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