A BaseContract with no type guards on its methods or events.

Extends

Properties

PropertyModifierTypeDescriptionInherited from
fallbackreadonlynull | WrappedFallbackThe fallback or receive function if any._ContractBase().fallback
filtersreadonlyRecord<string, ContractEvent<any[]>>All the Events available on this contract._ContractBase().filters
interfacereadonlyInterfaceThe contract Interface._ContractBase().interface
runnerreadonlynull | ContractRunnerThe connected runner. This is generally a Provider or a
Signer, which dictates what operations are supported.

For example, a Contract connected to a Provider may only execute read-only
operations.
_ContractBase().runner
targetreadonlystring | AddressableThe target to connect to.

This can be an address or any Addressable, such as another contract. To get the
resolved address, use the getAddress method.
_ContractBase().target

Methods

addListener()

addListener(event, listener): Promise<Contract>

Alias for on.

Parameters

ParameterTypeDescription
eventContractEventNameThe event to listen for.
listenerListenerThe listener to call when the event is emitted.

Returns

Promise<Contract>

Inherited from

_ContractBase().addListener

Source

contract/contract.ts:1490


attach()

attach(target): BaseContract

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

Parameters

ParameterTypeDescription
targetstring | AddressableThe target to connect to.

Returns

BaseContract

The new contract instance.

Inherited from

_ContractBase().attach

Source

contract/contract.ts:1167


connect()

connect(runner): BaseContract

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

Parameters

ParameterTypeDescription
runnernull | ContractRunnerThe runner to use.

Returns

BaseContract

The new contract instance.

Inherited from

_ContractBase().connect

Source

contract/contract.ts:1157


deploymentTransaction()

deploymentTransaction(): null | ContractTransactionResponse

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.

Inherited from

_ContractBase().deploymentTransaction

Source

contract/contract.ts:1248


emit()

emit(event, ...args): Promise<boolean>

Emit an event calling all listeners with args.

Resolves to true if any listeners were called.

Parameters

ParameterTypeDescription
eventContractEventNameThe event to emit.
argsany[]The arguments to pass to the listeners.

Returns

Promise<boolean>

true if any listeners were called.

Inherited from

_ContractBase().emit

Source

contract/contract.ts:1379


getAddress()

getAddress(): Promise<string>

Return the resolved address of this Contract.

Returns

Promise<string>

The resolved address.

Inherited from

_ContractBase().getAddress

Source

contract/contract.ts:1176


getDeployedCode()

getDeployedCode(): Promise<null | string>

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

Returns

Promise<null | string>

The deployed bytecode or null.

Inherited from

_ContractBase().getDeployedCode

Throws

If the runner does not support .provider.

Source

contract/contract.ts:1186


getEvent()

getEvent(key): ContractEvent<any[]>

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

ParameterTypeDescription
keystring | EventFragmentThe name of the event to return.

Returns

ContractEvent<any[]>

The event for the given name.

Inherited from

_ContractBase().getEvent

Source

contract/contract.ts:1274


getFunction()

getFunction<T>(key): T

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

Type parameterValue
T extends ContractMethod<any[], any, any, T>ContractMethod<any[], any, any>

Parameters

ParameterTypeDescription
keystring | FunctionFragmentThe name of the function to return.

Returns

T

The function for the given name.

Inherited from

_ContractBase().getFunction

Source

contract/contract.ts:1259


listenerCount()

listenerCount(event?): Promise<number>

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

Parameters

ParameterTypeDescription
event?ContractEventNameThe event to count listeners for.

Returns

Promise<number>

The number of listeners.

Inherited from

_ContractBase().listenerCount

Source

contract/contract.ts:1389


listeners()

listeners(event?): Promise<Listener[]>

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

Parameters

ParameterTypeDescription
event?ContractEventNameThe event to get listeners for.

Returns

Promise<Listener[]>

The listeners.

Inherited from

_ContractBase().listeners

Source

contract/contract.ts:1413


off()

off(event, listener?): Promise<Contract>

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

Parameters

ParameterTypeDescription
eventContractEventNameThe event to remove the listener from.
listener?ListenerThe listener to remove.

Returns

Promise<Contract>

This contract instance.

Inherited from

_ContractBase().off

Source

contract/contract.ts:1438


on()

on(event, listener): Promise<Contract>

Add an event listener for the event.

Parameters

ParameterTypeDescription
eventContractEventNameThe event to listen for.
listenerListenerThe listener to call when the event is emitted.

Returns

Promise<Contract>

This contract instance.

Inherited from

_ContractBase().on

Source

contract/contract.ts:1350


once()

once(event, listener): Promise<Contract>

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

Parameters

ParameterTypeDescription
eventContractEventNameThe event to listen for.
listenerListenerThe listener to call when the event is emitted.

Returns

Promise<Contract>

Inherited from

_ContractBase().once

Source

contract/contract.ts:1363


queryFilter()

queryFilter(
   event, 
   fromBlock?, 
toBlock?): Promise<(EventLog | Log)[]>

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

Parameters

ParameterTypeDescription
eventContractEventNameThe event to query.
fromBlock?BlockTagThe block to start querying from.
toBlock?BlockTagThe block to stop querying at.

Returns

Promise<(EventLog | Log)[]>

An array of event logs.

Inherited from

_ContractBase().queryFilter

Source

contract/contract.ts:1300


removeAllListeners()

removeAllListeners(event?): Promise<Contract>

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

Parameters

ParameterTypeDescription
event?ContractEventNameThe event to remove the listeners from.

Returns

Promise<Contract>

This contract instance.

Inherited from

_ContractBase().removeAllListeners

Source

contract/contract.ts:1465


removeListener()

removeListener(event, listener): Promise<Contract>

Alias for off.

Parameters

ParameterTypeDescription
eventContractEventNameThe event to remove the listener from.
listenerListenerThe listener to remove.

Returns

Promise<Contract>

Inherited from

_ContractBase().removeListener

Source

contract/contract.ts:1500


waitForDeployment()

waitForDeployment(): Promise<Contract>

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

Returns

Promise<Contract>

The contract instance.

Inherited from

_ContractBase().waitForDeployment

Throws

If the contract runner does not support .provider.

Source

contract/contract.ts:1205