@paraspell/assets 12.0.0 → 12.0.2
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 +64 -31
- package/dist/index.mjs +21 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -37,86 +37,87 @@ pnpm | npm install || yarn add @paraspell/assets
|
|
|
37
37
|
### Import functionality
|
|
38
38
|
|
|
39
39
|
To use this functionality you first have to import it in the following way.
|
|
40
|
+
|
|
40
41
|
```ts
|
|
41
|
-
import { getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTChain, getAssetLocation,
|
|
42
|
+
import { getSupportedDestinations, getSupportedAssets, getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTChain, getAssetLocation, TParachain, TRelaychain, TSubstrateChain, TExternalChain, TChain, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/assets'
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
### Query assets object
|
|
46
|
-
This function returns `assets object` from `assets.json` for `particular Parachain` including information about `native` and `foreign` assets.
|
|
47
|
+
This function returns `assets object` from `assets.json` for `particular Parachain` including information about `native` and `foreign` assets. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
47
48
|
|
|
48
49
|
```ts
|
|
49
|
-
getAssetsObject(
|
|
50
|
+
getAssetsObject(TChain)
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
### Query asset ID
|
|
53
|
-
This function returns `assetId` for `particular Parachain` and `asset symbol`.
|
|
54
|
+
This function returns `assetId` for `particular Parachain` and `asset symbol`. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
54
55
|
|
|
55
56
|
```ts
|
|
56
|
-
getAssetId(
|
|
57
|
+
getAssetId(TChain, ASSET_SYMBOL)
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
### Query Relay chain asset symbol
|
|
60
|
-
This function returns the `symbol` of the Relay chain for a particular Parachain. Either
|
|
61
|
+
This function returns the `symbol` of the Relay chain for a particular Parachain. Either `DOT` or `KSM` or `WND` or `PAS`. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
61
62
|
|
|
62
63
|
```ts
|
|
63
|
-
getRelayChainSymbol(
|
|
64
|
+
getRelayChainSymbol(TChain)
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
### Query native assets
|
|
67
|
-
This function returns a string array of `native` assets symbols for a particular Parachain.
|
|
68
|
+
This function returns a string array of `native` assets symbols for a particular Parachain. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
68
69
|
|
|
69
70
|
```ts
|
|
70
|
-
getNativeAssets(
|
|
71
|
+
getNativeAssets(TChain)
|
|
71
72
|
```
|
|
72
73
|
|
|
73
74
|
### Query foreign assets
|
|
74
|
-
This function returns an object array of foreign assets for a particular Parachain. Each object has a symbol and assetId property.
|
|
75
|
+
This function returns an object array of foreign assets for a particular Parachain. Each object has a symbol and assetId property. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
75
76
|
|
|
76
77
|
```ts
|
|
77
|
-
getOtherAssets(
|
|
78
|
+
getOtherAssets(TChain)
|
|
78
79
|
```
|
|
79
80
|
|
|
80
81
|
### Query all asset symbols
|
|
81
|
-
Function returns string array of all asset symbols for a specific Parachain. (native and foreign assets are merged into a single array).
|
|
82
|
+
Function returns string array of all asset symbols for a specific Parachain. (native and foreign assets are merged into a single array). Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
82
83
|
|
|
83
84
|
```ts
|
|
84
|
-
getAllAssetsSymbols(
|
|
85
|
+
getAllAssetsSymbols(TChain)
|
|
85
86
|
```
|
|
86
87
|
|
|
87
88
|
### Query asset support
|
|
88
|
-
The function checks if Parachain supports a particular asset. (Both native and foreign assets are searched). Returns boolean.
|
|
89
|
+
The function checks if Parachain supports a particular asset. (Both native and foreign assets are searched). Returns boolean. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
89
90
|
|
|
90
91
|
```ts
|
|
91
|
-
hasSupportForAsset(
|
|
92
|
+
hasSupportForAsset(TChain, ASSET_SYMBOL)
|
|
92
93
|
```
|
|
93
94
|
|
|
94
95
|
### Query asset decimals
|
|
95
|
-
The function returns decimals for a specific asset.
|
|
96
|
+
The function returns decimals for a specific asset. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
96
97
|
|
|
97
98
|
```ts
|
|
98
|
-
getAssetDecimals(
|
|
99
|
+
getAssetDecimals(TChain, ASSET_SYMBOL)
|
|
99
100
|
```
|
|
100
101
|
|
|
101
102
|
### Query Parachain ID
|
|
102
|
-
The function returns specific Parachain id.
|
|
103
|
+
The function returns specific Parachain id. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
103
104
|
|
|
104
105
|
```ts
|
|
105
|
-
getParaId(
|
|
106
|
+
getParaId(TChain)
|
|
106
107
|
```
|
|
107
108
|
|
|
108
109
|
### 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
|
+
Find out whether asset is registered on chain and return its entire parameters. If not found, returns null. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
110
111
|
|
|
111
112
|
```ts
|
|
112
|
-
findAssetInfo(
|
|
113
|
+
findAssetInfo(TChain, ASSET_SYMBOL/*, DESTINATION?*/)
|
|
113
114
|
```
|
|
114
115
|
|
|
115
116
|
### 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
|
+
Find out whether asset is registered on chain and return its entire parameters. If not found, returns error. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
117
118
|
|
|
118
119
|
```ts
|
|
119
|
-
findAssetInfoOrThrow(
|
|
120
|
+
findAssetInfoOrThrow(TChain, ASSET_SYMBOL/*, DESTINATION?*/)
|
|
120
121
|
```
|
|
121
122
|
|
|
122
123
|
### Query Parachain name
|
|
@@ -126,18 +127,51 @@ Function to get specific TChain from Parachain id.
|
|
|
126
127
|
getTChain(chainID: number, ecosystem: 'Polkadot' | 'Kusama' | 'Ethereum' | 'Paseo' | 'Westend') //When Ethereum ecosystem is selected please fill chainID as 1 to select Ethereum.
|
|
127
128
|
```
|
|
128
129
|
|
|
130
|
+
### Import chains as types
|
|
131
|
+
There are 5 options for types you can choose based on your prefference
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
// Export all Parachains
|
|
135
|
+
console.log(TParachain)
|
|
136
|
+
|
|
137
|
+
// Export all Relay chains
|
|
138
|
+
console.log(TRelaychain)
|
|
139
|
+
|
|
140
|
+
// Export all Substrate chains (Parachains + Relays)
|
|
141
|
+
console.log(TSubstrateChain)
|
|
142
|
+
|
|
143
|
+
// Export chains outside Polkadot ecosystem (Ethereum)
|
|
144
|
+
console.log(TExternalChain)
|
|
145
|
+
|
|
146
|
+
// Export all chains implemented in ParaSpell
|
|
147
|
+
console.log(TChain)
|
|
148
|
+
```
|
|
149
|
+
|
|
129
150
|
### Import chains as constant
|
|
130
|
-
|
|
151
|
+
There are 5 options for constants you can choose based on your prefference
|
|
131
152
|
|
|
132
153
|
```ts
|
|
154
|
+
// Export all Parachains
|
|
155
|
+
console.log(PARACHAINS)
|
|
156
|
+
|
|
157
|
+
// Export all Relay chains
|
|
158
|
+
console.log(RELAYCHAINS)
|
|
159
|
+
|
|
160
|
+
// Export all Substrate chains (Parachains + Relays)
|
|
161
|
+
console.log(SUBSTRATE_CHAINS)
|
|
162
|
+
|
|
163
|
+
// Export chains outside Polkadot ecosystem (Ethereum)
|
|
164
|
+
console.log(EXTERNAL_CHAINS)
|
|
165
|
+
|
|
166
|
+
// Export all chains implemented in ParaSpell
|
|
133
167
|
console.log(CHAINS)
|
|
134
168
|
```
|
|
135
169
|
|
|
136
170
|
### Convert id or symbol to location
|
|
137
|
-
Get location for asset id or symbol.
|
|
171
|
+
Get location for asset id or symbol. Function uses [TChain](https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types) types.
|
|
138
172
|
|
|
139
173
|
```ts
|
|
140
|
-
getAssetLocation(
|
|
174
|
+
getAssetLocation(TChain, { symbol: symbol } | { id: assetId })
|
|
141
175
|
```
|
|
142
176
|
|
|
143
177
|
## 💻 Tests
|
|
@@ -172,9 +206,8 @@ Published under [MIT License](https://github.com/paraspell/xcm-tools/blob/main/p
|
|
|
172
206
|
|
|
173
207
|
## Supported by
|
|
174
208
|
|
|
175
|
-
<div
|
|
176
|
-
|
|
177
|
-
<img width="
|
|
178
|
-
|
|
179
|
-
</p>
|
|
209
|
+
<div>
|
|
210
|
+
<div align="center" style="margin-top: 20px;">
|
|
211
|
+
<img width="750" alt="version" src="https://github.com/user-attachments/assets/29e4b099-d90c-46d6-a3ce-94edfbda003c" />
|
|
212
|
+
</div>
|
|
180
213
|
</div>
|
package/dist/index.mjs
CHANGED
|
@@ -2891,6 +2891,27 @@ var EnergyWebX = {
|
|
|
2891
2891
|
]
|
|
2892
2892
|
}
|
|
2893
2893
|
}
|
|
2894
|
+
},
|
|
2895
|
+
{
|
|
2896
|
+
symbol: "USDC",
|
|
2897
|
+
decimals: 6,
|
|
2898
|
+
existentialDeposit: "10000",
|
|
2899
|
+
location: {
|
|
2900
|
+
parents: 1,
|
|
2901
|
+
interior: {
|
|
2902
|
+
X3: [
|
|
2903
|
+
{
|
|
2904
|
+
Parachain: 1000
|
|
2905
|
+
},
|
|
2906
|
+
{
|
|
2907
|
+
PalletInstance: 50
|
|
2908
|
+
},
|
|
2909
|
+
{
|
|
2910
|
+
GeneralIndex: 1337
|
|
2911
|
+
}
|
|
2912
|
+
]
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2894
2915
|
}
|
|
2895
2916
|
]
|
|
2896
2917
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/assets",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.2",
|
|
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": "12.0.
|
|
26
|
+
"@paraspell/sdk-common": "12.0.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|