2023-03-04 04:25:07 +03:00
|
|
|
import { Interface } from "../abi/index.js";
|
|
|
|
import { Log, TransactionResponse } from "../providers/provider.js";
|
|
|
|
import { ContractTransactionResponse, EventLog } from "./wrappers.js";
|
|
|
|
import type { EventFragment, FunctionFragment, InterfaceAbi, ParamType } from "../abi/index.js";
|
|
|
|
import type { Addressable } from "../address/index.js";
|
|
|
|
import type { EventEmitterable, Listener } from "../utils/index.js";
|
2023-03-20 19:53:37 +03:00
|
|
|
import type { BlockTag, ContractRunner } from "../providers/index.js";
|
|
|
|
import type { ContractEventName, ContractInterface, ContractMethod, ContractEvent, ContractTransaction, WrappedFallback } from "./types.js";
|
2023-03-04 04:25:07 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
|
|
|
export declare function copyOverrides<O extends string = "data" | "to">(arg: any, allowed?: Array<string>): Promise<Omit<ContractTransaction, O>>;
|
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
|
|
|
export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray<ParamType>, args: Array<any>): Promise<Array<any>>;
|
|
|
|
declare const internal: unique symbol;
|
|
|
|
export declare class BaseContract implements Addressable, EventEmitterable<ContractEventName> {
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
readonly target: string | Addressable;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The contract Interface.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
readonly interface: Interface;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
readonly runner: null | ContractRunner;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* All the Events available on this contract.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
readonly filters: Record<string, ContractEvent>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
readonly [internal]: any;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* The fallback or receive function if any.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
readonly fallback: null | WrappedFallback;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Creates a new contract connected to %%target%% with the %%abi%% and
|
|
|
|
* optionally connected to a %%runner%% to perform operations on behalf
|
|
|
|
* of.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse);
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Return a new Contract instance with the same target and ABI, but
|
|
|
|
* a different %%runner%%.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
connect(runner: null | ContractRunner): BaseContract;
|
2023-06-14 04:47:44 +03:00
|
|
|
/**
|
|
|
|
* Return a new Contract instance with the same ABI and runner, but
|
|
|
|
* a different %%target%%.
|
|
|
|
*/
|
|
|
|
attach(target: string | Addressable): BaseContract;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Return the resolved address of this Contract.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
getAddress(): Promise<string>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
2023-07-16 00:55:24 +03:00
|
|
|
* Return the deployed bytecode or null if no bytecode is found.
|
2023-06-02 00:52:58 +03:00
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
getDeployedCode(): Promise<null | string>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Resolve to this Contract once the bytecode has been deployed, or
|
|
|
|
* resolve immediately if already deployed.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
waitForDeployment(): Promise<this>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Return the transaction used to deploy this contract.
|
|
|
|
*
|
|
|
|
* This is only available if this instance was returned from a
|
|
|
|
* [[ContractFactory]].
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
deploymentTransaction(): null | ContractTransactionResponse;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
getEvent(key: string | EventFragment): ContractEvent;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* @_ignore:
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
queryTransaction(hash: string): Promise<Array<EventLog>>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Provide historic access to event data for %%event%% in the range
|
|
|
|
* %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``)
|
|
|
|
* inclusive.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise<Array<EventLog | Log>>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Add an event %%listener%% for the %%event%%.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
on(event: ContractEventName, listener: Listener): Promise<this>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Add an event %%listener%% for the %%event%%, but remove the listener
|
|
|
|
* after it is fired once.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
once(event: ContractEventName, listener: Listener): Promise<this>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Emit an %%event%% calling all listeners with %%args%%.
|
|
|
|
*
|
|
|
|
* Resolves to ``true`` if any listeners were called.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
emit(event: ContractEventName, ...args: Array<any>): Promise<boolean>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the number of listeners of %%event%% or the total number
|
|
|
|
* of listeners if unspecified.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
listenerCount(event?: ContractEventName): Promise<number>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Resolves to the listeners subscribed to %%event%% or all listeners
|
|
|
|
* if unspecified.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
listeners(event?: ContractEventName): Promise<Array<Listener>>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Remove the %%listener%% from the listeners for %%event%% or remove
|
|
|
|
* all listeners if unspecified.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
off(event: ContractEventName, listener?: Listener): Promise<this>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Remove all the listeners for %%event%% or remove all listeners if
|
|
|
|
* unspecified.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
removeAllListeners(event?: ContractEventName): Promise<this>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Alias for [on].
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
addListener(event: ContractEventName, listener: Listener): Promise<this>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Alias for [off].
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
removeListener(event: ContractEventName, listener: Listener): Promise<this>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Create a new Class for the %%abi%%.
|
|
|
|
*/
|
2023-06-14 04:47:44 +03:00
|
|
|
static buildClass<T = ContractInterface>(abi: Interface | InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit<T, keyof BaseContract>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* Create a new BaseContract with a specified Interface.
|
|
|
|
*/
|
2023-06-14 04:47:44 +03:00
|
|
|
static from<T = ContractInterface>(target: string, abi: Interface | InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit<T, keyof BaseContract>;
|
2023-03-04 04:25:07 +03:00
|
|
|
}
|
2023-06-14 04:47:44 +03:00
|
|
|
declare const Contract_base: new (target: string, abi: Interface | InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit<ContractInterface, keyof BaseContract>;
|
2023-06-02 00:52:58 +03:00
|
|
|
/**
|
|
|
|
* A [[BaseContract]] with no type guards on its methods or events.
|
|
|
|
*/
|
2023-03-04 04:25:07 +03:00
|
|
|
export declare class Contract extends Contract_base {
|
|
|
|
}
|
|
|
|
export {};
|
2023-04-27 15:19:55 +03:00
|
|
|
//# sourceMappingURL=contract.d.ts.map
|