@paraspell/sdk-core 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.
Files changed (4) hide show
  1. package/dist/index.cjs +1359 -662
  2. package/dist/index.d.ts +168 -21
  3. package/dist/index.mjs +1358 -664
  4. package/package.json +14 -14
package/dist/index.cjs CHANGED
@@ -228,47 +228,77 @@ function _possibleConstructorReturn(t, e) {
228
228
  }
229
229
  function _regeneratorRuntime() {
230
230
  _regeneratorRuntime = function () {
231
- return e;
231
+ return r;
232
232
  };
233
233
  var t,
234
- e = {},
235
- r = Object.prototype,
236
- n = r.hasOwnProperty,
237
- o = Object.defineProperty || function (t, e, r) {
238
- t[e] = r.value;
239
- },
240
- i = "function" == typeof Symbol ? Symbol : {},
241
- a = i.iterator || "@@iterator",
242
- c = i.asyncIterator || "@@asyncIterator",
243
- u = i.toStringTag || "@@toStringTag";
244
- function define(t, e, r) {
245
- return Object.defineProperty(t, e, {
246
- value: r,
247
- enumerable: true,
248
- configurable: true,
249
- writable: true
250
- }), t[e];
234
+ r = {},
235
+ e = Object.prototype,
236
+ n = e.hasOwnProperty,
237
+ o = "function" == typeof Symbol ? Symbol : {},
238
+ i = o.iterator || "@@iterator",
239
+ a = o.asyncIterator || "@@asyncIterator",
240
+ u = o.toStringTag || "@@toStringTag";
241
+ function c(t, r, e, n) {
242
+ return Object.defineProperty(t, r, {
243
+ value: e,
244
+ enumerable: !n,
245
+ configurable: !n,
246
+ writable: !n
247
+ });
251
248
  }
252
249
  try {
253
- define({}, "");
250
+ c({}, "");
254
251
  } catch (t) {
255
- define = function (t, e, r) {
256
- return t[e] = r;
252
+ c = function (t, r, e) {
253
+ return t[r] = e;
257
254
  };
258
255
  }
259
- function wrap(t, e, r, n) {
256
+ function h(r, e, n, o) {
260
257
  var i = e && e.prototype instanceof Generator ? e : Generator,
261
- a = Object.create(i.prototype),
262
- c = new Context(n || []);
263
- return o(a, "_invoke", {
264
- value: makeInvokeMethod(t, r, c)
265
- }), a;
258
+ a = Object.create(i.prototype);
259
+ return c(a, "_invoke", function (r, e, n) {
260
+ var o = 1;
261
+ return function (i, a) {
262
+ if (3 === o) throw Error("Generator is already running");
263
+ if (4 === o) {
264
+ if ("throw" === i) throw a;
265
+ return {
266
+ value: t,
267
+ done: true
268
+ };
269
+ }
270
+ for (n.method = i, n.arg = a;;) {
271
+ var u = n.delegate;
272
+ if (u) {
273
+ var c = d(u, n);
274
+ if (c) {
275
+ if (c === f) continue;
276
+ return c;
277
+ }
278
+ }
279
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
280
+ if (1 === o) throw o = 4, n.arg;
281
+ n.dispatchException(n.arg);
282
+ } else "return" === n.method && n.abrupt("return", n.arg);
283
+ o = 3;
284
+ var h = s(r, e, n);
285
+ if ("normal" === h.type) {
286
+ if (o = n.done ? 4 : 2, h.arg === f) continue;
287
+ return {
288
+ value: h.arg,
289
+ done: n.done
290
+ };
291
+ }
292
+ "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
293
+ }
294
+ };
295
+ }(r, n, new Context(o || [])), true), a;
266
296
  }
267
- function tryCatch(t, e, r) {
297
+ function s(t, r, e) {
268
298
  try {
269
299
  return {
270
300
  type: "normal",
271
- arg: t.call(e, r)
301
+ arg: t.call(r, e)
272
302
  };
273
303
  } catch (t) {
274
304
  return {
@@ -277,255 +307,193 @@ function _regeneratorRuntime() {
277
307
  };
278
308
  }
279
309
  }
280
- e.wrap = wrap;
281
- var h = "suspendedStart",
282
- l = "suspendedYield",
283
- f = "executing",
284
- s = "completed",
285
- y = {};
310
+ r.wrap = h;
311
+ var f = {};
286
312
  function Generator() {}
287
313
  function GeneratorFunction() {}
288
314
  function GeneratorFunctionPrototype() {}
289
- var p = {};
290
- define(p, a, function () {
315
+ var l = {};
316
+ c(l, i, function () {
291
317
  return this;
292
318
  });
293
- var d = Object.getPrototypeOf,
294
- v = d && d(d(values([])));
295
- v && v !== r && n.call(v, a) && (p = v);
296
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
297
- function defineIteratorMethods(t) {
298
- ["next", "throw", "return"].forEach(function (e) {
299
- define(t, e, function (t) {
300
- return this._invoke(e, t);
319
+ var p = Object.getPrototypeOf,
320
+ y = p && p(p(x([])));
321
+ y && y !== e && n.call(y, i) && (l = y);
322
+ var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
323
+ function g(t) {
324
+ ["next", "throw", "return"].forEach(function (r) {
325
+ c(t, r, function (t) {
326
+ return this._invoke(r, t);
301
327
  });
302
328
  });
303
329
  }
304
- function AsyncIterator(t, e) {
305
- function invoke(r, o, i, a) {
306
- var c = tryCatch(t[r], t, o);
330
+ function AsyncIterator(t, r) {
331
+ function e(o, i, a, u) {
332
+ var c = s(t[o], t, i);
307
333
  if ("throw" !== c.type) {
308
- var u = c.arg,
309
- h = u.value;
310
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
311
- invoke("next", t, i, a);
334
+ var h = c.arg,
335
+ f = h.value;
336
+ return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
337
+ e("next", t, a, u);
312
338
  }, function (t) {
313
- invoke("throw", t, i, a);
314
- }) : e.resolve(h).then(function (t) {
315
- u.value = t, i(u);
339
+ e("throw", t, a, u);
340
+ }) : r.resolve(f).then(function (t) {
341
+ h.value = t, a(h);
316
342
  }, function (t) {
317
- return invoke("throw", t, i, a);
343
+ return e("throw", t, a, u);
318
344
  });
319
345
  }
320
- a(c.arg);
346
+ u(c.arg);
321
347
  }
322
- var r;
323
- o(this, "_invoke", {
324
- value: function (t, n) {
325
- function callInvokeWithMethodAndArg() {
326
- return new e(function (e, r) {
327
- invoke(t, n, e, r);
328
- });
329
- }
330
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
331
- }
332
- });
333
- }
334
- function makeInvokeMethod(e, r, n) {
335
- var o = h;
336
- return function (i, a) {
337
- if (o === f) throw Error("Generator is already running");
338
- if (o === s) {
339
- if ("throw" === i) throw a;
340
- return {
341
- value: t,
342
- done: true
343
- };
344
- }
345
- for (n.method = i, n.arg = a;;) {
346
- var c = n.delegate;
347
- if (c) {
348
- var u = maybeInvokeDelegate(c, n);
349
- if (u) {
350
- if (u === y) continue;
351
- return u;
352
- }
353
- }
354
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
355
- if (o === h) throw o = s, n.arg;
356
- n.dispatchException(n.arg);
357
- } else "return" === n.method && n.abrupt("return", n.arg);
358
- o = f;
359
- var p = tryCatch(e, r, n);
360
- if ("normal" === p.type) {
361
- if (o = n.done ? s : l, p.arg === y) continue;
362
- return {
363
- value: p.arg,
364
- done: n.done
365
- };
366
- }
367
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
348
+ var o;
349
+ c(this, "_invoke", function (t, n) {
350
+ function i() {
351
+ return new r(function (r, o) {
352
+ e(t, n, r, o);
353
+ });
368
354
  }
369
- };
355
+ return o = o ? o.then(i, i) : i();
356
+ }, true);
370
357
  }
371
- function maybeInvokeDelegate(e, r) {
372
- var n = r.method,
373
- o = e.iterator[n];
374
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
375
- var i = tryCatch(o, e.iterator, r.arg);
376
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
358
+ function d(r, e) {
359
+ var n = e.method,
360
+ o = r.i[n];
361
+ 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;
362
+ var i = s(o, r.i, e.arg);
363
+ if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
377
364
  var a = i.arg;
378
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
365
+ 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);
379
366
  }
380
- function pushTryEntry(t) {
381
- var e = {
382
- tryLoc: t[0]
383
- };
384
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
367
+ function w(t) {
368
+ this.tryEntries.push(t);
385
369
  }
386
- function resetTryEntry(t) {
387
- var e = t.completion || {};
388
- e.type = "normal", delete e.arg, t.completion = e;
370
+ function m(r) {
371
+ var e = r[4] || {};
372
+ e.type = "normal", e.arg = t, r[4] = e;
389
373
  }
390
374
  function Context(t) {
391
- this.tryEntries = [{
392
- tryLoc: "root"
393
- }], t.forEach(pushTryEntry, this), this.reset(true);
394
- }
395
- function values(e) {
396
- if (e || "" === e) {
397
- var r = e[a];
398
- if (r) return r.call(e);
399
- if ("function" == typeof e.next) return e;
400
- if (!isNaN(e.length)) {
375
+ this.tryEntries = [[-1]], t.forEach(w, this), this.reset(true);
376
+ }
377
+ function x(r) {
378
+ if (null != r) {
379
+ var e = r[i];
380
+ if (e) return e.call(r);
381
+ if ("function" == typeof r.next) return r;
382
+ if (!isNaN(r.length)) {
401
383
  var o = -1,
402
- i = function next() {
403
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
404
- return next.value = t, next.done = true, next;
384
+ a = function e() {
385
+ for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = false, e;
386
+ return e.value = t, e.done = true, e;
405
387
  };
406
- return i.next = i;
407
- }
408
- }
409
- throw new TypeError(typeof e + " is not iterable");
410
- }
411
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
412
- value: GeneratorFunctionPrototype,
413
- configurable: true
414
- }), o(GeneratorFunctionPrototype, "constructor", {
415
- value: GeneratorFunction,
416
- configurable: true
417
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
418
- var e = "function" == typeof t && t.constructor;
419
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
420
- }, e.mark = function (t) {
421
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
422
- }, e.awrap = function (t) {
388
+ return a.next = a;
389
+ }
390
+ }
391
+ throw new TypeError(typeof r + " is not iterable");
392
+ }
393
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) {
394
+ var r = "function" == typeof t && t.constructor;
395
+ return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
396
+ }, r.mark = function (t) {
397
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
398
+ }, r.awrap = function (t) {
423
399
  return {
424
400
  __await: t
425
401
  };
426
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
402
+ }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
427
403
  return this;
428
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
404
+ }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
429
405
  void 0 === i && (i = Promise);
430
- var a = new AsyncIterator(wrap(t, r, n, o), i);
431
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
406
+ var a = new AsyncIterator(h(t, e, n, o), i);
407
+ return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
432
408
  return t.done ? t.value : a.next();
433
409
  });
434
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
410
+ }, g(v), c(v, u, "Generator"), c(v, i, function () {
435
411
  return this;
436
- }), define(g, "toString", function () {
412
+ }), c(v, "toString", function () {
437
413
  return "[object Generator]";
438
- }), e.keys = function (t) {
439
- var e = Object(t),
440
- r = [];
441
- for (var n in e) r.push(n);
442
- return r.reverse(), function next() {
443
- for (; r.length;) {
444
- var t = r.pop();
445
- if (t in e) return next.value = t, next.done = false, next;
446
- }
447
- return next.done = true, next;
414
+ }), r.keys = function (t) {
415
+ var r = Object(t),
416
+ e = [];
417
+ for (var n in r) e.unshift(n);
418
+ return function t() {
419
+ for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = false, t;
420
+ return t.done = true, t;
448
421
  };
449
- }, e.values = values, Context.prototype = {
422
+ }, r.values = x, Context.prototype = {
450
423
  constructor: Context,
451
- reset: function (e) {
452
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
424
+ reset: function (r) {
425
+ 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);
453
426
  },
454
427
  stop: function () {
455
428
  this.done = true;
456
- var t = this.tryEntries[0].completion;
429
+ var t = this.tryEntries[0][4];
457
430
  if ("throw" === t.type) throw t.arg;
458
431
  return this.rval;
459
432
  },
460
- dispatchException: function (e) {
461
- if (this.done) throw e;
462
- var r = this;
463
- function handle(n, o) {
464
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
433
+ dispatchException: function (r) {
434
+ if (this.done) throw r;
435
+ var e = this;
436
+ function n(t) {
437
+ a.type = "throw", a.arg = r, e.next = t;
465
438
  }
466
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
439
+ for (var o = e.tryEntries.length - 1; o >= 0; --o) {
467
440
  var i = this.tryEntries[o],
468
- a = i.completion;
469
- if ("root" === i.tryLoc) return handle("end");
470
- if (i.tryLoc <= this.prev) {
471
- var c = n.call(i, "catchLoc"),
472
- u = n.call(i, "finallyLoc");
473
- if (c && u) {
474
- if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
475
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
476
- } else if (c) {
477
- if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
478
- } else {
479
- if (!u) throw Error("try statement without catch or finally");
480
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
481
- }
441
+ a = i[4],
442
+ u = this.prev,
443
+ c = i[1],
444
+ h = i[2];
445
+ if (-1 === i[0]) return n("end"), false;
446
+ if (!c && !h) throw Error("try statement without catch or finally");
447
+ if (null != i[0] && i[0] <= u) {
448
+ if (u < c) return this.method = "next", this.arg = t, n(c), true;
449
+ if (u < h) return n(h), false;
482
450
  }
483
451
  }
484
452
  },
485
- abrupt: function (t, e) {
486
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
487
- var o = this.tryEntries[r];
488
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
489
- var i = o;
453
+ abrupt: function (t, r) {
454
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
455
+ var n = this.tryEntries[e];
456
+ if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
457
+ var o = n;
490
458
  break;
491
459
  }
492
460
  }
493
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
494
- var a = i ? i.completion : {};
495
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
461
+ o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
462
+ var i = o ? o[4] : {};
463
+ return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
496
464
  },
497
- complete: function (t, e) {
465
+ complete: function (t, r) {
498
466
  if ("throw" === t.type) throw t.arg;
499
- 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 && e && (this.next = e), y;
467
+ 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;
500
468
  },
501
469
  finish: function (t) {
502
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
503
- var r = this.tryEntries[e];
504
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
470
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
471
+ var e = this.tryEntries[r];
472
+ if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
505
473
  }
506
474
  },
507
475
  catch: function (t) {
508
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
509
- var r = this.tryEntries[e];
510
- if (r.tryLoc === t) {
511
- var n = r.completion;
476
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
477
+ var e = this.tryEntries[r];
478
+ if (e[0] === t) {
479
+ var n = e[4];
512
480
  if ("throw" === n.type) {
513
481
  var o = n.arg;
514
- resetTryEntry(r);
482
+ m(e);
515
483
  }
516
484
  return o;
517
485
  }
518
486
  }
519
487
  throw Error("illegal catch attempt");
520
488
  },
521
- delegateYield: function (e, r, n) {
489
+ delegateYield: function (r, e, n) {
522
490
  return this.delegate = {
523
- iterator: values(e),
524
- resultName: r,
525
- nextLoc: n
526
- }, "next" === this.method && (this.arg = t), y;
491
+ i: x(r),
492
+ r: e,
493
+ n: n
494
+ }, "next" === this.method && (this.arg = t), f;
527
495
  }
528
- }, e;
496
+ }, r;
529
497
  }
530
498
  function _setPrototypeOf(t, e) {
531
499
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
@@ -824,6 +792,168 @@ var AssetClaimBuilder = /*#__PURE__*/function () {
824
792
  }]);
825
793
  }();
826
794
 
795
+ /**
796
+ * Error thrown when the Ethereum bridge is halted.
797
+ */
798
+ var BridgeHaltedError = /*#__PURE__*/function (_Error) {
799
+ /**
800
+ * Constructs a new BridgeHaltedError.
801
+ *
802
+ * @param message - Optional custom error message.
803
+ */
804
+ function BridgeHaltedError() {
805
+ var _this;
806
+ _classCallCheck(this, BridgeHaltedError);
807
+ _this = _callSuper(this, BridgeHaltedError, ['Bridge operations have been paused by onchain governance.']);
808
+ _this.name = 'BridgeHaltedError';
809
+ return _this;
810
+ }
811
+ _inherits(BridgeHaltedError, _Error);
812
+ return _createClass(BridgeHaltedError);
813
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
814
+
815
+ /**
816
+ * Error thrown when the Dry Run fails.
817
+ */
818
+ var DryRunFailedError = /*#__PURE__*/function (_Error) {
819
+ /**
820
+ * Constructs a new DryRunFailedError.
821
+ *
822
+ * @param message - Optional custom error message.
823
+ */
824
+ function DryRunFailedError(reason) {
825
+ var _this;
826
+ _classCallCheck(this, DryRunFailedError);
827
+ _this = _callSuper(this, DryRunFailedError, ["Dry run failed: ".concat(reason)]);
828
+ _this.name = 'DryRunFailedError';
829
+ return _this;
830
+ }
831
+ _inherits(DryRunFailedError, _Error);
832
+ return _createClass(DryRunFailedError);
833
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
834
+
835
+ /**
836
+ * Error thrown when nodes from different relay chains are incompatible.
837
+ */
838
+ var IncompatibleNodesError = /*#__PURE__*/function (_Error) {
839
+ /**
840
+ * Constructs a new IncompatibleNodesError.
841
+ *
842
+ * @param message - Optional custom error message.
843
+ */
844
+ function IncompatibleNodesError(message) {
845
+ var _this;
846
+ _classCallCheck(this, IncompatibleNodesError);
847
+ _this = _callSuper(this, IncompatibleNodesError, [message !== null && message !== void 0 ? message : 'Transactions between nodes on different relaychains are not yet possible.']);
848
+ _this.name = 'IncompatibleNodes';
849
+ return _this;
850
+ }
851
+ _inherits(IncompatibleNodesError, _Error);
852
+ return _createClass(IncompatibleNodesError);
853
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
854
+
855
+ /**
856
+ * Error thrown when an invalid address is provided.
857
+ */
858
+ var InvalidAddressError = /*#__PURE__*/function (_Error) {
859
+ /**
860
+ * Constructs a new InvalidAddressError.
861
+ *
862
+ * @param message - The error message.
863
+ */
864
+ function InvalidAddressError(message) {
865
+ var _this;
866
+ _classCallCheck(this, InvalidAddressError);
867
+ _this = _callSuper(this, InvalidAddressError, [message]);
868
+ _this.name = 'InvalidAddressError';
869
+ return _this;
870
+ }
871
+ _inherits(InvalidAddressError, _Error);
872
+ return _createClass(InvalidAddressError);
873
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
874
+
875
+ /**
876
+ * Error thrown when the Dry Run fails.
877
+ */
878
+ var InvalidParameterError = /*#__PURE__*/function (_Error) {
879
+ /**
880
+ * Constructs a new InvalidParameterError.
881
+ *
882
+ * @param message - Required error message.
883
+ */
884
+ function InvalidParameterError(message) {
885
+ var _this;
886
+ _classCallCheck(this, InvalidParameterError);
887
+ _this = _callSuper(this, InvalidParameterError, [message]);
888
+ _this.name = 'InvalidParameterError';
889
+ return _this;
890
+ }
891
+ _inherits(InvalidParameterError, _Error);
892
+ return _createClass(InvalidParameterError);
893
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
894
+
895
+ /**
896
+ * Used to inform user, that Parachain they wish to use is not supported yet
897
+ */
898
+ var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
899
+ /**
900
+ * Constructs a new NodeNotSupportedError.
901
+ *
902
+ * @param message - Optional custom error message.
903
+ */
904
+ function NodeNotSupportedError(message) {
905
+ var _this;
906
+ _classCallCheck(this, NodeNotSupportedError);
907
+ _this = _callSuper(this, NodeNotSupportedError, [message !== null && message !== void 0 ? message : 'These nodes do not support XCM transfers from Relay / to Relay chain.']);
908
+ _this.name = 'NodeNotSupported';
909
+ return _this;
910
+ }
911
+ _inherits(NodeNotSupportedError, _Error);
912
+ return _createClass(NodeNotSupportedError);
913
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
914
+
915
+ /**
916
+ * Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
917
+ */
918
+ var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
919
+ /**
920
+ * Constructs a new NoXCMSupportImplementedError.
921
+ *
922
+ * @param node - The node for which XCM support is not implemented.
923
+ */
924
+ function NoXCMSupportImplementedError(node) {
925
+ var _this;
926
+ _classCallCheck(this, NoXCMSupportImplementedError);
927
+ _this = _callSuper(this, NoXCMSupportImplementedError, ["No XCM support implemented for ".concat(node, " node yet.")]);
928
+ _this.name = 'NoXCMSupportImplemented';
929
+ return _this;
930
+ }
931
+ _inherits(NoXCMSupportImplementedError, _Error);
932
+ return _createClass(NoXCMSupportImplementedError);
933
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
934
+
935
+ /**
936
+ * Used to inform user, that Parachain they wish to use does not support scenario they wish to use yet
937
+ */
938
+ var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
939
+ /**
940
+ * Constructs a new ScenarioNotSupportedError.
941
+ *
942
+ * @param node - The node where the scenario is not supported.
943
+ * @param scenario - The scenario that is not supported.
944
+ * @param message - Optional custom error message.
945
+ */
946
+ function ScenarioNotSupportedError(node, scenario, message) {
947
+ var _this;
948
+ _classCallCheck(this, ScenarioNotSupportedError);
949
+ _this = _callSuper(this, ScenarioNotSupportedError, [message !== null && message !== void 0 ? message : "Scenario ".concat(scenario, " not supported for node ").concat(node)]);
950
+ _this.name = 'ScenarioNotSupported';
951
+ return _this;
952
+ }
953
+ _inherits(ScenarioNotSupportedError, _Error);
954
+ return _createClass(ScenarioNotSupportedError);
955
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
956
+
827
957
  var DEFAULT_FEE_ASSET = 0;
828
958
  var ETH_PARA_ID = 1;
829
959
  var ETH_CHAIN_ID = BigInt(ETH_PARA_ID);
@@ -841,6 +971,7 @@ var DOT_MULTILOCATION = {
841
971
  var SYSTEM_NODES_POLKADOT = ['PeoplePolkadot', 'CoretimePolkadot', 'Collectives'];
842
972
  var SYSTEM_NODES_KUSAMA = ['PeopleKusama', 'CoretimeKusama'];
843
973
  var ASSET_HUB_EXECUTION_FEE = 2200000000n; // 0.22 DOT
974
+ // 30% padding
844
975
 
845
976
  var AssetHubPolkadot$1 = {
846
977
  name: "AssetHub",
@@ -924,6 +1055,25 @@ var Acala$1 = {
924
1055
  }
925
1056
  ]
926
1057
  };
1058
+ var Ajuna$1 = {
1059
+ name: "Ajuna Network",
1060
+ info: "ajuna",
1061
+ paraId: 2051,
1062
+ providers: [
1063
+ {
1064
+ name: "AjunaNetwork",
1065
+ endpoint: "wss://rpc-para.ajuna.network"
1066
+ },
1067
+ {
1068
+ name: "IBP1",
1069
+ endpoint: "wss://ajuna.ibp.network"
1070
+ },
1071
+ {
1072
+ name: "IBP2",
1073
+ endpoint: "wss://ajuna.dotters.network"
1074
+ }
1075
+ ]
1076
+ };
927
1077
  var Astar$1 = {
928
1078
  name: "Astar",
929
1079
  info: "astar",
@@ -1080,10 +1230,6 @@ var Centrifuge$1 = {
1080
1230
  name: "Centrifuge",
1081
1231
  endpoint: "wss://fullnode.centrifuge.io"
1082
1232
  },
1083
- {
1084
- name: "Dwellir",
1085
- endpoint: "wss://centrifuge-rpc.dwellir.com"
1086
- },
1087
1233
  {
1088
1234
  name: "LuckyFriday",
1089
1235
  endpoint: "wss://rpc-centrifuge.luckyfriday.io"
@@ -1102,10 +1248,6 @@ var ComposableFinance$1 = {
1102
1248
  {
1103
1249
  name: "Composable",
1104
1250
  endpoint: "wss://rpc.composable.finance"
1105
- },
1106
- {
1107
- name: "Dwellir",
1108
- endpoint: "wss://composable-rpc.dwellir.com"
1109
1251
  }
1110
1252
  ]
1111
1253
  };
@@ -1156,10 +1298,6 @@ var Interlay$1 = {
1156
1298
  info: "interlay",
1157
1299
  paraId: 2032,
1158
1300
  providers: [
1159
- {
1160
- name: "Dwellir",
1161
- endpoint: "wss://interlay-rpc.dwellir.com"
1162
- },
1163
1301
  {
1164
1302
  name: "Kintsugi Labs",
1165
1303
  endpoint: "wss://api.interlay.io/parachain"
@@ -1274,7 +1412,7 @@ var CoretimeKusama$1 = {
1274
1412
  providers: [
1275
1413
  {
1276
1414
  name: "Dwellir",
1277
- endpoint: "wss://coretime-kusama-rpc.dwellir.com"
1415
+ endpoint: "wss://coretime-kusama-rpc.n.dwellir.com"
1278
1416
  },
1279
1417
  {
1280
1418
  name: "IBP1",
@@ -1288,6 +1426,10 @@ var CoretimeKusama$1 = {
1288
1426
  name: "LuckyFriday",
1289
1427
  endpoint: "wss://rpc-coretime-kusama.luckyfriday.io"
1290
1428
  },
1429
+ {
1430
+ name: "OnFinality",
1431
+ endpoint: "wss://coretime-kusama.api.onfinality.io/public-ws"
1432
+ },
1291
1433
  {
1292
1434
  name: "Parity",
1293
1435
  endpoint: "wss://kusama-coretime-rpc.polkadot.io"
@@ -1303,6 +1445,10 @@ var CoretimePolkadot$1 = {
1303
1445
  info: "polkadotCoretime",
1304
1446
  paraId: 1005,
1305
1447
  providers: [
1448
+ {
1449
+ name: "Dwellir",
1450
+ endpoint: "wss://coretime-polkadot-rpc.n.dwellir.com"
1451
+ },
1306
1452
  {
1307
1453
  name: "IBP1",
1308
1454
  endpoint: "wss://sys.ibp.network/coretime-polkadot"
@@ -1315,9 +1461,17 @@ var CoretimePolkadot$1 = {
1315
1461
  name: "LuckyFriday",
1316
1462
  endpoint: "wss://rpc-coretime-polkadot.luckyfriday.io"
1317
1463
  },
1464
+ {
1465
+ name: "OnFinality",
1466
+ endpoint: "wss://coretime-polkadot.api.onfinality.io/public-ws"
1467
+ },
1318
1468
  {
1319
1469
  name: "Parity",
1320
1470
  endpoint: "wss://polkadot-coretime-rpc.polkadot.io"
1471
+ },
1472
+ {
1473
+ name: "Stakeworld",
1474
+ endpoint: "wss://dot-rpc.stakeworld.io/coretime"
1321
1475
  }
1322
1476
  ]
1323
1477
  };
@@ -1368,10 +1522,6 @@ var Amplitude$1 = {
1368
1522
  info: "amplitude",
1369
1523
  paraId: 2124,
1370
1524
  providers: [
1371
- {
1372
- name: "Dwellir",
1373
- endpoint: "wss://amplitude-rpc.dwellir.com"
1374
- },
1375
1525
  {
1376
1526
  name: "PendulumChain",
1377
1527
  endpoint: "wss://rpc-amplitude.pendulumchain.tech"
@@ -1412,17 +1562,6 @@ var BifrostKusama$1 = {
1412
1562
  }
1413
1563
  ]
1414
1564
  };
1415
- var Calamari$1 = {
1416
- name: "Calamari",
1417
- info: "calamari",
1418
- paraId: 2084,
1419
- providers: [
1420
- {
1421
- name: "Manta Network",
1422
- endpoint: "wss://calamari.systems"
1423
- }
1424
- ]
1425
- };
1426
1565
  var CrustShadow$1 = {
1427
1566
  name: "Crust Shadow",
1428
1567
  info: "shadow",
@@ -1461,17 +1600,6 @@ var Crab$1 = {
1461
1600
  }
1462
1601
  ]
1463
1602
  };
1464
- var InvArchTinker$1 = {
1465
- name: "InvArch Tinkernet",
1466
- info: "tinker",
1467
- paraId: 2125,
1468
- providers: [
1469
- {
1470
- name: "Dwellir",
1471
- endpoint: "wss://tinkernet-rpc.dwellir.com"
1472
- }
1473
- ]
1474
- };
1475
1603
  var Karura$1 = {
1476
1604
  name: "Karura",
1477
1605
  info: "karura",
@@ -1508,10 +1636,6 @@ var Kintsugi$1 = {
1508
1636
  info: "kintsugi",
1509
1637
  paraId: 2092,
1510
1638
  providers: [
1511
- {
1512
- name: "Dwellir",
1513
- endpoint: "wss://kintsugi-rpc.dwellir.com"
1514
- },
1515
1639
  {
1516
1640
  name: "Kintsugi Labs",
1517
1641
  endpoint: "wss://api-kusama.interlay.io/parachain"
@@ -1562,18 +1686,10 @@ var Quartz$1 = {
1562
1686
  info: "quartz",
1563
1687
  paraId: 2095,
1564
1688
  providers: [
1565
- {
1566
- name: "Dwellir",
1567
- endpoint: "wss://quartz-rpc.n.dwellir.com"
1568
- },
1569
1689
  {
1570
1690
  name: "Geo Load Balancer",
1571
1691
  endpoint: "wss://ws-quartz.unique.network"
1572
1692
  },
1573
- {
1574
- name: "Unique America",
1575
- endpoint: "wss://us-ws-quartz.unique.network"
1576
- },
1577
1693
  {
1578
1694
  name: "Unique Asia",
1579
1695
  endpoint: "wss://asia-ws-quartz.unique.network"
@@ -1611,6 +1727,10 @@ var PeoplePolkadot$1 = {
1611
1727
  info: "polkadotPeople",
1612
1728
  paraId: 1004,
1613
1729
  providers: [
1730
+ {
1731
+ name: "Dwellir",
1732
+ endpoint: "wss://people-polkadot-rpc.n.dwellir.com"
1733
+ },
1614
1734
  {
1615
1735
  name: "IBP1",
1616
1736
  endpoint: "wss://sys.ibp.network/people-polkadot"
@@ -1623,6 +1743,10 @@ var PeoplePolkadot$1 = {
1623
1743
  name: "LuckyFriday",
1624
1744
  endpoint: "wss://rpc-people-polkadot.luckyfriday.io"
1625
1745
  },
1746
+ {
1747
+ name: "OnFinality",
1748
+ endpoint: "wss://people-polkadot.api.onfinality.io/public-ws"
1749
+ },
1626
1750
  {
1627
1751
  name: "Parity",
1628
1752
  endpoint: "wss://polkadot-people-rpc.polkadot.io"
@@ -1630,8 +1754,12 @@ var PeoplePolkadot$1 = {
1630
1754
  {
1631
1755
  name: "RadiumBlock",
1632
1756
  endpoint: "wss://people-polkadot.public.curie.radiumblock.co/ws"
1633
- }
1634
- ]
1757
+ },
1758
+ {
1759
+ name: "Stakeworld",
1760
+ endpoint: "wss://dot-rpc.stakeworld.io/people"
1761
+ }
1762
+ ]
1635
1763
  };
1636
1764
  var PeopleKusama$1 = {
1637
1765
  name: "People",
@@ -1642,6 +1770,10 @@ var PeopleKusama$1 = {
1642
1770
  name: "Dwellir",
1643
1771
  endpoint: "wss://people-kusama-rpc.n.dwellir.com"
1644
1772
  },
1773
+ {
1774
+ name: "Helixstreet",
1775
+ endpoint: "wss://rpc-people-kusama.helixstreet.io"
1776
+ },
1645
1777
  {
1646
1778
  name: "IBP1",
1647
1779
  endpoint: "wss://sys.ibp.network/people-kusama"
@@ -1654,6 +1786,10 @@ var PeopleKusama$1 = {
1654
1786
  name: "LuckyFriday",
1655
1787
  endpoint: "wss://rpc-people-kusama.luckyfriday.io"
1656
1788
  },
1789
+ {
1790
+ name: "OnFinality",
1791
+ endpoint: "wss://people-kusama.api.onfinality.io/public-ws"
1792
+ },
1657
1793
  {
1658
1794
  name: "Parity",
1659
1795
  endpoint: "wss://kusama-people-rpc.polkadot.io"
@@ -1791,10 +1927,6 @@ var NeuroWeb$1 = {
1791
1927
  info: "neuroweb",
1792
1928
  paraId: 2043,
1793
1929
  providers: [
1794
- {
1795
- name: "Dwellir",
1796
- endpoint: "wss://neuroweb-rpc.dwellir.com"
1797
- },
1798
1930
  {
1799
1931
  name: "TraceLabs",
1800
1932
  endpoint: "wss://parachain-rpc.origin-trail.network"
@@ -1897,10 +2029,6 @@ var Subsocial$1 = {
1897
2029
  {
1898
2030
  name: "Dappforce",
1899
2031
  endpoint: "wss://para.subsocial.network"
1900
- },
1901
- {
1902
- name: "Dwellir",
1903
- endpoint: "wss://subsocial-rpc.dwellir.com"
1904
2032
  }
1905
2033
  ]
1906
2034
  };
@@ -1909,10 +2037,6 @@ var KiltSpiritnet$1 = {
1909
2037
  info: "kilt",
1910
2038
  paraId: 2086,
1911
2039
  providers: [
1912
- {
1913
- name: "Dwellir",
1914
- endpoint: "wss://kilt-rpc.dwellir.com"
1915
- },
1916
2040
  {
1917
2041
  name: "IBP1",
1918
2042
  endpoint: "wss://kilt.ibp.network"
@@ -2048,10 +2172,6 @@ var Polkadot = {
2048
2172
  name: "RadiumBlock",
2049
2173
  endpoint: "wss://polkadot.public.curie.radiumblock.co/ws"
2050
2174
  },
2051
- {
2052
- name: "RockX",
2053
- endpoint: "wss://rockx-dot.w3node.com/polka-public-dot/ws"
2054
- },
2055
2175
  {
2056
2176
  name: "Stakeworld",
2057
2177
  endpoint: "wss://dot-rpc.stakeworld.io"
@@ -2103,10 +2223,6 @@ var Kusama = {
2103
2223
  name: "RadiumBlock",
2104
2224
  endpoint: "wss://kusama.public.curie.radiumblock.co/ws"
2105
2225
  },
2106
- {
2107
- name: "RockX",
2108
- endpoint: "wss://rockx-ksm.w3node.com/polka-public-ksm/ws"
2109
- },
2110
2226
  {
2111
2227
  name: "Stakeworld",
2112
2228
  endpoint: "wss://ksm-rpc.stakeworld.io"
@@ -2116,6 +2232,7 @@ var Kusama = {
2116
2232
  var configs = {
2117
2233
  AssetHubPolkadot: AssetHubPolkadot$1,
2118
2234
  Acala: Acala$1,
2235
+ Ajuna: Ajuna$1,
2119
2236
  Astar: Astar$1,
2120
2237
  BifrostPolkadot: BifrostPolkadot$1,
2121
2238
  Bitgreen: Bitgreen$1,
@@ -2136,10 +2253,8 @@ var configs = {
2136
2253
  Amplitude: Amplitude$1,
2137
2254
  Basilisk: Basilisk$1,
2138
2255
  BifrostKusama: BifrostKusama$1,
2139
- Calamari: Calamari$1,
2140
2256
  CrustShadow: CrustShadow$1,
2141
2257
  Crab: Crab$1,
2142
- InvArchTinker: InvArchTinker$1,
2143
2258
  Karura: Karura$1,
2144
2259
  Kintsugi: Kintsugi$1,
2145
2260
  Moonriver: Moonriver$1,
@@ -2290,7 +2405,7 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
2290
2405
  includeFee = _ref2.includeFee;
2291
2406
  var paraId = resolveParaId(paraIdTo, destination);
2292
2407
  return _objectSpread2({
2293
- dest: createPolkadotXcmHeader('RelayToPara', version, destination, paraId),
2408
+ dest: createVersionedDestination('RelayToPara', version, destination, paraId),
2294
2409
  beneficiary: createVersionedBeneficiary({
2295
2410
  api: api,
2296
2411
  scenario: 'RelayToPara',
@@ -2352,7 +2467,7 @@ var createVersionedMultiAssets = function createVersionedMultiAssets(version, am
2352
2467
  var multiAssets = createMultiAsset(version, amount, multiLocation);
2353
2468
  return addXcmVersionHeader([multiAssets], version);
2354
2469
  };
2355
- var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId, junction, parents) {
2470
+ var createVersionedDestination = function createVersionedDestination(scenario, version, destination, nodeId, junction, parents) {
2356
2471
  var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? sdkCommon.Parents.ZERO : sdkCommon.Parents.ONE;
2357
2472
  var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
2358
2473
  Parachain: nodeId
@@ -2392,10 +2507,10 @@ var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(relay
2392
2507
  return node;
2393
2508
  };
2394
2509
  var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, node) {
2395
- var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2510
+ var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2396
2511
  isDestination: false
2397
2512
  },
2398
- isDestination = _ref3.isDestination;
2513
+ isDestination = _ref2.isDestination;
2399
2514
  if ('multilocation' in currency) {
2400
2515
  throw new assets.InvalidCurrencyError("\n Selected chain doesn't support multilocation you provided. Maybe you meant custom multilocation. If so, you need to use override option. Your selection should look like this: {multilocation: Override(".concat(JSON.stringify(currency.multilocation), ")}."));
2401
2516
  }
@@ -2701,148 +2816,6 @@ var resolveParaId = function resolveParaId(paraId, destination) {
2701
2816
  return paraId !== null && paraId !== void 0 ? paraId : getParaId(destination);
2702
2817
  };
2703
2818
 
2704
- /**
2705
- * Error thrown when the Ethereum bridge is halted.
2706
- */
2707
- var BridgeHaltedError = /*#__PURE__*/function (_Error) {
2708
- /**
2709
- * Constructs a new BridgeHaltedError.
2710
- *
2711
- * @param message - Optional custom error message.
2712
- */
2713
- function BridgeHaltedError() {
2714
- var _this;
2715
- _classCallCheck(this, BridgeHaltedError);
2716
- _this = _callSuper(this, BridgeHaltedError, ['Bridge operations have been paused by onchain governance.']);
2717
- _this.name = 'BridgeHaltedError';
2718
- return _this;
2719
- }
2720
- _inherits(BridgeHaltedError, _Error);
2721
- return _createClass(BridgeHaltedError);
2722
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2723
-
2724
- /**
2725
- * Error thrown when the Dry Run fails.
2726
- */
2727
- var DryRunFailedError = /*#__PURE__*/function (_Error) {
2728
- /**
2729
- * Constructs a new DryRunFailedError.
2730
- *
2731
- * @param message - Optional custom error message.
2732
- */
2733
- function DryRunFailedError(reason) {
2734
- var _this;
2735
- _classCallCheck(this, DryRunFailedError);
2736
- _this = _callSuper(this, DryRunFailedError, ["Dry run failed: ".concat(reason)]);
2737
- _this.name = 'DryRunFailedError';
2738
- return _this;
2739
- }
2740
- _inherits(DryRunFailedError, _Error);
2741
- return _createClass(DryRunFailedError);
2742
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2743
-
2744
- /**
2745
- * Error thrown when nodes from different relay chains are incompatible.
2746
- */
2747
- var IncompatibleNodesError = /*#__PURE__*/function (_Error) {
2748
- /**
2749
- * Constructs a new IncompatibleNodesError.
2750
- *
2751
- * @param message - Optional custom error message.
2752
- */
2753
- function IncompatibleNodesError(message) {
2754
- var _this;
2755
- _classCallCheck(this, IncompatibleNodesError);
2756
- _this = _callSuper(this, IncompatibleNodesError, [message !== null && message !== void 0 ? message : 'Transactions between nodes on different relaychains are not yet possible.']);
2757
- _this.name = 'IncompatibleNodes';
2758
- return _this;
2759
- }
2760
- _inherits(IncompatibleNodesError, _Error);
2761
- return _createClass(IncompatibleNodesError);
2762
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2763
-
2764
- /**
2765
- * Error thrown when an invalid address is provided.
2766
- */
2767
- var InvalidAddressError = /*#__PURE__*/function (_Error) {
2768
- /**
2769
- * Constructs a new InvalidAddressError.
2770
- *
2771
- * @param message - The error message.
2772
- */
2773
- function InvalidAddressError(message) {
2774
- var _this;
2775
- _classCallCheck(this, InvalidAddressError);
2776
- _this = _callSuper(this, InvalidAddressError, [message]);
2777
- _this.name = 'InvalidAddressError';
2778
- return _this;
2779
- }
2780
- _inherits(InvalidAddressError, _Error);
2781
- return _createClass(InvalidAddressError);
2782
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2783
-
2784
- /**
2785
- * Used to inform user, that Parachain they wish to use is not supported yet
2786
- */
2787
- var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
2788
- /**
2789
- * Constructs a new NodeNotSupportedError.
2790
- *
2791
- * @param message - Optional custom error message.
2792
- */
2793
- function NodeNotSupportedError(message) {
2794
- var _this;
2795
- _classCallCheck(this, NodeNotSupportedError);
2796
- _this = _callSuper(this, NodeNotSupportedError, [message !== null && message !== void 0 ? message : 'These nodes do not support XCM transfers from Relay / to Relay chain.']);
2797
- _this.name = 'NodeNotSupported';
2798
- return _this;
2799
- }
2800
- _inherits(NodeNotSupportedError, _Error);
2801
- return _createClass(NodeNotSupportedError);
2802
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2803
-
2804
- /**
2805
- * Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
2806
- */
2807
- var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
2808
- /**
2809
- * Constructs a new NoXCMSupportImplementedError.
2810
- *
2811
- * @param node - The node for which XCM support is not implemented.
2812
- */
2813
- function NoXCMSupportImplementedError(node) {
2814
- var _this;
2815
- _classCallCheck(this, NoXCMSupportImplementedError);
2816
- _this = _callSuper(this, NoXCMSupportImplementedError, ["No XCM support implemented for ".concat(node, " node yet.")]);
2817
- _this.name = 'NoXCMSupportImplemented';
2818
- return _this;
2819
- }
2820
- _inherits(NoXCMSupportImplementedError, _Error);
2821
- return _createClass(NoXCMSupportImplementedError);
2822
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2823
-
2824
- /**
2825
- * Used to inform user, that Parachain they wish to use does not support scenario they wish to use yet
2826
- */
2827
- var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
2828
- /**
2829
- * Constructs a new ScenarioNotSupportedError.
2830
- *
2831
- * @param node - The node where the scenario is not supported.
2832
- * @param scenario - The scenario that is not supported.
2833
- * @param message - Optional custom error message.
2834
- */
2835
- function ScenarioNotSupportedError(node, scenario, message) {
2836
- var _this;
2837
- _classCallCheck(this, ScenarioNotSupportedError);
2838
- _this = _callSuper(this, ScenarioNotSupportedError, [message !== null && message !== void 0 ? message : "Scenario ".concat(scenario, " not supported for node ").concat(node)]);
2839
- _this.name = 'ScenarioNotSupported';
2840
- return _this;
2841
- }
2842
- _inherits(ScenarioNotSupportedError, _Error);
2843
- return _createClass(ScenarioNotSupportedError);
2844
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2845
-
2846
2819
  var validateAddress = function validateAddress(address, node) {
2847
2820
  var isDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
2848
2821
  var isEvm = assets.isNodeEvm(node);
@@ -3290,7 +3263,7 @@ var ParachainNode = /*#__PURE__*/function () {
3290
3263
  }
3291
3264
  _options = {
3292
3265
  api: api,
3293
- header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraId),
3266
+ header: this.createVersionedDestination(scenario, versionOrDefault, destination, paraId),
3294
3267
  addressSelection: createVersionedBeneficiary({
3295
3268
  api: api,
3296
3269
  scenario: scenario,
@@ -3346,8 +3319,8 @@ var ParachainNode = /*#__PURE__*/function () {
3346
3319
  key: "getRelayToParaOverrides",
3347
3320
  value: function getRelayToParaOverrides() {
3348
3321
  return {
3349
- section: 'reserve_transfer_assets',
3350
- includeFee: false
3322
+ section: 'limited_reserve_transfer_assets',
3323
+ includeFee: true
3351
3324
  };
3352
3325
  }
3353
3326
  }, {
@@ -3377,9 +3350,9 @@ var ParachainNode = /*#__PURE__*/function () {
3377
3350
  });
3378
3351
  }
3379
3352
  }, {
3380
- key: "createPolkadotXcmHeader",
3381
- value: function createPolkadotXcmHeader$1(scenario, version, destination, paraId) {
3382
- return createPolkadotXcmHeader(scenario, version, destination, paraId);
3353
+ key: "createVersionedDestination",
3354
+ value: function createVersionedDestination$1(scenario, version, destination, paraId) {
3355
+ return createVersionedDestination(scenario, version, destination, paraId);
3383
3356
  }
3384
3357
  }, {
3385
3358
  key: "getNativeAssetSymbol",
@@ -3492,13 +3465,13 @@ var ParachainNode = /*#__PURE__*/function () {
3492
3465
  case 15:
3493
3466
  // Pad fee by 50%
3494
3467
  dryRunFeePadded = BigInt(dryRunResult.fee) * BigInt(3) / BigInt(2);
3495
- destWithHeader = createPolkadotXcmHeader(scenario, version, destination, paraIdTo);
3468
+ destWithHeader = createVersionedDestination(scenario, version, destination, paraIdTo);
3496
3469
  _extractVersionFromHe = extractVersionFromHeader(destWithHeader), _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2), _extractVersionFromHe2[0], dest = _extractVersionFromHe2[1];
3497
3470
  call = {
3498
3471
  module: 'PolkadotXcm',
3499
3472
  section: 'transfer_assets_using_type_and_then',
3500
3473
  parameters: {
3501
- dest: this.createPolkadotXcmHeader(scenario, version, destination, getParaId('AssetHubPolkadot')),
3474
+ dest: this.createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
3502
3475
  assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
3503
3476
  assets_transfer_type: 'DestinationReserve',
3504
3477
  remote_fees_id: addXcmVersionHeader((_feeAsset$multiLocati = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.multiLocation) !== null && _feeAsset$multiLocati !== void 0 ? _feeAsset$multiLocati : DOT_MULTILOCATION, version),
@@ -3655,7 +3628,7 @@ var ParachainNode = /*#__PURE__*/function () {
3655
3628
  module: 'PolkadotXcm',
3656
3629
  section: 'transfer_assets_using_type_and_then',
3657
3630
  parameters: {
3658
- dest: this.createPolkadotXcmHeader(scenario, version, destination, getParaId('AssetHubPolkadot')),
3631
+ dest: this.createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
3659
3632
  assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, fee, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
3660
3633
  assets_transfer_type: 'DestinationReserve',
3661
3634
  remote_fees_id: addXcmVersionHeader((_feeAsset$multiLocati2 = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.multiLocation) !== null && _feeAsset$multiLocati2 !== void 0 ? _feeAsset$multiLocati2 : DOT_MULTILOCATION, version),
@@ -3703,10 +3676,11 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3703
3676
  return _createClass(Acala, [{
3704
3677
  key: "getCurrencySelection",
3705
3678
  value: function getCurrencySelection(asset) {
3679
+ var symbol = asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol;
3706
3680
  return assets.isForeignAsset(asset) ? {
3707
3681
  ForeignAsset: Number(asset.assetId)
3708
3682
  } : {
3709
- Token: asset.symbol
3683
+ Token: symbol
3710
3684
  };
3711
3685
  }
3712
3686
  }, {
@@ -3745,59 +3719,6 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3745
3719
  return api.callTxMethod({
3746
3720
  module: 'Currencies',
3747
3721
  section: 'transfer',
3748
- parameters: {
3749
- dest: {
3750
- Id: address
3751
- },
3752
- currency_id: this.getCurrencySelection(_objectSpread2(_objectSpread2({}, asset), {}, {
3753
- symbol: asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol
3754
- })),
3755
- amount: BigInt(asset.amount)
3756
- }
3757
- });
3758
- }
3759
- }]);
3760
- }(ParachainNode);
3761
-
3762
- var Altair = /*#__PURE__*/function (_ParachainNode) {
3763
- function Altair() {
3764
- _classCallCheck(this, Altair);
3765
- return _callSuper(this, Altair, ['Altair', 'altair', 'kusama', exports.Version.V3]);
3766
- }
3767
- _inherits(Altair, _ParachainNode);
3768
- return _createClass(Altair, [{
3769
- key: "getCurrencySelection",
3770
- value: function getCurrencySelection(asset) {
3771
- if (asset.symbol === this.getNativeAssetSymbol()) return 'Native';
3772
- if (!assets.isForeignAsset(asset)) {
3773
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3774
- }
3775
- return {
3776
- ForeignAsset: Number(asset.assetId)
3777
- };
3778
- }
3779
- }, {
3780
- key: "transferXTokens",
3781
- value: function transferXTokens(input) {
3782
- var asset = input.asset;
3783
- var currencySelection = this.getCurrencySelection(asset);
3784
- return XTokensTransferImpl.transferXTokens(input, currencySelection);
3785
- }
3786
- }, {
3787
- key: "transferLocalNonNativeAsset",
3788
- value: function transferLocalNonNativeAsset(options) {
3789
- var api = options.api,
3790
- asset = options.asset,
3791
- address = options.address;
3792
- if (!assets.isForeignAsset(asset)) {
3793
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3794
- }
3795
- if (asset.assetId === undefined) {
3796
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3797
- }
3798
- return api.callTxMethod({
3799
- module: 'Tokens',
3800
- section: 'transfer',
3801
3722
  parameters: {
3802
3723
  dest: {
3803
3724
  Id: address
@@ -3810,27 +3731,6 @@ var Altair = /*#__PURE__*/function (_ParachainNode) {
3810
3731
  }]);
3811
3732
  }(ParachainNode);
3812
3733
 
3813
- var Amplitude = /*#__PURE__*/function (_ParachainNode) {
3814
- function Amplitude() {
3815
- _classCallCheck(this, Amplitude);
3816
- return _callSuper(this, Amplitude, ['Amplitude', 'amplitude', 'kusama', exports.Version.V3]);
3817
- }
3818
- _inherits(Amplitude, _ParachainNode);
3819
- return _createClass(Amplitude, [{
3820
- key: "transferXTokens",
3821
- value: function transferXTokens(input) {
3822
- var asset = input.asset;
3823
- if (!assets.isForeignAsset(asset)) {
3824
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3825
- }
3826
- var currencySelection = {
3827
- XCM: Number(asset.assetId)
3828
- };
3829
- return XTokensTransferImpl.transferXTokens(input, currencySelection);
3830
- }
3831
- }]);
3832
- }(ParachainNode);
3833
-
3834
3734
  var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
3835
3735
  function PolkadotXCMTransferImpl() {
3836
3736
  _classCallCheck(this, PolkadotXCMTransferImpl);
@@ -3872,22 +3772,157 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
3872
3772
  }]);
3873
3773
  }();
3874
3774
 
3875
- var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
3876
- function AssetHubKusama() {
3877
- _classCallCheck(this, AssetHubKusama);
3878
- return _callSuper(this, AssetHubKusama, ['AssetHubKusama', 'KusamaAssetHub', 'kusama', exports.Version.V3]);
3775
+ var Ajuna = /*#__PURE__*/function (_ParachainNode) {
3776
+ function Ajuna() {
3777
+ _classCallCheck(this, Ajuna);
3778
+ return _callSuper(this, Ajuna, ['Ajuna', 'ajuna', 'polkadot', exports.Version.V4]);
3879
3779
  }
3880
- _inherits(AssetHubKusama, _ParachainNode);
3881
- return _createClass(AssetHubKusama, [{
3882
- key: "transferPolkadotXCM",
3883
- value: function transferPolkadotXCM(input) {
3884
- var destination = input.destination,
3885
- asset = input.asset,
3886
- scenario = input.scenario;
3887
- // TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
3888
- // TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
3889
- if (destination === 'AssetHubPolkadot') {
3890
- return Promise.resolve(getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot'));
3780
+ _inherits(Ajuna, _ParachainNode);
3781
+ return _createClass(Ajuna, [{
3782
+ key: "transferXTokens",
3783
+ value: function transferXTokens(input) {
3784
+ var scenario = input.scenario,
3785
+ asset = input.asset;
3786
+ if (scenario !== 'ParaToPara') {
3787
+ throw new ScenarioNotSupportedError(this.node, scenario);
3788
+ }
3789
+ if (asset.symbol !== this.getNativeAssetSymbol()) {
3790
+ throw new assets.InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by node ").concat(this.node, "."));
3791
+ }
3792
+ return XTokensTransferImpl.transferXTokens(input, this.getNativeAssetSymbol());
3793
+ }
3794
+ }, {
3795
+ key: "transferPolkadotXCM",
3796
+ value: function transferPolkadotXCM(input) {
3797
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'transfer_assets', 'Unlimited'));
3798
+ }
3799
+ }, {
3800
+ key: "canUseXTokens",
3801
+ value: function canUseXTokens(_ref) {
3802
+ var asset = _ref.asset,
3803
+ destination = _ref.to;
3804
+ return !(asset.symbol === 'DOT' && destination === 'AssetHubPolkadot');
3805
+ }
3806
+ }, {
3807
+ key: "transferRelayToPara",
3808
+ value: function transferRelayToPara() {
3809
+ throw new NodeNotSupportedError();
3810
+ }
3811
+ }, {
3812
+ key: "transferLocalNonNativeAsset",
3813
+ value: function transferLocalNonNativeAsset(options) {
3814
+ var api = options.api,
3815
+ asset = options.asset,
3816
+ address = options.address;
3817
+ if (!assets.isForeignAsset(asset)) {
3818
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3819
+ }
3820
+ if (asset.assetId === undefined) {
3821
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3822
+ }
3823
+ return api.callTxMethod({
3824
+ module: 'Assets',
3825
+ section: 'transfer',
3826
+ parameters: {
3827
+ id: Number(asset.assetId),
3828
+ target: {
3829
+ Id: address
3830
+ },
3831
+ amount: BigInt(asset.amount)
3832
+ }
3833
+ });
3834
+ }
3835
+ }]);
3836
+ }(ParachainNode);
3837
+
3838
+ var Altair = /*#__PURE__*/function (_ParachainNode) {
3839
+ function Altair() {
3840
+ _classCallCheck(this, Altair);
3841
+ return _callSuper(this, Altair, ['Altair', 'altair', 'kusama', exports.Version.V3]);
3842
+ }
3843
+ _inherits(Altair, _ParachainNode);
3844
+ return _createClass(Altair, [{
3845
+ key: "getCurrencySelection",
3846
+ value: function getCurrencySelection(asset) {
3847
+ if (asset.symbol === this.getNativeAssetSymbol()) return 'Native';
3848
+ if (!assets.isForeignAsset(asset)) {
3849
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3850
+ }
3851
+ return {
3852
+ ForeignAsset: Number(asset.assetId)
3853
+ };
3854
+ }
3855
+ }, {
3856
+ key: "transferXTokens",
3857
+ value: function transferXTokens(input) {
3858
+ var asset = input.asset;
3859
+ var currencySelection = this.getCurrencySelection(asset);
3860
+ return XTokensTransferImpl.transferXTokens(input, currencySelection);
3861
+ }
3862
+ }, {
3863
+ key: "transferLocalNonNativeAsset",
3864
+ value: function transferLocalNonNativeAsset(options) {
3865
+ var api = options.api,
3866
+ asset = options.asset,
3867
+ address = options.address;
3868
+ if (!assets.isForeignAsset(asset)) {
3869
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3870
+ }
3871
+ if (asset.assetId === undefined) {
3872
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3873
+ }
3874
+ return api.callTxMethod({
3875
+ module: 'Tokens',
3876
+ section: 'transfer',
3877
+ parameters: {
3878
+ dest: {
3879
+ Id: address
3880
+ },
3881
+ currency_id: this.getCurrencySelection(asset),
3882
+ amount: BigInt(asset.amount)
3883
+ }
3884
+ });
3885
+ }
3886
+ }]);
3887
+ }(ParachainNode);
3888
+
3889
+ var Amplitude = /*#__PURE__*/function (_ParachainNode) {
3890
+ function Amplitude() {
3891
+ _classCallCheck(this, Amplitude);
3892
+ return _callSuper(this, Amplitude, ['Amplitude', 'amplitude', 'kusama', exports.Version.V3]);
3893
+ }
3894
+ _inherits(Amplitude, _ParachainNode);
3895
+ return _createClass(Amplitude, [{
3896
+ key: "transferXTokens",
3897
+ value: function transferXTokens(input) {
3898
+ var asset = input.asset;
3899
+ if (!assets.isForeignAsset(asset)) {
3900
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3901
+ }
3902
+ var currencySelection = {
3903
+ XCM: Number(asset.assetId)
3904
+ };
3905
+ return XTokensTransferImpl.transferXTokens(input, currencySelection);
3906
+ }
3907
+ }]);
3908
+ }(ParachainNode);
3909
+
3910
+ var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
3911
+ function AssetHubKusama() {
3912
+ _classCallCheck(this, AssetHubKusama);
3913
+ return _callSuper(this, AssetHubKusama, ['AssetHubKusama', 'KusamaAssetHub', 'kusama', exports.Version.V3]);
3914
+ }
3915
+ _inherits(AssetHubKusama, _ParachainNode);
3916
+ return _createClass(AssetHubKusama, [{
3917
+ key: "transferPolkadotXCM",
3918
+ value: function transferPolkadotXCM(input) {
3919
+ var destination = input.destination,
3920
+ asset = input.asset,
3921
+ scenario = input.scenario;
3922
+ // TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
3923
+ // TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
3924
+ if (destination === 'AssetHubPolkadot') {
3925
+ return Promise.resolve(getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot'));
3891
3926
  }
3892
3927
  var isSystemNode = !sdkCommon.isTMultiLocation(destination) && SYSTEM_NODES_KUSAMA.includes(destination);
3893
3928
  if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !assets.isForeignAsset(asset) && !isSystemNode) {
@@ -3929,7 +3964,7 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
3929
3964
  destination = input.destination,
3930
3965
  paraIdTo = input.paraIdTo,
3931
3966
  address = input.address;
3932
- var destWithHeader = createPolkadotXcmHeader(scenario, version, destination, paraIdTo);
3967
+ var destWithHeader = createVersionedDestination(scenario, version, destination, paraIdTo);
3933
3968
  var _extractVersionFromHe = extractVersionFromHeader(destWithHeader),
3934
3969
  _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2);
3935
3970
  _extractVersionFromHe2[0];
@@ -4063,7 +4098,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4063
4098
  module: 'PolkadotXcm',
4064
4099
  section: 'transfer_assets_using_type_and_then',
4065
4100
  parameters: {
4066
- dest: _this.createPolkadotXcmHeader(scenario, version, destination, paraIdTo),
4101
+ dest: _this.createVersionedDestination(scenario, version, destination, paraIdTo),
4067
4102
  assets: addXcmVersionHeader([].concat(_toConsumableArray(useDOTAsFeeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [createMultiAsset(version, asset.amount, asset.multiLocation)]), version),
4068
4103
  assets_transfer_type: 'LocalReserve',
4069
4104
  remote_fees_id: addXcmVersionHeader(useDOTAsFeeAsset ? DOT_MULTILOCATION : asset.multiLocation, version),
@@ -4159,7 +4194,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4159
4194
  module: 'PolkadotXcm',
4160
4195
  section: 'transfer_assets_using_type_and_then',
4161
4196
  parameters: {
4162
- dest: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
4197
+ dest: createVersionedDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
4163
4198
  assets: addXcmVersionHeader([createMultiAsset(version, asset.amount, multiLocation)], version),
4164
4199
  assets_transfer_type: 'LocalReserve',
4165
4200
  remote_fees_id: addXcmVersionHeader(multiLocation, version),
@@ -4241,7 +4276,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4241
4276
  return _context2.abrupt("return", this.handleEthBridgeNativeTransfer(input));
4242
4277
  case 14:
4243
4278
  modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
4244
- header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
4279
+ header: createVersionedDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
4245
4280
  addressSelection: createVersionedBeneficiary({
4246
4281
  api: api,
4247
4282
  scenario: scenario,
@@ -4284,7 +4319,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4284
4319
  }
4285
4320
  };
4286
4321
  var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
4287
- header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
4322
+ header: this.createVersionedDestination(scenario, version, destination, paraId),
4288
4323
  addressSelection: createVersionedBeneficiary({
4289
4324
  api: api,
4290
4325
  scenario: scenario,
@@ -4313,7 +4348,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4313
4348
  var _input$version4;
4314
4349
  var versionOrDefault = (_input$version4 = input.version) !== null && _input$version4 !== void 0 ? _input$version4 : exports.Version.V2;
4315
4350
  return _objectSpread2(_objectSpread2({}, input), {}, {
4316
- header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
4351
+ header: this.createVersionedDestination(scenario, versionOrDefault, destination, paraIdTo),
4317
4352
  addressSelection: createVersionedBeneficiary({
4318
4353
  api: api,
4319
4354
  scenario: scenario,
@@ -4362,7 +4397,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4362
4397
  proofSize: maxU64
4363
4398
  }, MIN_FEE);
4364
4399
  _context3.next = 9;
4365
- return api.getDryRun({
4400
+ return api.getDryRunCall({
4366
4401
  node: this.node,
4367
4402
  tx: dummyTx,
4368
4403
  address: senderAddress
@@ -4446,7 +4481,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4446
4481
  return Promise.resolve(this.handleBifrostEthTransfer(input, true));
4447
4482
  }
4448
4483
  var isSystemNode = !sdkCommon.isTMultiLocation(destination) && SYSTEM_NODES_POLKADOT.includes(destination);
4449
- if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !assets.isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && !isSystemNode) {
4484
+ if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !assets.isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && destination !== 'Ajuna' && !isSystemNode) {
4450
4485
  throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
4451
4486
  }
4452
4487
  if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !assets.isForeignAsset(asset)) {
@@ -4529,8 +4564,7 @@ var Astar = /*#__PURE__*/function (_ParachainNode) {
4529
4564
  return _createClass(Astar, [{
4530
4565
  key: "transferPolkadotXCM",
4531
4566
  value: function transferPolkadotXCM(input) {
4532
- // TESTED https://polkadot.subscan.io/xcm_message/polkadot-f2b697df74ebe4b62853fe81b8b7d0522464972d
4533
- return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
4567
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
4534
4568
  }
4535
4569
  }, {
4536
4570
  key: "transferXTokens",
@@ -4792,28 +4826,6 @@ var BridgeHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4792
4826
  }]);
4793
4827
  }(ParachainNode);
4794
4828
 
4795
- var Calamari = /*#__PURE__*/function (_ParachainNode) {
4796
- function Calamari() {
4797
- _classCallCheck(this, Calamari);
4798
- return _callSuper(this, Calamari, ['Calamari', 'calamari', 'kusama', exports.Version.V3]);
4799
- }
4800
- _inherits(Calamari, _ParachainNode);
4801
- return _createClass(Calamari, [{
4802
- key: "transferXTokens",
4803
- value: function transferXTokens(input) {
4804
- // Currently only option for XCM transfer
4805
- var asset = input.asset;
4806
- if (!assets.isForeignAsset(asset) || !asset.assetId) {
4807
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
4808
- }
4809
- var currencySelection = {
4810
- MantaCurrency: BigInt(asset.assetId)
4811
- };
4812
- return XTokensTransferImpl.transferXTokens(input, currencySelection);
4813
- }
4814
- }]);
4815
- }(ParachainNode);
4816
-
4817
4829
  var Centrifuge = /*#__PURE__*/function (_ParachainNode) {
4818
4830
  function Centrifuge() {
4819
4831
  _classCallCheck(this, Centrifuge);
@@ -5129,11 +5141,28 @@ var Darwinia = /*#__PURE__*/function (_ParachainNode) {
5129
5141
  return _createClass(Darwinia, [{
5130
5142
  key: "transferPolkadotXCM",
5131
5143
  value: function transferPolkadotXCM(input) {
5132
- var scenario = input.scenario;
5133
- if (scenario === 'ParaToPara') {
5144
+ var scenario = input.scenario,
5145
+ asset = input.asset;
5146
+ if (scenario === 'ParaToPara' && asset.symbol !== this.getNativeAssetSymbol()) {
5134
5147
  throw new ScenarioNotSupportedError(this.node, scenario);
5135
5148
  }
5136
- return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
5149
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
5150
+ }
5151
+ }, {
5152
+ key: "createCurrencySpec",
5153
+ value: function createCurrencySpec(amount, scenario, version, _asset) {
5154
+ if (scenario === 'ParaToPara') {
5155
+ return createVersionedMultiAssets(version, amount, {
5156
+ parents: sdkCommon.Parents.ZERO,
5157
+ interior: {
5158
+ X1: {
5159
+ PalletInstance: 5
5160
+ }
5161
+ }
5162
+ });
5163
+ } else {
5164
+ return _superPropGet(Darwinia, "createCurrencySpec", this, 3)([amount, scenario, version]);
5165
+ }
5137
5166
  }
5138
5167
  }, {
5139
5168
  key: "transferLocalNonNativeAsset",
@@ -5276,7 +5305,7 @@ var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scena
5276
5305
  AllCounted: 1
5277
5306
  }
5278
5307
  },
5279
- dest: Object.values(createPolkadotXcmHeader(scenario, version, destination, paraId, undefined, sdkCommon.Parents.ONE))[0],
5308
+ dest: Object.values(createVersionedDestination(scenario, version, destination, paraId, undefined, sdkCommon.Parents.ONE))[0],
5280
5309
  xcm: [{
5281
5310
  BuyExecution: {
5282
5311
  fees: {
@@ -5435,7 +5464,7 @@ var Hydration = /*#__PURE__*/function (_ParachainNode) {
5435
5464
  module: 'PolkadotXcm',
5436
5465
  section: 'transfer_assets_using_type_and_then',
5437
5466
  parameters: {
5438
- dest: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
5467
+ dest: this.createVersionedDestination(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
5439
5468
  assets: _defineProperty({}, versionOrDefault, [createMultiAsset(versionOrDefault, asset.amount, DOT_MULTILOCATION)]),
5440
5469
  assets_transfer_type: 'DestinationReserve',
5441
5470
  remote_fees_id: _defineProperty({}, versionOrDefault, {
@@ -5608,24 +5637,6 @@ var Interlay = /*#__PURE__*/function (_ParachainNode) {
5608
5637
  }]);
5609
5638
  }(ParachainNode);
5610
5639
 
5611
- var InvArchTinker = /*#__PURE__*/function (_ParachainNode) {
5612
- function InvArchTinker() {
5613
- _classCallCheck(this, InvArchTinker);
5614
- return _callSuper(this, InvArchTinker, ['InvArchTinker', 'tinker', 'kusama', exports.Version.V3]);
5615
- }
5616
- _inherits(InvArchTinker, _ParachainNode);
5617
- return _createClass(InvArchTinker, [{
5618
- key: "transferXTokens",
5619
- value: function transferXTokens(input) {
5620
- var asset = input.asset;
5621
- if (!assets.isForeignAsset(asset) || !asset.assetId) {
5622
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
5623
- }
5624
- return XTokensTransferImpl.transferXTokens(input, BigInt(asset.assetId));
5625
- }
5626
- }]);
5627
- }(ParachainNode);
5628
-
5629
5640
  var Karura = /*#__PURE__*/function (_ParachainNode) {
5630
5641
  function Karura() {
5631
5642
  _classCallCheck(this, Karura);
@@ -5653,16 +5664,18 @@ var Karura = /*#__PURE__*/function (_ParachainNode) {
5653
5664
  var KiltSpiritnet = /*#__PURE__*/function (_ParachainNode) {
5654
5665
  function KiltSpiritnet() {
5655
5666
  _classCallCheck(this, KiltSpiritnet);
5656
- return _callSuper(this, KiltSpiritnet, ['KiltSpiritnet', 'kilt', 'polkadot', exports.Version.V2]);
5667
+ return _callSuper(this, KiltSpiritnet, ['KiltSpiritnet', 'kilt', 'polkadot', exports.Version.V3]);
5657
5668
  }
5658
5669
  _inherits(KiltSpiritnet, _ParachainNode);
5659
5670
  return _createClass(KiltSpiritnet, [{
5660
5671
  key: "transferPolkadotXCM",
5661
5672
  value: function transferPolkadotXCM(input) {
5662
- if (input.scenario !== 'ParaToPara') {
5663
- throw new ScenarioNotSupportedError(this.node, input.scenario);
5673
+ var scenario = input.scenario,
5674
+ asset = input.asset;
5675
+ if (scenario === 'ParaToPara' && asset.symbol !== this.getNativeAssetSymbol()) {
5676
+ throw new ScenarioNotSupportedError(this.node, scenario, 'KiltSpiritnet only supports native asset ParaToPara transfers');
5664
5677
  }
5665
- return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
5678
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
5666
5679
  }
5667
5680
  }, {
5668
5681
  key: "transferRelayToPara",
@@ -6482,6 +6495,7 @@ var nodes = function nodes() {
6482
6495
  return {
6483
6496
  AssetHubPolkadot: new AssetHubPolkadot(),
6484
6497
  Acala: new Acala(),
6498
+ Ajuna: new Ajuna(),
6485
6499
  Astar: new Astar(),
6486
6500
  Unique: new Unique(),
6487
6501
  Crust: new Crust(),
@@ -6504,10 +6518,8 @@ var nodes = function nodes() {
6504
6518
  Amplitude: new Amplitude(),
6505
6519
  Basilisk: new Basilisk(),
6506
6520
  BifrostKusama: new BifrostKusama(),
6507
- Calamari: new Calamari(),
6508
6521
  CrustShadow: new CrustShadow(),
6509
6522
  Crab: new Crab(),
6510
- InvArchTinker: new InvArchTinker(),
6511
6523
  Karura: new Karura(),
6512
6524
  Kintsugi: new Kintsugi(),
6513
6525
  Moonriver: new Moonriver(),
@@ -7025,31 +7037,207 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
7025
7037
  };
7026
7038
  }();
7027
7039
 
7028
- var getDryRun = /*#__PURE__*/function () {
7029
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7030
- var api, node, address;
7031
- return _regeneratorRuntime().wrap(function _callee$(_context) {
7032
- while (1) switch (_context.prev = _context.next) {
7040
+ /**
7041
+ * Retrieves the node name corresponding to a specified parachain ID.
7042
+ *
7043
+ * @param paraId - The parachain ID.
7044
+ * @returns The node name if found; otherwise, null.
7045
+ */
7046
+ var getTNode = function getTNode(paraId, ecosystem) {
7047
+ var _NODE_NAMES_DOT_KSM$f;
7048
+ if (paraId === 0) {
7049
+ return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
7050
+ }
7051
+ if (paraId === 1) {
7052
+ return 'Ethereum';
7053
+ }
7054
+ return (_NODE_NAMES_DOT_KSM$f = sdkCommon.NODE_NAMES_DOT_KSM.find(function (nodeName) {
7055
+ return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
7056
+ })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
7057
+ };
7058
+
7059
+ var isAssetHub = function isAssetHub(chain) {
7060
+ return chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama';
7061
+ };
7062
+ var isBridgeHub = function isBridgeHub(chain) {
7063
+ return chain === 'BridgeHubPolkadot' || chain === 'BridgeHubKusama';
7064
+ };
7065
+ var isPeople = function isPeople(chain) {
7066
+ return chain === 'PeoplePolkadot' || chain === 'PeopleKusama';
7067
+ };
7068
+ var isSystemPara = function isSystemPara(chain) {
7069
+ return isAssetHub(chain) || isBridgeHub(chain) || isPeople(chain);
7070
+ };
7071
+ var mul = function mul(v, num) {
7072
+ var den = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1n;
7073
+ return v * num / den;
7074
+ };
7075
+ var padFee = function padFee(raw, origin, dest, side) {
7076
+ var relayOrigin = sdkCommon.isRelayChain(origin);
7077
+ var relayDest = sdkCommon.isRelayChain(dest);
7078
+ var sysParaOrigin = isSystemPara(origin);
7079
+ var sysParaDest = isSystemPara(dest);
7080
+ var relayToPara = relayOrigin && !relayDest;
7081
+ var sysParaToPara = sysParaOrigin && !sysParaDest;
7082
+ var paraToPara = !relayOrigin && !sysParaOrigin;
7083
+ if (sysParaToPara) return raw * 40n;
7084
+ if (relayToPara) return side === 'origin' ? mul(raw, 320n, 100n) : mul(raw, 3000n, 100n);
7085
+ if (paraToPara) return mul(raw, 130n, 100n);
7086
+ // apply default 30% padding
7087
+ return mul(raw, 130n, 100n);
7088
+ };
7089
+
7090
+ var createOriginLocation = function createOriginLocation(origin, destination) {
7091
+ if (sdkCommon.isRelayChain(origin)) return DOT_MULTILOCATION;
7092
+ return {
7093
+ parents: sdkCommon.isRelayChain(destination) ? sdkCommon.Parents.ZERO : sdkCommon.Parents.ONE,
7094
+ interior: {
7095
+ X1: [{
7096
+ Parachain: getParaId(origin)
7097
+ }]
7098
+ }
7099
+ };
7100
+ };
7101
+ var getFeeForDestNode = /*#__PURE__*/function () {
7102
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
7103
+ var api, forwardedXcms, origin, destination, address, senderAddress, currency, disableFallback, calcPaymentInfoFee, dryRunResult, fee, newForwardedXcms, destParaId;
7104
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7105
+ while (1) switch (_context2.prev = _context2.next) {
7033
7106
  case 0:
7034
- api = options.api, node = options.node, address = options.address;
7035
- validateAddress(address, node, false);
7036
- _context.next = 4;
7037
- return api.init(node);
7038
- case 4:
7039
- _context.prev = 4;
7040
- _context.next = 7;
7041
- return api.getDryRun(options);
7107
+ api = _ref.api, forwardedXcms = _ref.forwardedXcms, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, currency = _ref.currency, disableFallback = _ref.disableFallback;
7108
+ calcPaymentInfoFee = /*#__PURE__*/function () {
7109
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7110
+ var originAsset, currencyInput, tx, rawFee;
7111
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7112
+ while (1) switch (_context.prev = _context.next) {
7113
+ case 0:
7114
+ if (!('multiasset' in currency)) {
7115
+ _context.next = 2;
7116
+ break;
7117
+ }
7118
+ throw new assets.InvalidCurrencyError('Multi-assets are not yet supported for XCM fee calculation.');
7119
+ case 2:
7120
+ originAsset = assets.findAsset(origin, currency, destination);
7121
+ if (originAsset) {
7122
+ _context.next = 5;
7123
+ break;
7124
+ }
7125
+ throw new assets.InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " not found in ").concat(origin));
7126
+ case 5:
7127
+ currencyInput = originAsset.multiLocation ? {
7128
+ multilocation: originAsset.multiLocation
7129
+ } : {
7130
+ symbol: originAsset.symbol
7131
+ };
7132
+ _context.next = 8;
7133
+ return Builder(api).from(destination).to(origin).address(senderAddress, address).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
7134
+ amount: currency.amount
7135
+ })).build();
7136
+ case 8:
7137
+ tx = _context.sent;
7138
+ _context.next = 11;
7139
+ return api.calculateTransactionFee(tx, address);
7140
+ case 11:
7141
+ rawFee = _context.sent;
7142
+ return _context.abrupt("return", padFee(rawFee, origin, destination, 'destination'));
7143
+ case 13:
7144
+ case "end":
7145
+ return _context.stop();
7146
+ }
7147
+ }, _callee);
7148
+ }));
7149
+ return function calcPaymentInfoFee() {
7150
+ return _ref3.apply(this, arguments);
7151
+ };
7152
+ }();
7153
+ if (!(!assets.hasDryRunSupport(destination) || !forwardedXcms)) {
7154
+ _context2.next = 7;
7155
+ break;
7156
+ }
7157
+ _context2.next = 5;
7158
+ return calcPaymentInfoFee();
7159
+ case 5:
7160
+ _context2.t0 = _context2.sent;
7161
+ return _context2.abrupt("return", {
7162
+ fee: _context2.t0,
7163
+ feeType: 'paymentInfo'
7164
+ });
7042
7165
  case 7:
7043
- return _context.abrupt("return", _context.sent);
7044
- case 8:
7045
- _context.prev = 8;
7046
- _context.next = 11;
7047
- return api.disconnect();
7048
- case 11:
7049
- return _context.finish(8);
7050
- case 12:
7051
- case "end":
7052
- return _context.stop();
7166
+ _context2.next = 9;
7167
+ return api.getDryRunXcm({
7168
+ originLocation: addXcmVersionHeader(createOriginLocation(origin, destination), exports.Version.V4),
7169
+ xcm: forwardedXcms[1][0],
7170
+ node: destination,
7171
+ origin: origin
7172
+ });
7173
+ case 9:
7174
+ dryRunResult = _context2.sent;
7175
+ if (dryRunResult.success) {
7176
+ _context2.next = 18;
7177
+ break;
7178
+ }
7179
+ if (!disableFallback) {
7180
+ _context2.next = 13;
7181
+ break;
7182
+ }
7183
+ return _context2.abrupt("return", {
7184
+ dryRunError: dryRunResult.failureReason
7185
+ });
7186
+ case 13:
7187
+ _context2.next = 15;
7188
+ return calcPaymentInfoFee();
7189
+ case 15:
7190
+ _context2.t1 = _context2.sent;
7191
+ _context2.t2 = dryRunResult.failureReason;
7192
+ return _context2.abrupt("return", {
7193
+ fee: _context2.t1,
7194
+ feeType: 'paymentInfo',
7195
+ dryRunError: _context2.t2
7196
+ });
7197
+ case 18:
7198
+ fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
7199
+ return _context2.abrupt("return", {
7200
+ fee: fee,
7201
+ feeType: 'dryRun',
7202
+ forwardedXcms: newForwardedXcms,
7203
+ destParaId: destParaId
7204
+ });
7205
+ case 20:
7206
+ case "end":
7207
+ return _context2.stop();
7208
+ }
7209
+ }, _callee2);
7210
+ }));
7211
+ return function getFeeForDestNode(_x) {
7212
+ return _ref2.apply(this, arguments);
7213
+ };
7214
+ }();
7215
+
7216
+ var getDryRun = /*#__PURE__*/function () {
7217
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7218
+ var api, node, address;
7219
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7220
+ while (1) switch (_context.prev = _context.next) {
7221
+ case 0:
7222
+ api = options.api, node = options.node, address = options.address;
7223
+ validateAddress(address, node, false);
7224
+ _context.next = 4;
7225
+ return api.init(node);
7226
+ case 4:
7227
+ _context.prev = 4;
7228
+ _context.next = 7;
7229
+ return api.getDryRunCall(options);
7230
+ case 7:
7231
+ return _context.abrupt("return", _context.sent);
7232
+ case 8:
7233
+ _context.prev = 8;
7234
+ _context.next = 11;
7235
+ return api.disconnect();
7236
+ case 11:
7237
+ return _context.finish(8);
7238
+ case 12:
7239
+ case "end":
7240
+ return _context.stop();
7053
7241
  }
7054
7242
  }, _callee, null, [[4,, 8, 12]]);
7055
7243
  }));
@@ -7058,6 +7246,400 @@ var getDryRun = /*#__PURE__*/function () {
7058
7246
  };
7059
7247
  }();
7060
7248
 
7249
+ var getFeeForOriginNode = /*#__PURE__*/function () {
7250
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7251
+ var api, tx, origin, destination, senderAddress, disableFallback, rawFee, dryRunResult, _rawFee, fee, forwardedXcms, destParaId;
7252
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7253
+ while (1) switch (_context.prev = _context.next) {
7254
+ case 0:
7255
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, disableFallback = _ref.disableFallback;
7256
+ if (assets.hasDryRunSupport(origin)) {
7257
+ _context.next = 6;
7258
+ break;
7259
+ }
7260
+ _context.next = 4;
7261
+ return api.calculateTransactionFee(tx, senderAddress);
7262
+ case 4:
7263
+ rawFee = _context.sent;
7264
+ return _context.abrupt("return", {
7265
+ fee: padFee(rawFee, origin, destination, 'origin'),
7266
+ feeType: 'paymentInfo'
7267
+ });
7268
+ case 6:
7269
+ _context.next = 8;
7270
+ return getDryRun({
7271
+ api: api,
7272
+ tx: tx,
7273
+ node: origin,
7274
+ address: senderAddress
7275
+ });
7276
+ case 8:
7277
+ dryRunResult = _context.sent;
7278
+ if (dryRunResult.success) {
7279
+ _context.next = 16;
7280
+ break;
7281
+ }
7282
+ if (!disableFallback) {
7283
+ _context.next = 12;
7284
+ break;
7285
+ }
7286
+ return _context.abrupt("return", {
7287
+ dryRunError: dryRunResult.failureReason
7288
+ });
7289
+ case 12:
7290
+ _context.next = 14;
7291
+ return api.calculateTransactionFee(tx, senderAddress);
7292
+ case 14:
7293
+ _rawFee = _context.sent;
7294
+ return _context.abrupt("return", {
7295
+ fee: padFee(_rawFee, origin, destination, 'origin'),
7296
+ feeType: 'paymentInfo',
7297
+ dryRunError: dryRunResult.failureReason
7298
+ });
7299
+ case 16:
7300
+ fee = dryRunResult.fee, forwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
7301
+ return _context.abrupt("return", {
7302
+ fee: fee,
7303
+ feeType: 'dryRun',
7304
+ forwardedXcms: forwardedXcms,
7305
+ destParaId: destParaId
7306
+ });
7307
+ case 18:
7308
+ case "end":
7309
+ return _context.stop();
7310
+ }
7311
+ }, _callee);
7312
+ }));
7313
+ return function getFeeForOriginNode(_x) {
7314
+ return _ref2.apply(this, arguments);
7315
+ };
7316
+ }();
7317
+
7318
+ var getXcmFee = /*#__PURE__*/function () {
7319
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7320
+ var _findAsset;
7321
+ var api, tx, origin, destination, senderAddress, address, currency, disableFallback, asset, _yield$getFeeForOrigi, originFee, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, destApi, destFeeRes, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationFee, destinationFeeType, destinationDryRunError, nextChain, hopApi, hopResult, failingRecord, hopIsDestination, destFallback;
7322
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7323
+ while (1) switch (_context.prev = _context.next) {
7324
+ case 0:
7325
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, disableFallback = _ref.disableFallback;
7326
+ asset = (_findAsset = assets.findAsset(origin, currency, destination)) !== null && _findAsset !== void 0 ? _findAsset : origin === 'AssetHubPolkadot' ? assets.findAsset('Ethereum', currency, null) : null;
7327
+ if (asset) {
7328
+ _context.next = 4;
7329
+ break;
7330
+ }
7331
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(origin));
7332
+ case 4:
7333
+ _context.next = 6;
7334
+ return getFeeForOriginNode({
7335
+ api: api,
7336
+ tx: tx,
7337
+ origin: origin,
7338
+ destination: destination,
7339
+ senderAddress: senderAddress,
7340
+ disableFallback: disableFallback
7341
+ });
7342
+ case 6:
7343
+ _yield$getFeeForOrigi = _context.sent;
7344
+ originFee = _yield$getFeeForOrigi.fee;
7345
+ originFeeType = _yield$getFeeForOrigi.feeType;
7346
+ originDryRunError = _yield$getFeeForOrigi.dryRunError;
7347
+ initialForwardedXcm = _yield$getFeeForOrigi.forwardedXcms;
7348
+ initialDestParaId = _yield$getFeeForOrigi.destParaId;
7349
+ api.setDisconnectAllowed(true);
7350
+ _context.next = 15;
7351
+ return api.disconnect();
7352
+ case 15:
7353
+ if (!originDryRunError) {
7354
+ _context.next = 30;
7355
+ break;
7356
+ }
7357
+ destApi = api.clone();
7358
+ _context.prev = 17;
7359
+ _context.next = 20;
7360
+ return destApi.init(destination);
7361
+ case 20:
7362
+ destApi.setDisconnectAllowed(false);
7363
+ _context.next = 23;
7364
+ return getFeeForDestNode({
7365
+ api: destApi,
7366
+ forwardedXcms: undefined,
7367
+ // force paymentInfo
7368
+ origin: origin,
7369
+ destination: destination,
7370
+ currency: currency,
7371
+ address: address,
7372
+ senderAddress: senderAddress,
7373
+ disableFallback: disableFallback
7374
+ });
7375
+ case 23:
7376
+ destFeeRes = _context.sent;
7377
+ return _context.abrupt("return", {
7378
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7379
+ fee: originFee
7380
+ }), originFeeType && {
7381
+ feeType: originFeeType
7382
+ }), {}, {
7383
+ currency: assets.getNativeAssetSymbol(origin),
7384
+ dryRunError: originDryRunError
7385
+ }),
7386
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFeeRes.fee && {
7387
+ fee: destFeeRes.fee
7388
+ }), destFeeRes.feeType && {
7389
+ feeType: destFeeRes.feeType
7390
+ }), {}, {
7391
+ currency: assets.getNativeAssetSymbol(destination)
7392
+ })
7393
+ });
7394
+ case 25:
7395
+ _context.prev = 25;
7396
+ destApi.setDisconnectAllowed(true);
7397
+ _context.next = 29;
7398
+ return destApi.disconnect();
7399
+ case 29:
7400
+ return _context.finish(25);
7401
+ case 30:
7402
+ currentOrigin = origin;
7403
+ forwardedXcms = initialForwardedXcm;
7404
+ nextParaId = initialDestParaId;
7405
+ intermediateFees = {};
7406
+ destinationFee = 0n;
7407
+ destinationFeeType = 'paymentInfo';
7408
+ case 36:
7409
+ if (!(Array.isArray(forwardedXcms) && forwardedXcms.length > 0 && forwardedXcms[1].length > 0 && ('disconnect' in api.getApi() ? Object.values(forwardedXcms[1][0]).length : forwardedXcms[1][0].value.length) > 0 && nextParaId !== undefined)) {
7410
+ _context.next = 69;
7411
+ break;
7412
+ }
7413
+ nextChain = getTNode(nextParaId, determineRelayChain(origin) === 'Polkadot' ? 'polkadot' : 'kusama');
7414
+ if (!(nextChain === null)) {
7415
+ _context.next = 40;
7416
+ break;
7417
+ }
7418
+ throw new Error("Unable to find TNode for paraId ".concat(nextParaId));
7419
+ case 40:
7420
+ hopApi = api.clone();
7421
+ _context.prev = 41;
7422
+ _context.next = 44;
7423
+ return hopApi.init(nextChain);
7424
+ case 44:
7425
+ _context.next = 46;
7426
+ return getFeeForDestNode({
7427
+ api: hopApi,
7428
+ forwardedXcms: forwardedXcms,
7429
+ origin: currentOrigin,
7430
+ destination: nextChain,
7431
+ currency: currency,
7432
+ address: address,
7433
+ senderAddress: senderAddress,
7434
+ disableFallback: disableFallback
7435
+ });
7436
+ case 46:
7437
+ hopResult = _context.sent;
7438
+ if (!hopResult.dryRunError) {
7439
+ _context.next = 58;
7440
+ break;
7441
+ }
7442
+ failingRecord = {
7443
+ fee: hopResult.fee,
7444
+ feeType: hopResult.feeType,
7445
+ currency: assets.getNativeAssetSymbol(nextChain),
7446
+ dryRunError: hopResult.dryRunError
7447
+ };
7448
+ hopIsDestination = nextChain === destination || sdkCommon.isRelayChain(nextChain) && !sdkCommon.isRelayChain(destination);
7449
+ if (hopIsDestination) {
7450
+ destinationFee = hopResult.fee;
7451
+ destinationFeeType = hopResult.feeType; // paymentInfo
7452
+ destinationDryRunError = hopResult.dryRunError;
7453
+ } else if (nextChain === 'AssetHubPolkadot') {
7454
+ intermediateFees.assetHub = failingRecord;
7455
+ } else if (nextChain === 'BridgeHubPolkadot') {
7456
+ intermediateFees.bridgeHub = failingRecord;
7457
+ }
7458
+ // We failed *before* the true destination → fallback via paymentInfo.
7459
+ if (hopIsDestination) {
7460
+ _context.next = 57;
7461
+ break;
7462
+ }
7463
+ _context.next = 54;
7464
+ return getFeeForDestNode({
7465
+ api: hopApi,
7466
+ // already at failing hop
7467
+ forwardedXcms: undefined,
7468
+ // forces paymentInfo path
7469
+ origin: nextChain,
7470
+ destination: destination,
7471
+ currency: currency,
7472
+ address: address,
7473
+ senderAddress: senderAddress,
7474
+ disableFallback: disableFallback
7475
+ });
7476
+ case 54:
7477
+ destFallback = _context.sent;
7478
+ destinationFee = destFallback.fee;
7479
+ destinationFeeType = destFallback.feeType; // paymentInfo
7480
+ case 57:
7481
+ return _context.abrupt("break", 69);
7482
+ case 58:
7483
+ if (nextChain === destination || sdkCommon.isRelayChain(nextChain) && !sdkCommon.isRelayChain(destination)) {
7484
+ destinationFee = hopResult.fee;
7485
+ destinationFeeType = hopResult.feeType;
7486
+ } else if (nextChain === 'AssetHubPolkadot') {
7487
+ intermediateFees.assetHub = {
7488
+ fee: hopResult.fee,
7489
+ feeType: hopResult.feeType,
7490
+ currency: assets.getNativeAssetSymbol(nextChain)
7491
+ };
7492
+ } else if (nextChain === 'BridgeHubPolkadot') {
7493
+ intermediateFees.bridgeHub = {
7494
+ fee: hopResult.fee,
7495
+ feeType: hopResult.feeType,
7496
+ currency: assets.getNativeAssetSymbol(nextChain)
7497
+ };
7498
+ } else ;
7499
+ forwardedXcms = hopResult.forwardedXcms;
7500
+ nextParaId = hopResult.destParaId;
7501
+ currentOrigin = nextChain;
7502
+ case 62:
7503
+ _context.prev = 62;
7504
+ hopApi.setDisconnectAllowed(true);
7505
+ _context.next = 66;
7506
+ return hopApi.disconnect();
7507
+ case 66:
7508
+ return _context.finish(62);
7509
+ case 67:
7510
+ _context.next = 36;
7511
+ break;
7512
+ case 69:
7513
+ return _context.abrupt("return", _objectSpread2(_objectSpread2({
7514
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7515
+ fee: originFee
7516
+ }), originFeeType && {
7517
+ feeType: originFeeType
7518
+ }), {}, {
7519
+ currency: assets.getNativeAssetSymbol(origin)
7520
+ }, originDryRunError && {
7521
+ dryRunError: originDryRunError
7522
+ })
7523
+ }, intermediateFees), {}, {
7524
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destinationFee && {
7525
+ fee: destinationFee
7526
+ }), destinationFeeType && {
7527
+ feeType: destinationFeeType
7528
+ }), {}, {
7529
+ currency: destinationFeeType === 'dryRun' ? asset.symbol : assets.getNativeAssetSymbol(destination)
7530
+ }, destinationDryRunError && {
7531
+ dryRunError: destinationDryRunError
7532
+ })
7533
+ }));
7534
+ case 70:
7535
+ case "end":
7536
+ return _context.stop();
7537
+ }
7538
+ }, _callee, null, [[17,, 25, 30], [41,, 62, 67]]);
7539
+ }));
7540
+ return function getXcmFee(_x) {
7541
+ return _ref2.apply(this, arguments);
7542
+ };
7543
+ }();
7544
+
7545
+ var BRIDGE_FEE_DOT = 682395810n; // 0.068239581 DOT
7546
+ var BRIDGE_FEE_KSM = 12016807000n; // 0.012016807 KSM
7547
+ var getXcmFeeEstimate = /*#__PURE__*/function () {
7548
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7549
+ var api, tx, origin, destination, address, senderAddress, currency, rawOriginFee, originFee, destApi, originAsset, currencyInput, flippedTx, rawDestFee, destinationFee;
7550
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7551
+ while (1) switch (_context.prev = _context.next) {
7552
+ case 0:
7553
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, currency = _ref.currency;
7554
+ if (!(origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama')) {
7555
+ _context.next = 3;
7556
+ break;
7557
+ }
7558
+ return _context.abrupt("return", {
7559
+ origin: {
7560
+ fee: BRIDGE_FEE_DOT,
7561
+ currency: assets.getNativeAssetSymbol(origin)
7562
+ },
7563
+ destination: {
7564
+ fee: BRIDGE_FEE_KSM,
7565
+ currency: assets.getNativeAssetSymbol(destination)
7566
+ }
7567
+ });
7568
+ case 3:
7569
+ if (!(origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot')) {
7570
+ _context.next = 5;
7571
+ break;
7572
+ }
7573
+ return _context.abrupt("return", {
7574
+ origin: {
7575
+ fee: BRIDGE_FEE_KSM,
7576
+ currency: assets.getNativeAssetSymbol(origin)
7577
+ },
7578
+ destination: {
7579
+ fee: BRIDGE_FEE_DOT,
7580
+ currency: assets.getNativeAssetSymbol(destination)
7581
+ }
7582
+ });
7583
+ case 5:
7584
+ _context.next = 7;
7585
+ return api.calculateTransactionFee(tx, senderAddress);
7586
+ case 7:
7587
+ rawOriginFee = _context.sent;
7588
+ originFee = padFee(rawOriginFee, origin, destination, 'origin');
7589
+ destApi = api.clone();
7590
+ _context.next = 12;
7591
+ return destApi.init(destination);
7592
+ case 12:
7593
+ if (!('multiasset' in currency)) {
7594
+ _context.next = 14;
7595
+ break;
7596
+ }
7597
+ throw new assets.InvalidCurrencyError('Multi-assets are not yet supported for simple XCM fee estimation.');
7598
+ case 14:
7599
+ originAsset = assets.findAsset(origin, currency, destination);
7600
+ if (originAsset) {
7601
+ _context.next = 17;
7602
+ break;
7603
+ }
7604
+ throw new assets.InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " not found in ").concat(origin));
7605
+ case 17:
7606
+ currencyInput = originAsset.multiLocation ? {
7607
+ multilocation: originAsset.multiLocation
7608
+ } : {
7609
+ symbol: originAsset.symbol
7610
+ };
7611
+ _context.next = 20;
7612
+ return Builder(destApi).from(destination).to(origin).address(senderAddress, address).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
7613
+ amount: currency.amount
7614
+ })).build();
7615
+ case 20:
7616
+ flippedTx = _context.sent;
7617
+ _context.next = 23;
7618
+ return destApi.calculateTransactionFee(flippedTx, address);
7619
+ case 23:
7620
+ rawDestFee = _context.sent;
7621
+ destinationFee = padFee(rawDestFee, origin, destination, 'destination');
7622
+ return _context.abrupt("return", {
7623
+ origin: {
7624
+ fee: originFee,
7625
+ currency: assets.getNativeAssetSymbol(origin)
7626
+ },
7627
+ destination: {
7628
+ fee: destinationFee,
7629
+ currency: assets.getNativeAssetSymbol(destination)
7630
+ }
7631
+ });
7632
+ case 26:
7633
+ case "end":
7634
+ return _context.stop();
7635
+ }
7636
+ }, _callee);
7637
+ }));
7638
+ return function getXcmFeeEstimate(_x) {
7639
+ return _ref2.apply(this, arguments);
7640
+ };
7641
+ }();
7642
+
7061
7643
  var transferRelayToPara = /*#__PURE__*/function () {
7062
7644
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7063
7645
  var api, origin, destination, asset, address, paraIdTo, version, pallet, method, isMultiLocationDestination, serializedApiCall;
@@ -7510,19 +8092,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
7510
8092
  currency: _currency
7511
8093
  }));
7512
8094
  }
7513
- /**
7514
- * Sets the recipient address.
7515
- *
7516
- * @param address - The destination address.
7517
- * @returns An instance of Builder
7518
- */
7519
8095
  }, {
7520
8096
  key: "address",
7521
8097
  value: function address(_address, senderAddress) {
7522
8098
  return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
7523
- address: _address,
8099
+ address: _address
8100
+ }, senderAddress ? {
7524
8101
  senderAddress: senderAddress
7525
- }));
8102
+ } : {}));
7526
8103
  }
7527
8104
  /**
7528
8105
  * Sets the XCM version to be used for the transfer.
@@ -7676,11 +8253,140 @@ var GeneralBuilder = /*#__PURE__*/function () {
7676
8253
  }
7677
8254
  return dryRun;
7678
8255
  }()
8256
+ /**
8257
+ * Estimates the XCM fee for the transfer using paymentInfo function.
8258
+ *
8259
+ * @returns An origin and destination fee estimate.
8260
+ */
8261
+ }, {
8262
+ key: "getXcmFeeEstimate",
8263
+ value: (function () {
8264
+ var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
8265
+ var _this$_options2, from, to, address, senderAddress, tx;
8266
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
8267
+ while (1) switch (_context4.prev = _context4.next) {
8268
+ case 0:
8269
+ _this$_options2 = this._options, from = _this$_options2.from, to = _this$_options2.to, address = _this$_options2.address, senderAddress = _this$_options2.senderAddress;
8270
+ if (!sdkCommon.isTMultiLocation(to)) {
8271
+ _context4.next = 3;
8272
+ break;
8273
+ }
8274
+ throw new InvalidParameterError('Multi-Location destination is not supported for XCM fee calculation.');
8275
+ case 3:
8276
+ if (!sdkCommon.isTMultiLocation(address)) {
8277
+ _context4.next = 5;
8278
+ break;
8279
+ }
8280
+ throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
8281
+ case 5:
8282
+ if (!(to === 'Ethereum')) {
8283
+ _context4.next = 7;
8284
+ break;
8285
+ }
8286
+ throw new InvalidParameterError('Ethereum destination is not yet supported for XCM fee calculation.');
8287
+ case 7:
8288
+ this.api.setDisconnectAllowed(false);
8289
+ _context4.next = 10;
8290
+ return this.build();
8291
+ case 10:
8292
+ tx = _context4.sent;
8293
+ this.api.setDisconnectAllowed(true);
8294
+ return _context4.abrupt("return", getXcmFeeEstimate({
8295
+ api: this.api,
8296
+ tx: tx,
8297
+ origin: from,
8298
+ destination: to,
8299
+ address: address,
8300
+ senderAddress: senderAddress,
8301
+ currency: this._options.currency
8302
+ }));
8303
+ case 13:
8304
+ case "end":
8305
+ return _context4.stop();
8306
+ }
8307
+ }, _callee4, this);
8308
+ }));
8309
+ function getXcmFeeEstimate$1() {
8310
+ return _getXcmFeeEstimate2.apply(this, arguments);
8311
+ }
8312
+ return getXcmFeeEstimate$1;
8313
+ }()
8314
+ /**
8315
+ * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
8316
+ *
8317
+ * @returns An origin and destination fee.
8318
+ */
8319
+ )
8320
+ }, {
8321
+ key: "getXcmFee",
8322
+ value: (function () {
8323
+ var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
8324
+ var _ref,
8325
+ disableFallback,
8326
+ _this$_options3,
8327
+ from,
8328
+ to,
8329
+ address,
8330
+ senderAddress,
8331
+ tx,
8332
+ _args5 = arguments;
8333
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
8334
+ while (1) switch (_context5.prev = _context5.next) {
8335
+ case 0:
8336
+ _ref = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {
8337
+ disableFallback: false
8338
+ }, disableFallback = _ref.disableFallback;
8339
+ _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, address = _this$_options3.address, senderAddress = _this$_options3.senderAddress;
8340
+ if (!sdkCommon.isTMultiLocation(to)) {
8341
+ _context5.next = 4;
8342
+ break;
8343
+ }
8344
+ throw new InvalidParameterError('Multi-Location destination is not supported for XCM fee calculation.');
8345
+ case 4:
8346
+ if (!sdkCommon.isTMultiLocation(address)) {
8347
+ _context5.next = 6;
8348
+ break;
8349
+ }
8350
+ throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
8351
+ case 6:
8352
+ if (!(to === 'Ethereum')) {
8353
+ _context5.next = 8;
8354
+ break;
8355
+ }
8356
+ throw new InvalidParameterError('Ethereum destination is not yet supported for XCM fee calculation.');
8357
+ case 8:
8358
+ _context5.next = 10;
8359
+ return this.build();
8360
+ case 10:
8361
+ tx = _context5.sent;
8362
+ this.api.setDisconnectAllowed(false);
8363
+ return _context5.abrupt("return", getXcmFee({
8364
+ api: this.api,
8365
+ tx: tx,
8366
+ origin: from,
8367
+ destination: to,
8368
+ senderAddress: senderAddress,
8369
+ address: address,
8370
+ currency: this._options.currency,
8371
+ disableFallback: disableFallback
8372
+ }));
8373
+ case 13:
8374
+ case "end":
8375
+ return _context5.stop();
8376
+ }
8377
+ }, _callee5, this);
8378
+ }));
8379
+ function getXcmFee$1() {
8380
+ return _getXcmFee2.apply(this, arguments);
8381
+ }
8382
+ return getXcmFee$1;
8383
+ }()
7679
8384
  /**
7680
8385
  * Returns the API instance used by the builder.
7681
8386
  *
7682
8387
  * @returns The API instance.
7683
8388
  */
8389
+ )
7684
8390
  }, {
7685
8391
  key: "getApi",
7686
8392
  value: function getApi() {
@@ -7708,25 +8414,6 @@ var Builder = function Builder(api) {
7708
8414
  return new GeneralBuilder(api, new BatchTransactionManager());
7709
8415
  };
7710
8416
 
7711
- /**
7712
- * Retrieves the node name corresponding to a specified parachain ID.
7713
- *
7714
- * @param paraId - The parachain ID.
7715
- * @returns The node name if found; otherwise, null.
7716
- */
7717
- var getTNode = function getTNode(paraId, ecosystem) {
7718
- var _NODE_NAMES_DOT_KSM$f;
7719
- if (paraId === 0) {
7720
- return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
7721
- }
7722
- if (paraId === 1) {
7723
- return 'Ethereum';
7724
- }
7725
- return (_NODE_NAMES_DOT_KSM$f = sdkCommon.NODE_NAMES_DOT_KSM.find(function (nodeName) {
7726
- return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
7727
- })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
7728
- };
7729
-
7730
8417
  var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
7731
8418
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node, address, asset) {
7732
8419
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -7976,8 +8663,8 @@ var getBalanceNative = /*#__PURE__*/function () {
7976
8663
 
7977
8664
  var getAssetBalanceInternal = /*#__PURE__*/function () {
7978
8665
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7979
- var _yield$getBalanceFore;
7980
- var address, node, currency, api, isNativeSymbol;
8666
+ var _findAsset, _yield$getBalanceFore;
8667
+ var address, node, currency, api, asset, isNativeSymbol;
7981
8668
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7982
8669
  while (1) switch (_context.prev = _context.next) {
7983
8670
  case 0:
@@ -7985,52 +8672,59 @@ var getAssetBalanceInternal = /*#__PURE__*/function () {
7985
8672
  _context.next = 3;
7986
8673
  return api.init(node);
7987
8674
  case 3:
7988
- isNativeSymbol = 'symbol' in currency ? assets.getNativeAssetSymbol(node) === currency.symbol : false;
8675
+ asset = (_findAsset = assets.findAsset(node, currency, null)) !== null && _findAsset !== void 0 ? _findAsset : node === 'AssetHubPolkadot' ? assets.findAsset('Ethereum', currency, null) : null;
8676
+ if (asset) {
8677
+ _context.next = 6;
8678
+ break;
8679
+ }
8680
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(node));
8681
+ case 6:
8682
+ isNativeSymbol = asset.symbol === assets.getNativeAssetSymbol(node);
7989
8683
  if (!(isNativeSymbol && node !== 'Interlay' && node !== 'Kintsugi')) {
7990
- _context.next = 10;
8684
+ _context.next = 13;
7991
8685
  break;
7992
8686
  }
7993
- _context.next = 7;
8687
+ _context.next = 10;
7994
8688
  return getBalanceNativeInternal({
7995
8689
  address: address,
7996
8690
  node: node,
7997
8691
  api: api
7998
8692
  });
7999
- case 7:
8693
+ case 10:
8000
8694
  _context.t0 = _context.sent;
8001
- _context.next = 22;
8695
+ _context.next = 25;
8002
8696
  break;
8003
- case 10:
8004
- _context.next = 12;
8697
+ case 13:
8698
+ _context.next = 15;
8005
8699
  return getBalanceForeignInternal({
8006
8700
  address: address,
8007
8701
  node: node,
8008
8702
  api: api,
8009
8703
  currency: currency
8010
8704
  });
8011
- case 12:
8705
+ case 15:
8012
8706
  _context.t2 = _yield$getBalanceFore = _context.sent;
8013
8707
  _context.t1 = _context.t2 !== null;
8014
8708
  if (!_context.t1) {
8015
- _context.next = 16;
8709
+ _context.next = 19;
8016
8710
  break;
8017
8711
  }
8018
8712
  _context.t1 = _yield$getBalanceFore !== void 0;
8019
- case 16:
8713
+ case 19:
8020
8714
  if (!_context.t1) {
8021
- _context.next = 20;
8715
+ _context.next = 23;
8022
8716
  break;
8023
8717
  }
8024
8718
  _context.t3 = _yield$getBalanceFore;
8025
- _context.next = 21;
8719
+ _context.next = 24;
8026
8720
  break;
8027
- case 20:
8721
+ case 23:
8028
8722
  _context.t3 = 0n;
8029
- case 21:
8723
+ case 24:
8030
8724
  _context.t0 = _context.t3;
8031
- case 22:
8725
+ case 25:
8032
8726
  return _context.abrupt("return", _context.t0);
8033
- case 23:
8727
+ case 26:
8034
8728
  case "end":
8035
8729
  return _context.stop();
8036
8730
  }
@@ -8485,6 +9179,7 @@ exports.ETH_CHAIN_ID = ETH_CHAIN_ID;
8485
9179
  exports.GeneralBuilder = GeneralBuilder;
8486
9180
  exports.IncompatibleNodesError = IncompatibleNodesError;
8487
9181
  exports.InvalidAddressError = InvalidAddressError;
9182
+ exports.InvalidParameterError = InvalidParameterError;
8488
9183
  exports.NoXCMSupportImplementedError = NoXCMSupportImplementedError;
8489
9184
  exports.NodeNotSupportedError = NodeNotSupportedError;
8490
9185
  exports.ScenarioNotSupportedError = ScenarioNotSupportedError;
@@ -8518,6 +9213,8 @@ exports.getParaId = getParaId;
8518
9213
  exports.getTNode = getTNode;
8519
9214
  exports.getTransferInfo = getTransferInfo;
8520
9215
  exports.getTransferableAmount = getTransferableAmount;
9216
+ exports.getXcmFee = getXcmFee;
9217
+ exports.getXcmFeeEstimate = getXcmFeeEstimate;
8521
9218
  exports.isEthersContract = isEthersContract;
8522
9219
  exports.isEthersSigner = isEthersSigner;
8523
9220
  exports.resolveModuleError = resolveModuleError;