@paraspell/sdk-core 11.11.0 → 11.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +75 -62
- package/dist/index.d.ts +8 -3
- package/dist/index.mjs +65 -55
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -838,6 +838,9 @@ var sortAssets = function sortAssets(assets$1) {
|
|
|
838
838
|
});
|
|
839
839
|
};
|
|
840
840
|
|
|
841
|
+
var parseUnits = viem.parseUnits;
|
|
842
|
+
var formatUnits = viem.formatUnits;
|
|
843
|
+
|
|
841
844
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
842
845
|
var isConfig = function isConfig(value) {
|
|
843
846
|
return _typeof(value) === 'object' && value !== null && !Array.isArray(value) && (
|
|
@@ -857,7 +860,7 @@ var computeOverridenAmount = function computeOverridenAmount(options, increaseAm
|
|
|
857
860
|
} else {
|
|
858
861
|
assertToIsString(to);
|
|
859
862
|
var asset = assets.findAssetInfoOrThrow(from, currency, to);
|
|
860
|
-
return
|
|
863
|
+
return parseUnits(increaseAmount, asset.decimals) + BigInt(amount);
|
|
861
864
|
}
|
|
862
865
|
};
|
|
863
866
|
var overrideTxAmount = /*#__PURE__*/function () {
|
|
@@ -1221,7 +1224,7 @@ var padFee = function padFee(raw, origin, dest, side) {
|
|
|
1221
1224
|
// apply default 30% padding
|
|
1222
1225
|
return mul(raw, 130n, 100n);
|
|
1223
1226
|
};
|
|
1224
|
-
var
|
|
1227
|
+
var padValueBy = function padValueBy(amount, percent) {
|
|
1225
1228
|
return mul(amount, BigInt(100 + percent), 100n);
|
|
1226
1229
|
};
|
|
1227
1230
|
|
|
@@ -3194,7 +3197,7 @@ var applyDecimalAbstraction = function applyDecimalAbstraction(amount, decimals,
|
|
|
3194
3197
|
}
|
|
3195
3198
|
return BigInt(_strAmount);
|
|
3196
3199
|
}
|
|
3197
|
-
return
|
|
3200
|
+
return parseUnits(amount.toString(), decimals);
|
|
3198
3201
|
};
|
|
3199
3202
|
|
|
3200
3203
|
var createAssetsFilter = function createAssetsFilter(asset) {
|
|
@@ -3667,7 +3670,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3667
3670
|
paraIdTo: paraIdTo
|
|
3668
3671
|
}; // We mint 1000 units of feeAsset and use 100
|
|
3669
3672
|
FEE_ASSET_AMOUNT = 100;
|
|
3670
|
-
feeAssetAmount = feeAssetInfo ?
|
|
3673
|
+
feeAssetAmount = feeAssetInfo ? parseUnits(FEE_ASSET_AMOUNT.toString(), feeAssetInfo.decimals) : MIN_FEE;
|
|
3671
3674
|
call = createExecuteCall(chain, createDirectExecuteXcm(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
|
|
3672
3675
|
fees: {
|
|
3673
3676
|
originFee: feeAssetAmount,
|
|
@@ -3695,9 +3698,9 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3695
3698
|
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
3696
3699
|
case 2:
|
|
3697
3700
|
originFeeEstimate = dryRunResult.origin.fee;
|
|
3698
|
-
originFee =
|
|
3701
|
+
originFee = padValueBy(originFeeEstimate, FEE_PADDING_PERCENTAGE$2);
|
|
3699
3702
|
reserveFeeEstimate = getReserveFeeFromHops(dryRunResult.hops);
|
|
3700
|
-
reserveFee =
|
|
3703
|
+
reserveFee = padValueBy(reserveFeeEstimate, FEE_PADDING_PERCENTAGE$2);
|
|
3701
3704
|
checkAmount(feeAssetInfo && !assets.isAssetEqual(assetInfo, feeAssetInfo) ? reserveFee : originFee + reserveFee);
|
|
3702
3705
|
xcm = createDirectExecuteXcm(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
|
|
3703
3706
|
fees: {
|
|
@@ -3747,7 +3750,7 @@ var getMythosOriginFee = /*#__PURE__*/function () {
|
|
|
3747
3750
|
}
|
|
3748
3751
|
throw new InvalidParameterError("Pool DOT -> ".concat(nativeAsset.symbol, " not found."));
|
|
3749
3752
|
case 4:
|
|
3750
|
-
return _context.a(2,
|
|
3753
|
+
return _context.a(2, padValueBy(feeConverted, 10));
|
|
3751
3754
|
}
|
|
3752
3755
|
}, _callee);
|
|
3753
3756
|
}));
|
|
@@ -4497,6 +4500,50 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4497
4500
|
};
|
|
4498
4501
|
}();
|
|
4499
4502
|
|
|
4503
|
+
var getFailureInfo$1 = function getFailureInfo(result) {
|
|
4504
|
+
var orderedChecks = [{
|
|
4505
|
+
chain: 'origin',
|
|
4506
|
+
chainResult: result.origin
|
|
4507
|
+
}, {
|
|
4508
|
+
chain: 'destination',
|
|
4509
|
+
chainResult: result.destination
|
|
4510
|
+
}, {
|
|
4511
|
+
chain: 'assetHub',
|
|
4512
|
+
chainResult: result.assetHub
|
|
4513
|
+
}, {
|
|
4514
|
+
chain: 'bridgeHub',
|
|
4515
|
+
chainResult: result.bridgeHub
|
|
4516
|
+
}].concat(_toConsumableArray(result.hops.map(function (hop) {
|
|
4517
|
+
return {
|
|
4518
|
+
chain: hop.chain,
|
|
4519
|
+
chainResult: hop.result
|
|
4520
|
+
};
|
|
4521
|
+
})));
|
|
4522
|
+
var _iterator = _createForOfIteratorHelper(orderedChecks),
|
|
4523
|
+
_step;
|
|
4524
|
+
try {
|
|
4525
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4526
|
+
var _step$value = _step.value,
|
|
4527
|
+
chain = _step$value.chain,
|
|
4528
|
+
chainResult = _step$value.chainResult;
|
|
4529
|
+
if (chainResult && chainResult.success === false && chainResult.failureReason) {
|
|
4530
|
+
return {
|
|
4531
|
+
failureChain: chain,
|
|
4532
|
+
failureReason: chainResult.failureReason
|
|
4533
|
+
};
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4536
|
+
} catch (err) {
|
|
4537
|
+
_iterator.e(err);
|
|
4538
|
+
} finally {
|
|
4539
|
+
_iterator.f();
|
|
4540
|
+
}
|
|
4541
|
+
return {
|
|
4542
|
+
failureChain: result.failureChain,
|
|
4543
|
+
failureReason: result.failureReason
|
|
4544
|
+
};
|
|
4545
|
+
};
|
|
4546
|
+
|
|
4500
4547
|
var getParaEthTransferFees = /*#__PURE__*/function () {
|
|
4501
4548
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(ahApi) {
|
|
4502
4549
|
var DEFAULT_FEE, feeStorageItem, leFeeHex, bytes, reversedHex, validReversedHex, leFee, transferBridgeFee, finalBridgeFee, finalAssethubExecutionFee;
|
|
@@ -5222,41 +5269,10 @@ var addEthereumBridgeFees = /*#__PURE__*/function () {
|
|
|
5222
5269
|
};
|
|
5223
5270
|
}();
|
|
5224
5271
|
|
|
5225
|
-
var getFailureInfo$1 = function getFailureInfo(results, hops) {
|
|
5226
|
-
// Check standard chains first for backwards compatibility
|
|
5227
|
-
for (var _i = 0, _arr = ['destination', 'assetHub', 'bridgeHub']; _i < _arr.length; _i++) {
|
|
5228
|
-
var chain = _arr[_i];
|
|
5229
|
-
var res = results[chain];
|
|
5230
|
-
if (res && !res.success && res.failureReason) {
|
|
5231
|
-
return {
|
|
5232
|
-
failureReason: res.failureReason,
|
|
5233
|
-
failureChain: chain
|
|
5234
|
-
};
|
|
5235
|
-
}
|
|
5236
|
-
}
|
|
5237
|
-
var _iterator = _createForOfIteratorHelper(hops),
|
|
5238
|
-
_step;
|
|
5239
|
-
try {
|
|
5240
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
5241
|
-
var hop = _step.value;
|
|
5242
|
-
if (!hop.result.success && hop.result.failureReason) {
|
|
5243
|
-
return {
|
|
5244
|
-
failureReason: hop.result.failureReason,
|
|
5245
|
-
failureChain: hop.chain
|
|
5246
|
-
};
|
|
5247
|
-
}
|
|
5248
|
-
}
|
|
5249
|
-
} catch (err) {
|
|
5250
|
-
_iterator.e(err);
|
|
5251
|
-
} finally {
|
|
5252
|
-
_iterator.f();
|
|
5253
|
-
}
|
|
5254
|
-
return {};
|
|
5255
|
-
};
|
|
5256
5272
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
5257
5273
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5258
5274
|
var _traversalResult$brid;
|
|
5259
|
-
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,
|
|
5275
|
+
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, result, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
5260
5276
|
return _regenerator().w(function (_context2) {
|
|
5261
5277
|
while (1) switch (_context2.n) {
|
|
5262
5278
|
case 0:
|
|
@@ -5429,20 +5445,14 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5429
5445
|
currency: assets.getNativeAssetSymbol(bridgeHubChain),
|
|
5430
5446
|
asset: assets.findNativeAssetInfoOrThrow(bridgeHubChain)
|
|
5431
5447
|
}) : processedBridgeHub;
|
|
5432
|
-
|
|
5433
|
-
destination: traversalResult.destination,
|
|
5434
|
-
assetHub: traversalResult.assetHub,
|
|
5435
|
-
bridgeHub: bridgeHubWithCurrency
|
|
5436
|
-
}, traversalResult.hops), failureReason = _getFailureInfo.failureReason, failureChain = _getFailureInfo.failureChain;
|
|
5437
|
-
return _context2.a(2, {
|
|
5438
|
-
failureReason: failureReason,
|
|
5439
|
-
failureChain: failureChain,
|
|
5448
|
+
result = {
|
|
5440
5449
|
origin: originDryModified,
|
|
5441
5450
|
assetHub: traversalResult.assetHub,
|
|
5442
5451
|
bridgeHub: bridgeHubWithCurrency,
|
|
5443
5452
|
destination: traversalResult.destination,
|
|
5444
5453
|
hops: traversalResult.hops
|
|
5445
|
-
}
|
|
5454
|
+
};
|
|
5455
|
+
return _context2.a(2, _objectSpread2(_objectSpread2({}, getFailureInfo$1(result)), result));
|
|
5446
5456
|
}
|
|
5447
5457
|
}, _callee2);
|
|
5448
5458
|
}));
|
|
@@ -5639,7 +5649,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5639
5649
|
throw new DryRunFailedError("Exchange (destination) failed: ".concat(dryRunResult.destination.failureReason || 'Unknown reason'));
|
|
5640
5650
|
}
|
|
5641
5651
|
if (dryRunResult.destination && dryRunResult.destination.success) {
|
|
5642
|
-
fees.exchangeFee =
|
|
5652
|
+
fees.exchangeFee = padValueBy(dryRunResult.destination.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5643
5653
|
}
|
|
5644
5654
|
} else {
|
|
5645
5655
|
// Normal case: exchange is an intermediate hop
|
|
@@ -5648,7 +5658,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5648
5658
|
throw new DryRunFailedError("Exchange hop failed: ".concat(exchangeHop.result.failureReason || 'Unknown reason'));
|
|
5649
5659
|
}
|
|
5650
5660
|
if (exchangeHop.result.success) {
|
|
5651
|
-
fees.exchangeFee =
|
|
5661
|
+
fees.exchangeFee = padValueBy(exchangeHop.result.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5652
5662
|
}
|
|
5653
5663
|
}
|
|
5654
5664
|
} else {
|
|
@@ -5665,7 +5675,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5665
5675
|
throw new DryRunFailedError("Hop before exchange failed: ".concat(hopBeforeExchange.result.failureReason || 'Unknown reason'));
|
|
5666
5676
|
}
|
|
5667
5677
|
if (hopBeforeExchange.result.success) {
|
|
5668
|
-
fees.originReserveFee =
|
|
5678
|
+
fees.originReserveFee = padValueBy(hopBeforeExchange.result.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5669
5679
|
}
|
|
5670
5680
|
} else if (!destChain && hops.length > 0) {
|
|
5671
5681
|
// Special case: when destChain is undefined and we have hops,
|
|
@@ -5675,7 +5685,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5675
5685
|
throw new DryRunFailedError("Origin reserve hop failed: ".concat(lastHop.result.failureReason || 'Unknown reason'));
|
|
5676
5686
|
}
|
|
5677
5687
|
if (lastHop.result.success) {
|
|
5678
|
-
fees.originReserveFee =
|
|
5688
|
+
fees.originReserveFee = padValueBy(lastHop.result.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5679
5689
|
}
|
|
5680
5690
|
}
|
|
5681
5691
|
// Handle destination reserve fee (hop after exchange)
|
|
@@ -5686,7 +5696,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5686
5696
|
throw new DryRunFailedError("Hop after exchange failed: ".concat(hopAfterExchange.result.failureReason || 'Unknown reason'));
|
|
5687
5697
|
}
|
|
5688
5698
|
if (hopAfterExchange.result.success) {
|
|
5689
|
-
fees.destReserveFee =
|
|
5699
|
+
fees.destReserveFee = padValueBy(hopAfterExchange.result.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5690
5700
|
}
|
|
5691
5701
|
}
|
|
5692
5702
|
return fees;
|
|
@@ -5885,8 +5895,8 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
5885
5895
|
});
|
|
5886
5896
|
case 4:
|
|
5887
5897
|
feeResult = _context.v;
|
|
5888
|
-
originExecutionFee =
|
|
5889
|
-
destinationExecutionFee =
|
|
5898
|
+
originExecutionFee = padValueBy(feeResult.origin.fee, 20); // Pad by 20%
|
|
5899
|
+
destinationExecutionFee = padValueBy(
|
|
5890
5900
|
// Pad by 20%
|
|
5891
5901
|
feeResult.destination.feeType === 'paymentInfo' ? feeResult.origin.fee : feeResult.destination.fee, 20);
|
|
5892
5902
|
return _context.a(2, createExecuteExchangeXcm(input, origin, (_feeResult$origin$wei = feeResult.origin.weight) !== null && _feeResult$origin$wei !== void 0 ? _feeResult$origin$wei : MAX_WEIGHT, originExecutionFee, destinationExecutionFee));
|
|
@@ -10654,7 +10664,7 @@ var createMintTxs = function createMintTxs(chain, asset, balance, address, api)
|
|
|
10654
10664
|
return palletInstance.mint(address, asset, balance, chain, api);
|
|
10655
10665
|
};
|
|
10656
10666
|
var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountHuman, balance, address, api) {
|
|
10657
|
-
var amount =
|
|
10667
|
+
var amount = parseUnits(amountHuman, asset.decimals);
|
|
10658
10668
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
10659
10669
|
amount: amount
|
|
10660
10670
|
}), balance, address, api);
|
|
@@ -10662,7 +10672,7 @@ var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountH
|
|
|
10662
10672
|
var createOptionalMintTxs = function createOptionalMintTxs(chain, currency, amountHuman, balance, address, api) {
|
|
10663
10673
|
var asset = assets.findAssetInfo(chain, currency, null);
|
|
10664
10674
|
if (!asset) return null;
|
|
10665
|
-
var amount =
|
|
10675
|
+
var amount = parseUnits(amountHuman, asset.decimals);
|
|
10666
10676
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
10667
10677
|
amount: amount
|
|
10668
10678
|
}), balance, address, api);
|
|
@@ -10703,7 +10713,7 @@ var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeA
|
|
|
10703
10713
|
});
|
|
10704
10714
|
return preminted.some(function (a) {
|
|
10705
10715
|
return assets.isAssetXcEqual(a, sent);
|
|
10706
|
-
}) ?
|
|
10716
|
+
}) ? parseUnits(BYPASS_MINT_AMOUNT, sent.decimals) : 0n;
|
|
10707
10717
|
};
|
|
10708
10718
|
var wrapTxBypass = /*#__PURE__*/function () {
|
|
10709
10719
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dryRunOptions) {
|
|
@@ -10786,7 +10796,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10786
10796
|
_context.n = 8;
|
|
10787
10797
|
break;
|
|
10788
10798
|
}
|
|
10789
|
-
amount =
|
|
10799
|
+
amount = parseUnits(BYPASS_MINT_AMOUNT, feeAsset.decimals);
|
|
10790
10800
|
_context.n = 7;
|
|
10791
10801
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, feeAsset), {}, {
|
|
10792
10802
|
amount: amount
|
|
@@ -10805,7 +10815,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10805
10815
|
balance = _context.v;
|
|
10806
10816
|
bonus = mintBonusForSent(chain, asset, feeAsset, !!mintFeeAssets);
|
|
10807
10817
|
if ((options === null || options === void 0 ? void 0 : options.sentAssetMintMode) === 'bypass') {
|
|
10808
|
-
mintAmount =
|
|
10818
|
+
mintAmount = parseUnits(BYPASS_MINT_AMOUNT, asset.decimals) + asset.amount;
|
|
10809
10819
|
} else {
|
|
10810
10820
|
missing = (_calcPreviewMintAmoun = calcPreviewMintAmount(balance, asset.amount)) !== null && _calcPreviewMintAmoun !== void 0 ? _calcPreviewMintAmoun : 0n;
|
|
10811
10821
|
total = missing + bonus;
|
|
@@ -12692,7 +12702,7 @@ var computeInstructionFee = /*#__PURE__*/function () {
|
|
|
12692
12702
|
while (1) switch (_context.n) {
|
|
12693
12703
|
case 0:
|
|
12694
12704
|
chain = _ref.chain, api = _ref.api;
|
|
12695
|
-
_t =
|
|
12705
|
+
_t = padValueBy;
|
|
12696
12706
|
_context.n = 1;
|
|
12697
12707
|
return api.getXcmPaymentApiFee(chain, addXcmVersionHeader(xcm, version), [], {
|
|
12698
12708
|
location: DOT_LOCATION
|
|
@@ -14473,6 +14483,7 @@ exports.dryRun = dryRun;
|
|
|
14473
14483
|
exports.dryRunInternal = dryRunInternal;
|
|
14474
14484
|
exports.dryRunOrigin = dryRunOrigin;
|
|
14475
14485
|
exports.encodeSs58 = encodeSs58;
|
|
14486
|
+
exports.formatUnits = formatUnits;
|
|
14476
14487
|
exports.getAssetBalance = getAssetBalance;
|
|
14477
14488
|
exports.getAssetBalanceInternal = getAssetBalanceInternal;
|
|
14478
14489
|
exports.getAssetReserveChain = getAssetReserveChain;
|
|
@@ -14487,6 +14498,7 @@ exports.getChainLocation = getChainLocation;
|
|
|
14487
14498
|
exports.getChainProviders = getChainProviders;
|
|
14488
14499
|
exports.getChainVersion = getChainVersion;
|
|
14489
14500
|
exports.getCurrencySelection = getCurrencySelection;
|
|
14501
|
+
exports.getFailureInfo = getFailureInfo$1;
|
|
14490
14502
|
exports.getMinTransferableAmount = getMinTransferableAmount;
|
|
14491
14503
|
exports.getMinTransferableAmountInternal = getMinTransferableAmountInternal;
|
|
14492
14504
|
exports.getOriginFeeDetails = getOriginFeeDetails;
|
|
@@ -14513,7 +14525,8 @@ exports.maybeOverrideAsset = maybeOverrideAsset;
|
|
|
14513
14525
|
exports.maybeOverrideAssets = maybeOverrideAssets;
|
|
14514
14526
|
exports.overrideTxAmount = overrideTxAmount;
|
|
14515
14527
|
exports.padFee = padFee;
|
|
14516
|
-
exports.
|
|
14528
|
+
exports.padValueBy = padValueBy;
|
|
14529
|
+
exports.parseUnits = parseUnits;
|
|
14517
14530
|
exports.resolveDestChain = resolveDestChain;
|
|
14518
14531
|
exports.resolveModuleError = resolveModuleError;
|
|
14519
14532
|
exports.resolveParaId = resolveParaId;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { TCurrencyInputWithAmount, TCurrencyInput, WithAmount, TAssetInfo, TAsse
|
|
|
6
6
|
export * from '@paraspell/assets';
|
|
7
7
|
import { TPallet } from '@paraspell/pallets';
|
|
8
8
|
export * from '@paraspell/pallets';
|
|
9
|
-
import { WalletClient } from 'viem';
|
|
9
|
+
import { WalletClient, parseUnits as parseUnits$1, formatUnits as formatUnits$1 } from 'viem';
|
|
10
10
|
|
|
11
11
|
type WithApi<TBase, TApi, TRes> = TBase & {
|
|
12
12
|
api: IPolkadotApi<TApi, TRes>;
|
|
@@ -2164,6 +2164,8 @@ declare const dryRunInternal: <TApi, TRes>(options: TDryRunOptions<TApi, TRes>)
|
|
|
2164
2164
|
|
|
2165
2165
|
declare const dryRunOrigin: <TApi, TRes>(options: TDryRunCallOptions<TApi, TRes>) => Promise<TDryRunChainResult>;
|
|
2166
2166
|
|
|
2167
|
+
declare const getFailureInfo: (result: TDryRunResult) => Pick<TDryRunResult, "failureReason" | "failureChain">;
|
|
2168
|
+
|
|
2167
2169
|
declare const traverseXcmHops: <TApi, TRes, THopResult>(config: HopTraversalConfig<TApi, TRes, THopResult>) => Promise<HopTraversalResult<THopResult>>;
|
|
2168
2170
|
declare const addEthereumBridgeFees: <TApi, TRes, TResult extends {
|
|
2169
2171
|
fee?: bigint;
|
|
@@ -2268,7 +2270,7 @@ declare const computeFeeFromDryRunPjs: (dryRun: any, chain: TSubstrateChain, exe
|
|
|
2268
2270
|
declare const resolveModuleError: (chain: TSubstrateChain, error: TModuleError) => XTokensError | PolkadotXcmError;
|
|
2269
2271
|
|
|
2270
2272
|
declare const padFee: (raw: bigint, origin: TSubstrateChain, dest: TChain, side: "origin" | "destination") => bigint;
|
|
2271
|
-
declare const
|
|
2273
|
+
declare const padValueBy: (amount: bigint, percent: number) => bigint;
|
|
2272
2274
|
|
|
2273
2275
|
/**
|
|
2274
2276
|
* Retrieves the chain instance for a given chain.
|
|
@@ -2332,7 +2334,10 @@ declare const handleSwapExecuteTransfer: <TApi, TRes>(options: TCreateSwapXcmOpt
|
|
|
2332
2334
|
|
|
2333
2335
|
declare const handleToAhTeleport: <TApi, TRes>(origin: TParachain, input: TPolkadotXCMTransferOptions<TApi, TRes>, defaultTx: TRes) => Promise<TRes>;
|
|
2334
2336
|
|
|
2337
|
+
declare const parseUnits: typeof parseUnits$1;
|
|
2338
|
+
declare const formatUnits: typeof formatUnits$1;
|
|
2339
|
+
|
|
2335
2340
|
declare const validateAddress: (address: TAddress, chain: TChain, isDestination?: boolean) => void;
|
|
2336
2341
|
|
|
2337
|
-
export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, overrideTxAmount, padFee,
|
|
2342
|
+
export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, formatUnits, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getFailureInfo, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, overrideTxAmount, padFee, padValueBy, parseUnits, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
|
|
2338
2343
|
export type { BuildHopInfoOptions, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TBatchOptions, TBatchedSendOptions, TBifrostToken, TBridgeStatus, TBuildDestInfoOptions, TBuildInternalRes, TBuilderConfig, TBuilderOptions, TBypassOptions, TChainConfig, TChainConfigMap, TChainWithApi, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TCreateTxsOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignByAssetOptions, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeInternalOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeInternalOptions, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapConfig, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TTxFactory, TTypeAndThenCallContext, TTypeAndThenFees, TUrl, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { blake2b } from '@noble/hashes/blake2';
|
|
|
2
2
|
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findNativeAssetInfoOrThrow, findAssetInfo, isTAsset, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow, findAssetInfoOnDest, Native, hasXcmPaymentApiSupport, getExistentialDeposit, 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
|
-
import { isAddress, parseUnits, createPublicClient, http, getContract, pad, toHex, getAddress, concat, keccak256 } from 'viem';
|
|
5
|
+
import { isAddress, parseUnits as parseUnits$1, formatUnits as formatUnits$1, createPublicClient, http, getContract, pad, toHex, getAddress, concat, keccak256 } from 'viem';
|
|
6
6
|
import { getSupportedPalletsDetails, getDefaultPallet, getSupportedPallets, getNativeAssetsPallet, getOtherAssetsPallets } from '@paraspell/pallets';
|
|
7
7
|
export * from '@paraspell/pallets';
|
|
8
8
|
import { replaceBigInt, isTLocation, Version, hasJunction, getJunctionValue, isRelayChain, Parents, PARACHAINS, deepEqual, isTrustedChain, isExternalChain, isDotKsmBridge, isSystemChain } from '@paraspell/sdk-common';
|
|
@@ -839,6 +839,9 @@ var sortAssets = function sortAssets(assets) {
|
|
|
839
839
|
});
|
|
840
840
|
};
|
|
841
841
|
|
|
842
|
+
var parseUnits = parseUnits$1;
|
|
843
|
+
var formatUnits = formatUnits$1;
|
|
844
|
+
|
|
842
845
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
843
846
|
var isConfig = function isConfig(value) {
|
|
844
847
|
return _typeof(value) === 'object' && value !== null && !Array.isArray(value) && (
|
|
@@ -1222,7 +1225,7 @@ var padFee = function padFee(raw, origin, dest, side) {
|
|
|
1222
1225
|
// apply default 30% padding
|
|
1223
1226
|
return mul(raw, 130n, 100n);
|
|
1224
1227
|
};
|
|
1225
|
-
var
|
|
1228
|
+
var padValueBy = function padValueBy(amount, percent) {
|
|
1226
1229
|
return mul(amount, BigInt(100 + percent), 100n);
|
|
1227
1230
|
};
|
|
1228
1231
|
|
|
@@ -3696,9 +3699,9 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3696
3699
|
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
3697
3700
|
case 2:
|
|
3698
3701
|
originFeeEstimate = dryRunResult.origin.fee;
|
|
3699
|
-
originFee =
|
|
3702
|
+
originFee = padValueBy(originFeeEstimate, FEE_PADDING_PERCENTAGE$2);
|
|
3700
3703
|
reserveFeeEstimate = getReserveFeeFromHops(dryRunResult.hops);
|
|
3701
|
-
reserveFee =
|
|
3704
|
+
reserveFee = padValueBy(reserveFeeEstimate, FEE_PADDING_PERCENTAGE$2);
|
|
3702
3705
|
checkAmount(feeAssetInfo && !isAssetEqual(assetInfo, feeAssetInfo) ? reserveFee : originFee + reserveFee);
|
|
3703
3706
|
xcm = createDirectExecuteXcm(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
|
|
3704
3707
|
fees: {
|
|
@@ -3748,7 +3751,7 @@ var getMythosOriginFee = /*#__PURE__*/function () {
|
|
|
3748
3751
|
}
|
|
3749
3752
|
throw new InvalidParameterError("Pool DOT -> ".concat(nativeAsset.symbol, " not found."));
|
|
3750
3753
|
case 4:
|
|
3751
|
-
return _context.a(2,
|
|
3754
|
+
return _context.a(2, padValueBy(feeConverted, 10));
|
|
3752
3755
|
}
|
|
3753
3756
|
}, _callee);
|
|
3754
3757
|
}));
|
|
@@ -4498,6 +4501,50 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4498
4501
|
};
|
|
4499
4502
|
}();
|
|
4500
4503
|
|
|
4504
|
+
var getFailureInfo$1 = function getFailureInfo(result) {
|
|
4505
|
+
var orderedChecks = [{
|
|
4506
|
+
chain: 'origin',
|
|
4507
|
+
chainResult: result.origin
|
|
4508
|
+
}, {
|
|
4509
|
+
chain: 'destination',
|
|
4510
|
+
chainResult: result.destination
|
|
4511
|
+
}, {
|
|
4512
|
+
chain: 'assetHub',
|
|
4513
|
+
chainResult: result.assetHub
|
|
4514
|
+
}, {
|
|
4515
|
+
chain: 'bridgeHub',
|
|
4516
|
+
chainResult: result.bridgeHub
|
|
4517
|
+
}].concat(_toConsumableArray(result.hops.map(function (hop) {
|
|
4518
|
+
return {
|
|
4519
|
+
chain: hop.chain,
|
|
4520
|
+
chainResult: hop.result
|
|
4521
|
+
};
|
|
4522
|
+
})));
|
|
4523
|
+
var _iterator = _createForOfIteratorHelper(orderedChecks),
|
|
4524
|
+
_step;
|
|
4525
|
+
try {
|
|
4526
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4527
|
+
var _step$value = _step.value,
|
|
4528
|
+
chain = _step$value.chain,
|
|
4529
|
+
chainResult = _step$value.chainResult;
|
|
4530
|
+
if (chainResult && chainResult.success === false && chainResult.failureReason) {
|
|
4531
|
+
return {
|
|
4532
|
+
failureChain: chain,
|
|
4533
|
+
failureReason: chainResult.failureReason
|
|
4534
|
+
};
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
} catch (err) {
|
|
4538
|
+
_iterator.e(err);
|
|
4539
|
+
} finally {
|
|
4540
|
+
_iterator.f();
|
|
4541
|
+
}
|
|
4542
|
+
return {
|
|
4543
|
+
failureChain: result.failureChain,
|
|
4544
|
+
failureReason: result.failureReason
|
|
4545
|
+
};
|
|
4546
|
+
};
|
|
4547
|
+
|
|
4501
4548
|
var getParaEthTransferFees = /*#__PURE__*/function () {
|
|
4502
4549
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(ahApi) {
|
|
4503
4550
|
var DEFAULT_FEE, feeStorageItem, leFeeHex, bytes, reversedHex, validReversedHex, leFee, transferBridgeFee, finalBridgeFee, finalAssethubExecutionFee;
|
|
@@ -5223,41 +5270,10 @@ var addEthereumBridgeFees = /*#__PURE__*/function () {
|
|
|
5223
5270
|
};
|
|
5224
5271
|
}();
|
|
5225
5272
|
|
|
5226
|
-
var getFailureInfo$1 = function getFailureInfo(results, hops) {
|
|
5227
|
-
// Check standard chains first for backwards compatibility
|
|
5228
|
-
for (var _i = 0, _arr = ['destination', 'assetHub', 'bridgeHub']; _i < _arr.length; _i++) {
|
|
5229
|
-
var chain = _arr[_i];
|
|
5230
|
-
var res = results[chain];
|
|
5231
|
-
if (res && !res.success && res.failureReason) {
|
|
5232
|
-
return {
|
|
5233
|
-
failureReason: res.failureReason,
|
|
5234
|
-
failureChain: chain
|
|
5235
|
-
};
|
|
5236
|
-
}
|
|
5237
|
-
}
|
|
5238
|
-
var _iterator = _createForOfIteratorHelper(hops),
|
|
5239
|
-
_step;
|
|
5240
|
-
try {
|
|
5241
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
5242
|
-
var hop = _step.value;
|
|
5243
|
-
if (!hop.result.success && hop.result.failureReason) {
|
|
5244
|
-
return {
|
|
5245
|
-
failureReason: hop.result.failureReason,
|
|
5246
|
-
failureChain: hop.chain
|
|
5247
|
-
};
|
|
5248
|
-
}
|
|
5249
|
-
}
|
|
5250
|
-
} catch (err) {
|
|
5251
|
-
_iterator.e(err);
|
|
5252
|
-
} finally {
|
|
5253
|
-
_iterator.f();
|
|
5254
|
-
}
|
|
5255
|
-
return {};
|
|
5256
|
-
};
|
|
5257
5273
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
5258
5274
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5259
5275
|
var _traversalResult$brid;
|
|
5260
|
-
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,
|
|
5276
|
+
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, result, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
5261
5277
|
return _regenerator().w(function (_context2) {
|
|
5262
5278
|
while (1) switch (_context2.n) {
|
|
5263
5279
|
case 0:
|
|
@@ -5430,20 +5446,14 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5430
5446
|
currency: getNativeAssetSymbol(bridgeHubChain),
|
|
5431
5447
|
asset: findNativeAssetInfoOrThrow(bridgeHubChain)
|
|
5432
5448
|
}) : processedBridgeHub;
|
|
5433
|
-
|
|
5434
|
-
destination: traversalResult.destination,
|
|
5435
|
-
assetHub: traversalResult.assetHub,
|
|
5436
|
-
bridgeHub: bridgeHubWithCurrency
|
|
5437
|
-
}, traversalResult.hops), failureReason = _getFailureInfo.failureReason, failureChain = _getFailureInfo.failureChain;
|
|
5438
|
-
return _context2.a(2, {
|
|
5439
|
-
failureReason: failureReason,
|
|
5440
|
-
failureChain: failureChain,
|
|
5449
|
+
result = {
|
|
5441
5450
|
origin: originDryModified,
|
|
5442
5451
|
assetHub: traversalResult.assetHub,
|
|
5443
5452
|
bridgeHub: bridgeHubWithCurrency,
|
|
5444
5453
|
destination: traversalResult.destination,
|
|
5445
5454
|
hops: traversalResult.hops
|
|
5446
|
-
}
|
|
5455
|
+
};
|
|
5456
|
+
return _context2.a(2, _objectSpread2(_objectSpread2({}, getFailureInfo$1(result)), result));
|
|
5447
5457
|
}
|
|
5448
5458
|
}, _callee2);
|
|
5449
5459
|
}));
|
|
@@ -5640,7 +5650,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5640
5650
|
throw new DryRunFailedError("Exchange (destination) failed: ".concat(dryRunResult.destination.failureReason || 'Unknown reason'));
|
|
5641
5651
|
}
|
|
5642
5652
|
if (dryRunResult.destination && dryRunResult.destination.success) {
|
|
5643
|
-
fees.exchangeFee =
|
|
5653
|
+
fees.exchangeFee = padValueBy(dryRunResult.destination.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5644
5654
|
}
|
|
5645
5655
|
} else {
|
|
5646
5656
|
// Normal case: exchange is an intermediate hop
|
|
@@ -5649,7 +5659,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5649
5659
|
throw new DryRunFailedError("Exchange hop failed: ".concat(exchangeHop.result.failureReason || 'Unknown reason'));
|
|
5650
5660
|
}
|
|
5651
5661
|
if (exchangeHop.result.success) {
|
|
5652
|
-
fees.exchangeFee =
|
|
5662
|
+
fees.exchangeFee = padValueBy(exchangeHop.result.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5653
5663
|
}
|
|
5654
5664
|
}
|
|
5655
5665
|
} else {
|
|
@@ -5666,7 +5676,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5666
5676
|
throw new DryRunFailedError("Hop before exchange failed: ".concat(hopBeforeExchange.result.failureReason || 'Unknown reason'));
|
|
5667
5677
|
}
|
|
5668
5678
|
if (hopBeforeExchange.result.success) {
|
|
5669
|
-
fees.originReserveFee =
|
|
5679
|
+
fees.originReserveFee = padValueBy(hopBeforeExchange.result.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5670
5680
|
}
|
|
5671
5681
|
} else if (!destChain && hops.length > 0) {
|
|
5672
5682
|
// Special case: when destChain is undefined and we have hops,
|
|
@@ -5676,7 +5686,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5676
5686
|
throw new DryRunFailedError("Origin reserve hop failed: ".concat(lastHop.result.failureReason || 'Unknown reason'));
|
|
5677
5687
|
}
|
|
5678
5688
|
if (lastHop.result.success) {
|
|
5679
|
-
fees.originReserveFee =
|
|
5689
|
+
fees.originReserveFee = padValueBy(lastHop.result.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5680
5690
|
}
|
|
5681
5691
|
}
|
|
5682
5692
|
// Handle destination reserve fee (hop after exchange)
|
|
@@ -5687,7 +5697,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5687
5697
|
throw new DryRunFailedError("Hop after exchange failed: ".concat(hopAfterExchange.result.failureReason || 'Unknown reason'));
|
|
5688
5698
|
}
|
|
5689
5699
|
if (hopAfterExchange.result.success) {
|
|
5690
|
-
fees.destReserveFee =
|
|
5700
|
+
fees.destReserveFee = padValueBy(hopAfterExchange.result.fee, FEE_PADDING_PERCENTAGE$1);
|
|
5691
5701
|
}
|
|
5692
5702
|
}
|
|
5693
5703
|
return fees;
|
|
@@ -5886,8 +5896,8 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
5886
5896
|
});
|
|
5887
5897
|
case 4:
|
|
5888
5898
|
feeResult = _context.v;
|
|
5889
|
-
originExecutionFee =
|
|
5890
|
-
destinationExecutionFee =
|
|
5899
|
+
originExecutionFee = padValueBy(feeResult.origin.fee, 20); // Pad by 20%
|
|
5900
|
+
destinationExecutionFee = padValueBy(
|
|
5891
5901
|
// Pad by 20%
|
|
5892
5902
|
feeResult.destination.feeType === 'paymentInfo' ? feeResult.origin.fee : feeResult.destination.fee, 20);
|
|
5893
5903
|
return _context.a(2, createExecuteExchangeXcm(input, origin, (_feeResult$origin$wei = feeResult.origin.weight) !== null && _feeResult$origin$wei !== void 0 ? _feeResult$origin$wei : MAX_WEIGHT, originExecutionFee, destinationExecutionFee));
|
|
@@ -12693,7 +12703,7 @@ var computeInstructionFee = /*#__PURE__*/function () {
|
|
|
12693
12703
|
while (1) switch (_context.n) {
|
|
12694
12704
|
case 0:
|
|
12695
12705
|
chain = _ref.chain, api = _ref.api;
|
|
12696
|
-
_t =
|
|
12706
|
+
_t = padValueBy;
|
|
12697
12707
|
_context.n = 1;
|
|
12698
12708
|
return api.getXcmPaymentApiFee(chain, addXcmVersionHeader(xcm, version), [], {
|
|
12699
12709
|
location: DOT_LOCATION
|
|
@@ -14417,4 +14427,4 @@ var Builder = function Builder(api) {
|
|
|
14417
14427
|
return new GeneralBuilder(api, new BatchTransactionManager());
|
|
14418
14428
|
};
|
|
14419
14429
|
|
|
14420
|
-
export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, overrideTxAmount, padFee,
|
|
14430
|
+
export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, formatUnits, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getFailureInfo$1 as getFailureInfo, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, overrideTxAmount, padFee, padValueBy, parseUnits, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.12.1",
|
|
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.37.9",
|
|
29
|
-
"@paraspell/
|
|
30
|
-
"@paraspell/
|
|
31
|
-
"@paraspell/
|
|
29
|
+
"@paraspell/assets": "11.12.1",
|
|
30
|
+
"@paraspell/pallets": "11.12.1",
|
|
31
|
+
"@paraspell/sdk-common": "11.12.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|