@paraspell/assets 11.2.4 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -11
- package/dist/index.cjs +3 -1
- package/dist/index.mjs +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -38,71 +38,104 @@ pnpm | npm install || yarn add @paraspell/assets
|
|
|
38
38
|
|
|
39
39
|
To use this functionality you first have to import it in the following way.
|
|
40
40
|
```ts
|
|
41
|
-
import { getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTChain, getAssetLocation, CHAINS } from '@paraspell/assets'
|
|
41
|
+
import { getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTChain, getAssetLocation, CHAINS, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/assets'
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
### Query assets object
|
|
46
46
|
This function returns `assets object` from `assets.json` for `particular Parachain` including information about `native` and `foreign` assets.
|
|
47
|
+
|
|
47
48
|
```ts
|
|
48
49
|
getAssetsObject('Acala')
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
### Query asset ID
|
|
52
|
-
This function returns `assetId` for `particular Parachain` and `asset symbol
|
|
53
|
+
This function returns `assetId` for `particular Parachain` and `asset symbol`.
|
|
54
|
+
|
|
53
55
|
```ts
|
|
54
56
|
getAssetId('Acala', 'DOT')
|
|
55
57
|
```
|
|
58
|
+
|
|
56
59
|
### Query Relay chain asset symbol
|
|
57
|
-
This function returns the `symbol` of the Relay chain for a particular Parachain. Either "DOT" or "KSM"
|
|
60
|
+
This function returns the `symbol` of the Relay chain for a particular Parachain. Either "DOT" or "KSM".
|
|
61
|
+
|
|
58
62
|
```ts
|
|
59
63
|
getRelayChainSymbol('Basilisk')
|
|
60
64
|
```
|
|
65
|
+
|
|
61
66
|
### Query native assets
|
|
62
|
-
This function returns a string array of `native` assets symbols for a particular Parachain
|
|
67
|
+
This function returns a string array of `native` assets symbols for a particular Parachain.
|
|
68
|
+
|
|
63
69
|
```ts
|
|
64
70
|
getNativeAssets('Acala')
|
|
65
71
|
```
|
|
72
|
+
|
|
66
73
|
### Query foreign assets
|
|
67
|
-
This function returns an object array of foreign assets for a particular Parachain. Each object has a symbol and assetId property
|
|
74
|
+
This function returns an object array of foreign assets for a particular Parachain. Each object has a symbol and assetId property.
|
|
75
|
+
|
|
68
76
|
```ts
|
|
69
77
|
getOtherAssets('Acala')
|
|
70
78
|
```
|
|
79
|
+
|
|
71
80
|
### Query all asset symbols
|
|
72
|
-
Function returns string array of all asset symbols for a specific Parachain. (native and foreign assets are merged into a single array)
|
|
81
|
+
Function returns string array of all asset symbols for a specific Parachain. (native and foreign assets are merged into a single array).
|
|
82
|
+
|
|
73
83
|
```ts
|
|
74
84
|
getAllAssetsSymbols('Acala')
|
|
75
85
|
```
|
|
86
|
+
|
|
76
87
|
### Query asset support
|
|
77
|
-
The function checks if Parachain supports a particular asset. (Both native and foreign assets are searched). Returns boolean
|
|
88
|
+
The function checks if Parachain supports a particular asset. (Both native and foreign assets are searched). Returns boolean.
|
|
89
|
+
|
|
78
90
|
```ts
|
|
79
91
|
hasSupportForAsset(chain: TChain, symbol: string)
|
|
80
92
|
```
|
|
93
|
+
|
|
81
94
|
### Query asset decimals
|
|
82
|
-
The function returns decimals for a specific asset
|
|
95
|
+
The function returns decimals for a specific asset.
|
|
96
|
+
|
|
83
97
|
```ts
|
|
84
98
|
getAssetDecimals('Basilisk', 'KSM')
|
|
85
99
|
```
|
|
100
|
+
|
|
86
101
|
### Query Parachain ID
|
|
87
|
-
The function returns specific Parachain id
|
|
102
|
+
The function returns specific Parachain id.
|
|
103
|
+
|
|
88
104
|
```ts
|
|
89
105
|
getParaId('Basilisk')
|
|
90
106
|
```
|
|
91
107
|
|
|
108
|
+
### Query asset data and support for specific chain I
|
|
109
|
+
Find out whether asset is registered on chain and return its entire parameters. If not found, returns null.
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
findAssetInfo('AssetHubPolkadot', {symbol: 'DOT'}/*, DESTINATION?*/)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Query asset data and support for specific chain II
|
|
116
|
+
Find out whether asset is registered on chain and return its entire parameters. If not found, returns error.
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
findAssetInfoOrThrow('AssetHubPolkadot', {symbol: 'DOT'}/*, DESTINATION?*/)
|
|
120
|
+
```
|
|
121
|
+
|
|
92
122
|
### Query Parachain name
|
|
93
|
-
Function to get specific TChain from Parachain id
|
|
123
|
+
Function to get specific TChain from Parachain id.
|
|
124
|
+
|
|
94
125
|
```ts
|
|
95
126
|
getTChain(chainID: number, ecosystem: 'Polkadot' | 'Kusama' | 'Ethereum' | 'Paseo' | 'Westend') //When Ethereum ecosystem is selected please fill chainID as 1 to select Ethereum.
|
|
96
127
|
```
|
|
97
128
|
|
|
98
129
|
### Import chains as constant
|
|
99
|
-
Import all compatible chains as constant
|
|
130
|
+
Import all compatible chains as constant.
|
|
131
|
+
|
|
100
132
|
```ts
|
|
101
133
|
console.log(CHAINS)
|
|
102
134
|
```
|
|
103
135
|
|
|
104
136
|
### Convert id or symbol to location
|
|
105
137
|
Get location for asset id or symbol.
|
|
138
|
+
|
|
106
139
|
```ts
|
|
107
140
|
getAssetLocation(chainFrom, { symbol: symbol } | { id: assetId })
|
|
108
141
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -18215,7 +18215,9 @@ var hasDryRunSupport = function hasDryRunSupport(chain) {
|
|
|
18215
18215
|
return getAssetsObject(chain).supportsDryRunApi;
|
|
18216
18216
|
};
|
|
18217
18217
|
var hasXcmPaymentApiSupport = function hasXcmPaymentApiSupport(chain) {
|
|
18218
|
-
|
|
18218
|
+
// These chains have XcmPaymentApi but it's not working
|
|
18219
|
+
var DISABLED_CHAINS = ['IntegriteePaseo', 'Basilisk', 'Jamton'];
|
|
18220
|
+
return getAssetsObject(chain).supportsXcmPaymentApi && !DISABLED_CHAINS.includes(chain);
|
|
18219
18221
|
};
|
|
18220
18222
|
|
|
18221
18223
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -18213,7 +18213,9 @@ var hasDryRunSupport = function hasDryRunSupport(chain) {
|
|
|
18213
18213
|
return getAssetsObject(chain).supportsDryRunApi;
|
|
18214
18214
|
};
|
|
18215
18215
|
var hasXcmPaymentApiSupport = function hasXcmPaymentApiSupport(chain) {
|
|
18216
|
-
|
|
18216
|
+
// These chains have XcmPaymentApi but it's not working
|
|
18217
|
+
var DISABLED_CHAINS = ['IntegriteePaseo', 'Basilisk', 'Jamton'];
|
|
18218
|
+
return getAssetsObject(chain).supportsXcmPaymentApi && !DISABLED_CHAINS.includes(chain);
|
|
18217
18219
|
};
|
|
18218
18220
|
|
|
18219
18221
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/assets",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "Assets for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@paraspell/sdk-common": "11.
|
|
26
|
+
"@paraspell/sdk-common": "11.3.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|