Skip to main content

ContractOptions

Index

Properties

optionaladdress

address?: string

The address used for this contract instance. All transactions generated by web3.js from this contract will contain this address as the to.

The address will be stored in lowercase.

myContract.options.address;
> '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'

// set a new address
myContract.options.address = '0x1234FFDD...';

optionalreadonlyfrom

from?: string

The address transactions should be made from.

optionalreadonlygas

gas?: string

The maximum gas provided for a transaction (gas limit).

optionalreadonlygasPrice

gasPrice?: string

The gas price in wei to use for transactions.

optionalreadonlyinput

input?: Bytes

The byte code of the contract. Used when the contract gets deployed

optionalmaxFeePerGas

maxFeePerGas?: string

The max fee per gas to use for transactions.

optionalmaxPriorityFeePerGas

maxPriorityFeePerGas?: string

The max priority fee per gas to use for transactions.

Accessors

jsonInterface

  • The json interface object derived from the ABI of this contract.

    Re-setting this will regenerate the methods and events of the contract instance.

    myContract.options.jsonInterface;
    > [{
    "type":"function",
    "name":"foo",
    "inputs": [{"name":"a","type":"uint256"}],
    "outputs": [{"name":"b","type":"address"}],
    "signature": "0x...",
    },{
    "type":"event",
    "name":"Event",
    "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"bytes32","indexed":false}],
    "signature": "0x...",
    }]

    // Set a new ABI interface
    // Note: the "signature" of every function and event's ABI is not needed to be provided when assigning.
    // It will be calculated and set automatically inside the setter.
    myContract.options.jsonInterface = [...];

    Returns ContractAbiWithSignature

  • Parameters

    Returns void