@paraspell/sdk-core 8.11.1 → 8.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/dist/index.cjs +1306 -614
  2. package/dist/index.d.ts +162 -22
  3. package/dist/index.mjs +1305 -616
  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"
@@ -1191,20 +1329,20 @@ var Moonbeam$1 = {
1191
1329
  paraId: 2004,
1192
1330
  providers: [
1193
1331
  {
1194
- name: "Allnodes",
1195
- endpoint: "wss://moonbeam-rpc.publicnode.com"
1332
+ name: "IBP1",
1333
+ endpoint: "wss://moonbeam.ibp.network"
1196
1334
  },
1197
1335
  {
1198
- name: "Blast",
1199
- endpoint: "wss://moonbeam.public.blastapi.io"
1336
+ name: "RadiumBlock",
1337
+ endpoint: "wss://moonbeam.public.curie.radiumblock.co/ws"
1200
1338
  },
1201
1339
  {
1202
- name: "Dwellir",
1203
- endpoint: "wss://moonbeam-rpc.n.dwellir.com"
1340
+ name: "Allnodes",
1341
+ endpoint: "wss://moonbeam-rpc.publicnode.com"
1204
1342
  },
1205
1343
  {
1206
- name: "IBP1",
1207
- endpoint: "wss://moonbeam.ibp.network"
1344
+ name: "Blast",
1345
+ endpoint: "wss://moonbeam.public.blastapi.io"
1208
1346
  },
1209
1347
  {
1210
1348
  name: "IBP2",
@@ -1218,10 +1356,6 @@ var Moonbeam$1 = {
1218
1356
  name: "OnFinality",
1219
1357
  endpoint: "wss://moonbeam.api.onfinality.io/public-ws"
1220
1358
  },
1221
- {
1222
- name: "RadiumBlock",
1223
- endpoint: "wss://moonbeam.public.curie.radiumblock.co/ws"
1224
- },
1225
1359
  {
1226
1360
  name: "UnitedBloc",
1227
1361
  endpoint: "wss://moonbeam.unitedbloc.com"
@@ -1274,7 +1408,7 @@ var CoretimeKusama$1 = {
1274
1408
  providers: [
1275
1409
  {
1276
1410
  name: "Dwellir",
1277
- endpoint: "wss://coretime-kusama-rpc.dwellir.com"
1411
+ endpoint: "wss://coretime-kusama-rpc.n.dwellir.com"
1278
1412
  },
1279
1413
  {
1280
1414
  name: "IBP1",
@@ -1288,6 +1422,10 @@ var CoretimeKusama$1 = {
1288
1422
  name: "LuckyFriday",
1289
1423
  endpoint: "wss://rpc-coretime-kusama.luckyfriday.io"
1290
1424
  },
1425
+ {
1426
+ name: "OnFinality",
1427
+ endpoint: "wss://coretime-kusama.api.onfinality.io/public-ws"
1428
+ },
1291
1429
  {
1292
1430
  name: "Parity",
1293
1431
  endpoint: "wss://kusama-coretime-rpc.polkadot.io"
@@ -1303,6 +1441,10 @@ var CoretimePolkadot$1 = {
1303
1441
  info: "polkadotCoretime",
1304
1442
  paraId: 1005,
1305
1443
  providers: [
1444
+ {
1445
+ name: "Dwellir",
1446
+ endpoint: "wss://coretime-polkadot-rpc.n.dwellir.com"
1447
+ },
1306
1448
  {
1307
1449
  name: "IBP1",
1308
1450
  endpoint: "wss://sys.ibp.network/coretime-polkadot"
@@ -1315,9 +1457,17 @@ var CoretimePolkadot$1 = {
1315
1457
  name: "LuckyFriday",
1316
1458
  endpoint: "wss://rpc-coretime-polkadot.luckyfriday.io"
1317
1459
  },
1460
+ {
1461
+ name: "OnFinality",
1462
+ endpoint: "wss://coretime-polkadot.api.onfinality.io/public-ws"
1463
+ },
1318
1464
  {
1319
1465
  name: "Parity",
1320
1466
  endpoint: "wss://polkadot-coretime-rpc.polkadot.io"
1467
+ },
1468
+ {
1469
+ name: "Stakeworld",
1470
+ endpoint: "wss://dot-rpc.stakeworld.io/coretime"
1321
1471
  }
1322
1472
  ]
1323
1473
  };
@@ -1368,10 +1518,6 @@ var Amplitude$1 = {
1368
1518
  info: "amplitude",
1369
1519
  paraId: 2124,
1370
1520
  providers: [
1371
- {
1372
- name: "Dwellir",
1373
- endpoint: "wss://amplitude-rpc.dwellir.com"
1374
- },
1375
1521
  {
1376
1522
  name: "PendulumChain",
1377
1523
  endpoint: "wss://rpc-amplitude.pendulumchain.tech"
@@ -1412,17 +1558,6 @@ var BifrostKusama$1 = {
1412
1558
  }
1413
1559
  ]
1414
1560
  };
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
1561
  var CrustShadow$1 = {
1427
1562
  name: "Crust Shadow",
1428
1563
  info: "shadow",
@@ -1461,21 +1596,10 @@ var Crab$1 = {
1461
1596
  }
1462
1597
  ]
1463
1598
  };
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
- var Karura$1 = {
1476
- name: "Karura",
1477
- info: "karura",
1478
- paraId: 2000,
1599
+ var Karura$1 = {
1600
+ name: "Karura",
1601
+ info: "karura",
1602
+ paraId: 2000,
1479
1603
  providers: [
1480
1604
  {
1481
1605
  name: "Acala Foundation 0",
@@ -1508,10 +1632,6 @@ var Kintsugi$1 = {
1508
1632
  info: "kintsugi",
1509
1633
  paraId: 2092,
1510
1634
  providers: [
1511
- {
1512
- name: "Dwellir",
1513
- endpoint: "wss://kintsugi-rpc.dwellir.com"
1514
- },
1515
1635
  {
1516
1636
  name: "Kintsugi Labs",
1517
1637
  endpoint: "wss://api-kusama.interlay.io/parachain"
@@ -1562,18 +1682,10 @@ var Quartz$1 = {
1562
1682
  info: "quartz",
1563
1683
  paraId: 2095,
1564
1684
  providers: [
1565
- {
1566
- name: "Dwellir",
1567
- endpoint: "wss://quartz-rpc.n.dwellir.com"
1568
- },
1569
1685
  {
1570
1686
  name: "Geo Load Balancer",
1571
1687
  endpoint: "wss://ws-quartz.unique.network"
1572
1688
  },
1573
- {
1574
- name: "Unique America",
1575
- endpoint: "wss://us-ws-quartz.unique.network"
1576
- },
1577
1689
  {
1578
1690
  name: "Unique Asia",
1579
1691
  endpoint: "wss://asia-ws-quartz.unique.network"
@@ -1611,6 +1723,10 @@ var PeoplePolkadot$1 = {
1611
1723
  info: "polkadotPeople",
1612
1724
  paraId: 1004,
1613
1725
  providers: [
1726
+ {
1727
+ name: "Dwellir",
1728
+ endpoint: "wss://people-polkadot-rpc.n.dwellir.com"
1729
+ },
1614
1730
  {
1615
1731
  name: "IBP1",
1616
1732
  endpoint: "wss://sys.ibp.network/people-polkadot"
@@ -1623,6 +1739,10 @@ var PeoplePolkadot$1 = {
1623
1739
  name: "LuckyFriday",
1624
1740
  endpoint: "wss://rpc-people-polkadot.luckyfriday.io"
1625
1741
  },
1742
+ {
1743
+ name: "OnFinality",
1744
+ endpoint: "wss://people-polkadot.api.onfinality.io/public-ws"
1745
+ },
1626
1746
  {
1627
1747
  name: "Parity",
1628
1748
  endpoint: "wss://polkadot-people-rpc.polkadot.io"
@@ -1630,6 +1750,10 @@ var PeoplePolkadot$1 = {
1630
1750
  {
1631
1751
  name: "RadiumBlock",
1632
1752
  endpoint: "wss://people-polkadot.public.curie.radiumblock.co/ws"
1753
+ },
1754
+ {
1755
+ name: "Stakeworld",
1756
+ endpoint: "wss://dot-rpc.stakeworld.io/people"
1633
1757
  }
1634
1758
  ]
1635
1759
  };
@@ -1642,6 +1766,10 @@ var PeopleKusama$1 = {
1642
1766
  name: "Dwellir",
1643
1767
  endpoint: "wss://people-kusama-rpc.n.dwellir.com"
1644
1768
  },
1769
+ {
1770
+ name: "Helixstreet",
1771
+ endpoint: "wss://rpc-people-kusama.helixstreet.io"
1772
+ },
1645
1773
  {
1646
1774
  name: "IBP1",
1647
1775
  endpoint: "wss://sys.ibp.network/people-kusama"
@@ -1654,6 +1782,10 @@ var PeopleKusama$1 = {
1654
1782
  name: "LuckyFriday",
1655
1783
  endpoint: "wss://rpc-people-kusama.luckyfriday.io"
1656
1784
  },
1785
+ {
1786
+ name: "OnFinality",
1787
+ endpoint: "wss://people-kusama.api.onfinality.io/public-ws"
1788
+ },
1657
1789
  {
1658
1790
  name: "Parity",
1659
1791
  endpoint: "wss://kusama-people-rpc.polkadot.io"
@@ -1791,10 +1923,6 @@ var NeuroWeb$1 = {
1791
1923
  info: "neuroweb",
1792
1924
  paraId: 2043,
1793
1925
  providers: [
1794
- {
1795
- name: "Dwellir",
1796
- endpoint: "wss://neuroweb-rpc.dwellir.com"
1797
- },
1798
1926
  {
1799
1927
  name: "TraceLabs",
1800
1928
  endpoint: "wss://parachain-rpc.origin-trail.network"
@@ -1897,10 +2025,6 @@ var Subsocial$1 = {
1897
2025
  {
1898
2026
  name: "Dappforce",
1899
2027
  endpoint: "wss://para.subsocial.network"
1900
- },
1901
- {
1902
- name: "Dwellir",
1903
- endpoint: "wss://subsocial-rpc.dwellir.com"
1904
2028
  }
1905
2029
  ]
1906
2030
  };
@@ -1909,10 +2033,6 @@ var KiltSpiritnet$1 = {
1909
2033
  info: "kilt",
1910
2034
  paraId: 2086,
1911
2035
  providers: [
1912
- {
1913
- name: "Dwellir",
1914
- endpoint: "wss://kilt-rpc.dwellir.com"
1915
- },
1916
2036
  {
1917
2037
  name: "IBP1",
1918
2038
  endpoint: "wss://kilt.ibp.network"
@@ -2048,10 +2168,6 @@ var Polkadot = {
2048
2168
  name: "RadiumBlock",
2049
2169
  endpoint: "wss://polkadot.public.curie.radiumblock.co/ws"
2050
2170
  },
2051
- {
2052
- name: "RockX",
2053
- endpoint: "wss://rockx-dot.w3node.com/polka-public-dot/ws"
2054
- },
2055
2171
  {
2056
2172
  name: "Stakeworld",
2057
2173
  endpoint: "wss://dot-rpc.stakeworld.io"
@@ -2103,10 +2219,6 @@ var Kusama = {
2103
2219
  name: "RadiumBlock",
2104
2220
  endpoint: "wss://kusama.public.curie.radiumblock.co/ws"
2105
2221
  },
2106
- {
2107
- name: "RockX",
2108
- endpoint: "wss://rockx-ksm.w3node.com/polka-public-ksm/ws"
2109
- },
2110
2222
  {
2111
2223
  name: "Stakeworld",
2112
2224
  endpoint: "wss://ksm-rpc.stakeworld.io"
@@ -2116,6 +2228,7 @@ var Kusama = {
2116
2228
  var configs = {
2117
2229
  AssetHubPolkadot: AssetHubPolkadot$1,
2118
2230
  Acala: Acala$1,
2231
+ Ajuna: Ajuna$1,
2119
2232
  Astar: Astar$1,
2120
2233
  BifrostPolkadot: BifrostPolkadot$1,
2121
2234
  Bitgreen: Bitgreen$1,
@@ -2136,10 +2249,8 @@ var configs = {
2136
2249
  Amplitude: Amplitude$1,
2137
2250
  Basilisk: Basilisk$1,
2138
2251
  BifrostKusama: BifrostKusama$1,
2139
- Calamari: Calamari$1,
2140
2252
  CrustShadow: CrustShadow$1,
2141
2253
  Crab: Crab$1,
2142
- InvArchTinker: InvArchTinker$1,
2143
2254
  Karura: Karura$1,
2144
2255
  Kintsugi: Kintsugi$1,
2145
2256
  Moonriver: Moonriver$1,
@@ -2290,7 +2401,7 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
2290
2401
  includeFee = _ref2.includeFee;
2291
2402
  var paraId = resolveParaId(paraIdTo, destination);
2292
2403
  return _objectSpread2({
2293
- dest: createPolkadotXcmHeader('RelayToPara', version, destination, paraId),
2404
+ dest: createVersionedDestination('RelayToPara', version, destination, paraId),
2294
2405
  beneficiary: createVersionedBeneficiary({
2295
2406
  api: api,
2296
2407
  scenario: 'RelayToPara',
@@ -2352,7 +2463,7 @@ var createVersionedMultiAssets = function createVersionedMultiAssets(version, am
2352
2463
  var multiAssets = createMultiAsset(version, amount, multiLocation);
2353
2464
  return addXcmVersionHeader([multiAssets], version);
2354
2465
  };
2355
- var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId, junction, parents) {
2466
+ var createVersionedDestination = function createVersionedDestination(scenario, version, destination, nodeId, junction, parents) {
2356
2467
  var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? sdkCommon.Parents.ZERO : sdkCommon.Parents.ONE;
2357
2468
  var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
2358
2469
  Parachain: nodeId
@@ -2392,10 +2503,10 @@ var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(relay
2392
2503
  return node;
2393
2504
  };
2394
2505
  var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, node) {
2395
- var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2506
+ var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2396
2507
  isDestination: false
2397
2508
  },
2398
- isDestination = _ref3.isDestination;
2509
+ isDestination = _ref2.isDestination;
2399
2510
  if ('multilocation' in currency) {
2400
2511
  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
2512
  }
@@ -2701,148 +2812,6 @@ var resolveParaId = function resolveParaId(paraId, destination) {
2701
2812
  return paraId !== null && paraId !== void 0 ? paraId : getParaId(destination);
2702
2813
  };
2703
2814
 
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
2815
  var validateAddress = function validateAddress(address, node) {
2847
2816
  var isDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
2848
2817
  var isEvm = assets.isNodeEvm(node);
@@ -3032,12 +3001,13 @@ var getBridgeStatus = /*#__PURE__*/function () {
3032
3001
  };
3033
3002
  }();
3034
3003
 
3035
- var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messageId) {
3004
+ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, version, messageId) {
3036
3005
  var api = _ref.api,
3037
3006
  address = _ref.address,
3038
3007
  asset = _ref.asset,
3039
3008
  scenario = _ref.scenario,
3040
- senderAddress = _ref.senderAddress;
3009
+ senderAddress = _ref.senderAddress,
3010
+ ahAddress = _ref.ahAddress;
3041
3011
  if (!assets.isForeignAsset(asset)) {
3042
3012
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3043
3013
  }
@@ -3045,7 +3015,10 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
3045
3015
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
3046
3016
  }
3047
3017
  if (!senderAddress) {
3048
- throw new assets.InvalidCurrencyError("Please provide senderAddress");
3018
+ throw new InvalidParameterError("Please provide senderAddress");
3019
+ }
3020
+ if (assets.isNodeEvm(origin) && !ahAddress) {
3021
+ throw new InvalidParameterError("Please provide ahAddress");
3049
3022
  }
3050
3023
  var ethAsset = assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
3051
3024
  if (!ethAsset) {
@@ -3071,7 +3044,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
3071
3044
  api: api,
3072
3045
  scenario: scenario,
3073
3046
  pallet: 'PolkadotXcm',
3074
- recipientAddress: senderAddress,
3047
+ recipientAddress: assets.isNodeEvm(origin) ? ahAddress : senderAddress,
3075
3048
  version: version
3076
3049
  })
3077
3050
  }
@@ -3211,11 +3184,11 @@ var ParachainNode = /*#__PURE__*/function () {
3211
3184
  key: "transfer",
3212
3185
  value: function () {
3213
3186
  var _transfer = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
3214
- var api, asset, feeAsset, address, destination, paraIdTo, overriddenAsset, version, senderAddress, pallet, method, isRelayDestination, scenario, paraId, versionOrDefault, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
3187
+ var api, asset, feeAsset, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, isRelayDestination, scenario, paraId, versionOrDefault, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
3215
3188
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3216
3189
  while (1) switch (_context.prev = _context.next) {
3217
3190
  case 0:
3218
- api = options.api, asset = options.asset, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, pallet = options.pallet, method = options.method;
3191
+ api = options.api, asset = options.asset, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
3219
3192
  isRelayDestination = !sdkCommon.isTMultiLocation(destination) && sdkCommon.isRelayChain(destination);
3220
3193
  scenario = isRelayDestination ? 'ParaToRelay' : 'ParaToPara';
3221
3194
  paraId = resolveParaId(paraIdTo, destination);
@@ -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,
@@ -3309,6 +3282,7 @@ var ParachainNode = /*#__PURE__*/function () {
3309
3282
  paraIdTo: paraId,
3310
3283
  version: version,
3311
3284
  senderAddress: senderAddress,
3285
+ ahAddress: ahAddress,
3312
3286
  pallet: pallet,
3313
3287
  method: method
3314
3288
  }; // Handle common cases
@@ -3377,9 +3351,9 @@ var ParachainNode = /*#__PURE__*/function () {
3377
3351
  });
3378
3352
  }
3379
3353
  }, {
3380
- key: "createPolkadotXcmHeader",
3381
- value: function createPolkadotXcmHeader$1(scenario, version, destination, paraId) {
3382
- return createPolkadotXcmHeader(scenario, version, destination, paraId);
3354
+ key: "createVersionedDestination",
3355
+ value: function createVersionedDestination$1(scenario, version, destination, paraId) {
3356
+ return createVersionedDestination(scenario, version, destination, paraId);
3383
3357
  }
3384
3358
  }, {
3385
3359
  key: "getNativeAssetSymbol",
@@ -3492,13 +3466,13 @@ var ParachainNode = /*#__PURE__*/function () {
3492
3466
  case 15:
3493
3467
  // Pad fee by 50%
3494
3468
  dryRunFeePadded = BigInt(dryRunResult.fee) * BigInt(3) / BigInt(2);
3495
- destWithHeader = createPolkadotXcmHeader(scenario, version, destination, paraIdTo);
3469
+ destWithHeader = createVersionedDestination(scenario, version, destination, paraIdTo);
3496
3470
  _extractVersionFromHe = extractVersionFromHeader(destWithHeader), _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2), _extractVersionFromHe2[0], dest = _extractVersionFromHe2[1];
3497
3471
  call = {
3498
3472
  module: 'PolkadotXcm',
3499
3473
  section: 'transfer_assets_using_type_and_then',
3500
3474
  parameters: {
3501
- dest: this.createPolkadotXcmHeader(scenario, version, destination, getParaId('AssetHubPolkadot')),
3475
+ dest: this.createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
3502
3476
  assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
3503
3477
  assets_transfer_type: 'DestinationReserve',
3504
3478
  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 +3629,7 @@ var ParachainNode = /*#__PURE__*/function () {
3655
3629
  module: 'PolkadotXcm',
3656
3630
  section: 'transfer_assets_using_type_and_then',
3657
3631
  parameters: {
3658
- dest: this.createPolkadotXcmHeader(scenario, version, destination, getParaId('AssetHubPolkadot')),
3632
+ dest: this.createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
3659
3633
  assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, fee, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
3660
3634
  assets_transfer_type: 'DestinationReserve',
3661
3635
  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),
@@ -3675,7 +3649,7 @@ var ParachainNode = /*#__PURE__*/function () {
3675
3649
  version: version
3676
3650
  })
3677
3651
  }
3678
- }], version) : createCustomXcmOnDest(input, version, messageId),
3652
+ }], version) : createCustomXcmOnDest(input, this.node, version, messageId),
3679
3653
  weight_limit: 'Unlimited'
3680
3654
  }
3681
3655
  };
@@ -3703,10 +3677,11 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3703
3677
  return _createClass(Acala, [{
3704
3678
  key: "getCurrencySelection",
3705
3679
  value: function getCurrencySelection(asset) {
3680
+ var symbol = asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol;
3706
3681
  return assets.isForeignAsset(asset) ? {
3707
3682
  ForeignAsset: Number(asset.assetId)
3708
3683
  } : {
3709
- Token: asset.symbol
3684
+ Token: symbol
3710
3685
  };
3711
3686
  }
3712
3687
  }, {
@@ -3749,9 +3724,7 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3749
3724
  dest: {
3750
3725
  Id: address
3751
3726
  },
3752
- currency_id: this.getCurrencySelection(_objectSpread2(_objectSpread2({}, asset), {}, {
3753
- symbol: asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol
3754
- })),
3727
+ currency_id: this.getCurrencySelection(asset),
3755
3728
  amount: BigInt(asset.amount)
3756
3729
  }
3757
3730
  });
@@ -3759,35 +3732,139 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3759
3732
  }]);
3760
3733
  }(ParachainNode);
3761
3734
 
3762
- var Altair = /*#__PURE__*/function (_ParachainNode) {
3763
- function Altair() {
3764
- _classCallCheck(this, Altair);
3765
- return _callSuper(this, Altair, ['Altair', 'altair', 'kusama', exports.Version.V3]);
3735
+ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
3736
+ function PolkadotXCMTransferImpl() {
3737
+ _classCallCheck(this, PolkadotXCMTransferImpl);
3766
3738
  }
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)
3739
+ return _createClass(PolkadotXCMTransferImpl, null, [{
3740
+ key: "transferPolkadotXCM",
3741
+ value: function transferPolkadotXCM(_ref, section) {
3742
+ var api = _ref.api,
3743
+ header = _ref.header,
3744
+ asset = _ref.asset,
3745
+ addressSelection = _ref.addressSelection,
3746
+ currencySelection = _ref.currencySelection,
3747
+ overriddenAsset = _ref.overriddenAsset,
3748
+ pallet = _ref.pallet,
3749
+ method = _ref.method;
3750
+ var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
3751
+ var _extractVersionFromHe = extractVersionFromHeader(currencySelection),
3752
+ _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2),
3753
+ version = _extractVersionFromHe2[0],
3754
+ multiAssets = _extractVersionFromHe2[1];
3755
+ var resolvedMultiAssets = addXcmVersionHeader(maybeOverrideMultiAssets(version, asset.amount, multiAssets, overriddenAsset), version);
3756
+ var feeAssetIndex = overriddenAsset === undefined || sdkCommon.isTMultiLocation(overriddenAsset) ? DEFAULT_FEE_ASSET : overriddenAsset.findIndex(function (asset) {
3757
+ return asset.isFeeAsset;
3758
+ });
3759
+ var call = {
3760
+ module: pallet !== null && pallet !== void 0 ? pallet : 'PolkadotXcm',
3761
+ section: method !== null && method !== void 0 ? method : section,
3762
+ parameters: _objectSpread2({
3763
+ dest: header,
3764
+ beneficiary: addressSelection,
3765
+ assets: resolvedMultiAssets,
3766
+ fee_asset_item: feeAssetIndex
3767
+ }, fees !== undefined ? {
3768
+ weight_limit: fees
3769
+ } : {})
3777
3770
  };
3771
+ return api.callTxMethod(call);
3778
3772
  }
3779
- }, {
3773
+ }]);
3774
+ }();
3775
+
3776
+ var Ajuna = /*#__PURE__*/function (_ParachainNode) {
3777
+ function Ajuna() {
3778
+ _classCallCheck(this, Ajuna);
3779
+ return _callSuper(this, Ajuna, ['Ajuna', 'ajuna', 'polkadot', exports.Version.V4]);
3780
+ }
3781
+ _inherits(Ajuna, _ParachainNode);
3782
+ return _createClass(Ajuna, [{
3780
3783
  key: "transferXTokens",
3781
3784
  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,
3785
+ var scenario = input.scenario,
3786
+ asset = input.asset;
3787
+ if (scenario !== 'ParaToPara') {
3788
+ throw new ScenarioNotSupportedError(this.node, scenario);
3789
+ }
3790
+ if (asset.symbol !== this.getNativeAssetSymbol()) {
3791
+ throw new assets.InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by node ").concat(this.node, "."));
3792
+ }
3793
+ return XTokensTransferImpl.transferXTokens(input, this.getNativeAssetSymbol());
3794
+ }
3795
+ }, {
3796
+ key: "transferPolkadotXCM",
3797
+ value: function transferPolkadotXCM(input) {
3798
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'transfer_assets', 'Unlimited'));
3799
+ }
3800
+ }, {
3801
+ key: "canUseXTokens",
3802
+ value: function canUseXTokens(_ref) {
3803
+ var asset = _ref.asset,
3804
+ destination = _ref.to;
3805
+ return !(asset.symbol === 'DOT' && destination === 'AssetHubPolkadot');
3806
+ }
3807
+ }, {
3808
+ key: "transferRelayToPara",
3809
+ value: function transferRelayToPara() {
3810
+ throw new NodeNotSupportedError();
3811
+ }
3812
+ }, {
3813
+ key: "transferLocalNonNativeAsset",
3814
+ value: function transferLocalNonNativeAsset(options) {
3815
+ var api = options.api,
3816
+ asset = options.asset,
3817
+ address = options.address;
3818
+ if (!assets.isForeignAsset(asset)) {
3819
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3820
+ }
3821
+ if (asset.assetId === undefined) {
3822
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3823
+ }
3824
+ return api.callTxMethod({
3825
+ module: 'Assets',
3826
+ section: 'transfer',
3827
+ parameters: {
3828
+ id: Number(asset.assetId),
3829
+ target: {
3830
+ Id: address
3831
+ },
3832
+ amount: BigInt(asset.amount)
3833
+ }
3834
+ });
3835
+ }
3836
+ }]);
3837
+ }(ParachainNode);
3838
+
3839
+ var Altair = /*#__PURE__*/function (_ParachainNode) {
3840
+ function Altair() {
3841
+ _classCallCheck(this, Altair);
3842
+ return _callSuper(this, Altair, ['Altair', 'altair', 'kusama', exports.Version.V3]);
3843
+ }
3844
+ _inherits(Altair, _ParachainNode);
3845
+ return _createClass(Altair, [{
3846
+ key: "getCurrencySelection",
3847
+ value: function getCurrencySelection(asset) {
3848
+ if (asset.symbol === this.getNativeAssetSymbol()) return 'Native';
3849
+ if (!assets.isForeignAsset(asset)) {
3850
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3851
+ }
3852
+ return {
3853
+ ForeignAsset: Number(asset.assetId)
3854
+ };
3855
+ }
3856
+ }, {
3857
+ key: "transferXTokens",
3858
+ value: function transferXTokens(input) {
3859
+ var asset = input.asset;
3860
+ var currencySelection = this.getCurrencySelection(asset);
3861
+ return XTokensTransferImpl.transferXTokens(input, currencySelection);
3862
+ }
3863
+ }, {
3864
+ key: "transferLocalNonNativeAsset",
3865
+ value: function transferLocalNonNativeAsset(options) {
3866
+ var api = options.api,
3867
+ asset = options.asset,
3791
3868
  address = options.address;
3792
3869
  if (!assets.isForeignAsset(asset)) {
3793
3870
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
@@ -3831,47 +3908,6 @@ var Amplitude = /*#__PURE__*/function (_ParachainNode) {
3831
3908
  }]);
3832
3909
  }(ParachainNode);
3833
3910
 
3834
- var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
3835
- function PolkadotXCMTransferImpl() {
3836
- _classCallCheck(this, PolkadotXCMTransferImpl);
3837
- }
3838
- return _createClass(PolkadotXCMTransferImpl, null, [{
3839
- key: "transferPolkadotXCM",
3840
- value: function transferPolkadotXCM(_ref, section) {
3841
- var api = _ref.api,
3842
- header = _ref.header,
3843
- asset = _ref.asset,
3844
- addressSelection = _ref.addressSelection,
3845
- currencySelection = _ref.currencySelection,
3846
- overriddenAsset = _ref.overriddenAsset,
3847
- pallet = _ref.pallet,
3848
- method = _ref.method;
3849
- var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
3850
- var _extractVersionFromHe = extractVersionFromHeader(currencySelection),
3851
- _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2),
3852
- version = _extractVersionFromHe2[0],
3853
- multiAssets = _extractVersionFromHe2[1];
3854
- var resolvedMultiAssets = addXcmVersionHeader(maybeOverrideMultiAssets(version, asset.amount, multiAssets, overriddenAsset), version);
3855
- var feeAssetIndex = overriddenAsset === undefined || sdkCommon.isTMultiLocation(overriddenAsset) ? DEFAULT_FEE_ASSET : overriddenAsset.findIndex(function (asset) {
3856
- return asset.isFeeAsset;
3857
- });
3858
- var call = {
3859
- module: pallet !== null && pallet !== void 0 ? pallet : 'PolkadotXcm',
3860
- section: method !== null && method !== void 0 ? method : section,
3861
- parameters: _objectSpread2({
3862
- dest: header,
3863
- beneficiary: addressSelection,
3864
- assets: resolvedMultiAssets,
3865
- fee_asset_item: feeAssetIndex
3866
- }, fees !== undefined ? {
3867
- weight_limit: fees
3868
- } : {})
3869
- };
3870
- return api.callTxMethod(call);
3871
- }
3872
- }]);
3873
- }();
3874
-
3875
3911
  var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
3876
3912
  function AssetHubKusama() {
3877
3913
  _classCallCheck(this, AssetHubKusama);
@@ -3929,7 +3965,7 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
3929
3965
  destination = input.destination,
3930
3966
  paraIdTo = input.paraIdTo,
3931
3967
  address = input.address;
3932
- var destWithHeader = createPolkadotXcmHeader(scenario, version, destination, paraIdTo);
3968
+ var destWithHeader = createVersionedDestination(scenario, version, destination, paraIdTo);
3933
3969
  var _extractVersionFromHe = extractVersionFromHeader(destWithHeader),
3934
3970
  _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2);
3935
3971
  _extractVersionFromHe2[0];
@@ -4063,7 +4099,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4063
4099
  module: 'PolkadotXcm',
4064
4100
  section: 'transfer_assets_using_type_and_then',
4065
4101
  parameters: {
4066
- dest: _this.createPolkadotXcmHeader(scenario, version, destination, paraIdTo),
4102
+ dest: _this.createVersionedDestination(scenario, version, destination, paraIdTo),
4067
4103
  assets: addXcmVersionHeader([].concat(_toConsumableArray(useDOTAsFeeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [createMultiAsset(version, asset.amount, asset.multiLocation)]), version),
4068
4104
  assets_transfer_type: 'LocalReserve',
4069
4105
  remote_fees_id: addXcmVersionHeader(useDOTAsFeeAsset ? DOT_MULTILOCATION : asset.multiLocation, version),
@@ -4159,7 +4195,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4159
4195
  module: 'PolkadotXcm',
4160
4196
  section: 'transfer_assets_using_type_and_then',
4161
4197
  parameters: {
4162
- dest: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
4198
+ dest: createVersionedDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
4163
4199
  assets: addXcmVersionHeader([createMultiAsset(version, asset.amount, multiLocation)], version),
4164
4200
  assets_transfer_type: 'LocalReserve',
4165
4201
  remote_fees_id: addXcmVersionHeader(multiLocation, version),
@@ -4241,7 +4277,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4241
4277
  return _context2.abrupt("return", this.handleEthBridgeNativeTransfer(input));
4242
4278
  case 14:
4243
4279
  modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
4244
- header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
4280
+ header: createVersionedDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
4245
4281
  addressSelection: createVersionedBeneficiary({
4246
4282
  api: api,
4247
4283
  scenario: scenario,
@@ -4284,7 +4320,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4284
4320
  }
4285
4321
  };
4286
4322
  var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
4287
- header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
4323
+ header: this.createVersionedDestination(scenario, version, destination, paraId),
4288
4324
  addressSelection: createVersionedBeneficiary({
4289
4325
  api: api,
4290
4326
  scenario: scenario,
@@ -4313,7 +4349,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4313
4349
  var _input$version4;
4314
4350
  var versionOrDefault = (_input$version4 = input.version) !== null && _input$version4 !== void 0 ? _input$version4 : exports.Version.V2;
4315
4351
  return _objectSpread2(_objectSpread2({}, input), {}, {
4316
- header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
4352
+ header: this.createVersionedDestination(scenario, versionOrDefault, destination, paraIdTo),
4317
4353
  addressSelection: createVersionedBeneficiary({
4318
4354
  api: api,
4319
4355
  scenario: scenario,
@@ -4362,7 +4398,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4362
4398
  proofSize: maxU64
4363
4399
  }, MIN_FEE);
4364
4400
  _context3.next = 9;
4365
- return api.getDryRun({
4401
+ return api.getDryRunCall({
4366
4402
  node: this.node,
4367
4403
  tx: dummyTx,
4368
4404
  address: senderAddress
@@ -4446,7 +4482,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4446
4482
  return Promise.resolve(this.handleBifrostEthTransfer(input, true));
4447
4483
  }
4448
4484
  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) {
4485
+ if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !assets.isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && destination !== 'Ajuna' && !isSystemNode) {
4450
4486
  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
4487
  }
4452
4488
  if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !assets.isForeignAsset(asset)) {
@@ -4791,28 +4827,6 @@ var BridgeHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4791
4827
  }]);
4792
4828
  }(ParachainNode);
4793
4829
 
4794
- var Calamari = /*#__PURE__*/function (_ParachainNode) {
4795
- function Calamari() {
4796
- _classCallCheck(this, Calamari);
4797
- return _callSuper(this, Calamari, ['Calamari', 'calamari', 'kusama', exports.Version.V3]);
4798
- }
4799
- _inherits(Calamari, _ParachainNode);
4800
- return _createClass(Calamari, [{
4801
- key: "transferXTokens",
4802
- value: function transferXTokens(input) {
4803
- // Currently only option for XCM transfer
4804
- var asset = input.asset;
4805
- if (!assets.isForeignAsset(asset) || !asset.assetId) {
4806
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
4807
- }
4808
- var currencySelection = {
4809
- MantaCurrency: BigInt(asset.assetId)
4810
- };
4811
- return XTokensTransferImpl.transferXTokens(input, currencySelection);
4812
- }
4813
- }]);
4814
- }(ParachainNode);
4815
-
4816
4830
  var Centrifuge = /*#__PURE__*/function (_ParachainNode) {
4817
4831
  function Centrifuge() {
4818
4832
  _classCallCheck(this, Centrifuge);
@@ -5292,7 +5306,7 @@ var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scena
5292
5306
  AllCounted: 1
5293
5307
  }
5294
5308
  },
5295
- dest: Object.values(createPolkadotXcmHeader(scenario, version, destination, paraId, undefined, sdkCommon.Parents.ONE))[0],
5309
+ dest: Object.values(createVersionedDestination(scenario, version, destination, paraId, undefined, sdkCommon.Parents.ONE))[0],
5296
5310
  xcm: [{
5297
5311
  BuyExecution: {
5298
5312
  fees: {
@@ -5451,7 +5465,7 @@ var Hydration = /*#__PURE__*/function (_ParachainNode) {
5451
5465
  module: 'PolkadotXcm',
5452
5466
  section: 'transfer_assets_using_type_and_then',
5453
5467
  parameters: {
5454
- dest: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
5468
+ dest: this.createVersionedDestination(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
5455
5469
  assets: _defineProperty({}, versionOrDefault, [createMultiAsset(versionOrDefault, asset.amount, DOT_MULTILOCATION)]),
5456
5470
  assets_transfer_type: 'DestinationReserve',
5457
5471
  remote_fees_id: _defineProperty({}, versionOrDefault, {
@@ -5624,24 +5638,6 @@ var Interlay = /*#__PURE__*/function (_ParachainNode) {
5624
5638
  }]);
5625
5639
  }(ParachainNode);
5626
5640
 
5627
- var InvArchTinker = /*#__PURE__*/function (_ParachainNode) {
5628
- function InvArchTinker() {
5629
- _classCallCheck(this, InvArchTinker);
5630
- return _callSuper(this, InvArchTinker, ['InvArchTinker', 'tinker', 'kusama', exports.Version.V3]);
5631
- }
5632
- _inherits(InvArchTinker, _ParachainNode);
5633
- return _createClass(InvArchTinker, [{
5634
- key: "transferXTokens",
5635
- value: function transferXTokens(input) {
5636
- var asset = input.asset;
5637
- if (!assets.isForeignAsset(asset) || !asset.assetId) {
5638
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
5639
- }
5640
- return XTokensTransferImpl.transferXTokens(input, BigInt(asset.assetId));
5641
- }
5642
- }]);
5643
- }(ParachainNode);
5644
-
5645
5641
  var Karura = /*#__PURE__*/function (_ParachainNode) {
5646
5642
  function Karura() {
5647
5643
  _classCallCheck(this, Karura);
@@ -5814,10 +5810,14 @@ var Moonbeam = /*#__PURE__*/function (_ParachainNode) {
5814
5810
  }, {
5815
5811
  key: "transferPolkadotXCM",
5816
5812
  value: function transferPolkadotXCM(input) {
5817
- var asset = input.asset,
5813
+ var destination = input.destination,
5814
+ asset = input.asset,
5818
5815
  scenario = input.scenario,
5819
5816
  _input$version = input.version,
5820
5817
  version = _input$version === void 0 ? this.version : _input$version;
5818
+ if (destination === 'Ethereum') {
5819
+ return this.transferToEthereum(input);
5820
+ }
5821
5821
  var multiLocation = this.getMultiLocation(asset, scenario);
5822
5822
  return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(_objectSpread2(_objectSpread2({}, input), {}, {
5823
5823
  currencySelection: createVersionedMultiAssets(version, asset.amount, multiLocation)
@@ -6500,6 +6500,7 @@ var nodes = function nodes() {
6500
6500
  return {
6501
6501
  AssetHubPolkadot: new AssetHubPolkadot(),
6502
6502
  Acala: new Acala(),
6503
+ Ajuna: new Ajuna(),
6503
6504
  Astar: new Astar(),
6504
6505
  Unique: new Unique(),
6505
6506
  Crust: new Crust(),
@@ -6522,10 +6523,8 @@ var nodes = function nodes() {
6522
6523
  Amplitude: new Amplitude(),
6523
6524
  Basilisk: new Basilisk(),
6524
6525
  BifrostKusama: new BifrostKusama(),
6525
- Calamari: new Calamari(),
6526
6526
  CrustShadow: new CrustShadow(),
6527
6527
  Crab: new Crab(),
6528
- InvArchTinker: new InvArchTinker(),
6529
6528
  Karura: new Karura(),
6530
6529
  Kintsugi: new Kintsugi(),
6531
6530
  Moonriver: new Moonriver(),
@@ -6986,9 +6985,10 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
6986
6985
  address: address,
6987
6986
  scenario: 'ParaToPara',
6988
6987
  senderAddress: senderAddress,
6988
+ ahAddress: ahAddress,
6989
6989
  asset: _objectSpread2(_objectSpread2({}, foundAsset), {}, {
6990
6990
  amount: currency.amount
6991
- })}, exports.Version.V4, messageId);
6991
+ })}, from, exports.Version.V4, messageId);
6992
6992
  _context.next = 39;
6993
6993
  return api.objectToHex(customXcm, 'XcmVersionedXcm');
6994
6994
  case 39:
@@ -7043,6 +7043,182 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
7043
7043
  };
7044
7044
  }();
7045
7045
 
7046
+ /**
7047
+ * Retrieves the node name corresponding to a specified parachain ID.
7048
+ *
7049
+ * @param paraId - The parachain ID.
7050
+ * @returns The node name if found; otherwise, null.
7051
+ */
7052
+ var getTNode = function getTNode(paraId, ecosystem) {
7053
+ var _NODE_NAMES_DOT_KSM$f;
7054
+ if (paraId === 0) {
7055
+ return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
7056
+ }
7057
+ if (paraId === 1) {
7058
+ return 'Ethereum';
7059
+ }
7060
+ return (_NODE_NAMES_DOT_KSM$f = sdkCommon.NODE_NAMES_DOT_KSM.find(function (nodeName) {
7061
+ return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
7062
+ })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
7063
+ };
7064
+
7065
+ var isAssetHub = function isAssetHub(chain) {
7066
+ return chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama';
7067
+ };
7068
+ var isBridgeHub = function isBridgeHub(chain) {
7069
+ return chain === 'BridgeHubPolkadot' || chain === 'BridgeHubKusama';
7070
+ };
7071
+ var isPeople = function isPeople(chain) {
7072
+ return chain === 'PeoplePolkadot' || chain === 'PeopleKusama';
7073
+ };
7074
+ var isSystemPara = function isSystemPara(chain) {
7075
+ return isAssetHub(chain) || isBridgeHub(chain) || isPeople(chain);
7076
+ };
7077
+ var mul = function mul(v, num) {
7078
+ var den = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1n;
7079
+ return v * num / den;
7080
+ };
7081
+ var padFee = function padFee(raw, origin, dest, side) {
7082
+ var relayOrigin = sdkCommon.isRelayChain(origin);
7083
+ var relayDest = sdkCommon.isRelayChain(dest);
7084
+ var sysParaOrigin = isSystemPara(origin);
7085
+ var sysParaDest = isSystemPara(dest);
7086
+ var relayToPara = relayOrigin && !relayDest;
7087
+ var sysParaToPara = sysParaOrigin && !sysParaDest;
7088
+ var paraToPara = !relayOrigin && !sysParaOrigin;
7089
+ if (sysParaToPara) return raw * 40n;
7090
+ if (relayToPara) return side === 'origin' ? mul(raw, 320n, 100n) : mul(raw, 3000n, 100n);
7091
+ if (paraToPara) return mul(raw, 130n, 100n);
7092
+ // apply default 30% padding
7093
+ return mul(raw, 130n, 100n);
7094
+ };
7095
+
7096
+ var createOriginLocation = function createOriginLocation(origin, destination) {
7097
+ if (sdkCommon.isRelayChain(origin)) return DOT_MULTILOCATION;
7098
+ return {
7099
+ parents: sdkCommon.isRelayChain(destination) ? sdkCommon.Parents.ZERO : sdkCommon.Parents.ONE,
7100
+ interior: {
7101
+ X1: [{
7102
+ Parachain: getParaId(origin)
7103
+ }]
7104
+ }
7105
+ };
7106
+ };
7107
+ var getFeeForDestNode = /*#__PURE__*/function () {
7108
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
7109
+ var api, forwardedXcms, origin, destination, address, senderAddress, currency, disableFallback, calcPaymentInfoFee, dryRunResult, fee, newForwardedXcms, destParaId;
7110
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7111
+ while (1) switch (_context2.prev = _context2.next) {
7112
+ case 0:
7113
+ api = _ref.api, forwardedXcms = _ref.forwardedXcms, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, currency = _ref.currency, disableFallback = _ref.disableFallback;
7114
+ calcPaymentInfoFee = /*#__PURE__*/function () {
7115
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7116
+ var originAsset, currencyInput, tx, rawFee;
7117
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7118
+ while (1) switch (_context.prev = _context.next) {
7119
+ case 0:
7120
+ if (!('multiasset' in currency)) {
7121
+ _context.next = 2;
7122
+ break;
7123
+ }
7124
+ throw new assets.InvalidCurrencyError('Multi-assets are not yet supported for XCM fee calculation.');
7125
+ case 2:
7126
+ originAsset = assets.findAsset(origin, currency, destination);
7127
+ if (originAsset) {
7128
+ _context.next = 5;
7129
+ break;
7130
+ }
7131
+ throw new assets.InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " not found in ").concat(origin));
7132
+ case 5:
7133
+ currencyInput = originAsset.multiLocation ? {
7134
+ multilocation: originAsset.multiLocation
7135
+ } : {
7136
+ symbol: originAsset.symbol
7137
+ };
7138
+ _context.next = 8;
7139
+ return Builder(api).from(destination).to(origin).address(senderAddress, address).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
7140
+ amount: currency.amount
7141
+ })).build();
7142
+ case 8:
7143
+ tx = _context.sent;
7144
+ _context.next = 11;
7145
+ return api.calculateTransactionFee(tx, address);
7146
+ case 11:
7147
+ rawFee = _context.sent;
7148
+ return _context.abrupt("return", padFee(rawFee, origin, destination, 'destination'));
7149
+ case 13:
7150
+ case "end":
7151
+ return _context.stop();
7152
+ }
7153
+ }, _callee);
7154
+ }));
7155
+ return function calcPaymentInfoFee() {
7156
+ return _ref3.apply(this, arguments);
7157
+ };
7158
+ }();
7159
+ if (!(!assets.hasDryRunSupport(destination) || !forwardedXcms)) {
7160
+ _context2.next = 7;
7161
+ break;
7162
+ }
7163
+ _context2.next = 5;
7164
+ return calcPaymentInfoFee();
7165
+ case 5:
7166
+ _context2.t0 = _context2.sent;
7167
+ return _context2.abrupt("return", {
7168
+ fee: _context2.t0,
7169
+ feeType: 'paymentInfo'
7170
+ });
7171
+ case 7:
7172
+ _context2.next = 9;
7173
+ return api.getDryRunXcm({
7174
+ originLocation: addXcmVersionHeader(createOriginLocation(origin, destination), exports.Version.V4),
7175
+ xcm: forwardedXcms[1][0],
7176
+ node: destination,
7177
+ origin: origin
7178
+ });
7179
+ case 9:
7180
+ dryRunResult = _context2.sent;
7181
+ if (dryRunResult.success) {
7182
+ _context2.next = 18;
7183
+ break;
7184
+ }
7185
+ if (!disableFallback) {
7186
+ _context2.next = 13;
7187
+ break;
7188
+ }
7189
+ return _context2.abrupt("return", {
7190
+ dryRunError: dryRunResult.failureReason
7191
+ });
7192
+ case 13:
7193
+ _context2.next = 15;
7194
+ return calcPaymentInfoFee();
7195
+ case 15:
7196
+ _context2.t1 = _context2.sent;
7197
+ _context2.t2 = dryRunResult.failureReason;
7198
+ return _context2.abrupt("return", {
7199
+ fee: _context2.t1,
7200
+ feeType: 'paymentInfo',
7201
+ dryRunError: _context2.t2
7202
+ });
7203
+ case 18:
7204
+ fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
7205
+ return _context2.abrupt("return", {
7206
+ fee: fee,
7207
+ feeType: 'dryRun',
7208
+ forwardedXcms: newForwardedXcms,
7209
+ destParaId: destParaId
7210
+ });
7211
+ case 20:
7212
+ case "end":
7213
+ return _context2.stop();
7214
+ }
7215
+ }, _callee2);
7216
+ }));
7217
+ return function getFeeForDestNode(_x) {
7218
+ return _ref2.apply(this, arguments);
7219
+ };
7220
+ }();
7221
+
7046
7222
  var getDryRun = /*#__PURE__*/function () {
7047
7223
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7048
7224
  var api, node, address;
@@ -7056,7 +7232,7 @@ var getDryRun = /*#__PURE__*/function () {
7056
7232
  case 4:
7057
7233
  _context.prev = 4;
7058
7234
  _context.next = 7;
7059
- return api.getDryRun(options);
7235
+ return api.getDryRunCall(options);
7060
7236
  case 7:
7061
7237
  return _context.abrupt("return", _context.sent);
7062
7238
  case 8:
@@ -7076,6 +7252,400 @@ var getDryRun = /*#__PURE__*/function () {
7076
7252
  };
7077
7253
  }();
7078
7254
 
7255
+ var getFeeForOriginNode = /*#__PURE__*/function () {
7256
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7257
+ var api, tx, origin, destination, senderAddress, disableFallback, rawFee, dryRunResult, _rawFee, fee, forwardedXcms, destParaId;
7258
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7259
+ while (1) switch (_context.prev = _context.next) {
7260
+ case 0:
7261
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, disableFallback = _ref.disableFallback;
7262
+ if (assets.hasDryRunSupport(origin)) {
7263
+ _context.next = 6;
7264
+ break;
7265
+ }
7266
+ _context.next = 4;
7267
+ return api.calculateTransactionFee(tx, senderAddress);
7268
+ case 4:
7269
+ rawFee = _context.sent;
7270
+ return _context.abrupt("return", {
7271
+ fee: padFee(rawFee, origin, destination, 'origin'),
7272
+ feeType: 'paymentInfo'
7273
+ });
7274
+ case 6:
7275
+ _context.next = 8;
7276
+ return getDryRun({
7277
+ api: api,
7278
+ tx: tx,
7279
+ node: origin,
7280
+ address: senderAddress
7281
+ });
7282
+ case 8:
7283
+ dryRunResult = _context.sent;
7284
+ if (dryRunResult.success) {
7285
+ _context.next = 16;
7286
+ break;
7287
+ }
7288
+ if (!disableFallback) {
7289
+ _context.next = 12;
7290
+ break;
7291
+ }
7292
+ return _context.abrupt("return", {
7293
+ dryRunError: dryRunResult.failureReason
7294
+ });
7295
+ case 12:
7296
+ _context.next = 14;
7297
+ return api.calculateTransactionFee(tx, senderAddress);
7298
+ case 14:
7299
+ _rawFee = _context.sent;
7300
+ return _context.abrupt("return", {
7301
+ fee: padFee(_rawFee, origin, destination, 'origin'),
7302
+ feeType: 'paymentInfo',
7303
+ dryRunError: dryRunResult.failureReason
7304
+ });
7305
+ case 16:
7306
+ fee = dryRunResult.fee, forwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
7307
+ return _context.abrupt("return", {
7308
+ fee: fee,
7309
+ feeType: 'dryRun',
7310
+ forwardedXcms: forwardedXcms,
7311
+ destParaId: destParaId
7312
+ });
7313
+ case 18:
7314
+ case "end":
7315
+ return _context.stop();
7316
+ }
7317
+ }, _callee);
7318
+ }));
7319
+ return function getFeeForOriginNode(_x) {
7320
+ return _ref2.apply(this, arguments);
7321
+ };
7322
+ }();
7323
+
7324
+ var getXcmFee = /*#__PURE__*/function () {
7325
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7326
+ var _findAsset;
7327
+ 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;
7328
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7329
+ while (1) switch (_context.prev = _context.next) {
7330
+ case 0:
7331
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, disableFallback = _ref.disableFallback;
7332
+ asset = (_findAsset = assets.findAsset(origin, currency, destination)) !== null && _findAsset !== void 0 ? _findAsset : origin === 'AssetHubPolkadot' ? assets.findAsset('Ethereum', currency, null) : null;
7333
+ if (asset) {
7334
+ _context.next = 4;
7335
+ break;
7336
+ }
7337
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(origin));
7338
+ case 4:
7339
+ _context.next = 6;
7340
+ return getFeeForOriginNode({
7341
+ api: api,
7342
+ tx: tx,
7343
+ origin: origin,
7344
+ destination: destination,
7345
+ senderAddress: senderAddress,
7346
+ disableFallback: disableFallback
7347
+ });
7348
+ case 6:
7349
+ _yield$getFeeForOrigi = _context.sent;
7350
+ originFee = _yield$getFeeForOrigi.fee;
7351
+ originFeeType = _yield$getFeeForOrigi.feeType;
7352
+ originDryRunError = _yield$getFeeForOrigi.dryRunError;
7353
+ initialForwardedXcm = _yield$getFeeForOrigi.forwardedXcms;
7354
+ initialDestParaId = _yield$getFeeForOrigi.destParaId;
7355
+ api.setDisconnectAllowed(true);
7356
+ _context.next = 15;
7357
+ return api.disconnect();
7358
+ case 15:
7359
+ if (!originDryRunError) {
7360
+ _context.next = 30;
7361
+ break;
7362
+ }
7363
+ destApi = api.clone();
7364
+ _context.prev = 17;
7365
+ _context.next = 20;
7366
+ return destApi.init(destination);
7367
+ case 20:
7368
+ destApi.setDisconnectAllowed(false);
7369
+ _context.next = 23;
7370
+ return getFeeForDestNode({
7371
+ api: destApi,
7372
+ forwardedXcms: undefined,
7373
+ // force paymentInfo
7374
+ origin: origin,
7375
+ destination: destination,
7376
+ currency: currency,
7377
+ address: address,
7378
+ senderAddress: senderAddress,
7379
+ disableFallback: disableFallback
7380
+ });
7381
+ case 23:
7382
+ destFeeRes = _context.sent;
7383
+ return _context.abrupt("return", {
7384
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7385
+ fee: originFee
7386
+ }), originFeeType && {
7387
+ feeType: originFeeType
7388
+ }), {}, {
7389
+ currency: assets.getNativeAssetSymbol(origin),
7390
+ dryRunError: originDryRunError
7391
+ }),
7392
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFeeRes.fee && {
7393
+ fee: destFeeRes.fee
7394
+ }), destFeeRes.feeType && {
7395
+ feeType: destFeeRes.feeType
7396
+ }), {}, {
7397
+ currency: assets.getNativeAssetSymbol(destination)
7398
+ })
7399
+ });
7400
+ case 25:
7401
+ _context.prev = 25;
7402
+ destApi.setDisconnectAllowed(true);
7403
+ _context.next = 29;
7404
+ return destApi.disconnect();
7405
+ case 29:
7406
+ return _context.finish(25);
7407
+ case 30:
7408
+ currentOrigin = origin;
7409
+ forwardedXcms = initialForwardedXcm;
7410
+ nextParaId = initialDestParaId;
7411
+ intermediateFees = {};
7412
+ destinationFee = 0n;
7413
+ destinationFeeType = 'paymentInfo';
7414
+ case 36:
7415
+ 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)) {
7416
+ _context.next = 69;
7417
+ break;
7418
+ }
7419
+ nextChain = getTNode(nextParaId, determineRelayChain(origin) === 'Polkadot' ? 'polkadot' : 'kusama');
7420
+ if (!(nextChain === null)) {
7421
+ _context.next = 40;
7422
+ break;
7423
+ }
7424
+ throw new Error("Unable to find TNode for paraId ".concat(nextParaId));
7425
+ case 40:
7426
+ hopApi = api.clone();
7427
+ _context.prev = 41;
7428
+ _context.next = 44;
7429
+ return hopApi.init(nextChain);
7430
+ case 44:
7431
+ _context.next = 46;
7432
+ return getFeeForDestNode({
7433
+ api: hopApi,
7434
+ forwardedXcms: forwardedXcms,
7435
+ origin: currentOrigin,
7436
+ destination: nextChain,
7437
+ currency: currency,
7438
+ address: address,
7439
+ senderAddress: senderAddress,
7440
+ disableFallback: disableFallback
7441
+ });
7442
+ case 46:
7443
+ hopResult = _context.sent;
7444
+ if (!hopResult.dryRunError) {
7445
+ _context.next = 58;
7446
+ break;
7447
+ }
7448
+ failingRecord = {
7449
+ fee: hopResult.fee,
7450
+ feeType: hopResult.feeType,
7451
+ currency: assets.getNativeAssetSymbol(nextChain),
7452
+ dryRunError: hopResult.dryRunError
7453
+ };
7454
+ hopIsDestination = nextChain === destination || sdkCommon.isRelayChain(nextChain) && !sdkCommon.isRelayChain(destination);
7455
+ if (hopIsDestination) {
7456
+ destinationFee = hopResult.fee;
7457
+ destinationFeeType = hopResult.feeType; // paymentInfo
7458
+ destinationDryRunError = hopResult.dryRunError;
7459
+ } else if (nextChain === 'AssetHubPolkadot') {
7460
+ intermediateFees.assetHub = failingRecord;
7461
+ } else if (nextChain === 'BridgeHubPolkadot') {
7462
+ intermediateFees.bridgeHub = failingRecord;
7463
+ }
7464
+ // We failed *before* the true destination → fallback via paymentInfo.
7465
+ if (hopIsDestination) {
7466
+ _context.next = 57;
7467
+ break;
7468
+ }
7469
+ _context.next = 54;
7470
+ return getFeeForDestNode({
7471
+ api: hopApi,
7472
+ // already at failing hop
7473
+ forwardedXcms: undefined,
7474
+ // forces paymentInfo path
7475
+ origin: nextChain,
7476
+ destination: destination,
7477
+ currency: currency,
7478
+ address: address,
7479
+ senderAddress: senderAddress,
7480
+ disableFallback: disableFallback
7481
+ });
7482
+ case 54:
7483
+ destFallback = _context.sent;
7484
+ destinationFee = destFallback.fee;
7485
+ destinationFeeType = destFallback.feeType; // paymentInfo
7486
+ case 57:
7487
+ return _context.abrupt("break", 69);
7488
+ case 58:
7489
+ if (nextChain === destination || sdkCommon.isRelayChain(nextChain) && !sdkCommon.isRelayChain(destination)) {
7490
+ destinationFee = hopResult.fee;
7491
+ destinationFeeType = hopResult.feeType;
7492
+ } else if (nextChain === 'AssetHubPolkadot') {
7493
+ intermediateFees.assetHub = {
7494
+ fee: hopResult.fee,
7495
+ feeType: hopResult.feeType,
7496
+ currency: assets.getNativeAssetSymbol(nextChain)
7497
+ };
7498
+ } else if (nextChain === 'BridgeHubPolkadot') {
7499
+ intermediateFees.bridgeHub = {
7500
+ fee: hopResult.fee,
7501
+ feeType: hopResult.feeType,
7502
+ currency: assets.getNativeAssetSymbol(nextChain)
7503
+ };
7504
+ } else ;
7505
+ forwardedXcms = hopResult.forwardedXcms;
7506
+ nextParaId = hopResult.destParaId;
7507
+ currentOrigin = nextChain;
7508
+ case 62:
7509
+ _context.prev = 62;
7510
+ hopApi.setDisconnectAllowed(true);
7511
+ _context.next = 66;
7512
+ return hopApi.disconnect();
7513
+ case 66:
7514
+ return _context.finish(62);
7515
+ case 67:
7516
+ _context.next = 36;
7517
+ break;
7518
+ case 69:
7519
+ return _context.abrupt("return", _objectSpread2(_objectSpread2({
7520
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7521
+ fee: originFee
7522
+ }), originFeeType && {
7523
+ feeType: originFeeType
7524
+ }), {}, {
7525
+ currency: assets.getNativeAssetSymbol(origin)
7526
+ }, originDryRunError && {
7527
+ dryRunError: originDryRunError
7528
+ })
7529
+ }, intermediateFees), {}, {
7530
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destinationFee && {
7531
+ fee: destinationFee
7532
+ }), destinationFeeType && {
7533
+ feeType: destinationFeeType
7534
+ }), {}, {
7535
+ currency: destinationFeeType === 'dryRun' ? asset.symbol : assets.getNativeAssetSymbol(destination)
7536
+ }, destinationDryRunError && {
7537
+ dryRunError: destinationDryRunError
7538
+ })
7539
+ }));
7540
+ case 70:
7541
+ case "end":
7542
+ return _context.stop();
7543
+ }
7544
+ }, _callee, null, [[17,, 25, 30], [41,, 62, 67]]);
7545
+ }));
7546
+ return function getXcmFee(_x) {
7547
+ return _ref2.apply(this, arguments);
7548
+ };
7549
+ }();
7550
+
7551
+ var BRIDGE_FEE_DOT = 682395810n; // 0.068239581 DOT
7552
+ var BRIDGE_FEE_KSM = 12016807000n; // 0.012016807 KSM
7553
+ var getXcmFeeEstimate = /*#__PURE__*/function () {
7554
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7555
+ var api, tx, origin, destination, address, senderAddress, currency, rawOriginFee, originFee, destApi, originAsset, currencyInput, flippedTx, rawDestFee, destinationFee;
7556
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7557
+ while (1) switch (_context.prev = _context.next) {
7558
+ case 0:
7559
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, currency = _ref.currency;
7560
+ if (!(origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama')) {
7561
+ _context.next = 3;
7562
+ break;
7563
+ }
7564
+ return _context.abrupt("return", {
7565
+ origin: {
7566
+ fee: BRIDGE_FEE_DOT,
7567
+ currency: assets.getNativeAssetSymbol(origin)
7568
+ },
7569
+ destination: {
7570
+ fee: BRIDGE_FEE_KSM,
7571
+ currency: assets.getNativeAssetSymbol(destination)
7572
+ }
7573
+ });
7574
+ case 3:
7575
+ if (!(origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot')) {
7576
+ _context.next = 5;
7577
+ break;
7578
+ }
7579
+ return _context.abrupt("return", {
7580
+ origin: {
7581
+ fee: BRIDGE_FEE_KSM,
7582
+ currency: assets.getNativeAssetSymbol(origin)
7583
+ },
7584
+ destination: {
7585
+ fee: BRIDGE_FEE_DOT,
7586
+ currency: assets.getNativeAssetSymbol(destination)
7587
+ }
7588
+ });
7589
+ case 5:
7590
+ _context.next = 7;
7591
+ return api.calculateTransactionFee(tx, senderAddress);
7592
+ case 7:
7593
+ rawOriginFee = _context.sent;
7594
+ originFee = padFee(rawOriginFee, origin, destination, 'origin');
7595
+ destApi = api.clone();
7596
+ _context.next = 12;
7597
+ return destApi.init(destination);
7598
+ case 12:
7599
+ if (!('multiasset' in currency)) {
7600
+ _context.next = 14;
7601
+ break;
7602
+ }
7603
+ throw new assets.InvalidCurrencyError('Multi-assets are not yet supported for simple XCM fee estimation.');
7604
+ case 14:
7605
+ originAsset = assets.findAsset(origin, currency, destination);
7606
+ if (originAsset) {
7607
+ _context.next = 17;
7608
+ break;
7609
+ }
7610
+ throw new assets.InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " not found in ").concat(origin));
7611
+ case 17:
7612
+ currencyInput = originAsset.multiLocation ? {
7613
+ multilocation: originAsset.multiLocation
7614
+ } : {
7615
+ symbol: originAsset.symbol
7616
+ };
7617
+ _context.next = 20;
7618
+ return Builder(destApi).from(destination).to(origin).address(senderAddress, address).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
7619
+ amount: currency.amount
7620
+ })).build();
7621
+ case 20:
7622
+ flippedTx = _context.sent;
7623
+ _context.next = 23;
7624
+ return destApi.calculateTransactionFee(flippedTx, address);
7625
+ case 23:
7626
+ rawDestFee = _context.sent;
7627
+ destinationFee = padFee(rawDestFee, origin, destination, 'destination');
7628
+ return _context.abrupt("return", {
7629
+ origin: {
7630
+ fee: originFee,
7631
+ currency: assets.getNativeAssetSymbol(origin)
7632
+ },
7633
+ destination: {
7634
+ fee: destinationFee,
7635
+ currency: assets.getNativeAssetSymbol(destination)
7636
+ }
7637
+ });
7638
+ case 26:
7639
+ case "end":
7640
+ return _context.stop();
7641
+ }
7642
+ }, _callee);
7643
+ }));
7644
+ return function getXcmFeeEstimate(_x) {
7645
+ return _ref2.apply(this, arguments);
7646
+ };
7647
+ }();
7648
+
7079
7649
  var transferRelayToPara = /*#__PURE__*/function () {
7080
7650
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7081
7651
  var api, origin, destination, asset, address, paraIdTo, version, pallet, method, isMultiLocationDestination, serializedApiCall;
@@ -7158,7 +7728,7 @@ var validateDestination = function validateDestination(origin, destination) {
7158
7728
  if (sdkCommon.isRelayChain(origin) && !sdkCommon.isTMultiLocation(destination) && sdkCommon.isRelayChain(destination) && origin !== destination) {
7159
7729
  throw new IncompatibleNodesError('Direct relay chain to relay chain transfers are not supported. Please use Polkadot <-> Kusama bridge through AssetHub.');
7160
7730
  }
7161
- if (destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration' && origin !== 'BifrostPolkadot') {
7731
+ if (destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration' && origin !== 'BifrostPolkadot' && origin !== 'Moonbeam') {
7162
7732
  throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot and Hydration.');
7163
7733
  }
7164
7734
  var isMultiLocationDestination = _typeof(destination) === 'object';
@@ -7284,11 +7854,11 @@ var validateDestinationAddress = function validateDestinationAddress(address, de
7284
7854
 
7285
7855
  var send = /*#__PURE__*/function () {
7286
7856
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7287
- var api, origin, currency, feeAsset, address, destination, paraIdTo, version, senderAddress, pallet, method, isBridge, assetCheckEnabled, asset, resolvedFeeAsset, isLocalTransfer, overriddenAsset, resolvedAsset, originNode;
7857
+ var api, origin, currency, feeAsset, address, destination, paraIdTo, version, senderAddress, ahAddress, pallet, method, isBridge, assetCheckEnabled, asset, resolvedFeeAsset, isLocalTransfer, overriddenAsset, resolvedAsset, originNode;
7288
7858
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7289
7859
  while (1) switch (_context.prev = _context.next) {
7290
7860
  case 0:
7291
- api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, version = options.version, senderAddress = options.senderAddress, pallet = options.pallet, method = options.method;
7861
+ api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
7292
7862
  validateCurrency(currency, feeAsset);
7293
7863
  validateDestination(origin, destination);
7294
7864
  validateDestinationAddress(address, destination);
@@ -7375,6 +7945,7 @@ var send = /*#__PURE__*/function () {
7375
7945
  overriddenAsset: overriddenAsset,
7376
7946
  version: version,
7377
7947
  senderAddress: senderAddress,
7948
+ ahAddress: ahAddress,
7378
7949
  pallet: pallet,
7379
7950
  method: method
7380
7951
  }));
@@ -7528,18 +8099,26 @@ var GeneralBuilder = /*#__PURE__*/function () {
7528
8099
  currency: _currency
7529
8100
  }));
7530
8101
  }
8102
+ }, {
8103
+ key: "address",
8104
+ value: function address(_address, senderAddress) {
8105
+ return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
8106
+ address: _address
8107
+ }, senderAddress ? {
8108
+ senderAddress: senderAddress
8109
+ } : {}));
8110
+ }
7531
8111
  /**
7532
- * Sets the recipient address.
8112
+ * Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
7533
8113
  *
7534
- * @param address - The destination address.
8114
+ * @param address - The address to be used.
7535
8115
  * @returns An instance of Builder
7536
8116
  */
7537
8117
  }, {
7538
- key: "address",
7539
- value: function address(_address, senderAddress) {
8118
+ key: "ahAddress",
8119
+ value: function ahAddress(address) {
7540
8120
  return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
7541
- address: _address,
7542
- senderAddress: senderAddress
8121
+ ahAddress: address
7543
8122
  }));
7544
8123
  }
7545
8124
  /**
@@ -7694,11 +8273,140 @@ var GeneralBuilder = /*#__PURE__*/function () {
7694
8273
  }
7695
8274
  return dryRun;
7696
8275
  }()
8276
+ /**
8277
+ * Estimates the XCM fee for the transfer using paymentInfo function.
8278
+ *
8279
+ * @returns An origin and destination fee estimate.
8280
+ */
8281
+ }, {
8282
+ key: "getXcmFeeEstimate",
8283
+ value: (function () {
8284
+ var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
8285
+ var _this$_options2, from, to, address, senderAddress, tx;
8286
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
8287
+ while (1) switch (_context4.prev = _context4.next) {
8288
+ case 0:
8289
+ _this$_options2 = this._options, from = _this$_options2.from, to = _this$_options2.to, address = _this$_options2.address, senderAddress = _this$_options2.senderAddress;
8290
+ if (!sdkCommon.isTMultiLocation(to)) {
8291
+ _context4.next = 3;
8292
+ break;
8293
+ }
8294
+ throw new InvalidParameterError('Multi-Location destination is not supported for XCM fee calculation.');
8295
+ case 3:
8296
+ if (!sdkCommon.isTMultiLocation(address)) {
8297
+ _context4.next = 5;
8298
+ break;
8299
+ }
8300
+ throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
8301
+ case 5:
8302
+ if (!(to === 'Ethereum')) {
8303
+ _context4.next = 7;
8304
+ break;
8305
+ }
8306
+ throw new InvalidParameterError('Ethereum destination is not yet supported for XCM fee calculation.');
8307
+ case 7:
8308
+ this.api.setDisconnectAllowed(false);
8309
+ _context4.next = 10;
8310
+ return this.build();
8311
+ case 10:
8312
+ tx = _context4.sent;
8313
+ this.api.setDisconnectAllowed(true);
8314
+ return _context4.abrupt("return", getXcmFeeEstimate({
8315
+ api: this.api,
8316
+ tx: tx,
8317
+ origin: from,
8318
+ destination: to,
8319
+ address: address,
8320
+ senderAddress: senderAddress,
8321
+ currency: this._options.currency
8322
+ }));
8323
+ case 13:
8324
+ case "end":
8325
+ return _context4.stop();
8326
+ }
8327
+ }, _callee4, this);
8328
+ }));
8329
+ function getXcmFeeEstimate$1() {
8330
+ return _getXcmFeeEstimate2.apply(this, arguments);
8331
+ }
8332
+ return getXcmFeeEstimate$1;
8333
+ }()
8334
+ /**
8335
+ * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
8336
+ *
8337
+ * @returns An origin and destination fee.
8338
+ */
8339
+ )
8340
+ }, {
8341
+ key: "getXcmFee",
8342
+ value: (function () {
8343
+ var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
8344
+ var _ref,
8345
+ disableFallback,
8346
+ _this$_options3,
8347
+ from,
8348
+ to,
8349
+ address,
8350
+ senderAddress,
8351
+ tx,
8352
+ _args5 = arguments;
8353
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
8354
+ while (1) switch (_context5.prev = _context5.next) {
8355
+ case 0:
8356
+ _ref = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {
8357
+ disableFallback: false
8358
+ }, disableFallback = _ref.disableFallback;
8359
+ _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, address = _this$_options3.address, senderAddress = _this$_options3.senderAddress;
8360
+ if (!sdkCommon.isTMultiLocation(to)) {
8361
+ _context5.next = 4;
8362
+ break;
8363
+ }
8364
+ throw new InvalidParameterError('Multi-Location destination is not supported for XCM fee calculation.');
8365
+ case 4:
8366
+ if (!sdkCommon.isTMultiLocation(address)) {
8367
+ _context5.next = 6;
8368
+ break;
8369
+ }
8370
+ throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
8371
+ case 6:
8372
+ if (!(to === 'Ethereum')) {
8373
+ _context5.next = 8;
8374
+ break;
8375
+ }
8376
+ throw new InvalidParameterError('Ethereum destination is not yet supported for XCM fee calculation.');
8377
+ case 8:
8378
+ _context5.next = 10;
8379
+ return this.build();
8380
+ case 10:
8381
+ tx = _context5.sent;
8382
+ this.api.setDisconnectAllowed(false);
8383
+ return _context5.abrupt("return", getXcmFee({
8384
+ api: this.api,
8385
+ tx: tx,
8386
+ origin: from,
8387
+ destination: to,
8388
+ senderAddress: senderAddress,
8389
+ address: address,
8390
+ currency: this._options.currency,
8391
+ disableFallback: disableFallback
8392
+ }));
8393
+ case 13:
8394
+ case "end":
8395
+ return _context5.stop();
8396
+ }
8397
+ }, _callee5, this);
8398
+ }));
8399
+ function getXcmFee$1() {
8400
+ return _getXcmFee2.apply(this, arguments);
8401
+ }
8402
+ return getXcmFee$1;
8403
+ }()
7697
8404
  /**
7698
8405
  * Returns the API instance used by the builder.
7699
8406
  *
7700
8407
  * @returns The API instance.
7701
8408
  */
8409
+ )
7702
8410
  }, {
7703
8411
  key: "getApi",
7704
8412
  value: function getApi() {
@@ -7726,25 +8434,6 @@ var Builder = function Builder(api) {
7726
8434
  return new GeneralBuilder(api, new BatchTransactionManager());
7727
8435
  };
7728
8436
 
7729
- /**
7730
- * Retrieves the node name corresponding to a specified parachain ID.
7731
- *
7732
- * @param paraId - The parachain ID.
7733
- * @returns The node name if found; otherwise, null.
7734
- */
7735
- var getTNode = function getTNode(paraId, ecosystem) {
7736
- var _NODE_NAMES_DOT_KSM$f;
7737
- if (paraId === 0) {
7738
- return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
7739
- }
7740
- if (paraId === 1) {
7741
- return 'Ethereum';
7742
- }
7743
- return (_NODE_NAMES_DOT_KSM$f = sdkCommon.NODE_NAMES_DOT_KSM.find(function (nodeName) {
7744
- return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
7745
- })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
7746
- };
7747
-
7748
8437
  var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
7749
8438
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node, address, asset) {
7750
8439
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -8510,6 +9199,7 @@ exports.ETH_CHAIN_ID = ETH_CHAIN_ID;
8510
9199
  exports.GeneralBuilder = GeneralBuilder;
8511
9200
  exports.IncompatibleNodesError = IncompatibleNodesError;
8512
9201
  exports.InvalidAddressError = InvalidAddressError;
9202
+ exports.InvalidParameterError = InvalidParameterError;
8513
9203
  exports.NoXCMSupportImplementedError = NoXCMSupportImplementedError;
8514
9204
  exports.NodeNotSupportedError = NodeNotSupportedError;
8515
9205
  exports.ScenarioNotSupportedError = ScenarioNotSupportedError;
@@ -8543,6 +9233,8 @@ exports.getParaId = getParaId;
8543
9233
  exports.getTNode = getTNode;
8544
9234
  exports.getTransferInfo = getTransferInfo;
8545
9235
  exports.getTransferableAmount = getTransferableAmount;
9236
+ exports.getXcmFee = getXcmFee;
9237
+ exports.getXcmFeeEstimate = getXcmFeeEstimate;
8546
9238
  exports.isEthersContract = isEthersContract;
8547
9239
  exports.isEthersSigner = isEthersSigner;
8548
9240
  exports.resolveModuleError = resolveModuleError;