Create a new ContractFactory
for a contract with the provided ABI and bytecode.
The ABI (Application Binary Interface) of the contract.
The bytecode of the contract.
Optional
deploymentType: DeploymentTypeThe deployment type, defaults to 'create'.
Protected
Optional
_accountProtected
_requestProtected
_subscriptionProtected
Optional
_walletReadonly
abiThe Contract Interface.
Readonly
bytecodeThe Contract deployment bytecode. Often called the initcode.
Readonly
contractReadonly
deploymentThe deployment type that is currently in use.
Readonly
providersReadonly
zkStatic
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 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
checkDeploys a new contract or account instance on the L2 blockchain.
Optional
args: ContractConstructorArgs<Abi>Constructor arguments for the contract
Optional
overrides: OverridesUsed for providing salt to create2 and create2Account deployment types and for providing custom factoryDeps
const deployedContract = await contractFactory.deploy(arg1, arg2, ...);
const deployedContractWithSaltAndDeps = await contractFactory.deploy(arg1, arg2, ..., {
customData: {
factoryDeps: ['0x...']
}
});
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.
Optional
overrides: OverridesWill set the provider.
Optional
provider: string | SupportedProviders<unknown>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
from
A
ContractFactory
is used to deploy aContract
to the blockchain.