@etherspot/remote-signer
Version:
Etherspot Permissioned Signer SDK - signs the UserOp with SessionKey and sends it to the Bundler
96 lines (92 loc) • 4.46 kB
text/typescript
import { Address, LocalAccount, AccountSource, JsonRpcAccount, CustomSource, InvalidAddressErrorType, IsAddressErrorType, Hex } from 'viem';
import { BigNumberish, BigNumber } from './sdk/types/bignumber.mjs';
import { BytesLike } from './sdk/types/common-types.mjs';
import { ErrorType } from 'node_modules/viem/_types/errors/utils';
type AccountType = 'erc7579-implementation';
type PromiseOrValue<T> = T | Promise<T>;
type BaseAccountUserOperationStruct = {
sender: PromiseOrValue<string>;
nonce: PromiseOrValue<BigNumberish>;
initCode: PromiseOrValue<BytesLike>;
callData: PromiseOrValue<BytesLike>;
accountGasLimits: PromiseOrValue<BytesLike>;
preVerificationGas: PromiseOrValue<BigNumberish>;
gasFees: PromiseOrValue<BytesLike>;
paymasterAndData: PromiseOrValue<BytesLike>;
signature: PromiseOrValue<BytesLike>;
};
type UserOperationStruct = {
sender: PromiseOrValue<string>;
nonce: PromiseOrValue<BigNumberish>;
initCode: PromiseOrValue<BytesLike>;
callData: PromiseOrValue<BytesLike>;
callGasLimit: PromiseOrValue<BigNumberish>;
verificationGasLimit: PromiseOrValue<BigNumberish>;
preVerificationGas: PromiseOrValue<BigNumberish>;
maxFeePerGas: PromiseOrValue<BigNumberish>;
maxPriorityFeePerGas: PromiseOrValue<BigNumberish>;
paymasterAndData: PromiseOrValue<BytesLike>;
signature: PromiseOrValue<BytesLike>;
};
interface FeeData {
lastBaseFeePerGas: null | BigNumber;
maxFeePerGas: null | BigNumber;
maxPriorityFeePerGas: null | BigNumber;
gasPrice: null | BigNumber;
}
type ExtendedLocalAccount<source extends string = string, address extends Address = Address> = LocalAccount<source, address> & {
signUserOpWithRemoteSigner(userOp: UserOperation): Promise<UserOperation>;
};
type GetAccountReturnType<accountSource extends AccountSource> = (accountSource extends Address ? JsonRpcAccount : never) | (accountSource extends CustomSource ? LocalAccount : never);
type ToAccountErrorType = InvalidAddressErrorType | IsAddressErrorType | ErrorType;
type InitialModules = {
validators: Module[];
executors: Module[];
hooks: Module[];
fallbacks: Module[];
};
type ModuleType = 'validator' | 'executor' | 'fallback' | 'hook';
type Module = {
module: Address;
data?: Hex;
additionalContext?: Hex;
type: ModuleType;
};
type ModuleTypeIds = {
[index in ModuleType]: number;
};
declare const moduleTypeIds: ModuleTypeIds;
interface UserOperation {
sender: string;
nonce: BigNumberish;
factory?: string;
factoryData?: BytesLike;
callData: BytesLike;
callGasLimit: BigNumberish;
verificationGasLimit: BigNumberish;
preVerificationGas: BigNumberish;
maxFeePerGas: BigNumberish;
maxPriorityFeePerGas: BigNumberish;
paymaster?: string;
paymasterVerificationGasLimit?: BigNumberish;
paymasterPostOpGasLimit?: BigNumberish;
paymasterData?: BytesLike;
signature: BytesLike;
}
type NotPromise<T> = {
[P in keyof T]: Exclude<T[P], Promise<any>>;
};
declare function packUserOp(op1: UserOperation | NotPromise<BaseAccountUserOperationStruct>, forSignature?: boolean): string;
declare function packUint(high128: BigNumberish, low128: BigNumberish): string;
declare function packPaymasterData(paymaster: string, paymasterVerificationGasLimit: BigNumberish, postOpGasLimit: BigNumberish, paymasterData?: BytesLike): BytesLike;
declare function packUserOpData(op: any): NotPromise<BaseAccountUserOperationStruct>;
declare function getUserOpHash(op: UserOperation, entryPoint: string, chainId: number): string;
interface DecodedError {
message: string;
opIndex?: number;
}
declare function decodeErrorReason(error: string): DecodedError | undefined;
declare function rethrowError(e: any): any;
declare function deepHexlify(obj: any): any;
declare function resolveHexlify(a: any): any;
export { type AccountType as A, type BaseAccountUserOperationStruct as B, type ExtendedLocalAccount as E, type FeeData as F, type GetAccountReturnType as G, type InitialModules as I, type ModuleType as M, type NotPromise as N, type PromiseOrValue as P, type ToAccountErrorType as T, type UserOperation as U, packUint as a, packPaymasterData as b, packUserOpData as c, decodeErrorReason as d, deepHexlify as e, resolveHexlify as f, getUserOpHash as g, type UserOperationStruct as h, type Module as i, type ModuleTypeIds as j, moduleTypeIds as m, packUserOp as p, rethrowError as r };