@paraspell/sdk-core 11.8.4 → 11.8.5
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 +148 -68
- package/dist/index.mjs +149 -69
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -3695,6 +3695,44 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3695
3695
|
};
|
|
3696
3696
|
}();
|
|
3697
3697
|
|
|
3698
|
+
var getMythosOriginFee = /*#__PURE__*/function () {
|
|
3699
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api) {
|
|
3700
|
+
var ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, ahExecutionFee, nativeAsset, feeConverted;
|
|
3701
|
+
return _regenerator().w(function (_context) {
|
|
3702
|
+
while (1) switch (_context.n) {
|
|
3703
|
+
case 0:
|
|
3704
|
+
ahApi = api.clone();
|
|
3705
|
+
_context.n = 1;
|
|
3706
|
+
return ahApi.init('AssetHubPolkadot');
|
|
3707
|
+
case 1:
|
|
3708
|
+
_context.n = 2;
|
|
3709
|
+
return getParaEthTransferFees(ahApi);
|
|
3710
|
+
case 2:
|
|
3711
|
+
_yield$getParaEthTran = _context.v;
|
|
3712
|
+
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
3713
|
+
bridgeFee = _yield$getParaEthTran2[0];
|
|
3714
|
+
ahExecutionFee = _yield$getParaEthTran2[1];
|
|
3715
|
+
nativeAsset = assets.findNativeAssetInfoOrThrow('Mythos');
|
|
3716
|
+
assertHasLocation(nativeAsset);
|
|
3717
|
+
_context.n = 3;
|
|
3718
|
+
return ahApi.quoteAhPrice(DOT_LOCATION, nativeAsset.location, bridgeFee + ahExecutionFee);
|
|
3719
|
+
case 3:
|
|
3720
|
+
feeConverted = _context.v;
|
|
3721
|
+
if (feeConverted) {
|
|
3722
|
+
_context.n = 4;
|
|
3723
|
+
break;
|
|
3724
|
+
}
|
|
3725
|
+
throw new InvalidParameterError("Pool DOT -> ".concat(nativeAsset.symbol, " not found."));
|
|
3726
|
+
case 4:
|
|
3727
|
+
return _context.a(2, padFeeBy(feeConverted, 10));
|
|
3728
|
+
}
|
|
3729
|
+
}, _callee);
|
|
3730
|
+
}));
|
|
3731
|
+
return function getMythosOriginFee(_x) {
|
|
3732
|
+
return _ref.apply(this, arguments);
|
|
3733
|
+
};
|
|
3734
|
+
}();
|
|
3735
|
+
|
|
3698
3736
|
var resolveFeeAsset = function resolveFeeAsset(feeAsset, origin, destination, currency) {
|
|
3699
3737
|
var asset = assets.findAssetInfo(origin, feeAsset, !sdkCommon.isTLocation(destination) ? destination : null);
|
|
3700
3738
|
var usesRawOverriddenMultiAssets = Array.isArray(currency) && currency.every(assets.isTAsset);
|
|
@@ -5308,7 +5346,7 @@ var getFailureInfo$1 = function getFailureInfo(results, hops) {
|
|
|
5308
5346
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
5309
5347
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5310
5348
|
var _traversalResult$brid;
|
|
5311
|
-
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, initialForwardedXcms, initialDestParaId, processHop, traversalResult, assetHubChain, bridgeHubChain, processedBridgeHub, bridgeHubHopIndex, bridgeHubWithCurrency, _getFailureInfo, failureReason, failureChain, _t;
|
|
5349
|
+
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, isMythosToEthereum, originDryModified, initialForwardedXcms, initialDestParaId, processHop, traversalResult, assetHubChain, bridgeHubChain, processedBridgeHub, bridgeHubHopIndex, bridgeHubWithCurrency, _getFailureInfo, failureReason, failureChain, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
5312
5350
|
return _regenerator().w(function (_context2) {
|
|
5313
5351
|
while (1) switch (_context2.n) {
|
|
5314
5352
|
case 0:
|
|
@@ -5342,7 +5380,30 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5342
5380
|
hops: []
|
|
5343
5381
|
});
|
|
5344
5382
|
case 2:
|
|
5345
|
-
|
|
5383
|
+
isMythosToEthereum = origin === 'Mythos' && destination === 'Ethereum';
|
|
5384
|
+
if (!isMythosToEthereum) {
|
|
5385
|
+
_context2.n = 4;
|
|
5386
|
+
break;
|
|
5387
|
+
}
|
|
5388
|
+
_t2 = _objectSpread2;
|
|
5389
|
+
_t3 = _objectSpread2({}, originDryRun);
|
|
5390
|
+
_t4 = {};
|
|
5391
|
+
_t5 = originDryRun.fee;
|
|
5392
|
+
_context2.n = 3;
|
|
5393
|
+
return getMythosOriginFee(api);
|
|
5394
|
+
case 3:
|
|
5395
|
+
_t6 = _context2.v;
|
|
5396
|
+
_t7 = _t5 + _t6;
|
|
5397
|
+
_t = _t2(_t3, _t4, {
|
|
5398
|
+
fee: _t7
|
|
5399
|
+
});
|
|
5400
|
+
_context2.n = 5;
|
|
5401
|
+
break;
|
|
5402
|
+
case 4:
|
|
5403
|
+
_t = originDryRun;
|
|
5404
|
+
case 5:
|
|
5405
|
+
originDryModified = _t;
|
|
5406
|
+
initialForwardedXcms = originDryModified.forwardedXcms, initialDestParaId = originDryModified.destParaId;
|
|
5346
5407
|
processHop = /*#__PURE__*/function () {
|
|
5347
5408
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
5348
5409
|
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, isDestination, hopAsset, hopDryRun;
|
|
@@ -5379,7 +5440,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5379
5440
|
origin: currentOrigin,
|
|
5380
5441
|
asset: hopAsset,
|
|
5381
5442
|
feeAsset: resolvedFeeAsset,
|
|
5382
|
-
originFee:
|
|
5443
|
+
originFee: originDryModified.fee,
|
|
5383
5444
|
amount: amount
|
|
5384
5445
|
});
|
|
5385
5446
|
case 2:
|
|
@@ -5395,7 +5456,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5395
5456
|
return _ref2.apply(this, arguments);
|
|
5396
5457
|
};
|
|
5397
5458
|
}();
|
|
5398
|
-
_context2.n =
|
|
5459
|
+
_context2.n = 6;
|
|
5399
5460
|
return traverseXcmHops({
|
|
5400
5461
|
api: api,
|
|
5401
5462
|
origin: origin,
|
|
@@ -5415,25 +5476,35 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5415
5476
|
};
|
|
5416
5477
|
}
|
|
5417
5478
|
});
|
|
5418
|
-
case
|
|
5479
|
+
case 6:
|
|
5419
5480
|
traversalResult = _context2.v;
|
|
5420
5481
|
// Process Ethereum bridge fees
|
|
5421
5482
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
5422
|
-
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
5483
|
+
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin)); // For Mythos → Ethereum, we skip additional Ethereum bridge fees (aligns with getXcmFeeInternal)
|
|
5484
|
+
if (!isMythosToEthereum) {
|
|
5485
|
+
_context2.n = 7;
|
|
5486
|
+
break;
|
|
5487
|
+
}
|
|
5488
|
+
_t8 = traversalResult.bridgeHub;
|
|
5489
|
+
_context2.n = 11;
|
|
5490
|
+
break;
|
|
5491
|
+
case 7:
|
|
5423
5492
|
if (!((_traversalResult$brid = traversalResult.bridgeHub) !== null && _traversalResult$brid !== void 0 && _traversalResult$brid.success)) {
|
|
5424
|
-
_context2.n =
|
|
5493
|
+
_context2.n = 9;
|
|
5425
5494
|
break;
|
|
5426
5495
|
}
|
|
5427
|
-
_context2.n =
|
|
5496
|
+
_context2.n = 8;
|
|
5428
5497
|
return addEthereumBridgeFees(api, traversalResult.bridgeHub, destination, assetHubChain);
|
|
5429
|
-
case
|
|
5430
|
-
|
|
5431
|
-
_context2.n =
|
|
5498
|
+
case 8:
|
|
5499
|
+
_t9 = _context2.v;
|
|
5500
|
+
_context2.n = 10;
|
|
5432
5501
|
break;
|
|
5433
|
-
case
|
|
5434
|
-
|
|
5435
|
-
case
|
|
5436
|
-
|
|
5502
|
+
case 9:
|
|
5503
|
+
_t9 = traversalResult.bridgeHub;
|
|
5504
|
+
case 10:
|
|
5505
|
+
_t8 = _t9;
|
|
5506
|
+
case 11:
|
|
5507
|
+
processedBridgeHub = _t8;
|
|
5437
5508
|
// Update bridge hub in hops if needed
|
|
5438
5509
|
if (processedBridgeHub && processedBridgeHub.success && traversalResult.bridgeHub && traversalResult.bridgeHub.success && processedBridgeHub.fee !== traversalResult.bridgeHub.fee) {
|
|
5439
5510
|
bridgeHubHopIndex = traversalResult.hops.findIndex(function (hop) {
|
|
@@ -5457,7 +5528,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5457
5528
|
return _context2.a(2, {
|
|
5458
5529
|
failureReason: failureReason,
|
|
5459
5530
|
failureChain: failureChain,
|
|
5460
|
-
origin:
|
|
5531
|
+
origin: originDryModified,
|
|
5461
5532
|
assetHub: traversalResult.assetHub,
|
|
5462
5533
|
bridgeHub: bridgeHubWithCurrency,
|
|
5463
5534
|
destination: traversalResult.destination,
|
|
@@ -8884,7 +8955,7 @@ var Moonriver = /*#__PURE__*/function (_Parachain) {
|
|
|
8884
8955
|
|
|
8885
8956
|
var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
8886
8957
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, chain, version) {
|
|
8887
|
-
var api, asset, senderAddress, address, destination, messageId,
|
|
8958
|
+
var api, asset, senderAddress, address, destination, messageId, nativeMythAmount;
|
|
8888
8959
|
return _regenerator().w(function (_context) {
|
|
8889
8960
|
while (1) switch (_context.n) {
|
|
8890
8961
|
case 0:
|
|
@@ -8902,28 +8973,10 @@ var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
|
8902
8973
|
return generateMessageId(api, senderAddress, getParaId(chain), asset.assetId, address, asset.amount);
|
|
8903
8974
|
case 2:
|
|
8904
8975
|
messageId = _context.v;
|
|
8905
|
-
ahApi = api.clone();
|
|
8906
8976
|
_context.n = 3;
|
|
8907
|
-
return
|
|
8977
|
+
return getMythosOriginFee(api);
|
|
8908
8978
|
case 3:
|
|
8909
|
-
|
|
8910
|
-
return getParaEthTransferFees(ahApi);
|
|
8911
|
-
case 4:
|
|
8912
|
-
_yield$getParaEthTran = _context.v;
|
|
8913
|
-
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
8914
|
-
bridgeFee = _yield$getParaEthTran2[0];
|
|
8915
|
-
ahExecutionFee = _yield$getParaEthTran2[1];
|
|
8916
|
-
_context.n = 5;
|
|
8917
|
-
return ahApi.quoteAhPrice(DOT_LOCATION, assets.getNativeAssets(chain)[0].location, bridgeFee + ahExecutionFee);
|
|
8918
|
-
case 5:
|
|
8919
|
-
feeConverted = _context.v;
|
|
8920
|
-
if (feeConverted) {
|
|
8921
|
-
_context.n = 6;
|
|
8922
|
-
break;
|
|
8923
|
-
}
|
|
8924
|
-
throw new InvalidParameterError("Pool DOT -> ".concat(asset.symbol, " not found."));
|
|
8925
|
-
case 6:
|
|
8926
|
-
nativeMythAmount = padFeeBy(feeConverted, 10);
|
|
8979
|
+
nativeMythAmount = _context.v;
|
|
8927
8980
|
return _context.a(2, {
|
|
8928
8981
|
module: 'PolkadotXcm',
|
|
8929
8982
|
method: 'transfer_assets_using_type_and_then',
|
|
@@ -10803,7 +10856,7 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
|
10803
10856
|
};
|
|
10804
10857
|
var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
10805
10858
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
10806
|
-
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe,
|
|
10859
|
+
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe, originFeeRaw, originCurrency, originAsset, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, isMythosToEthereum, originFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destCurrency, destAsset, destFeeType, destDryRunError, destSufficient, destResult, _destApi, destFallback, assetHubChain, processedBridgeHub, bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason, _t, _t2, _t3, _t4;
|
|
10807
10860
|
return _regenerator().w(function (_context2) {
|
|
10808
10861
|
while (1) switch (_context2.p = _context2.n) {
|
|
10809
10862
|
case 0:
|
|
@@ -10824,7 +10877,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10824
10877
|
});
|
|
10825
10878
|
case 1:
|
|
10826
10879
|
_yield$getOriginXcmFe = _context2.v;
|
|
10827
|
-
|
|
10880
|
+
originFeeRaw = _yield$getOriginXcmFe.fee;
|
|
10828
10881
|
originCurrency = _yield$getOriginXcmFe.currency;
|
|
10829
10882
|
originAsset = _yield$getOriginXcmFe.asset;
|
|
10830
10883
|
originFeeType = _yield$getOriginXcmFe.feeType;
|
|
@@ -10833,17 +10886,34 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10833
10886
|
initialDestParaId = _yield$getOriginXcmFe.destParaId;
|
|
10834
10887
|
originWeight = _yield$getOriginXcmFe.weight;
|
|
10835
10888
|
sufficientOriginFee = _yield$getOriginXcmFe.sufficient;
|
|
10889
|
+
isMythosToEthereum = origin === 'Mythos' && destination === 'Ethereum';
|
|
10890
|
+
if (!isMythosToEthereum) {
|
|
10891
|
+
_context2.n = 3;
|
|
10892
|
+
break;
|
|
10893
|
+
}
|
|
10894
|
+
_context2.n = 2;
|
|
10895
|
+
return getMythosOriginFee(api);
|
|
10896
|
+
case 2:
|
|
10897
|
+
_t2 = _context2.v;
|
|
10898
|
+
_t3 = originFeeRaw !== null && originFeeRaw !== void 0 ? originFeeRaw : 0n;
|
|
10899
|
+
_t = _t2 + _t3;
|
|
10900
|
+
_context2.n = 4;
|
|
10901
|
+
break;
|
|
10902
|
+
case 3:
|
|
10903
|
+
_t = originFeeRaw;
|
|
10904
|
+
case 4:
|
|
10905
|
+
originFee = _t;
|
|
10836
10906
|
if (!(originDryRunError || originFeeType === 'paymentInfo')) {
|
|
10837
|
-
_context2.n =
|
|
10907
|
+
_context2.n = 10;
|
|
10838
10908
|
break;
|
|
10839
10909
|
}
|
|
10840
10910
|
destApi = api.clone();
|
|
10841
|
-
_context2.p =
|
|
10842
|
-
_context2.n =
|
|
10911
|
+
_context2.p = 5;
|
|
10912
|
+
_context2.n = 6;
|
|
10843
10913
|
return destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
10844
|
-
case
|
|
10914
|
+
case 6:
|
|
10845
10915
|
destApi.setDisconnectAllowed(false);
|
|
10846
|
-
_context2.n =
|
|
10916
|
+
_context2.n = 7;
|
|
10847
10917
|
return getDestXcmFee({
|
|
10848
10918
|
api: destApi,
|
|
10849
10919
|
forwardedXcms: undefined,
|
|
@@ -10862,7 +10932,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10862
10932
|
disableFallback: disableFallback,
|
|
10863
10933
|
swapConfig: swapConfig
|
|
10864
10934
|
});
|
|
10865
|
-
case
|
|
10935
|
+
case 7:
|
|
10866
10936
|
destFeeRes = _context2.v;
|
|
10867
10937
|
_result = {
|
|
10868
10938
|
origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
|
|
@@ -10898,14 +10968,14 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10898
10968
|
failureChain: _failureChain,
|
|
10899
10969
|
failureReason: _failureReason
|
|
10900
10970
|
}));
|
|
10901
|
-
case
|
|
10902
|
-
_context2.p =
|
|
10971
|
+
case 8:
|
|
10972
|
+
_context2.p = 8;
|
|
10903
10973
|
destApi.setDisconnectAllowed(true);
|
|
10904
|
-
_context2.n =
|
|
10974
|
+
_context2.n = 9;
|
|
10905
10975
|
return destApi.disconnect();
|
|
10906
|
-
case
|
|
10907
|
-
return _context2.f(
|
|
10908
|
-
case
|
|
10976
|
+
case 9:
|
|
10977
|
+
return _context2.f(8);
|
|
10978
|
+
case 10:
|
|
10909
10979
|
processHop = /*#__PURE__*/function () {
|
|
10910
10980
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
10911
10981
|
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, hopResult;
|
|
@@ -10954,7 +11024,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10954
11024
|
return _ref3.apply(this, arguments);
|
|
10955
11025
|
};
|
|
10956
11026
|
}();
|
|
10957
|
-
_context2.n =
|
|
11027
|
+
_context2.n = 11;
|
|
10958
11028
|
return traverseXcmHops({
|
|
10959
11029
|
api: api,
|
|
10960
11030
|
origin: origin,
|
|
@@ -10974,14 +11044,14 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10974
11044
|
};
|
|
10975
11045
|
}
|
|
10976
11046
|
});
|
|
10977
|
-
case
|
|
11047
|
+
case 11:
|
|
10978
11048
|
traversalResult = _context2.v;
|
|
10979
11049
|
// Handle case where we failed before reaching destination
|
|
10980
11050
|
destFee = 0n;
|
|
10981
11051
|
destFeeType = destination === 'Ethereum' ? 'noFeeRequired' : 'paymentInfo';
|
|
10982
11052
|
destSufficient = undefined;
|
|
10983
11053
|
if (!traversalResult.destination) {
|
|
10984
|
-
_context2.n =
|
|
11054
|
+
_context2.n = 12;
|
|
10985
11055
|
break;
|
|
10986
11056
|
}
|
|
10987
11057
|
destResult = traversalResult.destination;
|
|
@@ -10991,19 +11061,19 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10991
11061
|
destSufficient = destResult.sufficient;
|
|
10992
11062
|
destCurrency = destResult.currency;
|
|
10993
11063
|
destAsset = destResult.asset;
|
|
10994
|
-
_context2.n =
|
|
11064
|
+
_context2.n = 16;
|
|
10995
11065
|
break;
|
|
10996
|
-
case
|
|
11066
|
+
case 12:
|
|
10997
11067
|
if (!(traversalResult.hops.length > 0 && traversalResult.hops[traversalResult.hops.length - 1].result.dryRunError)) {
|
|
10998
|
-
_context2.n =
|
|
11068
|
+
_context2.n = 15;
|
|
10999
11069
|
break;
|
|
11000
11070
|
}
|
|
11001
11071
|
// We failed before reaching destination, use fallback
|
|
11002
11072
|
_destApi = api.clone();
|
|
11003
|
-
_context2.n =
|
|
11073
|
+
_context2.n = 13;
|
|
11004
11074
|
return _destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
11005
|
-
case
|
|
11006
|
-
_context2.n =
|
|
11075
|
+
case 13:
|
|
11076
|
+
_context2.n = 14;
|
|
11007
11077
|
return getDestXcmFee({
|
|
11008
11078
|
api: _destApi,
|
|
11009
11079
|
forwardedXcms: undefined,
|
|
@@ -11021,28 +11091,38 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11021
11091
|
disableFallback: disableFallback,
|
|
11022
11092
|
swapConfig: swapConfig
|
|
11023
11093
|
});
|
|
11024
|
-
case
|
|
11094
|
+
case 14:
|
|
11025
11095
|
destFallback = _context2.v;
|
|
11026
11096
|
destFee = destFallback.fee;
|
|
11027
11097
|
destFeeType = destFallback.feeType;
|
|
11028
11098
|
destSufficient = destFallback.sufficient;
|
|
11029
11099
|
destCurrency = assets.getNativeAssetSymbol(destination);
|
|
11030
11100
|
destAsset = assets.findNativeAssetInfoOrThrow(destination);
|
|
11031
|
-
_context2.n =
|
|
11101
|
+
_context2.n = 16;
|
|
11032
11102
|
break;
|
|
11033
|
-
case
|
|
11103
|
+
case 15:
|
|
11034
11104
|
destFee = 0n;
|
|
11035
11105
|
destFeeType = 'noFeeRequired';
|
|
11036
11106
|
destSufficient = true;
|
|
11037
11107
|
destCurrency = assets.getNativeAssetSymbol(destination);
|
|
11038
11108
|
destAsset = assets.findNativeAssetInfoOrThrow(destination);
|
|
11039
|
-
case
|
|
11109
|
+
case 16:
|
|
11040
11110
|
// Process Ethereum bridge fees
|
|
11041
11111
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
11042
|
-
|
|
11112
|
+
if (!isMythosToEthereum) {
|
|
11113
|
+
_context2.n = 17;
|
|
11114
|
+
break;
|
|
11115
|
+
}
|
|
11116
|
+
_t4 = traversalResult.bridgeHub;
|
|
11117
|
+
_context2.n = 19;
|
|
11118
|
+
break;
|
|
11119
|
+
case 17:
|
|
11120
|
+
_context2.n = 18;
|
|
11043
11121
|
return addEthereumBridgeFees(api, traversalResult.bridgeHub, destination, assetHubChain);
|
|
11044
|
-
case
|
|
11045
|
-
|
|
11122
|
+
case 18:
|
|
11123
|
+
_t4 = _context2.v;
|
|
11124
|
+
case 19:
|
|
11125
|
+
processedBridgeHub = _t4;
|
|
11046
11126
|
// Update bridge hub fee in hops if needed
|
|
11047
11127
|
if (processedBridgeHub && traversalResult.bridgeHub && processedBridgeHub.fee !== traversalResult.bridgeHub.fee) {
|
|
11048
11128
|
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
@@ -11118,7 +11198,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11118
11198
|
failureReason: failureReason
|
|
11119
11199
|
}));
|
|
11120
11200
|
}
|
|
11121
|
-
}, _callee2, null, [[
|
|
11201
|
+
}, _callee2, null, [[5,, 8, 10]]);
|
|
11122
11202
|
}));
|
|
11123
11203
|
return function getXcmFeeInternal(_x) {
|
|
11124
11204
|
return _ref2.apply(this, arguments);
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { blake2b } from '@noble/hashes/blake2';
|
|
2
|
-
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findAssetInfo, isTAsset, getExistentialDeposit, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow,
|
|
2
|
+
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findNativeAssetInfoOrThrow, findAssetInfo, isTAsset, getExistentialDeposit, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow, Native, hasXcmPaymentApiSupport, getRelayChainSymbol, findNativeAssetInfo, isAssetXcEqual, hasSupportForAsset, isSymbolSpecifier, normalizeLocation, getEdFromAssetOrThrow, normalizeSymbol } from '@paraspell/assets';
|
|
3
3
|
export * from '@paraspell/assets';
|
|
4
4
|
import { base58 } from '@scure/base';
|
|
5
5
|
import { isAddress, parseUnits, createPublicClient, http, getContract, pad, toHex, getAddress, concat, keccak256 } from 'viem';
|
|
@@ -3696,6 +3696,44 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3696
3696
|
};
|
|
3697
3697
|
}();
|
|
3698
3698
|
|
|
3699
|
+
var getMythosOriginFee = /*#__PURE__*/function () {
|
|
3700
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api) {
|
|
3701
|
+
var ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, ahExecutionFee, nativeAsset, feeConverted;
|
|
3702
|
+
return _regenerator().w(function (_context) {
|
|
3703
|
+
while (1) switch (_context.n) {
|
|
3704
|
+
case 0:
|
|
3705
|
+
ahApi = api.clone();
|
|
3706
|
+
_context.n = 1;
|
|
3707
|
+
return ahApi.init('AssetHubPolkadot');
|
|
3708
|
+
case 1:
|
|
3709
|
+
_context.n = 2;
|
|
3710
|
+
return getParaEthTransferFees(ahApi);
|
|
3711
|
+
case 2:
|
|
3712
|
+
_yield$getParaEthTran = _context.v;
|
|
3713
|
+
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
3714
|
+
bridgeFee = _yield$getParaEthTran2[0];
|
|
3715
|
+
ahExecutionFee = _yield$getParaEthTran2[1];
|
|
3716
|
+
nativeAsset = findNativeAssetInfoOrThrow('Mythos');
|
|
3717
|
+
assertHasLocation(nativeAsset);
|
|
3718
|
+
_context.n = 3;
|
|
3719
|
+
return ahApi.quoteAhPrice(DOT_LOCATION, nativeAsset.location, bridgeFee + ahExecutionFee);
|
|
3720
|
+
case 3:
|
|
3721
|
+
feeConverted = _context.v;
|
|
3722
|
+
if (feeConverted) {
|
|
3723
|
+
_context.n = 4;
|
|
3724
|
+
break;
|
|
3725
|
+
}
|
|
3726
|
+
throw new InvalidParameterError("Pool DOT -> ".concat(nativeAsset.symbol, " not found."));
|
|
3727
|
+
case 4:
|
|
3728
|
+
return _context.a(2, padFeeBy(feeConverted, 10));
|
|
3729
|
+
}
|
|
3730
|
+
}, _callee);
|
|
3731
|
+
}));
|
|
3732
|
+
return function getMythosOriginFee(_x) {
|
|
3733
|
+
return _ref.apply(this, arguments);
|
|
3734
|
+
};
|
|
3735
|
+
}();
|
|
3736
|
+
|
|
3699
3737
|
var resolveFeeAsset = function resolveFeeAsset(feeAsset, origin, destination, currency) {
|
|
3700
3738
|
var asset = findAssetInfo(origin, feeAsset, !isTLocation(destination) ? destination : null);
|
|
3701
3739
|
var usesRawOverriddenMultiAssets = Array.isArray(currency) && currency.every(isTAsset);
|
|
@@ -5309,7 +5347,7 @@ var getFailureInfo$1 = function getFailureInfo(results, hops) {
|
|
|
5309
5347
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
5310
5348
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5311
5349
|
var _traversalResult$brid;
|
|
5312
|
-
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, initialForwardedXcms, initialDestParaId, processHop, traversalResult, assetHubChain, bridgeHubChain, processedBridgeHub, bridgeHubHopIndex, bridgeHubWithCurrency, _getFailureInfo, failureReason, failureChain, _t;
|
|
5350
|
+
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, isMythosToEthereum, originDryModified, initialForwardedXcms, initialDestParaId, processHop, traversalResult, assetHubChain, bridgeHubChain, processedBridgeHub, bridgeHubHopIndex, bridgeHubWithCurrency, _getFailureInfo, failureReason, failureChain, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
5313
5351
|
return _regenerator().w(function (_context2) {
|
|
5314
5352
|
while (1) switch (_context2.n) {
|
|
5315
5353
|
case 0:
|
|
@@ -5343,7 +5381,30 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5343
5381
|
hops: []
|
|
5344
5382
|
});
|
|
5345
5383
|
case 2:
|
|
5346
|
-
|
|
5384
|
+
isMythosToEthereum = origin === 'Mythos' && destination === 'Ethereum';
|
|
5385
|
+
if (!isMythosToEthereum) {
|
|
5386
|
+
_context2.n = 4;
|
|
5387
|
+
break;
|
|
5388
|
+
}
|
|
5389
|
+
_t2 = _objectSpread2;
|
|
5390
|
+
_t3 = _objectSpread2({}, originDryRun);
|
|
5391
|
+
_t4 = {};
|
|
5392
|
+
_t5 = originDryRun.fee;
|
|
5393
|
+
_context2.n = 3;
|
|
5394
|
+
return getMythosOriginFee(api);
|
|
5395
|
+
case 3:
|
|
5396
|
+
_t6 = _context2.v;
|
|
5397
|
+
_t7 = _t5 + _t6;
|
|
5398
|
+
_t = _t2(_t3, _t4, {
|
|
5399
|
+
fee: _t7
|
|
5400
|
+
});
|
|
5401
|
+
_context2.n = 5;
|
|
5402
|
+
break;
|
|
5403
|
+
case 4:
|
|
5404
|
+
_t = originDryRun;
|
|
5405
|
+
case 5:
|
|
5406
|
+
originDryModified = _t;
|
|
5407
|
+
initialForwardedXcms = originDryModified.forwardedXcms, initialDestParaId = originDryModified.destParaId;
|
|
5347
5408
|
processHop = /*#__PURE__*/function () {
|
|
5348
5409
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
5349
5410
|
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, isDestination, hopAsset, hopDryRun;
|
|
@@ -5380,7 +5441,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5380
5441
|
origin: currentOrigin,
|
|
5381
5442
|
asset: hopAsset,
|
|
5382
5443
|
feeAsset: resolvedFeeAsset,
|
|
5383
|
-
originFee:
|
|
5444
|
+
originFee: originDryModified.fee,
|
|
5384
5445
|
amount: amount
|
|
5385
5446
|
});
|
|
5386
5447
|
case 2:
|
|
@@ -5396,7 +5457,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5396
5457
|
return _ref2.apply(this, arguments);
|
|
5397
5458
|
};
|
|
5398
5459
|
}();
|
|
5399
|
-
_context2.n =
|
|
5460
|
+
_context2.n = 6;
|
|
5400
5461
|
return traverseXcmHops({
|
|
5401
5462
|
api: api,
|
|
5402
5463
|
origin: origin,
|
|
@@ -5416,25 +5477,35 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5416
5477
|
};
|
|
5417
5478
|
}
|
|
5418
5479
|
});
|
|
5419
|
-
case
|
|
5480
|
+
case 6:
|
|
5420
5481
|
traversalResult = _context2.v;
|
|
5421
5482
|
// Process Ethereum bridge fees
|
|
5422
5483
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
5423
|
-
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
5484
|
+
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin)); // For Mythos → Ethereum, we skip additional Ethereum bridge fees (aligns with getXcmFeeInternal)
|
|
5485
|
+
if (!isMythosToEthereum) {
|
|
5486
|
+
_context2.n = 7;
|
|
5487
|
+
break;
|
|
5488
|
+
}
|
|
5489
|
+
_t8 = traversalResult.bridgeHub;
|
|
5490
|
+
_context2.n = 11;
|
|
5491
|
+
break;
|
|
5492
|
+
case 7:
|
|
5424
5493
|
if (!((_traversalResult$brid = traversalResult.bridgeHub) !== null && _traversalResult$brid !== void 0 && _traversalResult$brid.success)) {
|
|
5425
|
-
_context2.n =
|
|
5494
|
+
_context2.n = 9;
|
|
5426
5495
|
break;
|
|
5427
5496
|
}
|
|
5428
|
-
_context2.n =
|
|
5497
|
+
_context2.n = 8;
|
|
5429
5498
|
return addEthereumBridgeFees(api, traversalResult.bridgeHub, destination, assetHubChain);
|
|
5430
|
-
case
|
|
5431
|
-
|
|
5432
|
-
_context2.n =
|
|
5499
|
+
case 8:
|
|
5500
|
+
_t9 = _context2.v;
|
|
5501
|
+
_context2.n = 10;
|
|
5433
5502
|
break;
|
|
5434
|
-
case
|
|
5435
|
-
|
|
5436
|
-
case
|
|
5437
|
-
|
|
5503
|
+
case 9:
|
|
5504
|
+
_t9 = traversalResult.bridgeHub;
|
|
5505
|
+
case 10:
|
|
5506
|
+
_t8 = _t9;
|
|
5507
|
+
case 11:
|
|
5508
|
+
processedBridgeHub = _t8;
|
|
5438
5509
|
// Update bridge hub in hops if needed
|
|
5439
5510
|
if (processedBridgeHub && processedBridgeHub.success && traversalResult.bridgeHub && traversalResult.bridgeHub.success && processedBridgeHub.fee !== traversalResult.bridgeHub.fee) {
|
|
5440
5511
|
bridgeHubHopIndex = traversalResult.hops.findIndex(function (hop) {
|
|
@@ -5458,7 +5529,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5458
5529
|
return _context2.a(2, {
|
|
5459
5530
|
failureReason: failureReason,
|
|
5460
5531
|
failureChain: failureChain,
|
|
5461
|
-
origin:
|
|
5532
|
+
origin: originDryModified,
|
|
5462
5533
|
assetHub: traversalResult.assetHub,
|
|
5463
5534
|
bridgeHub: bridgeHubWithCurrency,
|
|
5464
5535
|
destination: traversalResult.destination,
|
|
@@ -8885,7 +8956,7 @@ var Moonriver = /*#__PURE__*/function (_Parachain) {
|
|
|
8885
8956
|
|
|
8886
8957
|
var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
8887
8958
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, chain, version) {
|
|
8888
|
-
var api, asset, senderAddress, address, destination, messageId,
|
|
8959
|
+
var api, asset, senderAddress, address, destination, messageId, nativeMythAmount;
|
|
8889
8960
|
return _regenerator().w(function (_context) {
|
|
8890
8961
|
while (1) switch (_context.n) {
|
|
8891
8962
|
case 0:
|
|
@@ -8903,28 +8974,10 @@ var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
|
8903
8974
|
return generateMessageId(api, senderAddress, getParaId(chain), asset.assetId, address, asset.amount);
|
|
8904
8975
|
case 2:
|
|
8905
8976
|
messageId = _context.v;
|
|
8906
|
-
ahApi = api.clone();
|
|
8907
8977
|
_context.n = 3;
|
|
8908
|
-
return
|
|
8978
|
+
return getMythosOriginFee(api);
|
|
8909
8979
|
case 3:
|
|
8910
|
-
|
|
8911
|
-
return getParaEthTransferFees(ahApi);
|
|
8912
|
-
case 4:
|
|
8913
|
-
_yield$getParaEthTran = _context.v;
|
|
8914
|
-
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
8915
|
-
bridgeFee = _yield$getParaEthTran2[0];
|
|
8916
|
-
ahExecutionFee = _yield$getParaEthTran2[1];
|
|
8917
|
-
_context.n = 5;
|
|
8918
|
-
return ahApi.quoteAhPrice(DOT_LOCATION, getNativeAssets(chain)[0].location, bridgeFee + ahExecutionFee);
|
|
8919
|
-
case 5:
|
|
8920
|
-
feeConverted = _context.v;
|
|
8921
|
-
if (feeConverted) {
|
|
8922
|
-
_context.n = 6;
|
|
8923
|
-
break;
|
|
8924
|
-
}
|
|
8925
|
-
throw new InvalidParameterError("Pool DOT -> ".concat(asset.symbol, " not found."));
|
|
8926
|
-
case 6:
|
|
8927
|
-
nativeMythAmount = padFeeBy(feeConverted, 10);
|
|
8980
|
+
nativeMythAmount = _context.v;
|
|
8928
8981
|
return _context.a(2, {
|
|
8929
8982
|
module: 'PolkadotXcm',
|
|
8930
8983
|
method: 'transfer_assets_using_type_and_then',
|
|
@@ -10804,7 +10857,7 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
|
10804
10857
|
};
|
|
10805
10858
|
var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
10806
10859
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
10807
|
-
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe,
|
|
10860
|
+
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe, originFeeRaw, originCurrency, originAsset, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, isMythosToEthereum, originFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destCurrency, destAsset, destFeeType, destDryRunError, destSufficient, destResult, _destApi, destFallback, assetHubChain, processedBridgeHub, bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason, _t, _t2, _t3, _t4;
|
|
10808
10861
|
return _regenerator().w(function (_context2) {
|
|
10809
10862
|
while (1) switch (_context2.p = _context2.n) {
|
|
10810
10863
|
case 0:
|
|
@@ -10825,7 +10878,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10825
10878
|
});
|
|
10826
10879
|
case 1:
|
|
10827
10880
|
_yield$getOriginXcmFe = _context2.v;
|
|
10828
|
-
|
|
10881
|
+
originFeeRaw = _yield$getOriginXcmFe.fee;
|
|
10829
10882
|
originCurrency = _yield$getOriginXcmFe.currency;
|
|
10830
10883
|
originAsset = _yield$getOriginXcmFe.asset;
|
|
10831
10884
|
originFeeType = _yield$getOriginXcmFe.feeType;
|
|
@@ -10834,17 +10887,34 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10834
10887
|
initialDestParaId = _yield$getOriginXcmFe.destParaId;
|
|
10835
10888
|
originWeight = _yield$getOriginXcmFe.weight;
|
|
10836
10889
|
sufficientOriginFee = _yield$getOriginXcmFe.sufficient;
|
|
10890
|
+
isMythosToEthereum = origin === 'Mythos' && destination === 'Ethereum';
|
|
10891
|
+
if (!isMythosToEthereum) {
|
|
10892
|
+
_context2.n = 3;
|
|
10893
|
+
break;
|
|
10894
|
+
}
|
|
10895
|
+
_context2.n = 2;
|
|
10896
|
+
return getMythosOriginFee(api);
|
|
10897
|
+
case 2:
|
|
10898
|
+
_t2 = _context2.v;
|
|
10899
|
+
_t3 = originFeeRaw !== null && originFeeRaw !== void 0 ? originFeeRaw : 0n;
|
|
10900
|
+
_t = _t2 + _t3;
|
|
10901
|
+
_context2.n = 4;
|
|
10902
|
+
break;
|
|
10903
|
+
case 3:
|
|
10904
|
+
_t = originFeeRaw;
|
|
10905
|
+
case 4:
|
|
10906
|
+
originFee = _t;
|
|
10837
10907
|
if (!(originDryRunError || originFeeType === 'paymentInfo')) {
|
|
10838
|
-
_context2.n =
|
|
10908
|
+
_context2.n = 10;
|
|
10839
10909
|
break;
|
|
10840
10910
|
}
|
|
10841
10911
|
destApi = api.clone();
|
|
10842
|
-
_context2.p =
|
|
10843
|
-
_context2.n =
|
|
10912
|
+
_context2.p = 5;
|
|
10913
|
+
_context2.n = 6;
|
|
10844
10914
|
return destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
10845
|
-
case
|
|
10915
|
+
case 6:
|
|
10846
10916
|
destApi.setDisconnectAllowed(false);
|
|
10847
|
-
_context2.n =
|
|
10917
|
+
_context2.n = 7;
|
|
10848
10918
|
return getDestXcmFee({
|
|
10849
10919
|
api: destApi,
|
|
10850
10920
|
forwardedXcms: undefined,
|
|
@@ -10863,7 +10933,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10863
10933
|
disableFallback: disableFallback,
|
|
10864
10934
|
swapConfig: swapConfig
|
|
10865
10935
|
});
|
|
10866
|
-
case
|
|
10936
|
+
case 7:
|
|
10867
10937
|
destFeeRes = _context2.v;
|
|
10868
10938
|
_result = {
|
|
10869
10939
|
origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
|
|
@@ -10899,14 +10969,14 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10899
10969
|
failureChain: _failureChain,
|
|
10900
10970
|
failureReason: _failureReason
|
|
10901
10971
|
}));
|
|
10902
|
-
case
|
|
10903
|
-
_context2.p =
|
|
10972
|
+
case 8:
|
|
10973
|
+
_context2.p = 8;
|
|
10904
10974
|
destApi.setDisconnectAllowed(true);
|
|
10905
|
-
_context2.n =
|
|
10975
|
+
_context2.n = 9;
|
|
10906
10976
|
return destApi.disconnect();
|
|
10907
|
-
case
|
|
10908
|
-
return _context2.f(
|
|
10909
|
-
case
|
|
10977
|
+
case 9:
|
|
10978
|
+
return _context2.f(8);
|
|
10979
|
+
case 10:
|
|
10910
10980
|
processHop = /*#__PURE__*/function () {
|
|
10911
10981
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
10912
10982
|
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, hopResult;
|
|
@@ -10955,7 +11025,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10955
11025
|
return _ref3.apply(this, arguments);
|
|
10956
11026
|
};
|
|
10957
11027
|
}();
|
|
10958
|
-
_context2.n =
|
|
11028
|
+
_context2.n = 11;
|
|
10959
11029
|
return traverseXcmHops({
|
|
10960
11030
|
api: api,
|
|
10961
11031
|
origin: origin,
|
|
@@ -10975,14 +11045,14 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10975
11045
|
};
|
|
10976
11046
|
}
|
|
10977
11047
|
});
|
|
10978
|
-
case
|
|
11048
|
+
case 11:
|
|
10979
11049
|
traversalResult = _context2.v;
|
|
10980
11050
|
// Handle case where we failed before reaching destination
|
|
10981
11051
|
destFee = 0n;
|
|
10982
11052
|
destFeeType = destination === 'Ethereum' ? 'noFeeRequired' : 'paymentInfo';
|
|
10983
11053
|
destSufficient = undefined;
|
|
10984
11054
|
if (!traversalResult.destination) {
|
|
10985
|
-
_context2.n =
|
|
11055
|
+
_context2.n = 12;
|
|
10986
11056
|
break;
|
|
10987
11057
|
}
|
|
10988
11058
|
destResult = traversalResult.destination;
|
|
@@ -10992,19 +11062,19 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10992
11062
|
destSufficient = destResult.sufficient;
|
|
10993
11063
|
destCurrency = destResult.currency;
|
|
10994
11064
|
destAsset = destResult.asset;
|
|
10995
|
-
_context2.n =
|
|
11065
|
+
_context2.n = 16;
|
|
10996
11066
|
break;
|
|
10997
|
-
case
|
|
11067
|
+
case 12:
|
|
10998
11068
|
if (!(traversalResult.hops.length > 0 && traversalResult.hops[traversalResult.hops.length - 1].result.dryRunError)) {
|
|
10999
|
-
_context2.n =
|
|
11069
|
+
_context2.n = 15;
|
|
11000
11070
|
break;
|
|
11001
11071
|
}
|
|
11002
11072
|
// We failed before reaching destination, use fallback
|
|
11003
11073
|
_destApi = api.clone();
|
|
11004
|
-
_context2.n =
|
|
11074
|
+
_context2.n = 13;
|
|
11005
11075
|
return _destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
11006
|
-
case
|
|
11007
|
-
_context2.n =
|
|
11076
|
+
case 13:
|
|
11077
|
+
_context2.n = 14;
|
|
11008
11078
|
return getDestXcmFee({
|
|
11009
11079
|
api: _destApi,
|
|
11010
11080
|
forwardedXcms: undefined,
|
|
@@ -11022,28 +11092,38 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11022
11092
|
disableFallback: disableFallback,
|
|
11023
11093
|
swapConfig: swapConfig
|
|
11024
11094
|
});
|
|
11025
|
-
case
|
|
11095
|
+
case 14:
|
|
11026
11096
|
destFallback = _context2.v;
|
|
11027
11097
|
destFee = destFallback.fee;
|
|
11028
11098
|
destFeeType = destFallback.feeType;
|
|
11029
11099
|
destSufficient = destFallback.sufficient;
|
|
11030
11100
|
destCurrency = getNativeAssetSymbol(destination);
|
|
11031
11101
|
destAsset = findNativeAssetInfoOrThrow(destination);
|
|
11032
|
-
_context2.n =
|
|
11102
|
+
_context2.n = 16;
|
|
11033
11103
|
break;
|
|
11034
|
-
case
|
|
11104
|
+
case 15:
|
|
11035
11105
|
destFee = 0n;
|
|
11036
11106
|
destFeeType = 'noFeeRequired';
|
|
11037
11107
|
destSufficient = true;
|
|
11038
11108
|
destCurrency = getNativeAssetSymbol(destination);
|
|
11039
11109
|
destAsset = findNativeAssetInfoOrThrow(destination);
|
|
11040
|
-
case
|
|
11110
|
+
case 16:
|
|
11041
11111
|
// Process Ethereum bridge fees
|
|
11042
11112
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
11043
|
-
|
|
11113
|
+
if (!isMythosToEthereum) {
|
|
11114
|
+
_context2.n = 17;
|
|
11115
|
+
break;
|
|
11116
|
+
}
|
|
11117
|
+
_t4 = traversalResult.bridgeHub;
|
|
11118
|
+
_context2.n = 19;
|
|
11119
|
+
break;
|
|
11120
|
+
case 17:
|
|
11121
|
+
_context2.n = 18;
|
|
11044
11122
|
return addEthereumBridgeFees(api, traversalResult.bridgeHub, destination, assetHubChain);
|
|
11045
|
-
case
|
|
11046
|
-
|
|
11123
|
+
case 18:
|
|
11124
|
+
_t4 = _context2.v;
|
|
11125
|
+
case 19:
|
|
11126
|
+
processedBridgeHub = _t4;
|
|
11047
11127
|
// Update bridge hub fee in hops if needed
|
|
11048
11128
|
if (processedBridgeHub && traversalResult.bridgeHub && processedBridgeHub.fee !== traversalResult.bridgeHub.fee) {
|
|
11049
11129
|
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
@@ -11119,7 +11199,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11119
11199
|
failureReason: failureReason
|
|
11120
11200
|
}));
|
|
11121
11201
|
}
|
|
11122
|
-
}, _callee2, null, [[
|
|
11202
|
+
}, _callee2, null, [[5,, 8, 10]]);
|
|
11123
11203
|
}));
|
|
11124
11204
|
return function getXcmFeeInternal(_x) {
|
|
11125
11205
|
return _ref2.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "11.8.
|
|
3
|
+
"version": "11.8.5",
|
|
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": "^2.0.0",
|
|
28
28
|
"viem": "^2.36.0",
|
|
29
|
-
"@paraspell/assets": "11.8.
|
|
30
|
-
"@paraspell/sdk-common": "11.8.
|
|
31
|
-
"@paraspell/pallets": "11.8.
|
|
29
|
+
"@paraspell/assets": "11.8.5",
|
|
30
|
+
"@paraspell/sdk-common": "11.8.5",
|
|
31
|
+
"@paraspell/pallets": "11.8.5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|