@paraspell/sdk-pjs 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 +374 -311
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +374 -311
- package/package.json +12 -12
package/dist/index.mjs
CHANGED
|
@@ -121,47 +121,77 @@ function _objectSpread2(e) {
|
|
|
121
121
|
}
|
|
122
122
|
function _regeneratorRuntime() {
|
|
123
123
|
_regeneratorRuntime = function () {
|
|
124
|
-
return
|
|
124
|
+
return r;
|
|
125
125
|
};
|
|
126
126
|
var t,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
n =
|
|
130
|
-
o =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
configurable: true,
|
|
142
|
-
writable: true
|
|
143
|
-
}), t[e];
|
|
127
|
+
r = {},
|
|
128
|
+
e = Object.prototype,
|
|
129
|
+
n = e.hasOwnProperty,
|
|
130
|
+
o = "function" == typeof Symbol ? Symbol : {},
|
|
131
|
+
i = o.iterator || "@@iterator",
|
|
132
|
+
a = o.asyncIterator || "@@asyncIterator",
|
|
133
|
+
u = o.toStringTag || "@@toStringTag";
|
|
134
|
+
function c(t, r, e, n) {
|
|
135
|
+
return Object.defineProperty(t, r, {
|
|
136
|
+
value: e,
|
|
137
|
+
enumerable: !n,
|
|
138
|
+
configurable: !n,
|
|
139
|
+
writable: !n
|
|
140
|
+
});
|
|
144
141
|
}
|
|
145
142
|
try {
|
|
146
|
-
|
|
143
|
+
c({}, "");
|
|
147
144
|
} catch (t) {
|
|
148
|
-
|
|
149
|
-
return t[
|
|
145
|
+
c = function (t, r, e) {
|
|
146
|
+
return t[r] = e;
|
|
150
147
|
};
|
|
151
148
|
}
|
|
152
|
-
function
|
|
149
|
+
function h(r, e, n, o) {
|
|
153
150
|
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
154
|
-
a = Object.create(i.prototype)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
a = Object.create(i.prototype);
|
|
152
|
+
return c(a, "_invoke", function (r, e, n) {
|
|
153
|
+
var o = 1;
|
|
154
|
+
return function (i, a) {
|
|
155
|
+
if (3 === o) throw Error("Generator is already running");
|
|
156
|
+
if (4 === o) {
|
|
157
|
+
if ("throw" === i) throw a;
|
|
158
|
+
return {
|
|
159
|
+
value: t,
|
|
160
|
+
done: true
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
for (n.method = i, n.arg = a;;) {
|
|
164
|
+
var u = n.delegate;
|
|
165
|
+
if (u) {
|
|
166
|
+
var c = d(u, n);
|
|
167
|
+
if (c) {
|
|
168
|
+
if (c === f) continue;
|
|
169
|
+
return c;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
173
|
+
if (1 === o) throw o = 4, n.arg;
|
|
174
|
+
n.dispatchException(n.arg);
|
|
175
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
176
|
+
o = 3;
|
|
177
|
+
var h = s(r, e, n);
|
|
178
|
+
if ("normal" === h.type) {
|
|
179
|
+
if (o = n.done ? 4 : 2, h.arg === f) continue;
|
|
180
|
+
return {
|
|
181
|
+
value: h.arg,
|
|
182
|
+
done: n.done
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
"throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}(r, n, new Context(o || [])), true), a;
|
|
159
189
|
}
|
|
160
|
-
function
|
|
190
|
+
function s(t, r, e) {
|
|
161
191
|
try {
|
|
162
192
|
return {
|
|
163
193
|
type: "normal",
|
|
164
|
-
arg: t.call(
|
|
194
|
+
arg: t.call(r, e)
|
|
165
195
|
};
|
|
166
196
|
} catch (t) {
|
|
167
197
|
return {
|
|
@@ -170,255 +200,193 @@ function _regeneratorRuntime() {
|
|
|
170
200
|
};
|
|
171
201
|
}
|
|
172
202
|
}
|
|
173
|
-
|
|
174
|
-
var
|
|
175
|
-
l = "suspendedYield",
|
|
176
|
-
f = "executing",
|
|
177
|
-
s = "completed",
|
|
178
|
-
y = {};
|
|
203
|
+
r.wrap = h;
|
|
204
|
+
var f = {};
|
|
179
205
|
function Generator() {}
|
|
180
206
|
function GeneratorFunction() {}
|
|
181
207
|
function GeneratorFunctionPrototype() {}
|
|
182
|
-
var
|
|
183
|
-
|
|
208
|
+
var l = {};
|
|
209
|
+
c(l, i, function () {
|
|
184
210
|
return this;
|
|
185
211
|
});
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
var
|
|
190
|
-
function
|
|
191
|
-
["next", "throw", "return"].forEach(function (
|
|
192
|
-
|
|
193
|
-
return this._invoke(
|
|
212
|
+
var p = Object.getPrototypeOf,
|
|
213
|
+
y = p && p(p(x([])));
|
|
214
|
+
y && y !== e && n.call(y, i) && (l = y);
|
|
215
|
+
var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
|
|
216
|
+
function g(t) {
|
|
217
|
+
["next", "throw", "return"].forEach(function (r) {
|
|
218
|
+
c(t, r, function (t) {
|
|
219
|
+
return this._invoke(r, t);
|
|
194
220
|
});
|
|
195
221
|
});
|
|
196
222
|
}
|
|
197
|
-
function AsyncIterator(t,
|
|
198
|
-
function
|
|
199
|
-
var c =
|
|
223
|
+
function AsyncIterator(t, r) {
|
|
224
|
+
function e(o, i, a, u) {
|
|
225
|
+
var c = s(t[o], t, i);
|
|
200
226
|
if ("throw" !== c.type) {
|
|
201
|
-
var
|
|
202
|
-
|
|
203
|
-
return
|
|
204
|
-
|
|
227
|
+
var h = c.arg,
|
|
228
|
+
f = h.value;
|
|
229
|
+
return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
|
|
230
|
+
e("next", t, a, u);
|
|
205
231
|
}, function (t) {
|
|
206
|
-
|
|
207
|
-
}) :
|
|
208
|
-
|
|
232
|
+
e("throw", t, a, u);
|
|
233
|
+
}) : r.resolve(f).then(function (t) {
|
|
234
|
+
h.value = t, a(h);
|
|
209
235
|
}, function (t) {
|
|
210
|
-
return
|
|
236
|
+
return e("throw", t, a, u);
|
|
211
237
|
});
|
|
212
238
|
}
|
|
213
|
-
|
|
239
|
+
u(c.arg);
|
|
214
240
|
}
|
|
215
|
-
var
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
function
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
function makeInvokeMethod(e, r, n) {
|
|
228
|
-
var o = h;
|
|
229
|
-
return function (i, a) {
|
|
230
|
-
if (o === f) throw Error("Generator is already running");
|
|
231
|
-
if (o === s) {
|
|
232
|
-
if ("throw" === i) throw a;
|
|
233
|
-
return {
|
|
234
|
-
value: t,
|
|
235
|
-
done: true
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
for (n.method = i, n.arg = a;;) {
|
|
239
|
-
var c = n.delegate;
|
|
240
|
-
if (c) {
|
|
241
|
-
var u = maybeInvokeDelegate(c, n);
|
|
242
|
-
if (u) {
|
|
243
|
-
if (u === y) continue;
|
|
244
|
-
return u;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
248
|
-
if (o === h) throw o = s, n.arg;
|
|
249
|
-
n.dispatchException(n.arg);
|
|
250
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
251
|
-
o = f;
|
|
252
|
-
var p = tryCatch(e, r, n);
|
|
253
|
-
if ("normal" === p.type) {
|
|
254
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
255
|
-
return {
|
|
256
|
-
value: p.arg,
|
|
257
|
-
done: n.done
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
241
|
+
var o;
|
|
242
|
+
c(this, "_invoke", function (t, n) {
|
|
243
|
+
function i() {
|
|
244
|
+
return new r(function (r, o) {
|
|
245
|
+
e(t, n, r, o);
|
|
246
|
+
});
|
|
261
247
|
}
|
|
262
|
-
|
|
248
|
+
return o = o ? o.then(i, i) : i();
|
|
249
|
+
}, true);
|
|
263
250
|
}
|
|
264
|
-
function
|
|
265
|
-
var n =
|
|
266
|
-
o =
|
|
267
|
-
if (o === t) return
|
|
268
|
-
var i =
|
|
269
|
-
if ("throw" === i.type) return
|
|
251
|
+
function d(r, e) {
|
|
252
|
+
var n = e.method,
|
|
253
|
+
o = r.i[n];
|
|
254
|
+
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;
|
|
255
|
+
var i = s(o, r.i, e.arg);
|
|
256
|
+
if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
|
|
270
257
|
var a = i.arg;
|
|
271
|
-
return a ? a.done ? (r
|
|
258
|
+
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);
|
|
272
259
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
tryLoc: t[0]
|
|
276
|
-
};
|
|
277
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
260
|
+
function w(t) {
|
|
261
|
+
this.tryEntries.push(t);
|
|
278
262
|
}
|
|
279
|
-
function
|
|
280
|
-
var e =
|
|
281
|
-
e.type = "normal",
|
|
263
|
+
function m(r) {
|
|
264
|
+
var e = r[4] || {};
|
|
265
|
+
e.type = "normal", e.arg = t, r[4] = e;
|
|
282
266
|
}
|
|
283
267
|
function Context(t) {
|
|
284
|
-
this.tryEntries = [
|
|
285
|
-
tryLoc: "root"
|
|
286
|
-
}], t.forEach(pushTryEntry, this), this.reset(true);
|
|
268
|
+
this.tryEntries = [[-1]], t.forEach(w, this), this.reset(true);
|
|
287
269
|
}
|
|
288
|
-
function
|
|
289
|
-
if (
|
|
290
|
-
var
|
|
291
|
-
if (
|
|
292
|
-
if ("function" == typeof
|
|
293
|
-
if (!isNaN(
|
|
270
|
+
function x(r) {
|
|
271
|
+
if (null != r) {
|
|
272
|
+
var e = r[i];
|
|
273
|
+
if (e) return e.call(r);
|
|
274
|
+
if ("function" == typeof r.next) return r;
|
|
275
|
+
if (!isNaN(r.length)) {
|
|
294
276
|
var o = -1,
|
|
295
|
-
|
|
296
|
-
for (; ++o <
|
|
297
|
-
return
|
|
277
|
+
a = function e() {
|
|
278
|
+
for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = false, e;
|
|
279
|
+
return e.value = t, e.done = true, e;
|
|
298
280
|
};
|
|
299
|
-
return
|
|
281
|
+
return a.next = a;
|
|
300
282
|
}
|
|
301
283
|
}
|
|
302
|
-
throw new TypeError(typeof
|
|
284
|
+
throw new TypeError(typeof r + " is not iterable");
|
|
303
285
|
}
|
|
304
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
311
|
-
var e = "function" == typeof t && t.constructor;
|
|
312
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
313
|
-
}, e.mark = function (t) {
|
|
314
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
315
|
-
}, e.awrap = function (t) {
|
|
286
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) {
|
|
287
|
+
var r = "function" == typeof t && t.constructor;
|
|
288
|
+
return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
|
|
289
|
+
}, r.mark = function (t) {
|
|
290
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
|
|
291
|
+
}, r.awrap = function (t) {
|
|
316
292
|
return {
|
|
317
293
|
__await: t
|
|
318
294
|
};
|
|
319
|
-
},
|
|
295
|
+
}, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
|
|
320
296
|
return this;
|
|
321
|
-
}),
|
|
297
|
+
}), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
|
|
322
298
|
void 0 === i && (i = Promise);
|
|
323
|
-
var a = new AsyncIterator(
|
|
324
|
-
return
|
|
299
|
+
var a = new AsyncIterator(h(t, e, n, o), i);
|
|
300
|
+
return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
|
|
325
301
|
return t.done ? t.value : a.next();
|
|
326
302
|
});
|
|
327
|
-
},
|
|
303
|
+
}, g(v), c(v, u, "Generator"), c(v, i, function () {
|
|
328
304
|
return this;
|
|
329
|
-
}),
|
|
305
|
+
}), c(v, "toString", function () {
|
|
330
306
|
return "[object Generator]";
|
|
331
|
-
}),
|
|
332
|
-
var
|
|
333
|
-
|
|
334
|
-
for (var n in
|
|
335
|
-
return
|
|
336
|
-
for (;
|
|
337
|
-
|
|
338
|
-
if (t in e) return next.value = t, next.done = false, next;
|
|
339
|
-
}
|
|
340
|
-
return next.done = true, next;
|
|
307
|
+
}), r.keys = function (t) {
|
|
308
|
+
var r = Object(t),
|
|
309
|
+
e = [];
|
|
310
|
+
for (var n in r) e.unshift(n);
|
|
311
|
+
return function t() {
|
|
312
|
+
for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = false, t;
|
|
313
|
+
return t.done = true, t;
|
|
341
314
|
};
|
|
342
|
-
},
|
|
315
|
+
}, r.values = x, Context.prototype = {
|
|
343
316
|
constructor: Context,
|
|
344
|
-
reset: function (
|
|
345
|
-
if (this.prev =
|
|
317
|
+
reset: function (r) {
|
|
318
|
+
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);
|
|
346
319
|
},
|
|
347
320
|
stop: function () {
|
|
348
321
|
this.done = true;
|
|
349
|
-
var t = this.tryEntries[0]
|
|
322
|
+
var t = this.tryEntries[0][4];
|
|
350
323
|
if ("throw" === t.type) throw t.arg;
|
|
351
324
|
return this.rval;
|
|
352
325
|
},
|
|
353
|
-
dispatchException: function (
|
|
354
|
-
if (this.done) throw
|
|
355
|
-
var
|
|
356
|
-
function
|
|
357
|
-
|
|
326
|
+
dispatchException: function (r) {
|
|
327
|
+
if (this.done) throw r;
|
|
328
|
+
var e = this;
|
|
329
|
+
function n(t) {
|
|
330
|
+
a.type = "throw", a.arg = r, e.next = t;
|
|
358
331
|
}
|
|
359
|
-
for (var o =
|
|
332
|
+
for (var o = e.tryEntries.length - 1; o >= 0; --o) {
|
|
360
333
|
var i = this.tryEntries[o],
|
|
361
|
-
a = i
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
371
|
-
} else {
|
|
372
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
373
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
374
|
-
}
|
|
334
|
+
a = i[4],
|
|
335
|
+
u = this.prev,
|
|
336
|
+
c = i[1],
|
|
337
|
+
h = i[2];
|
|
338
|
+
if (-1 === i[0]) return n("end"), false;
|
|
339
|
+
if (!c && !h) throw Error("try statement without catch or finally");
|
|
340
|
+
if (null != i[0] && i[0] <= u) {
|
|
341
|
+
if (u < c) return this.method = "next", this.arg = t, n(c), true;
|
|
342
|
+
if (u < h) return n(h), false;
|
|
375
343
|
}
|
|
376
344
|
}
|
|
377
345
|
},
|
|
378
|
-
abrupt: function (t,
|
|
379
|
-
for (var
|
|
380
|
-
var
|
|
381
|
-
if (
|
|
382
|
-
var
|
|
346
|
+
abrupt: function (t, r) {
|
|
347
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
348
|
+
var n = this.tryEntries[e];
|
|
349
|
+
if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
|
|
350
|
+
var o = n;
|
|
383
351
|
break;
|
|
384
352
|
}
|
|
385
353
|
}
|
|
386
|
-
|
|
387
|
-
var
|
|
388
|
-
return
|
|
354
|
+
o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
|
|
355
|
+
var i = o ? o[4] : {};
|
|
356
|
+
return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
|
|
389
357
|
},
|
|
390
|
-
complete: function (t,
|
|
358
|
+
complete: function (t, r) {
|
|
391
359
|
if ("throw" === t.type) throw t.arg;
|
|
392
|
-
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 &&
|
|
360
|
+
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;
|
|
393
361
|
},
|
|
394
362
|
finish: function (t) {
|
|
395
|
-
for (var
|
|
396
|
-
var
|
|
397
|
-
if (
|
|
363
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
364
|
+
var e = this.tryEntries[r];
|
|
365
|
+
if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
|
|
398
366
|
}
|
|
399
367
|
},
|
|
400
368
|
catch: function (t) {
|
|
401
|
-
for (var
|
|
402
|
-
var
|
|
403
|
-
if (
|
|
404
|
-
var n =
|
|
369
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
370
|
+
var e = this.tryEntries[r];
|
|
371
|
+
if (e[0] === t) {
|
|
372
|
+
var n = e[4];
|
|
405
373
|
if ("throw" === n.type) {
|
|
406
374
|
var o = n.arg;
|
|
407
|
-
|
|
375
|
+
m(e);
|
|
408
376
|
}
|
|
409
377
|
return o;
|
|
410
378
|
}
|
|
411
379
|
}
|
|
412
380
|
throw Error("illegal catch attempt");
|
|
413
381
|
},
|
|
414
|
-
delegateYield: function (
|
|
382
|
+
delegateYield: function (r, e, n) {
|
|
415
383
|
return this.delegate = {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}, "next" === this.method && (this.arg = t),
|
|
384
|
+
i: x(r),
|
|
385
|
+
r: e,
|
|
386
|
+
n: n
|
|
387
|
+
}, "next" === this.method && (this.arg = t), f;
|
|
420
388
|
}
|
|
421
|
-
},
|
|
389
|
+
}, r;
|
|
422
390
|
}
|
|
423
391
|
function _slicedToArray(r, e) {
|
|
424
392
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
@@ -690,7 +658,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
690
658
|
}
|
|
691
659
|
}, _callee6, this);
|
|
692
660
|
}));
|
|
693
|
-
function getBalanceForeignPolkadotXcm(_x9,
|
|
661
|
+
function getBalanceForeignPolkadotXcm(_x9, _x0) {
|
|
694
662
|
return _getBalanceForeignPolkadotXcm.apply(this, arguments);
|
|
695
663
|
}
|
|
696
664
|
return getBalanceForeignPolkadotXcm;
|
|
@@ -715,7 +683,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
715
683
|
}
|
|
716
684
|
}, _callee7, this);
|
|
717
685
|
}));
|
|
718
|
-
function getMythosForeignBalance(
|
|
686
|
+
function getMythosForeignBalance(_x1) {
|
|
719
687
|
return _getMythosForeignBalance.apply(this, arguments);
|
|
720
688
|
}
|
|
721
689
|
return getMythosForeignBalance;
|
|
@@ -740,7 +708,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
740
708
|
}
|
|
741
709
|
}, _callee8, this);
|
|
742
710
|
}));
|
|
743
|
-
function getAssetHubForeignBalance(
|
|
711
|
+
function getAssetHubForeignBalance(_x10, _x11) {
|
|
744
712
|
return _getAssetHubForeignBalance.apply(this, arguments);
|
|
745
713
|
}
|
|
746
714
|
return getAssetHubForeignBalance;
|
|
@@ -765,7 +733,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
765
733
|
}
|
|
766
734
|
}, _callee9, this);
|
|
767
735
|
}));
|
|
768
|
-
function getForeignAssetsByIdBalance(
|
|
736
|
+
function getForeignAssetsByIdBalance(_x12, _x13) {
|
|
769
737
|
return _getForeignAssetsByIdBalance.apply(this, arguments);
|
|
770
738
|
}
|
|
771
739
|
return getForeignAssetsByIdBalance;
|
|
@@ -773,25 +741,25 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
773
741
|
}, {
|
|
774
742
|
key: "getBalanceForeignBifrost",
|
|
775
743
|
value: function () {
|
|
776
|
-
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
744
|
+
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(address, asset) {
|
|
777
745
|
var currencySelection, response, accountData;
|
|
778
|
-
return _regeneratorRuntime().wrap(function
|
|
779
|
-
while (1) switch (
|
|
746
|
+
return _regeneratorRuntime().wrap(function _callee0$(_context0) {
|
|
747
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
780
748
|
case 0:
|
|
781
749
|
currencySelection = getNode('BifrostPolkadot').getCurrencySelection(asset);
|
|
782
|
-
|
|
750
|
+
_context0.next = 3;
|
|
783
751
|
return this.api.query.tokens.accounts(address, currencySelection);
|
|
784
752
|
case 3:
|
|
785
|
-
response =
|
|
753
|
+
response = _context0.sent;
|
|
786
754
|
accountData = response ? response : null;
|
|
787
|
-
return
|
|
755
|
+
return _context0.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
788
756
|
case 6:
|
|
789
757
|
case "end":
|
|
790
|
-
return
|
|
758
|
+
return _context0.stop();
|
|
791
759
|
}
|
|
792
|
-
},
|
|
760
|
+
}, _callee0, this);
|
|
793
761
|
}));
|
|
794
|
-
function getBalanceForeignBifrost(
|
|
762
|
+
function getBalanceForeignBifrost(_x14, _x15) {
|
|
795
763
|
return _getBalanceForeignBifrost.apply(this, arguments);
|
|
796
764
|
}
|
|
797
765
|
return getBalanceForeignBifrost;
|
|
@@ -799,26 +767,26 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
799
767
|
}, {
|
|
800
768
|
key: "getBalanceNativeAcala",
|
|
801
769
|
value: function () {
|
|
802
|
-
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
770
|
+
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(address, symbol) {
|
|
803
771
|
var response, accountData;
|
|
804
|
-
return _regeneratorRuntime().wrap(function
|
|
805
|
-
while (1) switch (
|
|
772
|
+
return _regeneratorRuntime().wrap(function _callee1$(_context1) {
|
|
773
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
806
774
|
case 0:
|
|
807
|
-
|
|
775
|
+
_context1.next = 2;
|
|
808
776
|
return this.api.query.tokens.accounts(address, {
|
|
809
777
|
Token: symbol
|
|
810
778
|
});
|
|
811
779
|
case 2:
|
|
812
|
-
response =
|
|
780
|
+
response = _context1.sent;
|
|
813
781
|
accountData = response ? response : null;
|
|
814
|
-
return
|
|
782
|
+
return _context1.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
815
783
|
case 5:
|
|
816
784
|
case "end":
|
|
817
|
-
return
|
|
785
|
+
return _context1.stop();
|
|
818
786
|
}
|
|
819
|
-
},
|
|
787
|
+
}, _callee1, this);
|
|
820
788
|
}));
|
|
821
|
-
function getBalanceNativeAcala(
|
|
789
|
+
function getBalanceNativeAcala(_x16, _x17) {
|
|
822
790
|
return _getBalanceNativeAcala.apply(this, arguments);
|
|
823
791
|
}
|
|
824
792
|
return getBalanceNativeAcala;
|
|
@@ -826,19 +794,19 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
826
794
|
}, {
|
|
827
795
|
key: "getBalanceForeignXTokens",
|
|
828
796
|
value: function () {
|
|
829
|
-
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
797
|
+
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(node, address, asset) {
|
|
830
798
|
var pallet, response, entry, accountData;
|
|
831
|
-
return _regeneratorRuntime().wrap(function
|
|
832
|
-
while (1) switch (
|
|
799
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
800
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
833
801
|
case 0:
|
|
834
802
|
pallet = 'tokens';
|
|
835
803
|
if (node === 'Centrifuge' || node === 'Altair') {
|
|
836
804
|
pallet = 'ormlTokens';
|
|
837
805
|
}
|
|
838
|
-
|
|
806
|
+
_context10.next = 4;
|
|
839
807
|
return this.api.query[pallet].accounts.entries(address);
|
|
840
808
|
case 4:
|
|
841
|
-
response =
|
|
809
|
+
response = _context10.sent;
|
|
842
810
|
entry = response.find(function (_ref2) {
|
|
843
811
|
var _asset$symbol, _asset$assetId, _assetItem$toHuman, _asset$symbol2, _assetItem$toHuman2, _asset$assetId2;
|
|
844
812
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
@@ -850,14 +818,14 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
850
818
|
return assetSymbol === ((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase()) || isForeignAsset(asset) && assetSymbol === ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.toLowerCase()) || Object.values((_assetItem$toHuman = assetItem.toHuman()) !== null && _assetItem$toHuman !== void 0 ? _assetItem$toHuman : {}).toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === void 0 ? void 0 : _asset$symbol2.toLowerCase()) || isForeignAsset(asset) && Object.values((_assetItem$toHuman2 = assetItem.toHuman()) !== null && _assetItem$toHuman2 !== void 0 ? _assetItem$toHuman2 : {}).toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === void 0 ? void 0 : _asset$assetId2.toLowerCase());
|
|
851
819
|
});
|
|
852
820
|
accountData = entry ? entry[1] : null;
|
|
853
|
-
return
|
|
821
|
+
return _context10.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
854
822
|
case 8:
|
|
855
823
|
case "end":
|
|
856
|
-
return
|
|
824
|
+
return _context10.stop();
|
|
857
825
|
}
|
|
858
|
-
},
|
|
826
|
+
}, _callee10, this);
|
|
859
827
|
}));
|
|
860
|
-
function getBalanceForeignXTokens(
|
|
828
|
+
function getBalanceForeignXTokens(_x18, _x19, _x20) {
|
|
861
829
|
return _getBalanceForeignXTokens.apply(this, arguments);
|
|
862
830
|
}
|
|
863
831
|
return getBalanceForeignXTokens;
|
|
@@ -865,24 +833,24 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
865
833
|
}, {
|
|
866
834
|
key: "getBalanceForeignAssetsAccount",
|
|
867
835
|
value: function () {
|
|
868
|
-
var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
836
|
+
var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(address, assetId) {
|
|
869
837
|
var response, obj;
|
|
870
|
-
return _regeneratorRuntime().wrap(function
|
|
871
|
-
while (1) switch (
|
|
838
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
839
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
872
840
|
case 0:
|
|
873
|
-
|
|
841
|
+
_context11.next = 2;
|
|
874
842
|
return this.api.query.assets.account(assetId, address);
|
|
875
843
|
case 2:
|
|
876
|
-
response =
|
|
844
|
+
response = _context11.sent;
|
|
877
845
|
obj = response.toJSON();
|
|
878
|
-
return
|
|
846
|
+
return _context11.abrupt("return", BigInt(obj === null || !obj.balance ? 0 : obj.balance));
|
|
879
847
|
case 5:
|
|
880
848
|
case "end":
|
|
881
|
-
return
|
|
849
|
+
return _context11.stop();
|
|
882
850
|
}
|
|
883
|
-
},
|
|
851
|
+
}, _callee11, this);
|
|
884
852
|
}));
|
|
885
|
-
function getBalanceForeignAssetsAccount(
|
|
853
|
+
function getBalanceForeignAssetsAccount(_x21, _x22) {
|
|
886
854
|
return _getBalanceForeignAssetsAccount.apply(this, arguments);
|
|
887
855
|
}
|
|
888
856
|
return getBalanceForeignAssetsAccount;
|
|
@@ -890,30 +858,30 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
890
858
|
}, {
|
|
891
859
|
key: "getFromRpc",
|
|
892
860
|
value: function () {
|
|
893
|
-
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
861
|
+
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(module, method, key) {
|
|
894
862
|
var rpcModule, response;
|
|
895
|
-
return _regeneratorRuntime().wrap(function
|
|
896
|
-
while (1) switch (
|
|
863
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
864
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
897
865
|
case 0:
|
|
898
866
|
rpcModule = this.api.rpc[module];
|
|
899
867
|
if (!(!rpcModule || !rpcModule[method])) {
|
|
900
|
-
|
|
868
|
+
_context12.next = 3;
|
|
901
869
|
break;
|
|
902
870
|
}
|
|
903
871
|
throw new Error("RPC method ".concat(module, ".").concat(method, " not available"));
|
|
904
872
|
case 3:
|
|
905
|
-
|
|
873
|
+
_context12.next = 5;
|
|
906
874
|
return rpcModule[method](key);
|
|
907
875
|
case 5:
|
|
908
|
-
response =
|
|
909
|
-
return
|
|
876
|
+
response = _context12.sent;
|
|
877
|
+
return _context12.abrupt("return", response.toHex());
|
|
910
878
|
case 7:
|
|
911
879
|
case "end":
|
|
912
|
-
return
|
|
880
|
+
return _context12.stop();
|
|
913
881
|
}
|
|
914
|
-
},
|
|
882
|
+
}, _callee12, this);
|
|
915
883
|
}));
|
|
916
|
-
function getFromRpc(
|
|
884
|
+
function getFromRpc(_x23, _x24, _x25) {
|
|
917
885
|
return _getFromRpc.apply(this, arguments);
|
|
918
886
|
}
|
|
919
887
|
return getFromRpc;
|
|
@@ -931,40 +899,40 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
931
899
|
}, {
|
|
932
900
|
key: "createApiForNode",
|
|
933
901
|
value: function () {
|
|
934
|
-
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
902
|
+
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(node) {
|
|
935
903
|
var api;
|
|
936
|
-
return _regeneratorRuntime().wrap(function
|
|
937
|
-
while (1) switch (
|
|
904
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
905
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
938
906
|
case 0:
|
|
939
907
|
api = new PolkadotJsApi();
|
|
940
|
-
|
|
908
|
+
_context13.next = 3;
|
|
941
909
|
return api.init(node);
|
|
942
910
|
case 3:
|
|
943
|
-
return
|
|
911
|
+
return _context13.abrupt("return", api);
|
|
944
912
|
case 4:
|
|
945
913
|
case "end":
|
|
946
|
-
return
|
|
914
|
+
return _context13.stop();
|
|
947
915
|
}
|
|
948
|
-
},
|
|
916
|
+
}, _callee13);
|
|
949
917
|
}));
|
|
950
|
-
function createApiForNode(
|
|
918
|
+
function createApiForNode(_x26) {
|
|
951
919
|
return _createApiForNode.apply(this, arguments);
|
|
952
920
|
}
|
|
953
921
|
return createApiForNode;
|
|
954
922
|
}()
|
|
955
923
|
}, {
|
|
956
|
-
key: "
|
|
924
|
+
key: "getDryRunCall",
|
|
957
925
|
value: function () {
|
|
958
|
-
var
|
|
926
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref4) {
|
|
959
927
|
var _this$api$call$dryRun;
|
|
960
|
-
var tx, address, node, supportsDryRunApi, isBifrost, DEFAULT_XCM_VERSION, response, result, isSuccess, moduleError, failureReason, executionFee, fee, actualWeight, weight;
|
|
961
|
-
return _regeneratorRuntime().wrap(function
|
|
962
|
-
while (1) switch (
|
|
928
|
+
var tx, address, node, supportsDryRunApi, isBifrost, DEFAULT_XCM_VERSION, response, result, resultJson, isSuccess, moduleError, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
929
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
930
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
963
931
|
case 0:
|
|
964
932
|
tx = _ref4.tx, address = _ref4.address, node = _ref4.node;
|
|
965
933
|
supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
|
|
966
934
|
if (supportsDryRunApi) {
|
|
967
|
-
|
|
935
|
+
_context14.next = 4;
|
|
968
936
|
break;
|
|
969
937
|
}
|
|
970
938
|
throw new NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
@@ -972,71 +940,166 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
972
940
|
// Bifrost requires a third parameter XCM version
|
|
973
941
|
isBifrost = node === 'BifrostPolkadot' || node === 'BifrostKusama';
|
|
974
942
|
DEFAULT_XCM_VERSION = 3;
|
|
975
|
-
|
|
943
|
+
_context14.next = 8;
|
|
976
944
|
return (_this$api$call$dryRun = this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [{
|
|
977
945
|
system: {
|
|
978
946
|
Signed: address
|
|
979
947
|
}
|
|
980
948
|
}, tx].concat(_toConsumableArray(isBifrost ? [DEFAULT_XCM_VERSION] : [])));
|
|
981
949
|
case 8:
|
|
982
|
-
response =
|
|
950
|
+
response = _context14.sent;
|
|
983
951
|
result = response.toHuman();
|
|
952
|
+
resultJson = response.toJSON();
|
|
984
953
|
isSuccess = result.Ok && result.Ok.executionResult.Ok;
|
|
985
954
|
if (isSuccess) {
|
|
986
|
-
|
|
955
|
+
_context14.next = 16;
|
|
987
956
|
break;
|
|
988
957
|
}
|
|
989
958
|
moduleError = result.Ok.executionResult.Err.error.Module;
|
|
990
959
|
failureReason = resolveModuleError(node, moduleError);
|
|
991
|
-
return
|
|
960
|
+
return _context14.abrupt("return", {
|
|
992
961
|
success: false,
|
|
993
962
|
failureReason: failureReason
|
|
994
963
|
});
|
|
995
|
-
case
|
|
996
|
-
|
|
964
|
+
case 16:
|
|
965
|
+
_context14.next = 18;
|
|
997
966
|
return this.calculateTransactionFee(tx, address);
|
|
998
|
-
case
|
|
999
|
-
executionFee =
|
|
967
|
+
case 18:
|
|
968
|
+
executionFee = _context14.sent;
|
|
1000
969
|
fee = computeFeeFromDryRunPjs(result, node, executionFee);
|
|
1001
|
-
actualWeight =
|
|
970
|
+
actualWeight = resultJson.ok.executionResult.ok.actualWeight;
|
|
1002
971
|
weight = actualWeight ? {
|
|
1003
972
|
refTime: BigInt(actualWeight.refTime),
|
|
1004
973
|
proofSize: BigInt(actualWeight.proofSize)
|
|
1005
974
|
} : undefined;
|
|
1006
|
-
|
|
975
|
+
forwardedXcms = resultJson.ok.forwardedXcms.length > 0 ? resultJson.ok.forwardedXcms[0] : [];
|
|
976
|
+
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref5) {
|
|
977
|
+
return i.Here ? 0 : (_ref5 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref5 === void 0 ? void 0 : _ref5.parachain;
|
|
978
|
+
}(Object.values(forwardedXcms[0])[0].interior);
|
|
979
|
+
return _context14.abrupt("return", {
|
|
1007
980
|
success: true,
|
|
1008
981
|
fee: fee,
|
|
1009
|
-
weight: weight
|
|
982
|
+
weight: weight,
|
|
983
|
+
forwardedXcms: forwardedXcms,
|
|
984
|
+
destParaId: destParaId
|
|
1010
985
|
});
|
|
1011
|
-
case
|
|
986
|
+
case 25:
|
|
1012
987
|
case "end":
|
|
1013
|
-
return
|
|
988
|
+
return _context14.stop();
|
|
1014
989
|
}
|
|
1015
|
-
},
|
|
990
|
+
}, _callee14, this);
|
|
991
|
+
}));
|
|
992
|
+
function getDryRunCall(_x27) {
|
|
993
|
+
return _getDryRunCall.apply(this, arguments);
|
|
994
|
+
}
|
|
995
|
+
return getDryRunCall;
|
|
996
|
+
}()
|
|
997
|
+
}, {
|
|
998
|
+
key: "getDryRunXcm",
|
|
999
|
+
value: function () {
|
|
1000
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref6) {
|
|
1001
|
+
var _ref7, _ref8, _ref9;
|
|
1002
|
+
var originLocation, xcm, node, origin, supportsDryRunApi, response, result, resultJson, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1003
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1004
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1005
|
+
case 0:
|
|
1006
|
+
originLocation = _ref6.originLocation, xcm = _ref6.xcm, node = _ref6.node, origin = _ref6.origin;
|
|
1007
|
+
supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
|
|
1008
|
+
if (supportsDryRunApi) {
|
|
1009
|
+
_context15.next = 4;
|
|
1010
|
+
break;
|
|
1011
|
+
}
|
|
1012
|
+
throw new NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
1013
|
+
case 4:
|
|
1014
|
+
_context15.next = 6;
|
|
1015
|
+
return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
|
|
1016
|
+
case 6:
|
|
1017
|
+
response = _context15.sent;
|
|
1018
|
+
result = response.toHuman();
|
|
1019
|
+
resultJson = response.toJSON();
|
|
1020
|
+
isSuccess = result.Ok && result.Ok.executionResult.Complete;
|
|
1021
|
+
if (isSuccess) {
|
|
1022
|
+
_context15.next = 13;
|
|
1023
|
+
break;
|
|
1024
|
+
}
|
|
1025
|
+
failureReason = result.Ok.executionResult.Incomplete.error;
|
|
1026
|
+
return _context15.abrupt("return", {
|
|
1027
|
+
success: false,
|
|
1028
|
+
failureReason: failureReason
|
|
1029
|
+
});
|
|
1030
|
+
case 13:
|
|
1031
|
+
emitted = result.Ok.emittedEvents; // We want to look for the last event
|
|
1032
|
+
reversedEvents = _toConsumableArray(emitted).reverse();
|
|
1033
|
+
palletsWithIssued = ['balances', 'foreignAssets', 'assets'];
|
|
1034
|
+
feeEvent = (_ref7 = (_ref8 = (_ref9 = origin === 'Mythos' ? reversedEvents.find(function (event) {
|
|
1035
|
+
return event.section === 'assetConversion' && event.method === 'SwapCreditExecuted';
|
|
1036
|
+
}) : undefined) !== null && _ref9 !== void 0 ? _ref9 :
|
|
1037
|
+
// Prefer an Issued event
|
|
1038
|
+
reversedEvents.find(function (event) {
|
|
1039
|
+
return palletsWithIssued.includes(event.section) && event.method === 'Issued';
|
|
1040
|
+
})) !== null && _ref8 !== void 0 ? _ref8 :
|
|
1041
|
+
// Fallback to Minted event
|
|
1042
|
+
reversedEvents.find(function (event) {
|
|
1043
|
+
return ['balances', 'foreignAssets'].includes(event.section) && event.method === 'Minted';
|
|
1044
|
+
})) !== null && _ref7 !== void 0 ? _ref7 : reversedEvents.find(function (event) {
|
|
1045
|
+
return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
|
|
1046
|
+
});
|
|
1047
|
+
if (feeEvent) {
|
|
1048
|
+
_context15.next = 19;
|
|
1049
|
+
break;
|
|
1050
|
+
}
|
|
1051
|
+
return _context15.abrupt("return", Promise.resolve({
|
|
1052
|
+
success: false,
|
|
1053
|
+
failureReason: 'Cannot determine destination fee. No Issued event found'
|
|
1054
|
+
}));
|
|
1055
|
+
case 19:
|
|
1056
|
+
feeAmount = feeEvent.section === 'assetConversion' ? feeEvent.data.amountIn : feeEvent.data.amount;
|
|
1057
|
+
fee = BigInt(feeAmount.replace(/,/g, ''));
|
|
1058
|
+
actualWeight = resultJson.ok.executionResult.used;
|
|
1059
|
+
weight = actualWeight ? {
|
|
1060
|
+
refTime: BigInt(actualWeight.refTime),
|
|
1061
|
+
proofSize: BigInt(actualWeight.proofSize)
|
|
1062
|
+
} : undefined;
|
|
1063
|
+
forwardedXcms = resultJson.ok.forwardedXcms.length > 0 ? resultJson.ok.forwardedXcms[0] : [];
|
|
1064
|
+
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref0) {
|
|
1065
|
+
return i.Here ? 0 : (_ref0 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref0 === void 0 ? void 0 : _ref0.parachain;
|
|
1066
|
+
}(Object.values(forwardedXcms[0])[0].interior);
|
|
1067
|
+
return _context15.abrupt("return", {
|
|
1068
|
+
success: true,
|
|
1069
|
+
fee: fee,
|
|
1070
|
+
weight: weight,
|
|
1071
|
+
forwardedXcms: forwardedXcms,
|
|
1072
|
+
destParaId: destParaId
|
|
1073
|
+
});
|
|
1074
|
+
case 26:
|
|
1075
|
+
case "end":
|
|
1076
|
+
return _context15.stop();
|
|
1077
|
+
}
|
|
1078
|
+
}, _callee15, this);
|
|
1016
1079
|
}));
|
|
1017
|
-
function
|
|
1018
|
-
return
|
|
1080
|
+
function getDryRunXcm(_x28) {
|
|
1081
|
+
return _getDryRunXcm.apply(this, arguments);
|
|
1019
1082
|
}
|
|
1020
|
-
return
|
|
1083
|
+
return getDryRunXcm;
|
|
1021
1084
|
}()
|
|
1022
1085
|
}, {
|
|
1023
1086
|
key: "getBridgeStatus",
|
|
1024
1087
|
value: function () {
|
|
1025
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1088
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1026
1089
|
var outboundOperatingMode;
|
|
1027
|
-
return _regeneratorRuntime().wrap(function
|
|
1028
|
-
while (1) switch (
|
|
1090
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1091
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1029
1092
|
case 0:
|
|
1030
|
-
|
|
1093
|
+
_context16.next = 2;
|
|
1031
1094
|
return this.api.query.ethereumOutboundQueue.operatingMode();
|
|
1032
1095
|
case 2:
|
|
1033
|
-
outboundOperatingMode =
|
|
1034
|
-
return
|
|
1096
|
+
outboundOperatingMode = _context16.sent;
|
|
1097
|
+
return _context16.abrupt("return", outboundOperatingMode.toPrimitive());
|
|
1035
1098
|
case 4:
|
|
1036
1099
|
case "end":
|
|
1037
|
-
return
|
|
1100
|
+
return _context16.stop();
|
|
1038
1101
|
}
|
|
1039
|
-
},
|
|
1102
|
+
}, _callee16, this);
|
|
1040
1103
|
}));
|
|
1041
1104
|
function getBridgeStatus() {
|
|
1042
1105
|
return _getBridgeStatus.apply(this, arguments);
|
|
@@ -1056,36 +1119,36 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1056
1119
|
}, {
|
|
1057
1120
|
key: "disconnect",
|
|
1058
1121
|
value: function () {
|
|
1059
|
-
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1122
|
+
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1060
1123
|
var force,
|
|
1061
|
-
|
|
1062
|
-
return _regeneratorRuntime().wrap(function
|
|
1063
|
-
while (1) switch (
|
|
1124
|
+
_args17 = arguments;
|
|
1125
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1126
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1064
1127
|
case 0:
|
|
1065
|
-
force =
|
|
1128
|
+
force = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : false;
|
|
1066
1129
|
if (this.initialized) {
|
|
1067
|
-
|
|
1130
|
+
_context17.next = 3;
|
|
1068
1131
|
break;
|
|
1069
1132
|
}
|
|
1070
|
-
return
|
|
1133
|
+
return _context17.abrupt("return", Promise.resolve());
|
|
1071
1134
|
case 3:
|
|
1072
1135
|
if (!(!force && !this.disconnectAllowed)) {
|
|
1073
|
-
|
|
1136
|
+
_context17.next = 5;
|
|
1074
1137
|
break;
|
|
1075
1138
|
}
|
|
1076
|
-
return
|
|
1139
|
+
return _context17.abrupt("return");
|
|
1077
1140
|
case 5:
|
|
1078
1141
|
if (!(force || typeof this._api === 'string' || this._api === undefined)) {
|
|
1079
|
-
|
|
1142
|
+
_context17.next = 8;
|
|
1080
1143
|
break;
|
|
1081
1144
|
}
|
|
1082
|
-
|
|
1145
|
+
_context17.next = 8;
|
|
1083
1146
|
return this.api.disconnect();
|
|
1084
1147
|
case 8:
|
|
1085
1148
|
case "end":
|
|
1086
|
-
return
|
|
1149
|
+
return _context17.stop();
|
|
1087
1150
|
}
|
|
1088
|
-
},
|
|
1151
|
+
}, _callee17, this);
|
|
1089
1152
|
}));
|
|
1090
1153
|
function disconnect() {
|
|
1091
1154
|
return _disconnect.apply(this, arguments);
|