@etherspot/remote-signer
Version:
Etherspot Permissioned Signer SDK - signs the UserOp with SessionKey and sends it to the Bundler
71 lines (68 loc) • 3.22 kB
text/typescript
import { TransactionDetailsForUserOp } from './TransactionDetailsForUserOp.mjs';
import { P as PaymasterAPI } from '../../PaymasterAPI-sOoROCL-.mjs';
import { B as BaseAccountUserOperationStruct, N as NotPromise, U as UserOperation, F as FeeData } from '../../ERC4337Utils-D4GRkIAr.mjs';
import { BigNumber, BigNumberish } from '../types/bignumber.mjs';
import { WalletClient, PublicClient, Account, TypedDataParameter } from 'viem';
import { GasOverheads } from './calcPreVerificationGas.mjs';
import { SdkOptions, Factory } from '../interfaces.mjs';
import { SignMessageDto } from '../dto/sign-message.dto.mjs';
import '../types/common-types.mjs';
import 'node_modules/viem/_types/errors/utils';
import '../bundler/interface.mjs';
interface BaseApiParams {
entryPointAddress: string;
etherspotWalletAddress?: string;
overheads?: Partial<GasOverheads>;
factoryAddress?: string;
sdkOptions?: SdkOptions;
walletClient?: WalletClient;
publicClient?: PublicClient;
externalViemAccount?: Account;
}
interface UserOpResult {
transactionHash: string;
success: boolean;
}
declare abstract class BaseAccountAPI {
private senderAddress;
private isPhantom;
overheads?: Partial<GasOverheads>;
entryPointAddress: string;
etherspotWalletAddress?: string;
paymasterAPI?: PaymasterAPI;
factoryUsed: Factory;
factoryAddress?: string;
externalViemAccount: Account;
walletClient: WalletClient;
publicClient: PublicClient;
constructor(params: BaseApiParams);
signMessage(dto: SignMessageDto): Promise<string>;
setPaymasterApi(paymaster: PaymasterAPI | null): Promise<void>;
require(options?: {
network?: boolean;
wallet?: boolean;
}): Promise<void>;
init(): Promise<this>;
protected abstract getAccountInitCode(): Promise<string>;
protected abstract getNonce(key?: BigNumber): Promise<BigNumber>;
protected abstract encodeExecute(target: string, value: BigNumberish, data: string): Promise<string>;
protected abstract encodeBatch(targets: string[], values: BigNumberish[], datas: string[]): Promise<string>;
checkAccountPhantom(): Promise<boolean>;
getCounterFactualAddress(): Promise<string>;
getInitCode(): Promise<string>;
getVerificationGasLimit(): Promise<BigNumberish>;
getPreVerificationGas(userOp: Partial<BaseAccountUserOperationStruct>): Promise<number>;
packUserOp(userOp: NotPromise<BaseAccountUserOperationStruct>): string;
encodeUserOpCallDataAndGasLimit(detailsForUserOp: TransactionDetailsForUserOp): Promise<{
callData: string;
callGasLimit: BigNumber;
}>;
getUserOpHash(userOp: UserOperation): Promise<string>;
getEtherspotWalletAddress(): Promise<string>;
estimateCreationGas(initCode?: string): Promise<BigNumberish>;
getViemFeeData(): Promise<FeeData>;
createUnsignedUserOp(info: TransactionDetailsForUserOp, key?: BigNumber): Promise<any>;
getUserOpReceipt(userOpHash: string, timeout?: number, interval?: number): Promise<string | null>;
signTypedData(domain: any, types: TypedDataParameter[], message: any): Promise<`0x${string}`>;
}
export { BaseAccountAPI, type BaseApiParams, type UserOpResult };