Skip to main content
Creates a new contract connected to target with the abi and optionally connected to a runner to perform operations on behalf of.

Implements

Properties

Methods

addListener()

Alias for on.

Parameters

Returns

Promise<BaseContract>

Implementation of

EventEmitterable.addListener

Source

contract/contract.ts:1490

attach()

Return a new Contract instance with the same ABI and runner, but a different target.

Parameters

Returns

BaseContract The new contract instance.

Source

contract/contract.ts:1167

connect()

Return a new Contract instance with the same target and ABI, but a different runner.

Parameters

Returns

BaseContract The new contract instance.

Source

contract/contract.ts:1157

deploymentTransaction()

Return the transaction used to deploy this contract. This is only available if this instance was returned from a ContractFactor.

Returns

null | ContractTransactionResponse The transaction used to deploy this contract or null.

Source

contract/contract.ts:1248

emit()

Emit an event calling all listeners with args. Resolves to true if any listeners were called.

Parameters

Returns

Promise<boolean> true if any listeners were called.

Implementation of

EventEmitterable.emit

Source

contract/contract.ts:1379

getAddress()

Return the resolved address of this Contract.

Returns

Promise<string> The resolved address.

Implementation of

Addressable.getAddress

Source

contract/contract.ts:1176

getDeployedCode()

Return the deployed bytecode or null if no bytecode is found.

Returns

Promise<null | string> The deployed bytecode or null.

Throws

If the runner does not support .provider.

Source

contract/contract.ts:1186

getEvent()

Return the event for a given name. This is useful when a contract event name conflicts with a JavaScript name such as prototype or when using a Contract programatically.

Parameters

Returns

ContractEvent<any[]> The event for the given name.

Source

contract/contract.ts:1274

getFunction()

Return the function for a given name. This is useful when a contract method name conflicts with a JavaScript name such as prototype or when using a Contract programatically.

Type parameters

Parameters

Returns

T The function for the given name.

Source

contract/contract.ts:1259

listenerCount()

Resolves to the number of listeners of event or the total number of listeners if unspecified.

Parameters

Returns

Promise<number> The number of listeners.

Implementation of

EventEmitterable.listenerCount

Source

contract/contract.ts:1389

listeners()

Resolves to the listeners subscribed to event or all listeners if unspecified.

Parameters

Returns

Promise<Listener[]> The listeners.

Implementation of

EventEmitterable.listeners

Source

contract/contract.ts:1413

off()

Remove the listener from the listeners for event or remove all listeners if unspecified.

Parameters

Returns

Promise<BaseContract> This contract instance.

Implementation of

EventEmitterable.off

Source

contract/contract.ts:1438

on()

Add an event listener for the event.

Parameters

Returns

Promise<BaseContract> This contract instance.

Implementation of

EventEmitterable.on

Source

contract/contract.ts:1350

once()

Add an event listener for the event, but remove the listener after it is fired once.

Parameters

Returns

Promise<BaseContract>

Implementation of

EventEmitterable.once

Source

contract/contract.ts:1363

queryFilter()

Provide historic access to event data for event in the range fromBlock (default: 0) to toBlock (default: "latest") inclusive.

Parameters

Returns

Promise<(EventLog | Log)[]> An array of event logs.

Source

contract/contract.ts:1300

removeAllListeners()

Remove all the listeners for event or remove all listeners if unspecified.

Parameters

Returns

Promise<BaseContract> This contract instance.

Implementation of

EventEmitterable.removeAllListeners

Source

contract/contract.ts:1465

removeListener()

Alias for off.

Parameters

Returns

Promise<BaseContract>

Implementation of

EventEmitterable.removeListener

Source

contract/contract.ts:1500

waitForDeployment()

Resolve to this Contract once the bytecode has been deployed, or resolve immediately if already deployed.

Returns

Promise<BaseContract> The contract instance.

Throws

If the contract runner does not support .provider.

Source

contract/contract.ts:1205

buildClass()

Create a new Class for the abi.

Type parameters

Parameters

Returns

Object The new Class for the ABI.

Source

contract/contract.ts:1510

from()

Create a new BaseContract with a specified Interface.

Type parameters

Parameters

Returns

BaseContract & Omit<T, keyof BaseContract> The new BaseContract.

Source

contract/contract.ts:1529