Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "util"

Index

Functions

getAbi

  • getAbi(contract: string): AbiType[]
  • Gets a contract ABI as a JavaScript array. This method supports contracts used by the Venus Protocol.

    example
    console.log('vBNB ABI: ', Venus.util.getAbi(Venus.vBNB));

    Parameters

    • contract: string

      The name of the contract.

    Returns AbiType[]

    Returns the ABI of the contract as a JavaScript array.

getAddress

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

    example
    console.log('vBNB Address: ', Venus.util.getAddress(Venus.vBNB));

    Parameters

    • contract: string

      The name of the contract.

    • Default value network: string = "mainnet"

    Returns string

    Returns the address of the contract.

getNetNameWithChainId

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

    example
    console.log('testnet : ', Venus.util.getNetNameWithChainId(97));

    Parameters

    • chainId: number

      The chain ID of the network.

    Returns string

    Returns the name of the Ethereum network.