UNPKG

startale-aa-sdk

Version:

SDK for startale account integration with support for account abstraction, ERC-7579, ERC-4337.

71 lines 2.8 kB
import { type Address, type OneOf, type Transport } from "viem"; import { type PaymasterClient, type PaymasterClientConfig } from "viem/account-abstraction"; import { type TokenPaymasterActions } from "./decorators/tokenPaymaster"; export type SCSPaymasterClient = Omit<PaymasterClient, "getPaymasterStubData"> & TokenPaymasterActions; /** * Configuration options for creating a SCS Paymaster Client. * @typedef {Object} SCSPaymasterClientConfig * @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 SCSPaymasterClientConfig = Omit<PaymasterClientConfig, "transport"> & OneOf<{ transport?: Transport; } | { paymasterUrl: string; } | { chainId: number; apiKey: string; }>; /** * Context for the SCS SPONSORED Paymaster. */ export type SCSPaymasterContext = { paymasterId?: string; token?: Address; calculateGasLimits?: boolean; }; type ToSCSTokenPaymasterContextParams = { token: Address; calculateGasLimits?: boolean; }; export declare const scsSponsoredPaymasterContext: SCSPaymasterContext; export declare const toSCSSponsoredPaymasterContext: (params?: Partial<SCSPaymasterContext>) => SCSPaymasterContext; export declare const toSCSTokenPaymasterContext: (params: ToSCSTokenPaymasterContextParams) => SCSPaymasterContext; /** * Creates a SCS Paymaster Client. * * This function sets up a client for interacting with SCS's paymaster service. * It can be configured with a custom transport, a specific paymaster URL, or with a chain ID and API key. * * @param {SCSPaymasterClientConfig} parameters - Configuration options for the client. * @returns {PaymasterClient} A configured Paymaster Client instance. * * @example * // Create a client with a custom transport * const client1 = createSCSPaymasterClient({ transport: customTransport }) * * @example * // Create a client with a specific paymaster URL * const client2 = createSCSPaymasterClient({ paymasterUrl: 'https://example.com/paymaster' }) * * @example * // Create a client with chain ID and API key * const client3 = createSCSPaymasterClient({ chainId: 1, apiKey: 'your-api-key' }) * * @example * // Create a Token Paymaster Client * const tokenPaymasterClient = createSCSPaymasterClient({ * paymasterUrl: 'https://example.com/paymaster', * paymasterContext: { * mode: "ERC20", * tokenInfo: { * feeTokenAddress: "0x..." * } * }, * }) */ export declare const createSCSPaymasterClient: (parameters: SCSPaymasterClientConfig) => SCSPaymasterClient; export {}; //# sourceMappingURL=createSCSPaymasterClient.d.ts.map