Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ContractCache

Look up contracts or ABIs by name or address. Values are cached. Also offers a contract resolver to easily retrieve an [[ethers.Contract]] object.

Hierarchy

  • ContractCache

Index

Constructors

constructor

Properties

abiMapping

abiMapping: AbiMapping

contractCache

contractCache: Map<number, Map<string, ethers.Contract>>

ifaceCache

ifaceCache: Map<number, Map<string, ethers.utils.Interface>>

providerSource

providerSource: ProviderSource

Methods

getAbiInterfaceByName

  • getAbiInterfaceByName(abiName: any): Promise<ethers.utils.Interface>
  • Lookup an [[ethers.utils.Interface]] by abi name

    Parameters

    • abiName: any

      The name of the ABI added in the AbiMapping

    Returns Promise<ethers.utils.Interface>

getChainId

  • getChainId(): Promise<number>
  • Returns Promise<number>

getContractByAddress

  • getContractByAddress(address: string, abi?: string): Promise<ethers.Contract>
  • Lookup a contract by address

    Parameters

    • address: string

      The address that the contract was added under in the AbiMapping

    • Optional abi: string

    Returns Promise<ethers.Contract>

getContractByName

  • getContractByName(contractName: string): Promise<ethers.Contract>
  • Lookup a contract by name.

    Parameters

    • contractName: string

      The contract name used to register the contract in the AbiMapping

    Returns Promise<ethers.Contract>

resolveContract

  • resolveContract(resolveContractOptions: ResolveContractOptions): Promise<ethers.Contract>
  • Parameters

    • resolveContractOptions: ResolveContractOptions

    Returns Promise<ethers.Contract>

Generated using TypeDoc