Package Exports
- @depay/web3-assets
- @depay/web3-assets/dist/esm/index.js
- @depay/web3-assets/dist/umd/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@depay/web3-assets) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Quickstart
yarn add @depay/web3-assetsor
npm install --save @depay/web3-assetsimport { getAssets } from '@depay/web3-assets'
let assets = await getAssets()
//[
// {
// "name": "Dai Stablecoin",
// "symbol": "DAI",
// "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
// "blockchain": "ethereum",
// "type": "20",
// "balance": "8007804249707967889272"
// }, {
// "name": "DePay",
// "symbol": "DEPAY",
// "address": "0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",
// "blockchain": "ethereum",
// "type": "20",
// "balance": "212816860003097638129"
// }, {
// "name": "PancakeSwap Token",
// "symbol": "CAKE",
// "address": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
// "blockchain": "bsc",
// "type": "20",
// "balance": "2221112213212321"
// }
//]Support
This library supports the following blockchains:
Functionalities
getAssets
Retrieves all assets of the connected crypto wallet account for all supported blockchains at once.
import { getAssets } from '@depay/web3-assets'
let assets = await getAssets()
//[
// {
// "name": "Dai Stablecoin",
// "symbol": "DAI",
// "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
// "blockchain": "ethereum",
// "type": "20",
// "balance": "8007804249707967889272"
// }, {
// "name": "DePay",
// "symbol": "DEPAY",
// "address": "0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",
// "blockchain": "ethereum",
// "type": "20",
// "balance": "212816860003097638129"
// }, {
// "name": "PancakeSwap Token",
// "symbol": "CAKE",
// "address": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
// "blockchain": "bsc",
// "type": "20",
// "balance": "2221112213212321"
// }
//]Also allows you to retrieve assets only for a given blockchain:
let assets = await getAssets({ blockchain: 'bsc' })
//[
// {
// "name": "PancakeSwap Token",
// "symbol": "CAKE",
// "address": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
// "blockchain": "bsc",
// "type": "20",
// "balance": "2221112213212321"
// }
//]Also allows you to retrieve assets for a given account for a given blockchain:
let assets = await getAssets({ account: '0xEcA533Ef096f191A35DE76aa4580FA3A722724bE', blockchain: 'bsc' })
//[
// {
// "name": "PancakeSwap Token",
// "symbol": "CAKE",
// "address": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
// "blockchain": "bsc",
// "type": "20",
// "balance": "2221112213212321"
// }
//]Development
Get started
yarn install
yarn devRelease
npm publish