注意: このページはまだ日本語に翻訳されていません。以下は英語の原文です。Creates a new contract connected to target with the abi and optionally connected to a runner to perform operations on behalf of.
Implements
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
fallback | readonly | null | WrappedFallback | The fallback or receive function if any. |
filters | readonly | Record<string, ContractEvent<any[]>> | All the Events available on this contract. |
interface | readonly | Interface | The contract Interface. |
runner | readonly | null | ContractRunner | The 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. |
target | readonly | string | Addressable | The 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. |
Methods
addListener()
Parameters
| Parameter | Type | Description |
|---|---|---|
event | ContractEventName | The event to listen for. |
listener | Listener | The listener to call when the event is emitted. |
Returns
Promise<BaseContract>
Implementation of
EventEmitterable.addListener
Source
contract/contract.ts:1490attach()
target.
Parameters
| Parameter | Type | Description |
|---|---|---|
target | string | Addressable | The target to connect to. |
Returns
BaseContract
The new contract instance.
Source
contract/contract.ts:1167connect()
runner.
Parameters
| Parameter | Type | Description |
|---|---|---|
runner | null | ContractRunner | The runner to use. |
Returns
BaseContract
The new contract instance.
Source
contract/contract.ts:1157deploymentTransaction()
Returns
null | ContractTransactionResponse
The transaction used to deploy this contract or null.
Source
contract/contract.ts:1248emit()
event calling all listeners with args.
Resolves to true if any listeners were called.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | ContractEventName | The event to emit. |
…args | any[] | The arguments to pass to the listeners. |
Returns
Promise<boolean>
true if any listeners were called.
Implementation of
EventEmitterable.emit
Source
contract/contract.ts:1379getAddress()
Returns
Promise<string>
The resolved address.
Implementation of
Addressable.getAddress
Source
contract/contract.ts:1176getDeployedCode()
Returns
Promise<null | string>
The deployed bytecode or null.
Throws
If the runner does not support .provider.Source
contract/contract.ts:1186getEvent()
prototype or when using a Contract programatically.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | EventFragment | The name of the event to return. |
Returns
ContractEvent<any[]>
The event for the given name.
Source
contract/contract.ts:1274getFunction()
prototype or when using a Contract programatically.
Type parameters
| Type parameter | Value |
|---|---|
T extends ContractMethod<any[], any, any, T> | ContractMethod<any[], any, any> |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | FunctionFragment | The name of the function to return. |
Returns
T
The function for the given name.
Source
contract/contract.ts:1259listenerCount()
event or the total number of listeners if unspecified.
Parameters
| Parameter | Type | Description |
|---|---|---|
event? | ContractEventName | The event to count listeners for. |
Returns
Promise<number>
The number of listeners.
Implementation of
EventEmitterable.listenerCount
Source
contract/contract.ts:1389listeners()
event or all listeners if unspecified.
Parameters
| Parameter | Type | Description |
|---|---|---|
event? | ContractEventName | The event to get listeners for. |
Returns
Promise<Listener[]>
The listeners.
Implementation of
EventEmitterable.listeners
Source
contract/contract.ts:1413off()
listener from the listeners for event or remove all listeners if unspecified.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | ContractEventName | The event to remove the listener from. |
listener? | Listener | The listener to remove. |
Returns
Promise<BaseContract>
This contract instance.
Implementation of
EventEmitterable.off
Source
contract/contract.ts:1438on()
listener for the event.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | ContractEventName | The event to listen for. |
listener | Listener | The listener to call when the event is emitted. |
Returns
Promise<BaseContract>
This contract instance.
Implementation of
EventEmitterable.on
Source
contract/contract.ts:1350once()
listener for the event, but remove the listener after it is fired once.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | ContractEventName | The event to listen for. |
listener | Listener | The listener to call when the event is emitted. |
Returns
Promise<BaseContract>
Implementation of
EventEmitterable.once
Source
contract/contract.ts:1363queryFilter()
event in the range fromBlock (default: 0) to toBlock (default:
"latest") inclusive.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | ContractEventName | The event to query. |
fromBlock? | BlockTag | The block to start querying from. |
toBlock? | BlockTag | The block to stop querying at. |
Returns
Promise<(EventLog | Log)[]>
An array of event logs.
Source
contract/contract.ts:1300removeAllListeners()
event or remove all listeners if unspecified.
Parameters
| Parameter | Type | Description |
|---|---|---|
event? | ContractEventName | The event to remove the listeners from. |
Returns
Promise<BaseContract>
This contract instance.
Implementation of
EventEmitterable.removeAllListeners
Source
contract/contract.ts:1465removeListener()
Parameters
| Parameter | Type | Description |
|---|---|---|
event | ContractEventName | The event to remove the listener from. |
listener | Listener | The listener to remove. |
Returns
Promise<BaseContract>
Implementation of
EventEmitterable.removeListener
Source
contract/contract.ts:1500waitForDeployment()
Returns
Promise<BaseContract>
The contract instance.
Throws
If the contract runner does not support .provider.Source
contract/contract.ts:1205buildClass()
abi.
Type parameters
| Type parameter | Value |
|---|---|
T | ContractInterface |
Parameters
| Parameter | Type | Description |
|---|---|---|
abi | Interface | InterfaceAbi | The ABI to create the class from. |
Returns
Object
The new Class for the ABI.
Source
contract/contract.ts:1510from()
Type parameters
| Type parameter | Value |
|---|---|
T | ContractInterface |
Parameters
| Parameter | Type | Description |
|---|---|---|
target | string | The target to connect to. |
abi | Interface | InterfaceAbi | The ABI to use. |
runner? | null | ContractRunner | The runner to use. |
Returns
BaseContract & Omit<T, keyof BaseContract>
The new BaseContract.
