@paraspell/swap 14.3.4 → 14.3.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.mjs +16 -2
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -577,11 +577,11 @@ var assignIsExchange = function assignIsExchange(result, options) {
|
|
|
577
577
|
var dryRunTransaction = /*#__PURE__*/function () {
|
|
578
578
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, transaction, destChain, bypassOptions) {
|
|
579
579
|
var _ref2;
|
|
580
|
-
var api, exchange, sender, evmSenderAddress, destination, currencyFrom, currencyTo, amount, tx, chain, senderResolved, resolvedDest;
|
|
580
|
+
var api, exchange, sender, evmSenderAddress, destination, currencyFrom, currencyTo, feeAsset, amount, tx, chain, senderResolved, resolvedDest;
|
|
581
581
|
return _regenerator().w(function (_context) {
|
|
582
582
|
while (1) switch (_context.n) {
|
|
583
583
|
case 0:
|
|
584
|
-
api = options.api, exchange = options.exchange, sender = options.sender, evmSenderAddress = options.evmSenderAddress, destination = options.destination, currencyFrom = options.currencyFrom, currencyTo = options.currencyTo, amount = options.amount;
|
|
584
|
+
api = options.api, exchange = options.exchange, sender = options.sender, evmSenderAddress = options.evmSenderAddress, destination = options.destination, currencyFrom = options.currencyFrom, currencyTo = options.currencyTo, feeAsset = options.feeAsset, amount = options.amount;
|
|
585
585
|
tx = transaction.tx, chain = transaction.chain;
|
|
586
586
|
assertCurrencyCore(currencyTo);
|
|
587
587
|
senderResolved = evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender;
|
|
@@ -599,6 +599,7 @@ var dryRunTransaction = /*#__PURE__*/function () {
|
|
|
599
599
|
currency: _objectSpread2(_objectSpread2({}, currencyFrom), {}, {
|
|
600
600
|
amount: BigInt(amount)
|
|
601
601
|
}),
|
|
602
|
+
feeAsset: feeAsset,
|
|
602
603
|
bypassOptions: bypassOptions
|
|
603
604
|
}));
|
|
604
605
|
}
|
|
@@ -10328,6 +10329,12 @@ var validateTransferOptions = function validateTransferOptions(options) {
|
|
|
10328
10329
|
throw new MissingParameterError('evmSenderAddress', 'EVM sender address is required');
|
|
10329
10330
|
}
|
|
10330
10331
|
};
|
|
10332
|
+
var validateRoutedFeeAsset = function validateRoutedFeeAsset(_ref) {
|
|
10333
|
+
var feeAsset = _ref.feeAsset;
|
|
10334
|
+
if (feeAsset) {
|
|
10335
|
+
throw new ScenarioNotSupportedError('Fee asset is only supported for swaps that use the execute transfer');
|
|
10336
|
+
}
|
|
10337
|
+
};
|
|
10331
10338
|
|
|
10332
10339
|
var FEE_ESTIMATION_UNITS = '100';
|
|
10333
10340
|
var calculateFromExchangeFee = /*#__PURE__*/function () {
|
|
@@ -10441,6 +10448,8 @@ var prepareExtrinsics = /*#__PURE__*/function () {
|
|
|
10441
10448
|
}
|
|
10442
10449
|
throw _t;
|
|
10443
10450
|
case 4:
|
|
10451
|
+
validateRoutedFeeAsset(options);
|
|
10452
|
+
// 1. Create transfer origin -> exchange (optional)
|
|
10444
10453
|
if (!(origin && origin.chain !== exchange.chain)) {
|
|
10445
10454
|
_context.n = 6;
|
|
10446
10455
|
break;
|
|
@@ -10616,6 +10625,8 @@ var getSwapOriginFee = /*#__PURE__*/function () {
|
|
|
10616
10625
|
}
|
|
10617
10626
|
throw _t;
|
|
10618
10627
|
case 4:
|
|
10628
|
+
validateRoutedFeeAsset(options);
|
|
10629
|
+
// Origin chain is upstream from the exchange — fee is the cost of origin -> exchange
|
|
10619
10630
|
if (!(origin && origin.chain !== exchange.chain)) {
|
|
10620
10631
|
_context.n = 5;
|
|
10621
10632
|
break;
|
|
@@ -10786,6 +10797,8 @@ var getRouterFees = /*#__PURE__*/function () {
|
|
|
10786
10797
|
}
|
|
10787
10798
|
throw _t;
|
|
10788
10799
|
case 4:
|
|
10800
|
+
validateRoutedFeeAsset(options);
|
|
10801
|
+
// 1. Get fees for origin -> exchange (optional)
|
|
10789
10802
|
if (!(origin && origin.chain !== exchange.chain)) {
|
|
10790
10803
|
_context.n = 6;
|
|
10791
10804
|
break;
|
|
@@ -11535,6 +11548,7 @@ var getSwapInfo = /*#__PURE__*/function () {
|
|
|
11535
11548
|
}
|
|
11536
11549
|
throw _t;
|
|
11537
11550
|
case 5:
|
|
11551
|
+
validateRoutedFeeAsset(options);
|
|
11538
11552
|
api = options.api, origin = options.origin, exchange = options.exchange, currencyTo = options.currencyTo, destination = options.destination, amount = options.amount, sender = options.sender, evmSenderAddress = options.evmSenderAddress;
|
|
11539
11553
|
assertCurrencyCore(currencyTo);
|
|
11540
11554
|
senderAddress = evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/swap",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.5",
|
|
4
4
|
"description": "Tool for XCM cross-chain asset exchanging across Polkadot and Kusama ecosystems",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"@crypto-dex-sdk/token-lists": "^0.1.4",
|
|
39
39
|
"@galacticcouncil/descriptors": "^2.7.0",
|
|
40
40
|
"@galacticcouncil/sdk-next": "^2.1.0",
|
|
41
|
-
"@paraspell/sdk": "14.3.
|
|
42
|
-
"@paraspell/sdk-common": "14.3.
|
|
43
|
-
"@paraspell/sdk-core": "14.3.
|
|
44
|
-
"@paraspell/sdk-pjs": "14.3.
|
|
41
|
+
"@paraspell/sdk": "14.3.5",
|
|
42
|
+
"@paraspell/sdk-common": "14.3.5",
|
|
43
|
+
"@paraspell/sdk-core": "14.3.5",
|
|
44
|
+
"@paraspell/sdk-pjs": "14.3.5",
|
|
45
45
|
"@polkadot/api": "^16.5.6",
|
|
46
46
|
"@polkadot/types": "^16.5.6",
|
|
47
47
|
"@polkadot/util": "^14.0.3",
|