@paraspell/sdk 5.1.0 → 5.2.1
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 +29 -16
- package/dist/index.cjs +490 -111
- package/dist/index.d.ts +191 -153
- package/dist/index.mjs +490 -111
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<img alt="snyk" src="https://snyk.io/test/github/paraspell/sdk/badge.svg" />
|
|
18
18
|
</a>
|
|
19
19
|
</p>
|
|
20
|
-
<p>Currently supporting
|
|
20
|
+
<p>Currently supporting 53 Polkadot & Kusama nodes list <a href = "https://github.com/paraspell/xcm-tools/blob/main/packages/sdk/docs/supportedNodes.md"\>[here]</p>
|
|
21
21
|
<p>SDK documentation <a href = "https://paraspell.github.io/docs/" \>[here]</p>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
@@ -60,6 +60,8 @@ NOTES:
|
|
|
60
60
|
- If you wish to transfer from Parachain that uses long IDs for example Moonbeam you have to add the character 'n' the end of currencyID. Eg: .currency(42259045809535163221576417993425387648n) will mean you transfer xcDOT.
|
|
61
61
|
- You can now use custom ParachainIDs if you wish to test in TestNet. Just add parachainID as an additional parameter eg: .to('Basilisk', 2948)
|
|
62
62
|
- You can now add optional parameter useKeepAlive which will ensure, that you send more than existential deposit.
|
|
63
|
+
- Since v5 you can fully customize all multilocations (address, currency and destination). Instead of string parameter simply pass object with multilocation instead for more information refer to the following PR https://github.com/paraspell/xcm-tools/pull/199.
|
|
64
|
+
- Fee asset is now an optional parameter.
|
|
63
65
|
```
|
|
64
66
|
|
|
65
67
|
### Builder pattern:
|
|
@@ -68,10 +70,11 @@ NOTES:
|
|
|
68
70
|
```ts
|
|
69
71
|
await Builder(/*node api - optional*/)
|
|
70
72
|
.from(NODE)
|
|
71
|
-
.to(NODE/*,customParaId - optional*/)
|
|
72
|
-
.currency(CurrencyString
|
|
73
|
+
.to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
|
|
74
|
+
.currency(CurrencyString| | CurrencyID | Multilocation object)
|
|
75
|
+
/*.feeAsset(feeAsset) - Optional (Fee asset select id)*/
|
|
73
76
|
.amount(amount)
|
|
74
|
-
.address(address)
|
|
77
|
+
.address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/)
|
|
75
78
|
.build()
|
|
76
79
|
/*
|
|
77
80
|
EXAMPLE:
|
|
@@ -87,9 +90,9 @@ await Builder()
|
|
|
87
90
|
##### Transfer assets from the Relay chain to Parachain
|
|
88
91
|
```ts
|
|
89
92
|
await Builder(/*node api - optional*/)
|
|
90
|
-
.to(NODE/*,customParaId - optional*/)
|
|
93
|
+
.to(NODE/*,customParaId - optional*/ | Multilocation object)
|
|
91
94
|
.amount(amount)
|
|
92
|
-
.address(address)
|
|
95
|
+
.address(address | Multilocation object)
|
|
93
96
|
.build()
|
|
94
97
|
/*
|
|
95
98
|
EXAMPLE:
|
|
@@ -104,8 +107,9 @@ await Builder()
|
|
|
104
107
|
```ts
|
|
105
108
|
await Builder(/*node api - optional*/)
|
|
106
109
|
.from(NODE)
|
|
110
|
+
/*.feeAsset(feeAsset) - Optional (Fee asset select id)*/
|
|
107
111
|
.amount(amount)
|
|
108
|
-
.address(address)
|
|
112
|
+
.address(address | Multilocation object)
|
|
109
113
|
.build()
|
|
110
114
|
/*
|
|
111
115
|
EXAMPLE:
|
|
@@ -117,6 +121,9 @@ await Builder()
|
|
|
117
121
|
*/
|
|
118
122
|
```
|
|
119
123
|
##### Use keepAlive option
|
|
124
|
+
```
|
|
125
|
+
NOTE: Custom multilocations are not available when keepALive check is used
|
|
126
|
+
```
|
|
120
127
|
```ts
|
|
121
128
|
await Builder(/*node api - optional*/)
|
|
122
129
|
.from(NODE)
|
|
@@ -147,18 +154,23 @@ Builder(api)
|
|
|
147
154
|
```
|
|
148
155
|
|
|
149
156
|
### Function pattern:
|
|
157
|
+
```
|
|
158
|
+
NOTES:
|
|
159
|
+
- Since version v5 there was a breaking change introduced. You now pass single object with properties instead of parameters
|
|
160
|
+
- Since v5 you can fully customize all multilocations (address, currency and destination). Instead of string parameter simply pass object with multilocation instead for more information refer to the following PR https://github.com/paraspell/xcm-tools/pull/199.
|
|
161
|
+
- Custom multilocations are not available when keepALive check is used
|
|
162
|
+
```
|
|
150
163
|
```ts
|
|
151
|
-
//NOW FEATURING OBJECT PARAMETERS
|
|
152
|
-
|
|
153
164
|
// Transfer assets from Parachain to Parachain
|
|
154
165
|
await paraspell.xcmPallet.send(
|
|
155
166
|
{
|
|
156
167
|
api?: ApiPromise,
|
|
157
168
|
origin: origin Parachain name string,
|
|
158
|
-
currency: CurrencyString
|
|
169
|
+
currency: CurrencyString | CurrencyID | Multilocation object /*Only works for PolkadotXCM pallet*/,
|
|
170
|
+
feeAsset? - Fee asset select id
|
|
159
171
|
amount: any,
|
|
160
|
-
to: destination address string,
|
|
161
|
-
destination: destination Parachain ID,
|
|
172
|
+
to: destination address string | Multilocation object,
|
|
173
|
+
destination: destination Parachain ID | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/,
|
|
162
174
|
paraIdTo?: number,
|
|
163
175
|
destApiForKeepAlive?: ApiPromise
|
|
164
176
|
}
|
|
@@ -170,7 +182,8 @@ await paraspell.xcmPallet.send(
|
|
|
170
182
|
api?: ApiPromise,
|
|
171
183
|
origin: origin Parachain name string,
|
|
172
184
|
amount: any,
|
|
173
|
-
|
|
185
|
+
feeAsset? - Fee asset select id,
|
|
186
|
+
to: destination address string | Multilocation object,
|
|
174
187
|
paraIdTo?: number,
|
|
175
188
|
destApiForKeepAlive?: ApiPromise
|
|
176
189
|
}
|
|
@@ -180,9 +193,9 @@ await paraspell.xcmPallet.send(
|
|
|
180
193
|
await paraspell.xcmPallet.transferRelayToPara(
|
|
181
194
|
{
|
|
182
195
|
api?: ApiPromise,
|
|
183
|
-
destination: destination Parachain ID,
|
|
196
|
+
destination: destination Parachain ID | Multilocation object,
|
|
184
197
|
amount: any,
|
|
185
|
-
to: destination address string,
|
|
198
|
+
to: destination address string | Multilocation object,
|
|
186
199
|
paraIdTo?: number,
|
|
187
200
|
destApiForKeepAlive?: ApiPromise
|
|
188
201
|
}
|
|
@@ -291,7 +304,7 @@ XCM SDK can be tested in [Playground](https://github.com/paraspell/xcm-tools/tre
|
|
|
291
304
|
|
|
292
305
|
Made with 💛 by [ParaSpell✨](https://github.com/paraspell)
|
|
293
306
|
|
|
294
|
-
Published under [MIT License](https://github.com/paraspell/
|
|
307
|
+
Published under [MIT License](https://github.com/paraspell/xcm-tools/blob/main/packages/sdk/LICENSE).
|
|
295
308
|
|
|
296
309
|
## Support
|
|
297
310
|
|