BaseContract
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:18
An interface for objects which have an address, and can resolve it asyncronously.
This allows objects such as [[Signer]] or [[Contract]] to be used most places an address can be, for example getting the balance.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BaseContract( target, abi, runner?, _deployTx?): BaseContract;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:56
Creates a new contract connected to %%target%% with the %%abi%% and optionally connected to a %%runner%% to perform operations on behalf of.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
target | | string | Addressable |
abi | | Interface | InterfaceAbi |
runner? | | null | ContractRunner |
_deployTx? | | null | TransactionResponse |
Returns
Section titled “Returns”BaseContract
Properties
Section titled “Properties”[internal]
Section titled “[internal]”readonly [internal]: any;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:46
@_ignore:
fallback
Section titled “fallback”readonly fallback: | null | WrappedFallback;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:50
The fallback or receive function if any.
filters
Section titled “filters”readonly filters: Record<string, ContractEvent>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:42
All the Events available on this contract.
interface
Section titled “interface”readonly interface: Interface;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:30
The contract Interface.
runner
Section titled “runner”readonly runner: | null | ContractRunner;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:38
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
Section titled “target”readonly target: | string | Addressable;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:26
The target to connect to.
This can be an address, ENS name or any [[Addressable]], such as
another contract. To get the resovled address, use the getAddress
method.
Methods
Section titled “Methods”addListener()
Section titled “addListener()”addListener(event, listener): Promise<BaseContract>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:147
Alias for [on].
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event | ContractEventName |
listener | Listener |
Returns
Section titled “Returns”Promise
<BaseContract
>
Implementation of
Section titled “Implementation of”attach()
Section titled “attach()”attach(target): BaseContract;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:66
Return a new Contract instance with the same ABI and runner, but a different %%target%%.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
target | | string | Addressable |
Returns
Section titled “Returns”BaseContract
connect()
Section titled “connect()”connect(runner): BaseContract;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:61
Return a new Contract instance with the same target and ABI, but a different %%runner%%.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
runner | | null | ContractRunner |
Returns
Section titled “Returns”BaseContract
deploymentTransaction()
Section titled “deploymentTransaction()”deploymentTransaction(): | null | ContractTransactionResponse;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:86
Return the transaction used to deploy this contract.
This is only available if this instance was returned from a [[ContractFactory]].
Returns
Section titled “Returns”| null
| ContractTransactionResponse
emit()
Section titled “emit()”emit(event, ...args): Promise<boolean>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:123
Emit an %%event%% calling all listeners with %%args%%.
Resolves to true
if any listeners were called.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event | ContractEventName |
…args | any [] |
Returns
Section titled “Returns”Promise
<boolean
>
Implementation of
Section titled “Implementation of”getAddress()
Section titled “getAddress()”getAddress(): Promise<string>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:70
Return the resolved address of this Contract.
Returns
Section titled “Returns”Promise
<string
>
Implementation of
Section titled “Implementation of”getDeployedCode()
Section titled “getDeployedCode()”getDeployedCode(): Promise<null | string>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:74
Return the deployed bytecode or null if no bytecode is found.
Returns
Section titled “Returns”Promise
<null
| string
>
getEvent()
Section titled “getEvent()”getEvent(key): ContractEvent;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:98
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
Section titled “Parameters”Parameter | Type |
---|---|
key | | string | EventFragment |
Returns
Section titled “Returns”getFunction()
Section titled “getFunction()”getFunction<T>(key): T;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:92
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
Section titled “Type Parameters”Type Parameter | Default type |
---|---|
T extends ContractMethod <any [], any , any > | ContractMethod <any [], any , any > |
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
key | | string | FunctionFragment |
Returns
Section titled “Returns”T
listenerCount()
Section titled “listenerCount()”listenerCount(event?): Promise<number>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:128
Resolves to the number of listeners of %%event%% or the total number of listeners if unspecified.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event? | ContractEventName |
Returns
Section titled “Returns”Promise
<number
>
Implementation of
Section titled “Implementation of”EventEmitterable
.listenerCount
listeners()
Section titled “listeners()”listeners(event?): Promise<Listener[]>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:133
Resolves to the listeners subscribed to %%event%% or all listeners if unspecified.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event? | ContractEventName |
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”off(event, listener?): Promise<BaseContract>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:138
Remove the %%listener%% from the listeners for %%event%% or remove all listeners if unspecified.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event | ContractEventName |
listener? | Listener |
Returns
Section titled “Returns”Promise
<BaseContract
>
Implementation of
Section titled “Implementation of”on(event, listener): Promise<BaseContract>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:112
Add an event %%listener%% for the %%event%%.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event | ContractEventName |
listener | Listener |
Returns
Section titled “Returns”Promise
<BaseContract
>
Implementation of
Section titled “Implementation of”once()
Section titled “once()”once(event, listener): Promise<BaseContract>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:117
Add an event %%listener%% for the %%event%%, but remove the listener after it is fired once.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event | ContractEventName |
listener | Listener |
Returns
Section titled “Returns”Promise
<BaseContract
>
Implementation of
Section titled “Implementation of”queryFilter()
Section titled “queryFilter()”queryFilter( event, fromBlock?, toBlock?): Promise<( | Log| EventLog)[]>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:108
Provide historic access to event data for %%event%% in the range
%%fromBlock%% (default: 0
) to %%toBlock%% (default: "latest"
)
inclusive.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event | ContractEventName |
fromBlock? | BlockTag |
toBlock? | BlockTag |
Returns
Section titled “Returns”Promise
<(
| Log
| EventLog
)[]>
queryTransaction()
Section titled “queryTransaction()”queryTransaction(hash): Promise<EventLog[]>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:102
@_ignore:
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
hash | string |
Returns
Section titled “Returns”removeAllListeners()
Section titled “removeAllListeners()”removeAllListeners(event?): Promise<BaseContract>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:143
Remove all the listeners for %%event%% or remove all listeners if unspecified.
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event? | ContractEventName |
Returns
Section titled “Returns”Promise
<BaseContract
>
Implementation of
Section titled “Implementation of”EventEmitterable
.removeAllListeners
removeListener()
Section titled “removeListener()”removeListener(event, listener): Promise<BaseContract>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:151
Alias for [off].
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
event | ContractEventName |
listener | Listener |
Returns
Section titled “Returns”Promise
<BaseContract
>
Implementation of
Section titled “Implementation of”EventEmitterable
.removeListener
waitForDeployment()
Section titled “waitForDeployment()”waitForDeployment(): Promise<BaseContract>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:79
Resolve to this Contract once the bytecode has been deployed, or resolve immediately if already deployed.
Returns
Section titled “Returns”Promise
<BaseContract
>
buildClass()
Section titled “buildClass()”static buildClass<T>(abi): (target, runner?) => BaseContract & Omit<T, keyof BaseContract>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:155
Create a new Class for the %%abi%%.
Type Parameters
Section titled “Type Parameters”Type Parameter | Default type |
---|---|
T | ContractInterface |
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
abi | | Interface | InterfaceAbi |
Returns
Section titled “Returns”new buildClass(target, runner?): BaseContract & Omit<T, keyof BaseContract>;
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
target | string |
runner? | | null | ContractRunner |
Returns
Section titled “Returns”BaseContract
& Omit
<T
, keyof BaseContract
>
from()
Section titled “from()”static from<T>( target, abi,runner?): BaseContract & Omit<T, keyof BaseContract>;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/contract/contract.d.ts:159
Create a new BaseContract with a specified Interface.
Type Parameters
Section titled “Type Parameters”Type Parameter | Default type |
---|---|
T | ContractInterface |
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
target | string |
abi | | Interface | InterfaceAbi |
runner? | | null | ContractRunner |
Returns
Section titled “Returns”BaseContract
& Omit
<T
, keyof BaseContract
>