Skip to main content

AccountAbstraction <API>

Account Abstraction feature allows enhancing user experience and security by allowing smart contracts to manage user accounts and transactions more flexibly.

For using account abstraction functions, install web3-account-abstraction packages using: npm i web3-account-abstraction or yarn add web3-account-abstraction.

 import {AccountAbstraction} from 'web3-account-abstraction';

const aa = new AccountAbstraction('https://bundler-provider');
aa.supportedEntryPoints().then(console.log);

Hierarchy

Index

Constructors

publicconstructor

Properties

config

readonlyproviders

providers: { HttpProvider: Web3BaseProviderConstructor; WebsocketProvider: Web3BaseProviderConstructor }

Type declaration

staticoptionalgivenProvider

givenProvider?: SupportedProviders<never>

staticreadonlyproviders

providers: { HttpProvider: Web3BaseProviderConstructor; WebsocketProvider: Web3BaseProviderConstructor }

Type declaration

Accessors

BatchRequest

accountProvider

blockHeaderTimeout

  • get blockHeaderTimeout(): number
  • set blockHeaderTimeout(val: number): void
  • The blockHeaderTimeout is used over socket-based connections. This option defines the amount seconds it should wait for 'newBlockHeaders' event before falling back to polling to fetch transaction receipt. Default is 10 seconds.


    Returns number

  • Will set the blockHeaderTimeout


    Parameters

    • val: number

    Returns void

contractDataInputFill

  • get contractDataInputFill(): input | data | both
  • set contractDataInputFill(val: input | data | both): void
  • The contractDataInputFill options property will allow you to set the hash of the method signature and encoded parameters to the property either data, input or both within your contract. This will affect the contracts send, call and estimateGas methods Default is data.


    Returns input | data | both

  • Will set the contractDataInputFill


    Parameters

    • val: input | data | both

    Returns void

currentProvider

  • Will return the current provider. (The same as provider)

    @example
    const web3Context = new Web3Context("http://localhost:8545");
    console.log(web3Context.provider);
    > HttpProvider {
    clientUrl: 'http://localhost:8545',
    httpProviderOptions: undefined
    }

    Returns undefined | Web3BaseProvider<API>

    Returns the current provider

  • Will set the current provider. (The same as provider)

    @example
     const web3Context = new Web3Context("http://localhost:8545");
    web3Context.currentProvider = "ws://localhost:8545";
    console.log(web3Context.provider);
    > WebSocketProvider {
    _eventEmitter: EventEmitter {
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    ...
    }

    Parameters

    Returns void

customTransactionSchema

defaultAccount

  • get defaultAccount(): undefined | string
  • set defaultAccount(val: undefined | string): void
  • This default address is used as the default from property, if no from property is specified in for the following methods:

    • web3.eth.sendTransaction()
    • web3.eth.call()
    • myContract.methods.myMethod().call()
    • myContract.methods.myMethod().send()

    Returns undefined | string

  • Will set the default account.


    Parameters

    • val: undefined | string

    Returns void

defaultBlock

  • The default block is used for certain methods. You can override it by passing in the defaultBlock as last parameter. The default value is "latest".

    • web3.eth.getBalance()
    • web3.eth.getCode()
    • web3.eth.getTransactionCount()
    • web3.eth.getStorageAt()
    • web3.eth.call()
    • myContract.methods.myMethod().call()

    Returns BlockNumberOrTag

  • Will set the default block.

    • A block number
    • "earliest" - String: The genesis block
    • "latest" - String: The latest block (current head of the blockchain)
    • "pending" - String: The currently mined block (including pending transactions)
    • "finalized" - String: (For POS networks) The finalized block is one which has been accepted as canonical by greater than 2/3 of validators
    • "safe" - String: (For POS networks) The safe head block is one which under normal network conditions, is expected to be included in the canonical chain. Under normal network conditions the safe head and the actual tip of the chain will be equivalent (with safe head trailing only by a few seconds). Safe heads will be less likely to be reorged than the proof of work network's latest blocks.

    Parameters

    Returns void

defaultChain

  • get defaultChain(): string
  • set defaultChain(val: string): void
  • Returns string

  • Parameters

    • val: string

    Returns void

defaultCommon

  • get defaultCommon(): undefined | Common
  • set defaultCommon(val: undefined | Common): void
  • Will get the default common property The default common property does contain the following Common object:

    • customChain - Object: The custom chain properties
      • name - string: (optional) The name of the chain
      • networkId - number: Network ID of the custom chain
      • chainId - number: Chain ID of the custom chain
    • baseChain - string: (optional) mainnet, goerli, kovan, rinkeby, or ropsten
    • hardfork - string: (optional) chainstart, homestead, dao, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul, berlin, or london Default is undefined.

    Returns undefined | Common

  • Will set the default common property


    Parameters

    Returns void

defaultHardfork

  • get defaultHardfork(): string
  • set defaultHardfork(val: string): void
  • Will return the default hardfork. Default is london The default hardfork property can be one of the following:

    • chainstart
    • homestead
    • dao
    • tangerineWhistle
    • spuriousDragon
    • byzantium
    • constantinople
    • petersburg
    • istanbul
    • berlin
    • london
    • 'arrowGlacier',
    • 'tangerineWhistle',
    • 'muirGlacier'

    Returns string

  • Will set the default hardfork.


    Parameters

    • val: string

    Returns void

defaultMaxPriorityFeePerGas

  • get defaultMaxPriorityFeePerGas(): Numbers
  • set defaultMaxPriorityFeePerGas(val: Numbers): void
  • Returns Numbers

  • Parameters

    Returns void

defaultNetworkId

  • get defaultNetworkId(): undefined | Numbers
  • set defaultNetworkId(val: undefined | Numbers): void
  • Returns undefined | Numbers

  • Parameters

    Returns void

defaultReturnFormat

  • Returns DataFormat

  • Parameters

    Returns void

defaultTransactionType

  • get defaultTransactionType(): Numbers
  • set defaultTransactionType(val: Numbers): void
  • Returns Numbers

  • Parameters

    Returns void

enableExperimentalFeatures

  • get enableExperimentalFeatures(): { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
  • set enableExperimentalFeatures(val: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }): void
  • The enableExperimentalFeatures is used to enable trying new experimental features that are still not fully implemented or not fully tested or still have some related issues. Default is false for every feature.


    Returns { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }

    • useRpcCallSpecification: boolean
    • useSubscriptionWhenCheckingBlockTimeout: boolean
  • Will set the enableExperimentalFeatures


    Parameters

    • val: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
      • useRpcCallSpecification: boolean
      • useSubscriptionWhenCheckingBlockTimeout: boolean

    Returns void

givenProvider

  • Will return the givenProvider if available.

    When using web3.js in an Ethereum compatible browser, it will set with the current native provider by that browser. Will return the given provider by the (browser) environment, otherwise undefined.


    Returns undefined | SupportedProviders<never>

handleRevert

  • get handleRevert(): boolean
  • set handleRevert(val: boolean): void
  • The handleRevert options property returns the revert reason string if enabled for the following methods:

    • web3.eth.sendTransaction()
    • web3.eth.call()
    • myContract.methods.myMethod().call()
    • myContract.methods.myMethod().send() Default is false.

    Note: At the moment handleRevert is only supported for sendTransaction and not for sendSignedTransaction


    Returns boolean

  • Will set the handleRevert


    Parameters

    • val: boolean

    Returns void

ignoreGasPricing

  • get ignoreGasPricing(): boolean
  • set ignoreGasPricing(val: boolean): void
  • Will get the ignoreGasPricing property. When true, the gasPrice, maxPriorityFeePerGas, and maxFeePerGas will not be autofilled in the transaction object. Useful when you want wallets to handle gas pricing.


    Returns boolean

  • Parameters

    • val: boolean

    Returns void

maxListenersWarningThreshold

  • get maxListenersWarningThreshold(): number
  • set maxListenersWarningThreshold(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

provider

  • Will return the current provider.

    @example
    const web3 = new Web3Context("http://localhost:8545");
    console.log(web3.provider);
    > HttpProvider {
    clientUrl: 'http://localhost:8545',
    httpProviderOptions: undefined
    }

    Returns undefined | Web3BaseProvider<API>

    Returns the current provider

  • Will set the current provider.

    @example
     const web3Context = new web3ContextContext("http://localhost:8545");
    web3Context.provider = "ws://localhost:8545";
    console.log(web3Context.provider);
    > WebSocketProvider {
    _eventEmitter: EventEmitter {
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    ...
    }

    Parameters

    Returns void

requestManager

subscriptionManager

transactionBlockTimeout

  • get transactionBlockTimeout(): number
  • set transactionBlockTimeout(val: number): void
  • The transactionBlockTimeout is used over socket-based connections. This option defines the amount of new blocks it should wait until the first confirmation happens, otherwise the PromiEvent rejects with a timeout error. Default is 50.


    Returns number

  • Will set the transactionBlockTimeout.


    Parameters

    • val: number

    Returns void

transactionBuilder

  • Returns undefined | TransactionBuilder<unknown>

  • Parameters

    Returns void

transactionConfirmationBlocks

  • get transactionConfirmationBlocks(): number
  • set transactionConfirmationBlocks(val: number): void
  • This defines the number of blocks it requires until a transaction is considered confirmed. Default is 24.


    Returns number

  • Will set the transactionConfirmationBlocks.


    Parameters

    • val: number

    Returns void

transactionConfirmationPollingInterval

  • get transactionConfirmationPollingInterval(): undefined | number
  • set transactionConfirmationPollingInterval(val: undefined | number): void
  • Returns undefined | number

  • Parameters

    • val: undefined | number

    Returns void

transactionPollingInterval

  • get transactionPollingInterval(): number
  • set transactionPollingInterval(val: number): void
  • Used over HTTP connections. This option defines the number of seconds between Web3 calls for a receipt which confirms that a transaction was mined by the network. Default is 1000 ms.


    Returns number

  • Will set the transactionPollingInterval.


    Parameters

    • val: number

    Returns void

transactionPollingTimeout

  • get transactionPollingTimeout(): number
  • set transactionPollingTimeout(val: number): void
  • Used over HTTP connections. This option defines the number of seconds Web3 will wait for a receipt which confirms that a transaction was mined by the network. Note: If this method times out, the transaction may still be pending. Default is 750 seconds (12.5 minutes).


    Returns number

  • Will set the transactionPollingTimeout.


    Parameters

    • val: number

    Returns void

transactionReceiptPollingInterval

  • get transactionReceiptPollingInterval(): undefined | number
  • set transactionReceiptPollingInterval(val: undefined | number): void
  • The transactionPollingInterval is used over HTTP connections. This option defines the number of seconds between Web3 calls for a receipt which confirms that a transaction was mined by the network. Default is undefined


    Returns undefined | number

  • Will set the transactionReceiptPollingInterval


    Parameters

    • val: undefined | number

    Returns void

transactionSendTimeout

  • get transactionSendTimeout(): number
  • set transactionSendTimeout(val: number): void
  • The time used to wait for Ethereum Node to return the sent transaction result. Note: If the RPC call stuck at the Node and therefor timed-out, the transaction may still be pending or even mined by the Network. We recommend checking the pending transactions in such a case. Default is 750 seconds (12.5 minutes).


    Returns number

  • Will set the transactionSendTimeout.


    Parameters

    • val: number

    Returns void

transactionTypeParser

wallet

Methods

emit

  • emit<K>(eventName: K, params: { CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • params: { CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]

    Returns void

publicestimateUserOperationGas

  • Estimate the gas values for a UserOperation. Given UserOperation optionally without gas limits and gas prices, return the needed gas limits. The signature field is ignored by the wallet, so that the operation will not require user's approval. Still, it might require putting a "semi-valid" signature (e.g. a signature in the right length)

    @example
        estimateUserOperationGas({
    sender: "0x9fd042a18e90ce326073fa70f111dc9d798d9a52",
    nonce: "123",
    initCode: "0x68656c6c6f",
    callData: "0x776F726C64",
    callGasLimit: "1000",
    verificationGasLimit: "2300",
    preVerificationGas: "3100",
    maxFeePerGas: "0",
    maxPriorityFeePerGas: "0",
    paymasterAndData: "0x626c6f63746f",
    signature: "0x636c656d656e74"
    },"0x636c656d656e74").then(console.log);
    > {
    callGasLimit : "0x18b33",
    preVerificationGas: "0xdf17",
    verificationGasLimit:"0x128c4"
    }

    Parameters

    • userOperation: UserOperation
    • entryPoint: string

      a singleton contract to execute bundles of UserOperations. Bundlers/Clients whitelist the supported entrypoint.

    Returns Promise<Web3APIReturnType<API, eth_estimateUserOperationGas>>

    • preVerificationGas gas overhead of this UserOperation
    • verificationGasLimit actual gas used by the validation of this UserOperation
    • callGasLimit value used by inner account execution

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

extend

  • This method allows extending the web3 modules. Note: This method is only for backward compatibility, and It is recommended to use Web3 v4 Plugin feature for extending web3.js functionality if you are developing something new.


    Parameters

    Returns this

publicgenerateUserOpHash

  • calculate UserOperationHash

    @example
    generateUserOpHash({
    sender: "0x9fd042a18e90ce326073fa70f111dc9d798d9a52",
    nonce: "123",
    initCode: "0x68656c6c6f",
    callData: "0x776F726C64",
    callGasLimit: "1000",
    verificationGasLimit: "2300",
    preVerificationGas: "3100",
    maxFeePerGas: "0",
    maxPriorityFeePerGas: "0",
    paymasterAndData: "0x626c6f63746f",
    signature: "0x636c656d656e74"
    },"0x636c656d656e74", '0x1').then(console.log);
    > 0xxxx

    Parameters

    • userOp: UserOperationRequire

      a structure that describes a transaction to be sent on behalf of a user.

    • entryPoint: string

      a singleton contract to execute bundles of UserOperations. Bundlers/Clients whitelist the supported entrypoint.

    • chainId: string

    Returns string

    an array of the entryPoint addresses supported by the client. The first element of the array SHOULD be the entryPoint addressed preferred by the client.

getContextObject

getMaxListeners

  • getMaxListeners(): number
  • Returns number

publicgetUserOperationByHash

  • getUserOperationByHash(hash: string): Promise<Web3APIReturnType<API, eth_getUserOperationByHash>>
  • Return a UserOperation based on a hash (userOpHash) returned by eth_sendUserOperation

    @example
        getUserOperationByHash("0xxxxx").then(console.log);
    > {
    userOperation: {
    sender: "xxxx",
    nonce: "xxxx",
    initCode: "0xxxxxxxxxxxxxxx",
    callData: "0xxxxxxxxxxxxxxx",
    callGasLimit: "xxxx",
    verificationGasLimit: "xxxx",
    preVerificationGas: "xxxx",
    maxFeePerGas: "0",
    maxPriorityFeePerGas: "0",
    paymasterAndData: "0xxxxxxxxxxxxxxx",
    signature: "0xxxxxxxxxxxxxxx"
    },
    entryPoint: '0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789',
    blockNumber: 39642225,
    blockHash: '0x638a175940cacb33f35e265961b164b14aa77477438340e635b227752f31981f',
    transactionHash: '0xc3e64ac247ae2343335596e106d1b97e35637656e1b99b37977a4165b34aeeb4',
    }

    Parameters

    • hash: string

      a userOpHash value returned by eth_sendUserOperation

    Returns Promise<Web3APIReturnType<API, eth_getUserOperationByHash>>

    null in case the UserOperation is not yet included in a block, or a full UserOperation, with the addition of entryPoint, blockNumber, blockHash and transactionHash

publicgetUserOperationReceipt

  • getUserOperationReceipt(hash: string): Promise<Web3APIReturnType<API, eth_getUserOperationReceipt>>
  • Return null in case the UserOperation is not yet included in a block, or

    • userOpHash the request hash
    • entryPoint
    • sender
      • nonce
      • paymaster the paymaster used for this userOp (or empty)
      • actualGasCost - actual amount paid (by account or paymaster) for this UserOperation
      • actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution)
      • success boolean - did this execution completed without revert
      • reason in case of revert, this is the revert reason
      • logs the logs generated by this UserOperation (not including logs of other UserOperations in the same bundle)
      • receipt the TransactionReceipt object. Note that the returned TransactionReceipt is for the entire bundle, not only for this UserOperation.
    @example
        getUserOperationReceipt("0xa890d7c0dccfd6cebc025919f4857ab97953ae218e82f5e24c297f02ceea5b21").then(console.log);
    >"userOpHash": "0xa890d7c0dccfd6cebc025919f4857ab97953ae218e82f5e24c297f02ceea5b21",
    "entryPoint": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
    "sender": "0x026B37A09aF3ceB346c39999c5738F86A1a48f4d",
    "nonce": "0x7",
    "paymaster": "0xa312d8D37Be746BD09cBD9e9ba2ef16bc7Da48FF",
    "actualGasCost": "0x1a036c1638be0",
    "actualGasUsed": "0x2e8d8",
    "success": true,
    "reason": "",
    "logs": [
    {
    "address": "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789",
    "topics": [
    "0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972"
    ],
    "data": "0x",
    "blockHash": "0x638a175940cacb33f35e265961b164b14aa77477438340e635b227752f31981f",
    "blockNumber": "0x25ce471",
    "transactionHash": "0xc3e64ac247ae2343335596e106d1b97e35637656e1b99b37977a4165b34aeeb4",
    "transactionIndex": "0x44",
    "logIndex": "0x12d",
    "removed": false
    },
    {
    "address": "0xfd8ec18d48ac1f46b600e231da07d1da8209ceef",
    "topics": [
    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
    "0x0000000000000000000000000000000000000000000000000000000000000000",
    "0x000000000000000000000000026b37a09af3ceb346c39999c5738f86a1a48f4d",
    "0x000000000000000000000000000000000000000000000000000000000000007f"
    ],
    "data": "0x",
    "blockHash": "0x638a175940cacb33f35e265961b164b14aa77477438340e635b227752f31981f",
    "blockNumber": "0x25ce471",
    "transactionHash": "0xc3e64ac247ae2343335596e106d1b97e35637656e1b99b37977a4165b34aeeb4",
    "transactionIndex": "0x44",
    "logIndex": "0x12e",
    "removed": false
    },
    {
    "address": "0x00005ea00ac477b1030ce78506496e8c2de24bf5",
    "topics": [
    "0xe90cf9cc0a552cf52ea6ff74ece0f1c8ae8cc9ad630d3181f55ac43ca076b7d6",
    "0x000000000000000000000000fd8ec18d48ac1f46b600e231da07d1da8209ceef",
    "0x000000000000000000000000026b37a09af3ceb346c39999c5738f86a1a48f4d",
    "0x0000000000000000000000000000a26b00c1f0df003000390027140000faa719"
    ],
    "data": "0x000000000000000000000000026b37a09af3ceb346c39999c5738f86a1a48f4d0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000000000",
    "blockHash": "0x638a175940cacb33f35e265961b164b14aa77477438340e635b227752f31981f",
    "blockNumber": "0x25ce471",
    "transactionHash": "0xc3e64ac247ae2343335596e106d1b97e35637656e1b99b37977a4165b34aeeb4",
    "transactionIndex": "0x44",
    "logIndex": "0x12f",
    "removed": false
    },
    {
    "address": "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789",
    "topics": [
    "0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f",
    "0xa890d7c0dccfd6cebc025919f4857ab97953ae218e82f5e24c297f02ceea5b21",
    "0x000000000000000000000000026b37a09af3ceb346c39999c5738f86a1a48f4d",
    "0x000000000000000000000000a312d8d37be746bd09cbd9e9ba2ef16bc7da48ff"
    ],
    "data": "0x000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000001a036c1638be0000000000000000000000000000000000000000000000000000000000002e8d8",
    "blockHash": "0x638a175940cacb33f35e265961b164b14aa77477438340e635b227752f31981f",
    "blockNumber": "0x25ce471",
    "transactionHash": "0xc3e64ac247ae2343335596e106d1b97e35637656e1b99b37977a4165b34aeeb4",
    "transactionIndex": "0x44",
    "logIndex": "0x130",
    "removed": false
    }
    ],
    "receipt": {
    "transactionHash": "0xc3e64ac247ae2343335596e106d1b97e35637656e1b99b37977a4165b34aeeb4",
    "transactionIndex": "0x44",
    "blockHash": "0x638a175940cacb33f35e265961b164b14aa77477438340e635b227752f31981f",
    "blockNumber": "0x25ce471",
    "from": "0x1e6754b227c6ae4b0ca61d82f79d60660737554a",
    "to": "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789",
    "cumulativeGasUsed": "0x1716d3b",
    "gasUsed": "0x2b6c6",
    "contractAddress": null,
    "logs": [
    {
    "address": "0xfd8ec18d48ac1f46b600e231da07d1da8209ceef",
    "topics": [
    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
    "0x0000000000000000000000000000000000000000000000000000000000000000",
    "0x000000000000000000000000026b37a09af3ceb346c39999c5738f86a1a48f4d",
    "0x000000000000000000000000000000000000000000000000000000000000007f"
    ],
    "data": "0x",
    "blockHash": "0x638a175940cacb33f35e265961b164b14aa77477438340e635b227752f31981f",
    "blockNumber": "0x25ce471",
    "transactionHash": "0xc3e64ac247ae2343335596e106d1b97e35637656e1b99b37977a4165b34aeeb4",
    "transactionIndex": "0x44",
    "logIndex": "0x12e",
    "removed": false
    },
    ],
    "status": "0x1",
    "logsBloom": "0x000000000000000000000000000000000008000000000000000000000000000000080000000000000002001108040020001080000000000000000200004000000000000000000000000800080000008000000000000000000001000208400040000000000a0008000000000000000800000000000000004080800010020100040000000000000000100000000000010000000000200080000000000000000000210000000000000000400080000000000000000000000000108002000004004008000002000000000001001000800000000001000000800000148040020020000000000000000000000001000000000100000000000000000000002000100000",
    "type": "0x2",
    "effectiveGasPrice": "0x59682f2e"
    }

    Parameters

    • hash: string

      hash a userOpHash value returned by eth_sendUserOperation

    Returns Promise<Web3APIReturnType<API, eth_getUserOperationReceipt>>

    null in case the UserOperation is not yet included in a block, or UserOperation

link

  • link<T>(parentContext: T): void
  • Link current context to another context.


    Type parameters

    Parameters

    • parentContext: T

    Returns void

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

  • off<K>(eventName: K, fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>

    Returns void

on

  • on<K>(eventName: K, fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>

    Returns void

once

  • once<K>(eventName: K, fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>

    Returns void

registerPlugin

  • Parameters

    Returns void

removeAllListeners

  • Returns EventEmitter

publicsendUserOperation

  • Sends a UserOperation to the bundler. If accepted, the bundler will add it to the UserOperation mempool and return a userOpHash.

    @example
        sendUserOperation({
    sender: "0x9fd042a18e90ce326073fa70f111dc9d798d9a52",
    nonce: "123",
    initCode: "0x68656c6c6f",
    callData: "0x776F726C64",
    callGasLimit: "1000",
    verificationGasLimit: "2300",
    preVerificationGas: "3100",
    maxFeePerGas: "8500",
    maxPriorityFeePerGas: "1",
    paymasterAndData: "0x626c6f63746f",
    signature: "0x636c656d656e74"
    },"0x636c656d656e74").then(console.log);
    > 0xe554d0701f7fdc734f84927d109537f1ac4ee4ebfa3670c71d224a4fa15dbcd1

    Parameters

    • userOperation: UserOperation
    • entryPoint: string

      a singleton contract to execute bundles of UserOperations. Bundlers/Clients whitelist the supported entrypoint.

    Returns Promise<Web3APIReturnType<API, eth_sendUserOperation>>

    userOperation hash or throws error instead of balance.

setConfig

  • Parameters

    Returns void

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

setProvider

  • Will set the provider.


    Parameters

    Returns boolean

    Returns true if the provider was set

setRequestManagerMiddleware

  • Parameters

    Returns void

publicsupportedEntryPoints

  • Returns an array of the entryPoint addresses supported by the client. The first element of the array SHOULD be the entryPoint addressed preferred by the client.

    @example
        supportedEntryPoints().then(console.log);
    > ["0xcd01C8aa8995A59eB7B2627E69b40e0524B5ecf8", "0x7A0A0d159218E6a2f407B99173A2b12A6DDfC2a6"]

    Returns Promise<Web3APIReturnType<API, eth_supportedEntryPoints>>

    an array of the entryPoint addresses supported by the client. The first element of the array SHOULD be the entryPoint addressed preferred by the client.

use

  • Use to create new object of any type extended by Web3Context and link it to current context. This can be used to initiate a global context object and then use it to create new objects of any type extended by Web3Context.


    Type parameters

    Parameters

    Returns T

staticfromContextObject