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