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