### Install @account-kit/wallet-client Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/wallet-client/README.md Install the package using npm. ```bash npm i @account-kit/wallet-client ``` -------------------------------- ### Install @account-kit/smart-contracts Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/smart-contracts/README.md Install the package using npm. ```bash npm i @account-kit/smart-contracts ``` -------------------------------- ### Install Express Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-expo-example/README.md Install the Express.js framework, which might be used for backend services or local development setups. ```bash yarn add express ``` -------------------------------- ### Install iOS Pods Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-bare-example/README.md Navigate to the 'ios' directory and run 'pod install' to install necessary dependencies for iOS. Remember to return to the project root afterwards. ```bash # install pods (if necessary) cd ios pod install # Go back to the project root cd ../ ``` -------------------------------- ### Install @account-kit/core Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/core/README.md Use npm to install the @account-kit/core package. ```bash npm i @account-kit/core ``` -------------------------------- ### Install @account-kit/infra Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/infra/README.md Install the @account-kit/infra package using npm. ```bash npm i @account-kit/infra ``` -------------------------------- ### Start Development Server Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/ui-demo/README.md Navigate to the ui-demo directory and run this command to start the local development server. Open http://localhost:3000 in your browser. ```bash yarn dev ``` -------------------------------- ### Install @aa-sdk/core with npm Source: https://github.com/alchemyplatform/aa-sdk/blob/main/aa-sdk/core/README.md Install the core package using npm. ```bash npm i -s @aa-sdk/core ``` -------------------------------- ### Install @account-kit/react Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react/README.md Use this command to install the @account-kit/react package. Note that new integrations should use the beta @alchemy/wallet-apis package. ```bash npm i @account-kit/react ``` -------------------------------- ### Install Optional Solana Support Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/privy-integration/README.md For Solana features, install the @solana/web3.js library. This is optional and only for web. ```bash npm install @solana/web3.js # or yarn add @solana/web3.js # or pnpm add @solana/web3.js ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/ui-demo/README.md Run this command in the root /aa-sdk/ directory to install all necessary project dependencies. ```bash yarn install ``` -------------------------------- ### createConfig Usage Example Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/react/src/functions/createConfig.mdx An example demonstrating how to use the createConfig function with core and UI configurations. ```APIDOC ## Example Usage ```ts import { sepolia, alchemy } from "@account-kit/infra" import { AlchemyAccountsUIConfig, createConfig } from "@account-kit/react" import { QueryClient } from "@tanstack/react-query"; const uiConfig: AlchemyAccountsUIConfig = { illustrationStyle: "linear", auth: { sections: [[{ type: "email" }], [{ type: "passkey" }]], addPasskeyOnSignup: true, }, } const config = createConfig({ transport: alchemy({ apiKey: "your_api_key" }), chain: sepolia, ssr: true, sessionConfig: { expirationTimeMs: 1000 * 60 * 60, // 1 hour (defaults to 15 min) }, }, uiConfig) export const queryClient = new QueryClient(); ``` ``` -------------------------------- ### onInstall Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/variables/SessionKeyPluginAbi.mdx Handles the installation of the SessionKeyPlugin, potentially with initial configuration data. ```APIDOC ## POST /onInstall ### Description Handles the installation of the SessionKeyPlugin. ### Method POST ### Endpoint `/onInstall(bytes data)` ### Parameters #### Request Body - **data** (bytes) - Optional - Installation data. ### Response #### Success Response (200) - (empty) ``` -------------------------------- ### Install @aa-sdk/core with Yarn Source: https://github.com/alchemyplatform/aa-sdk/blob/main/aa-sdk/core/README.md Install the core package using Yarn. ```bash yarn add @aa-sdk/core ``` -------------------------------- ### Install @account-kit/react-native Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/react-native/README.md Use this command to install the React Native library for Account Kit. ```bash npm i @account-kit/react-native ``` -------------------------------- ### Install @aa-sdk/core with pnpm Source: https://github.com/alchemyplatform/aa-sdk/blob/main/aa-sdk/core/README.md Install the core package using pnpm. ```bash pnpm i @aa-sdk/core ``` -------------------------------- ### Install @aa-sdk/ethers with npm Source: https://github.com/alchemyplatform/aa-sdk/blob/main/aa-sdk/ethers/README.md Install the package using npm. ```bash npm i -s @aa-sdk/ethers ``` -------------------------------- ### Run Development Server Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/alchemy-privy-integration-example/README.md Start the development server using npm, yarn, or pnpm. ```bash npm run dev # or yarn dev # or pnpm dev ``` -------------------------------- ### Install @account-kit/react-native-signer Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/rn-signer/README.md Install the package using npm. ```sh npm install @account-kit/react-native-signer ``` -------------------------------- ### Install Dependencies Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/alchemy-privy-integration-example/README.md Install project dependencies using npm, yarn, or pnpm. ```bash npm install # or yarn install # or pnpm install ``` -------------------------------- ### ERC-7677 Middleware Setup Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/core/src/functions/erc7677Middleware.mdx Set up the ERC-7677 middleware for a smart account client. This example assumes the RPC provider supports ERC-7677 methods and does not require context. ```typescript import { createSmartAccountClient, erc7677Middleware, } from "@aa-sdk/core"; import { http } from "viem"; import { sepolia } from "viem/chains"; const client = createSmartAccountClient({ transport: http("rpc-url"), chain: sepolia, // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context ...erc7677Middleware(), }); ``` -------------------------------- ### Install @aa-sdk/ethers with pnpm Source: https://github.com/alchemyplatform/aa-sdk/blob/main/aa-sdk/ethers/README.md Install the package using pnpm. ```bash pnpm i @aa-sdk/ethers ``` -------------------------------- ### Install @aa-sdk/ethers with Yarn Source: https://github.com/alchemyplatform/aa-sdk/blob/main/aa-sdk/ethers/README.md Install the package using Yarn. ```bash yarn add @aa-sdk/ethers ``` -------------------------------- ### Run Docs Locally Source: https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md Start a local development server to preview documentation changes. ```bash yarn docs:dev ``` -------------------------------- ### Install Dependencies Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-bare-example/README.md Run this command from the root of the monorepo to install project dependencies. ```bash # Install Dependencies yarn install ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md Run this command in the project root to install all necessary dependencies using Yarn. ```bash yarn ``` -------------------------------- ### installExecution Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/variables/semiModularAccountBytecodeAbi.mdx Installs execution configurations for a module. ```APIDOC ## installExecution ### Description Installs execution configurations for a given module. ### Method `installExecution(address module, ExecutionManifest manifest, bytes moduleInstallData)` ### Parameters #### Path Parameters - **module** (address) - The address of the module. - **manifest** (ExecutionManifest) - The execution manifest. - **executionFunctions** (ManifestExecutionFunction[]) - An array of execution functions. - **executionHooks** (ManifestExecutionHook[]) - An array of execution hooks. - **interfaceIds** (bytes4[]) - An array of interface IDs. - **moduleInstallData** (bytes) - Data for installing the module. ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/alchemy-privy-integration-example/README.md Copy the example environment file and fill in your Privy and Alchemy credentials. ```bash cp .env.example .env.local ``` ```dotenv NEXT_PUBLIC_PRIVY_APP_ID=your-privy-app-id NEXT_PUBLIC_PRIVY_CLIENT_ID=your-privy-client-id NEXT_PUBLIC_ALCHEMY_API_KEY=your-alchemy-api-key NEXT_PUBLIC_ALCHEMY_POLICY_ID=your-gas-policy-id ``` -------------------------------- ### installPlugin Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/variables/UpgradeableModularAccountAbi.mdx Installs a new plugin to the modular account, requiring its address, manifest hash, installation data, and dependencies. ```APIDOC ## installPlugin ### Description Installs a plugin to the modular account. ### Parameters #### Path Parameters - **plugin** (address) - Required - The address of the plugin to install. - **manifestHash** (bytes32) - Required - The hash of the plugin's manifest. - **pluginInstallData** (bytes) - Required - The data required for plugin installation. - **dependencies** (FunctionReference[]) - Required - An array of function references representing plugin dependencies. ### State Mutability nonpayable ### Type function ``` -------------------------------- ### Install React Native (Expo) Package Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/privy-integration/README.md Install both @account-kit/privy-integration and @privy-io/expo for React Native (Expo) projects. ```bash npm install @account-kit/privy-integration @privy-io/expo # or yarn add @account-kit/privy-integration @privy-io/expo # or pnpm add @account-kit/privy-integration @privy-io/expo ``` -------------------------------- ### Get Help for Foundry Tools Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/ui-demo/contracts/README.md Access help documentation for Forge, Anvil, and Cast. ```shell $ forge --help ``` ```shell $ anvil --help ``` ```shell $ cast --help ``` -------------------------------- ### installPlugin Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/type-aliases/PluginManagerActions.mdx Installs a plugin to the smart contract account. This action is asynchronous and returns a promise that resolves with the user operation result. ```APIDOC ## installPlugin ### Description Installs a plugin to the smart contract account. ### Method (params) => Promise> ### Parameters - `params`: Parameters for the install plugin operation. ### Response - `Promise>`: A promise that resolves with the user operation result. ``` -------------------------------- ### Start iOS Application Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-bare-example/README.md Run this command from the root of your React Native project to build and launch the iOS application. ```bash # using npm ``` ```bash npm run ios # OR using Yarn ``` ```bash yarn ios ``` -------------------------------- ### Configuring Solana Connection with Auto-Detected Wallets Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/core/src/type-aliases/SolanaConnection.mdx Configure the Account Kit SDK to automatically detect and use installed Solana wallets. Ensure necessary wallet adapter packages are installed. ```typescript import { PhantomWalletAdapter, SolflareWalletAdapter } from "@solana/wallet-adapter-wallets"; // Auto-detect installed wallets const config = createConfig({ // ... other config solana: { connection: solanaConnection, adapters: "detect" } }); ``` -------------------------------- ### Start Local Anvil Node Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/ui-demo/contracts/README.md Launch a local Ethereum node for development and testing. ```shell $ anvil ``` -------------------------------- ### InstallSessionKeyPluginParams Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/type-aliases/InstallSessionKeyPluginParams.mdx Represents the parameters for installing a session key plugin. ```APIDOC ## Type: InstallSessionKeyPluginParams ### Description Defines the parameters for installing a session key plugin. ### Properties - **args** (Parameters[1]) - Required - The ABI encoded arguments for the session key plugin. - **dependencyOverrides?** (FunctionReference[]) - Optional - Overrides for plugin dependencies. - **pluginAddress?** (Address) - Optional - The address of the session key plugin. ``` -------------------------------- ### Initiate MFA Setup with AlchemySigner Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/BaseAlchemySigner.mdx Use `addMfa` to start the process of adding a new multi-factor authentication factor for the current user. The factor requires verification via `verifyMfa` to become active. Ensure a user is authenticated before calling this method. ```typescript import { AlchemyWebSigner } from "@account-kit/signer"; const signer = new AlchemyWebSigner({ client: { connection: { rpcUrl: "/api/rpc", }, iframeConfig: { iframeContainerId: "alchemy-signer-iframe-container", }, }, }); const result = await signer.addMfa({ multiFactorType: "totp" }); // Result contains multiFactorTotpUrl to display as QR code ``` -------------------------------- ### Install React Web Package Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/privy-integration/README.md Use npm, yarn, or pnpm to add the @account-kit/privy-integration package for React web applications. ```bash npm install @account-kit/privy-integration # or yarn add @account-kit/privy-integration # or pnpm add @account-kit/privy-integration ``` -------------------------------- ### Example Usage of installPlugin Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/functions/installPlugin.mdx Demonstrates how to use the installPlugin function with a client created by createModularAccountAlchemyClient. Ensure you provide the correct pluginAddress, manifestHash, and any required dependencies. ```typescript import { installPlugin, createModularAccountAlchemyClient } from "@account-kit/smart-contracts"; const client = createModularAccountAlchemyClient(...); const hash = await installPlugin(client, { pluginAddress: "0x...", manifestHash: "0x...", dependencies: [], // this is defined by the plugin you're installing }); ``` -------------------------------- ### Start Android Application Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-bare-example/README.md Run this command from the root of your React Native project to build and launch the Android application. ```bash # using npm ``` ```bash npm run android # OR using Yarn ``` ```bash yarn android ``` -------------------------------- ### Build SDK Docs Source: https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md Generate the SDK documentation for deployment or review. ```bash yarn docs:sdk ``` -------------------------------- ### Install Latest Expo and Enable New Architecture Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-expo-example/README.md Ensure you have the latest Expo version and that the new architecture is enabled in your project. ```bash yarn expo install expo@latest --fix ``` -------------------------------- ### Grant Permissions and Use Session Key Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/wallet-client/src/exports/functions/grantPermissions.mdx This example demonstrates how to create a session key, grant root permissions to it for a smart account, and then use these permissions to prepare and send calls signed by the session key. Ensure you have a client instance and have requested an account. ```typescript const sessionKey = LocalAccountSigner.generatePrivateKeySigner(); const account = await client.requestAccount(); const permissions = await client.grantPermissions({ account: account.address, expirySec: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour from now key: { publicKey: await sessionKey.getAddress(), type: "secp256k1", }, permissions: [{ type: "root" }], }); // Use the permissions to prepare a call const preparedCalls = await client.prepareCalls({ calls: [{ to: zeroAddress, value: "0x0" }], from: account.address, capabilities: { paymasterService: { policyId: "your-paymaster-policy-id", }, permissions, }, }); // Sign with the session key const signedCalls = await signPreparedCalls(sessionKey, preparedCalls); // Send the prepared call using the session key const result = await client.sendPreparedCalls({ ...signedCalls, capabilities: { permissions, }, }); ``` -------------------------------- ### Build the Project Source: https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md Execute this command to build the project before running tests or making changes. ```bash yarn build ``` -------------------------------- ### Install Crypto Shims Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-expo-example/README.md Install necessary shims for crypto libraries required for certain functionalities. ```bash yarn expo install node-libs-react-native crypto-browserify stream-browserify react-native-get-random-values ``` -------------------------------- ### installPlugin Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/functions/installPlugin.mdx Installs a plugin on a smart account via the client, sending the user operation with the appropriate parameters. It's recommended to use the installPlugin action returned from generated plugins. ```APIDOC ## installPlugin ### Description Installs a plugin on a smart account via the client, sending the user operation with the appropriate parameters. NOTE: it's recommended to just use the installPlugin action returned from generated plugins. ### Method Signature ```ts function installPlugin( client, params, ): Promise; ``` ### Parameters #### `client` - **Type**: `Client` - **Description**: The client configured to the smart account on which the plugin will be installed. #### `params` - **Type**: `InstallPluginParams` - **Description**: The parameters required to install the plugin, including overrides, context, and account information. ### Returns - **Type**: `Promise` - **Description**: A promise that resolves once the plugin installation operation is sent. ### Example ```ts import { installPlugin, createModularAccountAlchemyClient } from "@account-kit/smart-contracts"; const client = createModularAccountAlchemyClient(...); const hash = await installPlugin(client, { pluginAddress: "0x...", manifestHash: "0x...", dependencies: [], // this is defined by the plugin you're installing }); ``` ``` -------------------------------- ### Get Address with AlchemyServerSigner Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/AlchemyServerSigner.mdx Gets the address of the user from the signer client. Throws if the user cannot be retrieved. ```typescript getAddress(): Promise<`0x${string}`> ``` -------------------------------- ### Constructor Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/ethers/src/classes/EthersProviderAdapter.mdx Initializes the EthersProviderAdapter with account and chain configurations. ```APIDOC ## Constructor ### Description Configures and initializes the account provider based on the given options. ### Method ```ts new EthersProviderAdapter(opts: EthersProviderAdapterOpts) ``` ### Parameters - `opts` (EthersProviderAdapterOpts) - Required - The options for setting up the ethers provider adapter. ### Returns `EthersProviderAdapter` ### Example ```ts import { EthersProviderAdapter } from "@aa-sdk/ethers"; import { sepolia } from "@account-kit/infra"; import { createLightAccount } from "@account-kit/smart-contracts"; import { LocalAccountSigner } from "@aa-sdk/core"; import { http } from "viem"; const account = await createLightAccount({ transport: http("https://rpc.testnet.aepps.com"), chain: sepolia, signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()), }); const provider = new EthersProviderAdapter({ account, chain: sepolia, rpcProvider: "https://eth-sepolia.g.alchemy.com/v2/your-api-key", }); ``` ``` -------------------------------- ### createSmartAccountClientFromExisting Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/core/src/functions/createSmartAccountClientFromExisting.mdx Initializes a SmartAccountClient using an existing configuration. ```APIDOC ## createSmartAccountClientFromExisting ### Description Creates a smart account client from an existing BundlerClient configuration. ### Parameters #### Request Body - **config** (Omit<\{ account?: TAccount; addBreadCrumb?: (crumb) => T; customMiddleware?: [ClientMiddlewareFn]; dummyPaymasterAndData?: [ClientMiddlewareFn]; feeEstimator?: [ClientMiddlewareFn]; gasEstimator?: [ClientMiddlewareFn]; opts?: Object; paymasterAndData?: [ClientMiddlewareFn]; signUserOperation?: [ClientMiddlewareFn]; userOperationSimulator?: [ClientMiddlewareFn] \}, \"chain\" | \"transport\") & object** - Required - The configuration object which includes the client. ### Returns - **SmartAccountClient** - A smart account client created from the existing BundlerClient. ``` -------------------------------- ### Install Expo Router Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-expo-example/README.md Install Expo Router by following the official documentation. This is essential for navigation in your Expo app. ```bash yarn expo install expo-router ``` -------------------------------- ### Install Smart Wallets Packages Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-expo-example/README.md Add the required Smart Wallets packages to your project to enable smart contract wallet functionalities. ```bash yarn add @account-kit/react-native-signer @account-kit/signer @account-kit/smart-contracts @account-kit/infra ``` -------------------------------- ### Commit Message Format Example Source: https://github.com/alchemyplatform/aa-sdk/blob/main/CONTRIBUTING.md Examples of standardized commit messages, including feature additions and documentation updates. ```bash feat: add sanity check on provider connect for clearer error message (#181) ``` ```bash docs: add new section on gasless transactions (#189) ``` -------------------------------- ### initialize Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/variables/UpgradeableModularAccountAbi.mdx Initializes the modular account with a set of plugins and their corresponding initialization data. ```APIDOC ## initialize ### Description Initializes the modular account with plugins. ### Parameters #### Path Parameters - **plugins** (address[]) - Required - The addresses of the plugins to initialize. - **pluginInitData** (bytes) - Required - The initialization data for the plugins. ### State Mutability nonpayable ### Type function ``` -------------------------------- ### Get WebAuthn Attestation Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/AlchemySignerWebClient.mdx Protected method to get the WebAuthn attestation. It can accept optional options and user details for customization. ```typescript protected getWebAuthnAttestation(options?, userDetails?): Promise; ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/react-native-expo-example/README.md Create a `.env` file and add your Alchemy public API key and optionally your Paymaster Policy ID. ```bash EXPO_PUBLIC_API_KEY="" PAYMASTER_POLICY_ID="" ``` -------------------------------- ### stampWhoami Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/ServerSignerClient.mdx Generates a stamped whoami request for the current user. This request can then be used to call /signer/v1/whoami to get the user information. This is useful if you want to get the user information in a different context like a server. You can pass the stamped request to the server and then call our API to get the user information. Using this stamp is the most trusted way to get the user information since a stamp can only belong to the user who created it. ```APIDOC ## stampWhoami() ### Description Generates a stamped whoami request for the current user. This request can then be used to call /signer/v1/whoami to get the user information. This is useful if you want to get the user information in a different context like a server. You can pass the stamped request to the server and then call our API to get the user information. Using this stamp is the most trusted way to get the user information since a stamp can only belong to the user who created it. ### Returns `Promise` - a promise that resolves to the "whoami" information for the logged in user ### Throws if no organization ID is provided ``` -------------------------------- ### Get Default Account State Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/core/src/functions/defaultAccountState.mdx Import and use the defaultAccountState function to get the default state for a specific account type, such as 'LightAccount'. ```typescript import { defaultAccountState } from "@account-kit/core"; const defaultLightAccountState = defaultAccountState<"LightAccount">(); ``` -------------------------------- ### Get WebAuthn Attestation Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/BaseSignerClient.mdx Abstract method to get WebAuthn attestation. It can optionally accept overrides for credential creation options and user details. ```typescript abstract protected getWebAuthnAttestation(options?, userDetails?): Promise; ``` -------------------------------- ### Instantiate AccountSigner and Sign Message Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/ethers/src/classes/AccountSigner.mdx Demonstrates how to create an AccountSigner instance with a provider and account, and then use it to sign a message. Ensure you have the necessary imports and account setup before use. ```typescript import { AccountSigner, EthersProviderAdapter } from "@aa-sdk/ethers"; import { LocalAccountSigner } from "@aa-sdk/core"; import { sepolia } from "@account-kit/infra"; import { createLightAccount } from "@account-kit/smart-contracts"; import { http } from "viem"; const account = await createLightAccount({ transport: http("https://rpc.testnet.aepps.com"), chain: sepolia, signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()), }); const provider = new EthersProviderAdapter(); const signer = new AccountSigner(provider, account); const message = await signer.signMessage("hello"); ``` -------------------------------- ### Get OAuth Provider URL Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/ServerSignerClient.mdx Constructs the authentication URL for a selected OAuth provider. Ensure `initIframeStamper` is called to get the `turnkeyPublicKey` and that `oauthCallbackUrl` is set. ```typescript cosnt oauthParams = { authProviderId: "google", isCustomProvider: false, auth0Connection: undefined, scope: undefined, claims: undefined, mode: "redirect", redirectUrl: "https://your-url-path/oauth-return", expirationSeconds: 3000 }; const turnkeyPublicKey = await this.initIframeStamper(); const oauthCallbackUrl = this.oauthCallbackUrl; const oauthConfig = this.getOauthConfig() // Optional value for OauthConfig() const usesRelativeUrl = true // Optional value to determine if we use a relative (or absolute) url for the `redirect_url` const oauthProviderUrl = getOauthProviderUrl({ oauthParams, turnkeyPublicKey, oauthCallbackUrl }) ``` -------------------------------- ### Execute Token Swaps Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/privy-integration/README.md This section demonstrates how to use the `useAlchemyPrepareSwap` and `useAlchemySubmitSwap` hooks to facilitate token swaps. It covers preparing a swap by specifying either the exact amount to send or a minimum amount to receive, and then submitting the swap transaction. ```APIDOC ## Execute Token Swaps This section demonstrates how to use the `useAlchemyPrepareSwap` and `useAlchemySubmitSwap` hooks to facilitate token swaps. It covers preparing a swap by specifying either the exact amount to send or a minimum amount to receive, and then submitting the swap transaction. ### Hooks - `useAlchemyPrepareSwap()`: Prepares a token swap by fetching quotes and necessary data. - `useAlchemySubmitSwap()`: Submits the prepared swap transaction. ### Usage ```tsx import { useAlchemyPrepareSwap, useAlchemySubmitSwap, } from "@account-kit/privy-integration"; function SwapButton() { const { prepareSwap } = useAlchemyPrepareSwap(); const { submitSwap, isLoading } = useAlchemySubmitSwap(); const handleSwap = async () => { try { // Option A: Specify exact amount to swap FROM const preparedSwap = await prepareSwap({ fromToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // ETH toToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC fromAmount: "0xde0b6b3a7640000", // Swap exactly 1 ETH }); // Option B: Specify minimum amount to receive TO /* const preparedSwap = await prepareSwap({ fromToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // ETH toToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC minimumToAmount: "0x5f5e100", // Receive at least 100 USDC (6 decimals) }); */ console.log( "Quote expiry:", new Date(parseInt(preparedSwap.quote.expiry) * 1000), ); const result = await submitSwap(preparedSwap); console.log("Swap confirmed:", result.txnHash); } catch (err) { console.error("Swap failed:", err); } }; return ( ); } ``` ### Parameters for `prepareSwap` Either `fromAmount` or `minimumToAmount` must be provided. - **`fromToken`** (string) - Required - The token address to swap from. - **`toToken`** (string) - Required - The token address to swap to. - **`fromAmount`** (string) - Optional - The exact amount of `fromToken` to swap (in wei or token's base unit). - **`minimumToAmount`** (string) - Optional - The minimum amount of `toToken` to receive (in wei or token's base unit). ``` -------------------------------- ### Get Default Multi Owner Light Account Factory Address Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/functions/getDefaultMultiOwnerLightAccountFactoryAddress.mdx Use this function to get the default factory address for a MultiOwnerLightAccount. It requires a Chain object and the specific LightAccountVersion. ```typescript function getDefaultMultiOwnerLightAccountFactoryAddress(chain, version): any; ``` -------------------------------- ### Get Default Light Account Factory Address Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/functions/getDefaultLightAccountFactoryAddress.mdx Call this utility method with a Chain object to get the default factory address for a light account. Ensure the chain has an address currently deployed. ```typescript function getDefaultLightAccountFactoryAddress(chain, version): `0x${string}`; ``` -------------------------------- ### Start Metro Server (npm/Yarn) Source: https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/rn-signer/example/README.md Initiates the Metro bundler, which is essential for React Native development. Run this command from the root of your project. ```bash npm start ``` ```bash yarn start ``` -------------------------------- ### installValidation Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/variables/semiModularAccountBytecodeAbi.mdx Installs validation configurations. ```APIDOC ## installValidation ### Description Installs validation configurations, selectors, and hooks. ### Method `installValidation(ValidationConfig validationConfig, bytes4[] selectors, bytes installData, bytes[] hooks)` ### Parameters #### Path Parameters - **validationConfig** (ValidationConfig) - The validation configuration. - **selectors** (bytes4[]) - An array of selectors. - **installData** (bytes) - Data for installation. - **hooks** (bytes[]) - An array of hooks. ``` -------------------------------- ### Create a Light Account Client with Alchemy Transport Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/functions/createLightAccountClient.mdx This example demonstrates creating a light account client specifically for Alchemy's infrastructure. It utilizes the `alchemy` transport configuration and requires an API key. The return type will be an Alchemy-specific smart account client. ```typescript import { createLightAccountClient } from "@account-kit/smart-contracts"; import { sepolia, alchemy } from "@account-kit/infra"; import { LocalAccountSigner } from "@aa-sdk/core"; import { generatePrivateKey } from "viem"; const lightAlchemyAccountClient = await createLightAccountClient({ transport: alchemy({ apiKey: "your-api-key" }), chain: sepolia, signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()), }); ``` -------------------------------- ### `usePrepareCalls` Source: https://context7.com/alchemyplatform/aa-sdk/llms.txt Prepares a set of calls for a smart account, returning a signed payload that can be sent separately. Useful when you need user confirmation before submission. ```APIDOC ## `usePrepareCalls` — Prepare calls without sending Prepares a set of calls for a smart account, returning a signed payload that can be sent separately. Useful when you need user confirmation before submission. ### Parameters - `client`: The smart account client instance. ### Usage ```tsx import { usePrepareCalls, useSmartAccountClient, } from "@account-kit/react"; function PrepareDemo() { const { client } = useSmartAccountClient({}); const { prepareCallsAsync, preparedCalls, isPreparingCalls } = usePrepareCalls({ client }); const prepare = async () => { const prepared = await prepareCallsAsync({ calls: [{ to: "0xTarget", data: "0x", value: "0x0" }], }); console.log("Prepared call type:", prepared.type); // proceed to sign + send with useSendPreparedCalls }; return ( ); } ``` ``` -------------------------------- ### Get Entry Point Definition Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/core/src/functions/getEntryPoint.mdx Import and use the getEntryPoint function to retrieve the entry point definition for a chain. You can specify a version to get a specific entry point, or omit it to use the default version for the chain. ```typescript import { getEntryPoint } from "@aa-sdk/core"; import { sepolia } from "viem/chains"; const entryPoint060 = getEntryPoint(sepolia); const entryPoint070 = getEntryPoint(sepolia, { version: "0.7.0" }); ``` -------------------------------- ### Build Project with Forge Source: https://github.com/alchemyplatform/aa-sdk/blob/main/examples/ui-demo/contracts/README.md Use this command to compile your smart contracts. ```shell $ forge build ``` -------------------------------- ### getMfaStatus Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/BaseAlchemySigner.mdx Gets the current MFA status. ```APIDOC ## getMfaStatus() ### Description Gets the current MFA status. ### Example ```ts import { AlchemyWebSigner } from "@account-kit/signer"; const signer = new AlchemyWebSigner({ client: { connection: { rpcUrl: "/api/rpc", }, iframeConfig: { iframeContainerId: "alchemy-signer-iframe-container", }, }, }); const mfaStatus = signer.getMfaStatus(); if (mfaStatus === AlchemyMfaStatus.REQUIRED) { // Handle MFA requirement } ``` ### Returns - **object** - The current MFA status - **mfaFactorId?** (string) - Optional - **mfaRequired** (boolean) ``` -------------------------------- ### getMfaStatus() Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/AlchemyWebSigner.mdx Gets the current MFA status. ```APIDOC ## getMfaStatus() ### Description Gets the current MFA status. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Response #### Success Response (200) - **object** - The current MFA status - **mfaFactorId?** (string) - Optional - **mfaRequired** (boolean) - Required ### Request Example ```typescript import { AlchemyWebSigner } from "@account-kit/signer"; const signer = new AlchemyWebSigner({ client: { connection: { rpcUrl: "/api/rpc", }, iframeConfig: { iframeContainerId: "alchemy-signer-iframe-container", }, }, }); const mfaStatus = signer.getMfaStatus(); if (mfaStatus === AlchemyMfaStatus.REQUIRED) { // Handle MFA requirement } ``` ### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Constructor Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/BaseAlchemySigner.mdx Initializes an instance with the provided client and session configuration. This function sets up the internal store, initializes the session manager, registers listeners and initializes the session manager to manage session state. ```APIDOC ## Constructor ### Description Initializes an instance with the provided client and session configuration. This function sets up the internal store, initializes the session manager, registers listeners and initializes the session manager to manage session state. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **param0** (BaseAlchemySignerParams) - Required - Object containing the client and session configuration ### Returns - **BaseAlchemySigner** ``` -------------------------------- ### Extending Client with multiOwnerPluginActions Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/variables/multiOwnerPluginActions.mdx Demonstrates how to extend a smart account client with the `multiOwnerPluginActions`. This is the typical usage pattern after creating a smart account client. ```typescript import { multiOwnerPluginActions } from "@account-kit/smart-contracts"; import { createSmartAccountClient } from "@aa-sdk/core"; const client = createSmartAccountClient(...).extend(multiOwnerPluginActions); ``` -------------------------------- ### getSolanaConnection Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/core/src/README.mdx Used to get the connection for the id. ```APIDOC ## getSolanaConnection ### Description Used to get the connection for the Solana chain. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript getSolanaConnection() ``` ### Response #### Success Response - **connection** (object) - The connection object for the Solana chain. ``` -------------------------------- ### Create a Smart Wallet Client Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/wallet-client/src/exports/functions/createSmartWalletClient.mdx Use this function to initialize a smart wallet client. Ensure you have the necessary imports for LocalAccountSigner, alchemy, and the specific chain. ```typescript import { LocalAccountSigner } from "@aa-sdk/core"; import { alchemy, arbitrumSepolia } from "@account-kit/infra"; import { generatePrivateKey } from "viem/accounts"; import { createSmartWalletClient } from "@account-kit/wallet-client"; const signer = LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()); const transport = alchemy({ apiKey: "your-alchemy-api-key", }); const client = createSmartWalletClient({ transport, chain: arbitrumSepolia, signer, }); ``` -------------------------------- ### getChain Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/core/src/README.mdx Gets the currently active chain. ```APIDOC ## getChain ### Description Gets the currently active chain. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters None ### Request Example ```javascript getChain() ``` ### Response #### Success Response - **chain** (string) - The identifier of the currently active chain. ``` -------------------------------- ### getAddress() Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/signer/src/classes/AlchemyServerSigner.mdx Gets the address of the user from the signer client. ```APIDOC ## getAddress() ### Description Gets the address of the user from the signer client. ### Returns - Promise<`0x${string}`> - The address of the user ### Throws - If the user cannot be retrieved from the signer client ``` -------------------------------- ### getDepositInfo Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/core/src/variables/EntryPointAbi_v6.mdx Gets the deposit information for a given account. ```APIDOC ## function getDepositInfo(address account) ### Description Retrieves the deposit information for a specified account. This is a view function. ### Parameters #### Path Parameters - **account** (address) - The address of the account to retrieve deposit information for. ### Returns - **info** (struct IStakeManager.DepositInfo) - A structure containing the deposit details: - **deposit** (uint112): The amount deposited. - **staked** (bool): Indicates if the deposit is staked. - **stake** (uint112): The amount staked. - **unstakeDelaySec** (uint32): The delay in seconds before unstaking. - **withdrawTime** (uint48): The timestamp for withdrawal availability. ``` -------------------------------- ### getMAInitializationData Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/functions/getMAInitializationData.mdx Retrieves the initialization data for a multi-owner modular account. ```APIDOC ## getMAInitializationData ### Description Retrieves the initialization data for a multi-owner modular account. Throws an error if the client's chain is not found or if the multi-owner plugin address is not retrievable. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **params** (GetMAInitializationDataParams) - Required - the parameters for getting initialization data ### Request Example ```ts import { getMAInitializationData, } from "@account-kit/smart-contracts"; import { createSmartAccountClient, } from "@aa-sdk/core"; const client = createSmartAccountClient(...); const initializationData = await getMAInitializationData({ client, signerAddress: "0x...", // or array of signers }); ``` ### Response #### Success Response (200) - **UpgradeToData** - the initialization data required for upgrading to a multi-owner modular account #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Request Account with Default Parameters Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/wallet-client/src/exports/functions/requestAccount.mdx This example demonstrates how to request an account using default parameters with a local signer. Ensure you have a client instance and a signer configured. ```typescript const signer = LocalAccountSigner.privateKeyToAccountSigner("0x..."); const account = await client.requestAccount(signer); ``` -------------------------------- ### bundlerActions Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/core/src/README.mdx A viem client decorator that provides Bundler-specific actions. These actions include estimating gas for user operations, sending raw user operations, retrieving user operations by hash, getting supported entry points, and getting user operation receipts. ```APIDOC ## Variable: bundlerActions ### Description A viem client decorator that provides Bundler specific actions. These actions include estimating gas for user operations, sending raw user operations, retrieving user operations by hash, getting supported entry points, and getting user operation receipts. ### Usage ```javascript // Example usage (conceptual) import { createBundlerClient } from "@alchemy/aa-sdk-core"; const bundlerClient = createBundlerClient({ // ... bundler client config ... }); // Use bundlerActions via the client const gasEstimate = await bundlerClient.estimateUserOperationGas({ // ... user operation details ... }); ``` ``` -------------------------------- ### Build and Sign UserOperation from Transactions Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/core/src/functions/buildUserOperationFromTxs.mdx This example demonstrates how to build an unsigned UserOperation struct from an array of transaction requests and then sign it using the smart account client. It also shows how to send the signed UserOperation to a bundler. ```typescript import type { RpcTransactionRequest } from "viem"; import { smartAccountClient } from "./smartAccountClient"; const requests: RpcTransactionRequest[] = [ { from, to, data: encodeFunctionData({ abi: ContractABI.abi, functionName: "func", args: [arg1, arg2, ...], }), }, { from, to, data: encodeFunctionData({ abi: ContractABI.abi, functionName: "func", args: [arg1, arg2, ...], }), }, ]; const uoStruct = await smartAccountClient.buildUserOperationFromTxs({ requests, }); // signUserOperation signs the above unsigned user operation struct built // using the account connected to the smart account client const request = await smartAccountClient.signUserOperation({ uoStruct }); // You can use the BundlerAction `sendRawUserOperation` (packages/core/src/actions/bundler/sendRawUserOperation.ts) // to send the signed user operation request to the bundler, requesting the bundler to send the signed uo to the // EntryPoint contract pointed at by the entryPoint address parameter const entryPointAddress = client.account.getEntryPoint().address; const uoHash = await smartAccountClient.sendRawUserOperation({ request, entryPoint: entryPointAddress, }); ``` -------------------------------- ### getConnection Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/core/src/functions/getConnection.mdx Used to get the connection for the currently active chain. ```APIDOC ## getConnection(config: AlchemyAccountsConfig): Connection ### Description Used to get the connection for the currently active chain. ### Parameters #### Path Parameters - **config** (AlchemyAccountsConfig) - Required - the account config ### Request Example ```ts import { getConnection } from "@account-kit/core"; import { config } from "./config"; const connection = getConnection(config); ``` ### Response #### Success Response (200) - **connection** (Connection) - a connection object for the current active chain ``` -------------------------------- ### Initialize Smart Account Client with Default Fee Estimator Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/core/src/functions/defaultFeeEstimator.mdx Demonstrates how to initialize a smart account client using the defaultFeeEstimator. This middleware is responsible for estimating the maximum fee per gas and maximum priority fee per gas. ```typescript import { createSmartAccountClient, defaultFeeEstimator, createBundlerClient, } from "@aa-sdk/core"; const bundlerClient = createBundlerClient(...); // NOTE: this is already provided by the smart account client const client = createSmartAccountClient({ feeEstimator: defaultFeeEstimator(bundlerClient), ...otherParams }); ``` -------------------------------- ### Create a Multi-Owner Modular Account Client with Alchemy Transport Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/functions/createMultiOwnerModularAccountClient.mdx Initializes a multi-owner modular account client using Alchemy's transport and a specified chain. This example utilizes `alchemy` from `@account-kit/infra` for transport configuration and requires API key. The signer is created similarly to the HTTP transport example. ```typescript import { createMultiOwnerModularAccountClient } from "@account-kit/smart-contracts"; import { sepolia, alchemy } from "@account-kit/infra"; import { LocalAccountSigner } from "@aa-sdk/core"; import { generatePrivateKey } from "viem"; const alchemyAccountClient = await createMultiOwnerModularAccountClient({ transport: alchemy({ apiKey: "your-api-key" }), chain: sepolia, signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()), }); ``` -------------------------------- ### InstallMultisigPluginParams Type Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/type-aliases/InstallMultisigPluginParams.mdx Defines the structure for parameters used when installing a multisig plugin. ```APIDOC ## Type Definition: InstallMultisigPluginParams ### Description This type defines the parameters required for installing a multisig plugin. It includes the necessary arguments for encoding, optional dependency overrides, and an optional plugin address. ### Properties - **args** (Parameters[1]) - Required - The ABI encoded arguments for the installation. - **dependencyOverrides?** (FunctionReference[]) - Optional - An array of function references to override dependencies. - **pluginAddress?** (Address) - Optional - The specific address of the plugin to be installed. ``` -------------------------------- ### Create WebAuthn Account Client Example Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/aa-sdk/core/src/variables/webauthnGasEstimator.mdx Demonstrates how to create a SmartAccountClient using the webauthnGasEstimator middleware for a Modular Account V2 with WebAuthn. Ensure your configuration includes the necessary parameters for modular account creation and specifies the 'webauthn' mode. ```typescript import { webauthnGasEstimator, createSmartAccountClient, type SmartAccountClient, } from "@aa-sdk/core"; import { createModularAccountV2, type CreateModularAccountV2ClientParams, } from "@account-kit/smart-contracts"; const credential = { id: "credential-id", publicKey: "0x...", }; async function createWebauthnAccountClient( config: CreateModularAccountV2ClientParams, ): Promise { const webauthnAccount = await createModularAccountV2({ ...config, mode: "webauthn", credential, }); return createSmartAccountClient({ account: webAuthnAccount, gasEstimator: webauthnGasEstimator(config.gasEstimator), ...config, }); } ``` -------------------------------- ### getInstalledPlugins Source: https://github.com/alchemyplatform/aa-sdk/blob/main/docs/pages/reference/account-kit/smart-contracts/src/type-aliases/AccountLoupeActions.mdx Retrieves a list of addresses for all installed plugins on the smart contract account. ```APIDOC ## getInstalledPlugins ### Description Retrieves a list of addresses for all installed plugins on the smart contract account. ### Method `getInstalledPlugins(args: GetAccountParameter): Promise` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **args** (GetAccountParameter) - Required - The arguments for the function, including account context. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **readonly '0x${string}[]'** - An array of plugin addresses. #### Response Example ```json { "example": "response body" } ``` ```