Optional
providerOrContext: string | SupportedProviders<any> | Web3ContextInitOptionsProtected
Optional
_accountProtected
_contractProtected
_requestProtected
_rpcProtected
_subscriptionProtected
Optional
_walletReadonly
providersStatic
Optional
givenStatic
modulesStatic
onStatic
Readonly
providersStatic
requestEIP6963Static
utilsStatic
versionThe 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 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.
Protected
contractReturns the fee for the transaction.
Transaction object.
The format of the return value.
Returns an estimate of the gas required for a L1 to L2 transaction.
Transaction object.
The format of the return value.
Returns gas estimation for an L1 to L2 execute operation.
The transaction details.
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.
Returns all balances for confirmed tokens given by an account address.
The account address.
The format of the return value.
Returns additional ZKsync-specific information about the L2 block.
committed: The batch is closed and the state transition it creates exists on layer 1. proven: The batch proof has been created, submitted, and accepted on layer 1. executed: The batch state transition has been executed on L1; meaning the root state has been updated.
The number of the block.
The format of the return value.
Returns L1/L2 addresses of default bridges.
The format of the return value.
Returns bytecode of a transaction given by its hash.
Bytecode hash as string.
The format of the return value.
Returns the addresses of the default ZKsync Era bridge contracts on both L1 and L2.
Calls the zks_getBridgeContracts JSON-RPC method.
Returns the range of blocks contained within a batch given by batch number. The range is given by beginning/end block numbers in hexadecimal.
The layer 1 batch number.
The format of the return value.
Returns data pertaining to a given batch.
The layer 1 batch number.
The format of the return value.
Given a transaction hash, and an index of the L2 to L1 log produced within the transaction, it returns the proof for the corresponding L2 to L1 log.
The index of the log that can be obtained from the transaction receipt (it includes a list of every log produced by the transaction)
Hash of the L2 transaction the L2 to L1 log was produced within.
Optional
l2ToL1LogIndex: NumbersThe index of the L2 to L1 log in the transaction (optional).
The format of the return value.
Returns the main ZKsync Era smart contract address.
Calls the zks_getMainContract JSON-RPC method.
Returns the transaction confirmation data that is part of L2->L1
message.
The hash of the L2 transaction where the message was initiated.
Optional
index: number = 0In case there were multiple transactions in one message, you may pass an index of the transaction which confirmation data should be fetched.
Returns Merkle proofs for one or more storage values at the specified account along with a Merkle proof of their authenticity. This allows to verify that the values have not been tampered with. More details: https://docs.zksync.io/build/api.html#zks-getproof
The account to fetch storage values and proofs for.
Vector of storage keys in the account.
Number of the L1 batch specifying the point in time at which the requested values are returned.
The format of the return value.
Returns data of transactions in a block.
Block number.
The format of the return value.
Returns the testnet paymaster address
if available, or null
.
Calls the zks_getTestnetPaymaster JSON-RPC method.
Returns data from a specific transaction given by the transaction hash.
Transaction hash as string.
The format of the return value.
Returns the status of a specified transaction.
The hash of the transaction.
Returns the populated transfer transaction.
Transfer transaction request.
Returns the populated withdrawal transaction.
The transaction details.
Optional
accessList?: The access list which contains the addresses/storage slots which the transaction wishes to access
Optional
chainId?: string | number | bigintThe transaction's chain ID
Optional
customData?: Optional
data?: string | number | bigint | number[] | Uint8ArrayThis will contain the data of the message or the init of a contract.
Optional
eip712Meta?: The custom data for EIP712 transaction metadata.
Optional
from?: stringOptional
gasLimit?: string | number | bigint | Uint8ArrayThe transaction's gas limit.
Optional
gasPrice?: null | string | number | bigint | Uint8ArrayThe transaction's gas price. To be used if maxPriorityFeePerGas and maxFeePerGas were not provided
Optional
hash?: stringOptional
maxFeePerGas?: string | number | bigint | Uint8ArrayThe maximum total fee
Optional
maxPriorityFeePerGas?: string | number | bigint | Uint8ArrayThe maximum inclusion fee per gas (this fee is given to the miner)
Optional
nonce?: string | number | bigint | Uint8ArrayThe transaction's nonce.
Optional
r?: string | number | bigint | Uint8ArrayEC signature parameter.
Optional
s?: string | number | bigint | Uint8ArrayEC signature parameter.
Optional
signature?: stringOptional
to?: string | Uint8Array | AddressThe transaction's the address is sent to.
Optional
type?: string | number | bigintThe transaction type
Optional
v?: string | number | bigint | Uint8ArrayEC recovery ID.
Optional
value?: string | number | bigint | Uint8ArrayThe amount of Ether sent.
Will set the provider.
Optional
provider: string | SupportedProviders<EthExecutionAPI>SupportedProviders The provider to set
Returns true if the provider was set
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
.
Static
fromStatic
initCreates a new Provider
from provided URL or network name.
Will return the Web3BatchRequest constructor.