10.4.10 • Published 7 months ago

@paraspell/assets v10.4.10

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Information

This package serves as a core component for both @paraspell/sdk and @paraspell/sdk-pjs and is automatically installed as a dependency. The package on its own offers functionality that can be imported separately and be used in front-end applications. It allows 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.

Implementation

Install package

pnpm | npm install || yarn add @paraspell/assets

Import functionality

To use this functionality you first have to import it in the following way.

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 })

💻 Tests

  • Run compilation using pnpm compile

  • Run linter using pnpm lint

  • Run unit tests using pnpm test

  • Update Parachain registered assets in the map using script - pnpm updateAssets

  • Update existential deposits in the map using script - pnpm updateEds

Assets can be tested in Playground.

License

Made with 💛 by ParaSpell✨

Published under MIT License.

Support

10.4.10

7 months ago

10.4.9

7 months ago

10.4.8

7 months ago

10.4.7

7 months ago

10.4.6

7 months ago

10.4.5

7 months ago

10.4.4

7 months ago

10.4.3

7 months ago

10.4.2

7 months ago

10.4.1

7 months ago

10.4.0

7 months ago

10.3.1

7 months ago

10.3.0

7 months ago

10.2.0

7 months ago

10.1.7

7 months ago

9.2.5

7 months ago

10.1.6

7 months ago

10.1.5

7 months ago

10.1.4

7 months ago

9.2.4

7 months ago

10.1.3

7 months ago

10.1.2

7 months ago

10.1.1

7 months ago

10.1.0

7 months ago

10.0.2

7 months ago

10.0.1

8 months ago

10.0.0

8 months ago

9.2.2

8 months ago

9.2.1

8 months ago

9.2.0

8 months ago

9.1.2

8 months ago

9.1.1

8 months ago

9.1.0

8 months ago

9.0.0

8 months ago

8.16.0

8 months ago

8.15.2

8 months ago

8.15.1

8 months ago

8.15.0

8 months ago

8.14.0

8 months ago

8.13.2

8 months ago

8.13.1

8 months ago

8.13.0

8 months ago

8.12.1

8 months ago

8.12.0

8 months ago

8.11.1

8 months ago

8.11.0

9 months ago

8.10.0

9 months ago

8.9.10

9 months ago

8.9.9

9 months ago

8.9.8

9 months ago

8.9.7

9 months ago

8.9.6

9 months ago

8.9.5

9 months ago

8.9.4

9 months ago

8.9.3

9 months ago

8.9.2

9 months ago

8.9.1

9 months ago

8.9.0

10 months ago