@paraspell/sdk-core 8.11.0 → 8.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/dist/index.cjs +1359 -662
  2. package/dist/index.d.ts +168 -21
  3. package/dist/index.mjs +1358 -664
  4. package/package.json +14 -14
package/dist/index.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"
@@ -1275,7 +1413,7 @@ var CoretimeKusama$1 = {
1275
1413
  providers: [
1276
1414
  {
1277
1415
  name: "Dwellir",
1278
- endpoint: "wss://coretime-kusama-rpc.dwellir.com"
1416
+ endpoint: "wss://coretime-kusama-rpc.n.dwellir.com"
1279
1417
  },
1280
1418
  {
1281
1419
  name: "IBP1",
@@ -1289,6 +1427,10 @@ var CoretimeKusama$1 = {
1289
1427
  name: "LuckyFriday",
1290
1428
  endpoint: "wss://rpc-coretime-kusama.luckyfriday.io"
1291
1429
  },
1430
+ {
1431
+ name: "OnFinality",
1432
+ endpoint: "wss://coretime-kusama.api.onfinality.io/public-ws"
1433
+ },
1292
1434
  {
1293
1435
  name: "Parity",
1294
1436
  endpoint: "wss://kusama-coretime-rpc.polkadot.io"
@@ -1304,6 +1446,10 @@ var CoretimePolkadot$1 = {
1304
1446
  info: "polkadotCoretime",
1305
1447
  paraId: 1005,
1306
1448
  providers: [
1449
+ {
1450
+ name: "Dwellir",
1451
+ endpoint: "wss://coretime-polkadot-rpc.n.dwellir.com"
1452
+ },
1307
1453
  {
1308
1454
  name: "IBP1",
1309
1455
  endpoint: "wss://sys.ibp.network/coretime-polkadot"
@@ -1316,9 +1462,17 @@ var CoretimePolkadot$1 = {
1316
1462
  name: "LuckyFriday",
1317
1463
  endpoint: "wss://rpc-coretime-polkadot.luckyfriday.io"
1318
1464
  },
1465
+ {
1466
+ name: "OnFinality",
1467
+ endpoint: "wss://coretime-polkadot.api.onfinality.io/public-ws"
1468
+ },
1319
1469
  {
1320
1470
  name: "Parity",
1321
1471
  endpoint: "wss://polkadot-coretime-rpc.polkadot.io"
1472
+ },
1473
+ {
1474
+ name: "Stakeworld",
1475
+ endpoint: "wss://dot-rpc.stakeworld.io/coretime"
1322
1476
  }
1323
1477
  ]
1324
1478
  };
@@ -1369,10 +1523,6 @@ var Amplitude$1 = {
1369
1523
  info: "amplitude",
1370
1524
  paraId: 2124,
1371
1525
  providers: [
1372
- {
1373
- name: "Dwellir",
1374
- endpoint: "wss://amplitude-rpc.dwellir.com"
1375
- },
1376
1526
  {
1377
1527
  name: "PendulumChain",
1378
1528
  endpoint: "wss://rpc-amplitude.pendulumchain.tech"
@@ -1413,17 +1563,6 @@ var BifrostKusama$1 = {
1413
1563
  }
1414
1564
  ]
1415
1565
  };
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
1566
  var CrustShadow$1 = {
1428
1567
  name: "Crust Shadow",
1429
1568
  info: "shadow",
@@ -1462,17 +1601,6 @@ var Crab$1 = {
1462
1601
  }
1463
1602
  ]
1464
1603
  };
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
1604
  var Karura$1 = {
1477
1605
  name: "Karura",
1478
1606
  info: "karura",
@@ -1509,10 +1637,6 @@ var Kintsugi$1 = {
1509
1637
  info: "kintsugi",
1510
1638
  paraId: 2092,
1511
1639
  providers: [
1512
- {
1513
- name: "Dwellir",
1514
- endpoint: "wss://kintsugi-rpc.dwellir.com"
1515
- },
1516
1640
  {
1517
1641
  name: "Kintsugi Labs",
1518
1642
  endpoint: "wss://api-kusama.interlay.io/parachain"
@@ -1563,18 +1687,10 @@ var Quartz$1 = {
1563
1687
  info: "quartz",
1564
1688
  paraId: 2095,
1565
1689
  providers: [
1566
- {
1567
- name: "Dwellir",
1568
- endpoint: "wss://quartz-rpc.n.dwellir.com"
1569
- },
1570
1690
  {
1571
1691
  name: "Geo Load Balancer",
1572
1692
  endpoint: "wss://ws-quartz.unique.network"
1573
1693
  },
1574
- {
1575
- name: "Unique America",
1576
- endpoint: "wss://us-ws-quartz.unique.network"
1577
- },
1578
1694
  {
1579
1695
  name: "Unique Asia",
1580
1696
  endpoint: "wss://asia-ws-quartz.unique.network"
@@ -1612,6 +1728,10 @@ var PeoplePolkadot$1 = {
1612
1728
  info: "polkadotPeople",
1613
1729
  paraId: 1004,
1614
1730
  providers: [
1731
+ {
1732
+ name: "Dwellir",
1733
+ endpoint: "wss://people-polkadot-rpc.n.dwellir.com"
1734
+ },
1615
1735
  {
1616
1736
  name: "IBP1",
1617
1737
  endpoint: "wss://sys.ibp.network/people-polkadot"
@@ -1624,6 +1744,10 @@ var PeoplePolkadot$1 = {
1624
1744
  name: "LuckyFriday",
1625
1745
  endpoint: "wss://rpc-people-polkadot.luckyfriday.io"
1626
1746
  },
1747
+ {
1748
+ name: "OnFinality",
1749
+ endpoint: "wss://people-polkadot.api.onfinality.io/public-ws"
1750
+ },
1627
1751
  {
1628
1752
  name: "Parity",
1629
1753
  endpoint: "wss://polkadot-people-rpc.polkadot.io"
@@ -1631,8 +1755,12 @@ var PeoplePolkadot$1 = {
1631
1755
  {
1632
1756
  name: "RadiumBlock",
1633
1757
  endpoint: "wss://people-polkadot.public.curie.radiumblock.co/ws"
1634
- }
1635
- ]
1758
+ },
1759
+ {
1760
+ name: "Stakeworld",
1761
+ endpoint: "wss://dot-rpc.stakeworld.io/people"
1762
+ }
1763
+ ]
1636
1764
  };
1637
1765
  var PeopleKusama$1 = {
1638
1766
  name: "People",
@@ -1643,6 +1771,10 @@ var PeopleKusama$1 = {
1643
1771
  name: "Dwellir",
1644
1772
  endpoint: "wss://people-kusama-rpc.n.dwellir.com"
1645
1773
  },
1774
+ {
1775
+ name: "Helixstreet",
1776
+ endpoint: "wss://rpc-people-kusama.helixstreet.io"
1777
+ },
1646
1778
  {
1647
1779
  name: "IBP1",
1648
1780
  endpoint: "wss://sys.ibp.network/people-kusama"
@@ -1655,6 +1787,10 @@ var PeopleKusama$1 = {
1655
1787
  name: "LuckyFriday",
1656
1788
  endpoint: "wss://rpc-people-kusama.luckyfriday.io"
1657
1789
  },
1790
+ {
1791
+ name: "OnFinality",
1792
+ endpoint: "wss://people-kusama.api.onfinality.io/public-ws"
1793
+ },
1658
1794
  {
1659
1795
  name: "Parity",
1660
1796
  endpoint: "wss://kusama-people-rpc.polkadot.io"
@@ -1792,10 +1928,6 @@ var NeuroWeb$1 = {
1792
1928
  info: "neuroweb",
1793
1929
  paraId: 2043,
1794
1930
  providers: [
1795
- {
1796
- name: "Dwellir",
1797
- endpoint: "wss://neuroweb-rpc.dwellir.com"
1798
- },
1799
1931
  {
1800
1932
  name: "TraceLabs",
1801
1933
  endpoint: "wss://parachain-rpc.origin-trail.network"
@@ -1898,10 +2030,6 @@ var Subsocial$1 = {
1898
2030
  {
1899
2031
  name: "Dappforce",
1900
2032
  endpoint: "wss://para.subsocial.network"
1901
- },
1902
- {
1903
- name: "Dwellir",
1904
- endpoint: "wss://subsocial-rpc.dwellir.com"
1905
2033
  }
1906
2034
  ]
1907
2035
  };
@@ -1910,10 +2038,6 @@ var KiltSpiritnet$1 = {
1910
2038
  info: "kilt",
1911
2039
  paraId: 2086,
1912
2040
  providers: [
1913
- {
1914
- name: "Dwellir",
1915
- endpoint: "wss://kilt-rpc.dwellir.com"
1916
- },
1917
2041
  {
1918
2042
  name: "IBP1",
1919
2043
  endpoint: "wss://kilt.ibp.network"
@@ -2049,10 +2173,6 @@ var Polkadot = {
2049
2173
  name: "RadiumBlock",
2050
2174
  endpoint: "wss://polkadot.public.curie.radiumblock.co/ws"
2051
2175
  },
2052
- {
2053
- name: "RockX",
2054
- endpoint: "wss://rockx-dot.w3node.com/polka-public-dot/ws"
2055
- },
2056
2176
  {
2057
2177
  name: "Stakeworld",
2058
2178
  endpoint: "wss://dot-rpc.stakeworld.io"
@@ -2104,10 +2224,6 @@ var Kusama = {
2104
2224
  name: "RadiumBlock",
2105
2225
  endpoint: "wss://kusama.public.curie.radiumblock.co/ws"
2106
2226
  },
2107
- {
2108
- name: "RockX",
2109
- endpoint: "wss://rockx-ksm.w3node.com/polka-public-ksm/ws"
2110
- },
2111
2227
  {
2112
2228
  name: "Stakeworld",
2113
2229
  endpoint: "wss://ksm-rpc.stakeworld.io"
@@ -2117,6 +2233,7 @@ var Kusama = {
2117
2233
  var configs = {
2118
2234
  AssetHubPolkadot: AssetHubPolkadot$1,
2119
2235
  Acala: Acala$1,
2236
+ Ajuna: Ajuna$1,
2120
2237
  Astar: Astar$1,
2121
2238
  BifrostPolkadot: BifrostPolkadot$1,
2122
2239
  Bitgreen: Bitgreen$1,
@@ -2137,10 +2254,8 @@ var configs = {
2137
2254
  Amplitude: Amplitude$1,
2138
2255
  Basilisk: Basilisk$1,
2139
2256
  BifrostKusama: BifrostKusama$1,
2140
- Calamari: Calamari$1,
2141
2257
  CrustShadow: CrustShadow$1,
2142
2258
  Crab: Crab$1,
2143
- InvArchTinker: InvArchTinker$1,
2144
2259
  Karura: Karura$1,
2145
2260
  Kintsugi: Kintsugi$1,
2146
2261
  Moonriver: Moonriver$1,
@@ -2291,7 +2406,7 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
2291
2406
  includeFee = _ref2.includeFee;
2292
2407
  var paraId = resolveParaId(paraIdTo, destination);
2293
2408
  return _objectSpread2({
2294
- dest: createPolkadotXcmHeader('RelayToPara', version, destination, paraId),
2409
+ dest: createVersionedDestination('RelayToPara', version, destination, paraId),
2295
2410
  beneficiary: createVersionedBeneficiary({
2296
2411
  api: api,
2297
2412
  scenario: 'RelayToPara',
@@ -2353,7 +2468,7 @@ var createVersionedMultiAssets = function createVersionedMultiAssets(version, am
2353
2468
  var multiAssets = createMultiAsset(version, amount, multiLocation);
2354
2469
  return addXcmVersionHeader([multiAssets], version);
2355
2470
  };
2356
- var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId, junction, parents) {
2471
+ var createVersionedDestination = function createVersionedDestination(scenario, version, destination, nodeId, junction, parents) {
2357
2472
  var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? Parents.ZERO : Parents.ONE;
2358
2473
  var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
2359
2474
  Parachain: nodeId
@@ -2393,10 +2508,10 @@ var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(relay
2393
2508
  return node;
2394
2509
  };
2395
2510
  var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, node) {
2396
- var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2511
+ var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2397
2512
  isDestination: false
2398
2513
  },
2399
- isDestination = _ref3.isDestination;
2514
+ isDestination = _ref2.isDestination;
2400
2515
  if ('multilocation' in currency) {
2401
2516
  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
2517
  }
@@ -2702,148 +2817,6 @@ var resolveParaId = function resolveParaId(paraId, destination) {
2702
2817
  return paraId !== null && paraId !== void 0 ? paraId : getParaId(destination);
2703
2818
  };
2704
2819
 
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
2820
  var validateAddress = function validateAddress(address, node) {
2848
2821
  var isDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
2849
2822
  var isEvm = isNodeEvm(node);
@@ -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,
@@ -3347,8 +3320,8 @@ var ParachainNode = /*#__PURE__*/function () {
3347
3320
  key: "getRelayToParaOverrides",
3348
3321
  value: function getRelayToParaOverrides() {
3349
3322
  return {
3350
- section: 'reserve_transfer_assets',
3351
- includeFee: false
3323
+ section: 'limited_reserve_transfer_assets',
3324
+ includeFee: true
3352
3325
  };
3353
3326
  }
3354
3327
  }, {
@@ -3378,9 +3351,9 @@ var ParachainNode = /*#__PURE__*/function () {
3378
3351
  });
3379
3352
  }
3380
3353
  }, {
3381
- key: "createPolkadotXcmHeader",
3382
- value: function createPolkadotXcmHeader$1(scenario, version, destination, paraId) {
3383
- return createPolkadotXcmHeader(scenario, version, destination, paraId);
3354
+ key: "createVersionedDestination",
3355
+ value: function createVersionedDestination$1(scenario, version, destination, paraId) {
3356
+ return createVersionedDestination(scenario, version, destination, paraId);
3384
3357
  }
3385
3358
  }, {
3386
3359
  key: "getNativeAssetSymbol",
@@ -3493,13 +3466,13 @@ var ParachainNode = /*#__PURE__*/function () {
3493
3466
  case 15:
3494
3467
  // Pad fee by 50%
3495
3468
  dryRunFeePadded = BigInt(dryRunResult.fee) * BigInt(3) / BigInt(2);
3496
- destWithHeader = createPolkadotXcmHeader(scenario, version, destination, paraIdTo);
3469
+ destWithHeader = createVersionedDestination(scenario, version, destination, paraIdTo);
3497
3470
  _extractVersionFromHe = extractVersionFromHeader(destWithHeader), _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2), _extractVersionFromHe2[0], dest = _extractVersionFromHe2[1];
3498
3471
  call = {
3499
3472
  module: 'PolkadotXcm',
3500
3473
  section: 'transfer_assets_using_type_and_then',
3501
3474
  parameters: {
3502
- dest: this.createPolkadotXcmHeader(scenario, version, destination, getParaId('AssetHubPolkadot')),
3475
+ dest: this.createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
3503
3476
  assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
3504
3477
  assets_transfer_type: 'DestinationReserve',
3505
3478
  remote_fees_id: addXcmVersionHeader((_feeAsset$multiLocati = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.multiLocation) !== null && _feeAsset$multiLocati !== void 0 ? _feeAsset$multiLocati : DOT_MULTILOCATION, version),
@@ -3656,7 +3629,7 @@ var ParachainNode = /*#__PURE__*/function () {
3656
3629
  module: 'PolkadotXcm',
3657
3630
  section: 'transfer_assets_using_type_and_then',
3658
3631
  parameters: {
3659
- dest: this.createPolkadotXcmHeader(scenario, version, destination, getParaId('AssetHubPolkadot')),
3632
+ dest: this.createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
3660
3633
  assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, fee, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
3661
3634
  assets_transfer_type: 'DestinationReserve',
3662
3635
  remote_fees_id: addXcmVersionHeader((_feeAsset$multiLocati2 = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.multiLocation) !== null && _feeAsset$multiLocati2 !== void 0 ? _feeAsset$multiLocati2 : DOT_MULTILOCATION, version),
@@ -3704,10 +3677,11 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3704
3677
  return _createClass(Acala, [{
3705
3678
  key: "getCurrencySelection",
3706
3679
  value: function getCurrencySelection(asset) {
3680
+ var symbol = asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol;
3707
3681
  return isForeignAsset(asset) ? {
3708
3682
  ForeignAsset: Number(asset.assetId)
3709
3683
  } : {
3710
- Token: asset.symbol
3684
+ Token: symbol
3711
3685
  };
3712
3686
  }
3713
3687
  }, {
@@ -3746,59 +3720,6 @@ var Acala = /*#__PURE__*/function (_ParachainNode) {
3746
3720
  return api.callTxMethod({
3747
3721
  module: 'Currencies',
3748
3722
  section: 'transfer',
3749
- parameters: {
3750
- dest: {
3751
- Id: address
3752
- },
3753
- currency_id: this.getCurrencySelection(_objectSpread2(_objectSpread2({}, asset), {}, {
3754
- symbol: asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol
3755
- })),
3756
- amount: BigInt(asset.amount)
3757
- }
3758
- });
3759
- }
3760
- }]);
3761
- }(ParachainNode);
3762
-
3763
- var Altair = /*#__PURE__*/function (_ParachainNode) {
3764
- function Altair() {
3765
- _classCallCheck(this, Altair);
3766
- return _callSuper(this, Altair, ['Altair', 'altair', 'kusama', Version.V3]);
3767
- }
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)
3778
- };
3779
- }
3780
- }, {
3781
- key: "transferXTokens",
3782
- 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,
3792
- address = options.address;
3793
- if (!isForeignAsset(asset)) {
3794
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3795
- }
3796
- if (asset.assetId === undefined) {
3797
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3798
- }
3799
- return api.callTxMethod({
3800
- module: 'Tokens',
3801
- section: 'transfer',
3802
3723
  parameters: {
3803
3724
  dest: {
3804
3725
  Id: address
@@ -3811,27 +3732,6 @@ var Altair = /*#__PURE__*/function (_ParachainNode) {
3811
3732
  }]);
3812
3733
  }(ParachainNode);
3813
3734
 
3814
- var Amplitude = /*#__PURE__*/function (_ParachainNode) {
3815
- function Amplitude() {
3816
- _classCallCheck(this, Amplitude);
3817
- return _callSuper(this, Amplitude, ['Amplitude', 'amplitude', 'kusama', Version.V3]);
3818
- }
3819
- _inherits(Amplitude, _ParachainNode);
3820
- return _createClass(Amplitude, [{
3821
- key: "transferXTokens",
3822
- value: function transferXTokens(input) {
3823
- var asset = input.asset;
3824
- if (!isForeignAsset(asset)) {
3825
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3826
- }
3827
- var currencySelection = {
3828
- XCM: Number(asset.assetId)
3829
- };
3830
- return XTokensTransferImpl.transferXTokens(input, currencySelection);
3831
- }
3832
- }]);
3833
- }(ParachainNode);
3834
-
3835
3735
  var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
3836
3736
  function PolkadotXCMTransferImpl() {
3837
3737
  _classCallCheck(this, PolkadotXCMTransferImpl);
@@ -3873,22 +3773,157 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
3873
3773
  }]);
3874
3774
  }();
3875
3775
 
3876
- var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
3877
- function AssetHubKusama() {
3878
- _classCallCheck(this, AssetHubKusama);
3879
- return _callSuper(this, AssetHubKusama, ['AssetHubKusama', 'KusamaAssetHub', 'kusama', Version.V3]);
3776
+ var Ajuna = /*#__PURE__*/function (_ParachainNode) {
3777
+ function Ajuna() {
3778
+ _classCallCheck(this, Ajuna);
3779
+ return _callSuper(this, Ajuna, ['Ajuna', 'ajuna', 'polkadot', Version.V4]);
3880
3780
  }
3881
- _inherits(AssetHubKusama, _ParachainNode);
3882
- return _createClass(AssetHubKusama, [{
3883
- key: "transferPolkadotXCM",
3884
- value: function transferPolkadotXCM(input) {
3885
- var destination = input.destination,
3886
- asset = input.asset,
3887
- scenario = input.scenario;
3888
- // TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
3889
- // TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
3890
- if (destination === 'AssetHubPolkadot') {
3891
- return Promise.resolve(getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot'));
3781
+ _inherits(Ajuna, _ParachainNode);
3782
+ return _createClass(Ajuna, [{
3783
+ key: "transferXTokens",
3784
+ value: function transferXTokens(input) {
3785
+ var scenario = input.scenario,
3786
+ asset = input.asset;
3787
+ if (scenario !== 'ParaToPara') {
3788
+ throw new ScenarioNotSupportedError(this.node, scenario);
3789
+ }
3790
+ if (asset.symbol !== this.getNativeAssetSymbol()) {
3791
+ throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by node ").concat(this.node, "."));
3792
+ }
3793
+ return XTokensTransferImpl.transferXTokens(input, this.getNativeAssetSymbol());
3794
+ }
3795
+ }, {
3796
+ key: "transferPolkadotXCM",
3797
+ value: function transferPolkadotXCM(input) {
3798
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'transfer_assets', 'Unlimited'));
3799
+ }
3800
+ }, {
3801
+ key: "canUseXTokens",
3802
+ value: function canUseXTokens(_ref) {
3803
+ var asset = _ref.asset,
3804
+ destination = _ref.to;
3805
+ return !(asset.symbol === 'DOT' && destination === 'AssetHubPolkadot');
3806
+ }
3807
+ }, {
3808
+ key: "transferRelayToPara",
3809
+ value: function transferRelayToPara() {
3810
+ throw new NodeNotSupportedError();
3811
+ }
3812
+ }, {
3813
+ key: "transferLocalNonNativeAsset",
3814
+ value: function transferLocalNonNativeAsset(options) {
3815
+ var api = options.api,
3816
+ asset = options.asset,
3817
+ address = options.address;
3818
+ if (!isForeignAsset(asset)) {
3819
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3820
+ }
3821
+ if (asset.assetId === undefined) {
3822
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3823
+ }
3824
+ return api.callTxMethod({
3825
+ module: 'Assets',
3826
+ section: 'transfer',
3827
+ parameters: {
3828
+ id: Number(asset.assetId),
3829
+ target: {
3830
+ Id: address
3831
+ },
3832
+ amount: BigInt(asset.amount)
3833
+ }
3834
+ });
3835
+ }
3836
+ }]);
3837
+ }(ParachainNode);
3838
+
3839
+ var Altair = /*#__PURE__*/function (_ParachainNode) {
3840
+ function Altair() {
3841
+ _classCallCheck(this, Altair);
3842
+ return _callSuper(this, Altair, ['Altair', 'altair', 'kusama', Version.V3]);
3843
+ }
3844
+ _inherits(Altair, _ParachainNode);
3845
+ return _createClass(Altair, [{
3846
+ key: "getCurrencySelection",
3847
+ value: function getCurrencySelection(asset) {
3848
+ if (asset.symbol === this.getNativeAssetSymbol()) return 'Native';
3849
+ if (!isForeignAsset(asset)) {
3850
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3851
+ }
3852
+ return {
3853
+ ForeignAsset: Number(asset.assetId)
3854
+ };
3855
+ }
3856
+ }, {
3857
+ key: "transferXTokens",
3858
+ value: function transferXTokens(input) {
3859
+ var asset = input.asset;
3860
+ var currencySelection = this.getCurrencySelection(asset);
3861
+ return XTokensTransferImpl.transferXTokens(input, currencySelection);
3862
+ }
3863
+ }, {
3864
+ key: "transferLocalNonNativeAsset",
3865
+ value: function transferLocalNonNativeAsset(options) {
3866
+ var api = options.api,
3867
+ asset = options.asset,
3868
+ address = options.address;
3869
+ if (!isForeignAsset(asset)) {
3870
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
3871
+ }
3872
+ if (asset.assetId === undefined) {
3873
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3874
+ }
3875
+ return api.callTxMethod({
3876
+ module: 'Tokens',
3877
+ section: 'transfer',
3878
+ parameters: {
3879
+ dest: {
3880
+ Id: address
3881
+ },
3882
+ currency_id: this.getCurrencySelection(asset),
3883
+ amount: BigInt(asset.amount)
3884
+ }
3885
+ });
3886
+ }
3887
+ }]);
3888
+ }(ParachainNode);
3889
+
3890
+ var Amplitude = /*#__PURE__*/function (_ParachainNode) {
3891
+ function Amplitude() {
3892
+ _classCallCheck(this, Amplitude);
3893
+ return _callSuper(this, Amplitude, ['Amplitude', 'amplitude', 'kusama', Version.V3]);
3894
+ }
3895
+ _inherits(Amplitude, _ParachainNode);
3896
+ return _createClass(Amplitude, [{
3897
+ key: "transferXTokens",
3898
+ value: function transferXTokens(input) {
3899
+ var asset = input.asset;
3900
+ if (!isForeignAsset(asset)) {
3901
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
3902
+ }
3903
+ var currencySelection = {
3904
+ XCM: Number(asset.assetId)
3905
+ };
3906
+ return XTokensTransferImpl.transferXTokens(input, currencySelection);
3907
+ }
3908
+ }]);
3909
+ }(ParachainNode);
3910
+
3911
+ var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
3912
+ function AssetHubKusama() {
3913
+ _classCallCheck(this, AssetHubKusama);
3914
+ return _callSuper(this, AssetHubKusama, ['AssetHubKusama', 'KusamaAssetHub', 'kusama', Version.V3]);
3915
+ }
3916
+ _inherits(AssetHubKusama, _ParachainNode);
3917
+ return _createClass(AssetHubKusama, [{
3918
+ key: "transferPolkadotXCM",
3919
+ value: function transferPolkadotXCM(input) {
3920
+ var destination = input.destination,
3921
+ asset = input.asset,
3922
+ scenario = input.scenario;
3923
+ // TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
3924
+ // TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
3925
+ if (destination === 'AssetHubPolkadot') {
3926
+ return Promise.resolve(getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot'));
3892
3927
  }
3893
3928
  var isSystemNode = !isTMultiLocation(destination) && SYSTEM_NODES_KUSAMA.includes(destination);
3894
3929
  if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset) && !isSystemNode) {
@@ -3930,7 +3965,7 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
3930
3965
  destination = input.destination,
3931
3966
  paraIdTo = input.paraIdTo,
3932
3967
  address = input.address;
3933
- var destWithHeader = createPolkadotXcmHeader(scenario, version, destination, paraIdTo);
3968
+ var destWithHeader = createVersionedDestination(scenario, version, destination, paraIdTo);
3934
3969
  var _extractVersionFromHe = extractVersionFromHeader(destWithHeader),
3935
3970
  _extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2);
3936
3971
  _extractVersionFromHe2[0];
@@ -4064,7 +4099,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4064
4099
  module: 'PolkadotXcm',
4065
4100
  section: 'transfer_assets_using_type_and_then',
4066
4101
  parameters: {
4067
- dest: _this.createPolkadotXcmHeader(scenario, version, destination, paraIdTo),
4102
+ dest: _this.createVersionedDestination(scenario, version, destination, paraIdTo),
4068
4103
  assets: addXcmVersionHeader([].concat(_toConsumableArray(useDOTAsFeeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [createMultiAsset(version, asset.amount, asset.multiLocation)]), version),
4069
4104
  assets_transfer_type: 'LocalReserve',
4070
4105
  remote_fees_id: addXcmVersionHeader(useDOTAsFeeAsset ? DOT_MULTILOCATION : asset.multiLocation, version),
@@ -4160,7 +4195,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4160
4195
  module: 'PolkadotXcm',
4161
4196
  section: 'transfer_assets_using_type_and_then',
4162
4197
  parameters: {
4163
- dest: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
4198
+ dest: createVersionedDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
4164
4199
  assets: addXcmVersionHeader([createMultiAsset(version, asset.amount, multiLocation)], version),
4165
4200
  assets_transfer_type: 'LocalReserve',
4166
4201
  remote_fees_id: addXcmVersionHeader(multiLocation, version),
@@ -4242,7 +4277,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4242
4277
  return _context2.abrupt("return", this.handleEthBridgeNativeTransfer(input));
4243
4278
  case 14:
4244
4279
  modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
4245
- header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
4280
+ header: createVersionedDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
4246
4281
  addressSelection: createVersionedBeneficiary({
4247
4282
  api: api,
4248
4283
  scenario: scenario,
@@ -4285,7 +4320,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4285
4320
  }
4286
4321
  };
4287
4322
  var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
4288
- header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
4323
+ header: this.createVersionedDestination(scenario, version, destination, paraId),
4289
4324
  addressSelection: createVersionedBeneficiary({
4290
4325
  api: api,
4291
4326
  scenario: scenario,
@@ -4314,7 +4349,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4314
4349
  var _input$version4;
4315
4350
  var versionOrDefault = (_input$version4 = input.version) !== null && _input$version4 !== void 0 ? _input$version4 : Version.V2;
4316
4351
  return _objectSpread2(_objectSpread2({}, input), {}, {
4317
- header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
4352
+ header: this.createVersionedDestination(scenario, versionOrDefault, destination, paraIdTo),
4318
4353
  addressSelection: createVersionedBeneficiary({
4319
4354
  api: api,
4320
4355
  scenario: scenario,
@@ -4363,7 +4398,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4363
4398
  proofSize: maxU64
4364
4399
  }, MIN_FEE);
4365
4400
  _context3.next = 9;
4366
- return api.getDryRun({
4401
+ return api.getDryRunCall({
4367
4402
  node: this.node,
4368
4403
  tx: dummyTx,
4369
4404
  address: senderAddress
@@ -4447,7 +4482,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4447
4482
  return Promise.resolve(this.handleBifrostEthTransfer(input, true));
4448
4483
  }
4449
4484
  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) {
4485
+ if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && destination !== 'Ajuna' && !isSystemNode) {
4451
4486
  throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
4452
4487
  }
4453
4488
  if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset)) {
@@ -4530,8 +4565,7 @@ var Astar = /*#__PURE__*/function (_ParachainNode) {
4530
4565
  return _createClass(Astar, [{
4531
4566
  key: "transferPolkadotXCM",
4532
4567
  value: function transferPolkadotXCM(input) {
4533
- // TESTED https://polkadot.subscan.io/xcm_message/polkadot-f2b697df74ebe4b62853fe81b8b7d0522464972d
4534
- return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
4568
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
4535
4569
  }
4536
4570
  }, {
4537
4571
  key: "transferXTokens",
@@ -4793,28 +4827,6 @@ var BridgeHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
4793
4827
  }]);
4794
4828
  }(ParachainNode);
4795
4829
 
4796
- var Calamari = /*#__PURE__*/function (_ParachainNode) {
4797
- function Calamari() {
4798
- _classCallCheck(this, Calamari);
4799
- return _callSuper(this, Calamari, ['Calamari', 'calamari', 'kusama', Version.V3]);
4800
- }
4801
- _inherits(Calamari, _ParachainNode);
4802
- return _createClass(Calamari, [{
4803
- key: "transferXTokens",
4804
- value: function transferXTokens(input) {
4805
- // Currently only option for XCM transfer
4806
- var asset = input.asset;
4807
- if (!isForeignAsset(asset) || !asset.assetId) {
4808
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
4809
- }
4810
- var currencySelection = {
4811
- MantaCurrency: BigInt(asset.assetId)
4812
- };
4813
- return XTokensTransferImpl.transferXTokens(input, currencySelection);
4814
- }
4815
- }]);
4816
- }(ParachainNode);
4817
-
4818
4830
  var Centrifuge = /*#__PURE__*/function (_ParachainNode) {
4819
4831
  function Centrifuge() {
4820
4832
  _classCallCheck(this, Centrifuge);
@@ -5130,11 +5142,28 @@ var Darwinia = /*#__PURE__*/function (_ParachainNode) {
5130
5142
  return _createClass(Darwinia, [{
5131
5143
  key: "transferPolkadotXCM",
5132
5144
  value: function transferPolkadotXCM(input) {
5133
- var scenario = input.scenario;
5134
- if (scenario === 'ParaToPara') {
5145
+ var scenario = input.scenario,
5146
+ asset = input.asset;
5147
+ if (scenario === 'ParaToPara' && asset.symbol !== this.getNativeAssetSymbol()) {
5135
5148
  throw new ScenarioNotSupportedError(this.node, scenario);
5136
5149
  }
5137
- return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
5150
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
5151
+ }
5152
+ }, {
5153
+ key: "createCurrencySpec",
5154
+ value: function createCurrencySpec(amount, scenario, version, _asset) {
5155
+ if (scenario === 'ParaToPara') {
5156
+ return createVersionedMultiAssets(version, amount, {
5157
+ parents: Parents.ZERO,
5158
+ interior: {
5159
+ X1: {
5160
+ PalletInstance: 5
5161
+ }
5162
+ }
5163
+ });
5164
+ } else {
5165
+ return _superPropGet(Darwinia, "createCurrencySpec", this, 3)([amount, scenario, version]);
5166
+ }
5138
5167
  }
5139
5168
  }, {
5140
5169
  key: "transferLocalNonNativeAsset",
@@ -5277,7 +5306,7 @@ var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scena
5277
5306
  AllCounted: 1
5278
5307
  }
5279
5308
  },
5280
- dest: Object.values(createPolkadotXcmHeader(scenario, version, destination, paraId, undefined, Parents.ONE))[0],
5309
+ dest: Object.values(createVersionedDestination(scenario, version, destination, paraId, undefined, Parents.ONE))[0],
5281
5310
  xcm: [{
5282
5311
  BuyExecution: {
5283
5312
  fees: {
@@ -5436,7 +5465,7 @@ var Hydration = /*#__PURE__*/function (_ParachainNode) {
5436
5465
  module: 'PolkadotXcm',
5437
5466
  section: 'transfer_assets_using_type_and_then',
5438
5467
  parameters: {
5439
- dest: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
5468
+ dest: this.createVersionedDestination(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
5440
5469
  assets: _defineProperty({}, versionOrDefault, [createMultiAsset(versionOrDefault, asset.amount, DOT_MULTILOCATION)]),
5441
5470
  assets_transfer_type: 'DestinationReserve',
5442
5471
  remote_fees_id: _defineProperty({}, versionOrDefault, {
@@ -5609,24 +5638,6 @@ var Interlay = /*#__PURE__*/function (_ParachainNode) {
5609
5638
  }]);
5610
5639
  }(ParachainNode);
5611
5640
 
5612
- var InvArchTinker = /*#__PURE__*/function (_ParachainNode) {
5613
- function InvArchTinker() {
5614
- _classCallCheck(this, InvArchTinker);
5615
- return _callSuper(this, InvArchTinker, ['InvArchTinker', 'tinker', 'kusama', Version.V3]);
5616
- }
5617
- _inherits(InvArchTinker, _ParachainNode);
5618
- return _createClass(InvArchTinker, [{
5619
- key: "transferXTokens",
5620
- value: function transferXTokens(input) {
5621
- var asset = input.asset;
5622
- if (!isForeignAsset(asset) || !asset.assetId) {
5623
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
5624
- }
5625
- return XTokensTransferImpl.transferXTokens(input, BigInt(asset.assetId));
5626
- }
5627
- }]);
5628
- }(ParachainNode);
5629
-
5630
5641
  var Karura = /*#__PURE__*/function (_ParachainNode) {
5631
5642
  function Karura() {
5632
5643
  _classCallCheck(this, Karura);
@@ -5654,16 +5665,18 @@ var Karura = /*#__PURE__*/function (_ParachainNode) {
5654
5665
  var KiltSpiritnet = /*#__PURE__*/function (_ParachainNode) {
5655
5666
  function KiltSpiritnet() {
5656
5667
  _classCallCheck(this, KiltSpiritnet);
5657
- return _callSuper(this, KiltSpiritnet, ['KiltSpiritnet', 'kilt', 'polkadot', Version.V2]);
5668
+ return _callSuper(this, KiltSpiritnet, ['KiltSpiritnet', 'kilt', 'polkadot', Version.V3]);
5658
5669
  }
5659
5670
  _inherits(KiltSpiritnet, _ParachainNode);
5660
5671
  return _createClass(KiltSpiritnet, [{
5661
5672
  key: "transferPolkadotXCM",
5662
5673
  value: function transferPolkadotXCM(input) {
5663
- if (input.scenario !== 'ParaToPara') {
5664
- throw new ScenarioNotSupportedError(this.node, input.scenario);
5674
+ var scenario = input.scenario,
5675
+ asset = input.asset;
5676
+ if (scenario === 'ParaToPara' && asset.symbol !== this.getNativeAssetSymbol()) {
5677
+ throw new ScenarioNotSupportedError(this.node, scenario, 'KiltSpiritnet only supports native asset ParaToPara transfers');
5665
5678
  }
5666
- return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
5679
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
5667
5680
  }
5668
5681
  }, {
5669
5682
  key: "transferRelayToPara",
@@ -6483,6 +6496,7 @@ var nodes = function nodes() {
6483
6496
  return {
6484
6497
  AssetHubPolkadot: new AssetHubPolkadot(),
6485
6498
  Acala: new Acala(),
6499
+ Ajuna: new Ajuna(),
6486
6500
  Astar: new Astar(),
6487
6501
  Unique: new Unique(),
6488
6502
  Crust: new Crust(),
@@ -6505,10 +6519,8 @@ var nodes = function nodes() {
6505
6519
  Amplitude: new Amplitude(),
6506
6520
  Basilisk: new Basilisk(),
6507
6521
  BifrostKusama: new BifrostKusama(),
6508
- Calamari: new Calamari(),
6509
6522
  CrustShadow: new CrustShadow(),
6510
6523
  Crab: new Crab(),
6511
- InvArchTinker: new InvArchTinker(),
6512
6524
  Karura: new Karura(),
6513
6525
  Kintsugi: new Kintsugi(),
6514
6526
  Moonriver: new Moonriver(),
@@ -7026,31 +7038,207 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
7026
7038
  };
7027
7039
  }();
7028
7040
 
7029
- var getDryRun = /*#__PURE__*/function () {
7030
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7031
- var api, node, address;
7032
- return _regeneratorRuntime().wrap(function _callee$(_context) {
7033
- while (1) switch (_context.prev = _context.next) {
7041
+ /**
7042
+ * Retrieves the node name corresponding to a specified parachain ID.
7043
+ *
7044
+ * @param paraId - The parachain ID.
7045
+ * @returns The node name if found; otherwise, null.
7046
+ */
7047
+ var getTNode = function getTNode(paraId, ecosystem) {
7048
+ var _NODE_NAMES_DOT_KSM$f;
7049
+ if (paraId === 0) {
7050
+ return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
7051
+ }
7052
+ if (paraId === 1) {
7053
+ return 'Ethereum';
7054
+ }
7055
+ return (_NODE_NAMES_DOT_KSM$f = NODE_NAMES_DOT_KSM.find(function (nodeName) {
7056
+ return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
7057
+ })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
7058
+ };
7059
+
7060
+ var isAssetHub = function isAssetHub(chain) {
7061
+ return chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama';
7062
+ };
7063
+ var isBridgeHub = function isBridgeHub(chain) {
7064
+ return chain === 'BridgeHubPolkadot' || chain === 'BridgeHubKusama';
7065
+ };
7066
+ var isPeople = function isPeople(chain) {
7067
+ return chain === 'PeoplePolkadot' || chain === 'PeopleKusama';
7068
+ };
7069
+ var isSystemPara = function isSystemPara(chain) {
7070
+ return isAssetHub(chain) || isBridgeHub(chain) || isPeople(chain);
7071
+ };
7072
+ var mul = function mul(v, num) {
7073
+ var den = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1n;
7074
+ return v * num / den;
7075
+ };
7076
+ var padFee = function padFee(raw, origin, dest, side) {
7077
+ var relayOrigin = isRelayChain(origin);
7078
+ var relayDest = isRelayChain(dest);
7079
+ var sysParaOrigin = isSystemPara(origin);
7080
+ var sysParaDest = isSystemPara(dest);
7081
+ var relayToPara = relayOrigin && !relayDest;
7082
+ var sysParaToPara = sysParaOrigin && !sysParaDest;
7083
+ var paraToPara = !relayOrigin && !sysParaOrigin;
7084
+ if (sysParaToPara) return raw * 40n;
7085
+ if (relayToPara) return side === 'origin' ? mul(raw, 320n, 100n) : mul(raw, 3000n, 100n);
7086
+ if (paraToPara) return mul(raw, 130n, 100n);
7087
+ // apply default 30% padding
7088
+ return mul(raw, 130n, 100n);
7089
+ };
7090
+
7091
+ var createOriginLocation = function createOriginLocation(origin, destination) {
7092
+ if (isRelayChain(origin)) return DOT_MULTILOCATION;
7093
+ return {
7094
+ parents: isRelayChain(destination) ? Parents.ZERO : Parents.ONE,
7095
+ interior: {
7096
+ X1: [{
7097
+ Parachain: getParaId(origin)
7098
+ }]
7099
+ }
7100
+ };
7101
+ };
7102
+ var getFeeForDestNode = /*#__PURE__*/function () {
7103
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
7104
+ var api, forwardedXcms, origin, destination, address, senderAddress, currency, disableFallback, calcPaymentInfoFee, dryRunResult, fee, newForwardedXcms, destParaId;
7105
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7106
+ while (1) switch (_context2.prev = _context2.next) {
7034
7107
  case 0:
7035
- api = options.api, node = options.node, address = options.address;
7036
- validateAddress(address, node, false);
7037
- _context.next = 4;
7038
- return api.init(node);
7039
- case 4:
7040
- _context.prev = 4;
7041
- _context.next = 7;
7042
- return api.getDryRun(options);
7108
+ api = _ref.api, forwardedXcms = _ref.forwardedXcms, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, currency = _ref.currency, disableFallback = _ref.disableFallback;
7109
+ calcPaymentInfoFee = /*#__PURE__*/function () {
7110
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7111
+ var originAsset, currencyInput, tx, rawFee;
7112
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7113
+ while (1) switch (_context.prev = _context.next) {
7114
+ case 0:
7115
+ if (!('multiasset' in currency)) {
7116
+ _context.next = 2;
7117
+ break;
7118
+ }
7119
+ throw new InvalidCurrencyError('Multi-assets are not yet supported for XCM fee calculation.');
7120
+ case 2:
7121
+ originAsset = findAsset(origin, currency, destination);
7122
+ if (originAsset) {
7123
+ _context.next = 5;
7124
+ break;
7125
+ }
7126
+ throw new InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " not found in ").concat(origin));
7127
+ case 5:
7128
+ currencyInput = originAsset.multiLocation ? {
7129
+ multilocation: originAsset.multiLocation
7130
+ } : {
7131
+ symbol: originAsset.symbol
7132
+ };
7133
+ _context.next = 8;
7134
+ return Builder(api).from(destination).to(origin).address(senderAddress, address).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
7135
+ amount: currency.amount
7136
+ })).build();
7137
+ case 8:
7138
+ tx = _context.sent;
7139
+ _context.next = 11;
7140
+ return api.calculateTransactionFee(tx, address);
7141
+ case 11:
7142
+ rawFee = _context.sent;
7143
+ return _context.abrupt("return", padFee(rawFee, origin, destination, 'destination'));
7144
+ case 13:
7145
+ case "end":
7146
+ return _context.stop();
7147
+ }
7148
+ }, _callee);
7149
+ }));
7150
+ return function calcPaymentInfoFee() {
7151
+ return _ref3.apply(this, arguments);
7152
+ };
7153
+ }();
7154
+ if (!(!hasDryRunSupport(destination) || !forwardedXcms)) {
7155
+ _context2.next = 7;
7156
+ break;
7157
+ }
7158
+ _context2.next = 5;
7159
+ return calcPaymentInfoFee();
7160
+ case 5:
7161
+ _context2.t0 = _context2.sent;
7162
+ return _context2.abrupt("return", {
7163
+ fee: _context2.t0,
7164
+ feeType: 'paymentInfo'
7165
+ });
7043
7166
  case 7:
7044
- return _context.abrupt("return", _context.sent);
7045
- case 8:
7046
- _context.prev = 8;
7047
- _context.next = 11;
7048
- return api.disconnect();
7049
- case 11:
7050
- return _context.finish(8);
7051
- case 12:
7052
- case "end":
7053
- return _context.stop();
7167
+ _context2.next = 9;
7168
+ return api.getDryRunXcm({
7169
+ originLocation: addXcmVersionHeader(createOriginLocation(origin, destination), Version.V4),
7170
+ xcm: forwardedXcms[1][0],
7171
+ node: destination,
7172
+ origin: origin
7173
+ });
7174
+ case 9:
7175
+ dryRunResult = _context2.sent;
7176
+ if (dryRunResult.success) {
7177
+ _context2.next = 18;
7178
+ break;
7179
+ }
7180
+ if (!disableFallback) {
7181
+ _context2.next = 13;
7182
+ break;
7183
+ }
7184
+ return _context2.abrupt("return", {
7185
+ dryRunError: dryRunResult.failureReason
7186
+ });
7187
+ case 13:
7188
+ _context2.next = 15;
7189
+ return calcPaymentInfoFee();
7190
+ case 15:
7191
+ _context2.t1 = _context2.sent;
7192
+ _context2.t2 = dryRunResult.failureReason;
7193
+ return _context2.abrupt("return", {
7194
+ fee: _context2.t1,
7195
+ feeType: 'paymentInfo',
7196
+ dryRunError: _context2.t2
7197
+ });
7198
+ case 18:
7199
+ fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
7200
+ return _context2.abrupt("return", {
7201
+ fee: fee,
7202
+ feeType: 'dryRun',
7203
+ forwardedXcms: newForwardedXcms,
7204
+ destParaId: destParaId
7205
+ });
7206
+ case 20:
7207
+ case "end":
7208
+ return _context2.stop();
7209
+ }
7210
+ }, _callee2);
7211
+ }));
7212
+ return function getFeeForDestNode(_x) {
7213
+ return _ref2.apply(this, arguments);
7214
+ };
7215
+ }();
7216
+
7217
+ var getDryRun = /*#__PURE__*/function () {
7218
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7219
+ var api, node, address;
7220
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7221
+ while (1) switch (_context.prev = _context.next) {
7222
+ case 0:
7223
+ api = options.api, node = options.node, address = options.address;
7224
+ validateAddress(address, node, false);
7225
+ _context.next = 4;
7226
+ return api.init(node);
7227
+ case 4:
7228
+ _context.prev = 4;
7229
+ _context.next = 7;
7230
+ return api.getDryRunCall(options);
7231
+ case 7:
7232
+ return _context.abrupt("return", _context.sent);
7233
+ case 8:
7234
+ _context.prev = 8;
7235
+ _context.next = 11;
7236
+ return api.disconnect();
7237
+ case 11:
7238
+ return _context.finish(8);
7239
+ case 12:
7240
+ case "end":
7241
+ return _context.stop();
7054
7242
  }
7055
7243
  }, _callee, null, [[4,, 8, 12]]);
7056
7244
  }));
@@ -7059,6 +7247,400 @@ var getDryRun = /*#__PURE__*/function () {
7059
7247
  };
7060
7248
  }();
7061
7249
 
7250
+ var getFeeForOriginNode = /*#__PURE__*/function () {
7251
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7252
+ var api, tx, origin, destination, senderAddress, disableFallback, rawFee, dryRunResult, _rawFee, fee, forwardedXcms, destParaId;
7253
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7254
+ while (1) switch (_context.prev = _context.next) {
7255
+ case 0:
7256
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, disableFallback = _ref.disableFallback;
7257
+ if (hasDryRunSupport(origin)) {
7258
+ _context.next = 6;
7259
+ break;
7260
+ }
7261
+ _context.next = 4;
7262
+ return api.calculateTransactionFee(tx, senderAddress);
7263
+ case 4:
7264
+ rawFee = _context.sent;
7265
+ return _context.abrupt("return", {
7266
+ fee: padFee(rawFee, origin, destination, 'origin'),
7267
+ feeType: 'paymentInfo'
7268
+ });
7269
+ case 6:
7270
+ _context.next = 8;
7271
+ return getDryRun({
7272
+ api: api,
7273
+ tx: tx,
7274
+ node: origin,
7275
+ address: senderAddress
7276
+ });
7277
+ case 8:
7278
+ dryRunResult = _context.sent;
7279
+ if (dryRunResult.success) {
7280
+ _context.next = 16;
7281
+ break;
7282
+ }
7283
+ if (!disableFallback) {
7284
+ _context.next = 12;
7285
+ break;
7286
+ }
7287
+ return _context.abrupt("return", {
7288
+ dryRunError: dryRunResult.failureReason
7289
+ });
7290
+ case 12:
7291
+ _context.next = 14;
7292
+ return api.calculateTransactionFee(tx, senderAddress);
7293
+ case 14:
7294
+ _rawFee = _context.sent;
7295
+ return _context.abrupt("return", {
7296
+ fee: padFee(_rawFee, origin, destination, 'origin'),
7297
+ feeType: 'paymentInfo',
7298
+ dryRunError: dryRunResult.failureReason
7299
+ });
7300
+ case 16:
7301
+ fee = dryRunResult.fee, forwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
7302
+ return _context.abrupt("return", {
7303
+ fee: fee,
7304
+ feeType: 'dryRun',
7305
+ forwardedXcms: forwardedXcms,
7306
+ destParaId: destParaId
7307
+ });
7308
+ case 18:
7309
+ case "end":
7310
+ return _context.stop();
7311
+ }
7312
+ }, _callee);
7313
+ }));
7314
+ return function getFeeForOriginNode(_x) {
7315
+ return _ref2.apply(this, arguments);
7316
+ };
7317
+ }();
7318
+
7319
+ var getXcmFee = /*#__PURE__*/function () {
7320
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7321
+ var _findAsset;
7322
+ 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;
7323
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7324
+ while (1) switch (_context.prev = _context.next) {
7325
+ case 0:
7326
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, disableFallback = _ref.disableFallback;
7327
+ asset = (_findAsset = findAsset(origin, currency, destination)) !== null && _findAsset !== void 0 ? _findAsset : origin === 'AssetHubPolkadot' ? findAsset('Ethereum', currency, null) : null;
7328
+ if (asset) {
7329
+ _context.next = 4;
7330
+ break;
7331
+ }
7332
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(origin));
7333
+ case 4:
7334
+ _context.next = 6;
7335
+ return getFeeForOriginNode({
7336
+ api: api,
7337
+ tx: tx,
7338
+ origin: origin,
7339
+ destination: destination,
7340
+ senderAddress: senderAddress,
7341
+ disableFallback: disableFallback
7342
+ });
7343
+ case 6:
7344
+ _yield$getFeeForOrigi = _context.sent;
7345
+ originFee = _yield$getFeeForOrigi.fee;
7346
+ originFeeType = _yield$getFeeForOrigi.feeType;
7347
+ originDryRunError = _yield$getFeeForOrigi.dryRunError;
7348
+ initialForwardedXcm = _yield$getFeeForOrigi.forwardedXcms;
7349
+ initialDestParaId = _yield$getFeeForOrigi.destParaId;
7350
+ api.setDisconnectAllowed(true);
7351
+ _context.next = 15;
7352
+ return api.disconnect();
7353
+ case 15:
7354
+ if (!originDryRunError) {
7355
+ _context.next = 30;
7356
+ break;
7357
+ }
7358
+ destApi = api.clone();
7359
+ _context.prev = 17;
7360
+ _context.next = 20;
7361
+ return destApi.init(destination);
7362
+ case 20:
7363
+ destApi.setDisconnectAllowed(false);
7364
+ _context.next = 23;
7365
+ return getFeeForDestNode({
7366
+ api: destApi,
7367
+ forwardedXcms: undefined,
7368
+ // force paymentInfo
7369
+ origin: origin,
7370
+ destination: destination,
7371
+ currency: currency,
7372
+ address: address,
7373
+ senderAddress: senderAddress,
7374
+ disableFallback: disableFallback
7375
+ });
7376
+ case 23:
7377
+ destFeeRes = _context.sent;
7378
+ return _context.abrupt("return", {
7379
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7380
+ fee: originFee
7381
+ }), originFeeType && {
7382
+ feeType: originFeeType
7383
+ }), {}, {
7384
+ currency: getNativeAssetSymbol(origin),
7385
+ dryRunError: originDryRunError
7386
+ }),
7387
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFeeRes.fee && {
7388
+ fee: destFeeRes.fee
7389
+ }), destFeeRes.feeType && {
7390
+ feeType: destFeeRes.feeType
7391
+ }), {}, {
7392
+ currency: getNativeAssetSymbol(destination)
7393
+ })
7394
+ });
7395
+ case 25:
7396
+ _context.prev = 25;
7397
+ destApi.setDisconnectAllowed(true);
7398
+ _context.next = 29;
7399
+ return destApi.disconnect();
7400
+ case 29:
7401
+ return _context.finish(25);
7402
+ case 30:
7403
+ currentOrigin = origin;
7404
+ forwardedXcms = initialForwardedXcm;
7405
+ nextParaId = initialDestParaId;
7406
+ intermediateFees = {};
7407
+ destinationFee = 0n;
7408
+ destinationFeeType = 'paymentInfo';
7409
+ case 36:
7410
+ 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)) {
7411
+ _context.next = 69;
7412
+ break;
7413
+ }
7414
+ nextChain = getTNode(nextParaId, determineRelayChain(origin) === 'Polkadot' ? 'polkadot' : 'kusama');
7415
+ if (!(nextChain === null)) {
7416
+ _context.next = 40;
7417
+ break;
7418
+ }
7419
+ throw new Error("Unable to find TNode for paraId ".concat(nextParaId));
7420
+ case 40:
7421
+ hopApi = api.clone();
7422
+ _context.prev = 41;
7423
+ _context.next = 44;
7424
+ return hopApi.init(nextChain);
7425
+ case 44:
7426
+ _context.next = 46;
7427
+ return getFeeForDestNode({
7428
+ api: hopApi,
7429
+ forwardedXcms: forwardedXcms,
7430
+ origin: currentOrigin,
7431
+ destination: nextChain,
7432
+ currency: currency,
7433
+ address: address,
7434
+ senderAddress: senderAddress,
7435
+ disableFallback: disableFallback
7436
+ });
7437
+ case 46:
7438
+ hopResult = _context.sent;
7439
+ if (!hopResult.dryRunError) {
7440
+ _context.next = 58;
7441
+ break;
7442
+ }
7443
+ failingRecord = {
7444
+ fee: hopResult.fee,
7445
+ feeType: hopResult.feeType,
7446
+ currency: getNativeAssetSymbol(nextChain),
7447
+ dryRunError: hopResult.dryRunError
7448
+ };
7449
+ hopIsDestination = nextChain === destination || isRelayChain(nextChain) && !isRelayChain(destination);
7450
+ if (hopIsDestination) {
7451
+ destinationFee = hopResult.fee;
7452
+ destinationFeeType = hopResult.feeType; // paymentInfo
7453
+ destinationDryRunError = hopResult.dryRunError;
7454
+ } else if (nextChain === 'AssetHubPolkadot') {
7455
+ intermediateFees.assetHub = failingRecord;
7456
+ } else if (nextChain === 'BridgeHubPolkadot') {
7457
+ intermediateFees.bridgeHub = failingRecord;
7458
+ }
7459
+ // We failed *before* the true destination → fallback via paymentInfo.
7460
+ if (hopIsDestination) {
7461
+ _context.next = 57;
7462
+ break;
7463
+ }
7464
+ _context.next = 54;
7465
+ return getFeeForDestNode({
7466
+ api: hopApi,
7467
+ // already at failing hop
7468
+ forwardedXcms: undefined,
7469
+ // forces paymentInfo path
7470
+ origin: nextChain,
7471
+ destination: destination,
7472
+ currency: currency,
7473
+ address: address,
7474
+ senderAddress: senderAddress,
7475
+ disableFallback: disableFallback
7476
+ });
7477
+ case 54:
7478
+ destFallback = _context.sent;
7479
+ destinationFee = destFallback.fee;
7480
+ destinationFeeType = destFallback.feeType; // paymentInfo
7481
+ case 57:
7482
+ return _context.abrupt("break", 69);
7483
+ case 58:
7484
+ if (nextChain === destination || isRelayChain(nextChain) && !isRelayChain(destination)) {
7485
+ destinationFee = hopResult.fee;
7486
+ destinationFeeType = hopResult.feeType;
7487
+ } else if (nextChain === 'AssetHubPolkadot') {
7488
+ intermediateFees.assetHub = {
7489
+ fee: hopResult.fee,
7490
+ feeType: hopResult.feeType,
7491
+ currency: getNativeAssetSymbol(nextChain)
7492
+ };
7493
+ } else if (nextChain === 'BridgeHubPolkadot') {
7494
+ intermediateFees.bridgeHub = {
7495
+ fee: hopResult.fee,
7496
+ feeType: hopResult.feeType,
7497
+ currency: getNativeAssetSymbol(nextChain)
7498
+ };
7499
+ } else ;
7500
+ forwardedXcms = hopResult.forwardedXcms;
7501
+ nextParaId = hopResult.destParaId;
7502
+ currentOrigin = nextChain;
7503
+ case 62:
7504
+ _context.prev = 62;
7505
+ hopApi.setDisconnectAllowed(true);
7506
+ _context.next = 66;
7507
+ return hopApi.disconnect();
7508
+ case 66:
7509
+ return _context.finish(62);
7510
+ case 67:
7511
+ _context.next = 36;
7512
+ break;
7513
+ case 69:
7514
+ return _context.abrupt("return", _objectSpread2(_objectSpread2({
7515
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7516
+ fee: originFee
7517
+ }), originFeeType && {
7518
+ feeType: originFeeType
7519
+ }), {}, {
7520
+ currency: getNativeAssetSymbol(origin)
7521
+ }, originDryRunError && {
7522
+ dryRunError: originDryRunError
7523
+ })
7524
+ }, intermediateFees), {}, {
7525
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destinationFee && {
7526
+ fee: destinationFee
7527
+ }), destinationFeeType && {
7528
+ feeType: destinationFeeType
7529
+ }), {}, {
7530
+ currency: destinationFeeType === 'dryRun' ? asset.symbol : getNativeAssetSymbol(destination)
7531
+ }, destinationDryRunError && {
7532
+ dryRunError: destinationDryRunError
7533
+ })
7534
+ }));
7535
+ case 70:
7536
+ case "end":
7537
+ return _context.stop();
7538
+ }
7539
+ }, _callee, null, [[17,, 25, 30], [41,, 62, 67]]);
7540
+ }));
7541
+ return function getXcmFee(_x) {
7542
+ return _ref2.apply(this, arguments);
7543
+ };
7544
+ }();
7545
+
7546
+ var BRIDGE_FEE_DOT = 682395810n; // 0.068239581 DOT
7547
+ var BRIDGE_FEE_KSM = 12016807000n; // 0.012016807 KSM
7548
+ var getXcmFeeEstimate = /*#__PURE__*/function () {
7549
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7550
+ var api, tx, origin, destination, address, senderAddress, currency, rawOriginFee, originFee, destApi, originAsset, currencyInput, flippedTx, rawDestFee, destinationFee;
7551
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
7552
+ while (1) switch (_context.prev = _context.next) {
7553
+ case 0:
7554
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, currency = _ref.currency;
7555
+ if (!(origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama')) {
7556
+ _context.next = 3;
7557
+ break;
7558
+ }
7559
+ return _context.abrupt("return", {
7560
+ origin: {
7561
+ fee: BRIDGE_FEE_DOT,
7562
+ currency: getNativeAssetSymbol(origin)
7563
+ },
7564
+ destination: {
7565
+ fee: BRIDGE_FEE_KSM,
7566
+ currency: getNativeAssetSymbol(destination)
7567
+ }
7568
+ });
7569
+ case 3:
7570
+ if (!(origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot')) {
7571
+ _context.next = 5;
7572
+ break;
7573
+ }
7574
+ return _context.abrupt("return", {
7575
+ origin: {
7576
+ fee: BRIDGE_FEE_KSM,
7577
+ currency: getNativeAssetSymbol(origin)
7578
+ },
7579
+ destination: {
7580
+ fee: BRIDGE_FEE_DOT,
7581
+ currency: getNativeAssetSymbol(destination)
7582
+ }
7583
+ });
7584
+ case 5:
7585
+ _context.next = 7;
7586
+ return api.calculateTransactionFee(tx, senderAddress);
7587
+ case 7:
7588
+ rawOriginFee = _context.sent;
7589
+ originFee = padFee(rawOriginFee, origin, destination, 'origin');
7590
+ destApi = api.clone();
7591
+ _context.next = 12;
7592
+ return destApi.init(destination);
7593
+ case 12:
7594
+ if (!('multiasset' in currency)) {
7595
+ _context.next = 14;
7596
+ break;
7597
+ }
7598
+ throw new InvalidCurrencyError('Multi-assets are not yet supported for simple XCM fee estimation.');
7599
+ case 14:
7600
+ originAsset = findAsset(origin, currency, destination);
7601
+ if (originAsset) {
7602
+ _context.next = 17;
7603
+ break;
7604
+ }
7605
+ throw new InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " not found in ").concat(origin));
7606
+ case 17:
7607
+ currencyInput = originAsset.multiLocation ? {
7608
+ multilocation: originAsset.multiLocation
7609
+ } : {
7610
+ symbol: originAsset.symbol
7611
+ };
7612
+ _context.next = 20;
7613
+ return Builder(destApi).from(destination).to(origin).address(senderAddress, address).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
7614
+ amount: currency.amount
7615
+ })).build();
7616
+ case 20:
7617
+ flippedTx = _context.sent;
7618
+ _context.next = 23;
7619
+ return destApi.calculateTransactionFee(flippedTx, address);
7620
+ case 23:
7621
+ rawDestFee = _context.sent;
7622
+ destinationFee = padFee(rawDestFee, origin, destination, 'destination');
7623
+ return _context.abrupt("return", {
7624
+ origin: {
7625
+ fee: originFee,
7626
+ currency: getNativeAssetSymbol(origin)
7627
+ },
7628
+ destination: {
7629
+ fee: destinationFee,
7630
+ currency: getNativeAssetSymbol(destination)
7631
+ }
7632
+ });
7633
+ case 26:
7634
+ case "end":
7635
+ return _context.stop();
7636
+ }
7637
+ }, _callee);
7638
+ }));
7639
+ return function getXcmFeeEstimate(_x) {
7640
+ return _ref2.apply(this, arguments);
7641
+ };
7642
+ }();
7643
+
7062
7644
  var transferRelayToPara = /*#__PURE__*/function () {
7063
7645
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
7064
7646
  var api, origin, destination, asset, address, paraIdTo, version, pallet, method, isMultiLocationDestination, serializedApiCall;
@@ -7511,19 +8093,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
7511
8093
  currency: _currency
7512
8094
  }));
7513
8095
  }
7514
- /**
7515
- * Sets the recipient address.
7516
- *
7517
- * @param address - The destination address.
7518
- * @returns An instance of Builder
7519
- */
7520
8096
  }, {
7521
8097
  key: "address",
7522
8098
  value: function address(_address, senderAddress) {
7523
8099
  return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
7524
- address: _address,
8100
+ address: _address
8101
+ }, senderAddress ? {
7525
8102
  senderAddress: senderAddress
7526
- }));
8103
+ } : {}));
7527
8104
  }
7528
8105
  /**
7529
8106
  * Sets the XCM version to be used for the transfer.
@@ -7677,11 +8254,140 @@ var GeneralBuilder = /*#__PURE__*/function () {
7677
8254
  }
7678
8255
  return dryRun;
7679
8256
  }()
8257
+ /**
8258
+ * Estimates the XCM fee for the transfer using paymentInfo function.
8259
+ *
8260
+ * @returns An origin and destination fee estimate.
8261
+ */
8262
+ }, {
8263
+ key: "getXcmFeeEstimate",
8264
+ value: (function () {
8265
+ var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
8266
+ var _this$_options2, from, to, address, senderAddress, tx;
8267
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
8268
+ while (1) switch (_context4.prev = _context4.next) {
8269
+ case 0:
8270
+ _this$_options2 = this._options, from = _this$_options2.from, to = _this$_options2.to, address = _this$_options2.address, senderAddress = _this$_options2.senderAddress;
8271
+ if (!isTMultiLocation(to)) {
8272
+ _context4.next = 3;
8273
+ break;
8274
+ }
8275
+ throw new InvalidParameterError('Multi-Location destination is not supported for XCM fee calculation.');
8276
+ case 3:
8277
+ if (!isTMultiLocation(address)) {
8278
+ _context4.next = 5;
8279
+ break;
8280
+ }
8281
+ throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
8282
+ case 5:
8283
+ if (!(to === 'Ethereum')) {
8284
+ _context4.next = 7;
8285
+ break;
8286
+ }
8287
+ throw new InvalidParameterError('Ethereum destination is not yet supported for XCM fee calculation.');
8288
+ case 7:
8289
+ this.api.setDisconnectAllowed(false);
8290
+ _context4.next = 10;
8291
+ return this.build();
8292
+ case 10:
8293
+ tx = _context4.sent;
8294
+ this.api.setDisconnectAllowed(true);
8295
+ return _context4.abrupt("return", getXcmFeeEstimate({
8296
+ api: this.api,
8297
+ tx: tx,
8298
+ origin: from,
8299
+ destination: to,
8300
+ address: address,
8301
+ senderAddress: senderAddress,
8302
+ currency: this._options.currency
8303
+ }));
8304
+ case 13:
8305
+ case "end":
8306
+ return _context4.stop();
8307
+ }
8308
+ }, _callee4, this);
8309
+ }));
8310
+ function getXcmFeeEstimate$1() {
8311
+ return _getXcmFeeEstimate2.apply(this, arguments);
8312
+ }
8313
+ return getXcmFeeEstimate$1;
8314
+ }()
8315
+ /**
8316
+ * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
8317
+ *
8318
+ * @returns An origin and destination fee.
8319
+ */
8320
+ )
8321
+ }, {
8322
+ key: "getXcmFee",
8323
+ value: (function () {
8324
+ var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
8325
+ var _ref,
8326
+ disableFallback,
8327
+ _this$_options3,
8328
+ from,
8329
+ to,
8330
+ address,
8331
+ senderAddress,
8332
+ tx,
8333
+ _args5 = arguments;
8334
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
8335
+ while (1) switch (_context5.prev = _context5.next) {
8336
+ case 0:
8337
+ _ref = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {
8338
+ disableFallback: false
8339
+ }, disableFallback = _ref.disableFallback;
8340
+ _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, address = _this$_options3.address, senderAddress = _this$_options3.senderAddress;
8341
+ if (!isTMultiLocation(to)) {
8342
+ _context5.next = 4;
8343
+ break;
8344
+ }
8345
+ throw new InvalidParameterError('Multi-Location destination is not supported for XCM fee calculation.');
8346
+ case 4:
8347
+ if (!isTMultiLocation(address)) {
8348
+ _context5.next = 6;
8349
+ break;
8350
+ }
8351
+ throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
8352
+ case 6:
8353
+ if (!(to === 'Ethereum')) {
8354
+ _context5.next = 8;
8355
+ break;
8356
+ }
8357
+ throw new InvalidParameterError('Ethereum destination is not yet supported for XCM fee calculation.');
8358
+ case 8:
8359
+ _context5.next = 10;
8360
+ return this.build();
8361
+ case 10:
8362
+ tx = _context5.sent;
8363
+ this.api.setDisconnectAllowed(false);
8364
+ return _context5.abrupt("return", getXcmFee({
8365
+ api: this.api,
8366
+ tx: tx,
8367
+ origin: from,
8368
+ destination: to,
8369
+ senderAddress: senderAddress,
8370
+ address: address,
8371
+ currency: this._options.currency,
8372
+ disableFallback: disableFallback
8373
+ }));
8374
+ case 13:
8375
+ case "end":
8376
+ return _context5.stop();
8377
+ }
8378
+ }, _callee5, this);
8379
+ }));
8380
+ function getXcmFee$1() {
8381
+ return _getXcmFee2.apply(this, arguments);
8382
+ }
8383
+ return getXcmFee$1;
8384
+ }()
7680
8385
  /**
7681
8386
  * Returns the API instance used by the builder.
7682
8387
  *
7683
8388
  * @returns The API instance.
7684
8389
  */
8390
+ )
7685
8391
  }, {
7686
8392
  key: "getApi",
7687
8393
  value: function getApi() {
@@ -7709,25 +8415,6 @@ var Builder = function Builder(api) {
7709
8415
  return new GeneralBuilder(api, new BatchTransactionManager());
7710
8416
  };
7711
8417
 
7712
- /**
7713
- * Retrieves the node name corresponding to a specified parachain ID.
7714
- *
7715
- * @param paraId - The parachain ID.
7716
- * @returns The node name if found; otherwise, null.
7717
- */
7718
- var getTNode = function getTNode(paraId, ecosystem) {
7719
- var _NODE_NAMES_DOT_KSM$f;
7720
- if (paraId === 0) {
7721
- return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
7722
- }
7723
- if (paraId === 1) {
7724
- return 'Ethereum';
7725
- }
7726
- return (_NODE_NAMES_DOT_KSM$f = NODE_NAMES_DOT_KSM.find(function (nodeName) {
7727
- return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
7728
- })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
7729
- };
7730
-
7731
8418
  var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
7732
8419
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node, address, asset) {
7733
8420
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -7977,8 +8664,8 @@ var getBalanceNative = /*#__PURE__*/function () {
7977
8664
 
7978
8665
  var getAssetBalanceInternal = /*#__PURE__*/function () {
7979
8666
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7980
- var _yield$getBalanceFore;
7981
- var address, node, currency, api, isNativeSymbol;
8667
+ var _findAsset, _yield$getBalanceFore;
8668
+ var address, node, currency, api, asset, isNativeSymbol;
7982
8669
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7983
8670
  while (1) switch (_context.prev = _context.next) {
7984
8671
  case 0:
@@ -7986,52 +8673,59 @@ var getAssetBalanceInternal = /*#__PURE__*/function () {
7986
8673
  _context.next = 3;
7987
8674
  return api.init(node);
7988
8675
  case 3:
7989
- isNativeSymbol = 'symbol' in currency ? getNativeAssetSymbol(node) === currency.symbol : false;
8676
+ asset = (_findAsset = findAsset(node, currency, null)) !== null && _findAsset !== void 0 ? _findAsset : node === 'AssetHubPolkadot' ? findAsset('Ethereum', currency, null) : null;
8677
+ if (asset) {
8678
+ _context.next = 6;
8679
+ break;
8680
+ }
8681
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(node));
8682
+ case 6:
8683
+ isNativeSymbol = asset.symbol === getNativeAssetSymbol(node);
7990
8684
  if (!(isNativeSymbol && node !== 'Interlay' && node !== 'Kintsugi')) {
7991
- _context.next = 10;
8685
+ _context.next = 13;
7992
8686
  break;
7993
8687
  }
7994
- _context.next = 7;
8688
+ _context.next = 10;
7995
8689
  return getBalanceNativeInternal({
7996
8690
  address: address,
7997
8691
  node: node,
7998
8692
  api: api
7999
8693
  });
8000
- case 7:
8694
+ case 10:
8001
8695
  _context.t0 = _context.sent;
8002
- _context.next = 22;
8696
+ _context.next = 25;
8003
8697
  break;
8004
- case 10:
8005
- _context.next = 12;
8698
+ case 13:
8699
+ _context.next = 15;
8006
8700
  return getBalanceForeignInternal({
8007
8701
  address: address,
8008
8702
  node: node,
8009
8703
  api: api,
8010
8704
  currency: currency
8011
8705
  });
8012
- case 12:
8706
+ case 15:
8013
8707
  _context.t2 = _yield$getBalanceFore = _context.sent;
8014
8708
  _context.t1 = _context.t2 !== null;
8015
8709
  if (!_context.t1) {
8016
- _context.next = 16;
8710
+ _context.next = 19;
8017
8711
  break;
8018
8712
  }
8019
8713
  _context.t1 = _yield$getBalanceFore !== void 0;
8020
- case 16:
8714
+ case 19:
8021
8715
  if (!_context.t1) {
8022
- _context.next = 20;
8716
+ _context.next = 23;
8023
8717
  break;
8024
8718
  }
8025
8719
  _context.t3 = _yield$getBalanceFore;
8026
- _context.next = 21;
8720
+ _context.next = 24;
8027
8721
  break;
8028
- case 20:
8722
+ case 23:
8029
8723
  _context.t3 = 0n;
8030
- case 21:
8724
+ case 24:
8031
8725
  _context.t0 = _context.t3;
8032
- case 22:
8726
+ case 25:
8033
8727
  return _context.abrupt("return", _context.t0);
8034
- case 23:
8728
+ case 26:
8035
8729
  case "end":
8036
8730
  return _context.stop();
8037
8731
  }
@@ -8477,4 +9171,4 @@ var verifyEdOnDestination = /*#__PURE__*/function () {
8477
9171
  };
8478
9172
  }();
8479
9173
 
8480
- 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 };
9174
+ 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 };