Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TokensManager

Contains methods to create Tokens classes.

Hierarchy

  • TokensManager

Index

Constructors

Methods

  • Creates PriceToken from full token structure (without price) or from token address and blockchain.

    example
    const token = await sdk.tokens.createPriceToken({
    blockchain: BLOCKCHAIN_NAME.ETHEREUM,
    address: '0xdac17f958d2ee523a2206206994597c13d831ec7'
    });

    console.log(token.price.toFormat(2)); // 1.00

    Parameters

    Returns Promise<PriceToken>

  • createPriceTokenAmount(priceTokenAmountStruct: PriceTokenAmountBaseStruct | TokenStruct & { weiAmount: BigNumber } & TokenStruct & { tokenAmount: BigNumber }): Promise<PriceTokenAmount>
  • Creates PriceTokenAmount from full token structure (without price) or from token address and blockchain.

    example
    const token = await sdk.tokens.createPriceTokenAmount({
    blockchain: BLOCKCHAIN_NAME.ETHEREUM,
    address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
    tokenAmount: new BigNumber(1)
    });

    console.log(token.tokenAmount.toNumber()); // 1
    console.log(token.stringWeiAmount); // 1000000

    Parameters

    • priceTokenAmountStruct: PriceTokenAmountBaseStruct | TokenStruct & { weiAmount: BigNumber } & TokenStruct & { tokenAmount: BigNumber }

      Full or base token's structure with amount.

    Returns Promise<PriceTokenAmount>

  • createPriceTokenAmountFromStruct(priceTokenAmountStruct: PriceTokenAmountStruct): PriceTokenAmount
  • createPriceTokenFromStruct(priceTokenStruct: PriceTokenStruct): PriceToken
  • Fetches token data and creates Token by token's address and blockchain.

    example
    const token = await sdk.tokens.createToken({
    blockchain: BLOCKCHAIN_NAME.ETHEREUM,
    address: '0xdac17f958d2ee523a2206206994597c13d831ec7'
    });

    console.log(token.symbol); // USDT
    console.log(token.name); // Tether USD
    console.log(token.decimals); // 6

    Parameters

    Returns Promise<Token>

  • createTokenFromStruct(tokenStruct: TokenStruct): Token
  • createTokensFromStructs(tokensStructs: TokenStruct[]): Token[]

Generated using TypeDoc