@paraspell/sdk 8.11.1 → 8.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/index.cjs +360 -303
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +360 -303
- package/package.json +17 -17
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var sdkCore = require('@paraspell/sdk-core');
|
|
4
4
|
var blake2b = require('@noble/hashes/blake2b');
|
|
5
5
|
var utils = require('@noble/hashes/utils');
|
|
6
|
+
var ethers = require('ethers');
|
|
6
7
|
var polkadotApi = require('polkadot-api');
|
|
7
8
|
var polkadotSdkCompat = require('polkadot-api/polkadot-sdk-compat');
|
|
8
9
|
|
|
@@ -168,47 +169,77 @@ function _objectSpread2(e) {
|
|
|
168
169
|
}
|
|
169
170
|
function _regeneratorRuntime() {
|
|
170
171
|
_regeneratorRuntime = function () {
|
|
171
|
-
return
|
|
172
|
+
return r;
|
|
172
173
|
};
|
|
173
174
|
var t,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
n =
|
|
177
|
-
o =
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
configurable: true,
|
|
189
|
-
writable: true
|
|
190
|
-
}), t[e];
|
|
175
|
+
r = {},
|
|
176
|
+
e = Object.prototype,
|
|
177
|
+
n = e.hasOwnProperty,
|
|
178
|
+
o = "function" == typeof Symbol ? Symbol : {},
|
|
179
|
+
i = o.iterator || "@@iterator",
|
|
180
|
+
a = o.asyncIterator || "@@asyncIterator",
|
|
181
|
+
u = o.toStringTag || "@@toStringTag";
|
|
182
|
+
function c(t, r, e, n) {
|
|
183
|
+
return Object.defineProperty(t, r, {
|
|
184
|
+
value: e,
|
|
185
|
+
enumerable: !n,
|
|
186
|
+
configurable: !n,
|
|
187
|
+
writable: !n
|
|
188
|
+
});
|
|
191
189
|
}
|
|
192
190
|
try {
|
|
193
|
-
|
|
191
|
+
c({}, "");
|
|
194
192
|
} catch (t) {
|
|
195
|
-
|
|
196
|
-
return t[
|
|
193
|
+
c = function (t, r, e) {
|
|
194
|
+
return t[r] = e;
|
|
197
195
|
};
|
|
198
196
|
}
|
|
199
|
-
function
|
|
197
|
+
function h(r, e, n, o) {
|
|
200
198
|
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
201
|
-
a = Object.create(i.prototype)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
221
|
+
if (1 === o) throw o = 4, n.arg;
|
|
222
|
+
n.dispatchException(n.arg);
|
|
223
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
224
|
+
o = 3;
|
|
225
|
+
var h = s(r, e, n);
|
|
226
|
+
if ("normal" === h.type) {
|
|
227
|
+
if (o = n.done ? 4 : 2, h.arg === f) continue;
|
|
228
|
+
return {
|
|
229
|
+
value: h.arg,
|
|
230
|
+
done: n.done
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
"throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}(r, n, new Context(o || [])), true), a;
|
|
206
237
|
}
|
|
207
|
-
function
|
|
238
|
+
function s(t, r, e) {
|
|
208
239
|
try {
|
|
209
240
|
return {
|
|
210
241
|
type: "normal",
|
|
211
|
-
arg: t.call(
|
|
242
|
+
arg: t.call(r, e)
|
|
212
243
|
};
|
|
213
244
|
} catch (t) {
|
|
214
245
|
return {
|
|
@@ -217,255 +248,193 @@ function _regeneratorRuntime() {
|
|
|
217
248
|
};
|
|
218
249
|
}
|
|
219
250
|
}
|
|
220
|
-
|
|
221
|
-
var
|
|
222
|
-
l = "suspendedYield",
|
|
223
|
-
f = "executing",
|
|
224
|
-
s = "completed",
|
|
225
|
-
y = {};
|
|
251
|
+
r.wrap = h;
|
|
252
|
+
var f = {};
|
|
226
253
|
function Generator() {}
|
|
227
254
|
function GeneratorFunction() {}
|
|
228
255
|
function GeneratorFunctionPrototype() {}
|
|
229
|
-
var
|
|
230
|
-
|
|
256
|
+
var l = {};
|
|
257
|
+
c(l, i, function () {
|
|
231
258
|
return this;
|
|
232
259
|
});
|
|
233
|
-
var
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
var
|
|
237
|
-
function
|
|
238
|
-
["next", "throw", "return"].forEach(function (
|
|
239
|
-
|
|
240
|
-
return this._invoke(
|
|
260
|
+
var p = Object.getPrototypeOf,
|
|
261
|
+
y = p && p(p(x([])));
|
|
262
|
+
y && y !== e && n.call(y, i) && (l = y);
|
|
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);
|
|
241
268
|
});
|
|
242
269
|
});
|
|
243
270
|
}
|
|
244
|
-
function AsyncIterator(t,
|
|
245
|
-
function
|
|
246
|
-
var c =
|
|
271
|
+
function AsyncIterator(t, r) {
|
|
272
|
+
function e(o, i, a, u) {
|
|
273
|
+
var c = s(t[o], t, i);
|
|
247
274
|
if ("throw" !== c.type) {
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
return
|
|
251
|
-
|
|
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);
|
|
252
279
|
}, function (t) {
|
|
253
|
-
|
|
254
|
-
}) :
|
|
255
|
-
|
|
280
|
+
e("throw", t, a, u);
|
|
281
|
+
}) : r.resolve(f).then(function (t) {
|
|
282
|
+
h.value = t, a(h);
|
|
256
283
|
}, function (t) {
|
|
257
|
-
return
|
|
284
|
+
return e("throw", t, a, u);
|
|
258
285
|
});
|
|
259
286
|
}
|
|
260
|
-
|
|
287
|
+
u(c.arg);
|
|
261
288
|
}
|
|
262
|
-
var
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
function
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
function makeInvokeMethod(e, r, n) {
|
|
275
|
-
var o = h;
|
|
276
|
-
return function (i, a) {
|
|
277
|
-
if (o === f) throw Error("Generator is already running");
|
|
278
|
-
if (o === s) {
|
|
279
|
-
if ("throw" === i) throw a;
|
|
280
|
-
return {
|
|
281
|
-
value: t,
|
|
282
|
-
done: true
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
for (n.method = i, n.arg = a;;) {
|
|
286
|
-
var c = n.delegate;
|
|
287
|
-
if (c) {
|
|
288
|
-
var u = maybeInvokeDelegate(c, n);
|
|
289
|
-
if (u) {
|
|
290
|
-
if (u === y) continue;
|
|
291
|
-
return u;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
295
|
-
if (o === h) throw o = s, n.arg;
|
|
296
|
-
n.dispatchException(n.arg);
|
|
297
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
298
|
-
o = f;
|
|
299
|
-
var p = tryCatch(e, r, n);
|
|
300
|
-
if ("normal" === p.type) {
|
|
301
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
302
|
-
return {
|
|
303
|
-
value: p.arg,
|
|
304
|
-
done: n.done
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
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
|
+
});
|
|
308
295
|
}
|
|
309
|
-
|
|
296
|
+
return o = o ? o.then(i, i) : i();
|
|
297
|
+
}, true);
|
|
310
298
|
}
|
|
311
|
-
function
|
|
312
|
-
var n =
|
|
313
|
-
o =
|
|
314
|
-
if (o === t) return
|
|
315
|
-
var i =
|
|
316
|
-
if ("throw" === i.type) return
|
|
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;
|
|
317
305
|
var a = i.arg;
|
|
318
|
-
return a ? a.done ? (r
|
|
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);
|
|
319
307
|
}
|
|
320
|
-
function
|
|
321
|
-
|
|
322
|
-
tryLoc: t[0]
|
|
323
|
-
};
|
|
324
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
308
|
+
function w(t) {
|
|
309
|
+
this.tryEntries.push(t);
|
|
325
310
|
}
|
|
326
|
-
function
|
|
327
|
-
var e =
|
|
328
|
-
e.type = "normal",
|
|
311
|
+
function m(r) {
|
|
312
|
+
var e = r[4] || {};
|
|
313
|
+
e.type = "normal", e.arg = t, r[4] = e;
|
|
329
314
|
}
|
|
330
315
|
function Context(t) {
|
|
331
|
-
this.tryEntries = [
|
|
332
|
-
tryLoc: "root"
|
|
333
|
-
}], t.forEach(pushTryEntry, this), this.reset(true);
|
|
316
|
+
this.tryEntries = [[-1]], t.forEach(w, this), this.reset(true);
|
|
334
317
|
}
|
|
335
|
-
function
|
|
336
|
-
if (
|
|
337
|
-
var
|
|
338
|
-
if (
|
|
339
|
-
if ("function" == typeof
|
|
340
|
-
if (!isNaN(
|
|
318
|
+
function x(r) {
|
|
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)) {
|
|
341
324
|
var o = -1,
|
|
342
|
-
|
|
343
|
-
for (; ++o <
|
|
344
|
-
return
|
|
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;
|
|
345
328
|
};
|
|
346
|
-
return
|
|
329
|
+
return a.next = a;
|
|
347
330
|
}
|
|
348
331
|
}
|
|
349
|
-
throw new TypeError(typeof
|
|
332
|
+
throw new TypeError(typeof r + " is not iterable");
|
|
350
333
|
}
|
|
351
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
358
|
-
var e = "function" == typeof t && t.constructor;
|
|
359
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
360
|
-
}, e.mark = function (t) {
|
|
361
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
362
|
-
}, e.awrap = function (t) {
|
|
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) {
|
|
363
340
|
return {
|
|
364
341
|
__await: t
|
|
365
342
|
};
|
|
366
|
-
},
|
|
343
|
+
}, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
|
|
367
344
|
return this;
|
|
368
|
-
}),
|
|
345
|
+
}), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
|
|
369
346
|
void 0 === i && (i = Promise);
|
|
370
|
-
var a = new AsyncIterator(
|
|
371
|
-
return
|
|
347
|
+
var a = new AsyncIterator(h(t, e, n, o), i);
|
|
348
|
+
return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
|
|
372
349
|
return t.done ? t.value : a.next();
|
|
373
350
|
});
|
|
374
|
-
},
|
|
351
|
+
}, g(v), c(v, u, "Generator"), c(v, i, function () {
|
|
375
352
|
return this;
|
|
376
|
-
}),
|
|
353
|
+
}), c(v, "toString", function () {
|
|
377
354
|
return "[object Generator]";
|
|
378
|
-
}),
|
|
379
|
-
var
|
|
380
|
-
|
|
381
|
-
for (var n in
|
|
382
|
-
return
|
|
383
|
-
for (;
|
|
384
|
-
|
|
385
|
-
if (t in e) return next.value = t, next.done = false, next;
|
|
386
|
-
}
|
|
387
|
-
return next.done = true, next;
|
|
355
|
+
}), r.keys = function (t) {
|
|
356
|
+
var r = Object(t),
|
|
357
|
+
e = [];
|
|
358
|
+
for (var n in r) e.unshift(n);
|
|
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;
|
|
388
362
|
};
|
|
389
|
-
},
|
|
363
|
+
}, r.values = x, Context.prototype = {
|
|
390
364
|
constructor: Context,
|
|
391
|
-
reset: function (
|
|
392
|
-
if (this.prev =
|
|
365
|
+
reset: function (r) {
|
|
366
|
+
if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t);
|
|
393
367
|
},
|
|
394
368
|
stop: function () {
|
|
395
369
|
this.done = true;
|
|
396
|
-
var t = this.tryEntries[0]
|
|
370
|
+
var t = this.tryEntries[0][4];
|
|
397
371
|
if ("throw" === t.type) throw t.arg;
|
|
398
372
|
return this.rval;
|
|
399
373
|
},
|
|
400
|
-
dispatchException: function (
|
|
401
|
-
if (this.done) throw
|
|
402
|
-
var
|
|
403
|
-
function
|
|
404
|
-
|
|
374
|
+
dispatchException: function (r) {
|
|
375
|
+
if (this.done) throw r;
|
|
376
|
+
var e = this;
|
|
377
|
+
function n(t) {
|
|
378
|
+
a.type = "throw", a.arg = r, e.next = t;
|
|
405
379
|
}
|
|
406
|
-
for (var o =
|
|
380
|
+
for (var o = e.tryEntries.length - 1; o >= 0; --o) {
|
|
407
381
|
var i = this.tryEntries[o],
|
|
408
|
-
a = i
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
418
|
-
} else {
|
|
419
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
420
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
421
|
-
}
|
|
382
|
+
a = i[4],
|
|
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;
|
|
422
391
|
}
|
|
423
392
|
}
|
|
424
393
|
},
|
|
425
|
-
abrupt: function (t,
|
|
426
|
-
for (var
|
|
427
|
-
var
|
|
428
|
-
if (
|
|
429
|
-
var
|
|
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;
|
|
430
399
|
break;
|
|
431
400
|
}
|
|
432
401
|
}
|
|
433
|
-
|
|
434
|
-
var
|
|
435
|
-
return
|
|
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);
|
|
436
405
|
},
|
|
437
|
-
complete: function (t,
|
|
406
|
+
complete: function (t, r) {
|
|
438
407
|
if ("throw" === t.type) throw t.arg;
|
|
439
|
-
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 &&
|
|
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;
|
|
440
409
|
},
|
|
441
410
|
finish: function (t) {
|
|
442
|
-
for (var
|
|
443
|
-
var
|
|
444
|
-
if (
|
|
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;
|
|
445
414
|
}
|
|
446
415
|
},
|
|
447
416
|
catch: function (t) {
|
|
448
|
-
for (var
|
|
449
|
-
var
|
|
450
|
-
if (
|
|
451
|
-
var n =
|
|
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];
|
|
452
421
|
if ("throw" === n.type) {
|
|
453
422
|
var o = n.arg;
|
|
454
|
-
|
|
423
|
+
m(e);
|
|
455
424
|
}
|
|
456
425
|
return o;
|
|
457
426
|
}
|
|
458
427
|
}
|
|
459
428
|
throw Error("illegal catch attempt");
|
|
460
429
|
},
|
|
461
|
-
delegateYield: function (
|
|
430
|
+
delegateYield: function (r, e, n) {
|
|
462
431
|
return this.delegate = {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}, "next" === this.method && (this.arg = t),
|
|
432
|
+
i: x(r),
|
|
433
|
+
r: e,
|
|
434
|
+
n: n
|
|
435
|
+
}, "next" === this.method && (this.arg = t), f;
|
|
467
436
|
}
|
|
468
|
-
},
|
|
437
|
+
}, r;
|
|
469
438
|
}
|
|
470
439
|
function _slicedToArray(r, e) {
|
|
471
440
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
@@ -957,7 +926,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
957
926
|
}
|
|
958
927
|
}, _callee7, this);
|
|
959
928
|
}));
|
|
960
|
-
function getBalanceForeignPolkadotXcm(
|
|
929
|
+
function getBalanceForeignPolkadotXcm(_x0, _x1) {
|
|
961
930
|
return _getBalanceForeignPolkadotXcm.apply(this, arguments);
|
|
962
931
|
}
|
|
963
932
|
return getBalanceForeignPolkadotXcm;
|
|
@@ -981,7 +950,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
981
950
|
}
|
|
982
951
|
}, _callee8, this);
|
|
983
952
|
}));
|
|
984
|
-
function getMythosForeignBalance(
|
|
953
|
+
function getMythosForeignBalance(_x10) {
|
|
985
954
|
return _getMythosForeignBalance.apply(this, arguments);
|
|
986
955
|
}
|
|
987
956
|
return getMythosForeignBalance;
|
|
@@ -1006,7 +975,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1006
975
|
}
|
|
1007
976
|
}, _callee9, this);
|
|
1008
977
|
}));
|
|
1009
|
-
function getAssetHubForeignBalance(
|
|
978
|
+
function getAssetHubForeignBalance(_x11, _x12) {
|
|
1010
979
|
return _getAssetHubForeignBalance.apply(this, arguments);
|
|
1011
980
|
}
|
|
1012
981
|
return getAssetHubForeignBalance;
|
|
@@ -1014,23 +983,23 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1014
983
|
}, {
|
|
1015
984
|
key: "getForeignAssetsByIdBalance",
|
|
1016
985
|
value: function () {
|
|
1017
|
-
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
986
|
+
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(address, assetId) {
|
|
1018
987
|
var res;
|
|
1019
|
-
return _regeneratorRuntime().wrap(function
|
|
1020
|
-
while (1) switch (
|
|
988
|
+
return _regeneratorRuntime().wrap(function _callee0$(_context0) {
|
|
989
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
1021
990
|
case 0:
|
|
1022
|
-
|
|
991
|
+
_context0.next = 2;
|
|
1023
992
|
return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(assetId, address);
|
|
1024
993
|
case 2:
|
|
1025
|
-
res =
|
|
1026
|
-
return
|
|
994
|
+
res = _context0.sent;
|
|
995
|
+
return _context0.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
|
|
1027
996
|
case 4:
|
|
1028
997
|
case "end":
|
|
1029
|
-
return
|
|
998
|
+
return _context0.stop();
|
|
1030
999
|
}
|
|
1031
|
-
},
|
|
1000
|
+
}, _callee0, this);
|
|
1032
1001
|
}));
|
|
1033
|
-
function getForeignAssetsByIdBalance(
|
|
1002
|
+
function getForeignAssetsByIdBalance(_x13, _x14) {
|
|
1034
1003
|
return _getForeignAssetsByIdBalance.apply(this, arguments);
|
|
1035
1004
|
}
|
|
1036
1005
|
return getForeignAssetsByIdBalance;
|
|
@@ -1038,26 +1007,26 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1038
1007
|
}, {
|
|
1039
1008
|
key: "getBalanceForeignBifrost",
|
|
1040
1009
|
value: function () {
|
|
1041
|
-
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1010
|
+
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(address, asset) {
|
|
1042
1011
|
var currencySelection, transformedParameters, response, accountData;
|
|
1043
|
-
return _regeneratorRuntime().wrap(function
|
|
1044
|
-
while (1) switch (
|
|
1012
|
+
return _regeneratorRuntime().wrap(function _callee1$(_context1) {
|
|
1013
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
1045
1014
|
case 0:
|
|
1046
1015
|
currencySelection = sdkCore.getNode('BifrostPolkadot').getCurrencySelection(asset);
|
|
1047
1016
|
transformedParameters = _transform(currencySelection);
|
|
1048
|
-
|
|
1017
|
+
_context1.next = 4;
|
|
1049
1018
|
return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
|
|
1050
1019
|
case 4:
|
|
1051
|
-
response =
|
|
1020
|
+
response = _context1.sent;
|
|
1052
1021
|
accountData = response ? response : null;
|
|
1053
|
-
return
|
|
1022
|
+
return _context1.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
1054
1023
|
case 7:
|
|
1055
1024
|
case "end":
|
|
1056
|
-
return
|
|
1025
|
+
return _context1.stop();
|
|
1057
1026
|
}
|
|
1058
|
-
},
|
|
1027
|
+
}, _callee1, this);
|
|
1059
1028
|
}));
|
|
1060
|
-
function getBalanceForeignBifrost(
|
|
1029
|
+
function getBalanceForeignBifrost(_x15, _x16) {
|
|
1061
1030
|
return _getBalanceForeignBifrost.apply(this, arguments);
|
|
1062
1031
|
}
|
|
1063
1032
|
return getBalanceForeignBifrost;
|
|
@@ -1065,27 +1034,27 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1065
1034
|
}, {
|
|
1066
1035
|
key: "getBalanceNativeAcala",
|
|
1067
1036
|
value: function () {
|
|
1068
|
-
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1037
|
+
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(address, symbol) {
|
|
1069
1038
|
var transformedParameters, response, accountData;
|
|
1070
|
-
return _regeneratorRuntime().wrap(function
|
|
1071
|
-
while (1) switch (
|
|
1039
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1040
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1072
1041
|
case 0:
|
|
1073
1042
|
transformedParameters = _transform({
|
|
1074
1043
|
Token: symbol
|
|
1075
1044
|
});
|
|
1076
|
-
|
|
1045
|
+
_context10.next = 3;
|
|
1077
1046
|
return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
|
|
1078
1047
|
case 3:
|
|
1079
|
-
response =
|
|
1048
|
+
response = _context10.sent;
|
|
1080
1049
|
accountData = response ? response : null;
|
|
1081
|
-
return
|
|
1050
|
+
return _context10.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
1082
1051
|
case 6:
|
|
1083
1052
|
case "end":
|
|
1084
|
-
return
|
|
1053
|
+
return _context10.stop();
|
|
1085
1054
|
}
|
|
1086
|
-
},
|
|
1055
|
+
}, _callee10, this);
|
|
1087
1056
|
}));
|
|
1088
|
-
function getBalanceNativeAcala(
|
|
1057
|
+
function getBalanceNativeAcala(_x17, _x18) {
|
|
1089
1058
|
return _getBalanceNativeAcala.apply(this, arguments);
|
|
1090
1059
|
}
|
|
1091
1060
|
return getBalanceNativeAcala;
|
|
@@ -1093,19 +1062,19 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1093
1062
|
}, {
|
|
1094
1063
|
key: "getBalanceForeignXTokens",
|
|
1095
1064
|
value: function () {
|
|
1096
|
-
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1065
|
+
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(node, address, asset) {
|
|
1097
1066
|
var pallet, response, entry;
|
|
1098
|
-
return _regeneratorRuntime().wrap(function
|
|
1099
|
-
while (1) switch (
|
|
1067
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1068
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1100
1069
|
case 0:
|
|
1101
1070
|
pallet = 'Tokens';
|
|
1102
1071
|
if (node === 'Centrifuge' || node === 'Altair') {
|
|
1103
1072
|
pallet = 'OrmlTokens';
|
|
1104
1073
|
}
|
|
1105
|
-
|
|
1074
|
+
_context11.next = 4;
|
|
1106
1075
|
return this.api.getUnsafeApi().query[pallet].Accounts.getEntries(address);
|
|
1107
1076
|
case 4:
|
|
1108
|
-
response =
|
|
1077
|
+
response = _context11.sent;
|
|
1109
1078
|
entry = response.find(function (_ref2) {
|
|
1110
1079
|
var _asset$symbol, _asset$assetId, _asset$symbol2, _asset$assetId2;
|
|
1111
1080
|
var keyArgs = _ref2.keyArgs;
|
|
@@ -1114,14 +1083,14 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1114
1083
|
var assetItem = _keyArgs[1];
|
|
1115
1084
|
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());
|
|
1116
1085
|
});
|
|
1117
|
-
return
|
|
1086
|
+
return _context11.abrupt("return", entry !== null && entry !== void 0 && entry.value ? BigInt(entry.value.free.toString()) : 0n);
|
|
1118
1087
|
case 7:
|
|
1119
1088
|
case "end":
|
|
1120
|
-
return
|
|
1089
|
+
return _context11.stop();
|
|
1121
1090
|
}
|
|
1122
|
-
},
|
|
1091
|
+
}, _callee11, this);
|
|
1123
1092
|
}));
|
|
1124
|
-
function getBalanceForeignXTokens(
|
|
1093
|
+
function getBalanceForeignXTokens(_x19, _x20, _x21) {
|
|
1125
1094
|
return _getBalanceForeignXTokens.apply(this, arguments);
|
|
1126
1095
|
}
|
|
1127
1096
|
return getBalanceForeignXTokens;
|
|
@@ -1129,23 +1098,23 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1129
1098
|
}, {
|
|
1130
1099
|
key: "getBalanceForeignAssetsAccount",
|
|
1131
1100
|
value: function () {
|
|
1132
|
-
var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1101
|
+
var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(address, assetId) {
|
|
1133
1102
|
var response;
|
|
1134
|
-
return _regeneratorRuntime().wrap(function
|
|
1135
|
-
while (1) switch (
|
|
1103
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1104
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1136
1105
|
case 0:
|
|
1137
|
-
|
|
1106
|
+
_context12.next = 2;
|
|
1138
1107
|
return this.api.getUnsafeApi().query.Assets.Account.getValue(assetId, address);
|
|
1139
1108
|
case 2:
|
|
1140
|
-
response =
|
|
1141
|
-
return
|
|
1109
|
+
response = _context12.sent;
|
|
1110
|
+
return _context12.abrupt("return", BigInt(response === undefined ? 0 : response.balance));
|
|
1142
1111
|
case 4:
|
|
1143
1112
|
case "end":
|
|
1144
|
-
return
|
|
1113
|
+
return _context12.stop();
|
|
1145
1114
|
}
|
|
1146
|
-
},
|
|
1115
|
+
}, _callee12, this);
|
|
1147
1116
|
}));
|
|
1148
|
-
function getBalanceForeignAssetsAccount(
|
|
1117
|
+
function getBalanceForeignAssetsAccount(_x22, _x23) {
|
|
1149
1118
|
return _getBalanceForeignAssetsAccount.apply(this, arguments);
|
|
1150
1119
|
}
|
|
1151
1120
|
return getBalanceForeignAssetsAccount;
|
|
@@ -1153,24 +1122,24 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1153
1122
|
}, {
|
|
1154
1123
|
key: "getFromRpc",
|
|
1155
1124
|
value: function () {
|
|
1156
|
-
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1125
|
+
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(module, method, key) {
|
|
1157
1126
|
var toSS58, value;
|
|
1158
|
-
return _regeneratorRuntime().wrap(function
|
|
1159
|
-
while (1) switch (
|
|
1127
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1128
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1160
1129
|
case 0:
|
|
1161
1130
|
toSS58 = polkadotApi.AccountId().dec;
|
|
1162
|
-
|
|
1163
|
-
return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) ? toSS58(key) : key]);
|
|
1131
|
+
_context13.next = 3;
|
|
1132
|
+
return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) && !ethers.ethers.isAddress(key) ? toSS58(key) : key]);
|
|
1164
1133
|
case 3:
|
|
1165
|
-
value =
|
|
1166
|
-
return
|
|
1134
|
+
value = _context13.sent;
|
|
1135
|
+
return _context13.abrupt("return", isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
|
|
1167
1136
|
case 5:
|
|
1168
1137
|
case "end":
|
|
1169
|
-
return
|
|
1138
|
+
return _context13.stop();
|
|
1170
1139
|
}
|
|
1171
|
-
},
|
|
1140
|
+
}, _callee13, this);
|
|
1172
1141
|
}));
|
|
1173
|
-
function getFromRpc(
|
|
1142
|
+
function getFromRpc(_x24, _x25, _x26) {
|
|
1174
1143
|
return _getFromRpc.apply(this, arguments);
|
|
1175
1144
|
}
|
|
1176
1145
|
return getFromRpc;
|
|
@@ -1183,40 +1152,40 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1183
1152
|
}, {
|
|
1184
1153
|
key: "createApiForNode",
|
|
1185
1154
|
value: function () {
|
|
1186
|
-
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1155
|
+
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(node) {
|
|
1187
1156
|
var api;
|
|
1188
|
-
return _regeneratorRuntime().wrap(function
|
|
1189
|
-
while (1) switch (
|
|
1157
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1158
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1190
1159
|
case 0:
|
|
1191
1160
|
api = new PapiApi();
|
|
1192
|
-
|
|
1161
|
+
_context14.next = 3;
|
|
1193
1162
|
return api.init(node);
|
|
1194
1163
|
case 3:
|
|
1195
|
-
return
|
|
1164
|
+
return _context14.abrupt("return", api);
|
|
1196
1165
|
case 4:
|
|
1197
1166
|
case "end":
|
|
1198
|
-
return
|
|
1167
|
+
return _context14.stop();
|
|
1199
1168
|
}
|
|
1200
|
-
},
|
|
1169
|
+
}, _callee14);
|
|
1201
1170
|
}));
|
|
1202
|
-
function createApiForNode(
|
|
1171
|
+
function createApiForNode(_x27) {
|
|
1203
1172
|
return _createApiForNode.apply(this, arguments);
|
|
1204
1173
|
}
|
|
1205
1174
|
return createApiForNode;
|
|
1206
1175
|
}()
|
|
1207
1176
|
}, {
|
|
1208
|
-
key: "
|
|
1177
|
+
key: "getDryRunCall",
|
|
1209
1178
|
value: function () {
|
|
1210
|
-
var
|
|
1179
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref3) {
|
|
1211
1180
|
var _this$api$getUnsafeAp;
|
|
1212
|
-
var tx, address, node, supportsDryRunApi, isBifrost, DEFAULT_XCM_VERSION, result, isSuccess, failureReason, executionFee, fee, actualWeight, weight;
|
|
1213
|
-
return _regeneratorRuntime().wrap(function
|
|
1214
|
-
while (1) switch (
|
|
1181
|
+
var tx, address, node, supportsDryRunApi, isBifrost, DEFAULT_XCM_VERSION, result, isSuccess, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1182
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1183
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1215
1184
|
case 0:
|
|
1216
1185
|
tx = _ref3.tx, address = _ref3.address, node = _ref3.node;
|
|
1217
1186
|
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
1218
1187
|
if (supportsDryRunApi) {
|
|
1219
|
-
|
|
1188
|
+
_context15.next = 4;
|
|
1220
1189
|
break;
|
|
1221
1190
|
}
|
|
1222
1191
|
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
@@ -1224,7 +1193,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1224
1193
|
// Bifrost requires a third parameter XCM version
|
|
1225
1194
|
isBifrost = node === 'BifrostPolkadot' || node === 'BifrostKusama';
|
|
1226
1195
|
DEFAULT_XCM_VERSION = 3;
|
|
1227
|
-
|
|
1196
|
+
_context15.next = 8;
|
|
1228
1197
|
return (_this$api$getUnsafeAp = this.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this$api$getUnsafeAp, [{
|
|
1229
1198
|
type: 'system',
|
|
1230
1199
|
value: {
|
|
@@ -1233,62 +1202,150 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1233
1202
|
}
|
|
1234
1203
|
}, tx.decodedCall].concat(_toConsumableArray(isBifrost ? [DEFAULT_XCM_VERSION] : [])));
|
|
1235
1204
|
case 8:
|
|
1236
|
-
result =
|
|
1205
|
+
result = _context15.sent;
|
|
1237
1206
|
isSuccess = result.success && result.value.execution_result.success;
|
|
1238
1207
|
if (isSuccess) {
|
|
1239
|
-
|
|
1208
|
+
_context15.next = 13;
|
|
1240
1209
|
break;
|
|
1241
1210
|
}
|
|
1242
1211
|
failureReason = result.value.execution_result.value.error.value.value.type;
|
|
1243
|
-
return
|
|
1212
|
+
return _context15.abrupt("return", Promise.resolve({
|
|
1244
1213
|
success: false,
|
|
1245
1214
|
failureReason: failureReason
|
|
1246
1215
|
}));
|
|
1247
1216
|
case 13:
|
|
1248
|
-
|
|
1217
|
+
_context15.next = 15;
|
|
1249
1218
|
return this.calculateTransactionFee(tx, address);
|
|
1250
1219
|
case 15:
|
|
1251
|
-
executionFee =
|
|
1220
|
+
executionFee = _context15.sent;
|
|
1252
1221
|
fee = sdkCore.computeFeeFromDryRun(result, node, executionFee);
|
|
1253
1222
|
actualWeight = result.value.execution_result.value.actual_weight;
|
|
1254
1223
|
weight = actualWeight ? {
|
|
1255
1224
|
refTime: actualWeight.ref_time,
|
|
1256
1225
|
proofSize: actualWeight.proof_size
|
|
1257
1226
|
} : undefined;
|
|
1258
|
-
|
|
1227
|
+
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1228
|
+
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1229
|
+
return _context15.abrupt("return", Promise.resolve({
|
|
1259
1230
|
success: true,
|
|
1260
1231
|
fee: fee,
|
|
1261
|
-
weight: weight
|
|
1232
|
+
weight: weight,
|
|
1233
|
+
forwardedXcms: forwardedXcms,
|
|
1234
|
+
destParaId: destParaId
|
|
1262
1235
|
}));
|
|
1263
|
-
case
|
|
1236
|
+
case 22:
|
|
1264
1237
|
case "end":
|
|
1265
|
-
return
|
|
1238
|
+
return _context15.stop();
|
|
1266
1239
|
}
|
|
1267
|
-
},
|
|
1240
|
+
}, _callee15, this);
|
|
1268
1241
|
}));
|
|
1269
|
-
function
|
|
1270
|
-
return
|
|
1242
|
+
function getDryRunCall(_x28) {
|
|
1243
|
+
return _getDryRunCall.apply(this, arguments);
|
|
1271
1244
|
}
|
|
1272
|
-
return
|
|
1245
|
+
return getDryRunCall;
|
|
1246
|
+
}()
|
|
1247
|
+
}, {
|
|
1248
|
+
key: "getDryRunXcm",
|
|
1249
|
+
value: function () {
|
|
1250
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref4) {
|
|
1251
|
+
var _ref5, _ref6, _ref7;
|
|
1252
|
+
var originLocation, xcm, node, origin, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1253
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1254
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1255
|
+
case 0:
|
|
1256
|
+
originLocation = _ref4.originLocation, xcm = _ref4.xcm, node = _ref4.node, origin = _ref4.origin;
|
|
1257
|
+
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
1258
|
+
if (supportsDryRunApi) {
|
|
1259
|
+
_context16.next = 4;
|
|
1260
|
+
break;
|
|
1261
|
+
}
|
|
1262
|
+
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
1263
|
+
case 4:
|
|
1264
|
+
transformedOriginLocation = _transform(originLocation);
|
|
1265
|
+
_context16.next = 7;
|
|
1266
|
+
return this.api.getUnsafeApi().apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
|
|
1267
|
+
case 7:
|
|
1268
|
+
result = _context16.sent;
|
|
1269
|
+
isSuccess = result.success && result.value.execution_result.type === 'Complete';
|
|
1270
|
+
if (isSuccess) {
|
|
1271
|
+
_context16.next = 12;
|
|
1272
|
+
break;
|
|
1273
|
+
}
|
|
1274
|
+
failureReason = result.value.execution_result.value.error.type;
|
|
1275
|
+
return _context16.abrupt("return", Promise.resolve({
|
|
1276
|
+
success: false,
|
|
1277
|
+
failureReason: failureReason
|
|
1278
|
+
}));
|
|
1279
|
+
case 12:
|
|
1280
|
+
emitted = result.value.emitted_events; // We want to look for the last event
|
|
1281
|
+
reversedEvents = _toConsumableArray(emitted).reverse();
|
|
1282
|
+
palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
|
|
1283
|
+
feeEvent = (_ref5 = (_ref6 = (_ref7 = origin === 'Mythos' ? reversedEvents.find(function (event) {
|
|
1284
|
+
return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
|
|
1285
|
+
}) : undefined) !== null && _ref7 !== void 0 ? _ref7 :
|
|
1286
|
+
// Prefer an Issued event
|
|
1287
|
+
reversedEvents.find(function (event) {
|
|
1288
|
+
return palletsWithIssued.includes(event.type) && event.value.type === 'Issued';
|
|
1289
|
+
})) !== null && _ref6 !== void 0 ? _ref6 :
|
|
1290
|
+
// Fallback to Minted event
|
|
1291
|
+
reversedEvents.find(function (event) {
|
|
1292
|
+
return ['Balances', 'ForeignAssets'].includes(event.type) && event.value.type === 'Minted';
|
|
1293
|
+
})) !== null && _ref5 !== void 0 ? _ref5 : reversedEvents.find(function (event) {
|
|
1294
|
+
return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
|
|
1295
|
+
});
|
|
1296
|
+
if (feeEvent) {
|
|
1297
|
+
_context16.next = 18;
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
return _context16.abrupt("return", Promise.resolve({
|
|
1301
|
+
success: false,
|
|
1302
|
+
failureReason: 'Cannot determine destination fee. No Issued event found'
|
|
1303
|
+
}));
|
|
1304
|
+
case 18:
|
|
1305
|
+
fee = feeEvent.type === 'AssetConversion' ? feeEvent.value.value.amount_in : feeEvent.value.value.amount;
|
|
1306
|
+
actualWeight = result.value.execution_result.value.used;
|
|
1307
|
+
weight = actualWeight ? {
|
|
1308
|
+
refTime: actualWeight.ref_time,
|
|
1309
|
+
proofSize: actualWeight.proof_size
|
|
1310
|
+
} : undefined;
|
|
1311
|
+
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1312
|
+
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1313
|
+
return _context16.abrupt("return", Promise.resolve({
|
|
1314
|
+
success: true,
|
|
1315
|
+
fee: fee,
|
|
1316
|
+
weight: weight,
|
|
1317
|
+
forwardedXcms: forwardedXcms,
|
|
1318
|
+
destParaId: destParaId
|
|
1319
|
+
}));
|
|
1320
|
+
case 24:
|
|
1321
|
+
case "end":
|
|
1322
|
+
return _context16.stop();
|
|
1323
|
+
}
|
|
1324
|
+
}, _callee16, this);
|
|
1325
|
+
}));
|
|
1326
|
+
function getDryRunXcm(_x29) {
|
|
1327
|
+
return _getDryRunXcm.apply(this, arguments);
|
|
1328
|
+
}
|
|
1329
|
+
return getDryRunXcm;
|
|
1273
1330
|
}()
|
|
1274
1331
|
}, {
|
|
1275
1332
|
key: "getBridgeStatus",
|
|
1276
1333
|
value: function () {
|
|
1277
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1334
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1278
1335
|
var outboundOperatingMode;
|
|
1279
|
-
return _regeneratorRuntime().wrap(function
|
|
1280
|
-
while (1) switch (
|
|
1336
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1337
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1281
1338
|
case 0:
|
|
1282
|
-
|
|
1339
|
+
_context17.next = 2;
|
|
1283
1340
|
return this.api.getUnsafeApi().query.EthereumOutboundQueue.OperatingMode.getValue();
|
|
1284
1341
|
case 2:
|
|
1285
|
-
outboundOperatingMode =
|
|
1286
|
-
return
|
|
1342
|
+
outboundOperatingMode = _context17.sent;
|
|
1343
|
+
return _context17.abrupt("return", outboundOperatingMode.type);
|
|
1287
1344
|
case 4:
|
|
1288
1345
|
case "end":
|
|
1289
|
-
return
|
|
1346
|
+
return _context17.stop();
|
|
1290
1347
|
}
|
|
1291
|
-
},
|
|
1348
|
+
}, _callee17, this);
|
|
1292
1349
|
}));
|
|
1293
1350
|
function getBridgeStatus() {
|
|
1294
1351
|
return _getBridgeStatus.apply(this, arguments);
|