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

@getsafle/asset-controller

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@getsafle/asset-controller

This controller detects tokens for a user and returns token balances.

  • 1.0.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-40%
Maintainers
4
Weekly downloads
 
Created
Source

Safle Asset Controller

This SDK is used to detect the tokens and their balances in a given user's public address.

Installation

To install this SDK,

npm install --save @getsafle/asset-controller

Initialization

Initialize the constructor,

const safleAssetController = require('@getsafle/asset-controller');

const assetController = new safleAssetController.AssetController({ rpcURL, chain });

Detect Tokens


This function will detect and return the list of all the tokens in the user's public address.

const tokenBalance = await assetController.detectTokens({ userAddress, tokenType });
  • userAddress - User Public Address
  • tokenType - optional parameter - valid values- erc20/erc721

Get list of chains on which a token exists


This function will return the list of all the chains which a particular token is supported

const chains = await assetController.getChains(tokenSymbol);
  • tokenSymbol - Token Symbol

Get token balances


This function will return the balances of all the tokens contract addresses passed in the array

const chains = await assetController.getTokenBalances(tokensToDetect, SINGLE_CALL_BALANCES_ADDRESS, userAddress);
  • tokensToDetect - array of all the token addresses
  • SINGLE_CALL_BALANCES_ADDRESS - Contract address of the single call balance checker contract
  • userAddress - Public address of the user to query the balance of

FAQs

Package last updated on 25 May 2023

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