### createMeeClient Example Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/client-creation.md Example of creating a MEE client with custom configurations, including multiple chain configurations and client options. ```APIDOC ## createMeeClient ### Description Creates a client for interacting with the MEE (Meta-transaction Execution Engine) service. ### Method `createMeeClient` ### Parameters - `account`: The multichain nexus account to use for the client. - `url`: (Optional) The URL for the MEE network. Defaults to the production URL. - `apiKey`: (Optional) The API key for authentication. Defaults to the Biconomy default. - `pollingInterval`: (Optional) The interval in milliseconds for polling. - `isDebugMode`: (Optional) A boolean to enable or disable debug mode. ### Return Type `Promise` — A client instance ready for MEE operations. ### Example Usage ```typescript import { createMeeClient, toMultichainNexusAccount, getMEEVersion, MEEVersion, getDefaultMEENetworkUrl, getDefaultMEENetworkApiKey } from "@biconomy/abstractjs"; import { base, optimism } from "viem/chains"; import { privateKeyToAccount } from "viem/accounts"; import { http } from "viem"; // First create a multichain account const signer = privateKeyToAccount(`0x${process.env.PRIVATE_KEY}`); const mcAccount = await toMultichainNexusAccount({ signer, chainConfigurations: [ { chain: base, transport: http(), version: getMEEVersion(MEEVersion.V2_0_0) }, { chain: optimism, transport: http(), version: getMEEVersion(MEEVersion.V2_0_0) } ] }); // Create MEE client with custom configuration const meeClient = await createMeeClient({ account: mcAccount, url: getDefaultMEENetworkUrl(false), // Production URL apiKey: getDefaultMEENetworkApiKey(false), pollingInterval: 500, isDebugMode: false }); // Client is ready to use const quote = await meeClient.getQuote({ instructions: [{ calls: [{ to: "0x...", value: 1n }], chainId: base.id }], feeToken: { address: "0x...", chainId: base.id } }); ``` ``` -------------------------------- ### Setup AbstractJS Project with Bun Source: https://github.com/bcnmy/abstractjs/blob/develop/README.md Installs project dependencies using Bun, ensuring lockfile integrity. This is a prerequisite for running tests. ```bash bun install --frozen-lockfile ``` -------------------------------- ### Install AbstractJS SDK Source: https://github.com/bcnmy/abstractjs/blob/develop/README.md Add the abstractjs package along with its dependencies using the Bun package manager. ```bash bun add @biconomy/abstractjs viem @rhinestone/module-sdk ``` -------------------------------- ### Example: Account Ownership Management Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Demonstrates how to retrieve current ownership details and add a new co-owner to an account on a specific chain. Requires the Abstract SDK to be initialized. ```typescript // Get current owner const ownership = await mcAccount.getOwnership(); console.log("Owners per chain:", ownership.owners); // Add a co-owner on specific chain const instructions = await mcAccount.addOwnership({ newOwner: "0x1234...", chainId: base.id }); ``` -------------------------------- ### Multi-Version Test Setup Source: https://github.com/bcnmy/abstractjs/blob/develop/src/sdk/integration-tests/mee-versions/README.md Sets up accounts and configurations for multi-version MEE integration tests. It initializes test accounts and prepares them for testing across different MEE versions. ```typescript import { setupMultiVersionAccounts } from "./setupMultiVersion" let accountConfigs: AccountConfig[] beforeAll(async () => { const network = await toNetwork("TESTNET_FROM_ENV_VARS") accountConfigs = await setupMultiVersionAccounts({ eoaAccount: network.account! }) }) // Tests iterate over all version configs for (const { name, version, mcNexus, meeClient } of accountConfigs) { describe(`${name}`, () => { test("should execute transaction", async () => { // Test logic }) }) } ``` -------------------------------- ### Catching Module Installation Error Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/errors.md Handle errors that occur when a validator or executor module cannot be installed. Verify the module address and initialization data are correct. ```typescript try { const validator = toValidator({ module: invalidModuleAddress, initData: "0x", walletClient }); const account = await toNexusAccount({ signer, chainConfiguration, validators: [validator] }); } catch (error) { if (error.message.includes("module") || error.message.includes("Module")) { console.error("Module installation failed:", error.message); // Verify module address and initData are correct } } ``` -------------------------------- ### Session Actions Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/modules.md Pre-defined session action configurations for common operations, simplifying the setup of smart and mee sessions. ```APIDOC ## Session Actions ### smartSessionActions / meeSessionActions Pre-defined session action configurations for common operations. **Import:** ```typescript import { smartSessionActions, meeSessionActions } from "@biconomy/abstractjs"; ``` ### Available Actions **smartSessionActions:** - `transferAction` — ERC20 token transfer - `nativeTransferAction` — Native token transfer - `swapAction` — Token swap operations - `stakeAction` — Staking operations - `approvalsAction` — Token approvals **meeSessionActions:** - `transferAction` — Multichain token transfer - `bridgeAction` — Cross-chain bridge operations - `composableAction` — Composable execution actions ### Example ```typescript import { smartSessionActions, toSmartSessionsModule } from "@biconomy/abstractjs"; const sessionValidator = await toSmartSessionsModule({ walletClient, chainId: base.id, actions: [smartSessionActions.transferAction] }); ``` ``` -------------------------------- ### getSafeQuote Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/mee-actions.md Gets a quote for using Gnosis Safe as a master account with Nexus. ```APIDOC ## getSafeQuote ### Description Gets a quote for using Gnosis Safe as a master account with Nexus. ### Parameters #### Query Parameters - **safeAddress** (Address) - Required - Address of the Gnosis Safe. - **instructions** (Instruction[]) - Required - Transaction instructions. - **feeToken** (FeeTokenInfo) - Required - Fee token. ### Return Type Quote with Safe-specific validation data. ``` -------------------------------- ### Get Default MEE Network API Key Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/configuration.md Retrieve the production or staging API key for the MEE network. Pass `true` to `isStaging` for the staging API key. ```typescript import { getDefaultMEENetworkApiKey } from "@biconomy/abstractjs"; const productionKey = getDefaultMEENetworkApiKey(false); // Production const stagingKey = getDefaultMEENetworkApiKey(true); // Staging ``` -------------------------------- ### Get Permit Quote Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/mee-actions.md Get a quote for a transaction using ERC20Permit for gas-efficient approvals. Supports an optional permit deadline. ```typescript async function getPermitQuote( params: GetPermitQuoteParams ): Promise ``` -------------------------------- ### Get Unified ERC20 Balance Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Gets the consolidated ERC20 token balance across all chains for a multichain account. Requires a MultichainToken object. ```typescript import { mcUSDC } from "@biconomy/abstractjs"; const balance = await mcAccount.getUnifiedERC20Balance(mcUSDC); console.log("Total USDC across all chains:", balance.totalBalance); console.log("Per-chain breakdown:", balance.balances); ``` -------------------------------- ### Basic AbstractJS SDK Usage Source: https://github.com/bcnmy/abstractjs/blob/develop/README.md Demonstrates setting up a multichain nexus account and creating an MEE client for transaction quoting and execution. Requires private key and chain configurations. ```typescript import { toMultichainNexusAccount, mcUSDC, createMeeClient, getMEEVersion, MEEVersion } from "@biconomy/abstractjs"; import { base, optimism } from "viem/chains"; import { privateKeyToAccount } from "viem/accounts"; import { http } from "viem"; const eoaAccount = privateKeyToAccount(`0x${process.env.PRIVATE_KEY}`) const mcNexus = await toMultichainNexusAccount({ signer: eoaAccount, chainConfigurations: [ { chain: base, transport: http(), version: getMEEVersion(MEEVersion.V2_1_0) }, { chain: optimism, transport: http(), version: getMEEVersion(MEEVersion.V2_1_0) } ] }) const meeClient = await createMeeClient({ account: mcNexus }) const quote = await meeClient.getQuote({ instructions: [{ calls: [{ to: "0x...", value: 1n, gasLimit: 100000n }], chainId: base.id }], feeToken: { address: mcUSDC.addressOn(base.id), chainId: base.id } }) // Execute the quote and get back a transaction hash // This sends the transaction to the network const { hash } = await meeClient.executeQuote({ quote }) ``` -------------------------------- ### Get Namespace Storage Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Retrieves the storage configuration for a given namespace. Requires a bigint namespace identifier. ```typescript async function getNamespaceStorage( namespace: bigint ): Promise ``` -------------------------------- ### Create MEE Client with Custom Configuration Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/client-creation.md Instantiate a MEE client with a pre-created multichain account and custom network configurations. Ensure all necessary imports are included. ```typescript import { createMeeClient, toMultichainNexusAccount, getMEEVersion, MEEVersion, getDefaultMEENetworkUrl, getDefaultMEENetworkApiKey } from "@biconomy/abstractjs"; import { base, optimism } from "viem/chains"; import { privateKeyToAccount } from "viem/accounts"; import { http } from "viem"; // First create a multichain account const signer = privateKeyToAccount(`0x${process.env.PRIVATE_KEY}`); const mcAccount = await toMultichainNexusAccount({ signer, chainConfigurations: [ { chain: base, transport: http(), version: getMEEVersion(MEEVersion.V2_0_0) }, { chain: optimism, transport: http(), version: getMEEVersion(MEEVersion.V2_0_0) } ] }); // Create MEE client with custom configuration const meeClient = await createMeeClient({ account: mcAccount, url: getDefaultMEENetworkUrl(false), // Production URL apiKey: getDefaultMEENetworkApiKey(false), pollingInterval: 500, isDebugMode: false }); // Client is ready to use const quote = await meeClient.getQuote({ instructions: [{ calls: [{ to: "0x...", value: 1n }], chainId: base.id }], feeToken: { address: "0x...", chainId: base.id } }); ``` -------------------------------- ### Get Gas Tank Balance Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Retrieves the current balance of the Gas Tank in wei. No parameters are required. ```typescript async function getGasTankBalance(): Promise ``` -------------------------------- ### Client Creation Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/GENERATION-SUMMARY.txt Functions for initializing and configuring the MEE client. ```APIDOC ## MEE Client Creation ### Description Functions to create and configure the MEE client, which is central to interacting with the AbstractJS SDK. ### Functions - `createMeeClient` ### Parameters - `CreateMeeClientParams`: An object containing parameters for client creation. See `types.md` for the full type definition and `configuration.md` for configuration options. ``` -------------------------------- ### Client Creation Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/README.md Functions to initialize various Biconomy clients for SDK operations. ```APIDOC ## Client Creation ### Description Functions to initialize different types of clients for interacting with Biconomy services. ### Functions - `createMeeClient()`: Initialize multichain execution client. - `createBicoBundlerClient()`: Setup ERC-4337 bundler. - `createBicoPaymasterClient()`: Setup gas sponsorship paymaster. - `createHttpClient()`: Low-level HTTP client factory. ``` -------------------------------- ### Get Gas Tank Address Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Retrieves the deployed Gas Tank contract address. No parameters are required. ```typescript async function getGasTankAddress(): Promise
``` -------------------------------- ### Import createMeeClient Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/client-creation.md Import the `createMeeClient` function from the `@biconomy/abstractjs` package to begin creating an MEE client. ```typescript import { createMeeClient } from "@biconomy/abstractjs"; ``` -------------------------------- ### Get Gas Tank Nonce Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Retrieves the current nonce value for the Gas Tank account. No parameters are required. ```typescript async function getGasTankNonce(): Promise ``` -------------------------------- ### buildDefaultInstructions Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/instruction-building.md Builds default transaction instructions from simple call parameters. This function takes an array of calls, each with a target address, call data, and an optional value, along with the chain ID, to construct a list of instructions. ```APIDOC ## buildDefaultInstructions ### Description Builds default transaction instructions from simple call parameters. ### Method ```typescript async function buildDefaultInstructions( params: BuildDefaultInstructionsParams ): Promise ``` ### Parameters #### Path Parameters - **calls** (`Call[]`) - Required - Array of transaction calls with target, data, and optional value. - **chainId** (`number`) - Required - Blockchain ID for execution. ### Return Type ```typescript Promise ``` Array of instructions ready for quote generation. ### Example ```typescript import { buildDefaultInstructions } from "@biconomy/abstractjs"; import { encodeFunctionData, parseEther } from "viem"; import { ERC20_ABI } from "@biconomy/abstractjs"; const instructions = await buildDefaultInstructions({ calls: [ { to: usdcAddress, data: encodeFunctionData({ abi: ERC20_ABI, functionName: "transfer", args: ["0x1234...", parseEther("100")] }) } ], chainId: base.id }); ``` ``` -------------------------------- ### Get Nexus Account Address Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Retrieves the deterministic address of a Nexus account before it is deployed. This is useful for pre-calculating addresses. ```typescript const address = await nexusAccount.getAddress(); console.log("Account will be deployed to:", address); ``` -------------------------------- ### Create Low-Level HTTP Client Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/client-creation.md Instantiate a low-level HTTP client for direct communication with Biconomy services. Provide the service URL, an API key, and optionally enable debug mode. ```typescript import { createHttpClient } from "@biconomy/abstractjs"; const client = createHttpClient( "https://network.biconomy.io/v1", "mee_3ZZmXCSod4xVXDRCZ5k5LTHg", false ); // Make requests directly const response = await client.request("/api/info"); ``` -------------------------------- ### Create and Deploy Gas Tank Account Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-creation.md Initializes a Gas Tank account using a signer and chain configuration, then deploys the Gas Tank contract. Ensure the GAS_TANK_PRIVATE_KEY environment variable is set. ```typescript import { toGasTankAccount, getMEEVersion, MEEVersion } from "@biconomy/abstractjs"; import { base } from "viem/chains"; import { privateKeyToAccount } from "viem/accounts"; import { http } from "viem"; const signer = privateKeyToAccount(`0x${process.env.GAS_TANK_PRIVATE_KEY}`); const gasTankAccount = await toGasTankAccount({ signer, chainConfiguration: { chain: base, transport: http(), version: getMEEVersion(MEEVersion.V2_0_0) } }); // Deploy the Gas Tank await gasTankAccount.deployGasTank(); // Get available balance const balance = await gasTankAccount.getGasTankBalance(); ``` -------------------------------- ### Build Native Token Transfer Instructions with AbstractJS Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/instruction-building.md Use to create instructions for transferring native tokens like ETH. Requires the recipient address, the amount in wei, and the target chain ID. Ensure `parseEther` is imported if specifying amounts in ether. ```typescript import { buildNativeTokenTransfer } from "@biconomy/abstractjs"; import { parseEther } from "viem"; const instructions = await buildNativeTokenTransfer({ to: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", amount: parseEther("1.5"), chainId: base.id }); ``` -------------------------------- ### Get On-Chain Quote Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/mee-actions.md Obtain a quote for a standard on-chain transaction. Requires transaction instructions and fee token configuration. ```typescript async function getOnChainQuote( params: GetOnChainQuoteParams ): Promise ``` -------------------------------- ### Get Default MEE Network URL Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/configuration.md Retrieve the production or staging URL for the MEE network. Pass `true` to `isStaging` for the staging URL. ```typescript import { getDefaultMEENetworkUrl } from "@biconomy/abstractjs"; const productionUrl = getDefaultMEENetworkUrl(false); // Production const stagingUrl = getDefaultMEENetworkUrl(true); // Staging ``` -------------------------------- ### buildWithdrawal Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/instruction-building.md Builds instructions for withdrawing funds from Gas Tank. ```APIDOC ## buildWithdrawal ### Description Builds instructions for withdrawing funds from Gas Tank. ### Signature ```typescript async function buildWithdrawal(params: WithdrawalParams): Promise ``` ### Parameters #### Path Parameters - **amount** (bigint) - Required - Amount to withdraw in wei. - **to** (Address) - Required - Recipient address. - **chainId** (number) - Required - Target blockchain. ### Return Type ```typescript Promise ``` ``` -------------------------------- ### mcDAI Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/constants.md DAI token deployed across multiple chains. Provides methods to get the address on a specific chain and lists supported chain IDs. ```APIDOC ## mcDAI DAI token deployed across multiple chains. ### Methods Same as mcUSDC ``` -------------------------------- ### Run All Integration Tests Source: https://github.com/bcnmy/abstractjs/blob/develop/src/sdk/integration-tests/mee-versions/README.md Execute all integration tests for MEE versions. This command is useful for a comprehensive check of all functionalities. ```bash bun run test integration-tests/mee-versions ``` -------------------------------- ### mcUSDT Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/constants.md USDT token deployed across multiple chains. Provides methods to get the address on a specific chain and lists supported chain IDs. ```APIDOC ## mcUSDT USDT token deployed across multiple chains. ### Methods Same as mcUSDC ``` -------------------------------- ### Build Transaction Instructions with `build` Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Use the `build` decorator to create transaction instructions, including bridging logic for cross-chain balance adjustments. It requires the amount, target token, and destination chain. ```typescript const instructions = await mcAccount.build({ amount: parseEther("100"), mcToken: mcUSDC, toChain: base }); ``` -------------------------------- ### mcUSDC Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/constants.md USDC token deployed across multiple chains. Provides methods to get the address on a specific chain and lists supported chain IDs. ```APIDOC ## mcUSDC USDC token deployed across multiple chains. ### Methods - `addressOn(chainId)` — Get USDC address on specific chain - `chainIds` — Array of supported chain IDs ### Common Addresses - Base (8453): `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` - Optimism (10): `0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85` - Arbitrum (42161): `0xAF88d065e77c8cC2239327C5EDb3A432268e5831` - Ethereum (1): `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 ### Usage ```typescript import { mcUSDC } from "@biconomy/abstractjs"; import { base, optimism } from "viem/chains"; const baseUSDC = mcUSDC.addressOn(base.id); const opUSDC = mcUSDC.addressOn(optimism.id); const balance = await mcAccount.getUnifiedERC20Balance(mcUSDC); ``` ``` -------------------------------- ### buildBatch Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/instruction-building.md Combines multiple instructions into a single batched execution, allowing for multiple operations within one transaction. ```APIDOC ## buildBatch ### Description Combines multiple instructions into a single batched execution. ### Method ```typescript async function buildBatch( params: BatchParams ): Promise ``` ### Parameters #### Path Parameters - **calls** (Call[]) - Required - Multiple calls to execute in one batch. - **chainId** (number) - Required - Target blockchain. ### Response #### Success Response - **Promise** ### Example ```typescript import { buildBatch, buildApprove, buildTransfer } from "@biconomy/abstractjs"; import { encodeFunctionData } from "viem"; // Approve and transfer in one transaction const calls: Call[] = [ // Approve router to spend USDC { to: usdcAddress, data: encodeFunctionData({ abi: ERC20_ABI, functionName: "approve", args: [swapRouterAddress, MaxUint256] }) }, // Execute swap { to: swapRouterAddress, data: encodeFunctionData({ abi: SWAP_ROUTER_ABI, functionName: "exactInputSingle", args: [swapParams] }) } ]; const instructions = await buildBatch({ calls, chainId: base.id }); ``` ``` -------------------------------- ### Create MEE Client Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/client-creation.md Instantiate an MEE client by calling `createMeeClient` with the necessary parameters, such as the multichain account. This client is essential for executing supertransactions. ```typescript const meeClient = await createMeeClient({ account: smartAccount }); ``` -------------------------------- ### Get Multichain Token Address Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/constants.md Retrieve the address of a multichain token on a specific chain. Used to fetch token balances or interact with token contracts. ```typescript const mcUSDC: MultichainToken ``` ```typescript import { mcUSDC } from "@biconomy/abstractjs"; import { base, optimism } from "viem/chains"; const baseUSDC = mcUSDC.addressOn(base.id); const opUSDC = mcUSDC.addressOn(optimism.id); const balance = await mcAccount.getUnifiedERC20Balance(mcUSDC); ``` -------------------------------- ### createHttpClient Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/client-creation.md Low-level HTTP client factory for direct communication with MEE and other Biconomy services. This client allows making direct requests and extending functionality. ```APIDOC ## createHttpClient ### Description Low-level HTTP client factory for direct communication with MEE and other Biconomy services. ### Signature ```typescript function createHttpClient( url: string, apiKey: string, isDebugMode?: boolean ): HttpClient ``` ### Parameters #### Path Parameters - **url** (string) - Required - Base URL for the HTTP service. - **apiKey** (string) - Required - API key for authentication. - **isDebugMode** (boolean) - Optional - Enable debug logging. Defaults to `false`. ### Return Type ```typescript type HttpClient = { request(url: string, options?: RequestInit): Promise extend>( actions: (client: HttpClient) => T ): HttpClient & T } ``` ### Example Usage ```typescript import { createHttpClient } from "@biconomy/abstractjs"; const client = createHttpClient( "https://network.biconomy.io/v1", "mee_3ZZmXCSod4xVXDRCZ5k5LTHg", false ); // Make requests directly const response = await client.request("/api/info"); ``` ``` -------------------------------- ### Get Default MEE Network API Key Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/constants.md Returns the API key for MEE network authentication. The key varies between production and staging environments. ```typescript function getDefaultMEENetworkApiKey(isStaging?: boolean): string ``` ```typescript "mee_3ZZmXCSod4xVXDRCZ5k5LTHg" ``` ```typescript "mee_3ZhZhHx3hmKrBQxacr283dHt" ``` -------------------------------- ### Create BicoBundlerClient Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/client-creation.md Instantiate a client for interacting with Biconomy's ERC-4337 bundler service. This client is used for submitting user operations and checking bundler status. ```typescript import { createBicoBundlerClient } from "@biconomy/abstractjs"; import { base } from "viem/chains"; import { http } from "viem"; const bundlerClient = await createBicoBundlerClient({ chain: base, transport: http() }); ``` -------------------------------- ### Multichain Token Constants Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/configuration.md Imports and uses pre-configured multichain token constants to get token addresses on specific chains. Requires importing from '@biconomy/abstractjs'. ```typescript import { mcUSDC, mcUSDT, mcDAI } from "@biconomy/abstractjs"; // Returns token object with addressOn() method const baseUSDC = mcUSDC.addressOn(base.id); const opUSDC = mcUSDC.addressOn(optimism.id); ``` -------------------------------- ### Configuration Options Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/GENERATION-SUMMARY.txt Details on various configuration parameters for the MEE client and account management. ```APIDOC ## Configuration Options ### Description This section outlines the various configuration parameters available for the MEE client, account creation, chain settings, and module configurations. ### MEE Client Configuration - `timeout` (number) - `retryCount` (number) - `apiKey` (string) ### Account Creation Options - `chainIds` (number[]) - `signer` (Signer) - `factoryAddress` (string) ### Chain Configuration - `rpcUrl` (string) - ` சேன்Id` (number) - `nativeToken` (string) ### Module Configuration - `moduleAddress` (string) - `version` (string) - `dependencies` (string[]) ### Gas and Fee Settings - `gasLimit` (number) - `maxFeePerGas` (number) - `maxPriorityFeePerGas` (number) ### Session Configuration - `mode` (SmartSessionMode) - `validUntil` (number) - `signature` (string) ### Supported Chains and Tokens - Information on supported blockchain networks and token standards. ``` -------------------------------- ### Get MEE Version Configuration Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/modules.md Retrieves the complete configuration for a specific Modular Execution Environment (MEE) version. This includes addresses for factories, implementations, validators, and more. ```typescript import { getMEEVersion, MEEVersion } from "@biconomy/abstractjs"; const config = getMEEVersion(MEEVersion.V2_0_0); console.log("Nexus implementation:", config.implementationAddress); console.log("Validator:", config.validatorAddress); ``` -------------------------------- ### Default Configurations by MEE Version Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/constants.md Provides complete configurations for each MEE version, including contract addresses for factories, validators, and other essential modules. ```typescript const DEFAULT_CONFIGURATIONS_BY_MEE_VERSION: Record ``` ```typescript import { DEFAULT_CONFIGURATIONS_BY_MEE_VERSION, MEEVersion } from "@biconomy/abstractjs"; const v200Config = DEFAULT_CONFIGURATIONS_BY_MEE_VERSION[MEEVersion.V2_0_0]; console.log("Factory:", v200Config.factoryAddress); console.log("Implementation:", v200Config.implementationAddress); const v300Config = DEFAULT_CONFIGURATIONS_BY_MEE_VERSION[MEEVersion.V3_0_0]; console.log("STX Validator:", v300Config.submodules?.EoaStatelessValidator); ``` -------------------------------- ### buildApprove Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/instruction-building.md Builds instructions for approving ERC20 token spending. This function allows you to generate instructions to grant an allowance to a spender for a specified amount of tokens. ```APIDOC ## buildApprove ### Description Builds instructions for approving ERC20 token spending. ### Signature ```typescript async function buildApprove( params: ApproveParams ): Promise ``` ### Parameters #### Path Parameters * **token** (`Address`) - Required - ERC20 token contract address. * **spender** (`Address`) - Required - Address authorized to spend tokens. * **amount** (`bigint`) - Required - Maximum amount to approve. * **chainId** (`number`) - Required - Target blockchain. ### Return Type ```typescript Promise ``` ### Example ```typescript import { buildApprove } from "@biconomy/abstractjs"; import { MaxUint256 } from "ethers"; const instructions = await buildApprove({ token: usdcAddress, spender: swapRouterAddress, amount: MaxUint256, chainId: base.id }); ``` ``` -------------------------------- ### Get Nonce With Key Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Retrieves the nonce associated with a specific validation mode or module. Allows specifying a custom nonce key, validation mode, or module address. ```typescript const nonceInfo = await getNonceWithKey({ key: 1n, validationMode: "0x01", moduleAddress: "0x..." }); ``` -------------------------------- ### batchInstructions Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/instruction-building.md Combines multiple instruction arrays into a single batched execution. ```APIDOC ## batchInstructions ### Description Combines multiple instruction arrays into a single batched execution. ### Signature ```typescript function batchInstructions( instructions: Instruction[][], strategy?: BatchStrategy ): Instruction[] ``` ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | instructions | `Instruction[][]` | ✓ | Multiple instruction arrays to batch. | | strategy | `"sequential" | "parallel"` | ✗ | Execution strategy. Defaults to sequential. | ### Return Type ```typescript Instruction[] ``` ``` -------------------------------- ### Get Fusion Quote Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/mee-actions.md Retrieves a fusion quote. Automatically selects between permit and on-chain modes based on token and network capabilities. Defaults to preferring permit mode. ```typescript async function getFusionQuote( params: GetFusionQuoteParams ): Promise ``` -------------------------------- ### Account Creation Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/GENERATION-SUMMARY.txt Functions for creating and managing accounts within the AbstractJS SDK. ```APIDOC ## Account Creation Functions ### Description Provides functionalities to create and manage user accounts, including different account types like NexusAccount and MultichainSmartAccount. ### Functions - `createNexusAccount` - `createMultichainSmartAccount` - `getAccount` ### Parameters Refer to `configuration.md` for detailed account creation options and `types.md` for account type definitions. ``` -------------------------------- ### Import createConditionInputParam Utility Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/modules.md Import the createConditionInputParam utility for creating input parameters for condition evaluation. ```typescript import { createConditionInputParam } from "@biconomy/abstractjs"; ``` -------------------------------- ### getNonceWithKey Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Retrieves the nonce associated with a specific validation mode or module. It allows specifying a nonce key, validation mode, or module address to get the corresponding nonce information. ```APIDOC ## getNonceWithKey Retrieves the nonce associated with a specific validation mode or module. ### Parameters #### Query Parameters - **key** (bigint) - Optional - Specific nonce key. Uses default if omitted. - **validationMode** ("0x00" | "0x01" | "0x02") - Optional - Validation mode for nonce retrieval. - **moduleAddress** (Address) - Optional - Module-specific nonce. ### Return Type ```typescript type NonceInfo = { nonceKey: bigint nonce: bigint } ``` ``` -------------------------------- ### Build Default Instructions with AbstractJS Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/instruction-building.md Use to construct default transaction instructions from a list of calls. Requires specifying target addresses, call data, and the chain ID. Ensure necessary imports like `encodeFunctionData` and `parseEther` are available. ```typescript import { buildDefaultInstructions } from "@biconomy/abstractjs"; import { encodeFunctionData, parseEther } from "viem"; import { ERC20_ABI } from "@biconomy/abstractjs"; const instructions = await buildDefaultInstructions({ calls: [ { to: usdcAddress, data: encodeFunctionData({ abi: ERC20_ABI, functionName: "transfer", args: ["0x1234...", parseEther("100")] }) } ], chainId: base.id }); ``` -------------------------------- ### Account Creation Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/README.md Functions for creating different types of smart accounts. ```APIDOC ## Account Creation ### Description Functions for creating single-chain, multichain, and transaction sponsorship smart accounts. ### Functions - `toNexusAccount()`: Create single-chain smart accounts. - `toMultichainNexusAccount()`: Create accounts across multiple blockchains. - `toGasTankAccount()`: Setup transaction sponsorship accounts. ``` -------------------------------- ### Execute Combined MEE Action Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/mee-actions.md A convenience method that combines getting a quote, signing it, and executing the signed quote in a single call. Use this for a streamlined transaction submission process. ```typescript const result = await meeClient.execute({ instructions: [{ calls: [{ to: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", data: "0x...", value: 0n }], chainId: base.id }], feeToken: { address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", chainId: base.id } }); ``` -------------------------------- ### buildMultichainInstructions Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/instruction-building.md Builds instructions for cross-chain multichain execution. This function facilitates the creation of instructions for executing calls across multiple blockchains. ```APIDOC ## buildMultichainInstructions ### Description Builds instructions for cross-chain multichain execution. ### Signature ```typescript async function buildMultichainInstructions( params: BuildMultichainParams ): Promise ``` ### Parameters #### Path Parameters - **calls** (MultiChainCall[]) - Required - Array of calls with associated chain IDs. - **broadcastChainId** (number) - Required - Chain ID for broadcasting the supertransaction. ### Return Type ```typescript Promise ``` ### Example ```typescript import { buildMultichainInstructions } from "@biconomy/abstractjs"; const instructions = await buildMultichainInstructions({ calls: [ { chainId: base.id, to: usdcAddress, data: encodeFunctionData({ abi: ERC20_ABI, functionName: "transfer", args: ["0x1234...", parseUnits("50", 6)] }) }, { chainId: optimism.id, to: usdcAddress, data: encodeFunctionData({ abi: ERC20_ABI, functionName: "transfer", args: ["0x5678...", parseUnits("50", 6)] }) } ], broadcastChainId: base.id }); ``` ``` -------------------------------- ### MultichainToken Type Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/types.md Defines a token that is deployed on multiple blockchain networks. Use `addressOn(chainId)` to get the token's address for a specific chain and `chainIds` to see supported chains. ```typescript type MultichainToken = MultichainContract ``` -------------------------------- ### Enable MEE Client Debug Logging Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/errors.md Create an MEE client instance with debug mode enabled to activate comprehensive logging. This allows monitoring of MEE node information, supported chains, and tokens, as well as deployed account addresses for diagnostic purposes. ```typescript // Create client with debug mode const meeClient = await createMeeClient({ account: mcAccount, isDebugMode: true // Enables detailed logging }); // Monitor MEE info for diagnostics console.log("MEE Node Info:", meeClient.info); console.log("Supported Chains:", meeClient.info.supportedChains); console.log("Supported Tokens:", meeClient.info.supportedTokens); // Check account deployments mcAccount.deployments.forEach(deployment => { console.log(`Deployed on ${deployment.chain.name}:`, deployment.getAddress()); }); ``` -------------------------------- ### MeeClient Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/types.md The MeeClient is an extended HTTP client that provides MEE-specific transaction methods. It includes functionalities for getting, signing, and executing quotes, as well as managing sessions and retrieving transaction receipts. ```APIDOC ## MeeClient ### Description Extended HTTP client with MEE-specific transaction methods. ### Type Definition ```typescript type MeeClient = HttpClient & { pollingInterval: number account: MultichainSmartAccount info: GetInfoPayload // Quote and execution methods getQuote(params: GetQuoteParams): Promise signQuote(params: SignQuoteParams): Promise executeSignedQuote(params: ExecuteSignedQuoteParams): Promise execute(params: GetQuoteParams): Promise executeQuote(params: SignQuoteParams): Promise // Quote variants getOnChainQuote(params: GetOnChainQuoteParams): Promise getPermitQuote(params: GetPermitQuoteParams): Promise signPermitQuote(params: SignPermitQuoteParams): Promise getFusionQuote(params: GetFusionQuoteParams): Promise signFusionQuote(params: SignFusionQuoteParameters): Promise executeFusionQuote(params: ExecuteFusionQuoteParams): Promise // Safe support getSafeQuote(params: GetSafeQuoteParams): Promise signSafeQuote(params: SignSafeQuoteParams): Promise // Session management getSessionQuote(params: T): Promise> signSessionQuote(params: SignSessionQuoteParams): Promise executeSessionQuote(params: SignSessionQuoteParams): Promise // Receipt methods waitForSupertransactionReceipt(params: WaitForSupertransactionReceiptParams): Promise getSupertransactionReceipt(params: GetSupertransactionReceiptParams): Promise // Token methods getGasToken(params: GetGasTokenParams): Promise getSupportedFeeToken(params: T): Promise } ``` ``` -------------------------------- ### Get Default MEE Gas Tank Configuration Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/configuration.md Retrieve the default Gas Tank configuration for sponsorship on production or testnet. The configuration includes the Gas Tank address, token, and chain ID. ```typescript import { getDefaultMeeGasTank } from "@biconomy/abstractjs"; const gasTank = getDefaultMeeGasTank(false); // Production // Returns: { // address: "0x18eAc826f3dD77d065E75E285d3456B751AC80d5", // token: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // chainId: 8453 // Base mainnet // } const testnetGasTank = getDefaultMeeGasTank(true); // Testnet // Returns: { // address: "0x18eAc826f3dD77d065E75E285d3456B751AC80d5", // token: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", // chainId: 84532 // Base Sepolia // } ``` -------------------------------- ### Run AbstractJS Tests Source: https://github.com/bcnmy/abstractjs/blob/develop/README.md Executes all project tests using the Bun test runner. For selective testing, use the '-t' flag with a test description. ```bash bun run test ``` ```bash bun run test:watch -t=mee ``` -------------------------------- ### Get Default Mee Gas Tank Configuration Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/constants.md A helper function to retrieve the appropriate Gas Tank configuration for either production or testnet environments. It returns an object containing the paymaster address, token address, and chain ID. ```typescript function getDefaultMeeGasTank(isTestnet?: boolean): { address: Address token: Address chainId: number } ``` ```typescript import { getDefaultMeeGasTank } from "@biconomy/abstractjs"; // Production configuration const prodGasTank = getDefaultMeeGasTank(false); // Returns: // { // address: "0x18eAc826f3dD77d065E75E285d3456B751AC80d5", // token: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // chainId: 8453 // } // Testnet configuration const testGasTank = getDefaultMeeGasTank(true); // Returns: // { // address: "0x18eAc826f3dD77d065E75E285d3456B751AC80d5", // token: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", // chainId: 84532 // } ``` -------------------------------- ### Build Composable Instructions with Runtime Values Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/instruction-building.md Use runtime value functions to dynamically inject token balances or nonces at execution time when building composable instructions. Ensure necessary imports are included. ```typescript import { buildComposable, runtimeNativeBalanceOf, runtimeERC20BalanceOf } from "@biconomy/abstractjs"; const instructions = await buildComposable({ calls: [ { target: swapRouter, callData: swapCallData, value: runtimeNativeBalanceOf({ account: nexusAddress }) }, { target: usdcAddress, callData: transferCallData, value: runtimeERC20BalanceOf({ token: usdcAddress, account: nexusAddress }) } ], chainId: base.id }); ``` -------------------------------- ### createBicoBundlerClient Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/client-creation.md Creates a client for interacting with Biconomy's ERC-4337 bundler service for submitting user operations. ```APIDOC ## createBicoBundlerClient ### Description Creates a client for interacting with Biconomy's ERC-4337 bundler service for submitting user operations. ### Method `createBicoBundlerClient` ### Parameters - **chain** (`Chain`) - Required - The blockchain network for bundler operations. - **transport** (`ClientConfig["transport"]`) - Required - Viem transport configuration (http, webSocket, etc.). - **url** (`string`) - Optional - Custom bundler service URL. Defaults to Biconomy default. - **apiKey** (`string`) - Optional - API key for bundler authentication. Defaults to Biconomy default. ### Return Type `Promise` — A client for submitting user operations and checking bundler status. ### Example Usage ```typescript import { createBicoBundlerClient } from "@biconomy/abstractjs"; import { base } from "viem/chains"; import { http } from "viem"; const bundlerClient = await createBicoBundlerClient({ chain: base, transport: http() }); ``` ``` -------------------------------- ### Build Bridge Instructions Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Constructs the necessary instructions for executing a cross-chain bridge transaction. Requires parameters like amount, token, and chain IDs. An optional bridge route can be specified. ```typescript async function buildBridgeInstructions( params: MultichainBridgingParams ): Promise ``` -------------------------------- ### createBicoPaymasterClient Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/client-creation.md Creates a client for interacting with Biconomy's gas sponsorship paymaster service. This client can be used to retrieve sponsorship quotes and sponsor transactions. ```APIDOC ## createBicoPaymasterClient ### Description Creates a client for interacting with Biconomy's gas sponsorship paymaster service. ### Signature ```typescript async function createBicoPaymasterClient( params: CreatePaymasterClientParams ): Promise ``` ### Parameters #### Path Parameters - **chain** (Chain) - Required - The blockchain network for paymaster operations. - **transport** (ClientConfig["transport"]) - Required - Viem transport configuration. - **url** (string) - Optional - Custom paymaster service URL. Defaults to Biconomy default. - **apiKey** (string) - Optional - API key for paymaster authentication. Defaults to Biconomy default. ### Return Type `Promise` — A client for retrieving sponsorship quotes and sponsoring transactions. ### Example Usage ```typescript import { createBicoPaymasterClient } from "@biconomy/abstractjs"; import { base } from "viem/chains"; import { http } from "viem"; const paymasterClient = await createBicoPaymasterClient({ chain: base, transport: http() }); ``` ``` -------------------------------- ### build / buildComposable Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/api-reference/account-decorators.md Builds transaction instructions, potentially including bridging logic for cross-chain balance adjustments. ```APIDOC ## build / buildComposable Builds transaction instructions that may include bridging logic when balance adjustments are needed across chains. ### Parameters for build #### Path Parameters - **amount** (bigint) - Required - Amount needed on the target chain. - **mcToken** (MultichainToken) - Required - Token to bridge/balance across chains. - **toChain** (Chain) - Required - Target blockchain for the transaction. - **instructions** (Instruction[]) - Optional - Existing instructions to add balance to. ### Return Type Promise Array of instructions including any necessary bridge transactions. ### Example ```typescript const instructions = await mcAccount.build({ amount: parseEther("100"), mcToken: mcUSDC, toChain: base }); ``` ``` -------------------------------- ### Instruction Building Source: https://github.com/bcnmy/abstractjs/blob/develop/_autodocs/GENERATION-SUMMARY.txt Utilities for constructing complex transaction instructions. ```APIDOC ## Instruction Building ### Description Utilities and functions to help construct and manage transaction instructions, enabling the creation of complex, multi-step operations. ### Functions - `buildInstruction` - `addStepToInstruction` - `combineInstructions` ### Related Types - `Instruction` - `AbstractCall` - `ComposableCall` - `Call` ```