UNPKG

@account-kit/infra

Version:

adapters for @aa-sdk/core for interacting with alchemy services

26 lines (25 loc) 2.47 kB
import { type GetEntryPointFromAccount, type SendTransactionsParameters, type SendUserOperationParameters, type SendUserOperationResult, type SmartContractAccount, type UserOperationContext, type UserOperationOverrides } from "@aa-sdk/core"; import type { Chain, Client, Hex, SendTransactionParameters, Transport } from "viem"; import type { SimulateUserOperationAssetChangesResponse } from "../../actions/types.js"; export type AlchemySmartAccountClientActions<TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined, TChain extends Chain | undefined = Chain | undefined, TEntryPointVersion extends GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>> = { simulateUserOperation: (args: SendUserOperationParameters<TAccount, TContext>) => Promise<SimulateUserOperationAssetChangesResponse>; sendUserOperation: (args: SendUserOperationParameters<TAccount, TContext, GetEntryPointFromAccount<TAccount>>) => Promise<SendUserOperationResult<TEntryPointVersion>>; sendTransaction: <TChainOverride extends Chain | undefined = undefined>(args: SendTransactionParameters<TChain, TAccount, TChainOverride>, overrides?: UserOperationOverrides<TEntryPointVersion>, context?: TContext) => Promise<Hex>; sendTransactions: (args: SendTransactionsParameters<TAccount, TContext>) => Promise<Hex>; }; /** * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations. * * @example * ```ts * import { alchemyActions } from "@account-kit/infra"; * import { createPublicClient } from "viem"; * * const client = createPublicClient(...); * const clientWithAlchemyActions = client.extend(alchemyActions); * ``` * * @param {Client<TTransport, TChain, TAccount>} client_ The client instance used to perform actions * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions */ export declare const alchemyActions: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(client: Client<TTransport, TChain, TAccount>) => AlchemySmartAccountClientActions<TAccount, TContext, TChain>;