@paraspell/sdk-pjs 8.0.3 → 8.2.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 +53 -17
- package/dist/index.cjs +57 -58
- package/dist/index.mjs +58 -59
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -77,31 +77,37 @@ NOTES:
|
|
|
77
77
|
- ParaSpell now offers advanced asset symbol selection {symbol: "symbol"} for non duplicate assets, {symbol: Native("symbol")} or {symbol: Foreign("symbol")} if the duplicates are between native and foreign assets and {symbol: ForeignAbstract("symbol")} if the duplicates are in foreign assets only. You will get an error that will guide you further if you simply start with {symbol: "symbol"}.
|
|
78
78
|
- You can now select assets by multilocation by simply using { multilocation: string | JSON }. The custom multilocation selection remains supported, but in order to use it you now have to use override - {multilocation: Override('Custom Multilocation')}.
|
|
79
79
|
- The balance queries also support multilocation asset selection
|
|
80
|
+
- You can now query foreign asset minimal deposits also.
|
|
80
81
|
```
|
|
81
82
|
|
|
82
83
|
```
|
|
83
84
|
Latest news:
|
|
84
|
-
- You can now query foreign asset minimal deposits also.
|
|
85
85
|
- Since v8, amount moved closer to currency selection and specifying from and to parameters is no longer optional to save code.
|
|
86
86
|
- More information on v8 major breaking change: https://github.com/paraspell/xcm-tools/pull/554
|
|
87
87
|
- XCM SDK Now supports API Failsafe - If one endpoint doesn't work it automatically switches to the next one.
|
|
88
|
+
- Builder now allows you to directly disconnect API.
|
|
88
89
|
```
|
|
89
90
|
|
|
90
91
|
### Builder pattern:
|
|
91
92
|
|
|
92
93
|
##### Transfer assets from Parachain to Parachain
|
|
93
94
|
```ts
|
|
94
|
-
|
|
95
|
+
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
95
96
|
.from(NODE)
|
|
96
97
|
.to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
|
|
97
98
|
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {multilocation: AssetMultilocationString, amount: amount | AssetMultilocationJson, amount: amount} | {multilocation: Override('Custom Multilocation'), amount: amount} | {multiasset: {currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or multilocation: multilocation*/, amount: amount}})
|
|
98
99
|
.address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/)
|
|
99
100
|
/*.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
|
|
100
101
|
.customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
|
|
101
|
-
|
|
102
|
+
|
|
103
|
+
const tx = await builder.build()
|
|
104
|
+
|
|
105
|
+
//Make sure to disconnect API after it is no longer used (eg. after transaction)
|
|
106
|
+
await builder.disconnect()
|
|
107
|
+
|
|
102
108
|
/*
|
|
103
109
|
EXAMPLE:
|
|
104
|
-
const
|
|
110
|
+
const builder = Builder()
|
|
105
111
|
.from('Acala')
|
|
106
112
|
.to('Astar')
|
|
107
113
|
.currency({
|
|
@@ -109,22 +115,31 @@ const tx = await Builder()
|
|
|
109
115
|
amount: '1000000000'
|
|
110
116
|
})
|
|
111
117
|
.address(address)
|
|
112
|
-
|
|
118
|
+
|
|
119
|
+
const tx = await builder.build()
|
|
120
|
+
|
|
121
|
+
//Disconnect API after TX
|
|
122
|
+
await builder.disconnect()
|
|
113
123
|
*/
|
|
114
124
|
```
|
|
115
125
|
##### Transfer assets from the Relay chain to Parachain
|
|
116
126
|
```ts
|
|
117
|
-
|
|
127
|
+
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
118
128
|
.from(RELAY_NODE) //Kusama or Polkadot
|
|
119
129
|
.to(NODE/*,customParaId - optional*/ | Multilocation object)
|
|
120
130
|
.currency({symbol: 'DOT', amount: amount})
|
|
121
131
|
.address(address | Multilocation object)
|
|
122
132
|
/*.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
|
|
123
133
|
.customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
|
|
124
|
-
|
|
134
|
+
|
|
135
|
+
const tx = await builder.build()
|
|
136
|
+
|
|
137
|
+
//Make sure to disconnect API after it is no longer used (eg. after transaction)
|
|
138
|
+
await builder.disconnect()
|
|
139
|
+
|
|
125
140
|
/*
|
|
126
141
|
EXAMPLE:
|
|
127
|
-
const
|
|
142
|
+
const builder = await Builder()
|
|
128
143
|
.from('Polkadot')
|
|
129
144
|
.to('Astar')
|
|
130
145
|
.currency({
|
|
@@ -132,22 +147,31 @@ const tx = await Builder()
|
|
|
132
147
|
amount: '1000000000'
|
|
133
148
|
})
|
|
134
149
|
.address(address)
|
|
135
|
-
|
|
150
|
+
|
|
151
|
+
const tx = await builder.build()
|
|
152
|
+
|
|
153
|
+
//Disconnect API after TX
|
|
154
|
+
await builder.disconnect()
|
|
136
155
|
*/
|
|
137
156
|
```
|
|
138
157
|
##### Transfer assets from Parachain to Relay chain
|
|
139
158
|
```ts
|
|
140
|
-
|
|
159
|
+
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
141
160
|
.from(NODE)
|
|
142
161
|
.to(RELAY_NODE) //Kusama or Polkadot
|
|
143
162
|
.currency({symbol: 'DOT', amount: amount})
|
|
144
163
|
.address(address | Multilocation object)
|
|
145
164
|
/*.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
|
|
146
165
|
.customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
|
|
147
|
-
|
|
166
|
+
|
|
167
|
+
const tx = await builder.build()
|
|
168
|
+
|
|
169
|
+
//Make sure to disconnect API after it is no longer used (eg. after transaction)
|
|
170
|
+
await builder.disconnect()
|
|
171
|
+
|
|
148
172
|
/*
|
|
149
173
|
EXAMPLE:
|
|
150
|
-
const
|
|
174
|
+
const builder = await Builder()
|
|
151
175
|
.from('Astar')
|
|
152
176
|
.to('Polkadot')
|
|
153
177
|
.currency({
|
|
@@ -155,14 +179,18 @@ const tx = await Builder()
|
|
|
155
179
|
amount: '1000000000'
|
|
156
180
|
})
|
|
157
181
|
.address(address)
|
|
158
|
-
|
|
182
|
+
|
|
183
|
+
const tx = await builder.build()
|
|
184
|
+
|
|
185
|
+
//Disconnect API after TX
|
|
186
|
+
await builder.disconnect()
|
|
159
187
|
*/
|
|
160
188
|
```
|
|
161
189
|
|
|
162
190
|
##### Batch calls
|
|
163
191
|
You can batch XCM calls and execute multiple XCM calls within one call. All three scenarios (Para->Para, Para->Relay, Relay->Para) can be used and combined.
|
|
164
192
|
```js
|
|
165
|
-
|
|
193
|
+
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
166
194
|
.from(NODE) //Ensure, that origin node is the same in all batched XCM Calls.
|
|
167
195
|
.to(NODE_2) //Any compatible Parachain
|
|
168
196
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
@@ -174,10 +202,14 @@ await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
174
202
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
175
203
|
.address(address | Multilocation object)
|
|
176
204
|
.addToBatch()
|
|
177
|
-
|
|
205
|
+
|
|
206
|
+
const tx = await builder.buildBatch({
|
|
178
207
|
// This settings object is optional and batch all is the default option
|
|
179
208
|
mode: BatchMode.BATCH_ALL //or BatchMode.BATCH
|
|
180
209
|
})
|
|
210
|
+
|
|
211
|
+
//Make sure to disconnect API after it is no longer used (eg. after transaction)
|
|
212
|
+
await builder.disconnect()
|
|
181
213
|
```
|
|
182
214
|
|
|
183
215
|
### Dry run your XCM Calls:
|
|
@@ -197,12 +229,16 @@ getDryRun({api /*optional*/, node, address, tx /* Extrinsic object */})
|
|
|
197
229
|
### Asset claim:
|
|
198
230
|
```ts
|
|
199
231
|
//Claim XCM trapped assets from the selected chain
|
|
200
|
-
|
|
232
|
+
const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
201
233
|
.claimFrom(NODE)
|
|
202
234
|
.fungible(MultilocationArray (Only one multilocation allowed) [{Multilocation}])
|
|
203
235
|
.account(address | Multilocation object)
|
|
204
236
|
/*.xcmVersion(Version.V3) Optional parameter, by default V3. XCM Version ENUM if a different XCM version is needed (Supported V2 & V3). Requires importing Version enum.*/
|
|
205
|
-
|
|
237
|
+
|
|
238
|
+
const tx = await builder.build()
|
|
239
|
+
|
|
240
|
+
//Make sure to disconnect API after it is no longer used (eg. after transaction)
|
|
241
|
+
await builder.disconnect()
|
|
206
242
|
```
|
|
207
243
|
|
|
208
244
|
### Asset queries:
|
package/dist/index.cjs
CHANGED
|
@@ -15,9 +15,6 @@ function _arrayLikeToArray(r, a) {
|
|
|
15
15
|
function _arrayWithHoles(r) {
|
|
16
16
|
if (Array.isArray(r)) return r;
|
|
17
17
|
}
|
|
18
|
-
function _arrayWithoutHoles(r) {
|
|
19
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
20
|
-
}
|
|
21
18
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
22
19
|
try {
|
|
23
20
|
var i = n[a](c),
|
|
@@ -39,7 +36,7 @@ function _asyncToGenerator(n) {
|
|
|
39
36
|
function _throw(n) {
|
|
40
37
|
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
41
38
|
}
|
|
42
|
-
_next(
|
|
39
|
+
_next(undefined);
|
|
43
40
|
});
|
|
44
41
|
};
|
|
45
42
|
}
|
|
@@ -49,25 +46,22 @@ function _classCallCheck(a, n) {
|
|
|
49
46
|
function _defineProperties(e, r) {
|
|
50
47
|
for (var t = 0; t < r.length; t++) {
|
|
51
48
|
var o = r[t];
|
|
52
|
-
o.enumerable = o.enumerable ||
|
|
49
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
function _createClass(e, r, t) {
|
|
56
53
|
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
57
|
-
writable:
|
|
54
|
+
writable: false
|
|
58
55
|
}), e;
|
|
59
56
|
}
|
|
60
57
|
function _defineProperty(e, r, t) {
|
|
61
58
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
62
59
|
value: t,
|
|
63
|
-
enumerable:
|
|
64
|
-
configurable:
|
|
65
|
-
writable:
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true
|
|
66
63
|
}) : e[r] = t, e;
|
|
67
64
|
}
|
|
68
|
-
function _iterableToArray(r) {
|
|
69
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
70
|
-
}
|
|
71
65
|
function _iterableToArrayLimit(r, l) {
|
|
72
66
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
73
67
|
if (null != t) {
|
|
@@ -76,12 +70,12 @@ function _iterableToArrayLimit(r, l) {
|
|
|
76
70
|
i,
|
|
77
71
|
u,
|
|
78
72
|
a = [],
|
|
79
|
-
f =
|
|
80
|
-
o =
|
|
73
|
+
f = true,
|
|
74
|
+
o = false;
|
|
81
75
|
try {
|
|
82
76
|
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
83
77
|
} catch (r) {
|
|
84
|
-
o =
|
|
78
|
+
o = true, n = r;
|
|
85
79
|
} finally {
|
|
86
80
|
try {
|
|
87
81
|
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
@@ -95,9 +89,6 @@ function _iterableToArrayLimit(r, l) {
|
|
|
95
89
|
function _nonIterableRest() {
|
|
96
90
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
97
91
|
}
|
|
98
|
-
function _nonIterableSpread() {
|
|
99
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
100
|
-
}
|
|
101
92
|
function ownKeys(e, r) {
|
|
102
93
|
var t = Object.keys(e);
|
|
103
94
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -111,7 +102,7 @@ function ownKeys(e, r) {
|
|
|
111
102
|
function _objectSpread2(e) {
|
|
112
103
|
for (var r = 1; r < arguments.length; r++) {
|
|
113
104
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
114
|
-
r % 2 ? ownKeys(Object(t),
|
|
105
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
115
106
|
_defineProperty(e, r, t[r]);
|
|
116
107
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
117
108
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
@@ -137,9 +128,9 @@ function _regeneratorRuntime() {
|
|
|
137
128
|
function define(t, e, r) {
|
|
138
129
|
return Object.defineProperty(t, e, {
|
|
139
130
|
value: r,
|
|
140
|
-
enumerable:
|
|
141
|
-
configurable:
|
|
142
|
-
writable:
|
|
131
|
+
enumerable: true,
|
|
132
|
+
configurable: true,
|
|
133
|
+
writable: true
|
|
143
134
|
}), t[e];
|
|
144
135
|
}
|
|
145
136
|
try {
|
|
@@ -232,7 +223,7 @@ function _regeneratorRuntime() {
|
|
|
232
223
|
if ("throw" === i) throw a;
|
|
233
224
|
return {
|
|
234
225
|
value: t,
|
|
235
|
-
done:
|
|
226
|
+
done: true
|
|
236
227
|
};
|
|
237
228
|
}
|
|
238
229
|
for (n.method = i, n.arg = a;;) {
|
|
@@ -283,7 +274,7 @@ function _regeneratorRuntime() {
|
|
|
283
274
|
function Context(t) {
|
|
284
275
|
this.tryEntries = [{
|
|
285
276
|
tryLoc: "root"
|
|
286
|
-
}], t.forEach(pushTryEntry, this), this.reset(
|
|
277
|
+
}], t.forEach(pushTryEntry, this), this.reset(true);
|
|
287
278
|
}
|
|
288
279
|
function values(e) {
|
|
289
280
|
if (e || "" === e) {
|
|
@@ -293,8 +284,8 @@ function _regeneratorRuntime() {
|
|
|
293
284
|
if (!isNaN(e.length)) {
|
|
294
285
|
var o = -1,
|
|
295
286
|
i = function next() {
|
|
296
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done =
|
|
297
|
-
return next.value = t, next.done =
|
|
287
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
|
|
288
|
+
return next.value = t, next.done = true, next;
|
|
298
289
|
};
|
|
299
290
|
return i.next = i;
|
|
300
291
|
}
|
|
@@ -303,10 +294,10 @@ function _regeneratorRuntime() {
|
|
|
303
294
|
}
|
|
304
295
|
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
305
296
|
value: GeneratorFunctionPrototype,
|
|
306
|
-
configurable:
|
|
297
|
+
configurable: true
|
|
307
298
|
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
308
299
|
value: GeneratorFunction,
|
|
309
|
-
configurable:
|
|
300
|
+
configurable: true
|
|
310
301
|
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
311
302
|
var e = "function" == typeof t && t.constructor;
|
|
312
303
|
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
@@ -319,7 +310,7 @@ function _regeneratorRuntime() {
|
|
|
319
310
|
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
320
311
|
return this;
|
|
321
312
|
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
322
|
-
|
|
313
|
+
undefined === i && (i = Promise);
|
|
323
314
|
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
324
315
|
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
325
316
|
return t.done ? t.value : a.next();
|
|
@@ -335,17 +326,17 @@ function _regeneratorRuntime() {
|
|
|
335
326
|
return r.reverse(), function next() {
|
|
336
327
|
for (; r.length;) {
|
|
337
328
|
var t = r.pop();
|
|
338
|
-
if (t in e) return next.value = t, next.done =
|
|
329
|
+
if (t in e) return next.value = t, next.done = false, next;
|
|
339
330
|
}
|
|
340
|
-
return next.done =
|
|
331
|
+
return next.done = true, next;
|
|
341
332
|
};
|
|
342
333
|
}, e.values = values, Context.prototype = {
|
|
343
334
|
constructor: Context,
|
|
344
335
|
reset: function (e) {
|
|
345
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done =
|
|
336
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
346
337
|
},
|
|
347
338
|
stop: function () {
|
|
348
|
-
this.done =
|
|
339
|
+
this.done = true;
|
|
349
340
|
var t = this.tryEntries[0].completion;
|
|
350
341
|
if ("throw" === t.type) throw t.arg;
|
|
351
342
|
return this.rval;
|
|
@@ -364,10 +355,10 @@ function _regeneratorRuntime() {
|
|
|
364
355
|
var c = n.call(i, "catchLoc"),
|
|
365
356
|
u = n.call(i, "finallyLoc");
|
|
366
357
|
if (c && u) {
|
|
367
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc,
|
|
358
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
368
359
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
369
360
|
} else if (c) {
|
|
370
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc,
|
|
361
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
371
362
|
} else {
|
|
372
363
|
if (!u) throw Error("try statement without catch or finally");
|
|
373
364
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
@@ -423,13 +414,10 @@ function _regeneratorRuntime() {
|
|
|
423
414
|
function _slicedToArray(r, e) {
|
|
424
415
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
425
416
|
}
|
|
426
|
-
function _toConsumableArray(r) {
|
|
427
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
428
|
-
}
|
|
429
417
|
function _toPrimitive(t, r) {
|
|
430
418
|
if ("object" != typeof t || !t) return t;
|
|
431
419
|
var e = t[Symbol.toPrimitive];
|
|
432
|
-
if (
|
|
420
|
+
if (undefined !== e) {
|
|
433
421
|
var i = e.call(t, r || "default");
|
|
434
422
|
if ("object" != typeof i) return i;
|
|
435
423
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
@@ -453,7 +441,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
453
441
|
if (r) {
|
|
454
442
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
455
443
|
var t = {}.toString.call(r).slice(8, -1);
|
|
456
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) :
|
|
444
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : undefined;
|
|
457
445
|
}
|
|
458
446
|
}
|
|
459
447
|
|
|
@@ -714,7 +702,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
714
702
|
_context.next = 16;
|
|
715
703
|
break;
|
|
716
704
|
case 8:
|
|
717
|
-
if (!((_this$_api = this._api) !== null && _this$_api !==
|
|
705
|
+
if (!((_this$_api = this._api) !== null && _this$_api !== undefined)) {
|
|
718
706
|
_context.next = 12;
|
|
719
707
|
break;
|
|
720
708
|
}
|
|
@@ -779,18 +767,20 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
779
767
|
}, {
|
|
780
768
|
key: "callTxMethod",
|
|
781
769
|
value: function callTxMethod(_ref) {
|
|
782
|
-
var _this$api$tx$
|
|
770
|
+
var _this$api$tx$moduleLo;
|
|
783
771
|
var module = _ref.module,
|
|
784
772
|
section = _ref.section,
|
|
785
773
|
parameters = _ref.parameters;
|
|
786
774
|
var values = Object.values(parameters);
|
|
787
775
|
var moduleLowerCase = lowercaseFirstLetter(module);
|
|
788
776
|
var sectionCamelCase = snakeToCamel(section);
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
777
|
+
return (_this$api$tx$moduleLo = this.api.tx[moduleLowerCase])[sectionCamelCase].apply(_this$api$tx$moduleLo, values);
|
|
778
|
+
}
|
|
779
|
+
}, {
|
|
780
|
+
key: "callBatchMethod",
|
|
781
|
+
value: function callBatchMethod(calls, mode) {
|
|
782
|
+
var section = mode === sdkCore.BatchMode.BATCH_ALL ? 'batchAll' : 'batch';
|
|
783
|
+
return this.api.tx.utility[section](calls);
|
|
794
784
|
}
|
|
795
785
|
}, {
|
|
796
786
|
key: "calculateTransactionFee",
|
|
@@ -1019,7 +1009,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1019
1009
|
var assetItem = _ref3$0$args[1];
|
|
1020
1010
|
_ref3[1];
|
|
1021
1011
|
var assetSymbol = assetItem.toString().toLowerCase();
|
|
1022
|
-
return assetSymbol === ((_asset$symbol = asset.symbol) === null || _asset$symbol ===
|
|
1012
|
+
return assetSymbol === ((_asset$symbol = asset.symbol) === null || _asset$symbol === undefined ? undefined : _asset$symbol.toLowerCase()) || sdkCore.isForeignAsset(asset) && assetSymbol === ((_asset$assetId = asset.assetId) === null || _asset$assetId === undefined ? undefined : _asset$assetId.toLowerCase()) || Object.values((_assetItem$toHuman = assetItem.toHuman()) !== null && _assetItem$toHuman !== undefined ? _assetItem$toHuman : {}).toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === undefined ? undefined : _asset$symbol2.toLowerCase()) || sdkCore.isForeignAsset(asset) && Object.values((_assetItem$toHuman2 = assetItem.toHuman()) !== null && _assetItem$toHuman2 !== undefined ? _assetItem$toHuman2 : {}).toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === undefined ? undefined : _asset$assetId2.toLowerCase());
|
|
1023
1013
|
});
|
|
1024
1014
|
accountData = entry ? entry[1] : null;
|
|
1025
1015
|
return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
@@ -1182,22 +1172,31 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1182
1172
|
key: "disconnect",
|
|
1183
1173
|
value: function () {
|
|
1184
1174
|
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1175
|
+
var force,
|
|
1176
|
+
_args16 = arguments;
|
|
1185
1177
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1186
1178
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1187
1179
|
case 0:
|
|
1188
|
-
|
|
1189
|
-
|
|
1180
|
+
force = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : false;
|
|
1181
|
+
if (this.initialized) {
|
|
1182
|
+
_context16.next = 3;
|
|
1190
1183
|
break;
|
|
1191
1184
|
}
|
|
1192
|
-
return _context16.abrupt("return");
|
|
1193
|
-
case
|
|
1194
|
-
if (!(
|
|
1185
|
+
return _context16.abrupt("return", Promise.resolve());
|
|
1186
|
+
case 3:
|
|
1187
|
+
if (!(!force && !this.disconnectAllowed)) {
|
|
1195
1188
|
_context16.next = 5;
|
|
1196
1189
|
break;
|
|
1197
1190
|
}
|
|
1198
|
-
_context16.
|
|
1199
|
-
return this.api.disconnect();
|
|
1191
|
+
return _context16.abrupt("return");
|
|
1200
1192
|
case 5:
|
|
1193
|
+
if (!(force || typeof this._api === 'string' || this._api === undefined)) {
|
|
1194
|
+
_context16.next = 8;
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
_context16.next = 8;
|
|
1198
|
+
return this.api.disconnect();
|
|
1199
|
+
case 8:
|
|
1201
1200
|
case "end":
|
|
1202
1201
|
return _context16.stop();
|
|
1203
1202
|
}
|
|
@@ -1442,13 +1441,13 @@ var EvmBuilderClass = /*#__PURE__*/function () {
|
|
|
1442
1441
|
_context.next = 19;
|
|
1443
1442
|
break;
|
|
1444
1443
|
}
|
|
1445
|
-
_context.t1 = _yield$transferEthToP2 ===
|
|
1444
|
+
_context.t1 = _yield$transferEthToP2 === undefined;
|
|
1446
1445
|
case 19:
|
|
1447
1446
|
if (!_context.t1) {
|
|
1448
1447
|
_context.next = 23;
|
|
1449
1448
|
break;
|
|
1450
1449
|
}
|
|
1451
|
-
_context.t3 =
|
|
1450
|
+
_context.t3 = undefined;
|
|
1452
1451
|
_context.next = 24;
|
|
1453
1452
|
break;
|
|
1454
1453
|
case 23:
|
|
@@ -1460,7 +1459,7 @@ var EvmBuilderClass = /*#__PURE__*/function () {
|
|
|
1460
1459
|
_context.next = 28;
|
|
1461
1460
|
break;
|
|
1462
1461
|
}
|
|
1463
|
-
_context.t0 = _yield$transferEthToP !==
|
|
1462
|
+
_context.t0 = _yield$transferEthToP !== undefined;
|
|
1464
1463
|
case 28:
|
|
1465
1464
|
if (!_context.t0) {
|
|
1466
1465
|
_context.next = 32;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getParaId, isForeignAsset, InvalidCurrencyError, getAssetBySymbolOrId, isOverrideMultiLocationSpecifier, createApiInstanceForNode as createApiInstanceForNode$1, getNode, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, send as send$1, getDryRun as getDryRun$1, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getTransferInfo as getTransferInfo$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, getMaxNativeTransferableAmount as getMaxNativeTransferableAmount$1, getMaxForeignTransferableAmount as getMaxForeignTransferableAmount$1, getTransferableAmount as getTransferableAmount$1, Foreign, ForeignAbstract, Native, Override, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, transferMoonbeamEvm, Builder as Builder$1, GeneralBuilder as GeneralBuilder$1 } from '@paraspell/sdk-core';
|
|
1
|
+
import { getParaId, isForeignAsset, InvalidCurrencyError, getAssetBySymbolOrId, isOverrideMultiLocationSpecifier, BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, send as send$1, getDryRun as getDryRun$1, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getTransferInfo as getTransferInfo$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, getMaxNativeTransferableAmount as getMaxNativeTransferableAmount$1, getMaxForeignTransferableAmount as getMaxForeignTransferableAmount$1, getTransferableAmount as getTransferableAmount$1, Foreign, ForeignAbstract, Native, Override, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, transferMoonbeamEvm, Builder as Builder$1, GeneralBuilder as GeneralBuilder$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { contextFactory, toPolkadot, environment } from '@snowbridge/api';
|
|
4
4
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
@@ -14,9 +14,6 @@ function _arrayLikeToArray(r, a) {
|
|
|
14
14
|
function _arrayWithHoles(r) {
|
|
15
15
|
if (Array.isArray(r)) return r;
|
|
16
16
|
}
|
|
17
|
-
function _arrayWithoutHoles(r) {
|
|
18
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
19
|
-
}
|
|
20
17
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
21
18
|
try {
|
|
22
19
|
var i = n[a](c),
|
|
@@ -38,7 +35,7 @@ function _asyncToGenerator(n) {
|
|
|
38
35
|
function _throw(n) {
|
|
39
36
|
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
40
37
|
}
|
|
41
|
-
_next(
|
|
38
|
+
_next(undefined);
|
|
42
39
|
});
|
|
43
40
|
};
|
|
44
41
|
}
|
|
@@ -48,25 +45,22 @@ function _classCallCheck(a, n) {
|
|
|
48
45
|
function _defineProperties(e, r) {
|
|
49
46
|
for (var t = 0; t < r.length; t++) {
|
|
50
47
|
var o = r[t];
|
|
51
|
-
o.enumerable = o.enumerable ||
|
|
48
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
function _createClass(e, r, t) {
|
|
55
52
|
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
56
|
-
writable:
|
|
53
|
+
writable: false
|
|
57
54
|
}), e;
|
|
58
55
|
}
|
|
59
56
|
function _defineProperty(e, r, t) {
|
|
60
57
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
61
58
|
value: t,
|
|
62
|
-
enumerable:
|
|
63
|
-
configurable:
|
|
64
|
-
writable:
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true
|
|
65
62
|
}) : e[r] = t, e;
|
|
66
63
|
}
|
|
67
|
-
function _iterableToArray(r) {
|
|
68
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
69
|
-
}
|
|
70
64
|
function _iterableToArrayLimit(r, l) {
|
|
71
65
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
72
66
|
if (null != t) {
|
|
@@ -75,12 +69,12 @@ function _iterableToArrayLimit(r, l) {
|
|
|
75
69
|
i,
|
|
76
70
|
u,
|
|
77
71
|
a = [],
|
|
78
|
-
f =
|
|
79
|
-
o =
|
|
72
|
+
f = true,
|
|
73
|
+
o = false;
|
|
80
74
|
try {
|
|
81
75
|
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
82
76
|
} catch (r) {
|
|
83
|
-
o =
|
|
77
|
+
o = true, n = r;
|
|
84
78
|
} finally {
|
|
85
79
|
try {
|
|
86
80
|
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
@@ -94,9 +88,6 @@ function _iterableToArrayLimit(r, l) {
|
|
|
94
88
|
function _nonIterableRest() {
|
|
95
89
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
96
90
|
}
|
|
97
|
-
function _nonIterableSpread() {
|
|
98
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
99
|
-
}
|
|
100
91
|
function ownKeys(e, r) {
|
|
101
92
|
var t = Object.keys(e);
|
|
102
93
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -110,7 +101,7 @@ function ownKeys(e, r) {
|
|
|
110
101
|
function _objectSpread2(e) {
|
|
111
102
|
for (var r = 1; r < arguments.length; r++) {
|
|
112
103
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
113
|
-
r % 2 ? ownKeys(Object(t),
|
|
104
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
114
105
|
_defineProperty(e, r, t[r]);
|
|
115
106
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
116
107
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
@@ -136,9 +127,9 @@ function _regeneratorRuntime() {
|
|
|
136
127
|
function define(t, e, r) {
|
|
137
128
|
return Object.defineProperty(t, e, {
|
|
138
129
|
value: r,
|
|
139
|
-
enumerable:
|
|
140
|
-
configurable:
|
|
141
|
-
writable:
|
|
130
|
+
enumerable: true,
|
|
131
|
+
configurable: true,
|
|
132
|
+
writable: true
|
|
142
133
|
}), t[e];
|
|
143
134
|
}
|
|
144
135
|
try {
|
|
@@ -231,7 +222,7 @@ function _regeneratorRuntime() {
|
|
|
231
222
|
if ("throw" === i) throw a;
|
|
232
223
|
return {
|
|
233
224
|
value: t,
|
|
234
|
-
done:
|
|
225
|
+
done: true
|
|
235
226
|
};
|
|
236
227
|
}
|
|
237
228
|
for (n.method = i, n.arg = a;;) {
|
|
@@ -282,7 +273,7 @@ function _regeneratorRuntime() {
|
|
|
282
273
|
function Context(t) {
|
|
283
274
|
this.tryEntries = [{
|
|
284
275
|
tryLoc: "root"
|
|
285
|
-
}], t.forEach(pushTryEntry, this), this.reset(
|
|
276
|
+
}], t.forEach(pushTryEntry, this), this.reset(true);
|
|
286
277
|
}
|
|
287
278
|
function values(e) {
|
|
288
279
|
if (e || "" === e) {
|
|
@@ -292,8 +283,8 @@ function _regeneratorRuntime() {
|
|
|
292
283
|
if (!isNaN(e.length)) {
|
|
293
284
|
var o = -1,
|
|
294
285
|
i = function next() {
|
|
295
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done =
|
|
296
|
-
return next.value = t, next.done =
|
|
286
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
|
|
287
|
+
return next.value = t, next.done = true, next;
|
|
297
288
|
};
|
|
298
289
|
return i.next = i;
|
|
299
290
|
}
|
|
@@ -302,10 +293,10 @@ function _regeneratorRuntime() {
|
|
|
302
293
|
}
|
|
303
294
|
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
304
295
|
value: GeneratorFunctionPrototype,
|
|
305
|
-
configurable:
|
|
296
|
+
configurable: true
|
|
306
297
|
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
307
298
|
value: GeneratorFunction,
|
|
308
|
-
configurable:
|
|
299
|
+
configurable: true
|
|
309
300
|
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
310
301
|
var e = "function" == typeof t && t.constructor;
|
|
311
302
|
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
@@ -318,7 +309,7 @@ function _regeneratorRuntime() {
|
|
|
318
309
|
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
319
310
|
return this;
|
|
320
311
|
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
321
|
-
|
|
312
|
+
undefined === i && (i = Promise);
|
|
322
313
|
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
323
314
|
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
324
315
|
return t.done ? t.value : a.next();
|
|
@@ -334,17 +325,17 @@ function _regeneratorRuntime() {
|
|
|
334
325
|
return r.reverse(), function next() {
|
|
335
326
|
for (; r.length;) {
|
|
336
327
|
var t = r.pop();
|
|
337
|
-
if (t in e) return next.value = t, next.done =
|
|
328
|
+
if (t in e) return next.value = t, next.done = false, next;
|
|
338
329
|
}
|
|
339
|
-
return next.done =
|
|
330
|
+
return next.done = true, next;
|
|
340
331
|
};
|
|
341
332
|
}, e.values = values, Context.prototype = {
|
|
342
333
|
constructor: Context,
|
|
343
334
|
reset: function (e) {
|
|
344
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done =
|
|
335
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
345
336
|
},
|
|
346
337
|
stop: function () {
|
|
347
|
-
this.done =
|
|
338
|
+
this.done = true;
|
|
348
339
|
var t = this.tryEntries[0].completion;
|
|
349
340
|
if ("throw" === t.type) throw t.arg;
|
|
350
341
|
return this.rval;
|
|
@@ -363,10 +354,10 @@ function _regeneratorRuntime() {
|
|
|
363
354
|
var c = n.call(i, "catchLoc"),
|
|
364
355
|
u = n.call(i, "finallyLoc");
|
|
365
356
|
if (c && u) {
|
|
366
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc,
|
|
357
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
367
358
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
368
359
|
} else if (c) {
|
|
369
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc,
|
|
360
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
370
361
|
} else {
|
|
371
362
|
if (!u) throw Error("try statement without catch or finally");
|
|
372
363
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
@@ -422,13 +413,10 @@ function _regeneratorRuntime() {
|
|
|
422
413
|
function _slicedToArray(r, e) {
|
|
423
414
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
424
415
|
}
|
|
425
|
-
function _toConsumableArray(r) {
|
|
426
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
427
|
-
}
|
|
428
416
|
function _toPrimitive(t, r) {
|
|
429
417
|
if ("object" != typeof t || !t) return t;
|
|
430
418
|
var e = t[Symbol.toPrimitive];
|
|
431
|
-
if (
|
|
419
|
+
if (undefined !== e) {
|
|
432
420
|
var i = e.call(t, r || "default");
|
|
433
421
|
if ("object" != typeof i) return i;
|
|
434
422
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
@@ -452,7 +440,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
452
440
|
if (r) {
|
|
453
441
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
454
442
|
var t = {}.toString.call(r).slice(8, -1);
|
|
455
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) :
|
|
443
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : undefined;
|
|
456
444
|
}
|
|
457
445
|
}
|
|
458
446
|
|
|
@@ -713,7 +701,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
713
701
|
_context.next = 16;
|
|
714
702
|
break;
|
|
715
703
|
case 8:
|
|
716
|
-
if (!((_this$_api = this._api) !== null && _this$_api !==
|
|
704
|
+
if (!((_this$_api = this._api) !== null && _this$_api !== undefined)) {
|
|
717
705
|
_context.next = 12;
|
|
718
706
|
break;
|
|
719
707
|
}
|
|
@@ -778,18 +766,20 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
778
766
|
}, {
|
|
779
767
|
key: "callTxMethod",
|
|
780
768
|
value: function callTxMethod(_ref) {
|
|
781
|
-
var _this$api$tx$
|
|
769
|
+
var _this$api$tx$moduleLo;
|
|
782
770
|
var module = _ref.module,
|
|
783
771
|
section = _ref.section,
|
|
784
772
|
parameters = _ref.parameters;
|
|
785
773
|
var values = Object.values(parameters);
|
|
786
774
|
var moduleLowerCase = lowercaseFirstLetter(module);
|
|
787
775
|
var sectionCamelCase = snakeToCamel(section);
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
776
|
+
return (_this$api$tx$moduleLo = this.api.tx[moduleLowerCase])[sectionCamelCase].apply(_this$api$tx$moduleLo, values);
|
|
777
|
+
}
|
|
778
|
+
}, {
|
|
779
|
+
key: "callBatchMethod",
|
|
780
|
+
value: function callBatchMethod(calls, mode) {
|
|
781
|
+
var section = mode === BatchMode.BATCH_ALL ? 'batchAll' : 'batch';
|
|
782
|
+
return this.api.tx.utility[section](calls);
|
|
793
783
|
}
|
|
794
784
|
}, {
|
|
795
785
|
key: "calculateTransactionFee",
|
|
@@ -1018,7 +1008,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1018
1008
|
var assetItem = _ref3$0$args[1];
|
|
1019
1009
|
_ref3[1];
|
|
1020
1010
|
var assetSymbol = assetItem.toString().toLowerCase();
|
|
1021
|
-
return assetSymbol === ((_asset$symbol = asset.symbol) === null || _asset$symbol ===
|
|
1011
|
+
return assetSymbol === ((_asset$symbol = asset.symbol) === null || _asset$symbol === undefined ? undefined : _asset$symbol.toLowerCase()) || isForeignAsset(asset) && assetSymbol === ((_asset$assetId = asset.assetId) === null || _asset$assetId === undefined ? undefined : _asset$assetId.toLowerCase()) || Object.values((_assetItem$toHuman = assetItem.toHuman()) !== null && _assetItem$toHuman !== undefined ? _assetItem$toHuman : {}).toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === undefined ? undefined : _asset$symbol2.toLowerCase()) || isForeignAsset(asset) && Object.values((_assetItem$toHuman2 = assetItem.toHuman()) !== null && _assetItem$toHuman2 !== undefined ? _assetItem$toHuman2 : {}).toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === undefined ? undefined : _asset$assetId2.toLowerCase());
|
|
1022
1012
|
});
|
|
1023
1013
|
accountData = entry ? entry[1] : null;
|
|
1024
1014
|
return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
@@ -1181,22 +1171,31 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1181
1171
|
key: "disconnect",
|
|
1182
1172
|
value: function () {
|
|
1183
1173
|
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1174
|
+
var force,
|
|
1175
|
+
_args16 = arguments;
|
|
1184
1176
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1185
1177
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1186
1178
|
case 0:
|
|
1187
|
-
|
|
1188
|
-
|
|
1179
|
+
force = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : false;
|
|
1180
|
+
if (this.initialized) {
|
|
1181
|
+
_context16.next = 3;
|
|
1189
1182
|
break;
|
|
1190
1183
|
}
|
|
1191
|
-
return _context16.abrupt("return");
|
|
1192
|
-
case
|
|
1193
|
-
if (!(
|
|
1184
|
+
return _context16.abrupt("return", Promise.resolve());
|
|
1185
|
+
case 3:
|
|
1186
|
+
if (!(!force && !this.disconnectAllowed)) {
|
|
1194
1187
|
_context16.next = 5;
|
|
1195
1188
|
break;
|
|
1196
1189
|
}
|
|
1197
|
-
_context16.
|
|
1198
|
-
return this.api.disconnect();
|
|
1190
|
+
return _context16.abrupt("return");
|
|
1199
1191
|
case 5:
|
|
1192
|
+
if (!(force || typeof this._api === 'string' || this._api === undefined)) {
|
|
1193
|
+
_context16.next = 8;
|
|
1194
|
+
break;
|
|
1195
|
+
}
|
|
1196
|
+
_context16.next = 8;
|
|
1197
|
+
return this.api.disconnect();
|
|
1198
|
+
case 8:
|
|
1200
1199
|
case "end":
|
|
1201
1200
|
return _context16.stop();
|
|
1202
1201
|
}
|
|
@@ -1441,13 +1440,13 @@ var EvmBuilderClass = /*#__PURE__*/function () {
|
|
|
1441
1440
|
_context.next = 19;
|
|
1442
1441
|
break;
|
|
1443
1442
|
}
|
|
1444
|
-
_context.t1 = _yield$transferEthToP2 ===
|
|
1443
|
+
_context.t1 = _yield$transferEthToP2 === undefined;
|
|
1445
1444
|
case 19:
|
|
1446
1445
|
if (!_context.t1) {
|
|
1447
1446
|
_context.next = 23;
|
|
1448
1447
|
break;
|
|
1449
1448
|
}
|
|
1450
|
-
_context.t3 =
|
|
1449
|
+
_context.t3 = undefined;
|
|
1451
1450
|
_context.next = 24;
|
|
1452
1451
|
break;
|
|
1453
1452
|
case 23:
|
|
@@ -1459,7 +1458,7 @@ var EvmBuilderClass = /*#__PURE__*/function () {
|
|
|
1459
1458
|
_context.next = 28;
|
|
1460
1459
|
break;
|
|
1461
1460
|
}
|
|
1462
|
-
_context.t0 = _yield$transferEthToP !==
|
|
1461
|
+
_context.t0 = _yield$transferEthToP !== undefined;
|
|
1463
1462
|
case 28:
|
|
1464
1463
|
if (!_context.t0) {
|
|
1465
1464
|
_context.next = 32;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@snowbridge/api": "^0.1.
|
|
27
|
-
"ethers": "^6.13.
|
|
28
|
-
"viem": "^2.
|
|
29
|
-
"@paraspell/sdk-core": "8.0
|
|
26
|
+
"@snowbridge/api": "^0.1.28",
|
|
27
|
+
"ethers": "^6.13.5",
|
|
28
|
+
"viem": "^2.22.13",
|
|
29
|
+
"@paraspell/sdk-core": "8.2.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@polkadot/api": ">= 15.0 < 16",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@babel/plugin-syntax-import-attributes": "^7.26.0",
|
|
40
|
-
"@babel/preset-env": "^7.26.
|
|
41
|
-
"@codecov/rollup-plugin": "^1.
|
|
40
|
+
"@babel/preset-env": "^7.26.7",
|
|
41
|
+
"@codecov/rollup-plugin": "^1.8.0",
|
|
42
42
|
"@rollup/plugin-babel": "^6.0.4",
|
|
43
43
|
"@rollup/plugin-json": "^6.1.0",
|
|
44
44
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
45
|
-
"@vitest/coverage-v8": "^
|
|
45
|
+
"@vitest/coverage-v8": "^3.0.4",
|
|
46
46
|
"axios": "^1.7.9",
|
|
47
47
|
"dotenv": "^16.4.7",
|
|
48
48
|
"prettier": "^3.4.2",
|
|
49
|
-
"rollup": "^4.
|
|
49
|
+
"rollup": "^4.32.0",
|
|
50
50
|
"rollup-plugin-dts": "^6.1.1",
|
|
51
51
|
"tslib": "^2.8.1"
|
|
52
52
|
},
|