@ethersproject/contracts

  • Version 5.6.1
  • Published
  • 250 kB
  • 10 dependencies
  • MIT license

Install

npm i @ethersproject/contracts
yarn add @ethersproject/contracts
pnpm add @ethersproject/contracts

Overview

Contract abstraction meta-class for ethers.

Index

Classes

class BaseContract

class BaseContract {}

    constructor

    constructor(
    addressOrName: string,
    contractInterface: any,
    signerOrProvider?: any
    );

      property address

      readonly address: string;

        property callStatic

        readonly callStatic: { [name: string]: ContractFunction<any> };

          property deployTransaction

          readonly deployTransaction: TransactionResponse;

            property estimateGas

            readonly estimateGas: { [name: string]: ContractFunction<BigNumber> };

              property filters

              readonly filters: { [name: string]: (...args: Array<any>) => EventFilter };

                property functions

                readonly functions: { [name: string]: ContractFunction<any> };

                  property interface

                  readonly interface: Interface;

                    property populateTransaction

                    readonly populateTransaction: {
                    [name: string]: ContractFunction<PopulatedTransaction>;
                    };

                      property provider

                      readonly provider: Provider;

                        property resolvedAddress

                        readonly resolvedAddress: Promise<string>;

                          property signer

                          readonly signer: Signer;

                            method attach

                            attach: (addressOrName: string) => Contract;

                              method connect

                              connect: (signerOrProvider: Signer | Provider | string) => Contract;

                                method deployed

                                deployed: () => Promise<Contract>;

                                  method emit

                                  emit: (eventName: EventFilter | string, ...args: Array<any>) => boolean;

                                    method fallback

                                    fallback: (overrides?: TransactionRequest) => Promise<TransactionResponse>;

                                      method getContractAddress

                                      static getContractAddress: (transaction: {
                                      from: string;
                                      nonce: BigNumberish;
                                      }) => string;

                                        method getInterface

                                        static getInterface: (contractInterface: ContractInterface) => Interface;

                                          method isIndexed

                                          static isIndexed: (value: any) => value is Indexed;

                                            method listenerCount

                                            listenerCount: (eventName?: EventFilter | string) => number;

                                              method listeners

                                              listeners: (eventName?: EventFilter | string) => Array<Listener>;

                                                method off

                                                off: (eventName: EventFilter | string, listener: Listener) => this;

                                                  method on

                                                  on: (event: EventFilter | string, listener: Listener) => this;

                                                    method once

                                                    once: (event: EventFilter | string, listener: Listener) => this;

                                                      method queryFilter

                                                      queryFilter: (
                                                      event: EventFilter,
                                                      fromBlockOrBlockhash?: BlockTag | string,
                                                      toBlock?: BlockTag
                                                      ) => Promise<Array<Event>>;

                                                        method removeAllListeners

                                                        removeAllListeners: (eventName?: EventFilter | string) => this;

                                                          method removeListener

                                                          removeListener: (eventName: EventFilter | string, listener: Listener) => this;

                                                            class Contract

                                                            class Contract extends BaseContract {}

                                                              class ContractFactory

                                                              class ContractFactory {}

                                                                constructor

                                                                constructor(contractInterface: any, bytecode: any, signer?: Signer);

                                                                  property bytecode

                                                                  readonly bytecode: string;

                                                                    property interface

                                                                    readonly interface: Interface;

                                                                      property signer

                                                                      readonly signer: Signer;

                                                                        method attach

                                                                        attach: (address: string) => Contract;

                                                                          method connect

                                                                          connect: (signer: Signer) => ContractFactory;

                                                                            method deploy

                                                                            deploy: (...args: Array<any>) => Promise<Contract>;

                                                                              method fromSolidity

                                                                              static fromSolidity: (compilerOutput: any, signer?: Signer) => ContractFactory;

                                                                                method getContract

                                                                                static getContract: (
                                                                                address: string,
                                                                                contractInterface: ContractInterface,
                                                                                signer?: Signer
                                                                                ) => Contract;

                                                                                  method getContractAddress

                                                                                  static getContractAddress: (tx: {
                                                                                  from: string;
                                                                                  nonce: BytesLike | BigNumber | number;
                                                                                  }) => string;

                                                                                    method getDeployTransaction

                                                                                    getDeployTransaction: (...args: Array<any>) => TransactionRequest;

                                                                                      method getInterface

                                                                                      static getInterface: (contractInterface: ContractInterface) => Interface;

                                                                                        Interfaces

                                                                                        interface CallOverrides

                                                                                        interface CallOverrides extends PayableOverrides {}

                                                                                          property blockTag

                                                                                          blockTag?: BlockTag | Promise<BlockTag>;

                                                                                            property from

                                                                                            from?: string | Promise<string>;

                                                                                              interface ContractReceipt

                                                                                              interface ContractReceipt extends TransactionReceipt {}

                                                                                                property events

                                                                                                events?: Array<Event>;

                                                                                                  interface ContractTransaction

                                                                                                  interface ContractTransaction extends TransactionResponse {}

                                                                                                    method wait

                                                                                                    wait: (confirmations?: number) => Promise<ContractReceipt>;

                                                                                                      interface Event

                                                                                                      interface Event extends Log {}

                                                                                                        property args

                                                                                                        args?: Result;

                                                                                                          property decode

                                                                                                          decode?: (data: string, topics?: Array<string>) => any;

                                                                                                            property decodeError

                                                                                                            decodeError?: Error;

                                                                                                              property event

                                                                                                              event?: string;

                                                                                                                property eventSignature

                                                                                                                eventSignature?: string;

                                                                                                                  property getBlock

                                                                                                                  getBlock: () => Promise<Block>;

                                                                                                                    property getTransaction

                                                                                                                    getTransaction: () => Promise<TransactionResponse>;

                                                                                                                      property getTransactionReceipt

                                                                                                                      getTransactionReceipt: () => Promise<TransactionReceipt>;

                                                                                                                        property removeListener

                                                                                                                        removeListener: () => void;

                                                                                                                          interface Overrides

                                                                                                                          interface Overrides {}

                                                                                                                            property accessList

                                                                                                                            accessList?: AccessListish;

                                                                                                                              property ccipReadEnabled

                                                                                                                              ccipReadEnabled?: boolean;

                                                                                                                                property customData

                                                                                                                                customData?: Record<string, any>;

                                                                                                                                  property gasLimit

                                                                                                                                  gasLimit?: BigNumberish | Promise<BigNumberish>;

                                                                                                                                    property gasPrice

                                                                                                                                    gasPrice?: BigNumberish | Promise<BigNumberish>;

                                                                                                                                      property maxFeePerGas

                                                                                                                                      maxFeePerGas?: BigNumberish | Promise<BigNumberish>;

                                                                                                                                        property maxPriorityFeePerGas

                                                                                                                                        maxPriorityFeePerGas?: BigNumberish | Promise<BigNumberish>;

                                                                                                                                          property nonce

                                                                                                                                          nonce?: BigNumberish | Promise<BigNumberish>;

                                                                                                                                            property type

                                                                                                                                            type?: number;

                                                                                                                                              interface PayableOverrides

                                                                                                                                              interface PayableOverrides extends Overrides {}

                                                                                                                                                property value

                                                                                                                                                value?: BigNumberish | Promise<BigNumberish>;

                                                                                                                                                  interface PopulatedTransaction

                                                                                                                                                  interface PopulatedTransaction {}

                                                                                                                                                    property accessList

                                                                                                                                                    accessList?: AccessList;

                                                                                                                                                      property ccipReadEnabled

                                                                                                                                                      ccipReadEnabled?: boolean;

                                                                                                                                                        property chainId

                                                                                                                                                        chainId?: number;

                                                                                                                                                          property customData

                                                                                                                                                          customData?: Record<string, any>;

                                                                                                                                                            property data

                                                                                                                                                            data?: string;

                                                                                                                                                              property from

                                                                                                                                                              from?: string;

                                                                                                                                                                property gasLimit

                                                                                                                                                                gasLimit?: BigNumber;

                                                                                                                                                                  property gasPrice

                                                                                                                                                                  gasPrice?: BigNumber;

                                                                                                                                                                    property maxFeePerGas

                                                                                                                                                                    maxFeePerGas?: BigNumber;

                                                                                                                                                                      property maxPriorityFeePerGas

                                                                                                                                                                      maxPriorityFeePerGas?: BigNumber;

                                                                                                                                                                        property nonce

                                                                                                                                                                        nonce?: number;

                                                                                                                                                                          property to

                                                                                                                                                                          to?: string;

                                                                                                                                                                            property type

                                                                                                                                                                            type?: number;

                                                                                                                                                                              property value

                                                                                                                                                                              value?: BigNumber;

                                                                                                                                                                                Type Aliases

                                                                                                                                                                                type ContractFunction

                                                                                                                                                                                type ContractFunction<T = any> = (...args: Array<any>) => Promise<T>;

                                                                                                                                                                                  type ContractInterface

                                                                                                                                                                                  type ContractInterface =
                                                                                                                                                                                  | string
                                                                                                                                                                                  | ReadonlyArray<Fragment | JsonFragment | string>
                                                                                                                                                                                  | Interface;

                                                                                                                                                                                    type EventFilter

                                                                                                                                                                                    type EventFilter = {
                                                                                                                                                                                    address?: string;
                                                                                                                                                                                    topics?: Array<string | Array<string>>;
                                                                                                                                                                                    };

                                                                                                                                                                                      Package Files (1)

                                                                                                                                                                                      Dependencies (10)

                                                                                                                                                                                      Dev Dependencies (0)

                                                                                                                                                                                      No dev dependencies.

                                                                                                                                                                                      Peer Dependencies (0)

                                                                                                                                                                                      No peer dependencies.

                                                                                                                                                                                      Badge

                                                                                                                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ethersproject/contracts.

                                                                                                                                                                                      • Markdown
                                                                                                                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@ethersproject/contracts)
                                                                                                                                                                                      • HTML
                                                                                                                                                                                        <a href="https://www.jsdocs.io/package/@ethersproject/contracts"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>