@paraspell/sdk-core 8.11.1 → 8.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/dist/index.cjs +1306 -614
  2. package/dist/index.d.ts +162 -22
  3. package/dist/index.mjs +1305 -616
  4. package/package.json +14 -14
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isTMultiLocation, Parents, isRelayChain, NODE_NAMES_DOT_KSM, hasJunction, deepEqual } from '@paraspell/sdk-common';
2
2
  export * from '@paraspell/sdk-common';
3
3
  import { ethers, Contract } from 'ethers';
4
- import { InvalidCurrencyError, getNativeAssetSymbol, getOtherAssets, isNodeEvm, getRelayChainSymbol, isForeignAsset, findAssetByMultiLocation, isAssetEqual, getAssetId, getAssetsObject, findAsset, isOverrideMultiLocationSpecifier, isTMultiAsset, isSymbolSpecifier, getNativeAssets, hasSupportForAsset, extractMultiAssetLoc, getExistentialDeposit } from '@paraspell/assets';
4
+ import { InvalidCurrencyError, getNativeAssetSymbol, getOtherAssets, isNodeEvm, getRelayChainSymbol, isForeignAsset, findAssetByMultiLocation, isAssetEqual, getAssetId, getAssetsObject, findAsset, isOverrideMultiLocationSpecifier, hasDryRunSupport, isTMultiAsset, isSymbolSpecifier, getNativeAssets, hasSupportForAsset, extractMultiAssetLoc, getExistentialDeposit } from '@paraspell/assets';
5
5
  export * from '@paraspell/assets';
6
6
  import { getSupportedPalletsDetails, getDefaultPallet } from '@paraspell/pallets';
7
7
  export * from '@paraspell/pallets';
@@ -229,47 +229,77 @@ function _possibleConstructorReturn(t, e) {
229
229
  }
230
230
  function _regeneratorRuntime() {
231
231
  _regeneratorRuntime = function () {
232
- return e;
232
+ return r;
233
233
  };
234
234
  var t,
235
- e = {},
236
- r = Object.prototype,
237
- n = r.hasOwnProperty,
238
- o = Object.defineProperty || function (t, e, r) {
239
- t[e] = r.value;
240
- },
241
- i = "function" == typeof Symbol ? Symbol : {},
242
- a = i.iterator || "@@iterator",
243
- c = i.asyncIterator || "@@asyncIterator",
244
- u = i.toStringTag || "@@toStringTag";
245
- function define(t, e, r) {
246
- return Object.defineProperty(t, e, {
247
- value: r,
248
- enumerable: true,
249
- configurable: true,
250
- writable: true
251
- }), t[e];
235
+ r = {},
236
+ e = Object.prototype,
237
+ n = e.hasOwnProperty,
238
+ o = "function" == typeof Symbol ? Symbol : {},
239
+ i = o.iterator || "@@iterator",
240
+ a = o.asyncIterator || "@@asyncIterator",
241
+ u = o.toStringTag || "@@toStringTag";
242
+ function c(t, r, e, n) {
243
+ return Object.defineProperty(t, r, {
244
+ value: e,
245
+ enumerable: !n,
246
+ configurable: !n,
247
+ writable: !n
248
+ });
252
249
  }
253
250
  try {
254
- define({}, "");
251
+ c({}, "");
255
252
  } catch (t) {
256
- define = function (t, e, r) {
257
- return t[e] = r;
253
+ c = function (t, r, e) {
254
+ return t[r] = e;
258
255
  };
259
256
  }
260
- function wrap(t, e, r, n) {
257
+ function h(r, e, n, o) {
261
258
  var i = e && e.prototype instanceof Generator ? e : Generator,
262
- a = Object.create(i.prototype),
263
- c = new Context(n || []);
264
- return o(a, "_invoke", {
265
- value: makeInvokeMethod(t, r, c)
266
- }), a;
259
+ a = Object.create(i.prototype);
260
+ return c(a, "_invoke", function (r, e, n) {
261
+ var o = 1;
262
+ return function (i, a) {
263
+ if (3 === o) throw Error("Generator is already running");
264
+ if (4 === o) {
265
+ if ("throw" === i) throw a;
266
+ return {
267
+ value: t,
268
+ done: true
269
+ };
270
+ }
271
+ for (n.method = i, n.arg = a;;) {
272
+ var u = n.delegate;
273
+ if (u) {
274
+ var c = d(u, n);
275
+ if (c) {
276
+ if (c === f) continue;
277
+ return c;
278
+ }
279
+ }
280
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
281
+ if (1 === o) throw o = 4, n.arg;
282
+ n.dispatchException(n.arg);
283
+ } else "return" === n.method && n.abrupt("return", n.arg);
284
+ o = 3;
285
+ var h = s(r, e, n);
286
+ if ("normal" === h.type) {
287
+ if (o = n.done ? 4 : 2, h.arg === f) continue;
288
+ return {
289
+ value: h.arg,
290
+ done: n.done
291
+ };
292
+ }
293
+ "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
294
+ }
295
+ };
296
+ }(r, n, new Context(o || [])), true), a;
267
297
  }
268
- function tryCatch(t, e, r) {
298
+ function s(t, r, e) {
269
299
  try {
270
300
  return {
271
301
  type: "normal",
272
- arg: t.call(e, r)
302
+ arg: t.call(r, e)
273
303
  };
274
304
  } catch (t) {
275
305
  return {
@@ -278,255 +308,193 @@ function _regeneratorRuntime() {
278
308
  };
279
309
  }
280
310
  }
281
- e.wrap = wrap;
282
- var h = "suspendedStart",
283
- l = "suspendedYield",
284
- f = "executing",
285
- s = "completed",
286
- y = {};
311
+ r.wrap = h;
312
+ var f = {};
287
313
  function Generator() {}
288
314
  function GeneratorFunction() {}
289
315
  function GeneratorFunctionPrototype() {}
290
- var p = {};
291
- define(p, a, function () {
316
+ var l = {};
317
+ c(l, i, function () {
292
318
  return this;
293
319
  });
294
- var d = Object.getPrototypeOf,
295
- v = d && d(d(values([])));
296
- v && v !== r && n.call(v, a) && (p = v);
297
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
298
- function defineIteratorMethods(t) {
299
- ["next", "throw", "return"].forEach(function (e) {
300
- define(t, e, function (t) {
301
- return this._invoke(e, t);
320
+ var p = Object.getPrototypeOf,
321
+ y = p && p(p(x([])));
322
+ y && y !== e && n.call(y, i) && (l = y);
323
+ var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
324
+ function g(t) {
325
+ ["next", "throw", "return"].forEach(function (r) {
326
+ c(t, r, function (t) {
327
+ return this._invoke(r, t);
302
328
  });
303
329
  });
304
330
  }
305
- function AsyncIterator(t, e) {
306
- function invoke(r, o, i, a) {
307
- var c = tryCatch(t[r], t, o);
331
+ function AsyncIterator(t, r) {
332
+ function e(o, i, a, u) {
333
+ var c = s(t[o], t, i);
308
334
  if ("throw" !== c.type) {
309
- var u = c.arg,
310
- h = u.value;
311
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
312
- invoke("next", t, i, a);
335
+ var h = c.arg,
336
+ f = h.value;
337
+ return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
338
+ e("next", t, a, u);
313
339
  }, function (t) {
314
- invoke("throw", t, i, a);
315
- }) : e.resolve(h).then(function (t) {
316
- u.value = t, i(u);
340
+ e("throw", t, a, u);
341
+ }) : r.resolve(f).then(function (t) {
342
+ h.value = t, a(h);
317
343
  }, function (t) {
318
- return invoke("throw", t, i, a);
344
+ return e("throw", t, a, u);
319
345
  });
320
346
  }
321
- a(c.arg);
347
+ u(c.arg);
322
348
  }
323
- var r;
324
- o(this, "_invoke", {
325
- value: function (t, n) {
326
- function callInvokeWithMethodAndArg() {
327
- return new e(function (e, r) {
328
- invoke(t, n, e, r);
329
- });
330
- }
331
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
332
- }
333
- });
334
- }
335
- function makeInvokeMethod(e, r, n) {
336
- var o = h;
337
- return function (i, a) {
338
- if (o === f) throw Error("Generator is already running");
339
- if (o === s) {
340
- if ("throw" === i) throw a;
341
- return {
342
- value: t,
343
- done: true
344
- };
345
- }
346
- for (n.method = i, n.arg = a;;) {
347
- var c = n.delegate;
348
- if (c) {
349
- var u = maybeInvokeDelegate(c, n);
350
- if (u) {
351
- if (u === y) continue;
352
- return u;
353
- }
354
- }
355
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
356
- if (o === h) throw o = s, n.arg;
357
- n.dispatchException(n.arg);
358
- } else "return" === n.method && n.abrupt("return", n.arg);
359
- o = f;
360
- var p = tryCatch(e, r, n);
361
- if ("normal" === p.type) {
362
- if (o = n.done ? s : l, p.arg === y) continue;
363
- return {
364
- value: p.arg,
365
- done: n.done
366
- };
367
- }
368
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
349
+ var o;
350
+ c(this, "_invoke", function (t, n) {
351
+ function i() {
352
+ return new r(function (r, o) {
353
+ e(t, n, r, o);
354
+ });
369
355
  }
370
- };
356
+ return o = o ? o.then(i, i) : i();
357
+ }, true);
371
358
  }
372
- function maybeInvokeDelegate(e, r) {
373
- var n = r.method,
374
- o = e.iterator[n];
375
- 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;
376
- var i = tryCatch(o, e.iterator, r.arg);
377
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
359
+ function d(r, e) {
360
+ var n = e.method,
361
+ o = r.i[n];
362
+ 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;
363
+ var i = s(o, r.i, e.arg);
364
+ if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
378
365
  var a = i.arg;
379
- 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);
366
+ 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);
380
367
  }
381
- function pushTryEntry(t) {
382
- var e = {
383
- tryLoc: t[0]
384
- };
385
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
368
+ function w(t) {
369
+ this.tryEntries.push(t);
386
370
  }
387
- function resetTryEntry(t) {
388
- var e = t.completion || {};
389
- e.type = "normal", delete e.arg, t.completion = e;
371
+ function m(r) {
372
+ var e = r[4] || {};
373
+ e.type = "normal", e.arg = t, r[4] = e;
390
374
  }
391
375
  function Context(t) {
392
- this.tryEntries = [{
393
- tryLoc: "root"
394
- }], t.forEach(pushTryEntry, this), this.reset(true);
395
- }
396
- function values(e) {
397
- if (e || "" === e) {
398
- var r = e[a];
399
- if (r) return r.call(e);
400
- if ("function" == typeof e.next) return e;
401
- if (!isNaN(e.length)) {
376
+ this.tryEntries = [[-1]], t.forEach(w, this), this.reset(true);
377
+ }
378
+ function x(r) {
379
+ if (null != r) {
380
+ var e = r[i];
381
+ if (e) return e.call(r);
382
+ if ("function" == typeof r.next) return r;
383
+ if (!isNaN(r.length)) {
402
384
  var o = -1,
403
- i = function next() {
404
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
405
- return next.value = t, next.done = true, next;
385
+ a = function e() {
386
+ for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = false, e;
387
+ return e.value = t, e.done = true, e;
406
388
  };
407
- return i.next = i;
408
- }
409
- }
410
- throw new TypeError(typeof e + " is not iterable");
411
- }
412
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
413
- value: GeneratorFunctionPrototype,
414
- configurable: true
415
- }), o(GeneratorFunctionPrototype, "constructor", {
416
- value: GeneratorFunction,
417
- configurable: true
418
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
419
- var e = "function" == typeof t && t.constructor;
420
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
421
- }, e.mark = function (t) {
422
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
423
- }, e.awrap = function (t) {
389
+ return a.next = a;
390
+ }
391
+ }
392
+ throw new TypeError(typeof r + " is not iterable");
393
+ }
394
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) {
395
+ var r = "function" == typeof t && t.constructor;
396
+ return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
397
+ }, r.mark = function (t) {
398
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
399
+ }, r.awrap = function (t) {
424
400
  return {
425
401
  __await: t
426
402
  };
427
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
403
+ }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
428
404
  return this;
429
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
405
+ }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
430
406
  void 0 === i && (i = Promise);
431
- var a = new AsyncIterator(wrap(t, r, n, o), i);
432
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
407
+ var a = new AsyncIterator(h(t, e, n, o), i);
408
+ return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
433
409
  return t.done ? t.value : a.next();
434
410
  });
435
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
411
+ }, g(v), c(v, u, "Generator"), c(v, i, function () {
436
412
  return this;
437
- }), define(g, "toString", function () {
413
+ }), c(v, "toString", function () {
438
414
  return "[object Generator]";
439
- }), e.keys = function (t) {
440
- var e = Object(t),
441
- r = [];
442
- for (var n in e) r.push(n);
443
- return r.reverse(), function next() {
444
- for (; r.length;) {
445
- var t = r.pop();
446
- if (t in e) return next.value = t, next.done = false, next;
447
- }
448
- return next.done = true, next;
415
+ }), r.keys = function (t) {
416
+ var r = Object(t),
417
+ e = [];
418
+ for (var n in r) e.unshift(n);
419
+ return function t() {
420
+ for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = false, t;
421
+ return t.done = true, t;
449
422
  };
450
- }, e.values = values, Context.prototype = {
423
+ }, r.values = x, Context.prototype = {
451
424
  constructor: Context,
452
- reset: function (e) {
453
- 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);
425
+ reset: function (r) {
426
+ 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);
454
427
  },
455
428
  stop: function () {
456
429
  this.done = true;
457
- var t = this.tryEntries[0].completion;
430
+ var t = this.tryEntries[0][4];
458
431
  if ("throw" === t.type) throw t.arg;
459
432
  return this.rval;
460
433
  },
461
- dispatchException: function (e) {
462
- if (this.done) throw e;
463
- var r = this;
464
- function handle(n, o) {
465
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
434
+ dispatchException: function (r) {
435
+ if (this.done) throw r;
436
+ var e = this;
437
+ function n(t) {
438
+ a.type = "throw", a.arg = r, e.next = t;
466
439
  }
467
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
440
+ for (var o = e.tryEntries.length - 1; o >= 0; --o) {
468
441
  var i = this.tryEntries[o],
469
- a = i.completion;
470
- if ("root" === i.tryLoc) return handle("end");
471
- if (i.tryLoc <= this.prev) {
472
- var c = n.call(i, "catchLoc"),
473
- u = n.call(i, "finallyLoc");
474
- if (c && u) {
475
- if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
476
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
477
- } else if (c) {
478
- if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
479
- } else {
480
- if (!u) throw Error("try statement without catch or finally");
481
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
482
- }
442
+ a = i[4],
443
+ u = this.prev,
444
+ c = i[1],
445
+ h = i[2];
446
+ if (-1 === i[0]) return n("end"), false;
447
+ if (!c && !h) throw Error("try statement without catch or finally");
448
+ if (null != i[0] && i[0] <= u) {
449
+ if (u < c) return this.method = "next", this.arg = t, n(c), true;
450
+ if (u < h) return n(h), false;
483
451
  }
484
452
  }
485
453
  },
486
- abrupt: function (t, e) {
487
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
488
- var o = this.tryEntries[r];
489
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
490
- var i = o;
454
+ abrupt: function (t, r) {
455
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
456
+ var n = this.tryEntries[e];
457
+ if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
458
+ var o = n;
491
459
  break;
492
460
  }
493
461
  }
494
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
495
- var a = i ? i.completion : {};
496
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
462
+ o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
463
+ var i = o ? o[4] : {};
464
+ return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
497
465
  },
498
- complete: function (t, e) {
466
+ complete: function (t, r) {
499
467
  if ("throw" === t.type) throw t.arg;
500
- 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;
468
+ 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;
501
469
  },
502
470
  finish: function (t) {
503
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
504
- var r = this.tryEntries[e];
505
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
471
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
472
+ var e = this.tryEntries[r];
473
+ if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
506
474
  }
507
475
  },
508
476
  catch: function (t) {
509
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
510
- var r = this.tryEntries[e];
511
- if (r.tryLoc === t) {
512
- var n = r.completion;
477
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
478
+ var e = this.tryEntries[r];
479
+ if (e[0] === t) {
480
+ var n = e[4];
513
481
  if ("throw" === n.type) {
514
482
  var o = n.arg;
515
- resetTryEntry(r);
483
+ m(e);
516
484
  }
517
485
  return o;
518
486
  }
519
487
  }
520
488
  throw Error("illegal catch attempt");
521
489
  },
522
- delegateYield: function (e, r, n) {
490
+ delegateYield: function (r, e, n) {
523
491
  return this.delegate = {
524
- iterator: values(e),
525
- resultName: r,
526
- nextLoc: n
527
- }, "next" === this.method && (this.arg = t), y;
492
+ i: x(r),
493
+ r: e,
494
+ n: n
495
+ }, "next" === this.method && (this.arg = t), f;
528
496
  }
529
- }, e;
497
+ }, r;
530
498
  }
531
499
  function _setPrototypeOf(t, e) {
532
500
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
@@ -825,6 +793,168 @@ var AssetClaimBuilder = /*#__PURE__*/function () {
825
793
  }]);
826
794
  }();
827
795
 
796
+ /**
797
+ * Error thrown when the Ethereum bridge is halted.
798
+ */
799
+ var BridgeHaltedError = /*#__PURE__*/function (_Error) {
800
+ /**
801
+ * Constructs a new BridgeHaltedError.
802
+ *
803
+ * @param message - Optional custom error message.
804
+ */
805
+ function BridgeHaltedError() {
806
+ var _this;
807
+ _classCallCheck(this, BridgeHaltedError);
808
+ _this = _callSuper(this, BridgeHaltedError, ['Bridge operations have been paused by onchain governance.']);
809
+ _this.name = 'BridgeHaltedError';
810
+ return _this;
811
+ }
812
+ _inherits(BridgeHaltedError, _Error);
813
+ return _createClass(BridgeHaltedError);
814
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
815
+
816
+ /**
817
+ * Error thrown when the Dry Run fails.
818
+ */
819
+ var DryRunFailedError = /*#__PURE__*/function (_Error) {
820
+ /**
821
+ * Constructs a new DryRunFailedError.
822
+ *
823
+ * @param message - Optional custom error message.
824
+ */
825
+ function DryRunFailedError(reason) {
826
+ var _this;
827
+ _classCallCheck(this, DryRunFailedError);
828
+ _this = _callSuper(this, DryRunFailedError, ["Dry run failed: ".concat(reason)]);
829
+ _this.name = 'DryRunFailedError';
830
+ return _this;
831
+ }
832
+ _inherits(DryRunFailedError, _Error);
833
+ return _createClass(DryRunFailedError);
834
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
835
+
836
+ /**
837
+ * Error thrown when nodes from different relay chains are incompatible.
838
+ */
839
+ var IncompatibleNodesError = /*#__PURE__*/function (_Error) {
840
+ /**
841
+ * Constructs a new IncompatibleNodesError.
842
+ *
843
+ * @param message - Optional custom error message.
844
+ */
845
+ function IncompatibleNodesError(message) {
846
+ var _this;
847
+ _classCallCheck(this, IncompatibleNodesError);
848
+ _this = _callSuper(this, IncompatibleNodesError, [message !== null && message !== void 0 ? message : 'Transactions between nodes on different relaychains are not yet possible.']);
849
+ _this.name = 'IncompatibleNodes';
850
+ return _this;
851
+ }
852
+ _inherits(IncompatibleNodesError, _Error);
853
+ return _createClass(IncompatibleNodesError);
854
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
855
+
856
+ /**
857
+ * Error thrown when an invalid address is provided.
858
+ */
859
+ var InvalidAddressError = /*#__PURE__*/function (_Error) {
860
+ /**
861
+ * Constructs a new InvalidAddressError.
862
+ *
863
+ * @param message - The error message.
864
+ */
865
+ function InvalidAddressError(message) {
866
+ var _this;
867
+ _classCallCheck(this, InvalidAddressError);
868
+ _this = _callSuper(this, InvalidAddressError, [message]);
869
+ _this.name = 'InvalidAddressError';
870
+ return _this;
871
+ }
872
+ _inherits(InvalidAddressError, _Error);
873
+ return _createClass(InvalidAddressError);
874
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
875
+
876
+ /**
877
+ * Error thrown when the Dry Run fails.
878
+ */
879
+ var InvalidParameterError = /*#__PURE__*/function (_Error) {
880
+ /**
881
+ * Constructs a new InvalidParameterError.
882
+ *
883
+ * @param message - Required error message.
884
+ */
885
+ function InvalidParameterError(message) {
886
+ var _this;
887
+ _classCallCheck(this, InvalidParameterError);
888
+ _this = _callSuper(this, InvalidParameterError, [message]);
889
+ _this.name = 'InvalidParameterError';
890
+ return _this;
891
+ }
892
+ _inherits(InvalidParameterError, _Error);
893
+ return _createClass(InvalidParameterError);
894
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
895
+
896
+ /**
897
+ * Used to inform user, that Parachain they wish to use is not supported yet
898
+ */
899
+ var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
900
+ /**
901
+ * Constructs a new NodeNotSupportedError.
902
+ *
903
+ * @param message - Optional custom error message.
904
+ */
905
+ function NodeNotSupportedError(message) {
906
+ var _this;
907
+ _classCallCheck(this, NodeNotSupportedError);
908
+ _this = _callSuper(this, NodeNotSupportedError, [message !== null && message !== void 0 ? message : 'These nodes do not support XCM transfers from Relay / to Relay chain.']);
909
+ _this.name = 'NodeNotSupported';
910
+ return _this;
911
+ }
912
+ _inherits(NodeNotSupportedError, _Error);
913
+ return _createClass(NodeNotSupportedError);
914
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
915
+
916
+ /**
917
+ * Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
918
+ */
919
+ var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
920
+ /**
921
+ * Constructs a new NoXCMSupportImplementedError.
922
+ *
923
+ * @param node - The node for which XCM support is not implemented.
924
+ */
925
+ function NoXCMSupportImplementedError(node) {
926
+ var _this;
927
+ _classCallCheck(this, NoXCMSupportImplementedError);
928
+ _this = _callSuper(this, NoXCMSupportImplementedError, ["No XCM support implemented for ".concat(node, " node yet.")]);
929
+ _this.name = 'NoXCMSupportImplemented';
930
+ return _this;
931
+ }
932
+ _inherits(NoXCMSupportImplementedError, _Error);
933
+ return _createClass(NoXCMSupportImplementedError);
934
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
935
+
936
+ /**
937
+ * Used to inform user, that Parachain they wish to use does not support scenario they wish to use yet
938
+ */
939
+ var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
940
+ /**
941
+ * Constructs a new ScenarioNotSupportedError.
942
+ *
943
+ * @param node - The node where the scenario is not supported.
944
+ * @param scenario - The scenario that is not supported.
945
+ * @param message - Optional custom error message.
946
+ */
947
+ function ScenarioNotSupportedError(node, scenario, message) {
948
+ var _this;
949
+ _classCallCheck(this, ScenarioNotSupportedError);
950
+ _this = _callSuper(this, ScenarioNotSupportedError, [message !== null && message !== void 0 ? message : "Scenario ".concat(scenario, " not supported for node ").concat(node)]);
951
+ _this.name = 'ScenarioNotSupported';
952
+ return _this;
953
+ }
954
+ _inherits(ScenarioNotSupportedError, _Error);
955
+ return _createClass(ScenarioNotSupportedError);
956
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
957
+
828
958
  var DEFAULT_FEE_ASSET = 0;
829
959
  var ETH_PARA_ID = 1;
830
960
  var ETH_CHAIN_ID = BigInt(ETH_PARA_ID);
@@ -842,6 +972,7 @@ var DOT_MULTILOCATION = {
842
972
  var SYSTEM_NODES_POLKADOT = ['PeoplePolkadot', 'CoretimePolkadot', 'Collectives'];
843
973
  var SYSTEM_NODES_KUSAMA = ['PeopleKusama', 'CoretimeKusama'];
844
974
  var ASSET_HUB_EXECUTION_FEE = 2200000000n; // 0.22 DOT
975
+ // 30% padding
845
976
 
846
977
  var AssetHubPolkadot$1 = {
847
978
  name: "AssetHub",
@@ -925,6 +1056,25 @@ var Acala$1 = {
925
1056
  }
926
1057
  ]
927
1058
  };
1059
+ var Ajuna$1 = {
1060
+ name: "Ajuna Network",
1061
+ info: "ajuna",
1062
+ paraId: 2051,
1063
+ providers: [
1064
+ {
1065
+ name: "AjunaNetwork",
1066
+ endpoint: "wss://rpc-para.ajuna.network"
1067
+ },
1068
+ {
1069
+ name: "IBP1",
1070
+ endpoint: "wss://ajuna.ibp.network"
1071
+ },
1072
+ {
1073
+ name: "IBP2",
1074
+ endpoint: "wss://ajuna.dotters.network"
1075
+ }
1076
+ ]
1077
+ };
928
1078
  var Astar$1 = {
929
1079
  name: "Astar",
930
1080
  info: "astar",
@@ -1081,10 +1231,6 @@ var Centrifuge$1 = {
1081
1231
  name: "Centrifuge",
1082
1232
  endpoint: "wss://fullnode.centrifuge.io"
1083
1233
  },
1084
- {
1085
- name: "Dwellir",
1086
- endpoint: "wss://centrifuge-rpc.dwellir.com"
1087
- },
1088
1234
  {
1089
1235
  name: "LuckyFriday",
1090
1236
  endpoint: "wss://rpc-centrifuge.luckyfriday.io"
@@ -1103,10 +1249,6 @@ var ComposableFinance$1 = {
1103
1249
  {
1104
1250
  name: "Composable",
1105
1251
  endpoint: "wss://rpc.composable.finance"
1106
- },
1107
- {
1108
- name: "Dwellir",
1109
- endpoint: "wss://composable-rpc.dwellir.com"
1110
1252
  }
1111
1253
  ]
1112
1254
  };
@@ -1157,10 +1299,6 @@ var Interlay$1 = {
1157
1299
  info: "interlay",
1158
1300
  paraId: 2032,
1159
1301
  providers: [
1160
- {
1161
- name: "Dwellir",
1162
- endpoint: "wss://interlay-rpc.dwellir.com"
1163
- },
1164
1302
  {
1165
1303
  name: "Kintsugi Labs",
1166
1304
  endpoint: "wss://api.interlay.io/parachain"
@@ -1192,20 +1330,20 @@ var Moonbeam$1 = {
1192
1330
  paraId: 2004,
1193
1331
  providers: [
1194
1332
  {
1195
- name: "Allnodes",
1196
- endpoint: "wss://moonbeam-rpc.publicnode.com"
1333
+ name: "IBP1",
1334
+ endpoint: "wss://moonbeam.ibp.network"
1197
1335
  },
1198
1336
  {
1199
- name: "Blast",
1200
- endpoint: "wss://moonbeam.public.blastapi.io"
1337
+ name: "RadiumBlock",
1338
+ endpoint: "wss://moonbeam.public.curie.radiumblock.co/ws"
1201
1339
  },
1202
1340
  {
1203
- name: "Dwellir",
1204
- endpoint: "wss://moonbeam-rpc.n.dwellir.com"
1341
+ name: "Allnodes",
1342
+ endpoint: "wss://moonbeam-rpc.publicnode.com"
1205
1343
  },
1206
1344
  {
1207
- name: "IBP1",
1208
- endpoint: "wss://moonbeam.ibp.network"
1345
+ name: "Blast",
1346
+ endpoint: "wss://moonbeam.public.blastapi.io"
1209
1347
  },
1210
1348
  {
1211
1349
  name: "IBP2",
@@ -1219,10 +1357,6 @@ var Moonbeam$1 = {
1219
1357
  name: "OnFinality",
1220
1358
  endpoint: "wss://moonbeam.api.onfinality.io/public-ws"
1221
1359
  },
1222
- {
1223
- name: "RadiumBlock",
1224
- endpoint: "wss://moonbeam.public.curie.radiumblock.co/ws"
1225
- },
1226
1360
  {
1227
1361
  name: "UnitedBloc",
1228
1362
  endpoint: "wss://moonbeam.unitedbloc.com"
@@ -1275,7 +1409,7 @@ var CoretimeKusama$1 = {
1275
1409
  providers: [
1276
1410
  {
1277
1411
  name: "Dwellir",
1278
- endpoint: "wss://coretime-kusama-rpc.dwellir.com"
1412
+ endpoint: "wss://coretime-kusama-rpc.n.dwellir.com"
1279
1413
  },
1280
1414
  {
1281
1415
  name: "IBP1",
@@ -1289,6 +1423,10 @@ var CoretimeKusama$1 = {
1289
1423
  name: "LuckyFriday",
1290
1424
  endpoint: "wss://rpc-coretime-kusama.luckyfriday.io"
1291
1425
  },
1426
+ {
1427
+ name: "OnFinality",
1428
+ endpoint: "wss://coretime-kusama.api.onfinality.io/public-ws"
1429
+ },
1292
1430
  {
1293
1431
  name: "Parity",
1294
1432
  endpoint: "wss://kusama-coretime-rpc.polkadot.io"
@@ -1304,6 +1442,10 @@ var CoretimePolkadot$1 = {
1304
1442
  info: "polkadotCoretime",
1305
1443
  paraId: 1005,
1306
1444
  providers: [
1445
+ {
1446
+ name: "Dwellir",
1447
+ endpoint: "wss://coretime-polkadot-rpc.n.dwellir.com"
1448
+ },
1307
1449
  {
1308
1450
  name: "IBP1",
1309
1451
  endpoint: "wss://sys.ibp.network/coretime-polkadot"
@@ -1316,9 +1458,17 @@ var CoretimePolkadot$1 = {
1316
1458
  name: "LuckyFriday",
1317
1459
  endpoint: "wss://rpc-coretime-polkadot.luckyfriday.io"
1318
1460
  },
1461
+ {
1462
+ name: "OnFinality",
1463
+ endpoint: "wss://coretime-polkadot.api.onfinality.io/public-ws"
1464
+ },
1319
1465
  {
1320
1466
  name: "Parity",
1321
1467
  endpoint: "wss://polkadot-coretime-rpc.polkadot.io"
1468
+ },
1469
+ {
1470
+ name: "Stakeworld",
1471
+ endpoint: "wss://dot-rpc.stakeworld.io/coretime"
1322
1472
  }
1323
1473
  ]
1324
1474
  };
@@ -1369,10 +1519,6 @@ var Amplitude$1 = {
1369
1519
  info: "amplitude",
1370
1520
  paraId: 2124,
1371
1521
  providers: [
1372
- {
1373
- name: "Dwellir",
1374
- endpoint: "wss://amplitude-rpc.dwellir.com"
1375
- },
1376
1522
  {
1377
1523
  name: "PendulumChain",
1378
1524
  endpoint: "wss://rpc-amplitude.pendulumchain.tech"
@@ -1413,17 +1559,6 @@ var BifrostKusama$1 = {
1413
1559
  }
1414
1560
  ]
1415
1561
  };
1416
- var Calamari$1 = {
1417
- name: "Calamari",
1418
- info: "calamari",
1419
- paraId: 2084,
1420
- providers: [
1421
- {
1422
- name: "Manta Network",
1423
- endpoint: "wss://calamari.systems"
1424
- }
1425
- ]
1426
- };
1427
1562
  var CrustShadow$1 = {
1428
1563
  name: "Crust Shadow",
1429
1564
  info: "shadow",
@@ -1462,21 +1597,10 @@ var Crab$1 = {
1462
1597
  }
1463
1598
  ]
1464
1599
  };
1465
- var InvArchTinker$1 = {
1466
- name: "InvArch Tinkernet",
1467
- info: "tinker",
1468
- paraId: 2125,
1469
- providers: [
1470
- {
1471
- name: "Dwellir",
1472
- endpoint: "wss://tinkernet-rpc.dwellir.com"
1473
- }
1474
- ]
1475
- };
1476
- var Karura$1 = {
1477
- name: "Karura",
1478
- info: "karura",
1479
- paraId: 2000,
1600
+ var Karura$1 = {
1601
+ name: "Karura",
1602
+ info: "karura",
1603
+ paraId: 2000,
1480
1604
  providers: [
1481
1605
  {
1482
1606
  name: "Acala Foundation 0",
@@ -1509,10 +1633,6 @@ var Kintsugi$1 = {
1509
1633
  info: "kintsugi",
1510
1634
  paraId: 2092,
1511
1635
  providers: [
1512
- {
1513
- name: "Dwellir",
1514
- endpoint: "wss://kintsugi-rpc.dwellir.com"
1515
- },
1516
1636
  {
1517
1637
  name: "Kintsugi Labs",
1518
1638
  endpoint: "wss://api-kusama.interlay.io/parachain"
@@ -1563,18 +1683,10 @@ var Quartz$1 = {
1563
1683
  info: "quartz",
1564
1684
  paraId: 2095,
1565
1685
  providers: [
1566
- {
1567
- name: "Dwellir",
1568
- endpoint: "wss://quartz-rpc.n.dwellir.com"
1569
- },
1570
1686
  {
1571
1687
  name: "Geo Load Balancer",
1572
1688
  endpoint: "wss://ws-quartz.unique.network"
1573
1689
  },
1574
- {
1575
- name: "Unique America",
1576
- endpoint: "wss://us-ws-quartz.unique.network"
1577
- },
1578
1690
  {
1579
1691
  name: "Unique Asia",
1580
1692
  endpoint: "wss://asia-ws-quartz.unique.network"
@@ -1612,6 +1724,10 @@ var PeoplePolkadot$1 = {
1612
1724
  info: "polkadotPeople",
1613
1725
  paraId: 1004,
1614
1726
  providers: [
1727
+ {
1728
+ name: "Dwellir",
1729
+ endpoint: "wss://people-polkadot-rpc.n.dwellir.com"
1730
+ },
1615
1731
  {
1616
1732
  name: "IBP1",
1617
1733
  endpoint: "wss://sys.ibp.network/people-polkadot"
@@ -1624,6 +1740,10 @@ var PeoplePolkadot$1 = {
1624
1740
  name: "LuckyFriday",
1625
1741
  endpoint: "wss://rpc-people-polkadot.luckyfriday.io"
1626
1742
  },
1743
+ {
1744
+ name: "OnFinality",
1745
+ endpoint: "wss://people-polkadot.api.onfinality.io/public-ws"
1746
+ },
1627
1747
  {
1628
1748
  name: "Parity",
1629
1749
  endpoint: "wss://polkadot-people-rpc.polkadot.io"
@@ -1631,6 +1751,10 @@ var PeoplePolkadot$1 = {
1631
1751
  {
1632
1752
  name: "RadiumBlock",
1633
1753
  endpoint: "wss://people-polkadot.public.curie.radiumblock.co/ws"
1754
+ },
1755
+ {
1756
+ name: "Stakeworld",
1757
+ endpoint: "wss://dot-rpc.stakeworld.io/people"
1634
1758
  }
1635
1759
  ]
1636
1760
  };
@@ -1643,6 +1767,10 @@ var PeopleKusama$1 = {
1643
1767
  name: "Dwellir",
1644
1768
  endpoint: "wss://people-kusama-rpc.n.dwellir.com"
1645
1769
  },
1770
+ {
1771
+ name: "Helixstreet",
1772
+ endpoint: "wss://rpc-people-kusama.helixstreet.io"
1773
+ },
1646
1774
  {
1647
1775
  name: "IBP1",
1648
1776
  endpoint: "wss://sys.ibp.network/people-kusama"
@@ -1655,6 +1783,10 @@ var PeopleKusama$1 = {
1655
1783
  name: "LuckyFriday",
1656
1784
  endpoint: "wss://rpc-people-kusama.luckyfriday.io"
1657
1785
  },
1786
+ {
1787
+ name: "OnFinality",
1788
+ endpoint: "wss://people-kusama.api.onfinality.io/public-ws"
1789
+ },
1658
1790
  {
1659
1791
  name: "Parity",
1660
1792
  endpoint: "wss://kusama-people-rpc.polkadot.io"
@@ -1792,10 +1924,6 @@ var NeuroWeb$1 = {
1792
1924
  info: "neuroweb",
1793
1925
  paraId: 2043,
1794
1926
  providers: [
1795
- {
1796
- name: "Dwellir",
1797
- endpoint: "wss://neuroweb-rpc.dwellir.com"
1798
- },
1799
1927
  {
1800
1928
  name: "TraceLabs",
1801
1929
  endpoint: "wss://parachain-rpc.origin-trail.network"
@@ -1898,10 +2026,6 @@ var Subsocial$1 = {
1898
2026
  {
1899
2027
  name: "Dappforce",
1900
2028
  endpoint: "wss://para.subsocial.network"
1901
- },
1902
- {
1903
- name: "Dwellir",
1904
- endpoint: "wss://subsocial-rpc.dwellir.com"
1905
2029
  }
1906
2030
  ]
1907
2031
  };
@@ -1910,10 +2034,6 @@ var KiltSpiritnet$1 = {
1910
2034
  info: "kilt",
1911
2035
  paraId: 2086,
1912
2036
  providers: [
1913
- {
1914
- name: "Dwellir",
1915
- endpoint: "wss://kilt-rpc.dwellir.com"
1916
- },
1917
2037
  {
1918
2038
  name: "IBP1",
1919
2039
  endpoint: "wss://kilt.ibp.network"
@@ -2049,10 +2169,6 @@ var Polkadot = {
2049
2169
  name: "RadiumBlock",
2050
2170
  endpoint: "wss://polkadot.public.curie.radiumblock.co/ws"
2051
2171
  },
2052
- {
2053
- name: "RockX",
2054
- endpoint: "wss://rockx-dot.w3node.com/polka-public-dot/ws"
2055
- },
2056
2172
  {
2057
2173
  name: "Stakeworld",
2058
2174
  endpoint: "wss://dot-rpc.stakeworld.io"
@@ -2104,10 +2220,6 @@ var Kusama = {
2104
2220
  name: "RadiumBlock",
2105
2221
  endpoint: "wss://kusama.public.curie.radiumblock.co/ws"
2106
2222
  },
2107
- {
2108
- name: "RockX",
2109
- endpoint: "wss://rockx-ksm.w3node.com/polka-public-ksm/ws"
2110
- },
2111
2223
  {
2112
2224
  name: "Stakeworld",
2113
2225
  endpoint: "wss://ksm-rpc.stakeworld.io"
@@ -2117,6 +2229,7 @@ var Kusama = {
2117
2229
  var configs = {
2118
2230
  AssetHubPolkadot: AssetHubPolkadot$1,
2119
2231
  Acala: Acala$1,
2232
+ Ajuna: Ajuna$1,
2120
2233
  Astar: Astar$1,
2121
2234
  BifrostPolkadot: BifrostPolkadot$1,
2122
2235
  Bitgreen: Bitgreen$1,
@@ -2137,10 +2250,8 @@ var configs = {
2137
2250
  Amplitude: Amplitude$1,
2138
2251
  Basilisk: Basilisk$1,
2139
2252
  BifrostKusama: BifrostKusama$1,
2140
- Calamari: Calamari$1,
2141
2253
  CrustShadow: CrustShadow$1,
2142
2254
  Crab: Crab$1,
2143
- InvArchTinker: InvArchTinker$1,
2144
2255
  Karura: Karura$1,
2145
2256
  Kintsugi: Kintsugi$1,
2146
2257
  Moonriver: Moonriver$1,
@@ -2291,7 +2402,7 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
2291
2402
  includeFee = _ref2.includeFee;
2292
2403
  var paraId = resolveParaId(paraIdTo, destination);
2293
2404
  return _objectSpread2({
2294
- dest: createPolkadotXcmHeader('RelayToPara', version, destination, paraId),
2405
+ dest: createVersionedDestination('RelayToPara', version, destination, paraId),
2295
2406
  beneficiary: createVersionedBeneficiary({
2296
2407
  api: api,
2297
2408
  scenario: 'RelayToPara',
@@ -2353,7 +2464,7 @@ var createVersionedMultiAssets = function createVersionedMultiAssets(version, am
2353
2464
  var multiAssets = createMultiAsset(version, amount, multiLocation);
2354
2465
  return addXcmVersionHeader([multiAssets], version);
2355
2466
  };
2356
- var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId, junction, parents) {
2467
+ var createVersionedDestination = function createVersionedDestination(scenario, version, destination, nodeId, junction, parents) {
2357
2468
  var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? Parents.ZERO : Parents.ONE;
2358
2469
  var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
2359
2470
  Parachain: nodeId
@@ -2393,10 +2504,10 @@ var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(relay
2393
2504
  return node;
2394
2505
  };
2395
2506
  var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, node) {
2396
- var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2507
+ var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2397
2508
  isDestination: false
2398
2509
  },
2399
- isDestination = _ref3.isDestination;
2510
+ isDestination = _ref2.isDestination;
2400
2511
  if ('multilocation' in currency) {
2401
2512
  throw new 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), ")}."));
2402
2513
  }
@@ -2702,148 +2813,6 @@ var resolveParaId = function resolveParaId(paraId, destination) {
2702
2813
  return paraId !== null && paraId !== void 0 ? paraId : getParaId(destination);
2703
2814
  };
2704
2815
 
2705
- /**
2706
- * Error thrown when the Ethereum bridge is halted.
2707
- */
2708
- var BridgeHaltedError = /*#__PURE__*/function (_Error) {
2709
- /**
2710
- * Constructs a new BridgeHaltedError.
2711
- *
2712
- * @param message - Optional custom error message.
2713
- */
2714
- function BridgeHaltedError() {
2715
- var _this;
2716
- _classCallCheck(this, BridgeHaltedError);
2717
- _this = _callSuper(this, BridgeHaltedError, ['Bridge operations have been paused by onchain governance.']);
2718
- _this.name = 'BridgeHaltedError';
2719
- return _this;
2720
- }
2721
- _inherits(BridgeHaltedError, _Error);
2722
- return _createClass(BridgeHaltedError);
2723
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2724
-
2725
- /**
2726
- * Error thrown when the Dry Run fails.
2727
- */
2728
- var DryRunFailedError = /*#__PURE__*/function (_Error) {
2729
- /**
2730
- * Constructs a new DryRunFailedError.
2731
- *
2732
- * @param message - Optional custom error message.
2733
- */
2734
- function DryRunFailedError(reason) {
2735
- var _this;
2736
- _classCallCheck(this, DryRunFailedError);
2737
- _this = _callSuper(this, DryRunFailedError, ["Dry run failed: ".concat(reason)]);
2738
- _this.name = 'DryRunFailedError';
2739
- return _this;
2740
- }
2741
- _inherits(DryRunFailedError, _Error);
2742
- return _createClass(DryRunFailedError);
2743
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2744
-
2745
- /**
2746
- * Error thrown when nodes from different relay chains are incompatible.
2747
- */
2748
- var IncompatibleNodesError = /*#__PURE__*/function (_Error) {
2749
- /**
2750
- * Constructs a new IncompatibleNodesError.
2751
- *
2752
- * @param message - Optional custom error message.
2753
- */
2754
- function IncompatibleNodesError(message) {
2755
- var _this;
2756
- _classCallCheck(this, IncompatibleNodesError);
2757
- _this = _callSuper(this, IncompatibleNodesError, [message !== null && message !== void 0 ? message : 'Transactions between nodes on different relaychains are not yet possible.']);
2758
- _this.name = 'IncompatibleNodes';
2759
- return _this;
2760
- }
2761
- _inherits(IncompatibleNodesError, _Error);
2762
- return _createClass(IncompatibleNodesError);
2763
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2764
-
2765
- /**
2766
- * Error thrown when an invalid address is provided.
2767
- */
2768
- var InvalidAddressError = /*#__PURE__*/function (_Error) {
2769
- /**
2770
- * Constructs a new InvalidAddressError.
2771
- *
2772
- * @param message - The error message.
2773
- */
2774
- function InvalidAddressError(message) {
2775
- var _this;
2776
- _classCallCheck(this, InvalidAddressError);
2777
- _this = _callSuper(this, InvalidAddressError, [message]);
2778
- _this.name = 'InvalidAddressError';
2779
- return _this;
2780
- }
2781
- _inherits(InvalidAddressError, _Error);
2782
- return _createClass(InvalidAddressError);
2783
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2784
-
2785
- /**
2786
- * Used to inform user, that Parachain they wish to use is not supported yet
2787
- */
2788
- var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
2789
- /**
2790
- * Constructs a new NodeNotSupportedError.
2791
- *
2792
- * @param message - Optional custom error message.
2793
- */
2794
- function NodeNotSupportedError(message) {
2795
- var _this;
2796
- _classCallCheck(this, NodeNotSupportedError);
2797
- _this = _callSuper(this, NodeNotSupportedError, [message !== null && message !== void 0 ? message : 'These nodes do not support XCM transfers from Relay / to Relay chain.']);
2798
- _this.name = 'NodeNotSupported';
2799
- return _this;
2800
- }
2801
- _inherits(NodeNotSupportedError, _Error);
2802
- return _createClass(NodeNotSupportedError);
2803
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2804
-
2805
- /**
2806
- * Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
2807
- */
2808
- var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
2809
- /**
2810
- * Constructs a new NoXCMSupportImplementedError.
2811
- *
2812
- * @param node - The node for which XCM support is not implemented.
2813
- */
2814
- function NoXCMSupportImplementedError(node) {
2815
- var _this;
2816
- _classCallCheck(this, NoXCMSupportImplementedError);
2817
- _this = _callSuper(this, NoXCMSupportImplementedError, ["No XCM support implemented for ".concat(node, " node yet.")]);
2818
- _this.name = 'NoXCMSupportImplemented';
2819
- return _this;
2820
- }
2821
- _inherits(NoXCMSupportImplementedError, _Error);
2822
- return _createClass(NoXCMSupportImplementedError);
2823
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2824
-
2825
- /**
2826
- * Used to inform user, that Parachain they wish to use does not support scenario they wish to use yet
2827
- */
2828
- var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
2829
- /**
2830
- * Constructs a new ScenarioNotSupportedError.
2831
- *
2832
- * @param node - The node where the scenario is not supported.
2833
- * @param scenario - The scenario that is not supported.
2834
- * @param message - Optional custom error message.
2835
- */
2836
- function ScenarioNotSupportedError(node, scenario, message) {
2837
- var _this;
2838
- _classCallCheck(this, ScenarioNotSupportedError);
2839
- _this = _callSuper(this, ScenarioNotSupportedError, [message !== null && message !== void 0 ? message : "Scenario ".concat(scenario, " not supported for node ").concat(node)]);
2840
- _this.name = 'ScenarioNotSupported';
2841
- return _this;
2842
- }
2843
- _inherits(ScenarioNotSupportedError, _Error);
2844
- return _createClass(ScenarioNotSupportedError);
2845
- }(/*#__PURE__*/_wrapNativeSuper(Error));
2846
-
2847
2816
  var validateAddress = function validateAddress(address, node) {
2848
2817
  var isDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
2849
2818
  var isEvm = isNodeEvm(node);
@@ -3033,12 +3002,13 @@ var getBridgeStatus = /*#__PURE__*/function () {
3033
3002
  };
3034
3003
  }();
3035
3004
 
3036
- var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messageId) {
3005
+ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, version, messageId) {
3037
3006
  var api = _ref.api,
3038
3007
  address = _ref.address,
3039
3008
  asset = _ref.asset,
3040
3009
  scenario = _ref.scenario,
3041
- senderAddress = _ref.senderAddress;
3010
+ senderAddress = _ref.senderAddress,
3011
+ ahAddress = _ref.ahAddress;
3042
3012
  if (!isForeignAsset(asset)) {
3043
3013
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3044
3014
  }
@@ -3046,7 +3016,10 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
3046
3016
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
3047
3017
  }
3048
3018
  if (!senderAddress) {
3049
- throw new InvalidCurrencyError("Please provide senderAddress");
3019
+ throw new InvalidParameterError("Please provide senderAddress");
3020
+ }
3021
+ if (isNodeEvm(origin) && !ahAddress) {
3022
+ throw new InvalidParameterError("Please provide ahAddress");
3050
3023
  }
3051
3024
  var ethAsset = findAssetByMultiLocation(getOtherAssets('Ethereum'), asset.multiLocation);
3052
3025
  if (!ethAsset) {
@@ -3072,7 +3045,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
3072
3045
  api: api,
3073
3046
  scenario: scenario,
3074
3047
  pallet: 'PolkadotXcm',
3075
- recipientAddress: senderAddress,
3048
+ recipientAddress: isNodeEvm(origin) ? ahAddress : senderAddress,
3076
3049
  version: version
3077
3050
  })
3078
3051
  }
@@ -3212,11 +3185,11 @@ var ParachainNode = /*#__PURE__*/function () {
3212
3185
  key: "transfer",
3213
3186
  value: function () {
3214
3187
  var _transfer = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
3215
- var api, asset, feeAsset, address, destination, paraIdTo, overriddenAsset, version, senderAddress, pallet, method, isRelayDestination, scenario, paraId, versionOrDefault, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
3188
+ var api, asset, feeAsset, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, isRelayDestination, scenario, paraId, versionOrDefault, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
3216
3189
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3217
3190
  while (1) switch (_context.prev = _context.next) {
3218
3191
  case 0:
3219
- api = options.api, asset = options.asset, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, pallet = options.pallet, method = options.method;
3192
+ api = options.api, asset = options.asset, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
3220
3193
  isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
3221
3194
  scenario = isRelayDestination ? 'ParaToRelay' : 'ParaToPara';
3222
3195
  paraId = resolveParaId(paraIdTo, destination);
@@ -3291,7 +3264,7 @@ var ParachainNode = /*#__PURE__*/function () {
3291
3264
  }
3292
3265
  _options = {
3293
3266
  api: api,
3294
- header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraId),
3267
+ header: this.createVersionedDestination(scenario, versionOrDefault, destination, paraId),
3295
3268
  addressSelection: createVersionedBeneficiary({
3296
3269
  api: api,
3297
3270
  scenario: scenario,
@@ -3310,6 +3283,7 @@ var ParachainNode = /*#__PURE__*/function () {
3310
3283
  paraIdTo: paraId,
3311
3284
  version: version,
3312
3285
  senderAddress: senderAddress,
3286
+ ahAddress: ahAddress,
3313
3287
  pallet: pallet,
3314
3288
  method: method
3315
3289
  }; // Handle common cases
@@ -3378,9 +3352,9 @@ var ParachainNode = /*#__PURE__*/function () {
3378
3352
  });
3379
3353
  }
3380
3354
  }, {
3381
- key: "createPolkadotXcmHeader",
3382
- value: function createPolkadotXcmHeader$1(scenario, version, destination, paraId) {
3383
- return createPolkadotXcmHeader(scenario, version, destination, paraId);
3355
+ key: "createVersionedDestination",
3356
+ value: function createVersionedDestination$1(scenario, version, destination, paraId) {
3357
+ return createVersionedDestination(scenario, version, destination, paraId);
3384
3358
  }
3385
3359
  }, {
3386
3360
  key: "getNativeAssetSymbol",
@@ -3493,13 +3467,13 @@ var ParachainNode = /*#__PURE__*/function () {
3493
3467
  case 15:
3494
3468
  // Pad fee by 50%
3495
3469
  dryRunFeePadded = BigInt(dryRunResult.fee) * BigInt(3) / BigInt(2);
3496
- destWithHeader = createPolkadotXcmHeader(scenario, version, destination, paraIdTo);
3470
+ destWithHeader = createVersionedDestination(scenario, version, destination, paraIdTo);
3497
3471
  _extractVersionFromHe = extractVersionFromHeader(destWithHeader), _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2), _extractVersionFromHe2[0], dest = _extractVersionFromHe2[1];
3498
3472
  call = {
3499
3473
  module: 'PolkadotXcm',
3500
3474
  section: 'transfer_assets_using_type_and_then',
3501
3475
  parameters: {
3502
- dest: this.createPolkadotXcmHeader(scenario, version, destination, getParaId('AssetHubPolkadot')),
3476
+ dest: this.createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
3503
3477
  assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
3504
3478
  assets_transfer_type: 'DestinationReserve',
3505
3479
  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),
@@ -3656,7 +3630,7 @@ var ParachainNode = /*#__PURE__*/function () {
3656
3630
  module: 'PolkadotXcm',
3657
3631
  section: 'transfer_assets_using_type_and_then',
3658
3632
  parameters: {
3659
- dest: this.createPolkadotXcmHeader(scenario, version, destination, getParaId('AssetHubPolkadot')),
3633
+ dest: this.createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
3660
3634
  assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, fee, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
3661
3635
  assets_transfer_type: 'DestinationReserve',
3662
3636
  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),
@@ -3676,7 +3650,7 @@ var ParachainNode = /*#__PURE__*/function () {
3676
3650
  version: version
3677
3651
  })
3678
3652
  }
3679
- }], version) : createCustomXcmOnDest(input, version, messageId),
3653
+ }], version) : createCustomXcmOnDest(input, this.node, version, messageId),
3680
3654
  weight_limit: 'Unlimited'
3681
3655
  }
3682
3656
  };
@@ -3704,10 +3678,11 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3704
3678
  return _createClass(Acala, [{
3705
3679
  key: "getCurrencySelection",
3706
3680
  value: function getCurrencySelection(asset) {
3681
+ var symbol = asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol;
3707
3682
  return isForeignAsset(asset) ? {
3708
3683
  ForeignAsset: Number(asset.assetId)
3709
3684
  } : {
3710
- Token: asset.symbol
3685
+ Token: symbol
3711
3686
  };
3712
3687
  }
3713
3688
  }, {
@@ -3750,9 +3725,7 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3750
3725
  dest: {
3751
3726
  Id: address
3752
3727
  },
3753
- currency_id: this.getCurrencySelection(_objectSpread2(_objectSpread2({}, asset), {}, {
3754
- symbol: asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol
3755
- })),
3728
+ currency_id: this.getCurrencySelection(asset),
3756
3729
  amount: BigInt(asset.amount)
3757
3730
  }
3758
3731
  });
@@ -3760,35 +3733,139 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3760
3733
  }]);
3761
3734
  }(ParachainNode);
3762
3735
 
3763
- var Altair = /*#__PURE__*/function (_ParachainNode) {
3764
- function Altair() {
3765
- _classCallCheck(this, Altair);
3766
- return _callSuper(this, Altair, ['Altair', 'altair', 'kusama', Version.V3]);
3736
+ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
3737
+ function PolkadotXCMTransferImpl() {
3738
+ _classCallCheck(this, PolkadotXCMTransferImpl);
3767
3739
  }
3768
- _inherits(Altair, _ParachainNode);
3769
- return _createClass(Altair, [{
3770
- key: "getCurrencySelection",
3771
- value: function getCurrencySelection(asset) {
3772
- if (asset.symbol === this.getNativeAssetSymbol()) return 'Native';
3773
- if (!isForeignAsset(asset)) {
3774
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3775
- }
3776
- return {
3777
- ForeignAsset: Number(asset.assetId)
3740
+ return _createClass(PolkadotXCMTransferImpl, null, [{
3741
+ key: "transferPolkadotXCM",
3742
+ value: function transferPolkadotXCM(_ref, section) {
3743
+ var api = _ref.api,
3744
+ header = _ref.header,
3745
+ asset = _ref.asset,
3746
+ addressSelection = _ref.addressSelection,
3747
+ currencySelection = _ref.currencySelection,
3748
+ overriddenAsset = _ref.overriddenAsset,
3749
+ pallet = _ref.pallet,
3750
+ method = _ref.method;
3751
+ var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
3752
+ var _extractVersionFromHe = extractVersionFromHeader(currencySelection),
3753
+ _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2),
3754
+ version = _extractVersionFromHe2[0],
3755
+ multiAssets = _extractVersionFromHe2[1];
3756
+ var resolvedMultiAssets = addXcmVersionHeader(maybeOverrideMultiAssets(version, asset.amount, multiAssets, overriddenAsset), version);
3757
+ var feeAssetIndex = overriddenAsset === undefined || isTMultiLocation(overriddenAsset) ? DEFAULT_FEE_ASSET : overriddenAsset.findIndex(function (asset) {
3758
+ return asset.isFeeAsset;
3759
+ });
3760
+ var call = {
3761
+ module: pallet !== null && pallet !== void 0 ? pallet : 'PolkadotXcm',
3762
+ section: method !== null && method !== void 0 ? method : section,
3763
+ parameters: _objectSpread2({
3764
+ dest: header,
3765
+ beneficiary: addressSelection,
3766
+ assets: resolvedMultiAssets,
3767
+ fee_asset_item: feeAssetIndex
3768
+ }, fees !== undefined ? {
3769
+ weight_limit: fees
3770
+ } : {})
3778
3771
  };
3772
+ return api.callTxMethod(call);
3779
3773
  }
3780
- }, {
3774
+ }]);
3775
+ }();
3776
+
3777
+ var Ajuna = /*#__PURE__*/function (_ParachainNode) {
3778
+ function Ajuna() {
3779
+ _classCallCheck(this, Ajuna);
3780
+ return _callSuper(this, Ajuna, ['Ajuna', 'ajuna', 'polkadot', Version.V4]);
3781
+ }
3782
+ _inherits(Ajuna, _ParachainNode);
3783
+ return _createClass(Ajuna, [{
3781
3784
  key: "transferXTokens",
3782
3785
  value: function transferXTokens(input) {
3783
- var asset = input.asset;
3784
- var currencySelection = this.getCurrencySelection(asset);
3785
- return XTokensTransferImpl.transferXTokens(input, currencySelection);
3786
- }
3787
- }, {
3788
- key: "transferLocalNonNativeAsset",
3789
- value: function transferLocalNonNativeAsset(options) {
3790
- var api = options.api,
3791
- asset = options.asset,
3786
+ var scenario = input.scenario,
3787
+ asset = input.asset;
3788
+ if (scenario !== 'ParaToPara') {
3789
+ throw new ScenarioNotSupportedError(this.node, scenario);
3790
+ }
3791
+ if (asset.symbol !== this.getNativeAssetSymbol()) {
3792
+ throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by node ").concat(this.node, "."));
3793
+ }
3794
+ return XTokensTransferImpl.transferXTokens(input, this.getNativeAssetSymbol());
3795
+ }
3796
+ }, {
3797
+ key: "transferPolkadotXCM",
3798
+ value: function transferPolkadotXCM(input) {
3799
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'transfer_assets', 'Unlimited'));
3800
+ }
3801
+ }, {
3802
+ key: "canUseXTokens",
3803
+ value: function canUseXTokens(_ref) {
3804
+ var asset = _ref.asset,
3805
+ destination = _ref.to;
3806
+ return !(asset.symbol === 'DOT' && destination === 'AssetHubPolkadot');
3807
+ }
3808
+ }, {
3809
+ key: "transferRelayToPara",
3810
+ value: function transferRelayToPara() {
3811
+ throw new NodeNotSupportedError();
3812
+ }
3813
+ }, {
3814
+ key: "transferLocalNonNativeAsset",
3815
+ value: function transferLocalNonNativeAsset(options) {
3816
+ var api = options.api,
3817
+ asset = options.asset,
3818
+ address = options.address;
3819
+ if (!isForeignAsset(asset)) {
3820
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3821
+ }
3822
+ if (asset.assetId === undefined) {
3823
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3824
+ }
3825
+ return api.callTxMethod({
3826
+ module: 'Assets',
3827
+ section: 'transfer',
3828
+ parameters: {
3829
+ id: Number(asset.assetId),
3830
+ target: {
3831
+ Id: address
3832
+ },
3833
+ amount: BigInt(asset.amount)
3834
+ }
3835
+ });
3836
+ }
3837
+ }]);
3838
+ }(ParachainNode);
3839
+
3840
+ var Altair = /*#__PURE__*/function (_ParachainNode) {
3841
+ function Altair() {
3842
+ _classCallCheck(this, Altair);
3843
+ return _callSuper(this, Altair, ['Altair', 'altair', 'kusama', Version.V3]);
3844
+ }
3845
+ _inherits(Altair, _ParachainNode);
3846
+ return _createClass(Altair, [{
3847
+ key: "getCurrencySelection",
3848
+ value: function getCurrencySelection(asset) {
3849
+ if (asset.symbol === this.getNativeAssetSymbol()) return 'Native';
3850
+ if (!isForeignAsset(asset)) {
3851
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3852
+ }
3853
+ return {
3854
+ ForeignAsset: Number(asset.assetId)
3855
+ };
3856
+ }
3857
+ }, {
3858
+ key: "transferXTokens",
3859
+ value: function transferXTokens(input) {
3860
+ var asset = input.asset;
3861
+ var currencySelection = this.getCurrencySelection(asset);
3862
+ return XTokensTransferImpl.transferXTokens(input, currencySelection);
3863
+ }
3864
+ }, {
3865
+ key: "transferLocalNonNativeAsset",
3866
+ value: function transferLocalNonNativeAsset(options) {
3867
+ var api = options.api,
3868
+ asset = options.asset,
3792
3869
  address = options.address;
3793
3870
  if (!isForeignAsset(asset)) {
3794
3871
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
@@ -3832,47 +3909,6 @@ var Amplitude = /*#__PURE__*/function (_ParachainNode) {
3832
3909
  }]);
3833
3910
  }(ParachainNode);
3834
3911
 
3835
- var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
3836
- function PolkadotXCMTransferImpl() {
3837
- _classCallCheck(this, PolkadotXCMTransferImpl);
3838
- }
3839
- return _createClass(PolkadotXCMTransferImpl, null, [{
3840
- key: "transferPolkadotXCM",
3841
- value: function transferPolkadotXCM(_ref, section) {
3842
- var api = _ref.api,
3843
- header = _ref.header,
3844
- asset = _ref.asset,
3845
- addressSelection = _ref.addressSelection,
3846
- currencySelection = _ref.currencySelection,
3847
- overriddenAsset = _ref.overriddenAsset,
3848
- pallet = _ref.pallet,
3849
- method = _ref.method;
3850
- var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
3851
- var _extractVersionFromHe = extractVersionFromHeader(currencySelection),
3852
- _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2),
3853
- version = _extractVersionFromHe2[0],
3854
- multiAssets = _extractVersionFromHe2[1];
3855
- var resolvedMultiAssets = addXcmVersionHeader(maybeOverrideMultiAssets(version, asset.amount, multiAssets, overriddenAsset), version);
3856
- var feeAssetIndex = overriddenAsset === undefined || isTMultiLocation(overriddenAsset) ? DEFAULT_FEE_ASSET : overriddenAsset.findIndex(function (asset) {
3857
- return asset.isFeeAsset;
3858
- });
3859
- var call = {
3860
- module: pallet !== null && pallet !== void 0 ? pallet : 'PolkadotXcm',
3861
- section: method !== null && method !== void 0 ? method : section,
3862
- parameters: _objectSpread2({
3863
- dest: header,
3864
- beneficiary: addressSelection,
3865
- assets: resolvedMultiAssets,
3866
- fee_asset_item: feeAssetIndex
3867
- }, fees !== undefined ? {
3868
- weight_limit: fees
3869
- } : {})
3870
- };
3871
- return api.callTxMethod(call);
3872
- }
3873
- }]);
3874
- }();
3875
-
3876
3912
  var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
3877
3913
  function AssetHubKusama() {
3878
3914
  _classCallCheck(this, AssetHubKusama);
@@ -3930,7 +3966,7 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
3930
3966
  destination = input.destination,
3931
3967
  paraIdTo = input.paraIdTo,
3932
3968
  address = input.address;
3933
- var destWithHeader = createPolkadotXcmHeader(scenario, version, destination, paraIdTo);
3969
+ var destWithHeader = createVersionedDestination(scenario, version, destination, paraIdTo);
3934
3970
  var _extractVersionFromHe = extractVersionFromHeader(destWithHeader),
3935
3971
  _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2);
3936
3972
  _extractVersionFromHe2[0];
@@ -4064,7 +4100,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4064
4100
  module: 'PolkadotXcm',
4065
4101
  section: 'transfer_assets_using_type_and_then',
4066
4102
  parameters: {
4067
- dest: _this.createPolkadotXcmHeader(scenario, version, destination, paraIdTo),
4103
+ dest: _this.createVersionedDestination(scenario, version, destination, paraIdTo),
4068
4104
  assets: addXcmVersionHeader([].concat(_toConsumableArray(useDOTAsFeeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [createMultiAsset(version, asset.amount, asset.multiLocation)]), version),
4069
4105
  assets_transfer_type: 'LocalReserve',
4070
4106
  remote_fees_id: addXcmVersionHeader(useDOTAsFeeAsset ? DOT_MULTILOCATION : asset.multiLocation, version),
@@ -4160,7 +4196,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4160
4196
  module: 'PolkadotXcm',
4161
4197
  section: 'transfer_assets_using_type_and_then',
4162
4198
  parameters: {
4163
- dest: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
4199
+ dest: createVersionedDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
4164
4200
  assets: addXcmVersionHeader([createMultiAsset(version, asset.amount, multiLocation)], version),
4165
4201
  assets_transfer_type: 'LocalReserve',
4166
4202
  remote_fees_id: addXcmVersionHeader(multiLocation, version),
@@ -4242,7 +4278,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4242
4278
  return _context2.abrupt("return", this.handleEthBridgeNativeTransfer(input));
4243
4279
  case 14:
4244
4280
  modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
4245
- header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
4281
+ header: createVersionedDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
4246
4282
  addressSelection: createVersionedBeneficiary({
4247
4283
  api: api,
4248
4284
  scenario: scenario,
@@ -4285,7 +4321,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4285
4321
  }
4286
4322
  };
4287
4323
  var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
4288
- header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
4324
+ header: this.createVersionedDestination(scenario, version, destination, paraId),
4289
4325
  addressSelection: createVersionedBeneficiary({
4290
4326
  api: api,
4291
4327
  scenario: scenario,
@@ -4314,7 +4350,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4314
4350
  var _input$version4;
4315
4351
  var versionOrDefault = (_input$version4 = input.version) !== null && _input$version4 !== void 0 ? _input$version4 : Version.V2;
4316
4352
  return _objectSpread2(_objectSpread2({}, input), {}, {
4317
- header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
4353
+ header: this.createVersionedDestination(scenario, versionOrDefault, destination, paraIdTo),
4318
4354
  addressSelection: createVersionedBeneficiary({
4319
4355
  api: api,
4320
4356
  scenario: scenario,
@@ -4363,7 +4399,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4363
4399
  proofSize: maxU64
4364
4400
  }, MIN_FEE);
4365
4401
  _context3.next = 9;
4366
- return api.getDryRun({
4402
+ return api.getDryRunCall({
4367
4403
  node: this.node,
4368
4404
  tx: dummyTx,
4369
4405
  address: senderAddress
@@ -4447,7 +4483,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4447
4483
  return Promise.resolve(this.handleBifrostEthTransfer(input, true));
4448
4484
  }
4449
4485
  var isSystemNode = !isTMultiLocation(destination) && SYSTEM_NODES_POLKADOT.includes(destination);
4450
- if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && !isSystemNode) {
4486
+ if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && destination !== 'Ajuna' && !isSystemNode) {
4451
4487
  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.');
4452
4488
  }
4453
4489
  if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset)) {
@@ -4792,28 +4828,6 @@ var BridgeHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4792
4828
  }]);
4793
4829
  }(ParachainNode);
4794
4830
 
4795
- var Calamari = /*#__PURE__*/function (_ParachainNode) {
4796
- function Calamari() {
4797
- _classCallCheck(this, Calamari);
4798
- return _callSuper(this, Calamari, ['Calamari', 'calamari', 'kusama', Version.V3]);
4799
- }
4800
- _inherits(Calamari, _ParachainNode);
4801
- return _createClass(Calamari, [{
4802
- key: "transferXTokens",
4803
- value: function transferXTokens(input) {
4804
- // Currently only option for XCM transfer
4805
- var asset = input.asset;
4806
- if (!isForeignAsset(asset) || !asset.assetId) {
4807
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
4808
- }
4809
- var currencySelection = {
4810
- MantaCurrency: BigInt(asset.assetId)
4811
- };
4812
- return XTokensTransferImpl.transferXTokens(input, currencySelection);
4813
- }
4814
- }]);
4815
- }(ParachainNode);
4816
-
4817
4831
  var Centrifuge = /*#__PURE__*/function (_ParachainNode) {
4818
4832
  function Centrifuge() {
4819
4833
  _classCallCheck(this, Centrifuge);
@@ -5293,7 +5307,7 @@ var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scena
5293
5307
  AllCounted: 1
5294
5308
  }
5295
5309
  },
5296
- dest: Object.values(createPolkadotXcmHeader(scenario, version, destination, paraId, undefined, Parents.ONE))[0],
5310
+ dest: Object.values(createVersionedDestination(scenario, version, destination, paraId, undefined, Parents.ONE))[0],
5297
5311
  xcm: [{
5298
5312
  BuyExecution: {
5299
5313
  fees: {
@@ -5452,7 +5466,7 @@ var Hydration = /*#__PURE__*/function (_ParachainNode) {
5452
5466
  module: 'PolkadotXcm',
5453
5467
  section: 'transfer_assets_using_type_and_then',
5454
5468
  parameters: {
5455
- dest: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
5469
+ dest: this.createVersionedDestination(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
5456
5470
  assets: _defineProperty({}, versionOrDefault, [createMultiAsset(versionOrDefault, asset.amount, DOT_MULTILOCATION)]),
5457
5471
  assets_transfer_type: 'DestinationReserve',
5458
5472
  remote_fees_id: _defineProperty({}, versionOrDefault, {
@@ -5625,24 +5639,6 @@ var Interlay = /*#__PURE__*/function (_ParachainNode) {
5625
5639
  }]);
5626
5640
  }(ParachainNode);
5627
5641
 
5628
- var InvArchTinker = /*#__PURE__*/function (_ParachainNode) {
5629
- function InvArchTinker() {
5630
- _classCallCheck(this, InvArchTinker);
5631
- return _callSuper(this, InvArchTinker, ['InvArchTinker', 'tinker', 'kusama', Version.V3]);
5632
- }
5633
- _inherits(InvArchTinker, _ParachainNode);
5634
- return _createClass(InvArchTinker, [{
5635
- key: "transferXTokens",
5636
- value: function transferXTokens(input) {
5637
- var asset = input.asset;
5638
- if (!isForeignAsset(asset) || !asset.assetId) {
5639
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
5640
- }
5641
- return XTokensTransferImpl.transferXTokens(input, BigInt(asset.assetId));
5642
- }
5643
- }]);
5644
- }(ParachainNode);
5645
-
5646
5642
  var Karura = /*#__PURE__*/function (_ParachainNode) {
5647
5643
  function Karura() {
5648
5644
  _classCallCheck(this, Karura);
@@ -5815,10 +5811,14 @@ var Moonbeam = /*#__PURE__*/function (_ParachainNode) {
5815
5811
  }, {
5816
5812
  key: "transferPolkadotXCM",
5817
5813
  value: function transferPolkadotXCM(input) {
5818
- var asset = input.asset,
5814
+ var destination = input.destination,
5815
+ asset = input.asset,
5819
5816
  scenario = input.scenario,
5820
5817
  _input$version = input.version,
5821
5818
  version = _input$version === void 0 ? this.version : _input$version;
5819
+ if (destination === 'Ethereum') {
5820
+ return this.transferToEthereum(input);
5821
+ }
5822
5822
  var multiLocation = this.getMultiLocation(asset, scenario);
5823
5823
  return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(_objectSpread2(_objectSpread2({}, input), {}, {
5824
5824
  currencySelection: createVersionedMultiAssets(version, asset.amount, multiLocation)
@@ -6501,6 +6501,7 @@ var nodes = function nodes() {
6501
6501
  return {
6502
6502
  AssetHubPolkadot: new AssetHubPolkadot(),
6503
6503
  Acala: new Acala(),
6504
+ Ajuna: new Ajuna(),
6504
6505
  Astar: new Astar(),
6505
6506
  Unique: new Unique(),
6506
6507
  Crust: new Crust(),
@@ -6523,10 +6524,8 @@ var nodes = function nodes() {
6523
6524
  Amplitude: new Amplitude(),
6524
6525
  Basilisk: new Basilisk(),
6525
6526
  BifrostKusama: new BifrostKusama(),
6526
- Calamari: new Calamari(),
6527
6527
  CrustShadow: new CrustShadow(),
6528
6528
  Crab: new Crab(),
6529
- InvArchTinker: new InvArchTinker(),
6530
6529
  Karura: new Karura(),
6531
6530
  Kintsugi: new Kintsugi(),
6532
6531
  Moonriver: new Moonriver(),
@@ -6987,9 +6986,10 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
6987
6986
  address: address,
6988
6987
  scenario: 'ParaToPara',
6989
6988
  senderAddress: senderAddress,
6989
+ ahAddress: ahAddress,
6990
6990
  asset: _objectSpread2(_objectSpread2({}, foundAsset), {}, {
6991
6991
  amount: currency.amount
6992
- })}, Version.V4, messageId);
6992
+ })}, from, Version.V4, messageId);
6993
6993
  _context.next = 39;
6994
6994
  return api.objectToHex(customXcm, 'XcmVersionedXcm');
6995
6995
  case 39:
@@ -7044,6 +7044,182 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
7044
7044
  };
7045
7045
  }();
7046
7046
 
7047
+ /**
7048
+ * Retrieves the node name corresponding to a specified parachain ID.
7049
+ *
7050
+ * @param paraId - The parachain ID.
7051
+ * @returns The node name if found; otherwise, null.
7052
+ */
7053
+ var getTNode = function getTNode(paraId, ecosystem) {
7054
+ var _NODE_NAMES_DOT_KSM$f;
7055
+ if (paraId === 0) {
7056
+ return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
7057
+ }
7058
+ if (paraId === 1) {
7059
+ return 'Ethereum';
7060
+ }
7061
+ return (_NODE_NAMES_DOT_KSM$f = NODE_NAMES_DOT_KSM.find(function (nodeName) {
7062
+ return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
7063
+ })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
7064
+ };
7065
+
7066
+ var isAssetHub = function isAssetHub(chain) {
7067
+ return chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama';
7068
+ };
7069
+ var isBridgeHub = function isBridgeHub(chain) {
7070
+ return chain === 'BridgeHubPolkadot' || chain === 'BridgeHubKusama';
7071
+ };
7072
+ var isPeople = function isPeople(chain) {
7073
+ return chain === 'PeoplePolkadot' || chain === 'PeopleKusama';
7074
+ };
7075
+ var isSystemPara = function isSystemPara(chain) {
7076
+ return isAssetHub(chain) || isBridgeHub(chain) || isPeople(chain);
7077
+ };
7078
+ var mul = function mul(v, num) {
7079
+ var den = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1n;
7080
+ return v * num / den;
7081
+ };
7082
+ var padFee = function padFee(raw, origin, dest, side) {
7083
+ var relayOrigin = isRelayChain(origin);
7084
+ var relayDest = isRelayChain(dest);
7085
+ var sysParaOrigin = isSystemPara(origin);
7086
+ var sysParaDest = isSystemPara(dest);
7087
+ var relayToPara = relayOrigin && !relayDest;
7088
+ var sysParaToPara = sysParaOrigin && !sysParaDest;
7089
+ var paraToPara = !relayOrigin && !sysParaOrigin;
7090
+ if (sysParaToPara) return raw * 40n;
7091
+ if (relayToPara) return side === 'origin' ? mul(raw, 320n, 100n) : mul(raw, 3000n, 100n);
7092
+ if (paraToPara) return mul(raw, 130n, 100n);
7093
+ // apply default 30% padding
7094
+ return mul(raw, 130n, 100n);
7095
+ };
7096
+
7097
+ var createOriginLocation = function createOriginLocation(origin, destination) {
7098
+ if (isRelayChain(origin)) return DOT_MULTILOCATION;
7099
+ return {
7100
+ parents: isRelayChain(destination) ? Parents.ZERO : Parents.ONE,
7101
+ interior: {
7102
+ X1: [{
7103
+ Parachain: getParaId(origin)
7104
+ }]
7105
+ }
7106
+ };
7107
+ };
7108
+ var getFeeForDestNode = /*#__PURE__*/function () {
7109
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
7110
+ var api, forwardedXcms, origin, destination, address, senderAddress, currency, disableFallback, calcPaymentInfoFee, dryRunResult, fee, newForwardedXcms, destParaId;
7111
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7112
+ while (1) switch (_context2.prev = _context2.next) {
7113
+ case 0:
7114
+ api = _ref.api, forwardedXcms = _ref.forwardedXcms, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, currency = _ref.currency, disableFallback = _ref.disableFallback;
7115
+ calcPaymentInfoFee = /*#__PURE__*/function () {
7116
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7117
+ var originAsset, currencyInput, tx, rawFee;
7118
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7119
+ while (1) switch (_context.prev = _context.next) {
7120
+ case 0:
7121
+ if (!('multiasset' in currency)) {
7122
+ _context.next = 2;
7123
+ break;
7124
+ }
7125
+ throw new InvalidCurrencyError('Multi-assets are not yet supported for XCM fee calculation.');
7126
+ case 2:
7127
+ originAsset = findAsset(origin, currency, destination);
7128
+ if (originAsset) {
7129
+ _context.next = 5;
7130
+ break;
7131
+ }
7132
+ throw new InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " not found in ").concat(origin));
7133
+ case 5:
7134
+ currencyInput = originAsset.multiLocation ? {
7135
+ multilocation: originAsset.multiLocation
7136
+ } : {
7137
+ symbol: originAsset.symbol
7138
+ };
7139
+ _context.next = 8;
7140
+ return Builder(api).from(destination).to(origin).address(senderAddress, address).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
7141
+ amount: currency.amount
7142
+ })).build();
7143
+ case 8:
7144
+ tx = _context.sent;
7145
+ _context.next = 11;
7146
+ return api.calculateTransactionFee(tx, address);
7147
+ case 11:
7148
+ rawFee = _context.sent;
7149
+ return _context.abrupt("return", padFee(rawFee, origin, destination, 'destination'));
7150
+ case 13:
7151
+ case "end":
7152
+ return _context.stop();
7153
+ }
7154
+ }, _callee);
7155
+ }));
7156
+ return function calcPaymentInfoFee() {
7157
+ return _ref3.apply(this, arguments);
7158
+ };
7159
+ }();
7160
+ if (!(!hasDryRunSupport(destination) || !forwardedXcms)) {
7161
+ _context2.next = 7;
7162
+ break;
7163
+ }
7164
+ _context2.next = 5;
7165
+ return calcPaymentInfoFee();
7166
+ case 5:
7167
+ _context2.t0 = _context2.sent;
7168
+ return _context2.abrupt("return", {
7169
+ fee: _context2.t0,
7170
+ feeType: 'paymentInfo'
7171
+ });
7172
+ case 7:
7173
+ _context2.next = 9;
7174
+ return api.getDryRunXcm({
7175
+ originLocation: addXcmVersionHeader(createOriginLocation(origin, destination), Version.V4),
7176
+ xcm: forwardedXcms[1][0],
7177
+ node: destination,
7178
+ origin: origin
7179
+ });
7180
+ case 9:
7181
+ dryRunResult = _context2.sent;
7182
+ if (dryRunResult.success) {
7183
+ _context2.next = 18;
7184
+ break;
7185
+ }
7186
+ if (!disableFallback) {
7187
+ _context2.next = 13;
7188
+ break;
7189
+ }
7190
+ return _context2.abrupt("return", {
7191
+ dryRunError: dryRunResult.failureReason
7192
+ });
7193
+ case 13:
7194
+ _context2.next = 15;
7195
+ return calcPaymentInfoFee();
7196
+ case 15:
7197
+ _context2.t1 = _context2.sent;
7198
+ _context2.t2 = dryRunResult.failureReason;
7199
+ return _context2.abrupt("return", {
7200
+ fee: _context2.t1,
7201
+ feeType: 'paymentInfo',
7202
+ dryRunError: _context2.t2
7203
+ });
7204
+ case 18:
7205
+ fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
7206
+ return _context2.abrupt("return", {
7207
+ fee: fee,
7208
+ feeType: 'dryRun',
7209
+ forwardedXcms: newForwardedXcms,
7210
+ destParaId: destParaId
7211
+ });
7212
+ case 20:
7213
+ case "end":
7214
+ return _context2.stop();
7215
+ }
7216
+ }, _callee2);
7217
+ }));
7218
+ return function getFeeForDestNode(_x) {
7219
+ return _ref2.apply(this, arguments);
7220
+ };
7221
+ }();
7222
+
7047
7223
  var getDryRun = /*#__PURE__*/function () {
7048
7224
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7049
7225
  var api, node, address;
@@ -7057,7 +7233,7 @@ var getDryRun = /*#__PURE__*/function () {
7057
7233
  case 4:
7058
7234
  _context.prev = 4;
7059
7235
  _context.next = 7;
7060
- return api.getDryRun(options);
7236
+ return api.getDryRunCall(options);
7061
7237
  case 7:
7062
7238
  return _context.abrupt("return", _context.sent);
7063
7239
  case 8:
@@ -7077,6 +7253,400 @@ var getDryRun = /*#__PURE__*/function () {
7077
7253
  };
7078
7254
  }();
7079
7255
 
7256
+ var getFeeForOriginNode = /*#__PURE__*/function () {
7257
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7258
+ var api, tx, origin, destination, senderAddress, disableFallback, rawFee, dryRunResult, _rawFee, fee, forwardedXcms, destParaId;
7259
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7260
+ while (1) switch (_context.prev = _context.next) {
7261
+ case 0:
7262
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, disableFallback = _ref.disableFallback;
7263
+ if (hasDryRunSupport(origin)) {
7264
+ _context.next = 6;
7265
+ break;
7266
+ }
7267
+ _context.next = 4;
7268
+ return api.calculateTransactionFee(tx, senderAddress);
7269
+ case 4:
7270
+ rawFee = _context.sent;
7271
+ return _context.abrupt("return", {
7272
+ fee: padFee(rawFee, origin, destination, 'origin'),
7273
+ feeType: 'paymentInfo'
7274
+ });
7275
+ case 6:
7276
+ _context.next = 8;
7277
+ return getDryRun({
7278
+ api: api,
7279
+ tx: tx,
7280
+ node: origin,
7281
+ address: senderAddress
7282
+ });
7283
+ case 8:
7284
+ dryRunResult = _context.sent;
7285
+ if (dryRunResult.success) {
7286
+ _context.next = 16;
7287
+ break;
7288
+ }
7289
+ if (!disableFallback) {
7290
+ _context.next = 12;
7291
+ break;
7292
+ }
7293
+ return _context.abrupt("return", {
7294
+ dryRunError: dryRunResult.failureReason
7295
+ });
7296
+ case 12:
7297
+ _context.next = 14;
7298
+ return api.calculateTransactionFee(tx, senderAddress);
7299
+ case 14:
7300
+ _rawFee = _context.sent;
7301
+ return _context.abrupt("return", {
7302
+ fee: padFee(_rawFee, origin, destination, 'origin'),
7303
+ feeType: 'paymentInfo',
7304
+ dryRunError: dryRunResult.failureReason
7305
+ });
7306
+ case 16:
7307
+ fee = dryRunResult.fee, forwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
7308
+ return _context.abrupt("return", {
7309
+ fee: fee,
7310
+ feeType: 'dryRun',
7311
+ forwardedXcms: forwardedXcms,
7312
+ destParaId: destParaId
7313
+ });
7314
+ case 18:
7315
+ case "end":
7316
+ return _context.stop();
7317
+ }
7318
+ }, _callee);
7319
+ }));
7320
+ return function getFeeForOriginNode(_x) {
7321
+ return _ref2.apply(this, arguments);
7322
+ };
7323
+ }();
7324
+
7325
+ var getXcmFee = /*#__PURE__*/function () {
7326
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7327
+ var _findAsset;
7328
+ 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;
7329
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7330
+ while (1) switch (_context.prev = _context.next) {
7331
+ case 0:
7332
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, disableFallback = _ref.disableFallback;
7333
+ asset = (_findAsset = findAsset(origin, currency, destination)) !== null && _findAsset !== void 0 ? _findAsset : origin === 'AssetHubPolkadot' ? findAsset('Ethereum', currency, null) : null;
7334
+ if (asset) {
7335
+ _context.next = 4;
7336
+ break;
7337
+ }
7338
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(origin));
7339
+ case 4:
7340
+ _context.next = 6;
7341
+ return getFeeForOriginNode({
7342
+ api: api,
7343
+ tx: tx,
7344
+ origin: origin,
7345
+ destination: destination,
7346
+ senderAddress: senderAddress,
7347
+ disableFallback: disableFallback
7348
+ });
7349
+ case 6:
7350
+ _yield$getFeeForOrigi = _context.sent;
7351
+ originFee = _yield$getFeeForOrigi.fee;
7352
+ originFeeType = _yield$getFeeForOrigi.feeType;
7353
+ originDryRunError = _yield$getFeeForOrigi.dryRunError;
7354
+ initialForwardedXcm = _yield$getFeeForOrigi.forwardedXcms;
7355
+ initialDestParaId = _yield$getFeeForOrigi.destParaId;
7356
+ api.setDisconnectAllowed(true);
7357
+ _context.next = 15;
7358
+ return api.disconnect();
7359
+ case 15:
7360
+ if (!originDryRunError) {
7361
+ _context.next = 30;
7362
+ break;
7363
+ }
7364
+ destApi = api.clone();
7365
+ _context.prev = 17;
7366
+ _context.next = 20;
7367
+ return destApi.init(destination);
7368
+ case 20:
7369
+ destApi.setDisconnectAllowed(false);
7370
+ _context.next = 23;
7371
+ return getFeeForDestNode({
7372
+ api: destApi,
7373
+ forwardedXcms: undefined,
7374
+ // force paymentInfo
7375
+ origin: origin,
7376
+ destination: destination,
7377
+ currency: currency,
7378
+ address: address,
7379
+ senderAddress: senderAddress,
7380
+ disableFallback: disableFallback
7381
+ });
7382
+ case 23:
7383
+ destFeeRes = _context.sent;
7384
+ return _context.abrupt("return", {
7385
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7386
+ fee: originFee
7387
+ }), originFeeType && {
7388
+ feeType: originFeeType
7389
+ }), {}, {
7390
+ currency: getNativeAssetSymbol(origin),
7391
+ dryRunError: originDryRunError
7392
+ }),
7393
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFeeRes.fee && {
7394
+ fee: destFeeRes.fee
7395
+ }), destFeeRes.feeType && {
7396
+ feeType: destFeeRes.feeType
7397
+ }), {}, {
7398
+ currency: getNativeAssetSymbol(destination)
7399
+ })
7400
+ });
7401
+ case 25:
7402
+ _context.prev = 25;
7403
+ destApi.setDisconnectAllowed(true);
7404
+ _context.next = 29;
7405
+ return destApi.disconnect();
7406
+ case 29:
7407
+ return _context.finish(25);
7408
+ case 30:
7409
+ currentOrigin = origin;
7410
+ forwardedXcms = initialForwardedXcm;
7411
+ nextParaId = initialDestParaId;
7412
+ intermediateFees = {};
7413
+ destinationFee = 0n;
7414
+ destinationFeeType = 'paymentInfo';
7415
+ case 36:
7416
+ 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)) {
7417
+ _context.next = 69;
7418
+ break;
7419
+ }
7420
+ nextChain = getTNode(nextParaId, determineRelayChain(origin) === 'Polkadot' ? 'polkadot' : 'kusama');
7421
+ if (!(nextChain === null)) {
7422
+ _context.next = 40;
7423
+ break;
7424
+ }
7425
+ throw new Error("Unable to find TNode for paraId ".concat(nextParaId));
7426
+ case 40:
7427
+ hopApi = api.clone();
7428
+ _context.prev = 41;
7429
+ _context.next = 44;
7430
+ return hopApi.init(nextChain);
7431
+ case 44:
7432
+ _context.next = 46;
7433
+ return getFeeForDestNode({
7434
+ api: hopApi,
7435
+ forwardedXcms: forwardedXcms,
7436
+ origin: currentOrigin,
7437
+ destination: nextChain,
7438
+ currency: currency,
7439
+ address: address,
7440
+ senderAddress: senderAddress,
7441
+ disableFallback: disableFallback
7442
+ });
7443
+ case 46:
7444
+ hopResult = _context.sent;
7445
+ if (!hopResult.dryRunError) {
7446
+ _context.next = 58;
7447
+ break;
7448
+ }
7449
+ failingRecord = {
7450
+ fee: hopResult.fee,
7451
+ feeType: hopResult.feeType,
7452
+ currency: getNativeAssetSymbol(nextChain),
7453
+ dryRunError: hopResult.dryRunError
7454
+ };
7455
+ hopIsDestination = nextChain === destination || isRelayChain(nextChain) && !isRelayChain(destination);
7456
+ if (hopIsDestination) {
7457
+ destinationFee = hopResult.fee;
7458
+ destinationFeeType = hopResult.feeType; // paymentInfo
7459
+ destinationDryRunError = hopResult.dryRunError;
7460
+ } else if (nextChain === 'AssetHubPolkadot') {
7461
+ intermediateFees.assetHub = failingRecord;
7462
+ } else if (nextChain === 'BridgeHubPolkadot') {
7463
+ intermediateFees.bridgeHub = failingRecord;
7464
+ }
7465
+ // We failed *before* the true destination → fallback via paymentInfo.
7466
+ if (hopIsDestination) {
7467
+ _context.next = 57;
7468
+ break;
7469
+ }
7470
+ _context.next = 54;
7471
+ return getFeeForDestNode({
7472
+ api: hopApi,
7473
+ // already at failing hop
7474
+ forwardedXcms: undefined,
7475
+ // forces paymentInfo path
7476
+ origin: nextChain,
7477
+ destination: destination,
7478
+ currency: currency,
7479
+ address: address,
7480
+ senderAddress: senderAddress,
7481
+ disableFallback: disableFallback
7482
+ });
7483
+ case 54:
7484
+ destFallback = _context.sent;
7485
+ destinationFee = destFallback.fee;
7486
+ destinationFeeType = destFallback.feeType; // paymentInfo
7487
+ case 57:
7488
+ return _context.abrupt("break", 69);
7489
+ case 58:
7490
+ if (nextChain === destination || isRelayChain(nextChain) && !isRelayChain(destination)) {
7491
+ destinationFee = hopResult.fee;
7492
+ destinationFeeType = hopResult.feeType;
7493
+ } else if (nextChain === 'AssetHubPolkadot') {
7494
+ intermediateFees.assetHub = {
7495
+ fee: hopResult.fee,
7496
+ feeType: hopResult.feeType,
7497
+ currency: getNativeAssetSymbol(nextChain)
7498
+ };
7499
+ } else if (nextChain === 'BridgeHubPolkadot') {
7500
+ intermediateFees.bridgeHub = {
7501
+ fee: hopResult.fee,
7502
+ feeType: hopResult.feeType,
7503
+ currency: getNativeAssetSymbol(nextChain)
7504
+ };
7505
+ } else ;
7506
+ forwardedXcms = hopResult.forwardedXcms;
7507
+ nextParaId = hopResult.destParaId;
7508
+ currentOrigin = nextChain;
7509
+ case 62:
7510
+ _context.prev = 62;
7511
+ hopApi.setDisconnectAllowed(true);
7512
+ _context.next = 66;
7513
+ return hopApi.disconnect();
7514
+ case 66:
7515
+ return _context.finish(62);
7516
+ case 67:
7517
+ _context.next = 36;
7518
+ break;
7519
+ case 69:
7520
+ return _context.abrupt("return", _objectSpread2(_objectSpread2({
7521
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7522
+ fee: originFee
7523
+ }), originFeeType && {
7524
+ feeType: originFeeType
7525
+ }), {}, {
7526
+ currency: getNativeAssetSymbol(origin)
7527
+ }, originDryRunError && {
7528
+ dryRunError: originDryRunError
7529
+ })
7530
+ }, intermediateFees), {}, {
7531
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destinationFee && {
7532
+ fee: destinationFee
7533
+ }), destinationFeeType && {
7534
+ feeType: destinationFeeType
7535
+ }), {}, {
7536
+ currency: destinationFeeType === 'dryRun' ? asset.symbol : getNativeAssetSymbol(destination)
7537
+ }, destinationDryRunError && {
7538
+ dryRunError: destinationDryRunError
7539
+ })
7540
+ }));
7541
+ case 70:
7542
+ case "end":
7543
+ return _context.stop();
7544
+ }
7545
+ }, _callee, null, [[17,, 25, 30], [41,, 62, 67]]);
7546
+ }));
7547
+ return function getXcmFee(_x) {
7548
+ return _ref2.apply(this, arguments);
7549
+ };
7550
+ }();
7551
+
7552
+ var BRIDGE_FEE_DOT = 682395810n; // 0.068239581 DOT
7553
+ var BRIDGE_FEE_KSM = 12016807000n; // 0.012016807 KSM
7554
+ var getXcmFeeEstimate = /*#__PURE__*/function () {
7555
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7556
+ var api, tx, origin, destination, address, senderAddress, currency, rawOriginFee, originFee, destApi, originAsset, currencyInput, flippedTx, rawDestFee, destinationFee;
7557
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7558
+ while (1) switch (_context.prev = _context.next) {
7559
+ case 0:
7560
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, currency = _ref.currency;
7561
+ if (!(origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama')) {
7562
+ _context.next = 3;
7563
+ break;
7564
+ }
7565
+ return _context.abrupt("return", {
7566
+ origin: {
7567
+ fee: BRIDGE_FEE_DOT,
7568
+ currency: getNativeAssetSymbol(origin)
7569
+ },
7570
+ destination: {
7571
+ fee: BRIDGE_FEE_KSM,
7572
+ currency: getNativeAssetSymbol(destination)
7573
+ }
7574
+ });
7575
+ case 3:
7576
+ if (!(origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot')) {
7577
+ _context.next = 5;
7578
+ break;
7579
+ }
7580
+ return _context.abrupt("return", {
7581
+ origin: {
7582
+ fee: BRIDGE_FEE_KSM,
7583
+ currency: getNativeAssetSymbol(origin)
7584
+ },
7585
+ destination: {
7586
+ fee: BRIDGE_FEE_DOT,
7587
+ currency: getNativeAssetSymbol(destination)
7588
+ }
7589
+ });
7590
+ case 5:
7591
+ _context.next = 7;
7592
+ return api.calculateTransactionFee(tx, senderAddress);
7593
+ case 7:
7594
+ rawOriginFee = _context.sent;
7595
+ originFee = padFee(rawOriginFee, origin, destination, 'origin');
7596
+ destApi = api.clone();
7597
+ _context.next = 12;
7598
+ return destApi.init(destination);
7599
+ case 12:
7600
+ if (!('multiasset' in currency)) {
7601
+ _context.next = 14;
7602
+ break;
7603
+ }
7604
+ throw new InvalidCurrencyError('Multi-assets are not yet supported for simple XCM fee estimation.');
7605
+ case 14:
7606
+ originAsset = findAsset(origin, currency, destination);
7607
+ if (originAsset) {
7608
+ _context.next = 17;
7609
+ break;
7610
+ }
7611
+ throw new InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " not found in ").concat(origin));
7612
+ case 17:
7613
+ currencyInput = originAsset.multiLocation ? {
7614
+ multilocation: originAsset.multiLocation
7615
+ } : {
7616
+ symbol: originAsset.symbol
7617
+ };
7618
+ _context.next = 20;
7619
+ return Builder(destApi).from(destination).to(origin).address(senderAddress, address).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
7620
+ amount: currency.amount
7621
+ })).build();
7622
+ case 20:
7623
+ flippedTx = _context.sent;
7624
+ _context.next = 23;
7625
+ return destApi.calculateTransactionFee(flippedTx, address);
7626
+ case 23:
7627
+ rawDestFee = _context.sent;
7628
+ destinationFee = padFee(rawDestFee, origin, destination, 'destination');
7629
+ return _context.abrupt("return", {
7630
+ origin: {
7631
+ fee: originFee,
7632
+ currency: getNativeAssetSymbol(origin)
7633
+ },
7634
+ destination: {
7635
+ fee: destinationFee,
7636
+ currency: getNativeAssetSymbol(destination)
7637
+ }
7638
+ });
7639
+ case 26:
7640
+ case "end":
7641
+ return _context.stop();
7642
+ }
7643
+ }, _callee);
7644
+ }));
7645
+ return function getXcmFeeEstimate(_x) {
7646
+ return _ref2.apply(this, arguments);
7647
+ };
7648
+ }();
7649
+
7080
7650
  var transferRelayToPara = /*#__PURE__*/function () {
7081
7651
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7082
7652
  var api, origin, destination, asset, address, paraIdTo, version, pallet, method, isMultiLocationDestination, serializedApiCall;
@@ -7159,7 +7729,7 @@ var validateDestination = function validateDestination(origin, destination) {
7159
7729
  if (isRelayChain(origin) && !isTMultiLocation(destination) && isRelayChain(destination) && origin !== destination) {
7160
7730
  throw new IncompatibleNodesError('Direct relay chain to relay chain transfers are not supported. Please use Polkadot <-> Kusama bridge through AssetHub.');
7161
7731
  }
7162
- if (destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration' && origin !== 'BifrostPolkadot') {
7732
+ if (destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration' && origin !== 'BifrostPolkadot' && origin !== 'Moonbeam') {
7163
7733
  throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot and Hydration.');
7164
7734
  }
7165
7735
  var isMultiLocationDestination = _typeof(destination) === 'object';
@@ -7285,11 +7855,11 @@ var validateDestinationAddress = function validateDestinationAddress(address, de
7285
7855
 
7286
7856
  var send = /*#__PURE__*/function () {
7287
7857
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7288
- var api, origin, currency, feeAsset, address, destination, paraIdTo, version, senderAddress, pallet, method, isBridge, assetCheckEnabled, asset, resolvedFeeAsset, isLocalTransfer, overriddenAsset, resolvedAsset, originNode;
7858
+ var api, origin, currency, feeAsset, address, destination, paraIdTo, version, senderAddress, ahAddress, pallet, method, isBridge, assetCheckEnabled, asset, resolvedFeeAsset, isLocalTransfer, overriddenAsset, resolvedAsset, originNode;
7289
7859
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7290
7860
  while (1) switch (_context.prev = _context.next) {
7291
7861
  case 0:
7292
- api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, version = options.version, senderAddress = options.senderAddress, pallet = options.pallet, method = options.method;
7862
+ api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
7293
7863
  validateCurrency(currency, feeAsset);
7294
7864
  validateDestination(origin, destination);
7295
7865
  validateDestinationAddress(address, destination);
@@ -7376,6 +7946,7 @@ var send = /*#__PURE__*/function () {
7376
7946
  overriddenAsset: overriddenAsset,
7377
7947
  version: version,
7378
7948
  senderAddress: senderAddress,
7949
+ ahAddress: ahAddress,
7379
7950
  pallet: pallet,
7380
7951
  method: method
7381
7952
  }));
@@ -7529,18 +8100,26 @@ var GeneralBuilder = /*#__PURE__*/function () {
7529
8100
  currency: _currency
7530
8101
  }));
7531
8102
  }
8103
+ }, {
8104
+ key: "address",
8105
+ value: function address(_address, senderAddress) {
8106
+ return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
8107
+ address: _address
8108
+ }, senderAddress ? {
8109
+ senderAddress: senderAddress
8110
+ } : {}));
8111
+ }
7532
8112
  /**
7533
- * Sets the recipient address.
8113
+ * Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
7534
8114
  *
7535
- * @param address - The destination address.
8115
+ * @param address - The address to be used.
7536
8116
  * @returns An instance of Builder
7537
8117
  */
7538
8118
  }, {
7539
- key: "address",
7540
- value: function address(_address, senderAddress) {
8119
+ key: "ahAddress",
8120
+ value: function ahAddress(address) {
7541
8121
  return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
7542
- address: _address,
7543
- senderAddress: senderAddress
8122
+ ahAddress: address
7544
8123
  }));
7545
8124
  }
7546
8125
  /**
@@ -7695,11 +8274,140 @@ var GeneralBuilder = /*#__PURE__*/function () {
7695
8274
  }
7696
8275
  return dryRun;
7697
8276
  }()
8277
+ /**
8278
+ * Estimates the XCM fee for the transfer using paymentInfo function.
8279
+ *
8280
+ * @returns An origin and destination fee estimate.
8281
+ */
8282
+ }, {
8283
+ key: "getXcmFeeEstimate",
8284
+ value: (function () {
8285
+ var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
8286
+ var _this$_options2, from, to, address, senderAddress, tx;
8287
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
8288
+ while (1) switch (_context4.prev = _context4.next) {
8289
+ case 0:
8290
+ _this$_options2 = this._options, from = _this$_options2.from, to = _this$_options2.to, address = _this$_options2.address, senderAddress = _this$_options2.senderAddress;
8291
+ if (!isTMultiLocation(to)) {
8292
+ _context4.next = 3;
8293
+ break;
8294
+ }
8295
+ throw new InvalidParameterError('Multi-Location destination is not supported for XCM fee calculation.');
8296
+ case 3:
8297
+ if (!isTMultiLocation(address)) {
8298
+ _context4.next = 5;
8299
+ break;
8300
+ }
8301
+ throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
8302
+ case 5:
8303
+ if (!(to === 'Ethereum')) {
8304
+ _context4.next = 7;
8305
+ break;
8306
+ }
8307
+ throw new InvalidParameterError('Ethereum destination is not yet supported for XCM fee calculation.');
8308
+ case 7:
8309
+ this.api.setDisconnectAllowed(false);
8310
+ _context4.next = 10;
8311
+ return this.build();
8312
+ case 10:
8313
+ tx = _context4.sent;
8314
+ this.api.setDisconnectAllowed(true);
8315
+ return _context4.abrupt("return", getXcmFeeEstimate({
8316
+ api: this.api,
8317
+ tx: tx,
8318
+ origin: from,
8319
+ destination: to,
8320
+ address: address,
8321
+ senderAddress: senderAddress,
8322
+ currency: this._options.currency
8323
+ }));
8324
+ case 13:
8325
+ case "end":
8326
+ return _context4.stop();
8327
+ }
8328
+ }, _callee4, this);
8329
+ }));
8330
+ function getXcmFeeEstimate$1() {
8331
+ return _getXcmFeeEstimate2.apply(this, arguments);
8332
+ }
8333
+ return getXcmFeeEstimate$1;
8334
+ }()
8335
+ /**
8336
+ * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
8337
+ *
8338
+ * @returns An origin and destination fee.
8339
+ */
8340
+ )
8341
+ }, {
8342
+ key: "getXcmFee",
8343
+ value: (function () {
8344
+ var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
8345
+ var _ref,
8346
+ disableFallback,
8347
+ _this$_options3,
8348
+ from,
8349
+ to,
8350
+ address,
8351
+ senderAddress,
8352
+ tx,
8353
+ _args5 = arguments;
8354
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
8355
+ while (1) switch (_context5.prev = _context5.next) {
8356
+ case 0:
8357
+ _ref = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {
8358
+ disableFallback: false
8359
+ }, disableFallback = _ref.disableFallback;
8360
+ _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, address = _this$_options3.address, senderAddress = _this$_options3.senderAddress;
8361
+ if (!isTMultiLocation(to)) {
8362
+ _context5.next = 4;
8363
+ break;
8364
+ }
8365
+ throw new InvalidParameterError('Multi-Location destination is not supported for XCM fee calculation.');
8366
+ case 4:
8367
+ if (!isTMultiLocation(address)) {
8368
+ _context5.next = 6;
8369
+ break;
8370
+ }
8371
+ throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
8372
+ case 6:
8373
+ if (!(to === 'Ethereum')) {
8374
+ _context5.next = 8;
8375
+ break;
8376
+ }
8377
+ throw new InvalidParameterError('Ethereum destination is not yet supported for XCM fee calculation.');
8378
+ case 8:
8379
+ _context5.next = 10;
8380
+ return this.build();
8381
+ case 10:
8382
+ tx = _context5.sent;
8383
+ this.api.setDisconnectAllowed(false);
8384
+ return _context5.abrupt("return", getXcmFee({
8385
+ api: this.api,
8386
+ tx: tx,
8387
+ origin: from,
8388
+ destination: to,
8389
+ senderAddress: senderAddress,
8390
+ address: address,
8391
+ currency: this._options.currency,
8392
+ disableFallback: disableFallback
8393
+ }));
8394
+ case 13:
8395
+ case "end":
8396
+ return _context5.stop();
8397
+ }
8398
+ }, _callee5, this);
8399
+ }));
8400
+ function getXcmFee$1() {
8401
+ return _getXcmFee2.apply(this, arguments);
8402
+ }
8403
+ return getXcmFee$1;
8404
+ }()
7698
8405
  /**
7699
8406
  * Returns the API instance used by the builder.
7700
8407
  *
7701
8408
  * @returns The API instance.
7702
8409
  */
8410
+ )
7703
8411
  }, {
7704
8412
  key: "getApi",
7705
8413
  value: function getApi() {
@@ -7727,25 +8435,6 @@ var Builder = function Builder(api) {
7727
8435
  return new GeneralBuilder(api, new BatchTransactionManager());
7728
8436
  };
7729
8437
 
7730
- /**
7731
- * Retrieves the node name corresponding to a specified parachain ID.
7732
- *
7733
- * @param paraId - The parachain ID.
7734
- * @returns The node name if found; otherwise, null.
7735
- */
7736
- var getTNode = function getTNode(paraId, ecosystem) {
7737
- var _NODE_NAMES_DOT_KSM$f;
7738
- if (paraId === 0) {
7739
- return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
7740
- }
7741
- if (paraId === 1) {
7742
- return 'Ethereum';
7743
- }
7744
- return (_NODE_NAMES_DOT_KSM$f = NODE_NAMES_DOT_KSM.find(function (nodeName) {
7745
- return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
7746
- })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
7747
- };
7748
-
7749
8438
  var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
7750
8439
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node, address, asset) {
7751
8440
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -8502,4 +9191,4 @@ var verifyEdOnDestination = /*#__PURE__*/function () {
8502
9191
  };
8503
9192
  }();
8504
9193
 
8505
- export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, determineRelayChain, generateAddressMultiLocationV4, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getDryRun, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, isEthersContract, isEthersSigner, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };
9194
+ export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, determineRelayChain, generateAddressMultiLocationV4, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getDryRun, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, getXcmFee, getXcmFeeEstimate, isEthersContract, isEthersSigner, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };