@paraspell/sdk 4.1.0 → 5.0.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 +57 -12
- package/dist/index.cjs +586 -781
- package/dist/index.d.ts +73 -126
- package/dist/index.mjs +586 -780
- package/package.json +21 -22
package/README.md
CHANGED
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
|
|
28
28
|
#### Install dependencies
|
|
29
29
|
|
|
30
|
-
```
|
|
31
|
-
pnpm
|
|
30
|
+
```bash
|
|
31
|
+
pnpm | npm install || yarn add @polkadot/api @polkadot/types @polkadot/api-base @polkadot/apps-config @polkadot/util
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
#### Install SDK
|
|
35
35
|
|
|
36
|
-
```
|
|
37
|
-
pnpm
|
|
36
|
+
```bash
|
|
37
|
+
pnpm | npm install || yarn add @paraspell/sdk
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
#### Importing package to your project:
|
|
@@ -148,23 +148,66 @@ Builder(api)
|
|
|
148
148
|
|
|
149
149
|
### Function pattern:
|
|
150
150
|
```ts
|
|
151
|
+
//NOW FEATURING OBJECT PARAMETERS
|
|
152
|
+
|
|
151
153
|
// Transfer assets from Parachain to Parachain
|
|
152
|
-
await paraspell.xcmPallet.send(
|
|
154
|
+
await paraspell.xcmPallet.send(
|
|
155
|
+
{
|
|
156
|
+
api?: ApiPromise,
|
|
157
|
+
origin: origin Parachain name string,
|
|
158
|
+
currency: CurrencyString||CurrencyID,
|
|
159
|
+
amount: any,
|
|
160
|
+
to: destination address string,
|
|
161
|
+
destination: destination Parachain ID,
|
|
162
|
+
paraIdTo?: number,
|
|
163
|
+
destApiForKeepAlive?: ApiPromise
|
|
164
|
+
}
|
|
165
|
+
)
|
|
153
166
|
|
|
154
167
|
// Transfer assets from Parachain to Relay chain
|
|
155
|
-
await paraspell.xcmPallet.send(
|
|
168
|
+
await paraspell.xcmPallet.send(
|
|
169
|
+
{
|
|
170
|
+
api?: ApiPromise,
|
|
171
|
+
origin: origin Parachain name string,
|
|
172
|
+
amount: any,
|
|
173
|
+
to: destination address string,
|
|
174
|
+
paraIdTo?: number,
|
|
175
|
+
destApiForKeepAlive?: ApiPromise
|
|
176
|
+
}
|
|
177
|
+
)
|
|
156
178
|
|
|
157
179
|
// Transfer assets from Relay chain to Parachain
|
|
158
|
-
await paraspell.xcmPallet.transferRelayToPara(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
180
|
+
await paraspell.xcmPallet.transferRelayToPara(
|
|
181
|
+
{
|
|
182
|
+
api?: ApiPromise,
|
|
183
|
+
destination: destination Parachain ID,
|
|
184
|
+
amount: any,
|
|
185
|
+
to: destination address string,
|
|
186
|
+
paraIdTo?: number,
|
|
187
|
+
destApiForKeepAlive?: ApiPromise
|
|
188
|
+
}
|
|
189
|
+
)
|
|
162
190
|
|
|
163
191
|
// Close HRMP channels
|
|
164
|
-
paraspell.closeChannels.closeChannel(
|
|
192
|
+
paraspell.closeChannels.closeChannel(
|
|
193
|
+
{
|
|
194
|
+
api: ApiPromise,
|
|
195
|
+
origin: origin Parachain ID,
|
|
196
|
+
inbound: number,
|
|
197
|
+
outbound: number
|
|
198
|
+
}
|
|
199
|
+
)
|
|
165
200
|
|
|
166
201
|
// Open HRMP channels
|
|
167
|
-
paraspell.openChannels.openChannel(
|
|
202
|
+
paraspell.openChannels.openChannel(
|
|
203
|
+
{
|
|
204
|
+
api: ApiPromise,
|
|
205
|
+
origin: origin Parachain ID,
|
|
206
|
+
destination: destination Parachain ID,
|
|
207
|
+
maxSize: number,
|
|
208
|
+
maxMessageSize: number
|
|
209
|
+
}
|
|
210
|
+
)
|
|
168
211
|
```
|
|
169
212
|
|
|
170
213
|
### Asset queries:
|
|
@@ -242,6 +285,8 @@ const ed = getExistentialDeposit('Acala')
|
|
|
242
285
|
|
|
243
286
|
- Run all core tests and checks using `pnpm runAll`
|
|
244
287
|
|
|
288
|
+
XCM SDK can be tested in [Playground](https://github.com/paraspell/xcm-tools/tree/main/apps/playground).
|
|
289
|
+
|
|
245
290
|
## License
|
|
246
291
|
|
|
247
292
|
Made with 💛 by [ParaSpell✨](https://github.com/paraspell)
|