Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

depay-blockchain-token

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

depay-blockchain-token

JavaScript library providing basic functionalities to work with tokens.

  • 1.5.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 15 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc