@getsafle/custom-token-controller

1.0.8 • Public • Published

Custom Token Controller

This SDK can be used to get the details of any token by it's contract address and it's balance for a specific address.

Installation

To install this SDK,

npm install --save @getsafle/custom-token-controller

Initialization

Initialize the constructor,

const safleTokenController = require('@getsafle/custom-token-controller');

const tokenController = new safleTokenController.CustomTokenController({ userAddress, rpcURL, chain });
  • userAddress - User Public Address
  • rpcURL - Web3 RPC provider URL
  • chain - blockchain name

Get Token Details


This function returns the token decimal and symbol for the contract address passed as parameter.

const tokenDetails = await tokenController.getTokenDetails(contractAddress);
  • contractAddress - Token contract address

Get Token Balance


const tokenDetails = await tokenController.getTokenBalance(contractAddress);
  • contractAddress - Token contract address

/@getsafle/custom-token-controller/

    Package Sidebar

    Install

    npm i @getsafle/custom-token-controller

    Weekly Downloads

    10

    Version

    1.0.8

    License

    MIT

    Unpacked Size

    14.3 kB

    Total Files

    12

    Last publish

    Collaborators

    • subhanshugupta
    • apoorv31
    • shubham.3008
    • sidth