@paraspell/sdk 10.2.0 → 10.3.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/dist/index.cjs +334 -567
- package/dist/index.d.ts +6 -4
- package/dist/index.mjs +333 -568
- package/package.json +11 -13
package/dist/index.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var sdkCore = require('@paraspell/sdk-core');
|
|
4
4
|
var blake2 = require('@noble/hashes/blake2');
|
|
5
5
|
var utils = require('@noble/hashes/utils');
|
|
6
|
-
var ethers = require('ethers');
|
|
7
6
|
var polkadotApi = require('polkadot-api');
|
|
8
7
|
var polkadotSdkCompat = require('polkadot-api/polkadot-sdk-compat');
|
|
8
|
+
var viem = require('viem');
|
|
9
9
|
|
|
10
10
|
function _arrayLikeToArray(r, a) {
|
|
11
11
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -167,274 +167,115 @@ function _objectSpread2(e) {
|
|
|
167
167
|
}
|
|
168
168
|
return e;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
function h(r, e, n, o) {
|
|
198
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
199
|
-
a = Object.create(i.prototype);
|
|
200
|
-
return c(a, "_invoke", function (r, e, n) {
|
|
201
|
-
var o = 1;
|
|
202
|
-
return function (i, a) {
|
|
203
|
-
if (3 === o) throw Error("Generator is already running");
|
|
204
|
-
if (4 === o) {
|
|
205
|
-
if ("throw" === i) throw a;
|
|
206
|
-
return {
|
|
207
|
-
value: t,
|
|
208
|
-
done: true
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
for (n.method = i, n.arg = a;;) {
|
|
212
|
-
var u = n.delegate;
|
|
213
|
-
if (u) {
|
|
214
|
-
var c = d(u, n);
|
|
215
|
-
if (c) {
|
|
216
|
-
if (c === f) continue;
|
|
217
|
-
return c;
|
|
218
|
-
}
|
|
170
|
+
function _regenerator() {
|
|
171
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
172
|
+
var e,
|
|
173
|
+
t,
|
|
174
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
175
|
+
n = r.iterator || "@@iterator",
|
|
176
|
+
o = r.toStringTag || "@@toStringTag";
|
|
177
|
+
function i(r, n, o, i) {
|
|
178
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
179
|
+
u = Object.create(c.prototype);
|
|
180
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
181
|
+
var i,
|
|
182
|
+
c,
|
|
183
|
+
u,
|
|
184
|
+
f = 0,
|
|
185
|
+
p = o || [],
|
|
186
|
+
y = false,
|
|
187
|
+
G = {
|
|
188
|
+
p: 0,
|
|
189
|
+
n: 0,
|
|
190
|
+
v: e,
|
|
191
|
+
a: d,
|
|
192
|
+
f: d.bind(e, 4),
|
|
193
|
+
d: function (t, r) {
|
|
194
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
219
195
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
196
|
+
};
|
|
197
|
+
function d(r, n) {
|
|
198
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
199
|
+
var o,
|
|
200
|
+
i = p[t],
|
|
201
|
+
d = G.p,
|
|
202
|
+
l = i[2];
|
|
203
|
+
r > 3 ? (o = l === n) && (c = i[4] || 3, u = i[5] === e ? i[3] : i[5], i[4] = 3, i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
204
|
+
}
|
|
205
|
+
if (o || r > 1) return a;
|
|
206
|
+
throw y = true, n;
|
|
207
|
+
}
|
|
208
|
+
return function (o, p, l) {
|
|
209
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
210
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
211
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
212
|
+
try {
|
|
213
|
+
if (f = 2, i) {
|
|
214
|
+
if (c || (o = "next"), t = i[o]) {
|
|
215
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
216
|
+
if (!t.done) return t;
|
|
217
|
+
u = t.value, c < 2 && (c = 0);
|
|
218
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
219
|
+
i = e;
|
|
220
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
221
|
+
} catch (t) {
|
|
222
|
+
i = e, c = 1, u = t;
|
|
223
|
+
} finally {
|
|
224
|
+
f = 1;
|
|
232
225
|
}
|
|
233
|
-
"throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
|
|
234
226
|
}
|
|
227
|
+
return {
|
|
228
|
+
value: t,
|
|
229
|
+
done: y
|
|
230
|
+
};
|
|
235
231
|
};
|
|
236
|
-
}(r,
|
|
237
|
-
}
|
|
238
|
-
function s(t, r, e) {
|
|
239
|
-
try {
|
|
240
|
-
return {
|
|
241
|
-
type: "normal",
|
|
242
|
-
arg: t.call(r, e)
|
|
243
|
-
};
|
|
244
|
-
} catch (t) {
|
|
245
|
-
return {
|
|
246
|
-
type: "throw",
|
|
247
|
-
arg: t
|
|
248
|
-
};
|
|
249
|
-
}
|
|
232
|
+
}(r, o, i), true), u;
|
|
250
233
|
}
|
|
251
|
-
|
|
252
|
-
var f = {};
|
|
234
|
+
var a = {};
|
|
253
235
|
function Generator() {}
|
|
254
236
|
function GeneratorFunction() {}
|
|
255
237
|
function GeneratorFunctionPrototype() {}
|
|
256
|
-
|
|
257
|
-
c(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
|
|
264
|
-
function g(t) {
|
|
265
|
-
["next", "throw", "return"].forEach(function (r) {
|
|
266
|
-
c(t, r, function (t) {
|
|
267
|
-
return this._invoke(r, t);
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
function AsyncIterator(t, r) {
|
|
272
|
-
function e(o, i, a, u) {
|
|
273
|
-
var c = s(t[o], t, i);
|
|
274
|
-
if ("throw" !== c.type) {
|
|
275
|
-
var h = c.arg,
|
|
276
|
-
f = h.value;
|
|
277
|
-
return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
|
|
278
|
-
e("next", t, a, u);
|
|
279
|
-
}, function (t) {
|
|
280
|
-
e("throw", t, a, u);
|
|
281
|
-
}) : r.resolve(f).then(function (t) {
|
|
282
|
-
h.value = t, a(h);
|
|
283
|
-
}, function (t) {
|
|
284
|
-
return e("throw", t, a, u);
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
u(c.arg);
|
|
288
|
-
}
|
|
289
|
-
var o;
|
|
290
|
-
c(this, "_invoke", function (t, n) {
|
|
291
|
-
function i() {
|
|
292
|
-
return new r(function (r, o) {
|
|
293
|
-
e(t, n, r, o);
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
return o = o ? o.then(i, i) : i();
|
|
297
|
-
}, true);
|
|
298
|
-
}
|
|
299
|
-
function d(r, e) {
|
|
300
|
-
var n = e.method,
|
|
301
|
-
o = r.i[n];
|
|
302
|
-
if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f;
|
|
303
|
-
var i = s(o, r.i, e.arg);
|
|
304
|
-
if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
|
|
305
|
-
var a = i.arg;
|
|
306
|
-
return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f);
|
|
307
|
-
}
|
|
308
|
-
function w(t) {
|
|
309
|
-
this.tryEntries.push(t);
|
|
310
|
-
}
|
|
311
|
-
function m(r) {
|
|
312
|
-
var e = r[4] || {};
|
|
313
|
-
e.type = "normal", e.arg = t, r[4] = e;
|
|
314
|
-
}
|
|
315
|
-
function Context(t) {
|
|
316
|
-
this.tryEntries = [[-1]], t.forEach(w, this), this.reset(true);
|
|
238
|
+
t = Object.getPrototypeOf;
|
|
239
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
240
|
+
return this;
|
|
241
|
+
}), t),
|
|
242
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
243
|
+
function f(e) {
|
|
244
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
317
245
|
}
|
|
318
|
-
function
|
|
319
|
-
if (null != r) {
|
|
320
|
-
var e = r[i];
|
|
321
|
-
if (e) return e.call(r);
|
|
322
|
-
if ("function" == typeof r.next) return r;
|
|
323
|
-
if (!isNaN(r.length)) {
|
|
324
|
-
var o = -1,
|
|
325
|
-
a = function e() {
|
|
326
|
-
for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = false, e;
|
|
327
|
-
return e.value = t, e.done = true, e;
|
|
328
|
-
};
|
|
329
|
-
return a.next = a;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
throw new TypeError(typeof r + " is not iterable");
|
|
333
|
-
}
|
|
334
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) {
|
|
335
|
-
var r = "function" == typeof t && t.constructor;
|
|
336
|
-
return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
|
|
337
|
-
}, r.mark = function (t) {
|
|
338
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
|
|
339
|
-
}, r.awrap = function (t) {
|
|
340
|
-
return {
|
|
341
|
-
__await: t
|
|
342
|
-
};
|
|
343
|
-
}, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
|
|
344
|
-
return this;
|
|
345
|
-
}), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
|
|
346
|
-
void 0 === i && (i = Promise);
|
|
347
|
-
var a = new AsyncIterator(h(t, e, n, o), i);
|
|
348
|
-
return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
|
|
349
|
-
return t.done ? t.value : a.next();
|
|
350
|
-
});
|
|
351
|
-
}, g(v), c(v, u, "Generator"), c(v, i, function () {
|
|
246
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
352
247
|
return this;
|
|
353
|
-
}),
|
|
248
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
354
249
|
return "[object Generator]";
|
|
355
|
-
}),
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
return function t() {
|
|
360
|
-
for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = false, t;
|
|
361
|
-
return t.done = true, t;
|
|
250
|
+
}), (_regenerator = function () {
|
|
251
|
+
return {
|
|
252
|
+
w: i,
|
|
253
|
+
m: f
|
|
362
254
|
};
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
u = this.prev,
|
|
384
|
-
c = i[1],
|
|
385
|
-
h = i[2];
|
|
386
|
-
if (-1 === i[0]) return n("end"), false;
|
|
387
|
-
if (!c && !h) throw Error("try statement without catch or finally");
|
|
388
|
-
if (null != i[0] && i[0] <= u) {
|
|
389
|
-
if (u < c) return this.method = "next", this.arg = t, n(c), true;
|
|
390
|
-
if (u < h) return n(h), false;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
},
|
|
394
|
-
abrupt: function (t, r) {
|
|
395
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
396
|
-
var n = this.tryEntries[e];
|
|
397
|
-
if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
|
|
398
|
-
var o = n;
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
|
|
403
|
-
var i = o ? o[4] : {};
|
|
404
|
-
return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
|
|
405
|
-
},
|
|
406
|
-
complete: function (t, r) {
|
|
407
|
-
if ("throw" === t.type) throw t.arg;
|
|
408
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f;
|
|
409
|
-
},
|
|
410
|
-
finish: function (t) {
|
|
411
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
412
|
-
var e = this.tryEntries[r];
|
|
413
|
-
if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
|
|
414
|
-
}
|
|
415
|
-
},
|
|
416
|
-
catch: function (t) {
|
|
417
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
418
|
-
var e = this.tryEntries[r];
|
|
419
|
-
if (e[0] === t) {
|
|
420
|
-
var n = e[4];
|
|
421
|
-
if ("throw" === n.type) {
|
|
422
|
-
var o = n.arg;
|
|
423
|
-
m(e);
|
|
424
|
-
}
|
|
425
|
-
return o;
|
|
426
|
-
}
|
|
255
|
+
})();
|
|
256
|
+
}
|
|
257
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
258
|
+
var i = Object.defineProperty;
|
|
259
|
+
try {
|
|
260
|
+
i({}, "", {});
|
|
261
|
+
} catch (e) {
|
|
262
|
+
i = 0;
|
|
263
|
+
}
|
|
264
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
265
|
+
if (r) i ? i(e, r, {
|
|
266
|
+
value: n,
|
|
267
|
+
enumerable: !t,
|
|
268
|
+
configurable: !t,
|
|
269
|
+
writable: !t
|
|
270
|
+
}) : e[r] = n;else {
|
|
271
|
+
function o(r, n) {
|
|
272
|
+
_regeneratorDefine(e, r, function (e) {
|
|
273
|
+
return this._invoke(r, n, e);
|
|
274
|
+
});
|
|
427
275
|
}
|
|
428
|
-
|
|
429
|
-
},
|
|
430
|
-
delegateYield: function (r, e, n) {
|
|
431
|
-
return this.delegate = {
|
|
432
|
-
i: x(r),
|
|
433
|
-
r: e,
|
|
434
|
-
n: n
|
|
435
|
-
}, "next" === this.method && (this.arg = t), f;
|
|
276
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
436
277
|
}
|
|
437
|
-
}, r;
|
|
278
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
438
279
|
}
|
|
439
280
|
function _slicedToArray(r, e) {
|
|
440
281
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
@@ -657,24 +498,23 @@ function createClientCache(maxSize, onEviction) {
|
|
|
657
498
|
if (!w.extended && w.value.refs > 0) {
|
|
658
499
|
// first expiry while still in use - Extend grace period
|
|
659
500
|
// Call rpc.properties to keep the connection alive
|
|
660
|
-
void _asyncToGenerator(/*#__PURE__*/
|
|
661
|
-
return
|
|
662
|
-
while (1) switch (_context.
|
|
501
|
+
void _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
502
|
+
return _regenerator().w(function (_context) {
|
|
503
|
+
while (1) switch (_context.n) {
|
|
663
504
|
case 0:
|
|
664
|
-
_context.
|
|
665
|
-
_context.
|
|
505
|
+
_context.p = 0;
|
|
506
|
+
_context.n = 1;
|
|
666
507
|
return w.value.client.getChainSpecData();
|
|
667
|
-
case
|
|
668
|
-
_context.
|
|
508
|
+
case 1:
|
|
509
|
+
_context.n = 3;
|
|
669
510
|
break;
|
|
670
|
-
case
|
|
671
|
-
_context.
|
|
672
|
-
_context.
|
|
673
|
-
case
|
|
674
|
-
|
|
675
|
-
return _context.stop();
|
|
511
|
+
case 2:
|
|
512
|
+
_context.p = 2;
|
|
513
|
+
_context.v;
|
|
514
|
+
case 3:
|
|
515
|
+
return _context.a(2);
|
|
676
516
|
}
|
|
677
|
-
}, _callee, null, [[0,
|
|
517
|
+
}, _callee, null, [[0, 2]]);
|
|
678
518
|
}))();
|
|
679
519
|
w.value.destroyWanted = true;
|
|
680
520
|
w.extended = true;
|
|
@@ -814,35 +654,32 @@ var keyFromWs = function keyFromWs(ws) {
|
|
|
814
654
|
return Array.isArray(ws) ? JSON.stringify(ws) : ws;
|
|
815
655
|
};
|
|
816
656
|
var createPolkadotClient = /*#__PURE__*/function () {
|
|
817
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
818
|
-
var isNodeJs, _ref2, getWsProvider, provider;
|
|
819
|
-
return
|
|
820
|
-
while (1) switch (_context.
|
|
657
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(ws) {
|
|
658
|
+
var isNodeJs, _ref2, getWsProvider, provider, _t;
|
|
659
|
+
return _regenerator().w(function (_context) {
|
|
660
|
+
while (1) switch (_context.n) {
|
|
821
661
|
case 0:
|
|
822
662
|
isNodeJs = typeof window === 'undefined';
|
|
823
663
|
if (!isNodeJs) {
|
|
824
|
-
_context.
|
|
664
|
+
_context.n = 2;
|
|
825
665
|
break;
|
|
826
666
|
}
|
|
827
|
-
_context.
|
|
667
|
+
_context.n = 1;
|
|
828
668
|
return import('polkadot-api/ws-provider/node');
|
|
829
|
-
case
|
|
830
|
-
|
|
831
|
-
_context.
|
|
669
|
+
case 1:
|
|
670
|
+
_t = _context.v;
|
|
671
|
+
_context.n = 4;
|
|
832
672
|
break;
|
|
833
|
-
case
|
|
834
|
-
_context.
|
|
673
|
+
case 2:
|
|
674
|
+
_context.n = 3;
|
|
835
675
|
return import('polkadot-api/ws-provider/web');
|
|
836
|
-
case
|
|
837
|
-
|
|
838
|
-
case
|
|
839
|
-
_ref2 =
|
|
676
|
+
case 3:
|
|
677
|
+
_t = _context.v;
|
|
678
|
+
case 4:
|
|
679
|
+
_ref2 = _t;
|
|
840
680
|
getWsProvider = _ref2.getWsProvider;
|
|
841
681
|
provider = Array.isArray(ws) ? getWsProvider(ws) : getWsProvider(ws);
|
|
842
|
-
return _context.
|
|
843
|
-
case 14:
|
|
844
|
-
case "end":
|
|
845
|
-
return _context.stop();
|
|
682
|
+
return _context.a(2, polkadotApi.createClient(polkadotSdkCompat.withPolkadotSdkCompat(provider)));
|
|
846
683
|
}
|
|
847
684
|
}, _callee);
|
|
848
685
|
}));
|
|
@@ -851,35 +688,32 @@ var createPolkadotClient = /*#__PURE__*/function () {
|
|
|
851
688
|
};
|
|
852
689
|
}();
|
|
853
690
|
var leasePolkadotClient = /*#__PURE__*/function () {
|
|
854
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/
|
|
855
|
-
var key, entry;
|
|
856
|
-
return
|
|
857
|
-
while (1) switch (_context2.
|
|
691
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(ws, ttlMs) {
|
|
692
|
+
var key, entry, _t2;
|
|
693
|
+
return _regenerator().w(function (_context2) {
|
|
694
|
+
while (1) switch (_context2.n) {
|
|
858
695
|
case 0:
|
|
859
696
|
key = keyFromWs(ws);
|
|
860
697
|
entry = clientPool.peek(key);
|
|
861
698
|
if (entry) {
|
|
862
|
-
_context2.
|
|
699
|
+
_context2.n = 2;
|
|
863
700
|
break;
|
|
864
701
|
}
|
|
865
|
-
_context2.
|
|
702
|
+
_context2.n = 1;
|
|
866
703
|
return createPolkadotClient(ws);
|
|
867
|
-
case
|
|
868
|
-
|
|
704
|
+
case 1:
|
|
705
|
+
_t2 = _context2.v;
|
|
869
706
|
entry = {
|
|
870
|
-
client:
|
|
707
|
+
client: _t2,
|
|
871
708
|
refs: 0,
|
|
872
709
|
destroyWanted: false
|
|
873
710
|
};
|
|
874
711
|
clientPool.set(key, entry, ttlMs);
|
|
875
|
-
case
|
|
712
|
+
case 2:
|
|
876
713
|
entry.refs += 1;
|
|
877
714
|
clientPool.revive(key, ttlMs);
|
|
878
715
|
entry.destroyWanted = false;
|
|
879
|
-
return _context2.
|
|
880
|
-
case 12:
|
|
881
|
-
case "end":
|
|
882
|
-
return _context2.stop();
|
|
716
|
+
return _context2.a(2, entry.client);
|
|
883
717
|
}
|
|
884
718
|
}, _callee2);
|
|
885
719
|
}));
|
|
@@ -898,7 +732,7 @@ var releasePolkadotClient = function releasePolkadotClient(ws) {
|
|
|
898
732
|
clientPool["delete"](key);
|
|
899
733
|
}
|
|
900
734
|
};
|
|
901
|
-
var unsupportedNodes = ['ComposableFinance', 'Interlay', 'CrustShadow', 'Kintsugi', 'RobonomicsKusama', '
|
|
735
|
+
var unsupportedNodes = ['ComposableFinance', 'Interlay', 'CrustShadow', 'Kintsugi', 'RobonomicsKusama', 'Pendulum', 'Subsocial'];
|
|
902
736
|
var isHex = function isHex(str) {
|
|
903
737
|
return typeof str === 'string' && /^0x[0-9a-fA-F]+$/.test(str);
|
|
904
738
|
};
|
|
@@ -927,58 +761,58 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
927
761
|
}, {
|
|
928
762
|
key: "init",
|
|
929
763
|
value: function () {
|
|
930
|
-
var _init = _asyncToGenerator(/*#__PURE__*/
|
|
764
|
+
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(node) {
|
|
931
765
|
var clientTtlMs,
|
|
932
766
|
_this$_api,
|
|
933
|
-
_args3 = arguments
|
|
934
|
-
|
|
935
|
-
|
|
767
|
+
_args3 = arguments,
|
|
768
|
+
_t3;
|
|
769
|
+
return _regenerator().w(function (_context3) {
|
|
770
|
+
while (1) switch (_context3.n) {
|
|
936
771
|
case 0:
|
|
937
772
|
clientTtlMs = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : DEFAULT_TTL_MS;
|
|
938
773
|
if (!this.initialized) {
|
|
939
|
-
_context3.
|
|
774
|
+
_context3.n = 1;
|
|
940
775
|
break;
|
|
941
776
|
}
|
|
942
|
-
return _context3.
|
|
943
|
-
case
|
|
777
|
+
return _context3.a(2);
|
|
778
|
+
case 1:
|
|
944
779
|
if (!unsupportedNodes.includes(node)) {
|
|
945
|
-
_context3.
|
|
780
|
+
_context3.n = 2;
|
|
946
781
|
break;
|
|
947
782
|
}
|
|
948
783
|
throw new sdkCore.NodeNotSupportedError("The node ".concat(node, " is not yet supported by the Polkadot API."));
|
|
949
|
-
case
|
|
784
|
+
case 2:
|
|
950
785
|
this._ttlMs = clientTtlMs;
|
|
951
786
|
if (!(typeof this._api === 'string' || this._api instanceof Array)) {
|
|
952
|
-
_context3.
|
|
787
|
+
_context3.n = 4;
|
|
953
788
|
break;
|
|
954
789
|
}
|
|
955
|
-
_context3.
|
|
790
|
+
_context3.n = 3;
|
|
956
791
|
return this.createApiInstance(this._api);
|
|
957
|
-
case
|
|
958
|
-
this.api = _context3.
|
|
959
|
-
_context3.
|
|
792
|
+
case 3:
|
|
793
|
+
this.api = _context3.v;
|
|
794
|
+
_context3.n = 8;
|
|
960
795
|
break;
|
|
961
|
-
case
|
|
796
|
+
case 4:
|
|
962
797
|
if (!((_this$_api = this._api) !== null && _this$_api !== void 0)) {
|
|
963
|
-
_context3.
|
|
798
|
+
_context3.n = 5;
|
|
964
799
|
break;
|
|
965
800
|
}
|
|
966
|
-
|
|
967
|
-
_context3.
|
|
801
|
+
_t3 = _this$_api;
|
|
802
|
+
_context3.n = 7;
|
|
968
803
|
break;
|
|
969
|
-
case
|
|
970
|
-
_context3.
|
|
804
|
+
case 5:
|
|
805
|
+
_context3.n = 6;
|
|
971
806
|
return sdkCore.createApiInstanceForNode(this, node);
|
|
972
|
-
case
|
|
973
|
-
|
|
974
|
-
case
|
|
975
|
-
this.api =
|
|
976
|
-
case
|
|
807
|
+
case 6:
|
|
808
|
+
_t3 = _context3.v;
|
|
809
|
+
case 7:
|
|
810
|
+
this.api = _t3;
|
|
811
|
+
case 8:
|
|
977
812
|
this._node = node;
|
|
978
813
|
this.initialized = true;
|
|
979
|
-
case
|
|
980
|
-
|
|
981
|
-
return _context3.stop();
|
|
814
|
+
case 9:
|
|
815
|
+
return _context3.a(2);
|
|
982
816
|
}
|
|
983
817
|
}, _callee3, this);
|
|
984
818
|
}));
|
|
@@ -990,14 +824,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
990
824
|
}, {
|
|
991
825
|
key: "createApiInstance",
|
|
992
826
|
value: function () {
|
|
993
|
-
var _createApiInstance = _asyncToGenerator(/*#__PURE__*/
|
|
994
|
-
return
|
|
995
|
-
while (1) switch (_context4.
|
|
827
|
+
var _createApiInstance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(wsUrl) {
|
|
828
|
+
return _regenerator().w(function (_context4) {
|
|
829
|
+
while (1) switch (_context4.n) {
|
|
996
830
|
case 0:
|
|
997
|
-
return _context4.
|
|
998
|
-
case 1:
|
|
999
|
-
case "end":
|
|
1000
|
-
return _context4.stop();
|
|
831
|
+
return _context4.a(2, leasePolkadotClient(wsUrl, this._ttlMs));
|
|
1001
832
|
}
|
|
1002
833
|
}, _callee4, this);
|
|
1003
834
|
}));
|
|
@@ -1045,10 +876,10 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1045
876
|
}, {
|
|
1046
877
|
key: "objectToHex",
|
|
1047
878
|
value: function () {
|
|
1048
|
-
var _objectToHex = _asyncToGenerator(/*#__PURE__*/
|
|
879
|
+
var _objectToHex = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(obj) {
|
|
1049
880
|
var transformedObj, tx, removeFirst5Bytes, encodedData;
|
|
1050
|
-
return
|
|
1051
|
-
while (1) switch (_context5.
|
|
881
|
+
return _regenerator().w(function (_context5) {
|
|
882
|
+
while (1) switch (_context5.n) {
|
|
1052
883
|
case 0:
|
|
1053
884
|
transformedObj = _transform(obj);
|
|
1054
885
|
tx = this.api.getUnsafeApi().tx.PolkadotXcm.send({
|
|
@@ -1066,14 +897,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1066
897
|
removeFirst5Bytes = function removeFirst5Bytes(hexString) {
|
|
1067
898
|
return '0x' + hexString.slice(12);
|
|
1068
899
|
};
|
|
1069
|
-
_context5.
|
|
900
|
+
_context5.n = 1;
|
|
1070
901
|
return tx.getEncodedData();
|
|
1071
|
-
case
|
|
1072
|
-
encodedData = _context5.
|
|
1073
|
-
return _context5.
|
|
1074
|
-
case 7:
|
|
1075
|
-
case "end":
|
|
1076
|
-
return _context5.stop();
|
|
902
|
+
case 1:
|
|
903
|
+
encodedData = _context5.v;
|
|
904
|
+
return _context5.a(2, removeFirst5Bytes(encodedData.asHex()));
|
|
1077
905
|
}
|
|
1078
906
|
}, _callee5, this);
|
|
1079
907
|
}));
|
|
@@ -1107,14 +935,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1107
935
|
}, {
|
|
1108
936
|
key: "calculateTransactionFee",
|
|
1109
937
|
value: function () {
|
|
1110
|
-
var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/
|
|
1111
|
-
return
|
|
1112
|
-
while (1) switch (_context6.
|
|
938
|
+
var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(tx, address) {
|
|
939
|
+
return _regenerator().w(function (_context6) {
|
|
940
|
+
while (1) switch (_context6.n) {
|
|
1113
941
|
case 0:
|
|
1114
|
-
return _context6.
|
|
1115
|
-
case 1:
|
|
1116
|
-
case "end":
|
|
1117
|
-
return _context6.stop();
|
|
942
|
+
return _context6.a(2, tx.getEstimatedFees(address));
|
|
1118
943
|
}
|
|
1119
944
|
}, _callee6);
|
|
1120
945
|
}));
|
|
@@ -1126,26 +951,23 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1126
951
|
}, {
|
|
1127
952
|
key: "quoteAhPrice",
|
|
1128
953
|
value: function () {
|
|
1129
|
-
var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/
|
|
954
|
+
var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(fromMl, toMl, amountIn) {
|
|
1130
955
|
var includeFee,
|
|
1131
956
|
transformedFromMl,
|
|
1132
957
|
transformedToMl,
|
|
1133
958
|
response,
|
|
1134
959
|
_args7 = arguments;
|
|
1135
|
-
return
|
|
1136
|
-
while (1) switch (_context7.
|
|
960
|
+
return _regenerator().w(function (_context7) {
|
|
961
|
+
while (1) switch (_context7.n) {
|
|
1137
962
|
case 0:
|
|
1138
963
|
includeFee = _args7.length > 3 && _args7[3] !== undefined ? _args7[3] : true;
|
|
1139
964
|
transformedFromMl = _transform(fromMl);
|
|
1140
965
|
transformedToMl = _transform(toMl);
|
|
1141
|
-
_context7.
|
|
966
|
+
_context7.n = 1;
|
|
1142
967
|
return this.api.getUnsafeApi().apis.AssetConversionApi.quote_price_exact_tokens_for_tokens(transformedFromMl, transformedToMl, amountIn, includeFee);
|
|
1143
|
-
case
|
|
1144
|
-
response = _context7.
|
|
1145
|
-
return _context7.
|
|
1146
|
-
case 7:
|
|
1147
|
-
case "end":
|
|
1148
|
-
return _context7.stop();
|
|
968
|
+
case 1:
|
|
969
|
+
response = _context7.v;
|
|
970
|
+
return _context7.a(2, response ? BigInt(response) : undefined);
|
|
1149
971
|
}
|
|
1150
972
|
}, _callee7, this);
|
|
1151
973
|
}));
|
|
@@ -1157,19 +979,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1157
979
|
}, {
|
|
1158
980
|
key: "getBalanceNative",
|
|
1159
981
|
value: function () {
|
|
1160
|
-
var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/
|
|
982
|
+
var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(address) {
|
|
1161
983
|
var res;
|
|
1162
|
-
return
|
|
1163
|
-
while (1) switch (_context8.
|
|
984
|
+
return _regenerator().w(function (_context8) {
|
|
985
|
+
while (1) switch (_context8.n) {
|
|
1164
986
|
case 0:
|
|
1165
|
-
_context8.
|
|
987
|
+
_context8.n = 1;
|
|
1166
988
|
return this.api.getUnsafeApi().query.System.Account.getValue(address);
|
|
1167
|
-
case
|
|
1168
|
-
res = _context8.
|
|
1169
|
-
return _context8.
|
|
1170
|
-
case 4:
|
|
1171
|
-
case "end":
|
|
1172
|
-
return _context8.stop();
|
|
989
|
+
case 1:
|
|
990
|
+
res = _context8.v;
|
|
991
|
+
return _context8.a(2, res.data.free);
|
|
1173
992
|
}
|
|
1174
993
|
}, _callee8, this);
|
|
1175
994
|
}));
|
|
@@ -1181,19 +1000,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1181
1000
|
}, {
|
|
1182
1001
|
key: "getBalanceForeignPolkadotXcm",
|
|
1183
1002
|
value: function () {
|
|
1184
|
-
var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/
|
|
1003
|
+
var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(address, id) {
|
|
1185
1004
|
var res;
|
|
1186
|
-
return
|
|
1187
|
-
while (1) switch (_context9.
|
|
1005
|
+
return _regenerator().w(function (_context9) {
|
|
1006
|
+
while (1) switch (_context9.n) {
|
|
1188
1007
|
case 0:
|
|
1189
|
-
_context9.
|
|
1008
|
+
_context9.n = 1;
|
|
1190
1009
|
return this.api.getUnsafeApi().query.Assets.Account.getValue(id, address);
|
|
1191
|
-
case
|
|
1192
|
-
res = _context9.
|
|
1193
|
-
return _context9.
|
|
1194
|
-
case 4:
|
|
1195
|
-
case "end":
|
|
1196
|
-
return _context9.stop();
|
|
1010
|
+
case 1:
|
|
1011
|
+
res = _context9.v;
|
|
1012
|
+
return _context9.a(2, res && res.balance ? BigInt(res.balance) : 0n);
|
|
1197
1013
|
}
|
|
1198
1014
|
}, _callee9, this);
|
|
1199
1015
|
}));
|
|
@@ -1205,19 +1021,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1205
1021
|
}, {
|
|
1206
1022
|
key: "getMythosForeignBalance",
|
|
1207
1023
|
value: function () {
|
|
1208
|
-
var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/
|
|
1024
|
+
var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(address) {
|
|
1209
1025
|
var res;
|
|
1210
|
-
return
|
|
1211
|
-
while (1) switch (_context0.
|
|
1026
|
+
return _regenerator().w(function (_context0) {
|
|
1027
|
+
while (1) switch (_context0.n) {
|
|
1212
1028
|
case 0:
|
|
1213
|
-
_context0.
|
|
1029
|
+
_context0.n = 1;
|
|
1214
1030
|
return this.api.getUnsafeApi().query.Balances.Account.getValue(address);
|
|
1215
|
-
case
|
|
1216
|
-
res = _context0.
|
|
1217
|
-
return _context0.
|
|
1218
|
-
case 4:
|
|
1219
|
-
case "end":
|
|
1220
|
-
return _context0.stop();
|
|
1031
|
+
case 1:
|
|
1032
|
+
res = _context0.v;
|
|
1033
|
+
return _context0.a(2, res && res.free ? BigInt(res.free) : 0n);
|
|
1221
1034
|
}
|
|
1222
1035
|
}, _callee0, this);
|
|
1223
1036
|
}));
|
|
@@ -1229,20 +1042,17 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1229
1042
|
}, {
|
|
1230
1043
|
key: "getBalanceForeignAssetsPallet",
|
|
1231
1044
|
value: function () {
|
|
1232
|
-
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/
|
|
1045
|
+
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(address, multiLocation) {
|
|
1233
1046
|
var transformedMultiLocation, res;
|
|
1234
|
-
return
|
|
1235
|
-
while (1) switch (_context1.
|
|
1047
|
+
return _regenerator().w(function (_context1) {
|
|
1048
|
+
while (1) switch (_context1.n) {
|
|
1236
1049
|
case 0:
|
|
1237
1050
|
transformedMultiLocation = _transform(multiLocation);
|
|
1238
|
-
_context1.
|
|
1051
|
+
_context1.n = 1;
|
|
1239
1052
|
return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(transformedMultiLocation, address);
|
|
1240
|
-
case
|
|
1241
|
-
res = _context1.
|
|
1242
|
-
return _context1.
|
|
1243
|
-
case 5:
|
|
1244
|
-
case "end":
|
|
1245
|
-
return _context1.stop();
|
|
1053
|
+
case 1:
|
|
1054
|
+
res = _context1.v;
|
|
1055
|
+
return _context1.a(2, BigInt(res === undefined ? 0 : res.balance));
|
|
1246
1056
|
}
|
|
1247
1057
|
}, _callee1, this);
|
|
1248
1058
|
}));
|
|
@@ -1254,19 +1064,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1254
1064
|
}, {
|
|
1255
1065
|
key: "getForeignAssetsByIdBalance",
|
|
1256
1066
|
value: function () {
|
|
1257
|
-
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/
|
|
1067
|
+
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address, assetId) {
|
|
1258
1068
|
var res;
|
|
1259
|
-
return
|
|
1260
|
-
while (1) switch (_context10.
|
|
1069
|
+
return _regenerator().w(function (_context10) {
|
|
1070
|
+
while (1) switch (_context10.n) {
|
|
1261
1071
|
case 0:
|
|
1262
|
-
_context10.
|
|
1072
|
+
_context10.n = 1;
|
|
1263
1073
|
return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(assetId, address);
|
|
1264
|
-
case
|
|
1265
|
-
res = _context10.
|
|
1266
|
-
return _context10.
|
|
1267
|
-
case 4:
|
|
1268
|
-
case "end":
|
|
1269
|
-
return _context10.stop();
|
|
1074
|
+
case 1:
|
|
1075
|
+
res = _context10.v;
|
|
1076
|
+
return _context10.a(2, BigInt(res === undefined ? 0 : res.balance));
|
|
1270
1077
|
}
|
|
1271
1078
|
}, _callee10, this);
|
|
1272
1079
|
}));
|
|
@@ -1278,22 +1085,19 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1278
1085
|
}, {
|
|
1279
1086
|
key: "getBalanceForeignBifrost",
|
|
1280
1087
|
value: function () {
|
|
1281
|
-
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/
|
|
1088
|
+
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(address, asset) {
|
|
1282
1089
|
var currencySelection, transformedParameters, response, accountData;
|
|
1283
|
-
return
|
|
1284
|
-
while (1) switch (_context11.
|
|
1090
|
+
return _regenerator().w(function (_context11) {
|
|
1091
|
+
while (1) switch (_context11.n) {
|
|
1285
1092
|
case 0:
|
|
1286
1093
|
currencySelection = sdkCore.getNode('BifrostPolkadot').getCurrencySelection(asset);
|
|
1287
1094
|
transformedParameters = _transform(currencySelection);
|
|
1288
|
-
_context11.
|
|
1095
|
+
_context11.n = 1;
|
|
1289
1096
|
return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
|
|
1290
|
-
case
|
|
1291
|
-
response = _context11.
|
|
1097
|
+
case 1:
|
|
1098
|
+
response = _context11.v;
|
|
1292
1099
|
accountData = response ? response : null;
|
|
1293
|
-
return _context11.
|
|
1294
|
-
case 7:
|
|
1295
|
-
case "end":
|
|
1296
|
-
return _context11.stop();
|
|
1100
|
+
return _context11.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
1297
1101
|
}
|
|
1298
1102
|
}, _callee11, this);
|
|
1299
1103
|
}));
|
|
@@ -1305,23 +1109,20 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1305
1109
|
}, {
|
|
1306
1110
|
key: "getBalanceNativeAcala",
|
|
1307
1111
|
value: function () {
|
|
1308
|
-
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/
|
|
1112
|
+
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(address, symbol) {
|
|
1309
1113
|
var transformedParameters, response, accountData;
|
|
1310
|
-
return
|
|
1311
|
-
while (1) switch (_context12.
|
|
1114
|
+
return _regenerator().w(function (_context12) {
|
|
1115
|
+
while (1) switch (_context12.n) {
|
|
1312
1116
|
case 0:
|
|
1313
1117
|
transformedParameters = _transform({
|
|
1314
1118
|
Token: symbol
|
|
1315
1119
|
});
|
|
1316
|
-
_context12.
|
|
1120
|
+
_context12.n = 1;
|
|
1317
1121
|
return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
|
|
1318
|
-
case
|
|
1319
|
-
response = _context12.
|
|
1122
|
+
case 1:
|
|
1123
|
+
response = _context12.v;
|
|
1320
1124
|
accountData = response ? response : null;
|
|
1321
|
-
return _context12.
|
|
1322
|
-
case 6:
|
|
1323
|
-
case "end":
|
|
1324
|
-
return _context12.stop();
|
|
1125
|
+
return _context12.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
1325
1126
|
}
|
|
1326
1127
|
}, _callee12, this);
|
|
1327
1128
|
}));
|
|
@@ -1333,19 +1134,19 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1333
1134
|
}, {
|
|
1334
1135
|
key: "getBalanceForeignXTokens",
|
|
1335
1136
|
value: function () {
|
|
1336
|
-
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/
|
|
1137
|
+
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(node, address, asset) {
|
|
1337
1138
|
var pallet, response, entry;
|
|
1338
|
-
return
|
|
1339
|
-
while (1) switch (_context13.
|
|
1139
|
+
return _regenerator().w(function (_context13) {
|
|
1140
|
+
while (1) switch (_context13.n) {
|
|
1340
1141
|
case 0:
|
|
1341
1142
|
pallet = 'Tokens';
|
|
1342
1143
|
if (node === 'Centrifuge' || node === 'Altair') {
|
|
1343
1144
|
pallet = 'OrmlTokens';
|
|
1344
1145
|
}
|
|
1345
|
-
_context13.
|
|
1146
|
+
_context13.n = 1;
|
|
1346
1147
|
return this.api.getUnsafeApi().query[pallet].Accounts.getEntries(address);
|
|
1347
|
-
case
|
|
1348
|
-
response = _context13.
|
|
1148
|
+
case 1:
|
|
1149
|
+
response = _context13.v;
|
|
1349
1150
|
entry = response.find(function (_ref5) {
|
|
1350
1151
|
var _asset$symbol, _asset$assetId, _asset$symbol2, _asset$assetId2;
|
|
1351
1152
|
var keyArgs = _ref5.keyArgs;
|
|
@@ -1354,10 +1155,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1354
1155
|
var assetItem = _keyArgs[1];
|
|
1355
1156
|
return assetItem.toString().toLowerCase() === ((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase()) || sdkCore.isForeignAsset(asset) && assetItem.toString().toLowerCase() === ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && assetItem.value.toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === void 0 ? void 0 : _asset$symbol2.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && sdkCore.isForeignAsset(asset) && assetItem.value.toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === void 0 ? void 0 : _asset$assetId2.toLowerCase());
|
|
1356
1157
|
});
|
|
1357
|
-
return _context13.
|
|
1358
|
-
case 7:
|
|
1359
|
-
case "end":
|
|
1360
|
-
return _context13.stop();
|
|
1158
|
+
return _context13.a(2, entry !== null && entry !== void 0 && entry.value ? BigInt(entry.value.free.toString()) : 0n);
|
|
1361
1159
|
}
|
|
1362
1160
|
}, _callee13, this);
|
|
1363
1161
|
}));
|
|
@@ -1369,19 +1167,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1369
1167
|
}, {
|
|
1370
1168
|
key: "getBalanceAssetsPallet",
|
|
1371
1169
|
value: function () {
|
|
1372
|
-
var _getBalanceAssetsPallet = _asyncToGenerator(/*#__PURE__*/
|
|
1170
|
+
var _getBalanceAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(address, assetId) {
|
|
1373
1171
|
var response;
|
|
1374
|
-
return
|
|
1375
|
-
while (1) switch (_context14.
|
|
1172
|
+
return _regenerator().w(function (_context14) {
|
|
1173
|
+
while (1) switch (_context14.n) {
|
|
1376
1174
|
case 0:
|
|
1377
|
-
_context14.
|
|
1175
|
+
_context14.n = 1;
|
|
1378
1176
|
return this.api.getUnsafeApi().query.Assets.Account.getValue(assetId, address);
|
|
1379
|
-
case
|
|
1380
|
-
response = _context14.
|
|
1381
|
-
return _context14.
|
|
1382
|
-
case 4:
|
|
1383
|
-
case "end":
|
|
1384
|
-
return _context14.stop();
|
|
1177
|
+
case 1:
|
|
1178
|
+
response = _context14.v;
|
|
1179
|
+
return _context14.a(2, BigInt(response === undefined ? 0 : response.balance));
|
|
1385
1180
|
}
|
|
1386
1181
|
}, _callee14, this);
|
|
1387
1182
|
}));
|
|
@@ -1393,20 +1188,17 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1393
1188
|
}, {
|
|
1394
1189
|
key: "getFromRpc",
|
|
1395
1190
|
value: function () {
|
|
1396
|
-
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/
|
|
1191
|
+
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(module, method, key) {
|
|
1397
1192
|
var toSS58, value;
|
|
1398
|
-
return
|
|
1399
|
-
while (1) switch (_context15.
|
|
1193
|
+
return _regenerator().w(function (_context15) {
|
|
1194
|
+
while (1) switch (_context15.n) {
|
|
1400
1195
|
case 0:
|
|
1401
1196
|
toSS58 = polkadotApi.AccountId().dec;
|
|
1402
|
-
_context15.
|
|
1403
|
-
return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) && !
|
|
1404
|
-
case
|
|
1405
|
-
value = _context15.
|
|
1406
|
-
return _context15.
|
|
1407
|
-
case 5:
|
|
1408
|
-
case "end":
|
|
1409
|
-
return _context15.stop();
|
|
1197
|
+
_context15.n = 1;
|
|
1198
|
+
return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) && !viem.isAddress(key) ? toSS58(key) : key]);
|
|
1199
|
+
case 1:
|
|
1200
|
+
value = _context15.v;
|
|
1201
|
+
return _context15.a(2, isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
|
|
1410
1202
|
}
|
|
1411
1203
|
}, _callee15, this);
|
|
1412
1204
|
}));
|
|
@@ -1423,19 +1215,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1423
1215
|
}, {
|
|
1424
1216
|
key: "createApiForNode",
|
|
1425
1217
|
value: function () {
|
|
1426
|
-
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/
|
|
1218
|
+
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(node) {
|
|
1427
1219
|
var api;
|
|
1428
|
-
return
|
|
1429
|
-
while (1) switch (_context16.
|
|
1220
|
+
return _regenerator().w(function (_context16) {
|
|
1221
|
+
while (1) switch (_context16.n) {
|
|
1430
1222
|
case 0:
|
|
1431
1223
|
api = new PapiApi();
|
|
1432
|
-
_context16.
|
|
1224
|
+
_context16.n = 1;
|
|
1433
1225
|
return api.init(node);
|
|
1434
|
-
case
|
|
1435
|
-
return _context16.
|
|
1436
|
-
case 4:
|
|
1437
|
-
case "end":
|
|
1438
|
-
return _context16.stop();
|
|
1226
|
+
case 1:
|
|
1227
|
+
return _context16.a(2, api);
|
|
1439
1228
|
}
|
|
1440
1229
|
}, _callee16);
|
|
1441
1230
|
}));
|
|
@@ -1447,20 +1236,20 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1447
1236
|
}, {
|
|
1448
1237
|
key: "getDryRunCall",
|
|
1449
1238
|
value: function () {
|
|
1450
|
-
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/
|
|
1239
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(_ref6) {
|
|
1451
1240
|
var _this = this;
|
|
1452
1241
|
var tx, address, node, isFeeAsset, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1453
|
-
return
|
|
1454
|
-
while (1) switch (_context18.
|
|
1242
|
+
return _regenerator().w(function (_context18) {
|
|
1243
|
+
while (1) switch (_context18.n) {
|
|
1455
1244
|
case 0:
|
|
1456
1245
|
tx = _ref6.tx, address = _ref6.address, node = _ref6.node, isFeeAsset = _ref6.isFeeAsset;
|
|
1457
1246
|
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
1458
1247
|
if (supportsDryRunApi) {
|
|
1459
|
-
_context18.
|
|
1248
|
+
_context18.n = 1;
|
|
1460
1249
|
break;
|
|
1461
1250
|
}
|
|
1462
1251
|
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
1463
|
-
case
|
|
1252
|
+
case 1:
|
|
1464
1253
|
DEFAULT_XCM_VERSION = 3;
|
|
1465
1254
|
basePayload = {
|
|
1466
1255
|
type: 'system',
|
|
@@ -1470,20 +1259,17 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1470
1259
|
}
|
|
1471
1260
|
};
|
|
1472
1261
|
performDryRunCall = /*#__PURE__*/function () {
|
|
1473
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/
|
|
1262
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(includeVersion) {
|
|
1474
1263
|
var _this$api$getUnsafeAp;
|
|
1475
1264
|
var callArgs;
|
|
1476
|
-
return
|
|
1477
|
-
while (1) switch (_context17.
|
|
1265
|
+
return _regenerator().w(function (_context17) {
|
|
1266
|
+
while (1) switch (_context17.n) {
|
|
1478
1267
|
case 0:
|
|
1479
1268
|
callArgs = [basePayload, tx.decodedCall];
|
|
1480
1269
|
if (includeVersion) {
|
|
1481
1270
|
callArgs.push(DEFAULT_XCM_VERSION);
|
|
1482
1271
|
}
|
|
1483
|
-
return _context17.
|
|
1484
|
-
case 3:
|
|
1485
|
-
case "end":
|
|
1486
|
-
return _context17.stop();
|
|
1272
|
+
return _context17.a(2, (_this$api$getUnsafeAp = _this.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this$api$getUnsafeAp, callArgs));
|
|
1487
1273
|
}
|
|
1488
1274
|
}, _callee17);
|
|
1489
1275
|
}));
|
|
@@ -1510,45 +1296,45 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1510
1296
|
return JSON.stringify((_ref8 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref8 !== void 0 ? _ref8 : 'Unknown error structure');
|
|
1511
1297
|
};
|
|
1512
1298
|
failureOutputReason = '';
|
|
1513
|
-
_context18.
|
|
1299
|
+
_context18.n = 2;
|
|
1514
1300
|
return performDryRunCall(false);
|
|
1515
|
-
case
|
|
1516
|
-
result = _context18.
|
|
1301
|
+
case 2:
|
|
1302
|
+
result = _context18.v;
|
|
1517
1303
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1518
1304
|
if (isSuccess) {
|
|
1519
|
-
_context18.
|
|
1305
|
+
_context18.n = 4;
|
|
1520
1306
|
break;
|
|
1521
1307
|
}
|
|
1522
1308
|
initialFailureReason = extractFailureReasonFromResult(result);
|
|
1523
1309
|
failureOutputReason = initialFailureReason;
|
|
1524
1310
|
if (!(initialFailureReason === 'VersionedConversionFailed')) {
|
|
1525
|
-
_context18.
|
|
1311
|
+
_context18.n = 4;
|
|
1526
1312
|
break;
|
|
1527
1313
|
}
|
|
1528
|
-
_context18.
|
|
1314
|
+
_context18.n = 3;
|
|
1529
1315
|
return performDryRunCall(true);
|
|
1530
|
-
case
|
|
1531
|
-
result = _context18.
|
|
1316
|
+
case 3:
|
|
1317
|
+
result = _context18.v;
|
|
1532
1318
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1533
1319
|
if (!isSuccess) {
|
|
1534
1320
|
failureOutputReason = extractFailureReasonFromResult(result);
|
|
1535
1321
|
} else {
|
|
1536
1322
|
failureOutputReason = '';
|
|
1537
1323
|
}
|
|
1538
|
-
case
|
|
1324
|
+
case 4:
|
|
1539
1325
|
if (isSuccess) {
|
|
1540
|
-
_context18.
|
|
1326
|
+
_context18.n = 5;
|
|
1541
1327
|
break;
|
|
1542
1328
|
}
|
|
1543
|
-
return _context18.
|
|
1329
|
+
return _context18.a(2, Promise.resolve({
|
|
1544
1330
|
success: false,
|
|
1545
1331
|
failureReason: failureOutputReason
|
|
1546
1332
|
}));
|
|
1547
|
-
case
|
|
1548
|
-
_context18.
|
|
1333
|
+
case 5:
|
|
1334
|
+
_context18.n = 6;
|
|
1549
1335
|
return this.calculateTransactionFee(tx, address);
|
|
1550
|
-
case
|
|
1551
|
-
executionFee = _context18.
|
|
1336
|
+
case 6:
|
|
1337
|
+
executionFee = _context18.v;
|
|
1552
1338
|
fee = sdkCore.computeFeeFromDryRun(result, node, executionFee, isFeeAsset);
|
|
1553
1339
|
actualWeight = result.value.execution_result.value.actual_weight;
|
|
1554
1340
|
weight = actualWeight ? {
|
|
@@ -1557,16 +1343,13 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1557
1343
|
} : undefined;
|
|
1558
1344
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1559
1345
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1560
|
-
return _context18.
|
|
1346
|
+
return _context18.a(2, Promise.resolve({
|
|
1561
1347
|
success: true,
|
|
1562
1348
|
fee: fee,
|
|
1563
1349
|
weight: weight,
|
|
1564
1350
|
forwardedXcms: forwardedXcms,
|
|
1565
1351
|
destParaId: destParaId
|
|
1566
1352
|
}));
|
|
1567
|
-
case 34:
|
|
1568
|
-
case "end":
|
|
1569
|
-
return _context18.stop();
|
|
1570
1353
|
}
|
|
1571
1354
|
}, _callee18, this);
|
|
1572
1355
|
}));
|
|
@@ -1578,36 +1361,36 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1578
1361
|
}, {
|
|
1579
1362
|
key: "getDryRunXcm",
|
|
1580
1363
|
value: function () {
|
|
1581
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/
|
|
1364
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref9) {
|
|
1582
1365
|
var _ref0, _ref1, _ref10, _ref11;
|
|
1583
1366
|
var originLocation, xcm, node, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, feeEvent, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1584
|
-
return
|
|
1585
|
-
while (1) switch (_context19.
|
|
1367
|
+
return _regenerator().w(function (_context19) {
|
|
1368
|
+
while (1) switch (_context19.n) {
|
|
1586
1369
|
case 0:
|
|
1587
1370
|
originLocation = _ref9.originLocation, xcm = _ref9.xcm, node = _ref9.node, origin = _ref9.origin, asset = _ref9.asset, feeAsset = _ref9.feeAsset, originFee = _ref9.originFee, amount = _ref9.amount;
|
|
1588
1371
|
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
1589
1372
|
if (supportsDryRunApi) {
|
|
1590
|
-
_context19.
|
|
1373
|
+
_context19.n = 1;
|
|
1591
1374
|
break;
|
|
1592
1375
|
}
|
|
1593
1376
|
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
1594
|
-
case
|
|
1377
|
+
case 1:
|
|
1595
1378
|
transformedOriginLocation = _transform(originLocation);
|
|
1596
|
-
_context19.
|
|
1379
|
+
_context19.n = 2;
|
|
1597
1380
|
return this.api.getUnsafeApi().apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
|
|
1598
|
-
case
|
|
1599
|
-
result = _context19.
|
|
1381
|
+
case 2:
|
|
1382
|
+
result = _context19.v;
|
|
1600
1383
|
isSuccess = result.success && result.value.execution_result.type === 'Complete';
|
|
1601
1384
|
if (isSuccess) {
|
|
1602
|
-
_context19.
|
|
1385
|
+
_context19.n = 3;
|
|
1603
1386
|
break;
|
|
1604
1387
|
}
|
|
1605
1388
|
failureReason = result.value.execution_result.value.error.type;
|
|
1606
|
-
return _context19.
|
|
1389
|
+
return _context19.a(2, Promise.resolve({
|
|
1607
1390
|
success: false,
|
|
1608
1391
|
failureReason: failureReason
|
|
1609
1392
|
}));
|
|
1610
|
-
case
|
|
1393
|
+
case 3:
|
|
1611
1394
|
emitted = result.value.emitted_events; // We want to look for the last event
|
|
1612
1395
|
reversedEvents = _toConsumableArray(emitted).reverse();
|
|
1613
1396
|
palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
|
|
@@ -1631,14 +1414,14 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1631
1414
|
return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
|
|
1632
1415
|
});
|
|
1633
1416
|
if (feeEvent) {
|
|
1634
|
-
_context19.
|
|
1417
|
+
_context19.n = 4;
|
|
1635
1418
|
break;
|
|
1636
1419
|
}
|
|
1637
|
-
return _context19.
|
|
1420
|
+
return _context19.a(2, Promise.resolve({
|
|
1638
1421
|
success: false,
|
|
1639
1422
|
failureReason: 'Cannot determine destination fee. No Issued event found'
|
|
1640
1423
|
}));
|
|
1641
|
-
case
|
|
1424
|
+
case 4:
|
|
1642
1425
|
fee = feeEvent.type === 'AssetConversion' ? feeEvent.value.value.amount_in : feeEvent.value.value.amount;
|
|
1643
1426
|
if (feeAssetFeeEvent) {
|
|
1644
1427
|
fee = amount - originFee - feeEvent.value.value.amount;
|
|
@@ -1650,16 +1433,13 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1650
1433
|
} : undefined;
|
|
1651
1434
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1652
1435
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1653
|
-
return _context19.
|
|
1436
|
+
return _context19.a(2, Promise.resolve({
|
|
1654
1437
|
success: true,
|
|
1655
1438
|
fee: fee,
|
|
1656
1439
|
weight: weight,
|
|
1657
1440
|
forwardedXcms: forwardedXcms,
|
|
1658
1441
|
destParaId: destParaId
|
|
1659
1442
|
}));
|
|
1660
|
-
case 27:
|
|
1661
|
-
case "end":
|
|
1662
|
-
return _context19.stop();
|
|
1663
1443
|
}
|
|
1664
1444
|
}, _callee19, this);
|
|
1665
1445
|
}));
|
|
@@ -1671,19 +1451,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1671
1451
|
}, {
|
|
1672
1452
|
key: "getBridgeStatus",
|
|
1673
1453
|
value: function () {
|
|
1674
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/
|
|
1454
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
|
|
1675
1455
|
var outboundOperatingMode;
|
|
1676
|
-
return
|
|
1677
|
-
while (1) switch (_context20.
|
|
1456
|
+
return _regenerator().w(function (_context20) {
|
|
1457
|
+
while (1) switch (_context20.n) {
|
|
1678
1458
|
case 0:
|
|
1679
|
-
_context20.
|
|
1459
|
+
_context20.n = 1;
|
|
1680
1460
|
return this.api.getUnsafeApi().query.EthereumOutboundQueue.OperatingMode.getValue();
|
|
1681
|
-
case
|
|
1682
|
-
outboundOperatingMode = _context20.
|
|
1683
|
-
return _context20.
|
|
1684
|
-
case 4:
|
|
1685
|
-
case "end":
|
|
1686
|
-
return _context20.stop();
|
|
1461
|
+
case 1:
|
|
1462
|
+
outboundOperatingMode = _context20.v;
|
|
1463
|
+
return _context20.a(2, outboundOperatingMode.type);
|
|
1687
1464
|
}
|
|
1688
1465
|
}, _callee20, this);
|
|
1689
1466
|
}));
|
|
@@ -1732,20 +1509,17 @@ var createApiInstanceForNode = function createApiInstanceForNode(node) {
|
|
|
1732
1509
|
};
|
|
1733
1510
|
var createPapiApiCall = function createPapiApiCall(apiCall) {
|
|
1734
1511
|
return /*#__PURE__*/function () {
|
|
1735
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
1512
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
1736
1513
|
var papiApi, optionsWithApi;
|
|
1737
|
-
return
|
|
1738
|
-
while (1) switch (_context.
|
|
1514
|
+
return _regenerator().w(function (_context) {
|
|
1515
|
+
while (1) switch (_context.n) {
|
|
1739
1516
|
case 0:
|
|
1740
1517
|
papiApi = new PapiApi();
|
|
1741
1518
|
papiApi.setApi(options.api);
|
|
1742
1519
|
optionsWithApi = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1743
1520
|
api: papiApi
|
|
1744
1521
|
});
|
|
1745
|
-
return _context.
|
|
1746
|
-
case 4:
|
|
1747
|
-
case "end":
|
|
1748
|
-
return _context.stop();
|
|
1522
|
+
return _context.a(2, apiCall(optionsWithApi));
|
|
1749
1523
|
}
|
|
1750
1524
|
}, _callee);
|
|
1751
1525
|
}));
|
|
@@ -1909,23 +1683,20 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1909
1683
|
}, {
|
|
1910
1684
|
key: "build",
|
|
1911
1685
|
value: (function () {
|
|
1912
|
-
var _build = _asyncToGenerator(/*#__PURE__*/
|
|
1686
|
+
var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1913
1687
|
var _this$_options, from, to, address;
|
|
1914
|
-
return
|
|
1915
|
-
while (1) switch (_context.
|
|
1688
|
+
return _regenerator().w(function (_context) {
|
|
1689
|
+
while (1) switch (_context.n) {
|
|
1916
1690
|
case 0:
|
|
1917
1691
|
_this$_options = this._options, from = _this$_options.from, to = _this$_options.to, address = _this$_options.address;
|
|
1918
1692
|
sdkCore.validateAddress(address, to);
|
|
1919
1693
|
if (!(from === 'Moonbeam' && to === 'Ethereum')) {
|
|
1920
|
-
_context.
|
|
1694
|
+
_context.n = 1;
|
|
1921
1695
|
break;
|
|
1922
1696
|
}
|
|
1923
|
-
return _context.
|
|
1924
|
-
case
|
|
1925
|
-
return _context.
|
|
1926
|
-
case 5:
|
|
1927
|
-
case "end":
|
|
1928
|
-
return _context.stop();
|
|
1697
|
+
return _context.a(2, sdkCore.transferMoonbeamToEth(this._options));
|
|
1698
|
+
case 1:
|
|
1699
|
+
return _context.a(2, sdkCore.transferMoonbeamEvm(this._options));
|
|
1929
1700
|
}
|
|
1930
1701
|
}, _callee, this);
|
|
1931
1702
|
}));
|
|
@@ -1973,20 +1744,17 @@ var send = createPapiApiCall(sdkCore.send);
|
|
|
1973
1744
|
var dryRun = createPapiApiCall(sdkCore.dryRun);
|
|
1974
1745
|
var dryRunOrigin = createPapiApiCall(sdkCore.dryRunOrigin);
|
|
1975
1746
|
var getParaEthTransferFees = /*#__PURE__*/function () {
|
|
1976
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
1747
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(ahApi) {
|
|
1977
1748
|
var papiApi;
|
|
1978
|
-
return
|
|
1979
|
-
while (1) switch (_context.
|
|
1749
|
+
return _regenerator().w(function (_context) {
|
|
1750
|
+
while (1) switch (_context.n) {
|
|
1980
1751
|
case 0:
|
|
1981
1752
|
papiApi = new PapiApi();
|
|
1982
1753
|
papiApi.setApi(ahApi);
|
|
1983
|
-
_context.
|
|
1754
|
+
_context.n = 1;
|
|
1984
1755
|
return papiApi.init('AssetHubPolkadot');
|
|
1985
|
-
case
|
|
1986
|
-
return _context.
|
|
1987
|
-
case 5:
|
|
1988
|
-
case "end":
|
|
1989
|
-
return _context.stop();
|
|
1756
|
+
case 1:
|
|
1757
|
+
return _context.a(2, sdkCore.getParaEthTransferFees(papiApi));
|
|
1990
1758
|
}
|
|
1991
1759
|
}, _callee);
|
|
1992
1760
|
}));
|
|
@@ -1998,17 +1766,14 @@ var getParaEthTransferFees = /*#__PURE__*/function () {
|
|
|
1998
1766
|
* Gets the Ethereum bridge status.
|
|
1999
1767
|
*/
|
|
2000
1768
|
var getBridgeStatus = /*#__PURE__*/function () {
|
|
2001
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
1769
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(ahApi) {
|
|
2002
1770
|
var papiApi;
|
|
2003
|
-
return
|
|
2004
|
-
while (1) switch (_context2.
|
|
1771
|
+
return _regenerator().w(function (_context2) {
|
|
1772
|
+
while (1) switch (_context2.n) {
|
|
2005
1773
|
case 0:
|
|
2006
1774
|
papiApi = new PapiApi();
|
|
2007
1775
|
papiApi.setApi(ahApi);
|
|
2008
|
-
return _context2.
|
|
2009
|
-
case 3:
|
|
2010
|
-
case "end":
|
|
2011
|
-
return _context2.stop();
|
|
1776
|
+
return _context2.a(2, sdkCore.getBridgeStatus(papiApi));
|
|
2012
1777
|
}
|
|
2013
1778
|
}, _callee2);
|
|
2014
1779
|
}));
|
|
@@ -2031,6 +1796,7 @@ var transfer = /*#__PURE__*/Object.freeze({
|
|
|
2031
1796
|
exports.Builder = Builder;
|
|
2032
1797
|
exports.EvmBuilder = EvmBuilder;
|
|
2033
1798
|
exports.assets = assets;
|
|
1799
|
+
exports.checkAndConvertToNumberOrBigInt = checkAndConvertToNumberOrBigInt;
|
|
2034
1800
|
exports.claimAssets = claimAssets;
|
|
2035
1801
|
exports.convertSs58 = convertSs58;
|
|
2036
1802
|
exports.createApiInstanceForNode = createApiInstanceForNode;
|
|
@@ -2044,6 +1810,7 @@ exports.getOriginFeeDetails = getOriginFeeDetails;
|
|
|
2044
1810
|
exports.getOriginXcmFee = getOriginXcmFee;
|
|
2045
1811
|
exports.getParaEthTransferFees = getParaEthTransferFees;
|
|
2046
1812
|
exports.send = send;
|
|
1813
|
+
exports.transform = _transform;
|
|
2047
1814
|
exports.xcmPallet = transfer;
|
|
2048
1815
|
Object.keys(sdkCore).forEach(function (k) {
|
|
2049
1816
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|