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