diff --git a/src/sdk/clients/createBicoPaymasterClient.ts b/src/sdk/clients/createBicoPaymasterClient.ts index 8653a803..01abfcc5 100644 --- a/src/sdk/clients/createBicoPaymasterClient.ts +++ b/src/sdk/clients/createBicoPaymasterClient.ts @@ -5,6 +5,14 @@ import { createPaymasterClient } from "viem/account-abstraction" +/** + * Configuration options for creating a Bico Paymaster Client. + * @typedef {Object} BicoPaymasterClientConfig + * @property {Transport} [transport] - Optional custom transport. + * @property {string} [paymasterUrl] - URL of the paymaster service. + * @property {number} [chainId] - Chain ID for the network. + * @property {string} [apiKey] - API key for authentication. + */ type BicoPaymasterClientConfig = Omit & OneOf< | { @@ -19,6 +27,27 @@ type BicoPaymasterClientConfig = Omit & } > +/** + * Creates a Bico Paymaster Client. + * + * This function sets up a client for interacting with Biconomy's paymaster service. + * It can be configured with a custom transport, a specific paymaster URL, or with a chain ID and API key. + * + * @param {BicoPaymasterClientConfig} parameters - Configuration options for the client. + * @returns {PaymasterClient} A configured Paymaster Client instance. + * + * @example + * // Create a client with a custom transport + * const client1 = createBicoPaymasterClient({ transport: customTransport }) + * + * @example + * // Create a client with a specific paymaster URL + * const client2 = createBicoPaymasterClient({ paymasterUrl: 'https://example.com/paymaster' }) + * + * @example + * // Create a client with chain ID and API key + * const client3 = createBicoPaymasterClient({ chainId: 1, apiKey: 'your-api-key' }) + */ export const createBicoPaymasterClient = ( parameters: BicoPaymasterClientConfig ): PaymasterClient => diff --git a/src/sdk/clients/createNexusClient.ts b/src/sdk/clients/createNexusClient.ts index 99e47d1c..b99bf5d8 100644 --- a/src/sdk/clients/createNexusClient.ts +++ b/src/sdk/clients/createNexusClient.ts @@ -30,10 +30,16 @@ import { smartAccountActions } from "./decorators/smartAccount" +/** + * Parameters for sending a transaction + */ export type SendTransactionParameters = { calls: Call | Call[] } +/** + * Nexus Client type + */ export type NexusClient< transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, @@ -48,15 +54,36 @@ export type NexusClient< BundlerActions & Erc7579Actions & SmartAccountActions & { + /** + * The Nexus account associated with this client + */ account: NexusAccount + /** + * Optional client for additional functionality + */ client?: client | Client | undefined + /** + * Transport configuration for the bundler + */ bundlerTransport?: BundlerClientConfig["transport"] + /** + * Optional paymaster configuration + */ paymaster?: BundlerClientConfig["paymaster"] | undefined + /** + * Optional paymaster context + */ paymasterContext?: BundlerClientConfig["paymasterContext"] | undefined + /** + * Optional user operation configuration + */ userOperation?: BundlerClientConfig["userOperation"] | undefined } > +/** + * Configuration for creating a Nexus Client + */ export type NexusClientConfig< transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, @@ -113,14 +140,33 @@ export type NexusClientConfig< index?: bigint /** Active module of the account. */ activeModule?: BaseValidationModule - /** Factory address of the account. */ + /** Executor module of the account. */ executorModule?: BaseExecutionModule + /** Factory address of the account. */ factoryAddress?: Address /** Owner module */ k1ValidatorAddress?: Address } > +/** + * Creates a Nexus Client for interacting with the Nexus smart account system. + * + * @param parameters - {@link NexusClientConfig} + * @returns Nexus Client. {@link NexusClient} + * + * @example + * import { createNexusClient } from '@biconomy/sdk' + * import { http } from 'viem' + * import { mainnet } from 'viem/chains' + * + * const nexusClient = await createNexusClient({ + * chain: mainnet, + * transport: http('https://mainnet.infura.io/v3/YOUR-PROJECT-ID'), + * bundlerTransport: http('https://api.biconomy.io'), + * holder: '0x...', + * }) + */ export async function createNexusClient( parameters: NexusClientConfig ): Promise {