@paraspell/sdk-core 10.4.7 → 10.4.8

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.
package/dist/index.cjs CHANGED
@@ -2399,10 +2399,6 @@ var getNode = function getNode(node) {
2399
2399
  return nodeMap[node];
2400
2400
  };
2401
2401
 
2402
- var replaceBigInt = function replaceBigInt(_key, value) {
2403
- return typeof value === 'bigint' ? value.toString() : value;
2404
- };
2405
-
2406
2402
  var resolveParaId = function resolveParaId(paraId, destination) {
2407
2403
  if (sdkCommon.isTMultiLocation(destination) || sdkCommon.isRelayChain(destination) || destination === 'Ethereum') {
2408
2404
  return undefined;
@@ -2591,7 +2587,7 @@ var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, node)
2591
2587
  if ('multilocation' in currency) {
2592
2588
  throw new assets.InvalidCurrencyError("\n Selected chain doesn't support multilocation you provided. Maybe you meant custom multilocation. If so, you need to use override option. Your selection should look like this: {multilocation: Override(".concat(JSON.stringify(currency.multilocation), ")}."));
2593
2589
  }
2594
- throw new assets.InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " node ").concat(node, " does not support currency ").concat(JSON.stringify(currency), "."));
2590
+ throw new assets.InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " node ").concat(node, " does not support currency ").concat(JSON.stringify(currency, sdkCommon.replaceBigInt), "."));
2595
2591
  };
2596
2592
 
2597
2593
  var resolveMultiLocationFromDest = function resolveMultiLocationFromDest(destination, asset) {
@@ -3372,29 +3368,23 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
3372
3368
  wallet: signer
3373
3369
  }
3374
3370
  });
3375
- foundAsset = assets.findAsset(from, currency, to);
3376
- if (!(foundAsset === null)) {
3377
- _context.n = 3;
3378
- break;
3379
- }
3380
- throw new assets.InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
3381
- case 3:
3371
+ foundAsset = assets.findAssetForNodeOrThrow(from, currency, to);
3382
3372
  if (!(foundAsset.symbol === assets.getNativeAssetSymbol(from))) {
3383
- _context.n = 4;
3373
+ _context.n = 3;
3384
3374
  break;
3385
3375
  }
3386
3376
  asset = NATIVE_ASSET_ID;
3387
- _context.n = 6;
3377
+ _context.n = 5;
3388
3378
  break;
3389
- case 4:
3379
+ case 3:
3390
3380
  if (!(!assets.isForeignAsset(foundAsset) || !foundAsset.assetId)) {
3391
- _context.n = 5;
3381
+ _context.n = 4;
3392
3382
  break;
3393
3383
  }
3394
3384
  throw new assets.InvalidCurrencyError('Currency must be a foreign asset with valid assetId');
3395
- case 5:
3385
+ case 4:
3396
3386
  asset = formatAssetIdToERC20(foundAsset.assetId);
3397
- case 6:
3387
+ case 5:
3398
3388
  destMultiLocation = getDestinationMultilocation(api, address, to);
3399
3389
  weight = U_64_MAX; // Partially inspired by Moonbeam XCM-SDK
3400
3390
  // https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
@@ -3404,27 +3394,27 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
3404
3394
  };
3405
3395
  multiCurrencySymbols = ['xcPINK', 'xcDED', 'xcSTINK', 'xcWIFD', 'xcNCTR'];
3406
3396
  useMultiAssets = from === 'Moonbeam' && to === 'AssetHubPolkadot' && multiCurrencySymbols.includes(foundAsset.symbol);
3407
- usdtAsset = assets.findAsset(from, {
3397
+ usdtAsset = assets.findAssetForNodeOrThrow(from, {
3408
3398
  symbol: 'xcUSDT'
3409
3399
  }, to);
3410
3400
  if (!useMultiAssets) {
3411
- _context.n = 8;
3401
+ _context.n = 7;
3412
3402
  break;
3413
3403
  }
3414
- _context.n = 7;
3404
+ _context.n = 6;
3415
3405
  return createTx('transferMultiCurrencies', [[[asset, currency.amount], [formatAssetIdToERC20((_usdtAsset$assetId = usdtAsset.assetId) !== null && _usdtAsset$assetId !== void 0 ? _usdtAsset$assetId : ''), '200000']], 1,
3416
3406
  // index of the fee asset
3417
3407
  destMultiLocation, weight]);
3418
- case 7:
3408
+ case 6:
3419
3409
  _t = _context.v;
3420
- _context.n = 10;
3421
- break;
3422
- case 8:
3423
3410
  _context.n = 9;
3411
+ break;
3412
+ case 7:
3413
+ _context.n = 8;
3424
3414
  return createTx('transfer', [asset, currency.amount, destMultiLocation, weight]);
3425
- case 9:
3415
+ case 8:
3426
3416
  _t = _context.v;
3427
- case 10:
3417
+ case 9:
3428
3418
  tx = _t;
3429
3419
  return _context.a(2, tx);
3430
3420
  }
@@ -3696,26 +3686,20 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3696
3686
  }
3697
3687
  throw new InvalidParameterError('Override multilocation is not supported for Evm transfers');
3698
3688
  case 5:
3699
- foundAsset = assets.findAsset(from, currency, to);
3700
- if (!(foundAsset === null)) {
3701
- _context.n = 6;
3702
- break;
3703
- }
3704
- throw new assets.InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
3705
- case 6:
3689
+ foundAsset = assets.findAssetForNodeOrThrow(from, currency, to);
3706
3690
  if (!(!assets.isForeignAsset(foundAsset) || !foundAsset.multiLocation)) {
3707
- _context.n = 7;
3691
+ _context.n = 6;
3708
3692
  break;
3709
3693
  }
3710
3694
  throw new assets.InvalidCurrencyError('Currency must be a foreign asset with valid multi-location');
3711
- case 7:
3695
+ case 6:
3712
3696
  ethAsset = assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), foundAsset.multiLocation);
3713
3697
  if (!(!ethAsset || !ethAsset.assetId)) {
3714
- _context.n = 8;
3698
+ _context.n = 7;
3715
3699
  break;
3716
3700
  }
3717
3701
  throw new assets.InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(foundAsset)));
3718
- case 8:
3702
+ case 7:
3719
3703
  contract = viem.getContract({
3720
3704
  abi: abi,
3721
3705
  address: xcmInterfacePrecompile,
@@ -3729,17 +3713,17 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3729
3713
  });
3730
3714
  senderAddress = (_signer$account = signer.account) === null || _signer$account === void 0 ? void 0 : _signer$account.address;
3731
3715
  if (senderAddress) {
3732
- _context.n = 9;
3716
+ _context.n = 8;
3733
3717
  break;
3734
3718
  }
3735
3719
  throw new InvalidParameterError('Unable to get sender address');
3720
+ case 8:
3721
+ _context.n = 9;
3722
+ return api.init(from, TX_CLIENT_TIMEOUT_MS);
3736
3723
  case 9:
3737
3724
  _context.n = 10;
3738
- return api.init(from, TX_CLIENT_TIMEOUT_MS);
3739
- case 10:
3740
- _context.n = 11;
3741
3725
  return generateMessageId(api, senderAddress, getParaId(from), ethAsset.assetId, address, currency.amount);
3742
- case 11:
3726
+ case 10:
3743
3727
  messageId = _context.v;
3744
3728
  customXcm = createCustomXcmOnDest({
3745
3729
  api: api,
@@ -3752,17 +3736,17 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3752
3736
  }),
3753
3737
  version: sdkCommon.Version.V4
3754
3738
  }, from, messageId);
3755
- _context.n = 12;
3739
+ _context.n = 11;
3756
3740
  return api.objectToHex(customXcm, 'XcmVersionedXcm');
3757
- case 12:
3741
+ case 11:
3758
3742
  customXcmOnDest = _context.v;
3759
- _context.n = 13;
3743
+ _context.n = 12;
3760
3744
  return api.createApiForNode('AssetHubPolkadot');
3761
- case 13:
3745
+ case 12:
3762
3746
  assetHubApi = _context.v;
3763
- _context.n = 14;
3747
+ _context.n = 13;
3764
3748
  return getParaEthTransferFees(assetHubApi);
3765
- case 14:
3749
+ case 13:
3766
3750
  _yield$getParaEthTran = _context.v;
3767
3751
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
3768
3752
  bridgeFee = _yield$getParaEthTran2[0];
@@ -3777,7 +3761,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3777
3761
  throw new InvalidParameterError('Input must be a valid number');
3778
3762
  }() : "0x".concat((num >>> 0).toString(16).padStart(8, '0'));
3779
3763
  }; // Execute the custom XCM message with the precompile
3780
- _context.n = 15;
3764
+ _context.n = 14;
3781
3765
  return createTx('transferAssetsUsingTypeAndThenAddress', [
3782
3766
  // This represents (1,X1(Parachain(1000)))
3783
3767
  [1, ['0x00' + numberToHex32(getParaId('AssetHubPolkadot')).slice(2)]],
@@ -3789,7 +3773,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3789
3773
  0,
3790
3774
  // The TransferType corresponding to fee asset
3791
3775
  2, customXcmOnDest]);
3792
- case 15:
3776
+ case 14:
3793
3777
  tx = _context.v;
3794
3778
  return _context.a(2, tx);
3795
3779
  }
@@ -3948,7 +3932,7 @@ var getOriginFeeDetails = /*#__PURE__*/function () {
3948
3932
 
3949
3933
  var getTransferableAmountInternal = /*#__PURE__*/function () {
3950
3934
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
3951
- var api, senderAddress, node, destination, currency, tx, feeAsset, resolvedFeeAsset, asset, balance, ed, edBN, isNativeAsset, shouldSubstractFee, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
3935
+ var api, senderAddress, node, destination, currency, tx, feeAsset, resolvedFeeAsset, asset, balance, ed, isNativeAsset, shouldSubstractFee, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
3952
3936
  return _regenerator().w(function (_context) {
3953
3937
  while (1) switch (_context.n) {
3954
3938
  case 0:
@@ -3965,22 +3949,15 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
3965
3949
  });
3966
3950
  case 1:
3967
3951
  balance = _context.v;
3968
- ed = assets.getExistentialDeposit(node, currency);
3969
- if (!(ed === null)) {
3970
- _context.n = 2;
3971
- break;
3972
- }
3973
- throw new InvalidParameterError("Cannot get existential deposit for currency ".concat(JSON.stringify(currency), "."));
3974
- case 2:
3975
- edBN = BigInt(ed);
3952
+ ed = assets.getExistentialDepositOrThrow(node, currency);
3976
3953
  isNativeAsset = assets.getNativeAssetSymbol(node) === asset.symbol;
3977
3954
  shouldSubstractFee = isNativeAsset || node === 'AssetHubPolkadot' && resolvedFeeAsset && assets.isAssetEqual(resolvedFeeAsset, asset);
3978
3955
  feeToSubtract = 0n;
3979
3956
  if (!shouldSubstractFee) {
3980
- _context.n = 5;
3957
+ _context.n = 4;
3981
3958
  break;
3982
3959
  }
3983
- _context.n = 3;
3960
+ _context.n = 2;
3984
3961
  return getOriginXcmFee({
3985
3962
  api: api,
3986
3963
  tx: tx,
@@ -3991,18 +3968,18 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
3991
3968
  currency: currency,
3992
3969
  disableFallback: false
3993
3970
  });
3994
- case 3:
3971
+ case 2:
3995
3972
  _yield$getOriginXcmFe = _context.v;
3996
3973
  fee = _yield$getOriginXcmFe.fee;
3997
3974
  if (!(fee === undefined)) {
3998
- _context.n = 4;
3975
+ _context.n = 3;
3999
3976
  break;
4000
3977
  }
4001
- throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(node, "."));
4002
- case 4:
3978
+ throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency, sdkCommon.replaceBigInt), " on node ").concat(node, "."));
3979
+ case 3:
4003
3980
  feeToSubtract = fee;
4004
- case 5:
4005
- transferable = balance - edBN - feeToSubtract;
3981
+ case 4:
3982
+ transferable = balance - ed - feeToSubtract;
4006
3983
  return _context.a(2, transferable > 0n ? transferable : 0n);
4007
3984
  }
4008
3985
  }, _callee);
@@ -4062,7 +4039,7 @@ var buildDestInfo = /*#__PURE__*/function () {
4062
4039
  _context.n = 2;
4063
4040
  break;
4064
4041
  }
4065
- throw new InvalidParameterError("Existential deposit not found for ".concat(destination, " with currency ").concat(JSON.stringify(currency)));
4042
+ throw new InvalidParameterError("Existential deposit not found for ".concat(destination, " with currency ").concat(JSON.stringify(currency, sdkCommon.replaceBigInt)));
4066
4043
  case 2:
4067
4044
  edDestBn = BigInt(edDest);
4068
4045
  destCurrency = destAsset.multiLocation ? {
@@ -4240,7 +4217,7 @@ var buildHopInfo = /*#__PURE__*/function () {
4240
4217
 
4241
4218
  var getTransferInfo = /*#__PURE__*/function () {
4242
4219
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
4243
- var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, originBalanceFee, originBalance, edOrigin, edOriginBn, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubNode, destinationInfo, _t;
4220
+ var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubNode, destinationInfo, _t;
4244
4221
  return _regenerator().w(function (_context) {
4245
4222
  while (1) switch (_context.n) {
4246
4223
  case 0:
@@ -4293,15 +4270,8 @@ var getTransferInfo = /*#__PURE__*/function () {
4293
4270
  });
4294
4271
  case 8:
4295
4272
  originBalance = _context.v;
4296
- edOrigin = assets.getExistentialDeposit(origin, currency);
4297
- if (edOrigin) {
4298
- _context.n = 9;
4299
- break;
4300
- }
4301
- throw new InvalidParameterError("Existential deposit not found for ".concat(origin, " with currency ").concat(JSON.stringify(currency)));
4302
- case 9:
4303
- edOriginBn = BigInt(edOrigin);
4304
- _context.n = 10;
4273
+ edOrigin = assets.getExistentialDepositOrThrow(origin, currency);
4274
+ _context.n = 9;
4305
4275
  return getXcmFee({
4306
4276
  api: api,
4307
4277
  tx: tx,
@@ -4313,7 +4283,7 @@ var getTransferInfo = /*#__PURE__*/function () {
4313
4283
  feeAsset: feeAsset,
4314
4284
  disableFallback: false
4315
4285
  });
4316
- case 10:
4286
+ case 9:
4317
4287
  _yield$getXcmFee = _context.v;
4318
4288
  _yield$getXcmFee$orig = _yield$getXcmFee.origin;
4319
4289
  originFee = _yield$getXcmFee$orig.fee;
@@ -4322,21 +4292,21 @@ var getTransferInfo = /*#__PURE__*/function () {
4322
4292
  bridgeHubFeeResult = _yield$getXcmFee.bridgeHub;
4323
4293
  destFeeDetail = _yield$getXcmFee.destination;
4324
4294
  if (!(originFee === undefined)) {
4325
- _context.n = 11;
4295
+ _context.n = 10;
4326
4296
  break;
4327
4297
  }
4328
- throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(origin, "."));
4329
- case 11:
4298
+ throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency, sdkCommon.replaceBigInt), " on node ").concat(origin, "."));
4299
+ case 10:
4330
4300
  isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && assets.isAssetEqual(resolvedFeeAsset, originAsset);
4331
4301
  originBalanceAfter = originBalance - BigInt(currency.amount);
4332
4302
  originBalanceFeeAfter = isFeeAssetAh ? originBalanceFee - BigInt(currency.amount) : originBalanceFee - originFee;
4333
4303
  originBalanceNativeSufficient = originBalanceFee >= originFee;
4334
- originBalanceSufficient = originBalanceAfter >= edOriginBn;
4304
+ originBalanceSufficient = originBalanceAfter >= edOrigin;
4335
4305
  if (!assetHubFeeResult) {
4336
- _context.n = 13;
4306
+ _context.n = 12;
4337
4307
  break;
4338
4308
  }
4339
- _context.n = 12;
4309
+ _context.n = 11;
4340
4310
  return buildHopInfo({
4341
4311
  api: api,
4342
4312
  node: determineRelayChain(origin) === 'Polkadot' ? 'AssetHubPolkadot' : 'AssetHubKusama',
@@ -4346,15 +4316,15 @@ var getTransferInfo = /*#__PURE__*/function () {
4346
4316
  senderAddress: senderAddress,
4347
4317
  ahAddress: ahAddress
4348
4318
  });
4349
- case 12:
4319
+ case 11:
4350
4320
  assetHub = _context.v;
4351
- case 13:
4321
+ case 12:
4352
4322
  if (!bridgeHubFeeResult) {
4353
- _context.n = 15;
4323
+ _context.n = 14;
4354
4324
  break;
4355
4325
  }
4356
4326
  bridgeHubNode = determineRelayChain(origin) === 'Polkadot' ? 'BridgeHubPolkadot' : 'BridgeHubKusama';
4357
- _context.n = 14;
4327
+ _context.n = 13;
4358
4328
  return buildHopInfo({
4359
4329
  api: api,
4360
4330
  node: bridgeHubNode,
@@ -4364,10 +4334,10 @@ var getTransferInfo = /*#__PURE__*/function () {
4364
4334
  senderAddress: senderAddress,
4365
4335
  ahAddress: ahAddress
4366
4336
  });
4367
- case 14:
4337
+ case 13:
4368
4338
  bridgeHub = _context.v;
4369
- case 15:
4370
- _context.n = 16;
4339
+ case 14:
4340
+ _context.n = 15;
4371
4341
  return buildDestInfo({
4372
4342
  api: api,
4373
4343
  origin: origin,
@@ -4380,7 +4350,7 @@ var getTransferInfo = /*#__PURE__*/function () {
4380
4350
  assetHubFee: assetHubFeeResult === null || assetHubFeeResult === void 0 ? void 0 : assetHubFeeResult.fee,
4381
4351
  bridgeFee: bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.fee
4382
4352
  });
4383
- case 16:
4353
+ case 15:
4384
4354
  destinationInfo = _context.v;
4385
4355
  return _context.a(2, {
4386
4356
  chain: {
@@ -4394,7 +4364,7 @@ var getTransferInfo = /*#__PURE__*/function () {
4394
4364
  balance: originBalance,
4395
4365
  balanceAfter: originBalanceAfter,
4396
4366
  currencySymbol: originAsset.symbol,
4397
- existentialDeposit: edOriginBn
4367
+ existentialDeposit: edOrigin
4398
4368
  },
4399
4369
  xcmFee: {
4400
4370
  sufficient: originBalanceNativeSufficient,
@@ -4408,17 +4378,17 @@ var getTransferInfo = /*#__PURE__*/function () {
4408
4378
  bridgeHub: bridgeHub,
4409
4379
  destination: destinationInfo
4410
4380
  });
4411
- case 17:
4412
- _context.p = 17;
4381
+ case 16:
4382
+ _context.p = 16;
4413
4383
  api.setDisconnectAllowed(true);
4414
- _context.n = 18;
4384
+ _context.n = 17;
4415
4385
  return api.disconnect();
4386
+ case 17:
4387
+ return _context.f(16);
4416
4388
  case 18:
4417
- return _context.f(17);
4418
- case 19:
4419
4389
  return _context.a(2);
4420
4390
  }
4421
- }, _callee, null, [[3,, 17, 19]]);
4391
+ }, _callee, null, [[3,, 16, 18]]);
4422
4392
  }));
4423
4393
  return function getTransferInfo(_x) {
4424
4394
  return _ref2.apply(this, arguments);
@@ -4438,7 +4408,7 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
4438
4408
  };
4439
4409
  var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
4440
4410
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
4441
- var api, tx, origin, destination, address, senderAddress, feeAsset, currency, destApi, asset, destCurrency, ed, edBN, balance, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, totalFee, method, feeToSubtract;
4411
+ var api, tx, origin, destination, address, senderAddress, feeAsset, currency, destApi, asset, destCurrency, ed, balance, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, totalFee, method, feeToSubtract;
4442
4412
  return _regenerator().w(function (_context) {
4443
4413
  while (1) switch (_context.n) {
4444
4414
  case 0:
@@ -4472,24 +4442,17 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
4472
4442
  } : {
4473
4443
  symbol: asset.symbol
4474
4444
  };
4475
- ed = assets.getExistentialDeposit(destination, destCurrency);
4476
- if (!(ed === null)) {
4477
- _context.n = 5;
4478
- break;
4479
- }
4480
- throw new InvalidParameterError("Cannot get existential deposit for currency ".concat(JSON.stringify(currency)));
4481
- case 5:
4482
- edBN = BigInt(ed);
4483
- _context.n = 6;
4445
+ ed = assets.getExistentialDepositOrThrow(destination, destCurrency);
4446
+ _context.n = 5;
4484
4447
  return getAssetBalanceInternal({
4485
4448
  address: address,
4486
4449
  node: destination,
4487
4450
  api: destApi,
4488
4451
  currency: destCurrency
4489
4452
  });
4490
- case 6:
4453
+ case 5:
4491
4454
  balance = _context.v;
4492
- _context.n = 7;
4455
+ _context.n = 6;
4493
4456
  return getXcmFee({
4494
4457
  api: api,
4495
4458
  tx: tx,
@@ -4501,40 +4464,40 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
4501
4464
  feeAsset: feeAsset,
4502
4465
  disableFallback: false
4503
4466
  });
4504
- case 7:
4467
+ case 6:
4505
4468
  xcmFeeResult = _context.v;
4506
4469
  dryRunError = xcmFeeResult.origin.dryRunError, assetHubFeeResult = xcmFeeResult.assetHub, bridgeHubFeeResult = xcmFeeResult.bridgeHub, _xcmFeeResult$destina = xcmFeeResult.destination, destFee = _xcmFeeResult$destina.fee, destFeeCurrency = _xcmFeeResult$destina.currency, destDryRunError = _xcmFeeResult$destina.dryRunError;
4507
4470
  if (!(destFee === undefined)) {
4508
- _context.n = 8;
4471
+ _context.n = 7;
4509
4472
  break;
4510
4473
  }
4511
- throw new InvalidParameterError("Cannot get destination xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(destination, "."));
4512
- case 8:
4474
+ throw new InvalidParameterError("Cannot get destination xcm fee for currency ".concat(JSON.stringify(currency, sdkCommon.replaceBigInt), " on node ").concat(destination, "."));
4475
+ case 7:
4513
4476
  if (!dryRunError) {
4514
- _context.n = 9;
4477
+ _context.n = 8;
4515
4478
  break;
4516
4479
  }
4517
4480
  throw new DryRunFailedError(dryRunError, 'origin');
4518
- case 9:
4481
+ case 8:
4519
4482
  hopDryRunError = (assetHubFeeResult === null || assetHubFeeResult === void 0 ? void 0 : assetHubFeeResult.dryRunError) || (bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.dryRunError);
4520
4483
  if (!hopDryRunError) {
4521
- _context.n = 10;
4484
+ _context.n = 9;
4522
4485
  break;
4523
4486
  }
4524
4487
  throw new DryRunFailedError(hopDryRunError, assetHubFeeResult !== null && assetHubFeeResult !== void 0 && assetHubFeeResult.dryRunError ? 'assetHub' : 'bridgeHub');
4525
- case 10:
4488
+ case 9:
4526
4489
  if (!destDryRunError) {
4527
- _context.n = 11;
4490
+ _context.n = 10;
4528
4491
  break;
4529
4492
  }
4530
4493
  throw new UnableToComputeError("Unable to compute fee for the destination asset. Destination dry run error: ".concat(destDryRunError));
4531
- case 11:
4494
+ case 10:
4532
4495
  if (!(assets.normalizeSymbol(asset.symbol) !== assets.normalizeSymbol(destFeeCurrency))) {
4533
- _context.n = 12;
4496
+ _context.n = 11;
4534
4497
  break;
4535
4498
  }
4536
4499
  throw new UnableToComputeError("The XCM fee could not be calculated because the origin or destination chain does not support DryRun.\n As a result, fee estimation is only available through PaymentInfo, which provides the cost in the native asset.\n This limitation restricts support to transfers involving the native asset of the Destination chain only.");
4537
- case 12:
4500
+ case 11:
4538
4501
  totalFee = calculateTotalXcmFee(xcmFeeResult);
4539
4502
  method = api.getMethod(tx);
4540
4503
  if (method === 'transfer_assets_using_type_and_then' || method === 'transferAssetsUsingTypeAndThen') {
@@ -4542,7 +4505,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
4542
4505
  } else {
4543
4506
  feeToSubtract = destFee;
4544
4507
  }
4545
- return _context.a(2, BigInt(currency.amount) - feeToSubtract > (balance < edBN ? edBN : 0));
4508
+ return _context.a(2, BigInt(currency.amount) - feeToSubtract > (balance < ed ? ed : 0));
4546
4509
  }
4547
4510
  }, _callee);
4548
4511
  }));
@@ -4669,54 +4632,48 @@ var getDestXcmFee = /*#__PURE__*/function () {
4669
4632
  }
4670
4633
  return _context.a(2, 0n);
4671
4634
  case 1:
4672
- originAsset = assets.findAsset(origin, currency, destination);
4673
- if (originAsset) {
4674
- _context.n = 2;
4675
- break;
4676
- }
4677
- throw new assets.InvalidCurrencyError("Currency ".concat(JSON.stringify(currency, replaceBigInt), " not found in ").concat(origin));
4678
- case 2:
4635
+ originAsset = assets.findAssetForNodeOrThrow(origin, currency, destination);
4679
4636
  if (!originAsset.multiLocation) {
4680
- _context.n = 8;
4637
+ _context.n = 7;
4681
4638
  break;
4682
4639
  }
4683
- _context.p = 3;
4684
- _context.n = 4;
4640
+ _context.p = 2;
4641
+ _context.n = 3;
4685
4642
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4686
4643
  destination: destination
4687
4644
  }), {
4688
4645
  multilocation: originAsset.multiLocation
4689
4646
  });
4690
- case 4:
4647
+ case 3:
4691
4648
  return _context.a(2, _context.v);
4692
- case 5:
4693
- _context.p = 5;
4649
+ case 4:
4650
+ _context.p = 4;
4694
4651
  _t = _context.v;
4695
4652
  if (!(_t instanceof assets.InvalidCurrencyError)) {
4696
- _context.n = 7;
4653
+ _context.n = 6;
4697
4654
  break;
4698
4655
  }
4699
- _context.n = 6;
4656
+ _context.n = 5;
4700
4657
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4701
4658
  destination: destination
4702
4659
  }), {
4703
4660
  symbol: originAsset.symbol
4704
4661
  });
4705
- case 6:
4662
+ case 5:
4706
4663
  return _context.a(2, _context.v);
4707
- case 7:
4664
+ case 6:
4708
4665
  throw _t;
4709
- case 8:
4710
- _context.n = 9;
4666
+ case 7:
4667
+ _context.n = 8;
4711
4668
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4712
4669
  destination: destination
4713
4670
  }), {
4714
4671
  symbol: originAsset.symbol
4715
4672
  });
4716
- case 9:
4673
+ case 8:
4717
4674
  return _context.a(2, _context.v);
4718
4675
  }
4719
- }, _callee, null, [[3, 5]]);
4676
+ }, _callee, null, [[2, 4]]);
4720
4677
  }));
4721
4678
  return function calcPaymentInfoFee() {
4722
4679
  return _ref2.apply(this, arguments);
@@ -5143,7 +5100,7 @@ var validateAssetSupport = function validateAssetSupport(_ref, assetCheckEnabled
5143
5100
  var isRelayDestination = !sdkCommon.isTMultiLocation(destination) && sdkCommon.isRelayChain(destination);
5144
5101
  var isMultiLocationDestination = _typeof(destination) === 'object';
5145
5102
  if (!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !assets.hasSupportForAsset(destination, asset.symbol)) {
5146
- throw new assets.InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
5103
+ throw new assets.InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency, sdkCommon.replaceBigInt), "."));
5147
5104
  }
5148
5105
  if (!isBridge && asset === null && assetCheckEnabled) {
5149
5106
  throwUnsupportedCurrency(currency, origin);
@@ -5185,7 +5142,7 @@ var resolveOverriddenAsset = function resolveOverriddenAsset(options, isBridge,
5185
5142
  var assets$1 = currency.multiasset.map(function (currency) {
5186
5143
  var asset = assets.findAsset(origin, currency, !sdkCommon.isTMultiLocation(destination) ? destination : null);
5187
5144
  if (asset && !asset.multiLocation) {
5188
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " does not have a multiLocation"));
5145
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(currency, sdkCommon.replaceBigInt), " does not have a multiLocation"));
5189
5146
  }
5190
5147
  if (!asset) {
5191
5148
  throw new assets.InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(JSON.stringify(currency)));
@@ -6202,7 +6159,7 @@ var ParachainNode = /*#__PURE__*/function () {
6202
6159
  throw new DryRunFailedError(dryRunResult.origin.failureReason);
6203
6160
  case 5:
6204
6161
  // Pad fee by 50%
6205
- dryRunFeePadded = BigInt(dryRunResult.origin.fee) * BigInt(3) / BigInt(2);
6162
+ dryRunFeePadded = BigInt(dryRunResult.origin.fee) * 3n / 2n;
6206
6163
  dest = createDestination(scenario, version, destination, paraIdTo);
6207
6164
  call = {
6208
6165
  module: 'PolkadotXcm',
@@ -10354,7 +10311,6 @@ exports.getTransferableAmount = getTransferableAmount;
10354
10311
  exports.getTransferableAmountInternal = getTransferableAmountInternal;
10355
10312
  exports.getXcmFee = getXcmFee;
10356
10313
  exports.getXcmFeeEstimate = getXcmFeeEstimate;
10357
- exports.replaceBigInt = replaceBigInt;
10358
10314
  exports.resolveModuleError = resolveModuleError;
10359
10315
  exports.resolveParaId = resolveParaId;
10360
10316
  exports.reverseTransformMultiLocation = reverseTransformMultiLocation;
package/dist/index.d.ts CHANGED
@@ -1816,8 +1816,6 @@ declare const reverseTransformMultiLocation: (multiLocation: TMultiLocation) =>
1816
1816
  */
1817
1817
  declare const transformMultiLocation: (multiLocation: TMultiLocation) => TMultiLocation;
1818
1818
 
1819
- declare const replaceBigInt: (_key: string, value: unknown) => unknown;
1820
-
1821
1819
  declare const resolveParaId: (paraId: number | undefined, destination: TDestination) => number | undefined;
1822
1820
 
1823
1821
  declare const validateAddress: (address: TAddress, node: TNodeWithRelayChains, isDestination?: boolean) => void;
@@ -1830,5 +1828,5 @@ declare const validateAddress: (address: TAddress, node: TNodeWithRelayChains, i
1830
1828
  */
1831
1829
  declare const determineRelayChain: (node: TNodeWithRelayChains) => TRelaychain;
1832
1830
 
1833
- export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, blake2b256, blake2b512, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createApiInstanceForNode, createBeneficiary, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, deriveAccountId, determineRelayChain, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getFees, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, replaceBigInt, resolveModuleError, resolveParaId, reverseTransformMultiLocation, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };
1831
+ export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, blake2b256, blake2b512, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createApiInstanceForNode, createBeneficiary, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, deriveAccountId, determineRelayChain, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getFees, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, resolveModuleError, resolveParaId, reverseTransformMultiLocation, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };
1834
1832
  export type { IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimOptions, TAssetClaimOptionsBase, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TCreateBeneficiaryOptions, TDestWeight, TDestination, TDryRunBaseOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunNodeFailure, TDryRunNodeResult, TDryRunNodeResultInternal, TDryRunNodeSuccess, TDryRunOptions, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEdJsonMap, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmNodeFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestNodeBaseOptions, TGetFeeForDestNodeOptions, TGetMaxForeignTransferableAmountOptions, TGetMaxForeignTransferableAmountOptionsBase, TGetMaxNativeTransferableAmountOptions, TGetMaxNativeTransferableAmountOptionsBase, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodeConfig, TNodeConfigMap, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TRelaychain, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TTransferInfo, TTransferLocalOptions, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { blake2b } from '@noble/hashes/blake2';
2
- import { isNodeEvm, getAssetsObject, getNativeAssetSymbol, getOtherAssets, getRelayChainSymbol, InvalidCurrencyError, isForeignAsset, findAssetForNodeOrThrow, findAsset, isOverrideMultiLocationSpecifier, findAssetByMultiLocation, isTMultiAsset, getExistentialDeposit, isAssetEqual, findAssetOnDestOrThrow, normalizeSymbol, getExistentialDepositOrThrow, hasDryRunSupport, hasSupportForAsset, extractMultiAssetLoc, isSymbolSpecifier, normalizeMultiLocation, getAssetId } from '@paraspell/assets';
2
+ import { isNodeEvm, getAssetsObject, getNativeAssetSymbol, getOtherAssets, getRelayChainSymbol, InvalidCurrencyError, isForeignAsset, findAssetForNodeOrThrow, isOverrideMultiLocationSpecifier, findAssetByMultiLocation, findAsset, isTMultiAsset, getExistentialDeposit, getExistentialDepositOrThrow, isAssetEqual, findAssetOnDestOrThrow, normalizeSymbol, hasDryRunSupport, hasSupportForAsset, extractMultiAssetLoc, isSymbolSpecifier, normalizeMultiLocation, getAssetId } from '@paraspell/assets';
3
3
  export * from '@paraspell/assets';
4
4
  import { base58 } from '@scure/base';
5
5
  import { isAddress, createPublicClient, http, getContract } from 'viem';
6
- import { Parents, Version, isTMultiLocation, isRelayChain, NODE_NAMES_DOT_KSM, hasJunction, deepEqual, isDotKsmBridge } from '@paraspell/sdk-common';
6
+ import { Parents, Version, isTMultiLocation, isRelayChain, replaceBigInt, NODE_NAMES_DOT_KSM, hasJunction, deepEqual, isDotKsmBridge } from '@paraspell/sdk-common';
7
7
  export * from '@paraspell/sdk-common';
8
8
  import { getSupportedPalletsDetails, getDefaultPallet } from '@paraspell/pallets';
9
9
  export * from '@paraspell/pallets';
@@ -2400,10 +2400,6 @@ var getNode = function getNode(node) {
2400
2400
  return nodeMap[node];
2401
2401
  };
2402
2402
 
2403
- var replaceBigInt = function replaceBigInt(_key, value) {
2404
- return typeof value === 'bigint' ? value.toString() : value;
2405
- };
2406
-
2407
2403
  var resolveParaId = function resolveParaId(paraId, destination) {
2408
2404
  if (isTMultiLocation(destination) || isRelayChain(destination) || destination === 'Ethereum') {
2409
2405
  return undefined;
@@ -2592,7 +2588,7 @@ var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, node)
2592
2588
  if ('multilocation' in currency) {
2593
2589
  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), ")}."));
2594
2590
  }
2595
- throw new InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " node ").concat(node, " does not support currency ").concat(JSON.stringify(currency), "."));
2591
+ throw new InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " node ").concat(node, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
2596
2592
  };
2597
2593
 
2598
2594
  var resolveMultiLocationFromDest = function resolveMultiLocationFromDest(destination, asset) {
@@ -3373,29 +3369,23 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
3373
3369
  wallet: signer
3374
3370
  }
3375
3371
  });
3376
- foundAsset = findAsset(from, currency, to);
3377
- if (!(foundAsset === null)) {
3378
- _context.n = 3;
3379
- break;
3380
- }
3381
- throw new InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
3382
- case 3:
3372
+ foundAsset = findAssetForNodeOrThrow(from, currency, to);
3383
3373
  if (!(foundAsset.symbol === getNativeAssetSymbol(from))) {
3384
- _context.n = 4;
3374
+ _context.n = 3;
3385
3375
  break;
3386
3376
  }
3387
3377
  asset = NATIVE_ASSET_ID;
3388
- _context.n = 6;
3378
+ _context.n = 5;
3389
3379
  break;
3390
- case 4:
3380
+ case 3:
3391
3381
  if (!(!isForeignAsset(foundAsset) || !foundAsset.assetId)) {
3392
- _context.n = 5;
3382
+ _context.n = 4;
3393
3383
  break;
3394
3384
  }
3395
3385
  throw new InvalidCurrencyError('Currency must be a foreign asset with valid assetId');
3396
- case 5:
3386
+ case 4:
3397
3387
  asset = formatAssetIdToERC20(foundAsset.assetId);
3398
- case 6:
3388
+ case 5:
3399
3389
  destMultiLocation = getDestinationMultilocation(api, address, to);
3400
3390
  weight = U_64_MAX; // Partially inspired by Moonbeam XCM-SDK
3401
3391
  // https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
@@ -3405,27 +3395,27 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
3405
3395
  };
3406
3396
  multiCurrencySymbols = ['xcPINK', 'xcDED', 'xcSTINK', 'xcWIFD', 'xcNCTR'];
3407
3397
  useMultiAssets = from === 'Moonbeam' && to === 'AssetHubPolkadot' && multiCurrencySymbols.includes(foundAsset.symbol);
3408
- usdtAsset = findAsset(from, {
3398
+ usdtAsset = findAssetForNodeOrThrow(from, {
3409
3399
  symbol: 'xcUSDT'
3410
3400
  }, to);
3411
3401
  if (!useMultiAssets) {
3412
- _context.n = 8;
3402
+ _context.n = 7;
3413
3403
  break;
3414
3404
  }
3415
- _context.n = 7;
3405
+ _context.n = 6;
3416
3406
  return createTx('transferMultiCurrencies', [[[asset, currency.amount], [formatAssetIdToERC20((_usdtAsset$assetId = usdtAsset.assetId) !== null && _usdtAsset$assetId !== void 0 ? _usdtAsset$assetId : ''), '200000']], 1,
3417
3407
  // index of the fee asset
3418
3408
  destMultiLocation, weight]);
3419
- case 7:
3409
+ case 6:
3420
3410
  _t = _context.v;
3421
- _context.n = 10;
3422
- break;
3423
- case 8:
3424
3411
  _context.n = 9;
3412
+ break;
3413
+ case 7:
3414
+ _context.n = 8;
3425
3415
  return createTx('transfer', [asset, currency.amount, destMultiLocation, weight]);
3426
- case 9:
3416
+ case 8:
3427
3417
  _t = _context.v;
3428
- case 10:
3418
+ case 9:
3429
3419
  tx = _t;
3430
3420
  return _context.a(2, tx);
3431
3421
  }
@@ -3697,26 +3687,20 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3697
3687
  }
3698
3688
  throw new InvalidParameterError('Override multilocation is not supported for Evm transfers');
3699
3689
  case 5:
3700
- foundAsset = findAsset(from, currency, to);
3701
- if (!(foundAsset === null)) {
3702
- _context.n = 6;
3703
- break;
3704
- }
3705
- throw new InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
3706
- case 6:
3690
+ foundAsset = findAssetForNodeOrThrow(from, currency, to);
3707
3691
  if (!(!isForeignAsset(foundAsset) || !foundAsset.multiLocation)) {
3708
- _context.n = 7;
3692
+ _context.n = 6;
3709
3693
  break;
3710
3694
  }
3711
3695
  throw new InvalidCurrencyError('Currency must be a foreign asset with valid multi-location');
3712
- case 7:
3696
+ case 6:
3713
3697
  ethAsset = findAssetByMultiLocation(getOtherAssets('Ethereum'), foundAsset.multiLocation);
3714
3698
  if (!(!ethAsset || !ethAsset.assetId)) {
3715
- _context.n = 8;
3699
+ _context.n = 7;
3716
3700
  break;
3717
3701
  }
3718
3702
  throw new InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(foundAsset)));
3719
- case 8:
3703
+ case 7:
3720
3704
  contract = getContract({
3721
3705
  abi: abi,
3722
3706
  address: xcmInterfacePrecompile,
@@ -3730,17 +3714,17 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3730
3714
  });
3731
3715
  senderAddress = (_signer$account = signer.account) === null || _signer$account === void 0 ? void 0 : _signer$account.address;
3732
3716
  if (senderAddress) {
3733
- _context.n = 9;
3717
+ _context.n = 8;
3734
3718
  break;
3735
3719
  }
3736
3720
  throw new InvalidParameterError('Unable to get sender address');
3721
+ case 8:
3722
+ _context.n = 9;
3723
+ return api.init(from, TX_CLIENT_TIMEOUT_MS);
3737
3724
  case 9:
3738
3725
  _context.n = 10;
3739
- return api.init(from, TX_CLIENT_TIMEOUT_MS);
3740
- case 10:
3741
- _context.n = 11;
3742
3726
  return generateMessageId(api, senderAddress, getParaId(from), ethAsset.assetId, address, currency.amount);
3743
- case 11:
3727
+ case 10:
3744
3728
  messageId = _context.v;
3745
3729
  customXcm = createCustomXcmOnDest({
3746
3730
  api: api,
@@ -3753,17 +3737,17 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3753
3737
  }),
3754
3738
  version: Version.V4
3755
3739
  }, from, messageId);
3756
- _context.n = 12;
3740
+ _context.n = 11;
3757
3741
  return api.objectToHex(customXcm, 'XcmVersionedXcm');
3758
- case 12:
3742
+ case 11:
3759
3743
  customXcmOnDest = _context.v;
3760
- _context.n = 13;
3744
+ _context.n = 12;
3761
3745
  return api.createApiForNode('AssetHubPolkadot');
3762
- case 13:
3746
+ case 12:
3763
3747
  assetHubApi = _context.v;
3764
- _context.n = 14;
3748
+ _context.n = 13;
3765
3749
  return getParaEthTransferFees(assetHubApi);
3766
- case 14:
3750
+ case 13:
3767
3751
  _yield$getParaEthTran = _context.v;
3768
3752
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
3769
3753
  bridgeFee = _yield$getParaEthTran2[0];
@@ -3778,7 +3762,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3778
3762
  throw new InvalidParameterError('Input must be a valid number');
3779
3763
  }() : "0x".concat((num >>> 0).toString(16).padStart(8, '0'));
3780
3764
  }; // Execute the custom XCM message with the precompile
3781
- _context.n = 15;
3765
+ _context.n = 14;
3782
3766
  return createTx('transferAssetsUsingTypeAndThenAddress', [
3783
3767
  // This represents (1,X1(Parachain(1000)))
3784
3768
  [1, ['0x00' + numberToHex32(getParaId('AssetHubPolkadot')).slice(2)]],
@@ -3790,7 +3774,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
3790
3774
  0,
3791
3775
  // The TransferType corresponding to fee asset
3792
3776
  2, customXcmOnDest]);
3793
- case 15:
3777
+ case 14:
3794
3778
  tx = _context.v;
3795
3779
  return _context.a(2, tx);
3796
3780
  }
@@ -3949,7 +3933,7 @@ var getOriginFeeDetails = /*#__PURE__*/function () {
3949
3933
 
3950
3934
  var getTransferableAmountInternal = /*#__PURE__*/function () {
3951
3935
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
3952
- var api, senderAddress, node, destination, currency, tx, feeAsset, resolvedFeeAsset, asset, balance, ed, edBN, isNativeAsset, shouldSubstractFee, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
3936
+ var api, senderAddress, node, destination, currency, tx, feeAsset, resolvedFeeAsset, asset, balance, ed, isNativeAsset, shouldSubstractFee, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
3953
3937
  return _regenerator().w(function (_context) {
3954
3938
  while (1) switch (_context.n) {
3955
3939
  case 0:
@@ -3966,22 +3950,15 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
3966
3950
  });
3967
3951
  case 1:
3968
3952
  balance = _context.v;
3969
- ed = getExistentialDeposit(node, currency);
3970
- if (!(ed === null)) {
3971
- _context.n = 2;
3972
- break;
3973
- }
3974
- throw new InvalidParameterError("Cannot get existential deposit for currency ".concat(JSON.stringify(currency), "."));
3975
- case 2:
3976
- edBN = BigInt(ed);
3953
+ ed = getExistentialDepositOrThrow(node, currency);
3977
3954
  isNativeAsset = getNativeAssetSymbol(node) === asset.symbol;
3978
3955
  shouldSubstractFee = isNativeAsset || node === 'AssetHubPolkadot' && resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, asset);
3979
3956
  feeToSubtract = 0n;
3980
3957
  if (!shouldSubstractFee) {
3981
- _context.n = 5;
3958
+ _context.n = 4;
3982
3959
  break;
3983
3960
  }
3984
- _context.n = 3;
3961
+ _context.n = 2;
3985
3962
  return getOriginXcmFee({
3986
3963
  api: api,
3987
3964
  tx: tx,
@@ -3992,18 +3969,18 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
3992
3969
  currency: currency,
3993
3970
  disableFallback: false
3994
3971
  });
3995
- case 3:
3972
+ case 2:
3996
3973
  _yield$getOriginXcmFe = _context.v;
3997
3974
  fee = _yield$getOriginXcmFe.fee;
3998
3975
  if (!(fee === undefined)) {
3999
- _context.n = 4;
3976
+ _context.n = 3;
4000
3977
  break;
4001
3978
  }
4002
- throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(node, "."));
4003
- case 4:
3979
+ throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency, replaceBigInt), " on node ").concat(node, "."));
3980
+ case 3:
4004
3981
  feeToSubtract = fee;
4005
- case 5:
4006
- transferable = balance - edBN - feeToSubtract;
3982
+ case 4:
3983
+ transferable = balance - ed - feeToSubtract;
4007
3984
  return _context.a(2, transferable > 0n ? transferable : 0n);
4008
3985
  }
4009
3986
  }, _callee);
@@ -4063,7 +4040,7 @@ var buildDestInfo = /*#__PURE__*/function () {
4063
4040
  _context.n = 2;
4064
4041
  break;
4065
4042
  }
4066
- throw new InvalidParameterError("Existential deposit not found for ".concat(destination, " with currency ").concat(JSON.stringify(currency)));
4043
+ throw new InvalidParameterError("Existential deposit not found for ".concat(destination, " with currency ").concat(JSON.stringify(currency, replaceBigInt)));
4067
4044
  case 2:
4068
4045
  edDestBn = BigInt(edDest);
4069
4046
  destCurrency = destAsset.multiLocation ? {
@@ -4241,7 +4218,7 @@ var buildHopInfo = /*#__PURE__*/function () {
4241
4218
 
4242
4219
  var getTransferInfo = /*#__PURE__*/function () {
4243
4220
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
4244
- var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, originBalanceFee, originBalance, edOrigin, edOriginBn, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubNode, destinationInfo, _t;
4221
+ var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubNode, destinationInfo, _t;
4245
4222
  return _regenerator().w(function (_context) {
4246
4223
  while (1) switch (_context.n) {
4247
4224
  case 0:
@@ -4294,15 +4271,8 @@ var getTransferInfo = /*#__PURE__*/function () {
4294
4271
  });
4295
4272
  case 8:
4296
4273
  originBalance = _context.v;
4297
- edOrigin = getExistentialDeposit(origin, currency);
4298
- if (edOrigin) {
4299
- _context.n = 9;
4300
- break;
4301
- }
4302
- throw new InvalidParameterError("Existential deposit not found for ".concat(origin, " with currency ").concat(JSON.stringify(currency)));
4303
- case 9:
4304
- edOriginBn = BigInt(edOrigin);
4305
- _context.n = 10;
4274
+ edOrigin = getExistentialDepositOrThrow(origin, currency);
4275
+ _context.n = 9;
4306
4276
  return getXcmFee({
4307
4277
  api: api,
4308
4278
  tx: tx,
@@ -4314,7 +4284,7 @@ var getTransferInfo = /*#__PURE__*/function () {
4314
4284
  feeAsset: feeAsset,
4315
4285
  disableFallback: false
4316
4286
  });
4317
- case 10:
4287
+ case 9:
4318
4288
  _yield$getXcmFee = _context.v;
4319
4289
  _yield$getXcmFee$orig = _yield$getXcmFee.origin;
4320
4290
  originFee = _yield$getXcmFee$orig.fee;
@@ -4323,21 +4293,21 @@ var getTransferInfo = /*#__PURE__*/function () {
4323
4293
  bridgeHubFeeResult = _yield$getXcmFee.bridgeHub;
4324
4294
  destFeeDetail = _yield$getXcmFee.destination;
4325
4295
  if (!(originFee === undefined)) {
4326
- _context.n = 11;
4296
+ _context.n = 10;
4327
4297
  break;
4328
4298
  }
4329
- throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(origin, "."));
4330
- case 11:
4299
+ throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency, replaceBigInt), " on node ").concat(origin, "."));
4300
+ case 10:
4331
4301
  isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, originAsset);
4332
4302
  originBalanceAfter = originBalance - BigInt(currency.amount);
4333
4303
  originBalanceFeeAfter = isFeeAssetAh ? originBalanceFee - BigInt(currency.amount) : originBalanceFee - originFee;
4334
4304
  originBalanceNativeSufficient = originBalanceFee >= originFee;
4335
- originBalanceSufficient = originBalanceAfter >= edOriginBn;
4305
+ originBalanceSufficient = originBalanceAfter >= edOrigin;
4336
4306
  if (!assetHubFeeResult) {
4337
- _context.n = 13;
4307
+ _context.n = 12;
4338
4308
  break;
4339
4309
  }
4340
- _context.n = 12;
4310
+ _context.n = 11;
4341
4311
  return buildHopInfo({
4342
4312
  api: api,
4343
4313
  node: determineRelayChain(origin) === 'Polkadot' ? 'AssetHubPolkadot' : 'AssetHubKusama',
@@ -4347,15 +4317,15 @@ var getTransferInfo = /*#__PURE__*/function () {
4347
4317
  senderAddress: senderAddress,
4348
4318
  ahAddress: ahAddress
4349
4319
  });
4350
- case 12:
4320
+ case 11:
4351
4321
  assetHub = _context.v;
4352
- case 13:
4322
+ case 12:
4353
4323
  if (!bridgeHubFeeResult) {
4354
- _context.n = 15;
4324
+ _context.n = 14;
4355
4325
  break;
4356
4326
  }
4357
4327
  bridgeHubNode = determineRelayChain(origin) === 'Polkadot' ? 'BridgeHubPolkadot' : 'BridgeHubKusama';
4358
- _context.n = 14;
4328
+ _context.n = 13;
4359
4329
  return buildHopInfo({
4360
4330
  api: api,
4361
4331
  node: bridgeHubNode,
@@ -4365,10 +4335,10 @@ var getTransferInfo = /*#__PURE__*/function () {
4365
4335
  senderAddress: senderAddress,
4366
4336
  ahAddress: ahAddress
4367
4337
  });
4368
- case 14:
4338
+ case 13:
4369
4339
  bridgeHub = _context.v;
4370
- case 15:
4371
- _context.n = 16;
4340
+ case 14:
4341
+ _context.n = 15;
4372
4342
  return buildDestInfo({
4373
4343
  api: api,
4374
4344
  origin: origin,
@@ -4381,7 +4351,7 @@ var getTransferInfo = /*#__PURE__*/function () {
4381
4351
  assetHubFee: assetHubFeeResult === null || assetHubFeeResult === void 0 ? void 0 : assetHubFeeResult.fee,
4382
4352
  bridgeFee: bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.fee
4383
4353
  });
4384
- case 16:
4354
+ case 15:
4385
4355
  destinationInfo = _context.v;
4386
4356
  return _context.a(2, {
4387
4357
  chain: {
@@ -4395,7 +4365,7 @@ var getTransferInfo = /*#__PURE__*/function () {
4395
4365
  balance: originBalance,
4396
4366
  balanceAfter: originBalanceAfter,
4397
4367
  currencySymbol: originAsset.symbol,
4398
- existentialDeposit: edOriginBn
4368
+ existentialDeposit: edOrigin
4399
4369
  },
4400
4370
  xcmFee: {
4401
4371
  sufficient: originBalanceNativeSufficient,
@@ -4409,17 +4379,17 @@ var getTransferInfo = /*#__PURE__*/function () {
4409
4379
  bridgeHub: bridgeHub,
4410
4380
  destination: destinationInfo
4411
4381
  });
4412
- case 17:
4413
- _context.p = 17;
4382
+ case 16:
4383
+ _context.p = 16;
4414
4384
  api.setDisconnectAllowed(true);
4415
- _context.n = 18;
4385
+ _context.n = 17;
4416
4386
  return api.disconnect();
4387
+ case 17:
4388
+ return _context.f(16);
4417
4389
  case 18:
4418
- return _context.f(17);
4419
- case 19:
4420
4390
  return _context.a(2);
4421
4391
  }
4422
- }, _callee, null, [[3,, 17, 19]]);
4392
+ }, _callee, null, [[3,, 16, 18]]);
4423
4393
  }));
4424
4394
  return function getTransferInfo(_x) {
4425
4395
  return _ref2.apply(this, arguments);
@@ -4439,7 +4409,7 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
4439
4409
  };
4440
4410
  var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
4441
4411
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
4442
- var api, tx, origin, destination, address, senderAddress, feeAsset, currency, destApi, asset, destCurrency, ed, edBN, balance, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, totalFee, method, feeToSubtract;
4412
+ var api, tx, origin, destination, address, senderAddress, feeAsset, currency, destApi, asset, destCurrency, ed, balance, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, totalFee, method, feeToSubtract;
4443
4413
  return _regenerator().w(function (_context) {
4444
4414
  while (1) switch (_context.n) {
4445
4415
  case 0:
@@ -4473,24 +4443,17 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
4473
4443
  } : {
4474
4444
  symbol: asset.symbol
4475
4445
  };
4476
- ed = getExistentialDeposit(destination, destCurrency);
4477
- if (!(ed === null)) {
4478
- _context.n = 5;
4479
- break;
4480
- }
4481
- throw new InvalidParameterError("Cannot get existential deposit for currency ".concat(JSON.stringify(currency)));
4482
- case 5:
4483
- edBN = BigInt(ed);
4484
- _context.n = 6;
4446
+ ed = getExistentialDepositOrThrow(destination, destCurrency);
4447
+ _context.n = 5;
4485
4448
  return getAssetBalanceInternal({
4486
4449
  address: address,
4487
4450
  node: destination,
4488
4451
  api: destApi,
4489
4452
  currency: destCurrency
4490
4453
  });
4491
- case 6:
4454
+ case 5:
4492
4455
  balance = _context.v;
4493
- _context.n = 7;
4456
+ _context.n = 6;
4494
4457
  return getXcmFee({
4495
4458
  api: api,
4496
4459
  tx: tx,
@@ -4502,40 +4465,40 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
4502
4465
  feeAsset: feeAsset,
4503
4466
  disableFallback: false
4504
4467
  });
4505
- case 7:
4468
+ case 6:
4506
4469
  xcmFeeResult = _context.v;
4507
4470
  dryRunError = xcmFeeResult.origin.dryRunError, assetHubFeeResult = xcmFeeResult.assetHub, bridgeHubFeeResult = xcmFeeResult.bridgeHub, _xcmFeeResult$destina = xcmFeeResult.destination, destFee = _xcmFeeResult$destina.fee, destFeeCurrency = _xcmFeeResult$destina.currency, destDryRunError = _xcmFeeResult$destina.dryRunError;
4508
4471
  if (!(destFee === undefined)) {
4509
- _context.n = 8;
4472
+ _context.n = 7;
4510
4473
  break;
4511
4474
  }
4512
- throw new InvalidParameterError("Cannot get destination xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(destination, "."));
4513
- case 8:
4475
+ throw new InvalidParameterError("Cannot get destination xcm fee for currency ".concat(JSON.stringify(currency, replaceBigInt), " on node ").concat(destination, "."));
4476
+ case 7:
4514
4477
  if (!dryRunError) {
4515
- _context.n = 9;
4478
+ _context.n = 8;
4516
4479
  break;
4517
4480
  }
4518
4481
  throw new DryRunFailedError(dryRunError, 'origin');
4519
- case 9:
4482
+ case 8:
4520
4483
  hopDryRunError = (assetHubFeeResult === null || assetHubFeeResult === void 0 ? void 0 : assetHubFeeResult.dryRunError) || (bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.dryRunError);
4521
4484
  if (!hopDryRunError) {
4522
- _context.n = 10;
4485
+ _context.n = 9;
4523
4486
  break;
4524
4487
  }
4525
4488
  throw new DryRunFailedError(hopDryRunError, assetHubFeeResult !== null && assetHubFeeResult !== void 0 && assetHubFeeResult.dryRunError ? 'assetHub' : 'bridgeHub');
4526
- case 10:
4489
+ case 9:
4527
4490
  if (!destDryRunError) {
4528
- _context.n = 11;
4491
+ _context.n = 10;
4529
4492
  break;
4530
4493
  }
4531
4494
  throw new UnableToComputeError("Unable to compute fee for the destination asset. Destination dry run error: ".concat(destDryRunError));
4532
- case 11:
4495
+ case 10:
4533
4496
  if (!(normalizeSymbol(asset.symbol) !== normalizeSymbol(destFeeCurrency))) {
4534
- _context.n = 12;
4497
+ _context.n = 11;
4535
4498
  break;
4536
4499
  }
4537
4500
  throw new UnableToComputeError("The XCM fee could not be calculated because the origin or destination chain does not support DryRun.\n As a result, fee estimation is only available through PaymentInfo, which provides the cost in the native asset.\n This limitation restricts support to transfers involving the native asset of the Destination chain only.");
4538
- case 12:
4501
+ case 11:
4539
4502
  totalFee = calculateTotalXcmFee(xcmFeeResult);
4540
4503
  method = api.getMethod(tx);
4541
4504
  if (method === 'transfer_assets_using_type_and_then' || method === 'transferAssetsUsingTypeAndThen') {
@@ -4543,7 +4506,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
4543
4506
  } else {
4544
4507
  feeToSubtract = destFee;
4545
4508
  }
4546
- return _context.a(2, BigInt(currency.amount) - feeToSubtract > (balance < edBN ? edBN : 0));
4509
+ return _context.a(2, BigInt(currency.amount) - feeToSubtract > (balance < ed ? ed : 0));
4547
4510
  }
4548
4511
  }, _callee);
4549
4512
  }));
@@ -4670,54 +4633,48 @@ var getDestXcmFee = /*#__PURE__*/function () {
4670
4633
  }
4671
4634
  return _context.a(2, 0n);
4672
4635
  case 1:
4673
- originAsset = findAsset(origin, currency, destination);
4674
- if (originAsset) {
4675
- _context.n = 2;
4676
- break;
4677
- }
4678
- throw new InvalidCurrencyError("Currency ".concat(JSON.stringify(currency, replaceBigInt), " not found in ").concat(origin));
4679
- case 2:
4636
+ originAsset = findAssetForNodeOrThrow(origin, currency, destination);
4680
4637
  if (!originAsset.multiLocation) {
4681
- _context.n = 8;
4638
+ _context.n = 7;
4682
4639
  break;
4683
4640
  }
4684
- _context.p = 3;
4685
- _context.n = 4;
4641
+ _context.p = 2;
4642
+ _context.n = 3;
4686
4643
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4687
4644
  destination: destination
4688
4645
  }), {
4689
4646
  multilocation: originAsset.multiLocation
4690
4647
  });
4691
- case 4:
4648
+ case 3:
4692
4649
  return _context.a(2, _context.v);
4693
- case 5:
4694
- _context.p = 5;
4650
+ case 4:
4651
+ _context.p = 4;
4695
4652
  _t = _context.v;
4696
4653
  if (!(_t instanceof InvalidCurrencyError)) {
4697
- _context.n = 7;
4654
+ _context.n = 6;
4698
4655
  break;
4699
4656
  }
4700
- _context.n = 6;
4657
+ _context.n = 5;
4701
4658
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4702
4659
  destination: destination
4703
4660
  }), {
4704
4661
  symbol: originAsset.symbol
4705
4662
  });
4706
- case 6:
4663
+ case 5:
4707
4664
  return _context.a(2, _context.v);
4708
- case 7:
4665
+ case 6:
4709
4666
  throw _t;
4710
- case 8:
4711
- _context.n = 9;
4667
+ case 7:
4668
+ _context.n = 8;
4712
4669
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4713
4670
  destination: destination
4714
4671
  }), {
4715
4672
  symbol: originAsset.symbol
4716
4673
  });
4717
- case 9:
4674
+ case 8:
4718
4675
  return _context.a(2, _context.v);
4719
4676
  }
4720
- }, _callee, null, [[3, 5]]);
4677
+ }, _callee, null, [[2, 4]]);
4721
4678
  }));
4722
4679
  return function calcPaymentInfoFee() {
4723
4680
  return _ref2.apply(this, arguments);
@@ -5144,7 +5101,7 @@ var validateAssetSupport = function validateAssetSupport(_ref, assetCheckEnabled
5144
5101
  var isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
5145
5102
  var isMultiLocationDestination = _typeof(destination) === 'object';
5146
5103
  if (!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !hasSupportForAsset(destination, asset.symbol)) {
5147
- throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
5104
+ throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
5148
5105
  }
5149
5106
  if (!isBridge && asset === null && assetCheckEnabled) {
5150
5107
  throwUnsupportedCurrency(currency, origin);
@@ -5186,7 +5143,7 @@ var resolveOverriddenAsset = function resolveOverriddenAsset(options, isBridge,
5186
5143
  var assets = currency.multiasset.map(function (currency) {
5187
5144
  var asset = findAsset(origin, currency, !isTMultiLocation(destination) ? destination : null);
5188
5145
  if (asset && !asset.multiLocation) {
5189
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " does not have a multiLocation"));
5146
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency, replaceBigInt), " does not have a multiLocation"));
5190
5147
  }
5191
5148
  if (!asset) {
5192
5149
  throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(JSON.stringify(currency)));
@@ -6203,7 +6160,7 @@ var ParachainNode = /*#__PURE__*/function () {
6203
6160
  throw new DryRunFailedError(dryRunResult.origin.failureReason);
6204
6161
  case 5:
6205
6162
  // Pad fee by 50%
6206
- dryRunFeePadded = BigInt(dryRunResult.origin.fee) * BigInt(3) / BigInt(2);
6163
+ dryRunFeePadded = BigInt(dryRunResult.origin.fee) * 3n / 2n;
6207
6164
  dest = createDestination(scenario, version, destination, paraIdTo);
6208
6165
  call = {
6209
6166
  module: 'PolkadotXcm',
@@ -10299,4 +10256,4 @@ var Builder = function Builder(api) {
10299
10256
  return new GeneralBuilder(api, new BatchTransactionManager());
10300
10257
  };
10301
10258
 
10302
- export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, blake2b256, blake2b512, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createApiInstanceForNode, createBeneficiary, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, deriveAccountId, determineRelayChain, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getFees, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, replaceBigInt, resolveModuleError, resolveParaId, reverseTransformMultiLocation, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };
10259
+ export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, blake2b256, blake2b512, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createApiInstanceForNode, createBeneficiary, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, deriveAccountId, determineRelayChain, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getFees, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, resolveModuleError, resolveParaId, reverseTransformMultiLocation, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "10.4.7",
3
+ "version": "10.4.8",
4
4
  "description": "SDK core for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,9 +26,9 @@
26
26
  "@noble/hashes": "^1.8.0",
27
27
  "@scure/base": "^1.2.6",
28
28
  "viem": "^2.30.5",
29
- "@paraspell/assets": "10.4.7",
30
- "@paraspell/pallets": "10.4.7",
31
- "@paraspell/sdk-common": "10.4.7"
29
+ "@paraspell/assets": "10.4.8",
30
+ "@paraspell/sdk-common": "10.4.8",
31
+ "@paraspell/pallets": "10.4.8"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/plugin-syntax-import-attributes": "^7.27.1",