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