Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "util"

Index

Functions

getAbi

  • getAbi(contract: string): any
  • Gets a contract ABI as a JavaScript array. This method supports contracts used by the Compound Protocol.

    example
    console.log('cETH ABI: ', Compound.util.getAbi(Compound.cETH));

    Parameters

    • contract: string

      The name of the contract.

    Returns any

    Returns the ABI of the contract as a JavaScript array.

getAddress

  • getAddress(contract: string, network?: string): any
  • Gets the contract address of the named contract. This method supports contracts used by the Compound Protocol.

    example
    console.log('cETH Address: ', Compound.util.getAddress(Compound.cETH));

    Parameters

    • contract: string

      The name of the contract.

    • Default value network: string = "mainnet"

    Returns any

    Returns the address of the contract.

getNetNameWithChainId

  • getNetNameWithChainId(chainId: number): any
  • Gets the name of an Ethereum network based on its chain ID.

    example
    console.log('Ropsten : ', Compound.util.getNetNameWithChainId(3));

    Parameters

    • chainId: number

      The chain ID of the network.

    Returns any

    Returns the name of the Ethereum network.