@paraspell/sdk-core 8.11.1 → 8.12.0

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