@paraspell/sdk-pjs 10.3.0 → 10.3.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/dist/index.cjs +430 -666
- package/dist/index.mjs +430 -666
- package/package.json +13 -13
package/dist/index.cjs
CHANGED
|
@@ -120,274 +120,115 @@ function _objectSpread2(e) {
|
|
|
120
120
|
}
|
|
121
121
|
return e;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
function h(r, e, n, o) {
|
|
151
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
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
|
-
}
|
|
123
|
+
function _regenerator() {
|
|
124
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
125
|
+
var e,
|
|
126
|
+
t,
|
|
127
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
128
|
+
n = r.iterator || "@@iterator",
|
|
129
|
+
o = r.toStringTag || "@@toStringTag";
|
|
130
|
+
function i(r, n, o, i) {
|
|
131
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
132
|
+
u = Object.create(c.prototype);
|
|
133
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
134
|
+
var i,
|
|
135
|
+
c,
|
|
136
|
+
u,
|
|
137
|
+
f = 0,
|
|
138
|
+
p = o || [],
|
|
139
|
+
y = false,
|
|
140
|
+
G = {
|
|
141
|
+
p: 0,
|
|
142
|
+
n: 0,
|
|
143
|
+
v: e,
|
|
144
|
+
a: d,
|
|
145
|
+
f: d.bind(e, 4),
|
|
146
|
+
d: function (t, r) {
|
|
147
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
172
148
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
149
|
+
};
|
|
150
|
+
function d(r, n) {
|
|
151
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
152
|
+
var o,
|
|
153
|
+
i = p[t],
|
|
154
|
+
d = G.p,
|
|
155
|
+
l = i[2];
|
|
156
|
+
r > 3 ? (o = l === n) && (c = i[4] || 3, u = i[5] === e ? i[3] : i[5], i[4] = 3, i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
157
|
+
}
|
|
158
|
+
if (o || r > 1) return a;
|
|
159
|
+
throw y = true, n;
|
|
160
|
+
}
|
|
161
|
+
return function (o, p, l) {
|
|
162
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
163
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
164
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
165
|
+
try {
|
|
166
|
+
if (f = 2, i) {
|
|
167
|
+
if (c || (o = "next"), t = i[o]) {
|
|
168
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
169
|
+
if (!t.done) return t;
|
|
170
|
+
u = t.value, c < 2 && (c = 0);
|
|
171
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
172
|
+
i = e;
|
|
173
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
174
|
+
} catch (t) {
|
|
175
|
+
i = e, c = 1, u = t;
|
|
176
|
+
} finally {
|
|
177
|
+
f = 1;
|
|
185
178
|
}
|
|
186
|
-
"throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
|
|
187
179
|
}
|
|
180
|
+
return {
|
|
181
|
+
value: t,
|
|
182
|
+
done: y
|
|
183
|
+
};
|
|
188
184
|
};
|
|
189
|
-
}(r,
|
|
185
|
+
}(r, o, i), true), u;
|
|
190
186
|
}
|
|
191
|
-
|
|
192
|
-
try {
|
|
193
|
-
return {
|
|
194
|
-
type: "normal",
|
|
195
|
-
arg: t.call(r, e)
|
|
196
|
-
};
|
|
197
|
-
} catch (t) {
|
|
198
|
-
return {
|
|
199
|
-
type: "throw",
|
|
200
|
-
arg: t
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
r.wrap = h;
|
|
205
|
-
var f = {};
|
|
187
|
+
var a = {};
|
|
206
188
|
function Generator() {}
|
|
207
189
|
function GeneratorFunction() {}
|
|
208
190
|
function GeneratorFunctionPrototype() {}
|
|
209
|
-
|
|
210
|
-
c(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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);
|
|
221
|
-
});
|
|
222
|
-
});
|
|
191
|
+
t = Object.getPrototypeOf;
|
|
192
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
193
|
+
return this;
|
|
194
|
+
}), t),
|
|
195
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
196
|
+
function f(e) {
|
|
197
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
223
198
|
}
|
|
224
|
-
|
|
225
|
-
function e(o, i, a, u) {
|
|
226
|
-
var c = s(t[o], t, i);
|
|
227
|
-
if ("throw" !== c.type) {
|
|
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);
|
|
232
|
-
}, function (t) {
|
|
233
|
-
e("throw", t, a, u);
|
|
234
|
-
}) : r.resolve(f).then(function (t) {
|
|
235
|
-
h.value = t, a(h);
|
|
236
|
-
}, function (t) {
|
|
237
|
-
return e("throw", t, a, u);
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
u(c.arg);
|
|
241
|
-
}
|
|
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
|
-
});
|
|
248
|
-
}
|
|
249
|
-
return o = o ? o.then(i, i) : i();
|
|
250
|
-
}, true);
|
|
251
|
-
}
|
|
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;
|
|
258
|
-
var a = i.arg;
|
|
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);
|
|
260
|
-
}
|
|
261
|
-
function w(t) {
|
|
262
|
-
this.tryEntries.push(t);
|
|
263
|
-
}
|
|
264
|
-
function m(r) {
|
|
265
|
-
var e = r[4] || {};
|
|
266
|
-
e.type = "normal", e.arg = t, r[4] = e;
|
|
267
|
-
}
|
|
268
|
-
function Context(t) {
|
|
269
|
-
this.tryEntries = [[-1]], t.forEach(w, this), this.reset(true);
|
|
270
|
-
}
|
|
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)) {
|
|
277
|
-
var o = -1,
|
|
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;
|
|
281
|
-
};
|
|
282
|
-
return a.next = a;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
throw new TypeError(typeof r + " is not iterable");
|
|
286
|
-
}
|
|
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) {
|
|
293
|
-
return {
|
|
294
|
-
__await: t
|
|
295
|
-
};
|
|
296
|
-
}, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
|
|
297
|
-
return this;
|
|
298
|
-
}), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
|
|
299
|
-
void 0 === i && (i = Promise);
|
|
300
|
-
var a = new AsyncIterator(h(t, e, n, o), i);
|
|
301
|
-
return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
|
|
302
|
-
return t.done ? t.value : a.next();
|
|
303
|
-
});
|
|
304
|
-
}, g(v), c(v, u, "Generator"), c(v, i, function () {
|
|
199
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
305
200
|
return this;
|
|
306
|
-
}),
|
|
201
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
307
202
|
return "[object Generator]";
|
|
308
|
-
}),
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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;
|
|
203
|
+
}), (_regenerator = function () {
|
|
204
|
+
return {
|
|
205
|
+
w: i,
|
|
206
|
+
m: f
|
|
315
207
|
};
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
},
|
|
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;
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
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);
|
|
358
|
-
},
|
|
359
|
-
complete: function (t, r) {
|
|
360
|
-
if ("throw" === t.type) throw t.arg;
|
|
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;
|
|
362
|
-
},
|
|
363
|
-
finish: function (t) {
|
|
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;
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
catch: function (t) {
|
|
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];
|
|
374
|
-
if ("throw" === n.type) {
|
|
375
|
-
var o = n.arg;
|
|
376
|
-
m(e);
|
|
377
|
-
}
|
|
378
|
-
return o;
|
|
379
|
-
}
|
|
208
|
+
})();
|
|
209
|
+
}
|
|
210
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
211
|
+
var i = Object.defineProperty;
|
|
212
|
+
try {
|
|
213
|
+
i({}, "", {});
|
|
214
|
+
} catch (e) {
|
|
215
|
+
i = 0;
|
|
216
|
+
}
|
|
217
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
218
|
+
if (r) i ? i(e, r, {
|
|
219
|
+
value: n,
|
|
220
|
+
enumerable: !t,
|
|
221
|
+
configurable: !t,
|
|
222
|
+
writable: !t
|
|
223
|
+
}) : e[r] = n;else {
|
|
224
|
+
function o(r, n) {
|
|
225
|
+
_regeneratorDefine(e, r, function (e) {
|
|
226
|
+
return this._invoke(r, n, e);
|
|
227
|
+
});
|
|
380
228
|
}
|
|
381
|
-
|
|
382
|
-
},
|
|
383
|
-
delegateYield: function (r, e, n) {
|
|
384
|
-
return this.delegate = {
|
|
385
|
-
i: x(r),
|
|
386
|
-
r: e,
|
|
387
|
-
n: n
|
|
388
|
-
}, "next" === this.method && (this.arg = t), f;
|
|
229
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
389
230
|
}
|
|
390
|
-
}, r;
|
|
231
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
391
232
|
}
|
|
392
233
|
function _slicedToArray(r, e) {
|
|
393
234
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
@@ -458,47 +299,46 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
458
299
|
}, {
|
|
459
300
|
key: "init",
|
|
460
301
|
value: function () {
|
|
461
|
-
var _init = _asyncToGenerator(/*#__PURE__*/
|
|
462
|
-
var _this$_api;
|
|
463
|
-
return
|
|
464
|
-
while (1) switch (_context.
|
|
302
|
+
var _init = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(node, _clientTtlMs) {
|
|
303
|
+
var _this$_api, _t;
|
|
304
|
+
return _regenerator().w(function (_context) {
|
|
305
|
+
while (1) switch (_context.n) {
|
|
465
306
|
case 0:
|
|
466
307
|
if (!this.initialized) {
|
|
467
|
-
_context.
|
|
308
|
+
_context.n = 1;
|
|
468
309
|
break;
|
|
469
310
|
}
|
|
470
|
-
return _context.
|
|
471
|
-
case
|
|
311
|
+
return _context.a(2);
|
|
312
|
+
case 1:
|
|
472
313
|
if (!(typeof this._api === 'string' || this._api instanceof Array)) {
|
|
473
|
-
_context.
|
|
314
|
+
_context.n = 3;
|
|
474
315
|
break;
|
|
475
316
|
}
|
|
476
|
-
_context.
|
|
317
|
+
_context.n = 2;
|
|
477
318
|
return this.createApiInstance(this._api);
|
|
478
|
-
case
|
|
479
|
-
this.api = _context.
|
|
480
|
-
_context.
|
|
319
|
+
case 2:
|
|
320
|
+
this.api = _context.v;
|
|
321
|
+
_context.n = 7;
|
|
481
322
|
break;
|
|
482
|
-
case
|
|
323
|
+
case 3:
|
|
483
324
|
if (!((_this$_api = this._api) !== null && _this$_api !== void 0)) {
|
|
484
|
-
_context.
|
|
325
|
+
_context.n = 4;
|
|
485
326
|
break;
|
|
486
327
|
}
|
|
487
|
-
|
|
488
|
-
_context.
|
|
328
|
+
_t = _this$_api;
|
|
329
|
+
_context.n = 6;
|
|
489
330
|
break;
|
|
490
|
-
case
|
|
491
|
-
_context.
|
|
331
|
+
case 4:
|
|
332
|
+
_context.n = 5;
|
|
492
333
|
return sdkCore.createApiInstanceForNode(this, node);
|
|
493
|
-
case
|
|
494
|
-
|
|
495
|
-
case
|
|
496
|
-
this.api =
|
|
497
|
-
case
|
|
334
|
+
case 5:
|
|
335
|
+
_t = _context.v;
|
|
336
|
+
case 6:
|
|
337
|
+
this.api = _t;
|
|
338
|
+
case 7:
|
|
498
339
|
this.initialized = true;
|
|
499
|
-
case
|
|
500
|
-
|
|
501
|
-
return _context.stop();
|
|
340
|
+
case 8:
|
|
341
|
+
return _context.a(2);
|
|
502
342
|
}
|
|
503
343
|
}, _callee, this);
|
|
504
344
|
}));
|
|
@@ -510,18 +350,15 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
510
350
|
}, {
|
|
511
351
|
key: "createApiInstance",
|
|
512
352
|
value: function () {
|
|
513
|
-
var _createApiInstance = _asyncToGenerator(/*#__PURE__*/
|
|
353
|
+
var _createApiInstance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(wsUrl) {
|
|
514
354
|
var wsProvider;
|
|
515
|
-
return
|
|
516
|
-
while (1) switch (_context2.
|
|
355
|
+
return _regenerator().w(function (_context2) {
|
|
356
|
+
while (1) switch (_context2.n) {
|
|
517
357
|
case 0:
|
|
518
358
|
wsProvider = new api.WsProvider(wsUrl);
|
|
519
|
-
return _context2.
|
|
359
|
+
return _context2.a(2, api.ApiPromise.create({
|
|
520
360
|
provider: wsProvider
|
|
521
361
|
}));
|
|
522
|
-
case 2:
|
|
523
|
-
case "end":
|
|
524
|
-
return _context2.stop();
|
|
525
362
|
}
|
|
526
363
|
}, _callee2);
|
|
527
364
|
}));
|
|
@@ -579,20 +416,17 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
579
416
|
}, {
|
|
580
417
|
key: "calculateTransactionFee",
|
|
581
418
|
value: function () {
|
|
582
|
-
var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/
|
|
419
|
+
var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(tx, address) {
|
|
583
420
|
var _yield$tx$paymentInfo, partialFee;
|
|
584
|
-
return
|
|
585
|
-
while (1) switch (_context3.
|
|
421
|
+
return _regenerator().w(function (_context3) {
|
|
422
|
+
while (1) switch (_context3.n) {
|
|
586
423
|
case 0:
|
|
587
|
-
_context3.
|
|
424
|
+
_context3.n = 1;
|
|
588
425
|
return tx.paymentInfo(address);
|
|
589
|
-
case
|
|
590
|
-
_yield$tx$paymentInfo = _context3.
|
|
426
|
+
case 1:
|
|
427
|
+
_yield$tx$paymentInfo = _context3.v;
|
|
591
428
|
partialFee = _yield$tx$paymentInfo.partialFee;
|
|
592
|
-
return _context3.
|
|
593
|
-
case 5:
|
|
594
|
-
case "end":
|
|
595
|
-
return _context3.stop();
|
|
429
|
+
return _context3.a(2, partialFee.toBigInt());
|
|
596
430
|
}
|
|
597
431
|
}, _callee3);
|
|
598
432
|
}));
|
|
@@ -604,22 +438,19 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
604
438
|
}, {
|
|
605
439
|
key: "quoteAhPrice",
|
|
606
440
|
value: function () {
|
|
607
|
-
var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/
|
|
441
|
+
var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(fromMl, toMl, amountIn) {
|
|
608
442
|
var includeFee,
|
|
609
443
|
quoted,
|
|
610
444
|
_args4 = arguments;
|
|
611
|
-
return
|
|
612
|
-
while (1) switch (_context4.
|
|
445
|
+
return _regenerator().w(function (_context4) {
|
|
446
|
+
while (1) switch (_context4.n) {
|
|
613
447
|
case 0:
|
|
614
448
|
includeFee = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : true;
|
|
615
|
-
_context4.
|
|
449
|
+
_context4.n = 1;
|
|
616
450
|
return this.api.call.assetConversionApi.quotePriceExactTokensForTokens(fromMl, toMl, amountIn.toString(), includeFee);
|
|
617
|
-
case
|
|
618
|
-
quoted = _context4.
|
|
619
|
-
return _context4.
|
|
620
|
-
case 5:
|
|
621
|
-
case "end":
|
|
622
|
-
return _context4.stop();
|
|
451
|
+
case 1:
|
|
452
|
+
quoted = _context4.v;
|
|
453
|
+
return _context4.a(2, quoted.toJSON() !== null ? BigInt(quoted.toString()) : undefined);
|
|
623
454
|
}
|
|
624
455
|
}, _callee4, this);
|
|
625
456
|
}));
|
|
@@ -631,19 +462,16 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
631
462
|
}, {
|
|
632
463
|
key: "getBalanceNative",
|
|
633
464
|
value: function () {
|
|
634
|
-
var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/
|
|
465
|
+
var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(address) {
|
|
635
466
|
var response;
|
|
636
|
-
return
|
|
637
|
-
while (1) switch (_context5.
|
|
467
|
+
return _regenerator().w(function (_context5) {
|
|
468
|
+
while (1) switch (_context5.n) {
|
|
638
469
|
case 0:
|
|
639
|
-
_context5.
|
|
470
|
+
_context5.n = 1;
|
|
640
471
|
return this.api.query.system.account(address);
|
|
641
|
-
case
|
|
642
|
-
response = _context5.
|
|
643
|
-
return _context5.
|
|
644
|
-
case 4:
|
|
645
|
-
case "end":
|
|
646
|
-
return _context5.stop();
|
|
472
|
+
case 1:
|
|
473
|
+
response = _context5.v;
|
|
474
|
+
return _context5.a(2, response.data.free.toBigInt());
|
|
647
475
|
}
|
|
648
476
|
}, _callee5, this);
|
|
649
477
|
}));
|
|
@@ -655,21 +483,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
655
483
|
}, {
|
|
656
484
|
key: "getBalanceForeignPolkadotXcm",
|
|
657
485
|
value: function () {
|
|
658
|
-
var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/
|
|
486
|
+
var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(address, id) {
|
|
659
487
|
var parsedId, response, obj;
|
|
660
|
-
return
|
|
661
|
-
while (1) switch (_context6.
|
|
488
|
+
return _regenerator().w(function (_context6) {
|
|
489
|
+
while (1) switch (_context6.n) {
|
|
662
490
|
case 0:
|
|
663
491
|
parsedId = new types.u32(this.api.registry, id);
|
|
664
|
-
_context6.
|
|
492
|
+
_context6.n = 1;
|
|
665
493
|
return this.api.query.assets.account(parsedId, address);
|
|
666
|
-
case
|
|
667
|
-
response = _context6.
|
|
494
|
+
case 1:
|
|
495
|
+
response = _context6.v;
|
|
668
496
|
obj = response.toJSON();
|
|
669
|
-
return _context6.
|
|
670
|
-
case 6:
|
|
671
|
-
case "end":
|
|
672
|
-
return _context6.stop();
|
|
497
|
+
return _context6.a(2, obj.balance ? BigInt(obj.balance) : 0n);
|
|
673
498
|
}
|
|
674
499
|
}, _callee6, this);
|
|
675
500
|
}));
|
|
@@ -681,20 +506,17 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
681
506
|
}, {
|
|
682
507
|
key: "getMythosForeignBalance",
|
|
683
508
|
value: function () {
|
|
684
|
-
var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/
|
|
509
|
+
var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(address) {
|
|
685
510
|
var response, obj;
|
|
686
|
-
return
|
|
687
|
-
while (1) switch (_context7.
|
|
511
|
+
return _regenerator().w(function (_context7) {
|
|
512
|
+
while (1) switch (_context7.n) {
|
|
688
513
|
case 0:
|
|
689
|
-
_context7.
|
|
514
|
+
_context7.n = 1;
|
|
690
515
|
return this.api.query.balances.account(address);
|
|
691
|
-
case
|
|
692
|
-
response = _context7.
|
|
516
|
+
case 1:
|
|
517
|
+
response = _context7.v;
|
|
693
518
|
obj = response.toJSON();
|
|
694
|
-
return _context7.
|
|
695
|
-
case 5:
|
|
696
|
-
case "end":
|
|
697
|
-
return _context7.stop();
|
|
519
|
+
return _context7.a(2, obj.free ? BigInt(obj.free) : 0n);
|
|
698
520
|
}
|
|
699
521
|
}, _callee7, this);
|
|
700
522
|
}));
|
|
@@ -706,20 +528,17 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
706
528
|
}, {
|
|
707
529
|
key: "getBalanceForeignAssetsPallet",
|
|
708
530
|
value: function () {
|
|
709
|
-
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/
|
|
531
|
+
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(address, multiLocation) {
|
|
710
532
|
var response, obj;
|
|
711
|
-
return
|
|
712
|
-
while (1) switch (_context8.
|
|
533
|
+
return _regenerator().w(function (_context8) {
|
|
534
|
+
while (1) switch (_context8.n) {
|
|
713
535
|
case 0:
|
|
714
|
-
_context8.
|
|
536
|
+
_context8.n = 1;
|
|
715
537
|
return this.api.query.foreignAssets.account(multiLocation, address);
|
|
716
|
-
case
|
|
717
|
-
response = _context8.
|
|
538
|
+
case 1:
|
|
539
|
+
response = _context8.v;
|
|
718
540
|
obj = response.toJSON();
|
|
719
|
-
return _context8.
|
|
720
|
-
case 5:
|
|
721
|
-
case "end":
|
|
722
|
-
return _context8.stop();
|
|
541
|
+
return _context8.a(2, BigInt(obj === null || !obj.balance ? 0 : obj.balance));
|
|
723
542
|
}
|
|
724
543
|
}, _callee8, this);
|
|
725
544
|
}));
|
|
@@ -731,20 +550,17 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
731
550
|
}, {
|
|
732
551
|
key: "getForeignAssetsByIdBalance",
|
|
733
552
|
value: function () {
|
|
734
|
-
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/
|
|
553
|
+
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(address, assetId) {
|
|
735
554
|
var response, obj;
|
|
736
|
-
return
|
|
737
|
-
while (1) switch (_context9.
|
|
555
|
+
return _regenerator().w(function (_context9) {
|
|
556
|
+
while (1) switch (_context9.n) {
|
|
738
557
|
case 0:
|
|
739
|
-
_context9.
|
|
558
|
+
_context9.n = 1;
|
|
740
559
|
return this.api.query.foreignAssets.account(assetId, address);
|
|
741
|
-
case
|
|
742
|
-
response = _context9.
|
|
560
|
+
case 1:
|
|
561
|
+
response = _context9.v;
|
|
743
562
|
obj = response.toJSON();
|
|
744
|
-
return _context9.
|
|
745
|
-
case 5:
|
|
746
|
-
case "end":
|
|
747
|
-
return _context9.stop();
|
|
563
|
+
return _context9.a(2, BigInt(obj === null || !obj.balance ? 0 : obj.balance));
|
|
748
564
|
}
|
|
749
565
|
}, _callee9, this);
|
|
750
566
|
}));
|
|
@@ -756,21 +572,18 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
756
572
|
}, {
|
|
757
573
|
key: "getBalanceForeignBifrost",
|
|
758
574
|
value: function () {
|
|
759
|
-
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/
|
|
575
|
+
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(address, asset) {
|
|
760
576
|
var currencySelection, response, accountData;
|
|
761
|
-
return
|
|
762
|
-
while (1) switch (_context0.
|
|
577
|
+
return _regenerator().w(function (_context0) {
|
|
578
|
+
while (1) switch (_context0.n) {
|
|
763
579
|
case 0:
|
|
764
580
|
currencySelection = sdkCore.getNode('BifrostPolkadot').getCurrencySelection(asset);
|
|
765
|
-
_context0.
|
|
581
|
+
_context0.n = 1;
|
|
766
582
|
return this.api.query.tokens.accounts(address, currencySelection);
|
|
767
|
-
case
|
|
768
|
-
response = _context0.
|
|
583
|
+
case 1:
|
|
584
|
+
response = _context0.v;
|
|
769
585
|
accountData = response ? response : null;
|
|
770
|
-
return _context0.
|
|
771
|
-
case 6:
|
|
772
|
-
case "end":
|
|
773
|
-
return _context0.stop();
|
|
586
|
+
return _context0.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
774
587
|
}
|
|
775
588
|
}, _callee0, this);
|
|
776
589
|
}));
|
|
@@ -782,22 +595,19 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
782
595
|
}, {
|
|
783
596
|
key: "getBalanceNativeAcala",
|
|
784
597
|
value: function () {
|
|
785
|
-
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/
|
|
598
|
+
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(address, symbol) {
|
|
786
599
|
var response, accountData;
|
|
787
|
-
return
|
|
788
|
-
while (1) switch (_context1.
|
|
600
|
+
return _regenerator().w(function (_context1) {
|
|
601
|
+
while (1) switch (_context1.n) {
|
|
789
602
|
case 0:
|
|
790
|
-
_context1.
|
|
603
|
+
_context1.n = 1;
|
|
791
604
|
return this.api.query.tokens.accounts(address, {
|
|
792
605
|
Token: symbol
|
|
793
606
|
});
|
|
794
|
-
case
|
|
795
|
-
response = _context1.
|
|
607
|
+
case 1:
|
|
608
|
+
response = _context1.v;
|
|
796
609
|
accountData = response ? response : null;
|
|
797
|
-
return _context1.
|
|
798
|
-
case 5:
|
|
799
|
-
case "end":
|
|
800
|
-
return _context1.stop();
|
|
610
|
+
return _context1.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
801
611
|
}
|
|
802
612
|
}, _callee1, this);
|
|
803
613
|
}));
|
|
@@ -809,19 +619,19 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
809
619
|
}, {
|
|
810
620
|
key: "getBalanceForeignXTokens",
|
|
811
621
|
value: function () {
|
|
812
|
-
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/
|
|
622
|
+
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(node, address, asset) {
|
|
813
623
|
var pallet, response, entry, accountData;
|
|
814
|
-
return
|
|
815
|
-
while (1) switch (_context10.
|
|
624
|
+
return _regenerator().w(function (_context10) {
|
|
625
|
+
while (1) switch (_context10.n) {
|
|
816
626
|
case 0:
|
|
817
627
|
pallet = 'tokens';
|
|
818
628
|
if (node === 'Centrifuge' || node === 'Altair') {
|
|
819
629
|
pallet = 'ormlTokens';
|
|
820
630
|
}
|
|
821
|
-
_context10.
|
|
631
|
+
_context10.n = 1;
|
|
822
632
|
return this.api.query[pallet].accounts.entries(address);
|
|
823
|
-
case
|
|
824
|
-
response = _context10.
|
|
633
|
+
case 1:
|
|
634
|
+
response = _context10.v;
|
|
825
635
|
entry = response.find(function (_ref2) {
|
|
826
636
|
var _asset$symbol, _asset$assetId, _assetItem$toHuman, _asset$symbol2, _assetItem$toHuman2, _asset$assetId2;
|
|
827
637
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
@@ -833,10 +643,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
833
643
|
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());
|
|
834
644
|
});
|
|
835
645
|
accountData = entry ? entry[1] : null;
|
|
836
|
-
return _context10.
|
|
837
|
-
case 8:
|
|
838
|
-
case "end":
|
|
839
|
-
return _context10.stop();
|
|
646
|
+
return _context10.a(2, accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
840
647
|
}
|
|
841
648
|
}, _callee10, this);
|
|
842
649
|
}));
|
|
@@ -848,20 +655,17 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
848
655
|
}, {
|
|
849
656
|
key: "getBalanceAssetsPallet",
|
|
850
657
|
value: function () {
|
|
851
|
-
var _getBalanceAssetsPallet = _asyncToGenerator(/*#__PURE__*/
|
|
658
|
+
var _getBalanceAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(address, assetId) {
|
|
852
659
|
var response, obj;
|
|
853
|
-
return
|
|
854
|
-
while (1) switch (_context11.
|
|
660
|
+
return _regenerator().w(function (_context11) {
|
|
661
|
+
while (1) switch (_context11.n) {
|
|
855
662
|
case 0:
|
|
856
|
-
_context11.
|
|
663
|
+
_context11.n = 1;
|
|
857
664
|
return this.api.query.assets.account(assetId, address);
|
|
858
|
-
case
|
|
859
|
-
response = _context11.
|
|
665
|
+
case 1:
|
|
666
|
+
response = _context11.v;
|
|
860
667
|
obj = response.toJSON();
|
|
861
|
-
return _context11.
|
|
862
|
-
case 5:
|
|
863
|
-
case "end":
|
|
864
|
-
return _context11.stop();
|
|
668
|
+
return _context11.a(2, BigInt(obj === null || !obj.balance ? 0 : obj.balance));
|
|
865
669
|
}
|
|
866
670
|
}, _callee11, this);
|
|
867
671
|
}));
|
|
@@ -878,26 +682,23 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
878
682
|
}, {
|
|
879
683
|
key: "getFromRpc",
|
|
880
684
|
value: function () {
|
|
881
|
-
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/
|
|
685
|
+
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(module, method, key) {
|
|
882
686
|
var rpcModule, response;
|
|
883
|
-
return
|
|
884
|
-
while (1) switch (_context12.
|
|
687
|
+
return _regenerator().w(function (_context12) {
|
|
688
|
+
while (1) switch (_context12.n) {
|
|
885
689
|
case 0:
|
|
886
690
|
rpcModule = this.api.rpc[module];
|
|
887
691
|
if (!(!rpcModule || !rpcModule[method])) {
|
|
888
|
-
_context12.
|
|
692
|
+
_context12.n = 1;
|
|
889
693
|
break;
|
|
890
694
|
}
|
|
891
695
|
throw new sdkCore.InvalidParameterError("RPC method ".concat(module, ".").concat(method, " not available"));
|
|
892
|
-
case
|
|
893
|
-
_context12.
|
|
696
|
+
case 1:
|
|
697
|
+
_context12.n = 2;
|
|
894
698
|
return rpcModule[method](key);
|
|
895
|
-
case
|
|
896
|
-
response = _context12.
|
|
897
|
-
return _context12.
|
|
898
|
-
case 7:
|
|
899
|
-
case "end":
|
|
900
|
-
return _context12.stop();
|
|
699
|
+
case 2:
|
|
700
|
+
response = _context12.v;
|
|
701
|
+
return _context12.a(2, response.toHex());
|
|
901
702
|
}
|
|
902
703
|
}, _callee12, this);
|
|
903
704
|
}));
|
|
@@ -919,19 +720,16 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
919
720
|
}, {
|
|
920
721
|
key: "createApiForNode",
|
|
921
722
|
value: function () {
|
|
922
|
-
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/
|
|
723
|
+
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(node) {
|
|
923
724
|
var api;
|
|
924
|
-
return
|
|
925
|
-
while (1) switch (_context13.
|
|
725
|
+
return _regenerator().w(function (_context13) {
|
|
726
|
+
while (1) switch (_context13.n) {
|
|
926
727
|
case 0:
|
|
927
728
|
api = new PolkadotJsApi();
|
|
928
|
-
_context13.
|
|
729
|
+
_context13.n = 1;
|
|
929
730
|
return api.init(node);
|
|
930
|
-
case
|
|
931
|
-
return _context13.
|
|
932
|
-
case 4:
|
|
933
|
-
case "end":
|
|
934
|
-
return _context13.stop();
|
|
731
|
+
case 1:
|
|
732
|
+
return _context13.a(2, api);
|
|
935
733
|
}
|
|
936
734
|
}, _callee13);
|
|
937
735
|
}));
|
|
@@ -943,49 +741,49 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
943
741
|
}, {
|
|
944
742
|
key: "getDryRunCall",
|
|
945
743
|
value: function () {
|
|
946
|
-
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/
|
|
744
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(_ref4) {
|
|
947
745
|
var _this$api$call$dryRun;
|
|
948
746
|
var tx, address, node, supportsDryRunApi, nodesRequiringVersionParam, needsVersionParam, DEFAULT_XCM_VERSION, response, result, resultJson, isSuccess, moduleError, failureReason, executionFee, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
949
|
-
return
|
|
950
|
-
while (1) switch (_context14.
|
|
747
|
+
return _regenerator().w(function (_context14) {
|
|
748
|
+
while (1) switch (_context14.n) {
|
|
951
749
|
case 0:
|
|
952
750
|
tx = _ref4.tx, address = _ref4.address, node = _ref4.node;
|
|
953
751
|
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
954
752
|
if (supportsDryRunApi) {
|
|
955
|
-
_context14.
|
|
753
|
+
_context14.n = 1;
|
|
956
754
|
break;
|
|
957
755
|
}
|
|
958
756
|
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
959
|
-
case
|
|
757
|
+
case 1:
|
|
960
758
|
nodesRequiringVersionParam = ['BifrostPolkadot', 'BifrostKusama', 'AssetHubKusama', 'AssetHubPolkadot', 'Kusama', 'Polkadot', 'Polimec', 'Astar'];
|
|
961
759
|
needsVersionParam = nodesRequiringVersionParam.includes(node);
|
|
962
760
|
DEFAULT_XCM_VERSION = 3;
|
|
963
|
-
_context14.
|
|
761
|
+
_context14.n = 2;
|
|
964
762
|
return (_this$api$call$dryRun = this.api.call.dryRunApi).dryRunCall.apply(_this$api$call$dryRun, [{
|
|
965
763
|
system: {
|
|
966
764
|
Signed: address
|
|
967
765
|
}
|
|
968
766
|
}, tx].concat(_toConsumableArray(needsVersionParam ? [DEFAULT_XCM_VERSION] : [])));
|
|
969
|
-
case
|
|
970
|
-
response = _context14.
|
|
767
|
+
case 2:
|
|
768
|
+
response = _context14.v;
|
|
971
769
|
result = response.toHuman();
|
|
972
770
|
resultJson = response.toJSON();
|
|
973
771
|
isSuccess = result.Ok && result.Ok.executionResult.Ok;
|
|
974
772
|
if (isSuccess) {
|
|
975
|
-
_context14.
|
|
773
|
+
_context14.n = 3;
|
|
976
774
|
break;
|
|
977
775
|
}
|
|
978
776
|
moduleError = result.Ok.executionResult.Err.error.Module;
|
|
979
777
|
failureReason = sdkCore.resolveModuleError(node, moduleError);
|
|
980
|
-
return _context14.
|
|
778
|
+
return _context14.a(2, {
|
|
981
779
|
success: false,
|
|
982
780
|
failureReason: failureReason
|
|
983
781
|
});
|
|
984
|
-
case
|
|
985
|
-
_context14.
|
|
782
|
+
case 3:
|
|
783
|
+
_context14.n = 4;
|
|
986
784
|
return this.calculateTransactionFee(tx, address);
|
|
987
|
-
case
|
|
988
|
-
executionFee = _context14.
|
|
785
|
+
case 4:
|
|
786
|
+
executionFee = _context14.v;
|
|
989
787
|
fee = sdkCore.computeFeeFromDryRunPjs(result, node, executionFee);
|
|
990
788
|
actualWeight = resultJson.ok.executionResult.ok.actualWeight;
|
|
991
789
|
weight = actualWeight ? {
|
|
@@ -996,16 +794,13 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
996
794
|
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref5) {
|
|
997
795
|
return i.here === null ? 0 : (_ref5 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref5 === void 0 ? void 0 : _ref5.parachain;
|
|
998
796
|
}(Object.values(forwardedXcms[0])[0].interior);
|
|
999
|
-
return _context14.
|
|
797
|
+
return _context14.a(2, {
|
|
1000
798
|
success: true,
|
|
1001
799
|
fee: fee,
|
|
1002
800
|
weight: weight,
|
|
1003
801
|
forwardedXcms: forwardedXcms,
|
|
1004
802
|
destParaId: destParaId
|
|
1005
803
|
});
|
|
1006
|
-
case 26:
|
|
1007
|
-
case "end":
|
|
1008
|
-
return _context14.stop();
|
|
1009
804
|
}
|
|
1010
805
|
}, _callee14, this);
|
|
1011
806
|
}));
|
|
@@ -1017,37 +812,37 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1017
812
|
}, {
|
|
1018
813
|
key: "getDryRunXcm",
|
|
1019
814
|
value: function () {
|
|
1020
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/
|
|
815
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref6) {
|
|
1021
816
|
var _ref7, _ref8, _ref9;
|
|
1022
817
|
var originLocation, xcm, node, origin, supportsDryRunApi, response, result, resultJson, isSuccess, failureReason, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee, actualWeight, weight, forwardedXcms, destParaId;
|
|
1023
|
-
return
|
|
1024
|
-
while (1) switch (_context15.
|
|
818
|
+
return _regenerator().w(function (_context15) {
|
|
819
|
+
while (1) switch (_context15.n) {
|
|
1025
820
|
case 0:
|
|
1026
821
|
originLocation = _ref6.originLocation, xcm = _ref6.xcm, node = _ref6.node, origin = _ref6.origin;
|
|
1027
822
|
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
1028
823
|
if (supportsDryRunApi) {
|
|
1029
|
-
_context15.
|
|
824
|
+
_context15.n = 1;
|
|
1030
825
|
break;
|
|
1031
826
|
}
|
|
1032
827
|
throw new sdkCore.NodeNotSupportedError("DryRunApi is not available on node ".concat(node));
|
|
1033
|
-
case
|
|
1034
|
-
_context15.
|
|
828
|
+
case 1:
|
|
829
|
+
_context15.n = 2;
|
|
1035
830
|
return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
|
|
1036
|
-
case
|
|
1037
|
-
response = _context15.
|
|
831
|
+
case 2:
|
|
832
|
+
response = _context15.v;
|
|
1038
833
|
result = response.toHuman();
|
|
1039
834
|
resultJson = response.toJSON();
|
|
1040
835
|
isSuccess = result.Ok && result.Ok.executionResult.Complete;
|
|
1041
836
|
if (isSuccess) {
|
|
1042
|
-
_context15.
|
|
837
|
+
_context15.n = 3;
|
|
1043
838
|
break;
|
|
1044
839
|
}
|
|
1045
840
|
failureReason = result.Ok.executionResult.Incomplete.error;
|
|
1046
|
-
return _context15.
|
|
841
|
+
return _context15.a(2, {
|
|
1047
842
|
success: false,
|
|
1048
843
|
failureReason: failureReason
|
|
1049
844
|
});
|
|
1050
|
-
case
|
|
845
|
+
case 3:
|
|
1051
846
|
emitted = result.Ok.emittedEvents; // We want to look for the last event
|
|
1052
847
|
reversedEvents = _toConsumableArray(emitted).reverse();
|
|
1053
848
|
palletsWithIssued = ['balances', 'foreignAssets', 'assets'];
|
|
@@ -1065,14 +860,14 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1065
860
|
return ['currencies', 'tokens'].includes(event.section) && event.method === 'Deposited';
|
|
1066
861
|
});
|
|
1067
862
|
if (feeEvent) {
|
|
1068
|
-
_context15.
|
|
863
|
+
_context15.n = 4;
|
|
1069
864
|
break;
|
|
1070
865
|
}
|
|
1071
|
-
return _context15.
|
|
866
|
+
return _context15.a(2, Promise.resolve({
|
|
1072
867
|
success: false,
|
|
1073
868
|
failureReason: 'Cannot determine destination fee. No Issued event found'
|
|
1074
869
|
}));
|
|
1075
|
-
case
|
|
870
|
+
case 4:
|
|
1076
871
|
feeAmount = feeEvent.section === 'assetConversion' ? feeEvent.data.amountIn : feeEvent.data.amount;
|
|
1077
872
|
fee = BigInt(feeAmount.replace(/,/g, ''));
|
|
1078
873
|
actualWeight = resultJson.ok.executionResult.used;
|
|
@@ -1084,16 +879,13 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1084
879
|
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref0) {
|
|
1085
880
|
return i.Here ? 0 : (_ref0 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref0 === void 0 ? void 0 : _ref0.parachain;
|
|
1086
881
|
}(Object.values(forwardedXcms[0])[0].interior);
|
|
1087
|
-
return _context15.
|
|
882
|
+
return _context15.a(2, {
|
|
1088
883
|
success: true,
|
|
1089
884
|
fee: fee,
|
|
1090
885
|
weight: weight,
|
|
1091
886
|
forwardedXcms: forwardedXcms,
|
|
1092
887
|
destParaId: destParaId
|
|
1093
888
|
});
|
|
1094
|
-
case 26:
|
|
1095
|
-
case "end":
|
|
1096
|
-
return _context15.stop();
|
|
1097
889
|
}
|
|
1098
890
|
}, _callee15, this);
|
|
1099
891
|
}));
|
|
@@ -1105,19 +897,16 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1105
897
|
}, {
|
|
1106
898
|
key: "getBridgeStatus",
|
|
1107
899
|
value: function () {
|
|
1108
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/
|
|
900
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
1109
901
|
var outboundOperatingMode;
|
|
1110
|
-
return
|
|
1111
|
-
while (1) switch (_context16.
|
|
902
|
+
return _regenerator().w(function (_context16) {
|
|
903
|
+
while (1) switch (_context16.n) {
|
|
1112
904
|
case 0:
|
|
1113
|
-
_context16.
|
|
905
|
+
_context16.n = 1;
|
|
1114
906
|
return this.api.query.ethereumOutboundQueue.operatingMode();
|
|
1115
|
-
case
|
|
1116
|
-
outboundOperatingMode = _context16.
|
|
1117
|
-
return _context16.
|
|
1118
|
-
case 4:
|
|
1119
|
-
case "end":
|
|
1120
|
-
return _context16.stop();
|
|
907
|
+
case 1:
|
|
908
|
+
outboundOperatingMode = _context16.v;
|
|
909
|
+
return _context16.a(2, outboundOperatingMode.toPrimitive());
|
|
1121
910
|
}
|
|
1122
911
|
}, _callee16, this);
|
|
1123
912
|
}));
|
|
@@ -1139,34 +928,33 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1139
928
|
}, {
|
|
1140
929
|
key: "disconnect",
|
|
1141
930
|
value: function () {
|
|
1142
|
-
var _disconnect = _asyncToGenerator(/*#__PURE__*/
|
|
931
|
+
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
|
|
1143
932
|
var force,
|
|
1144
933
|
_args17 = arguments;
|
|
1145
|
-
return
|
|
1146
|
-
while (1) switch (_context17.
|
|
934
|
+
return _regenerator().w(function (_context17) {
|
|
935
|
+
while (1) switch (_context17.n) {
|
|
1147
936
|
case 0:
|
|
1148
937
|
force = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : false;
|
|
1149
938
|
if (this.initialized) {
|
|
1150
|
-
_context17.
|
|
939
|
+
_context17.n = 1;
|
|
1151
940
|
break;
|
|
1152
941
|
}
|
|
1153
|
-
return _context17.
|
|
1154
|
-
case
|
|
942
|
+
return _context17.a(2, Promise.resolve());
|
|
943
|
+
case 1:
|
|
1155
944
|
if (!(!force && !this.disconnectAllowed)) {
|
|
1156
|
-
_context17.
|
|
945
|
+
_context17.n = 2;
|
|
1157
946
|
break;
|
|
1158
947
|
}
|
|
1159
|
-
return _context17.
|
|
1160
|
-
case
|
|
948
|
+
return _context17.a(2);
|
|
949
|
+
case 2:
|
|
1161
950
|
if (!(force || typeof this._api === 'string' || this._api === undefined)) {
|
|
1162
|
-
_context17.
|
|
951
|
+
_context17.n = 3;
|
|
1163
952
|
break;
|
|
1164
953
|
}
|
|
1165
|
-
_context17.
|
|
954
|
+
_context17.n = 3;
|
|
1166
955
|
return this.api.disconnect();
|
|
1167
|
-
case
|
|
1168
|
-
|
|
1169
|
-
return _context17.stop();
|
|
956
|
+
case 3:
|
|
957
|
+
return _context17.a(2);
|
|
1170
958
|
}
|
|
1171
959
|
}, _callee17, this);
|
|
1172
960
|
}));
|
|
@@ -1184,20 +972,17 @@ var createApiInstanceForNode = function createApiInstanceForNode(node) {
|
|
|
1184
972
|
};
|
|
1185
973
|
var createPolkadotJsApiCall = function createPolkadotJsApiCall(apiCall) {
|
|
1186
974
|
return /*#__PURE__*/function () {
|
|
1187
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
975
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
1188
976
|
var pjsApi, optionsWithApi;
|
|
1189
|
-
return
|
|
1190
|
-
while (1) switch (_context.
|
|
977
|
+
return _regenerator().w(function (_context) {
|
|
978
|
+
while (1) switch (_context.n) {
|
|
1191
979
|
case 0:
|
|
1192
980
|
pjsApi = new PolkadotJsApi();
|
|
1193
981
|
pjsApi.setApi(options.api);
|
|
1194
982
|
optionsWithApi = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1195
983
|
api: pjsApi
|
|
1196
984
|
});
|
|
1197
|
-
return _context.
|
|
1198
|
-
case 4:
|
|
1199
|
-
case "end":
|
|
1200
|
-
return _context.stop();
|
|
985
|
+
return _context.a(2, apiCall(optionsWithApi));
|
|
1201
986
|
}
|
|
1202
987
|
}, _callee);
|
|
1203
988
|
}));
|
|
@@ -1277,37 +1062,34 @@ var convertSs58 = function convertSs58(address, node) {
|
|
|
1277
1062
|
};
|
|
1278
1063
|
|
|
1279
1064
|
var approveToken = /*#__PURE__*/function () {
|
|
1280
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
1065
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(signer, amount, symbol) {
|
|
1281
1066
|
var env, contract, weth9, result, receipt;
|
|
1282
|
-
return
|
|
1283
|
-
while (1) switch (_context.
|
|
1067
|
+
return _regenerator().w(function (_context) {
|
|
1068
|
+
while (1) switch (_context.n) {
|
|
1284
1069
|
case 0:
|
|
1285
1070
|
env = api$1.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
1286
1071
|
contract = env.locations[0].erc20tokensReceivable.find(function (t) {
|
|
1287
1072
|
return t.id === symbol;
|
|
1288
1073
|
});
|
|
1289
1074
|
if (contract) {
|
|
1290
|
-
_context.
|
|
1075
|
+
_context.n = 1;
|
|
1291
1076
|
break;
|
|
1292
1077
|
}
|
|
1293
1078
|
throw new sdkCore.InvalidParameterError("Token ".concat(symbol, " not supported"));
|
|
1294
|
-
case
|
|
1079
|
+
case 1:
|
|
1295
1080
|
weth9 = contractTypes.WETH9__factory.connect(contract.address, signer);
|
|
1296
|
-
_context.
|
|
1081
|
+
_context.n = 2;
|
|
1297
1082
|
return weth9.approve(env.config.GATEWAY_CONTRACT, amount);
|
|
1298
|
-
case
|
|
1299
|
-
result = _context.
|
|
1300
|
-
_context.
|
|
1083
|
+
case 2:
|
|
1084
|
+
result = _context.v;
|
|
1085
|
+
_context.n = 3;
|
|
1301
1086
|
return result.wait();
|
|
1302
|
-
case
|
|
1303
|
-
receipt = _context.
|
|
1304
|
-
return _context.
|
|
1087
|
+
case 3:
|
|
1088
|
+
receipt = _context.v;
|
|
1089
|
+
return _context.a(2, {
|
|
1305
1090
|
result: result,
|
|
1306
1091
|
receipt: receipt
|
|
1307
1092
|
});
|
|
1308
|
-
case 12:
|
|
1309
|
-
case "end":
|
|
1310
|
-
return _context.stop();
|
|
1311
1093
|
}
|
|
1312
1094
|
}, _callee);
|
|
1313
1095
|
}));
|
|
@@ -1317,39 +1099,36 @@ var approveToken = /*#__PURE__*/function () {
|
|
|
1317
1099
|
}();
|
|
1318
1100
|
|
|
1319
1101
|
var depositToken = /*#__PURE__*/function () {
|
|
1320
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
1102
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(signer, amount, symbol) {
|
|
1321
1103
|
var env, contract, weth9, result, receipt;
|
|
1322
|
-
return
|
|
1323
|
-
while (1) switch (_context.
|
|
1104
|
+
return _regenerator().w(function (_context) {
|
|
1105
|
+
while (1) switch (_context.n) {
|
|
1324
1106
|
case 0:
|
|
1325
1107
|
env = api$1.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
1326
1108
|
contract = env.locations[0].erc20tokensReceivable.find(function (t) {
|
|
1327
1109
|
return t.id === symbol;
|
|
1328
1110
|
});
|
|
1329
1111
|
if (contract) {
|
|
1330
|
-
_context.
|
|
1112
|
+
_context.n = 1;
|
|
1331
1113
|
break;
|
|
1332
1114
|
}
|
|
1333
1115
|
throw new sdkCore.InvalidParameterError("Token ".concat(symbol, " not supported"));
|
|
1334
|
-
case
|
|
1116
|
+
case 1:
|
|
1335
1117
|
weth9 = contractTypes.WETH9__factory.connect(contract.address, signer);
|
|
1336
|
-
_context.
|
|
1118
|
+
_context.n = 2;
|
|
1337
1119
|
return weth9.deposit({
|
|
1338
1120
|
value: amount
|
|
1339
1121
|
});
|
|
1340
|
-
case
|
|
1341
|
-
result = _context.
|
|
1342
|
-
_context.
|
|
1122
|
+
case 2:
|
|
1123
|
+
result = _context.v;
|
|
1124
|
+
_context.n = 3;
|
|
1343
1125
|
return result.wait();
|
|
1344
|
-
case
|
|
1345
|
-
receipt = _context.
|
|
1346
|
-
return _context.
|
|
1126
|
+
case 3:
|
|
1127
|
+
receipt = _context.v;
|
|
1128
|
+
return _context.a(2, {
|
|
1347
1129
|
result: result,
|
|
1348
1130
|
receipt: receipt
|
|
1349
1131
|
});
|
|
1350
|
-
case 12:
|
|
1351
|
-
case "end":
|
|
1352
|
-
return _context.stop();
|
|
1353
1132
|
}
|
|
1354
1133
|
}, _callee);
|
|
1355
1134
|
}));
|
|
@@ -1391,52 +1170,52 @@ var createContext = function createContext(executionUrl, env) {
|
|
|
1391
1170
|
* @throws Will throw an error if the transfer validation fails or if the transfer cannot be completed.
|
|
1392
1171
|
*/
|
|
1393
1172
|
var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
1394
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
1395
|
-
var provider, signer, address, to, currency, ethAsset, env, context, destParaId, overrides, registry, fee, sourceAddress, transfer, validation, tx, response, receipt, messageReceipt;
|
|
1396
|
-
return
|
|
1397
|
-
while (1) switch (_context.
|
|
1173
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
1174
|
+
var provider, signer, address, to, currency, ethAsset, env, context, destParaId, overrides, registry, fee, sourceAddress, transfer, validation, tx, response, receipt, messageReceipt, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20, _t21, _t22, _t23;
|
|
1175
|
+
return _regenerator().w(function (_context) {
|
|
1176
|
+
while (1) switch (_context.n) {
|
|
1398
1177
|
case 0:
|
|
1399
1178
|
provider = _ref.provider, signer = _ref.signer, address = _ref.address, to = _ref.to, currency = _ref.currency;
|
|
1400
1179
|
if (!('multiasset' in currency)) {
|
|
1401
|
-
_context.
|
|
1180
|
+
_context.n = 1;
|
|
1402
1181
|
break;
|
|
1403
1182
|
}
|
|
1404
1183
|
throw new sdkCore.InvalidParameterError('Multiassets syntax is not supported for Evm transfers');
|
|
1405
|
-
case
|
|
1184
|
+
case 1:
|
|
1406
1185
|
if (!('multilocation' in currency && sdkCore.isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
1407
|
-
_context.
|
|
1186
|
+
_context.n = 2;
|
|
1408
1187
|
break;
|
|
1409
1188
|
}
|
|
1410
1189
|
throw new sdkCore.InvalidParameterError('Override multilocation is not supported for Evm transfers');
|
|
1411
|
-
case
|
|
1190
|
+
case 2:
|
|
1412
1191
|
if (provider) {
|
|
1413
|
-
_context.
|
|
1192
|
+
_context.n = 3;
|
|
1414
1193
|
break;
|
|
1415
1194
|
}
|
|
1416
1195
|
throw new sdkCore.InvalidParameterError('provider parameter is required for Snowbridge transfers.');
|
|
1417
|
-
case
|
|
1196
|
+
case 3:
|
|
1418
1197
|
if (isEthersSigner(signer)) {
|
|
1419
|
-
_context.
|
|
1198
|
+
_context.n = 4;
|
|
1420
1199
|
break;
|
|
1421
1200
|
}
|
|
1422
1201
|
throw new sdkCore.InvalidParameterError('Snowbridge does not support Viem provider yet.');
|
|
1423
|
-
case
|
|
1202
|
+
case 4:
|
|
1424
1203
|
ethAsset = sdkCore.findAsset('Ethereum', currency, to);
|
|
1425
1204
|
if (!(ethAsset === null)) {
|
|
1426
|
-
_context.
|
|
1205
|
+
_context.n = 5;
|
|
1427
1206
|
break;
|
|
1428
1207
|
}
|
|
1429
1208
|
throw new sdkCore.InvalidCurrencyError("Origin node Ethereum does not support currency ".concat(JSON.stringify(currency), "."));
|
|
1430
|
-
case
|
|
1209
|
+
case 5:
|
|
1431
1210
|
env = api$1.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
1432
1211
|
context = createContext(provider, env);
|
|
1433
1212
|
destParaId = sdkCore.getParaId(to);
|
|
1434
1213
|
if (!(!sdkCore.isForeignAsset(ethAsset) || ethAsset.assetId === undefined)) {
|
|
1435
|
-
_context.
|
|
1214
|
+
_context.n = 6;
|
|
1436
1215
|
break;
|
|
1437
1216
|
}
|
|
1438
1217
|
throw new sdkCore.InvalidCurrencyError('Selected asset has no asset id');
|
|
1439
|
-
case
|
|
1218
|
+
case 6:
|
|
1440
1219
|
overrides = {
|
|
1441
1220
|
precompiles: {
|
|
1442
1221
|
'2004': '0x000000000000000000000000000000000000081A'
|
|
@@ -1455,92 +1234,92 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1455
1234
|
}]
|
|
1456
1235
|
}
|
|
1457
1236
|
};
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
_context.
|
|
1237
|
+
_t = api$1.assetsV2;
|
|
1238
|
+
_t2 = _objectSpread2;
|
|
1239
|
+
_t3 = _objectSpread2;
|
|
1240
|
+
_t4 = {};
|
|
1241
|
+
_context.n = 7;
|
|
1463
1242
|
return api$1.assetsV2.fromContext(context);
|
|
1464
|
-
case
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
_context.
|
|
1470
|
-
return
|
|
1471
|
-
case
|
|
1472
|
-
registry = _context.
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
_context.
|
|
1243
|
+
case 7:
|
|
1244
|
+
_t5 = _context.v;
|
|
1245
|
+
_t6 = _t3(_t4, _t5);
|
|
1246
|
+
_t7 = overrides;
|
|
1247
|
+
_t8 = _t2(_t6, _t7);
|
|
1248
|
+
_context.n = 8;
|
|
1249
|
+
return _t.buildRegistry.call(_t, _t8);
|
|
1250
|
+
case 8:
|
|
1251
|
+
registry = _context.v;
|
|
1252
|
+
_t9 = api$1.toPolkadotV2;
|
|
1253
|
+
_t0 = context.gateway();
|
|
1254
|
+
_context.n = 9;
|
|
1476
1255
|
return context.assetHub();
|
|
1477
|
-
case
|
|
1478
|
-
|
|
1479
|
-
_context.
|
|
1256
|
+
case 9:
|
|
1257
|
+
_t1 = _context.v;
|
|
1258
|
+
_context.n = 10;
|
|
1480
1259
|
return context.parachain(destParaId);
|
|
1481
|
-
case
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
gateway:
|
|
1485
|
-
assetHub:
|
|
1486
|
-
destination:
|
|
1260
|
+
case 10:
|
|
1261
|
+
_t10 = _context.v;
|
|
1262
|
+
_t11 = {
|
|
1263
|
+
gateway: _t0,
|
|
1264
|
+
assetHub: _t1,
|
|
1265
|
+
destination: _t10
|
|
1487
1266
|
};
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
_context.
|
|
1492
|
-
return
|
|
1493
|
-
case
|
|
1494
|
-
fee = _context.
|
|
1495
|
-
_context.
|
|
1267
|
+
_t12 = registry;
|
|
1268
|
+
_t13 = ethAsset.assetId;
|
|
1269
|
+
_t14 = destParaId;
|
|
1270
|
+
_context.n = 11;
|
|
1271
|
+
return _t9.getDeliveryFee.call(_t9, _t11, _t12, _t13, _t14);
|
|
1272
|
+
case 11:
|
|
1273
|
+
fee = _context.v;
|
|
1274
|
+
_context.n = 12;
|
|
1496
1275
|
return signer.getAddress();
|
|
1497
|
-
case
|
|
1498
|
-
sourceAddress = _context.
|
|
1499
|
-
_context.
|
|
1276
|
+
case 12:
|
|
1277
|
+
sourceAddress = _context.v;
|
|
1278
|
+
_context.n = 13;
|
|
1500
1279
|
return api$1.toPolkadotV2.createTransfer(registry, sourceAddress, address, ethAsset.assetId, destParaId, BigInt(currency.amount), fee);
|
|
1501
|
-
case
|
|
1502
|
-
transfer = _context.
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
_context.
|
|
1280
|
+
case 13:
|
|
1281
|
+
transfer = _context.v;
|
|
1282
|
+
_t15 = api$1.toPolkadotV2;
|
|
1283
|
+
_t16 = context.ethereum();
|
|
1284
|
+
_t17 = context.gateway();
|
|
1285
|
+
_context.n = 14;
|
|
1507
1286
|
return context.bridgeHub();
|
|
1508
|
-
case
|
|
1509
|
-
|
|
1510
|
-
_context.
|
|
1287
|
+
case 14:
|
|
1288
|
+
_t18 = _context.v;
|
|
1289
|
+
_context.n = 15;
|
|
1511
1290
|
return context.assetHub();
|
|
1512
|
-
case
|
|
1513
|
-
|
|
1291
|
+
case 15:
|
|
1292
|
+
_t19 = _context.v;
|
|
1514
1293
|
if (!(destParaId !== sdkCore.getParaId('AssetHubPolkadot'))) {
|
|
1515
|
-
_context.
|
|
1294
|
+
_context.n = 17;
|
|
1516
1295
|
break;
|
|
1517
1296
|
}
|
|
1518
|
-
_context.
|
|
1297
|
+
_context.n = 16;
|
|
1519
1298
|
return context.parachain(destParaId);
|
|
1520
|
-
case
|
|
1521
|
-
|
|
1522
|
-
_context.
|
|
1299
|
+
case 16:
|
|
1300
|
+
_t20 = _context.v;
|
|
1301
|
+
_context.n = 18;
|
|
1523
1302
|
break;
|
|
1524
|
-
case
|
|
1525
|
-
|
|
1526
|
-
case
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
ethereum:
|
|
1530
|
-
gateway:
|
|
1531
|
-
bridgeHub:
|
|
1532
|
-
assetHub:
|
|
1533
|
-
destParachain:
|
|
1303
|
+
case 17:
|
|
1304
|
+
_t20 = undefined;
|
|
1305
|
+
case 18:
|
|
1306
|
+
_t21 = _t20;
|
|
1307
|
+
_t22 = {
|
|
1308
|
+
ethereum: _t16,
|
|
1309
|
+
gateway: _t17,
|
|
1310
|
+
bridgeHub: _t18,
|
|
1311
|
+
assetHub: _t19,
|
|
1312
|
+
destParachain: _t21
|
|
1534
1313
|
};
|
|
1535
|
-
|
|
1536
|
-
_context.
|
|
1537
|
-
return
|
|
1538
|
-
case
|
|
1539
|
-
validation = _context.
|
|
1314
|
+
_t23 = transfer;
|
|
1315
|
+
_context.n = 19;
|
|
1316
|
+
return _t15.validateTransfer.call(_t15, _t22, _t23);
|
|
1317
|
+
case 19:
|
|
1318
|
+
validation = _context.v;
|
|
1540
1319
|
if (!validation.logs.find(function (l) {
|
|
1541
1320
|
return l.kind == api$1.toPolkadotV2.ValidationKind.Error;
|
|
1542
1321
|
})) {
|
|
1543
|
-
_context.
|
|
1322
|
+
_context.n = 20;
|
|
1544
1323
|
break;
|
|
1545
1324
|
}
|
|
1546
1325
|
throw new sdkCore.InvalidParameterError("Validation failed with following errors: \n\n ".concat(validation.logs.filter(function (l) {
|
|
@@ -1548,39 +1327,36 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1548
1327
|
}).map(function (l) {
|
|
1549
1328
|
return l.message;
|
|
1550
1329
|
}).join('\n\n')));
|
|
1551
|
-
case
|
|
1330
|
+
case 20:
|
|
1552
1331
|
tx = transfer.tx;
|
|
1553
|
-
_context.
|
|
1332
|
+
_context.n = 21;
|
|
1554
1333
|
return signer.sendTransaction(tx);
|
|
1555
|
-
case
|
|
1556
|
-
response = _context.
|
|
1557
|
-
_context.
|
|
1334
|
+
case 21:
|
|
1335
|
+
response = _context.v;
|
|
1336
|
+
_context.n = 22;
|
|
1558
1337
|
return response.wait(1);
|
|
1559
|
-
case
|
|
1560
|
-
receipt = _context.
|
|
1338
|
+
case 22:
|
|
1339
|
+
receipt = _context.v;
|
|
1561
1340
|
if (receipt) {
|
|
1562
|
-
_context.
|
|
1341
|
+
_context.n = 23;
|
|
1563
1342
|
break;
|
|
1564
1343
|
}
|
|
1565
1344
|
throw new sdkCore.InvalidParameterError("Transaction ".concat(response.hash, " not included."));
|
|
1566
|
-
case
|
|
1567
|
-
_context.
|
|
1345
|
+
case 23:
|
|
1346
|
+
_context.n = 24;
|
|
1568
1347
|
return api$1.toPolkadotV2.getMessageReceipt(receipt);
|
|
1569
|
-
case
|
|
1570
|
-
messageReceipt = _context.
|
|
1348
|
+
case 24:
|
|
1349
|
+
messageReceipt = _context.v;
|
|
1571
1350
|
if (messageReceipt) {
|
|
1572
|
-
_context.
|
|
1351
|
+
_context.n = 25;
|
|
1573
1352
|
break;
|
|
1574
1353
|
}
|
|
1575
1354
|
throw new sdkCore.InvalidParameterError("Transaction ".concat(receipt.hash, " did not emit a message."));
|
|
1576
|
-
case
|
|
1577
|
-
return _context.
|
|
1355
|
+
case 25:
|
|
1356
|
+
return _context.a(2, {
|
|
1578
1357
|
response: response,
|
|
1579
1358
|
messageReceipt: messageReceipt
|
|
1580
1359
|
});
|
|
1581
|
-
case 91:
|
|
1582
|
-
case "end":
|
|
1583
|
-
return _context.stop();
|
|
1584
1360
|
}
|
|
1585
1361
|
}, _callee);
|
|
1586
1362
|
}));
|
|
@@ -1590,30 +1366,27 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1590
1366
|
}();
|
|
1591
1367
|
|
|
1592
1368
|
var getTokenBalance = /*#__PURE__*/function () {
|
|
1593
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
1369
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(signer, symbol) {
|
|
1594
1370
|
var env, contract, weth9, address;
|
|
1595
|
-
return
|
|
1596
|
-
while (1) switch (_context.
|
|
1371
|
+
return _regenerator().w(function (_context) {
|
|
1372
|
+
while (1) switch (_context.n) {
|
|
1597
1373
|
case 0:
|
|
1598
1374
|
env = api$1.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
1599
1375
|
contract = env.locations[0].erc20tokensReceivable.find(function (t) {
|
|
1600
1376
|
return t.id === symbol;
|
|
1601
1377
|
});
|
|
1602
1378
|
if (contract) {
|
|
1603
|
-
_context.
|
|
1379
|
+
_context.n = 1;
|
|
1604
1380
|
break;
|
|
1605
1381
|
}
|
|
1606
1382
|
throw new sdkCore.InvalidParameterError("Token ".concat(symbol, " not supported"));
|
|
1607
|
-
case
|
|
1383
|
+
case 1:
|
|
1608
1384
|
weth9 = contractTypes.WETH9__factory.connect(contract.address, signer);
|
|
1609
|
-
_context.
|
|
1385
|
+
_context.n = 2;
|
|
1610
1386
|
return signer.getAddress();
|
|
1611
|
-
case
|
|
1612
|
-
address = _context.
|
|
1613
|
-
return _context.
|
|
1614
|
-
case 9:
|
|
1615
|
-
case "end":
|
|
1616
|
-
return _context.stop();
|
|
1387
|
+
case 2:
|
|
1388
|
+
address = _context.v;
|
|
1389
|
+
return _context.a(2, weth9.balanceOf(address));
|
|
1617
1390
|
}
|
|
1618
1391
|
}, _callee);
|
|
1619
1392
|
}));
|
|
@@ -1710,50 +1483,47 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1710
1483
|
}, {
|
|
1711
1484
|
key: "build",
|
|
1712
1485
|
value: (function () {
|
|
1713
|
-
var _build = _asyncToGenerator(/*#__PURE__*/
|
|
1486
|
+
var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1714
1487
|
var _this$_options, from, to, address, signer, _yield$transferEthToP, response;
|
|
1715
|
-
return
|
|
1716
|
-
while (1) switch (_context.
|
|
1488
|
+
return _regenerator().w(function (_context) {
|
|
1489
|
+
while (1) switch (_context.n) {
|
|
1717
1490
|
case 0:
|
|
1718
1491
|
_this$_options = this._options, from = _this$_options.from, to = _this$_options.to, address = _this$_options.address, signer = _this$_options.signer;
|
|
1719
1492
|
sdkCore.validateAddress(address, to);
|
|
1720
1493
|
if (!(from === 'Moonbeam' && to === 'Ethereum')) {
|
|
1721
|
-
_context.
|
|
1494
|
+
_context.n = 2;
|
|
1722
1495
|
break;
|
|
1723
1496
|
}
|
|
1724
1497
|
if (!isEthersSigner(signer)) {
|
|
1725
|
-
_context.
|
|
1498
|
+
_context.n = 1;
|
|
1726
1499
|
break;
|
|
1727
1500
|
}
|
|
1728
1501
|
throw new sdkCore.InvalidParameterError('Ethers signer is not supported for Moonbeam to Ethereum transfers.');
|
|
1729
|
-
case
|
|
1730
|
-
return _context.
|
|
1502
|
+
case 1:
|
|
1503
|
+
return _context.a(2, sdkCore.transferMoonbeamToEth(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1731
1504
|
signer: signer
|
|
1732
1505
|
})));
|
|
1733
|
-
case
|
|
1506
|
+
case 2:
|
|
1734
1507
|
if (!(from === 'Moonbeam' || from === 'Moonriver' || from === 'Darwinia')) {
|
|
1735
|
-
_context.
|
|
1508
|
+
_context.n = 4;
|
|
1736
1509
|
break;
|
|
1737
1510
|
}
|
|
1738
1511
|
if (!isEthersSigner(signer)) {
|
|
1739
|
-
_context.
|
|
1512
|
+
_context.n = 3;
|
|
1740
1513
|
break;
|
|
1741
1514
|
}
|
|
1742
1515
|
throw new sdkCore.InvalidParameterError('Ethers signer is not supported for Moonbeam to Ethereum transfers.');
|
|
1743
|
-
case
|
|
1744
|
-
return _context.
|
|
1516
|
+
case 3:
|
|
1517
|
+
return _context.a(2, sdkCore.transferMoonbeamEvm(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1745
1518
|
signer: signer
|
|
1746
1519
|
})));
|
|
1747
|
-
case
|
|
1748
|
-
_context.
|
|
1520
|
+
case 4:
|
|
1521
|
+
_context.n = 5;
|
|
1749
1522
|
return transferEthToPolkadot$1(this._options);
|
|
1750
|
-
case
|
|
1751
|
-
_yield$transferEthToP = _context.
|
|
1523
|
+
case 5:
|
|
1524
|
+
_yield$transferEthToP = _context.v;
|
|
1752
1525
|
response = _yield$transferEthToP.response;
|
|
1753
|
-
return _context.
|
|
1754
|
-
case 17:
|
|
1755
|
-
case "end":
|
|
1756
|
-
return _context.stop();
|
|
1526
|
+
return _context.a(2, response.hash);
|
|
1757
1527
|
}
|
|
1758
1528
|
}, _callee, this);
|
|
1759
1529
|
}));
|
|
@@ -1807,20 +1577,17 @@ var transferEthToPolkadot = function transferEthToPolkadot(options) {
|
|
|
1807
1577
|
}));
|
|
1808
1578
|
};
|
|
1809
1579
|
var getParaEthTransferFees = /*#__PURE__*/function () {
|
|
1810
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
1580
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api) {
|
|
1811
1581
|
var pjsApi;
|
|
1812
|
-
return
|
|
1813
|
-
while (1) switch (_context.
|
|
1582
|
+
return _regenerator().w(function (_context) {
|
|
1583
|
+
while (1) switch (_context.n) {
|
|
1814
1584
|
case 0:
|
|
1815
1585
|
pjsApi = new PolkadotJsApi();
|
|
1816
1586
|
pjsApi.setApi(api);
|
|
1817
|
-
_context.
|
|
1587
|
+
_context.n = 1;
|
|
1818
1588
|
return pjsApi.init('AssetHubPolkadot', sdkCore.DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
1819
|
-
case
|
|
1820
|
-
return _context.
|
|
1821
|
-
case 5:
|
|
1822
|
-
case "end":
|
|
1823
|
-
return _context.stop();
|
|
1589
|
+
case 1:
|
|
1590
|
+
return _context.a(2, sdkCore.getParaEthTransferFees(pjsApi));
|
|
1824
1591
|
}
|
|
1825
1592
|
}, _callee);
|
|
1826
1593
|
}));
|
|
@@ -1832,17 +1599,14 @@ var getParaEthTransferFees = /*#__PURE__*/function () {
|
|
|
1832
1599
|
* Gets the Ethereum bridge status.
|
|
1833
1600
|
*/
|
|
1834
1601
|
var getBridgeStatus = /*#__PURE__*/function () {
|
|
1835
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
1602
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api) {
|
|
1836
1603
|
var pjsApi;
|
|
1837
|
-
return
|
|
1838
|
-
while (1) switch (_context2.
|
|
1604
|
+
return _regenerator().w(function (_context2) {
|
|
1605
|
+
while (1) switch (_context2.n) {
|
|
1839
1606
|
case 0:
|
|
1840
1607
|
pjsApi = new PolkadotJsApi();
|
|
1841
1608
|
pjsApi.setApi(api);
|
|
1842
|
-
return _context2.
|
|
1843
|
-
case 3:
|
|
1844
|
-
case "end":
|
|
1845
|
-
return _context2.stop();
|
|
1609
|
+
return _context2.a(2, sdkCore.getBridgeStatus(pjsApi));
|
|
1846
1610
|
}
|
|
1847
1611
|
}, _callee2);
|
|
1848
1612
|
}));
|