Alchemy Smart Account Client
To create an AlchemySmartAccountClient
, you must provide a set of parameters detailed below. For Fraxtal, Fraxtal Testnet, Zora, and Zora Sepolia networks, apiKey
and jwt
provide an rpcUrl
from a RPC provider since Alchemy currently only supports Account Abstraction for these networks. Please refer to documentation from Frax and Zora about RPC options.
Usage
import { createAlchemySmartAccountClient } from "@alchemy/aa-alchemy";
import { getDefaultEntryPointAddress } from "@alchemy/aa-core";
import { sepolia } from "@alchemy/aa-core";
// instantiates using every possible parameter, as a reference
export const client = createAlchemySmartAccountClient({
/// REQUIRED ///
apiKey: "ALCHEMY_API_KEY", // replace with your Alchemy API Key
chain: sepolia,
/// OPTIONAL ///
opts: {
txMaxRetries: 10,
txRetryIntervalMs: 2_000,
txRetryMultiplier: 1.5,
minPriorityFeePerBid: 100_000_000n,
feeOpts: {
baseFeeBufferMultiplier: 1.5n,
maxPriorityFeeBufferMultiplier: 1.05,
preVerificationGasBufferMultiplier: 1.05,
},
},
// will simulate user operations before sending them to ensure they don't revert
useSimulation: true,
// if you want to use alchemy's gas manager
gasManagerConfig: {
policyId: "policy-id",
},
});
Returns
AlchemySmartAccountClient
A new instance of an AlchemySmartAccountClient
.
Parameters
config: AlchemySmartAccountClientConfig
rpcUrl: string | undefined | never
-- a JSON-RPC URL. This is required if there is noapiKey
.apiKey: string | undefined | never
-- an Alchemy API Key. This is required if there is norpcUrl
orjwt
.jwt: string | undefined | never
-- an Alchemy JWT (JSON web token). This is required if there is noapiKey
.useSimulation: boolean
-- [optional] -- whether or not to simulate User Operations before sending them to ensure they don't revertgasManagerConfig: AlchemyGasManagerConfig
-- [optional] if you want to use Alchemy's gas manager to sponsor gas.policyId: string
-- the policy id of the gas manager you want to use.gasEstimationOptions: AlchemyGasEstimationOptions
-- [optional] optional option configurable for the gas estimation portion of the Alchemy gas managerpaymasterAddress: Address
-- [optional] paymaster address to use for the gas estimation. If not provided, the default paymaster address for the chain will be used.dummyData: Hex
-- [optional] dummy paymaster data to use for the gas estimation. If not provided, the default dummy data string will be used.
...accountParams
: CreateLightAccountParams -- additional parameters to pass to thecreateLightAccount
....clientParams
-- [optional] additional parameters to pass to theSmartAccountClient
constructor.