createSmartAccountClient

1function createSmartAccountClient<TTransport, TChain, TAccount, TContext>(
2 config,
3): SmartAccountClient<TTransport, TChain, TAccount>;

Defined in: aa-sdk/core/src/client/smartAccountClient.ts:135

Type Parameters

Type ParameterDefault type

TTransport extends Transport

Transport

TChain extends undefined | Chain

undefined | Chain

TAccount extends | undefined | SmartContractAccount

| undefined | SmartContractAccount

TContext extends | undefined | UserOperationContext

| undefined | UserOperationContext

Parameters

ParameterTypeDescription

config

{ account?: TAccount; addBreadCrumb?: <T>(crumb) => T; cacheTime?: number; chain?: Chain | TChain; customMiddleware?: ClientMiddlewareFn<TContext>; dummyPaymasterAndData?: ClientMiddlewareFn<TContext>; feeEstimator?: ClientMiddlewareFn<TContext>; gasEstimator?: ClientMiddlewareFn<TContext>; key?: string; name?: string; opts?: { feeOptions?: { callGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; maxFeePerGas?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; maxPriorityFeePerGas?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; paymasterPostOpGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; paymasterVerificationGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; preVerificationGas?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; verificationGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; }; txMaxRetries?: number; txRetryIntervalMs?: number; txRetryMultiplier?: number; }; paymasterAndData?: ClientMiddlewareFn<TContext>; pollingInterval?: number; signUserOperation?: ClientMiddlewareFn<TContext>; transport: TTransport; type?: string; userOperationSimulator?: ClientMiddlewareFn<TContext>; }

The configuration for creating the smart account client

config.account?

TAccount

config.addBreadCrumb?

<T>(crumb) => T

A function that adds a breadcrumb to the current context Note, most implementations will override the client with the default alchemy transport and this leads to the fact that a transport could be overwritten and not known until later.

config.cacheTime?

number

Time (in ms) that cached data will remain in memory.

Default

1chain.blockTime / 3

config.chain?

Chain | TChain

Chain for the client.

config.customMiddleware?

ClientMiddlewareFn<TContext>

config.dummyPaymasterAndData?

ClientMiddlewareFn<TContext>

config.feeEstimator?

ClientMiddlewareFn<TContext>

config.gasEstimator?

ClientMiddlewareFn<TContext>

config.key?

string

A key for the client.

config.name?

string

A name for the client.

config.opts?

{ feeOptions?: { callGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; maxFeePerGas?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; maxPriorityFeePerGas?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; paymasterPostOpGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; paymasterVerificationGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; preVerificationGas?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; verificationGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; }; txMaxRetries?: number; txRetryIntervalMs?: number; txRetryMultiplier?: number; }

config.opts.feeOptions?

{ callGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; maxFeePerGas?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; maxPriorityFeePerGas?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; paymasterPostOpGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; paymasterVerificationGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; preVerificationGas?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; verificationGasLimit?: { max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }; }

Optional user operation fee options to be set globally at the provider level

config.opts.feeOptions.callGasLimit?

{ max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }

config.opts.feeOptions.callGasLimit.max?

number | bigint | `0x${string}`

config.opts.feeOptions.callGasLimit.min?

number | bigint | `0x${string}`

config.opts.feeOptions.callGasLimit.multiplier?

number

Multiplier value with max precision of 4 decimal places

config.opts.feeOptions.maxFeePerGas?

{ max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }

config.opts.feeOptions.maxFeePerGas.max?

number | bigint | `0x${string}`

config.opts.feeOptions.maxFeePerGas.min?

number | bigint | `0x${string}`

config.opts.feeOptions.maxFeePerGas.multiplier?

number

Multiplier value with max precision of 4 decimal places

config.opts.feeOptions.maxPriorityFeePerGas?

{ max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }

config.opts.feeOptions.maxPriorityFeePerGas.max?

number | bigint | `0x${string}`

config.opts.feeOptions.maxPriorityFeePerGas.min?

number | bigint | `0x${string}`

config.opts.feeOptions.maxPriorityFeePerGas.multiplier?

number

Multiplier value with max precision of 4 decimal places

config.opts.feeOptions.paymasterPostOpGasLimit?

{ max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }

config.opts.feeOptions.paymasterPostOpGasLimit.max?

number | bigint | `0x${string}`

config.opts.feeOptions.paymasterPostOpGasLimit.min?

number | bigint | `0x${string}`

config.opts.feeOptions.paymasterPostOpGasLimit.multiplier?

number

Multiplier value with max precision of 4 decimal places

config.opts.feeOptions.paymasterVerificationGasLimit?

{ max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }

config.opts.feeOptions.paymasterVerificationGasLimit.max?

number | bigint | `0x${string}`

config.opts.feeOptions.paymasterVerificationGasLimit.min?

number | bigint | `0x${string}`

config.opts.feeOptions.paymasterVerificationGasLimit.multiplier?

number

Multiplier value with max precision of 4 decimal places

config.opts.feeOptions.preVerificationGas?

{ max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }

config.opts.feeOptions.preVerificationGas.max?

number | bigint | `0x${string}`

config.opts.feeOptions.preVerificationGas.min?

number | bigint | `0x${string}`

config.opts.feeOptions.preVerificationGas.multiplier?

number

Multiplier value with max precision of 4 decimal places

config.opts.feeOptions.verificationGasLimit?

{ max?: number | bigint | `0x${string}`; min?: number | bigint | `0x${string}`; multiplier?: number; }

config.opts.feeOptions.verificationGasLimit.max?

number | bigint | `0x${string}`

config.opts.feeOptions.verificationGasLimit.min?

number | bigint | `0x${string}`

config.opts.feeOptions.verificationGasLimit.multiplier?

number

Multiplier value with max precision of 4 decimal places

config.opts.txMaxRetries?

number

The maximum number of times to try fetching a transaction receipt before giving up (default: 5)

config.opts.txRetryIntervalMs?

number

The interval in milliseconds to wait between retries while waiting for tx receipts (default: 2_000)

config.opts.txRetryMultiplier?

number

The multiplier on interval length to wait between retries while waiting for tx receipts (default: 1.5)

config.paymasterAndData?

ClientMiddlewareFn<TContext>

config.pollingInterval?

number

Frequency (in ms) for polling enabled actions & events.

Default

1chain.blockTime / 3

config.signUserOperation?

ClientMiddlewareFn<TContext>

config.transport

TTransport

The RPC transport

config.type?

string

The type of client.

config.userOperationSimulator?

ClientMiddlewareFn<TContext>

Returns

SmartAccountClient<TTransport, TChain, TAccount>

A smart account client capable of handling transactions, message signing, and other operations on a smart account