Asset ๐ฐ query operations for your front-end โ
This functionality serves to retrieve asset data from compatible Parachains. Users can retrieve details like asset decimals
, registered assets on particular Parachain
, check if the asset is registered on Parachain
and more.
Import functionality โ
To use this functionality you first have to import it in the following way.
//PAPI
import { getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTNode, getAssetMultiLocation, NODE_NAMES } from '@paraspell/sdk'
//PJS
import { getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTNode, getAssetMultiLocation, NODE_NAMES } from '@paraspell/sdk-pjs'
//Standalone asset package
yarn add || pnpm | npm install @paraspell/assets
import { getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTNode, getAssetMultiLocation, NODE_NAMES } from '@paraspell/assets'
Query assets object โ
This function returns assets object
from assets.json
for particular Parachain
including information about native
and foreign
assets.
getAssetsObject('Acala')
Query asset ID โ
This function returns assetId
for particular Parachain
and asset symbol
getAssetId('Acala', 'DOT')
Query Relay chain asset symbol โ
This function returns the symbol
of the Relay chain for a particular Parachain. Either "DOT" or "KSM"
getRelayChainSymbol('Basilisk')
Query native assets โ
This function returns a string array of native
assets symbols for a particular Parachain
getNativeAssets('Acala')
Query foreign assets โ
This function returns an object array of foreign assets for a particular Parachain. Each object has a symbol and assetId property
getOtherAssets('Acala')
Query all asset symbols โ
Function returns string array of all asset symbols for a specific Parachain. (native and foreign assets are merged into a single array)
getAllAssetsSymbols('Acala')
Query asset support โ
The function checks if Parachain supports a particular asset. (Both native and foreign assets are searched). Returns boolean
hasSupportForAsset(node: TNode, symbol: string)
Query asset decimals โ
The function returns decimals for a specific asset
getAssetDecimals('Basilisk', 'KSM')
Query Parachain ID โ
The function returns specific Parachain id
getParaId('Basilisk')
Query Parachain name โ
Function to get specific TNode from Parachain id
getTNode(nodeID: number, ecosystem: 'polkadot' || 'kusama' || 'ethereum') //When Ethereum ecosystem is selected please fill nodeID as 1 to select Ethereum.
Import Parachains as constant โ
Import all compatible Parachains as constant
console.log(NODE_NAMES)
Convert id or symbol to multilocation โ
Get multilocation for asset id or symbol.
getAssetMultiLocation(chainFrom, { symbol: symbol } | { id: assetId })