Protected
Optional
_accountProtected
_requestProtected
_subscriptionProtected
Optional
_walletReadonly
providersStatic
Optional
givenStatic
Readonly
providersWill return the Web3BatchRequest constructor.
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.
Will set the blockHeaderTimeout
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
.
Will set the contractDataInputFill
Will return the current provider. (The same as provider
)
Returns the current provider
Will set the current provider. (The same as provider
)
SupportedProviders The provider to set
This default address is used as the default from
property, if no from
property is specified in for the following methods:
Will set the default account.
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"
.
Will set the default block.
"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.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 chainnetworkId
- number
: Network ID of the custom chainchainId
- number
: Chain ID of the custom chainbaseChain
- string
: (optional) mainnet, goerli, kovan, rinkeby, or ropstenhardfork
- string
: (optional) chainstart, homestead, dao, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul, berlin, or london
Default is undefined
.Will set the default common property
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
Will set the default hardfork.
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.
Will set the enableExperimentalFeatures
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
.
The handleRevert
options property returns the revert reason string if enabled for the following methods:
false
.Note
: At the moment handleRevert
is only supported for sendTransaction
and not for sendSignedTransaction
Will set the handleRevert
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.
Will return the current provider.
Returns the current provider
Will set the current provider.
The provider to set
Accepted providers are of type SupportedProviders
Will return the current subscriptionManager (Web3SubscriptionManager)
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
.
Will set the transactionBlockTimeout.
This defines the number of blocks it requires until a transaction is considered confirmed.
Default is 24
.
Will set the transactionConfirmationBlocks.
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.
Will set the transactionPollingInterval.
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).
Will set the transactionPollingTimeout.
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
Will set the transactionReceiptPollingInterval
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).
Will set the transactionSendTimeout.
Request to add a new chain to the user's wallet.
See EIP-3085 for more details.
Details of the chain to add.
A Promise that resolves if the request is successful.
await web3.walletRpc.addEthereumChain({
chainId: 5000,
blockExplorerUrls: ["https://mantlescan.xyz"],
chainName: "Mantle",
iconUrls: ["https://icons.llamao.fi/icons/chains/rsz_mantle.jpg"],
nativeCurrency: {
name: "Mantle",
symbol: "MNT",
decimals: 18,
},
rpcUrls: ["https://rpc.mantle.xyz"],
});
Retrieve the list of permissions granted to the dApp.
See EIP-2255 for more details.
A Promise that resolves to an array of granted permissions.
Protected
registerRequest permissions for a dApp.
See EIP-2255 for more details.
Details of the permission request.
A Promise that resolves to an array of granted permissions.
Revoke permissions granted to the dApp.
Details of the permissions to revoke.
A Promise that resolves if the request is successful.
Switch the wallet's currently active chain.
If the specified chain does not exist in the wallet, an error will be thrown. To prevent errors, ensure the chain has been added first or handle the call within a try/catch block.
See EIP-3326 for more details.
The ID of the chain to switch to.
A Promise that resolves if the chain switch is successful.
Add an asset to the user's wallet.
See EIP-747 for more details.
Details of the asset to watch.
A Promise that resolves to true
if the request is successful.
Static
from
This Web3.js plugin adds support for various wallet-related RPC methods.
Example
Initialize the plugin