@paraspell/sdk 3.1.1 → 4.0.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 +34 -55
- package/dist/index.cjs +1814 -645
- package/dist/index.d.ts +65 -29
- package/dist/index.mjs +1811 -643
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
SDK For XCM & XCMP handling made with ❤️ by ParaSpell✨. It is no longer necessary to construct calls manually. @paraspell/sdk handles this for you. Feel free to become a magician and try your paraSPELLS 🧙✨.
|
|
12
12
|
|
|
13
|
-
##### Currently supporting
|
|
13
|
+
##### Currently supporting 50 Polkadot & Kusama nodes list [here](https://github.com/paraspell/sdk/blob/main/docs/supportedNodes.md).
|
|
14
14
|
|
|
15
15
|
### Check out our brand new Wiki documentation! [Wiki docs](https://paraspell.github.io/docs/)
|
|
16
16
|
|
|
@@ -69,17 +69,23 @@ XCM pallet (Combined xTokens, polkadotXCM, ormlXTokens, XcmPallet & relayerXCM):
|
|
|
69
69
|
Builder pattern XCM & HRMP construction
|
|
70
70
|
|
|
71
71
|
```ts
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
//NOTE 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.
|
|
73
|
+
//NOTE2 You can now use custom ParachainIDs if you wish to test in TestNet. Just add parachainID as an additional parameter eg: .to('Basilisk', 2948)
|
|
74
|
+
//NOTE3 XCM Transfer Builders now require await
|
|
75
|
+
//NOTE4 You can now add optional parameter useKeepAlive which will ensure, that you send more than existential deposit.
|
|
76
|
+
//NOTE5 API parameter in XCM messages is now optional!
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
//Transfer tokens from Parachain to Parachain
|
|
79
|
+
await Builder(/*node api - optional*/).from(NODE).to(NODE/*,customParaId - optional*/).currency(CurrencyString||CurrencyID).amount(amount).address(address).build()
|
|
77
80
|
|
|
78
81
|
//Transfer tokens from the Relay chain to Parachain
|
|
79
|
-
Builder(api).to(NODE).amount(amount).address(address).build()
|
|
82
|
+
await Builder(/*node api - optional*/).to(NODE/*,customParaId - optional*/).amount(amount).address(address).build()
|
|
80
83
|
|
|
81
84
|
//Transfer tokens from Parachain to Relay chain
|
|
82
|
-
Builder(api).from(NODE).amount(amount).address(address).build()
|
|
85
|
+
await Builder(/*node api - optional*/).from(NODE).amount(amount).address(address).build()
|
|
86
|
+
|
|
87
|
+
//Use keepAlive example
|
|
88
|
+
await Builder(/*node api - optional*/).from(NODE).amount(amount).address(address).useKeepAlive(destinationParaAPI).build()
|
|
83
89
|
|
|
84
90
|
//Close HRMP channels
|
|
85
91
|
Builder(api).from(NODE).closeChannel().inbound(inbound).outbound(outbound).build()
|
|
@@ -91,15 +97,23 @@ Builder(api).from(NODE).to(NODE).openChannel().maxSize(maxSize).maxMessageSize(m
|
|
|
91
97
|
Function pattern XCM & HRMP construction
|
|
92
98
|
|
|
93
99
|
```ts
|
|
100
|
+
//NOTE If you wish to transfer from Parachain that uses long IDs for example Moonbeam you have to add character 'n' the end of currencyID. Eg: currency = 42259045809535163221576417993425387648n will mean you transfer xcDOT.
|
|
101
|
+
//NOTE2 You can now use custom ParachainIDs if you wish to test in TestNet. Just add parachainID as an additional parameter eg: .to('Basilisk', 2948)
|
|
102
|
+
//NOTE3 XCM Transfer Builders now require await
|
|
103
|
+
//NOTE4 You can now add optional parameter useKeepAlive which will ensure, that you send more than existential deposit.
|
|
104
|
+
//NOTE5 API parameter in XCM messages is now optional!
|
|
105
|
+
|
|
94
106
|
//Transfer tokens from Parachain to Parachain
|
|
95
|
-
|
|
96
|
-
paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name string, currency: CurrencyString||CurrencyID, amount: any, to: destination address string, destination: destination Parachain ID)
|
|
107
|
+
await paraspell.xcmPallet.send(api?: ApiPromise, origin: origin Parachain name string, currency: CurrencyString||CurrencyID, amount: any, to: destination address string, destination: destination Parachain ID, paraIdTo?: number,)
|
|
97
108
|
|
|
98
109
|
//Transfer tokens from Parachain to Relay chain
|
|
99
|
-
paraspell.xcmPallet.send(api
|
|
110
|
+
await paraspell.xcmPallet.send(api?: ApiPromise, origin: origin Parachain name string, amount: any, to: destination address string, paraIdTo?: number,)
|
|
100
111
|
|
|
101
112
|
//Transfer tokens from Relay chain to Parachain
|
|
102
|
-
paraspell.xcmPallet.transferRelayToPara(api
|
|
113
|
+
await paraspell.xcmPallet.transferRelayToPara(api?: ApiPromise, destination: destination Parachain ID, amount: any, to: destination address string,paraIdTo?: number,)
|
|
114
|
+
|
|
115
|
+
//Use keepAlive example
|
|
116
|
+
await paraspell.xcmPallet.send(api?: ApiPromise, destination: TNode, amount: string | number | bigint, to: string, paraIdTo?: number, destApiForKeepAlive?: ApiPromise)
|
|
103
117
|
|
|
104
118
|
//hrmp pallet:
|
|
105
119
|
//Close HRMP channels
|
|
@@ -147,46 +161,6 @@ paraspell.assets.getTNode(nodeID: number)
|
|
|
147
161
|
paraspell.NODE_NAMES
|
|
148
162
|
```
|
|
149
163
|
|
|
150
|
-
Basilisk XYK pallet construction
|
|
151
|
-
|
|
152
|
-
Builder pattern XYK construction
|
|
153
|
-
|
|
154
|
-
```ts
|
|
155
|
-
//Add liquidity to a specific pool
|
|
156
|
-
Builder(api).addLiquidity().assetA(assetA).assetB(assetB).amountA(amountA).amountBMaxLimit(maxLimit).build()
|
|
157
|
-
|
|
158
|
-
//Remove liquidity from a specific pool
|
|
159
|
-
Builder(api).removeLiquidity().assetA(assetA).assetB(assetB).liquidityAmount(liquidity).build()
|
|
160
|
-
|
|
161
|
-
//Create pool
|
|
162
|
-
Builder(api).createPool().assetA(assetA).amountA(amountA).assetB(assetB).amountB(amountB).build()
|
|
163
|
-
|
|
164
|
-
//Buy specific asset from the pool
|
|
165
|
-
Builder(api).buy().assetOut(out).assetIn(in).amount(amount).maxLimit(maxLimit).discount(discount).build()
|
|
166
|
-
|
|
167
|
-
//Sell specific asset from the pool
|
|
168
|
-
Builder(api).sell().assetIn(in).assetOut(out).amount(amount).maxLimit(maxLimit).discount(discount).build()
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Function pattern XYK construction
|
|
172
|
-
|
|
173
|
-
```ts
|
|
174
|
-
//Add liquidity to specific pool
|
|
175
|
-
paraspell.xyk.addLiquidity(api: ApiPromise, assetA: number, assetB: number, amountA: any, amountBMaxLimit: any)
|
|
176
|
-
|
|
177
|
-
//Remove liquidity from specific pool
|
|
178
|
-
paraspell.xyk.removeLiquidity(api: ApiPromise, assetA: number, assetB: number, liquidityAmount: any)
|
|
179
|
-
|
|
180
|
-
//Create pool
|
|
181
|
-
paraspell.xyk.createPool(api: ApiPromise, assetA: number, amountA: any, assetB: number, amountB: any)
|
|
182
|
-
|
|
183
|
-
//Buy specific asset from pool
|
|
184
|
-
paraspell.xyk.buy(api: ApiPromise, assetOut: number, assetIn: number, amount: any, maxLimit: any, discount: Bool)
|
|
185
|
-
|
|
186
|
-
//Sell specific asset from pool
|
|
187
|
-
paraspell.xyk.sell(api: ApiPromise, assetIn: number, assetOut: number, amount: any, maxLimit: any, discount: Bool)
|
|
188
|
-
```
|
|
189
|
-
|
|
190
164
|
Node pallet operations
|
|
191
165
|
|
|
192
166
|
```js
|
|
@@ -202,6 +176,13 @@ getSupportedPallets(node: TNode)
|
|
|
202
176
|
console.log(SUPPORTED_PALLETS)
|
|
203
177
|
```
|
|
204
178
|
|
|
179
|
+
Existential deposit query
|
|
180
|
+
```ts
|
|
181
|
+
import { getExistentialDeposit } from "@paraspell/sdk";
|
|
182
|
+
|
|
183
|
+
const ed = getExistentialDeposit('Acala')
|
|
184
|
+
```
|
|
185
|
+
|
|
205
186
|
##### Example of usage can be found in the UI repository [here](https://github.com/paraspell/ui) or in the Astarot repository [here](https://github.com/paraspell/astarot)
|
|
206
187
|
|
|
207
188
|
##### A list of currently compatible nodes can be found [here](https://github.com/paraspell/sdk/blob/beta-pre-release/docs/supportedNodes.md)
|
|
@@ -214,8 +195,6 @@ console.log(SUPPORTED_PALLETS)
|
|
|
214
195
|
|
|
215
196
|
- Install dependencies using `pnpm install`
|
|
216
197
|
|
|
217
|
-
- Run interactive tests using `pnpm dev`
|
|
218
|
-
|
|
219
198
|
- Run compilation test using `pnpm compile`
|
|
220
199
|
|
|
221
200
|
- Run linting test using `pnpm lint`
|
|
@@ -224,9 +203,9 @@ console.log(SUPPORTED_PALLETS)
|
|
|
224
203
|
|
|
225
204
|
- Run updatePallets script using `pnpm updatePallets`
|
|
226
205
|
|
|
227
|
-
- Run
|
|
206
|
+
- Run tests using `pnpm test`
|
|
228
207
|
|
|
229
|
-
- Run all
|
|
208
|
+
- Run all checks using `pnpm runAll`
|
|
230
209
|
|
|
231
210
|
## Founded by
|
|
232
211
|
|