Neat! Pickled Muskrat!

    depay-blockchain-token

    1.5.3 • Public • Published

    Quickstart

    yarn add depay-blockchain-token
    

    or

    npm install --save depay-blockchain-token
    
    import { Token } from 'depay-blockchain-token';
    
    let token = new Token({
      blockchain: 'ethereum',
      address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'
    });
    
    token.address // '0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb'
    await token.decimals() // 18
    await token.symbol() // 'DEPAY'
    await token.name() // 'DePay'
    await token.transferable() // true

    Functionalities

    initalize (new)

    import { Token } from 'depay-blockchain-token';
    
    let token = new Token({
      blockchain: 'ethereum',
      address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'
    });

    decimals

    Retrieves token decimals

    await token.decimals() // 18

    symbol

    Retrieves token symbol

    await token.symbol() // DEPAY

    name

    Retrieves token name

    await token.name() // DePay

    transferable

    Checks if token is transferable:

    await token.transferable() // true

    balance

    Provides the balance (BigNumber) of the given account:

    await token.balance('0xb0252f13850a4823706607524de0b146820F2240') // BigNumber {_hex: "0x0b896d5e9eeaabf4f1", _isBigNumber: true}

    this also works for the native token of the given blockchain:

    await token.balance('0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE') // BigNumber {_hex: "0x0b896d5e9eeaabf4f1", _isBigNumber: true}

    BigNumber

    Provides the BigNumber amount for a given token (based on the tokens decimals) based on a human readable amount:

    let token = new Token({
      blockchain: 'ethereum',
      address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'
    }) 
    
    token.BigNumber(1) // BigNumber '1000000000000000000'
    Token.BigNumber({
      amount: 1,
      blockchain: 'ethereum',
      address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'
    }) // BigNumber '1000000000000000000'

    Token Standards

    depay-blockchain-token exports standard token apis, like ERC20, BEP20 etc.:

    import { ERC20 } from 'depay-blockchain-token'

    Development

    Get started

    yarn install
    yarn dev
    

    Release

    npm publish
    

    Keywords

    Install

    npm i depay-blockchain-token

    DownloadsWeekly Downloads

    23

    Version

    1.5.3

    License

    MIT

    Unpacked Size

    26 kB

    Total Files

    6

    Last publish

    Collaborators

    • depay-sebastian