createLightAccountAlchemyClient
createLightAccountAlchemyClient
is a factory that improves the developer experience of connecting a Light Account to an AlchemySmartAccountClient
via an optional dependency on the @alchemy/aa-accounts
package. You can use this to directly instantiate an AlchemySmartAccountClient
already connected to a Light Account in one line of code.
Usage
import { createLightAccountAlchemyClient } from "@alchemy/aa-alchemy";
import { LocalAccountSigner, sepolia } from "@alchemy/aa-core";
export const smartAccountClient = await createLightAccountAlchemyClient({
apiKey: "YOUR_API_KEY",
chain: sepolia,
signer: LocalAccountSigner.mnemonicToAccountSigner("OWNER_MNEMONIC"),
});
Returns
Promise<AlchemySmartAccountClient>
A Promise
containing a new AlchemySmartAccountClient
connected to a Light Account.
Parameters
config: AlchemyLightAccountClientConfig
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.