Function createBicoBundlerClient

  • Creates a Bico Bundler Client with a given Transport configured for a Chain.

    Parameters

    • parameters: BicoBundlerClientConfig

      Configuration for the Bico Bundler Client

    Returns {
        account: undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
            address: `0x${string}`;
            getNonce: ((parameters?) => Promise<bigint>);
            isDeployed: (() => Promise<boolean>);
            type: "smart";
        }> & {
            address: `0x${string}`;
            getNonce: ((parameters?) => Promise<bigint>);
            isDeployed: (() => Promise<boolean>);
            type: "smart";
        };
        batch?: {
            multicall?: boolean | {
                batchSize?: number;
                wait?: number;
            };
        };
        cacheTime: number;
        ccipRead?: false | {
            request?: ((parameters) => Promise<`0x${string}`>);
        };
        chain: undefined | Chain;
        estimateUserOperationGas: (<const calls, accountOverride>(parameters) => Promise<EstimateUserOperationGasReturnType<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
            address: `0x${string}`;
            getNonce: ((parameters?) => Promise<bigint>);
            isDeployed: (() => Promise<boolean>);
            type: "smart";
        }> & {
            address: `0x${string}`;
            getNonce: ((parameters?) => Promise<bigint>);
            isDeployed: (() => Promise<boolean>);
            type: "smart";
        }, accountOverride>>);
        extend: (<const client>(fn) => Client<Transport, undefined | Chain, undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
            address: `0x${string}`;
            getNonce: ((parameters?) => Promise<bigint>);
            isDeployed: (() => Promise<boolean>);
            type: "smart";
        }> & {
            address: `0x${string}`;
            getNonce: ((parameters?) => Promise<bigint>);
            isDeployed: (() => Promise<boolean>);
            type: "smart";
        }, [{
            Method: "eth_chainId";
            Parameters?: undefined;
            ReturnType: `0x${string}`;
        }, {
            Method: "eth_estimateUserOperationGas";
            Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`] | [userOperation: RpcUserOperation, entrypoint: `0x${string}`, stateOverrideSet: RpcStateOverride];
            ReturnType: RpcEstimateUserOperationGasReturnType;
        }, {
            Method: "eth_getUserOperationByHash";
            Parameters: [hash: `0x${string}`];
            ReturnType: null | RpcGetUserOperationByHashReturnType;
        }, {
            Method: "eth_getUserOperationReceipt";
            Parameters: [hash: `0x${string}`];
            ReturnType: null | RpcUserOperationReceipt;
        }], {
            [K in string | number | symbol]: client[K]
        } & BundlerActions<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
            address: `0x${string}`;
            getNonce: ((parameters?) => Promise<(...)>);
            isDeployed: (() => Promise<(...)>);
            type: "smart";
        }> & {
            address: `0x${string}`;
            getNonce: ((parameters?) => Promise<bigint>);
            isDeployed: (() => Promise<boolean>);
            type: "smart";
        }> & PaymasterActions & BicoActions>);
        getChainId: (() => Promise<number>);
        getGasFeeValues: (() => Promise<{
            fast: {
                maxFeePerGas: bigint;
                maxPriorityFeePerGas: bigint;
            };
            slow: {
                maxFeePerGas: bigint;
                maxPriorityFeePerGas: bigint;
            };
            standard: {
                maxFeePerGas: bigint;
                maxPriorityFeePerGas: bigint;
            };
        }>);
        getPaymasterData: ((parameters) => Promise<GetPaymasterDataReturnType>);
        getPaymasterStubData: ((parameters) => Promise<GetPaymasterStubDataReturnType>);
        getSupportedEntryPoints: (() => Promise<GetSupportedEntryPointsReturnType>);
        getUserOperation: ((parameters) => Promise<{
            blockHash: `0x${string}`;
            blockNumber: bigint;
            entryPoint: `0x${string}`;
            transactionHash: `0x${string}`;
            userOperation: UserOperation;
        }>);
        getUserOperationReceipt: ((parameters) => Promise<{
            actualGasCost: bigint;
            actualGasUsed: bigint;
            entryPoint: `0x${string}`;
            logs: Log<bigint, number, false>[];
            nonce: bigint;
            paymaster?: `0x${string}`;
            reason?: string;
            receipt: TransactionReceipt<bigint, number, "success" | "reverted">;
            sender: `0x${string}`;
            success: boolean;
            userOpHash: `0x${string}`;
        }>);
        key: string;
        name: string;
        pollingInterval: number;
        prepareUserOperation: (<const calls, const request, accountOverride>(parameters) => Promise<{
            [K in string | number | symbol]: (UnionOmit<request, "parameters" | "calls"> & {
                callData: `0x${string}`;
                paymasterAndData: DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>> extends "0.6"
                    ? `0x${string}`
                    : undefined;
                sender: `0x${string}`;
            } & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                    ? any[any][number]
                    : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "factory"> extends never
                ? {}
                : FactoryProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                    ? any[any][number]
                    : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "nonce"> extends never
                ? {}
                : NonceProperties) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                    ? any[any][number]
                    : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "fees"> extends never
                ? {}
                : FeeProperties) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                    ? any[any][number]
                    : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "gas"> extends never
                ? {}
                : GasProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                    ? any[any][number]
                    : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "paymaster"> extends never
                ? {}
                : PaymasterProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                    ? any[any][number]
                    : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "signature"> extends never
                ? {}
                : SignatureProperties))[K]
        }>);
        request: EIP1193RequestFn<[{
            Method: "eth_chainId";
            Parameters?: undefined;
            ReturnType: `0x${string}`;
        }, {
            Method: "eth_estimateUserOperationGas";
            Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`] | [userOperation: RpcUserOperation, entrypoint: `0x${string}`, stateOverrideSet: RpcStateOverride];
            ReturnType: RpcEstimateUserOperationGasReturnType;
        }, {
            Method: "eth_getUserOperationByHash";
            Parameters: [hash: `0x${string}`];
            ReturnType: null | RpcGetUserOperationByHashReturnType;
        }, {
            Method: "eth_getUserOperationReceipt";
            Parameters: [hash: `0x${string}`];
            ReturnType: null | RpcUserOperationReceipt;
        }]>;
        sendUserOperation: (<const calls, accountOverride>(parameters) => Promise<`0x${string}`>);
        transport: TransportConfig<string, EIP1193RequestFn> & Record<string, any>;
        type: string;
        uid: string;
        waitForUserOperationReceipt: ((parameters) => Promise<{
            actualGasCost: bigint;
            actualGasUsed: bigint;
            entryPoint: `0x${string}`;
            logs: Log<bigint, number, false>[];
            nonce: bigint;
            paymaster?: `0x${string}`;
            reason?: string;
            receipt: TransactionReceipt<bigint, number, "success" | "reverted">;
            sender: `0x${string}`;
            success: boolean;
            userOpHash: `0x${string}`;
        }>);
    }

    A Bico Bundler Client

    • account: undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
          address: `0x${string}`;
          getNonce: ((parameters?) => Promise<bigint>);
          isDeployed: (() => Promise<boolean>);
          type: "smart";
      }> & {
          address: `0x${string}`;
          getNonce: ((parameters?) => Promise<bigint>);
          isDeployed: (() => Promise<boolean>);
          type: "smart";
      }

      The Account of the Client.

    • Optional batch?: {
          multicall?: boolean | {
              batchSize?: number;
              wait?: number;
          };
      }

      Flags for batch settings.

      • Optional multicall?: boolean | {
            batchSize?: number;
            wait?: number;
        }

        Toggle to enable eth_call multicall aggregation.

    • cacheTime: number

      Time (in ms) that cached data will remain in memory.

    • Optional ccipRead?: false | {
          request?: ((parameters) => Promise<`0x${string}`>);
      }

      CCIP Read configuration.

    • chain: undefined | Chain

      Chain for the client.

    • estimateUserOperationGas: (<const calls, accountOverride>(parameters) => Promise<EstimateUserOperationGasReturnType<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
          address: `0x${string}`;
          getNonce: ((parameters?) => Promise<bigint>);
          isDeployed: (() => Promise<boolean>);
          type: "smart";
      }> & {
          address: `0x${string}`;
          getNonce: ((parameters?) => Promise<bigint>);
          isDeployed: (() => Promise<boolean>);
          type: "smart";
      }, accountOverride>>)

      Returns an estimate of gas values necessary to execute the User Operation.

      Returns

      The gas estimate (in wei). EstimateUserOperationGasReturnType

      Example

      import { createBundlerClient, http, parseEther } from 'viem'
      import { mainnet } from 'viem/chains'
      import { toSmartAccount } from 'viem/accounts'

      const account = await toSmartAccount({ ... })

      const bundlerClient = createBundlerClient({
      chain: mainnet,
      transport: http(),
      })

      const values = await bundlerClient.estimateUserOperationGas({
      account,
      calls: [{ to: '0x...', value: parseEther('1') }],
      })
        • <const calls, accountOverride>(parameters): Promise<EstimateUserOperationGasReturnType<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }> & {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }, accountOverride>>
        • Type Parameters

          • const calls extends readonly unknown[]
          • accountOverride extends undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }> & {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            } = undefined

          Parameters

          • parameters: EstimateUserOperationGasParameters<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }> & {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }, accountOverride, calls>

            EstimateUserOperationGasParameters

          Returns Promise<EstimateUserOperationGasReturnType<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }> & {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }, accountOverride>>

    • extend: (<const client>(fn) => Client<Transport, undefined | Chain, undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
          address: `0x${string}`;
          getNonce: ((parameters?) => Promise<bigint>);
          isDeployed: (() => Promise<boolean>);
          type: "smart";
      }> & {
          address: `0x${string}`;
          getNonce: ((parameters?) => Promise<bigint>);
          isDeployed: (() => Promise<boolean>);
          type: "smart";
      }, [{
          Method: "eth_chainId";
          Parameters?: undefined;
          ReturnType: `0x${string}`;
      }, {
          Method: "eth_estimateUserOperationGas";
          Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`] | [userOperation: RpcUserOperation, entrypoint: `0x${string}`, stateOverrideSet: RpcStateOverride];
          ReturnType: RpcEstimateUserOperationGasReturnType;
      }, {
          Method: "eth_getUserOperationByHash";
          Parameters: [hash: `0x${string}`];
          ReturnType: null | RpcGetUserOperationByHashReturnType;
      }, {
          Method: "eth_getUserOperationReceipt";
          Parameters: [hash: `0x${string}`];
          ReturnType: null | RpcUserOperationReceipt;
      }], {
          [K in string | number | symbol]: client[K]
      } & BundlerActions<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
          address: `0x${string}`;
          getNonce: ((parameters?) => Promise<(...)>);
          isDeployed: (() => Promise<(...)>);
          type: "smart";
      }> & {
          address: `0x${string}`;
          getNonce: ((parameters?) => Promise<bigint>);
          isDeployed: (() => Promise<boolean>);
          type: "smart";
      }> & PaymasterActions & BicoActions>)
        • <const client>(fn): Client<Transport, undefined | Chain, undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }> & {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }, [{
              Method: "eth_chainId";
              Parameters?: undefined;
              ReturnType: `0x${string}`;
          }, {
              Method: "eth_estimateUserOperationGas";
              Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`] | [userOperation: RpcUserOperation, entrypoint: `0x${string}`, stateOverrideSet: RpcStateOverride];
              ReturnType: RpcEstimateUserOperationGasReturnType;
          }, {
              Method: "eth_getUserOperationByHash";
              Parameters: [hash: `0x${string}`];
              ReturnType: null | RpcGetUserOperationByHashReturnType;
          }, {
              Method: "eth_getUserOperationReceipt";
              Parameters: [hash: `0x${string}`];
              ReturnType: null | RpcUserOperationReceipt;
          }], {
              [K in string | number | symbol]: client[K]
          } & BundlerActions<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<(...)>);
              isDeployed: (() => Promise<(...)>);
              type: "smart";
          }> & {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }> & PaymasterActions & BicoActions>
        • Type Parameters

          • const client extends {
                account?: undefined;
                batch?: undefined;
                cacheTime?: undefined;
                ccipRead?: undefined;
                chain?: undefined;
                key?: undefined;
                name?: undefined;
                pollingInterval?: undefined;
                request?: undefined;
                transport?: undefined;
                type?: undefined;
                uid?: undefined;
            } & ExactPartial<ExtendableProtectedActions<Transport, undefined | Chain, undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<(...)>);
                isDeployed: (() => Promise<(...)>);
                type: "smart";
            }> & {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }>>

          Parameters

          • fn: ((client) => client)
              • (client): client
              • Parameters

                • client: Client<Transport, undefined | Chain, undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                      address: `0x${string}`;
                      getNonce: ((parameters?) => Promise<bigint>);
                      isDeployed: (() => Promise<boolean>);
                      type: "smart";
                  }> & {
                      address: `0x${string}`;
                      getNonce: ((parameters?) => Promise<bigint>);
                      isDeployed: (() => Promise<boolean>);
                      type: "smart";
                  }, [{
                      Method: "eth_chainId";
                      Parameters?: undefined;
                      ReturnType: `0x${string}`;
                  }, {
                      Method: "eth_estimateUserOperationGas";
                      Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`] | [userOperation: RpcUserOperation, entrypoint: `0x${string}`, stateOverrideSet: RpcStateOverride];
                      ReturnType: RpcEstimateUserOperationGasReturnType;
                  }, {
                      Method: "eth_getUserOperationByHash";
                      Parameters: [hash: `0x${string}`];
                      ReturnType: null | RpcGetUserOperationByHashReturnType;
                  }, {
                      Method: "eth_getUserOperationReceipt";
                      Parameters: [hash: `0x${string}`];
                      ReturnType: null | RpcUserOperationReceipt;
                  }], BundlerActions<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                      address: `0x${(...)}`;
                      getNonce: ((parameters?) => ...);
                      isDeployed: (() => ...);
                      type: "smart";
                  }> & {
                      address: `0x${string}`;
                      getNonce: ((parameters?) => Promise<(...)>);
                      isDeployed: (() => Promise<(...)>);
                      type: "smart";
                  }> & PaymasterActions & BicoActions>

                Returns client

          Returns Client<Transport, undefined | Chain, undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }> & {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }, [{
              Method: "eth_chainId";
              Parameters?: undefined;
              ReturnType: `0x${string}`;
          }, {
              Method: "eth_estimateUserOperationGas";
              Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`] | [userOperation: RpcUserOperation, entrypoint: `0x${string}`, stateOverrideSet: RpcStateOverride];
              ReturnType: RpcEstimateUserOperationGasReturnType;
          }, {
              Method: "eth_getUserOperationByHash";
              Parameters: [hash: `0x${string}`];
              ReturnType: null | RpcGetUserOperationByHashReturnType;
          }, {
              Method: "eth_getUserOperationReceipt";
              Parameters: [hash: `0x${string}`];
              ReturnType: null | RpcUserOperationReceipt;
          }], {
              [K in string | number | symbol]: client[K]
          } & BundlerActions<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<(...)>);
              isDeployed: (() => Promise<(...)>);
              type: "smart";
          }> & {
              address: `0x${string}`;
              getNonce: ((parameters?) => Promise<bigint>);
              isDeployed: (() => Promise<boolean>);
              type: "smart";
          }> & PaymasterActions & BicoActions>

    • getChainId: (() => Promise<number>)

      Returns the chain ID associated with the bundler.

      Returns

      The current chain ID. GetChainIdReturnType

      Example

      import { http } from 'viem'
      import { createBundlerClient, mainnet } from 'viem/chains'

      const client = createPublicClient({
      chain: mainnet,
      transport: http(),
      })
      const chainId = await client.getChainId()
      // 1
        • (): Promise<number>
        • Returns Promise<number>

    • getGasFeeValues: (() => Promise<{
          fast: {
              maxFeePerGas: bigint;
              maxPriorityFeePerGas: bigint;
          };
          slow: {
              maxFeePerGas: bigint;
              maxPriorityFeePerGas: bigint;
          };
          standard: {
              maxFeePerGas: bigint;
              maxPriorityFeePerGas: bigint;
          };
      }>)

      Returns the live gas prices that you can use to send a user operation.

      Returns

      slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas GetGasFeeValuesReturnType

      Example

      import { createClient } from "viem"
      import { bicoBundlerActions } from "@biconomy/sdk"

      const bundlerClient = createClient({
      chain: goerli,
      transport: http("https://api.biconomy.io/v2/goerli/rpc?apikey=YOUR_API_KEY_HERE")
      }).extend(bicoBundlerActions())

      await bundlerClient.getGasFeeValues()
        • (): Promise<{
              fast: {
                  maxFeePerGas: bigint;
                  maxPriorityFeePerGas: bigint;
              };
              slow: {
                  maxFeePerGas: bigint;
                  maxPriorityFeePerGas: bigint;
              };
              standard: {
                  maxFeePerGas: bigint;
                  maxPriorityFeePerGas: bigint;
              };
          }>
        • Returns Promise<{
              fast: {
                  maxFeePerGas: bigint;
                  maxPriorityFeePerGas: bigint;
              };
              slow: {
                  maxFeePerGas: bigint;
                  maxPriorityFeePerGas: bigint;
              };
              standard: {
                  maxFeePerGas: bigint;
                  maxPriorityFeePerGas: bigint;
              };
          }>

    • getPaymasterData: ((parameters) => Promise<GetPaymasterDataReturnType>)

      Retrieves paymaster-related User Operation properties to be used for sending the User Operation.

      Returns

      Paymaster-related User Operation properties. GetPaymasterDataReturnType

      Example

      import { http } from 'viem'
      import { createPaymasterClient } from 'viem/account-abstraction'

      const paymasterClient = createPaymasterClient({
      transport: http('https://...'),
      })

      const userOperation = { ... }

      const values = await paymasterClient.getPaymasterData({
      chainId: 1,
      entryPointAddress: '0x...',
      ...userOperation,
      })
        • (parameters): Promise<GetPaymasterDataReturnType>
        • Parameters

          • parameters: GetPaymasterDataParameters

            GetPaymasterDataParameters

          Returns Promise<GetPaymasterDataReturnType>

    • getPaymasterStubData: ((parameters) => Promise<GetPaymasterStubDataReturnType>)

      Retrieves paymaster-related User Operation properties to be used for gas estimation.

      Returns

      Paymaster-related User Operation properties. GetPaymasterStubDataReturnType

      Example

      import { http } from 'viem'
      import { createPaymasterClient } from 'viem/account-abstraction'

      const paymasterClient = createPaymasterClient({
      transport: http('https://...'),
      })

      const userOperation = { ... }

      const values = await paymasterClient.getPaymasterStubData({
      chainId: 1,
      entryPointAddress: '0x...',
      ...userOperation,
      })
        • (parameters): Promise<GetPaymasterStubDataReturnType>
        • Parameters

          • parameters: GetPaymasterStubDataParameters

            GetPaymasterStubDataParameters

          Returns Promise<GetPaymasterStubDataReturnType>

    • getSupportedEntryPoints: (() => Promise<GetSupportedEntryPointsReturnType>)

      Returns the EntryPoints that the bundler supports.

      Returns

      Supported Entry Points. GetSupportedEntryPointsReturnType

      Example

      import { createBundlerClient, http, parseEther } from 'viem'
      import { mainnet } from 'viem/chains'

      const bundlerClient = createBundlerClient({
      chain: mainnet,
      transport: http(),
      })

      const addresses = await bundlerClient.getSupportedEntryPoints()
        • (): Promise<GetSupportedEntryPointsReturnType>
        • Returns Promise<GetSupportedEntryPointsReturnType>

    • getUserOperation: ((parameters) => Promise<{
          blockHash: `0x${string}`;
          blockNumber: bigint;
          entryPoint: `0x${string}`;
          transactionHash: `0x${string}`;
          userOperation: UserOperation;
      }>)

      Returns the information about a User Operation given a hash.

      Returns

      The receipt. GetUserOperationReturnType

      Example

      import { createBundlerClient, http } from 'viem'
      import { mainnet } from 'viem/chains'

      const client = createBundlerClient({
      chain: mainnet,
      transport: http(),
      })

      const receipt = await client.getUserOperation({
      hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
      })
        • (parameters): Promise<{
              blockHash: `0x${string}`;
              blockNumber: bigint;
              entryPoint: `0x${string}`;
              transactionHash: `0x${string}`;
              userOperation: UserOperation;
          }>
        • Parameters

          • parameters: GetUserOperationParameters

            GetUserOperationParameters

          Returns Promise<{
              blockHash: `0x${string}`;
              blockNumber: bigint;
              entryPoint: `0x${string}`;
              transactionHash: `0x${string}`;
              userOperation: UserOperation;
          }>

    • getUserOperationReceipt: ((parameters) => Promise<{
          actualGasCost: bigint;
          actualGasUsed: bigint;
          entryPoint: `0x${string}`;
          logs: Log<bigint, number, false>[];
          nonce: bigint;
          paymaster?: `0x${string}`;
          reason?: string;
          receipt: TransactionReceipt<bigint, number, "success" | "reverted">;
          sender: `0x${string}`;
          success: boolean;
          userOpHash: `0x${string}`;
      }>)

      Returns the User Operation Receipt given a User Operation hash.

      Returns

      The receipt. GetUserOperationReceiptReturnType

      Example

      import { createBundlerClient, http } from 'viem'
      import { mainnet } from 'viem/chains'

      const client = createBundlerClient({
      chain: mainnet,
      transport: http(),
      })

      const receipt = await client.getUserOperationReceipt({
      hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
      })
        • (parameters): Promise<{
              actualGasCost: bigint;
              actualGasUsed: bigint;
              entryPoint: `0x${string}`;
              logs: Log<bigint, number, false>[];
              nonce: bigint;
              paymaster?: `0x${string}`;
              reason?: string;
              receipt: TransactionReceipt<bigint, number, "success" | "reverted">;
              sender: `0x${string}`;
              success: boolean;
              userOpHash: `0x${string}`;
          }>
        • Parameters

          • parameters: GetUserOperationReceiptParameters

            GetUserOperationReceiptParameters

          Returns Promise<{
              actualGasCost: bigint;
              actualGasUsed: bigint;
              entryPoint: `0x${string}`;
              logs: Log<bigint, number, false>[];
              nonce: bigint;
              paymaster?: `0x${string}`;
              reason?: string;
              receipt: TransactionReceipt<bigint, number, "success" | "reverted">;
              sender: `0x${string}`;
              success: boolean;
              userOpHash: `0x${string}`;
          }>

    • key: string

      A key for the client.

    • name: string

      A name for the client.

    • pollingInterval: number

      Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.

    • prepareUserOperation: (<const calls, const request, accountOverride>(parameters) => Promise<{
          [K in string | number | symbol]: (UnionOmit<request, "parameters" | "calls"> & {
              callData: `0x${string}`;
              paymasterAndData: DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>> extends "0.6"
                  ? `0x${string}`
                  : undefined;
              sender: `0x${string}`;
          } & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                  ? any[any][number]
                  : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "factory"> extends never
              ? {}
              : FactoryProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                  ? any[any][number]
                  : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "nonce"> extends never
              ? {}
              : NonceProperties) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                  ? any[any][number]
                  : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "fees"> extends never
              ? {}
              : FeeProperties) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                  ? any[any][number]
                  : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "gas"> extends never
              ? {}
              : GasProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                  ? any[any][number]
                  : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "paymaster"> extends never
              ? {}
              : PaymasterProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                  ? any[any][number]
                  : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "signature"> extends never
              ? {}
              : SignatureProperties))[K]
      }>)

      Prepares a User Operation and fills in missing properties.

      Returns

      The User Operation. PrepareUserOperationReturnType

      Example

      import { createBundlerClient, http } from 'viem'
      import { mainnet } from 'viem/chains'
      import { toSmartAccount } from 'viem/accounts'

      const account = await toSmartAccount({ ... })

      const client = createBundlerClient({
      chain: mainnet,
      transport: http(),
      })

      const request = await client.prepareUserOperation({
      account,
      calls: [{ to: '0x...', value: parseEther('1') }],
      })
        • <const calls, const request, accountOverride>(parameters): Promise<{
              [K in string | number | symbol]: (UnionOmit<request, "parameters" | "calls"> & {
                  callData: `0x${string}`;
                  paymasterAndData: DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>> extends "0.6"
                      ? `0x${string}`
                      : undefined;
                  sender: `0x${string}`;
              } & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "factory"> extends never
                  ? {}
                  : FactoryProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "nonce"> extends never
                  ? {}
                  : NonceProperties) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "fees"> extends never
                  ? {}
                  : FeeProperties) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "gas"> extends never
                  ? {}
                  : GasProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "paymaster"> extends never
                  ? {}
                  : PaymasterProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "signature"> extends never
                  ? {}
                  : SignatureProperties))[K]
          }>
        • Type Parameters

          • const calls extends readonly unknown[]
          • const request extends PrepareUserOperationRequest<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }> & {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }, accountOverride, calls>
          • accountOverride extends undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }> & {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            } = undefined

          Parameters

          • parameters: PrepareUserOperationParameters<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }> & {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }, accountOverride, calls, request>

          Returns Promise<{
              [K in string | number | symbol]: (UnionOmit<request, "parameters" | "calls"> & {
                  callData: `0x${string}`;
                  paymasterAndData: DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>> extends "0.6"
                      ? `0x${string}`
                      : undefined;
                  sender: `0x${string}`;
              } & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "factory"> extends never
                  ? {}
                  : FactoryProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "nonce"> extends never
                  ? {}
                  : NonceProperties) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "fees"> extends never
                  ? {}
                  : FeeProperties) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "gas"> extends never
                  ? {}
                  : GasProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "paymaster"> extends never
                  ? {}
                  : PaymasterProperties<DeriveEntryPointVersion<DeriveSmartAccount<(...) | (...), accountOverride>>>) & (Extract<request["parameters"] extends readonly PrepareUserOperationParameterType[]
                      ? any[any][number]
                      : "signature" | "factory" | "paymaster" | "nonce" | "gas" | "fees", "signature"> extends never
                  ? {}
                  : SignatureProperties))[K]
          }>

    • request: EIP1193RequestFn<[{
          Method: "eth_chainId";
          Parameters?: undefined;
          ReturnType: `0x${string}`;
      }, {
          Method: "eth_estimateUserOperationGas";
          Parameters: [userOperation: RpcUserOperation, entrypoint: `0x${string}`] | [userOperation: RpcUserOperation, entrypoint: `0x${string}`, stateOverrideSet: RpcStateOverride];
          ReturnType: RpcEstimateUserOperationGasReturnType;
      }, {
          Method: "eth_getUserOperationByHash";
          Parameters: [hash: `0x${string}`];
          ReturnType: null | RpcGetUserOperationByHashReturnType;
      }, {
          Method: "eth_getUserOperationReceipt";
          Parameters: [hash: `0x${string}`];
          ReturnType: null | RpcUserOperationReceipt;
      }]>

      Request function wrapped with friendly error handling

    • sendUserOperation: (<const calls, accountOverride>(parameters) => Promise<`0x${string}`>)

      Broadcasts a User Operation to the Bundler.

      Returns

      The User Operation hash. SendUserOperationReturnType

      Example

      import { createBundlerClient, http, parseEther } from 'viem'
      import { mainnet } from 'viem/chains'
      import { toSmartAccount } from 'viem/accounts'

      const account = toSmartAccount({ ... })

      const bundlerClient = createBundlerClient({
      chain: mainnet,
      transport: http(),
      })

      const values = await bundlerClient.sendUserOperation({
      account,
      calls: [{ to: '0x...', value: parseEther('1') }],
      })
        • <const calls, accountOverride>(parameters): Promise<`0x${string}`>
        • Type Parameters

          • const calls extends readonly unknown[]
          • accountOverride extends undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }> & {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            } = undefined

          Parameters

          • parameters: SendUserOperationParameters<undefined | object & Assign_<SmartAccountImplementation<Abi, EntryPointVersion, object>, {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }> & {
                address: `0x${string}`;
                getNonce: ((parameters?) => Promise<bigint>);
                isDeployed: (() => Promise<boolean>);
                type: "smart";
            }, accountOverride, calls>

            SendUserOperationParameters

          Returns Promise<`0x${string}`>

    • transport: TransportConfig<string, EIP1193RequestFn> & Record<string, any>

      The RPC transport

    • type: string

      The type of client.

    • uid: string

      A unique ID for the client.

    • waitForUserOperationReceipt: ((parameters) => Promise<{
          actualGasCost: bigint;
          actualGasUsed: bigint;
          entryPoint: `0x${string}`;
          logs: Log<bigint, number, false>[];
          nonce: bigint;
          paymaster?: `0x${string}`;
          reason?: string;
          receipt: TransactionReceipt<bigint, number, "success" | "reverted">;
          sender: `0x${string}`;
          success: boolean;
          userOpHash: `0x${string}`;
      }>)

      Waits for the User Operation to be included on a Block (one confirmation), and then returns the User Operation receipt.

      Returns

      The receipt. WaitForUserOperationReceiptReturnType

      Example

      import { createBundlerClient, http } from 'viem'
      import { mainnet } from 'viem/chains'

      const client = createBundlerClient({
      chain: mainnet,
      transport: http(),
      })

      const receipt = await client.waitForUserOperationReceipt({
      hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
      })
        • (parameters): Promise<{
              actualGasCost: bigint;
              actualGasUsed: bigint;
              entryPoint: `0x${string}`;
              logs: Log<bigint, number, false>[];
              nonce: bigint;
              paymaster?: `0x${string}`;
              reason?: string;
              receipt: TransactionReceipt<bigint, number, "success" | "reverted">;
              sender: `0x${string}`;
              success: boolean;
              userOpHash: `0x${string}`;
          }>
        • Parameters

          • parameters: WaitForUserOperationReceiptParameters

            WaitForUserOperationReceiptParameters

          Returns Promise<{
              actualGasCost: bigint;
              actualGasUsed: bigint;
              entryPoint: `0x${string}`;
              logs: Log<bigint, number, false>[];
              nonce: bigint;
              paymaster?: `0x${string}`;
              reason?: string;
              receipt: TransactionReceipt<bigint, number, "success" | "reverted">;
              sender: `0x${string}`;
              success: boolean;
              userOpHash: `0x${string}`;
          }>

    Example

    import { createBicoBundlerClient, http } from '@biconomy/sdk'
    import { mainnet } from 'viem/chains'

    const bundlerClient = createBicoBundlerClient({ chain: mainnet });