@getsafle/custom-token-controller
v1.0.8
Published
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.
Downloads
33
Keywords
Readme
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 AddressrpcURL
- Web3 RPC provider URLchain
- 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