This the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Token Discovery

Token discovery is the process of identifying and returning information on which supported tokens belong to an address. Several token types exists for several different blockchains.

We use the term token to describe any kind of unit that could be held by an address. One such example would be the native currency on a blockchain (each Bitcoin address has at least the Bitcoin token). Other chains support more token types, Ethereum addresses for example can contain many different erc20 tokens.

Plugin Input

Please see heat-server-common/src/constants.ts for type definitions

interface {
  /**
   * Enum of blockchain identifiers
   */   
  blockchain: Blockchains,

  /**
   * Enum of asset or token types
   */   
  assetType: AssetTypes,

  /**
   * Address or public key
   */   
  addrXpub: string,
}

Plugin Output

interface {
  /**
   * Result is an array
   */
  [index: number]: {

    /**
     * Unique identifier (erc20 contract addr, or '0' for native currency)
     */
    assetId: string;

    /**
     * Enum of asset or token types
     */   
    assetType: number;

    /**
     * Amount/value in smallest unit on blockchain (satoshi, wei, etc)
     */  
    value: string;

    /**
     * Indicates the address received atleast one transaction
     */
    exists: boolean;
  }
}