@paraspell/swap 14.4.3 → 14.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +118 -11
- package/package.json +14 -14
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createChainClient as createChainClient$1, getPaymentInfo, registerSwapExtension } from '@paraspell/sdk';
|
|
2
|
-
import { UnsupportedOperationError, assertCurrencyCore, dryRun, getDryRunError, DryRunFailedError, isConfig, getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, Parents, isSymbolMatch, getParaId, UnableToComputeError, findNativeAssetInfoOrThrow, InvalidCurrencyError, findAssetInfoOrThrow, findAssetInfoByLoc, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, getSupportedAssetsImpl, isAssetEqual, findAssetInfoOnDestImpl, normalizeExchange, EXCHANGE_CHAINS, deepEqual, reverseTransformLocation, getAssetsImpl, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, Builder, isChainEvm, convertBuilderConfig, handleSwapExecuteTransfer, getXcmFee, getOriginXcmFee as getOriginXcmFee$1, InvalidAddressError, MissingParameterError, BatchMode, createChainClient as createChainClient$2, getExistentialDeposit, buildHopInfo, getRelayChainSymbol, aggregateHopFees, buildDestInfo, buildOriginInfo } from '@paraspell/sdk-core';
|
|
2
|
+
import { UnsupportedOperationError, assertCurrencyCore, dryRun, getDryRunError, DryRunFailedError, isConfig, getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, Parents, isSymbolMatch, getParaId, UnableToComputeError, findNativeAssetInfoOrThrow, InvalidCurrencyError, findAssetInfoOrThrow, findAssetInfoByLoc, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, getSupportedAssetsImpl, isAssetEqual, findAssetInfoOnDestImpl, normalizeExchange, EXCHANGE_CHAINS, deepEqual, reverseTransformLocation, getAssetsImpl, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, replaceBigInt, Builder, isChainEvm, convertBuilderConfig, handleSwapExecuteTransfer, getXcmFee, getOriginXcmFee as getOriginXcmFee$1, InvalidAddressError, MissingParameterError, BatchMode, createChainClient as createChainClient$2, getExistentialDeposit, buildHopInfo, getRelayChainSymbol, aggregateHopFees, buildDestInfo, buildOriginInfo } from '@paraspell/sdk-core';
|
|
3
3
|
import { toHex } from 'polkadot-api/utils';
|
|
4
4
|
import 'polkadot-api';
|
|
5
5
|
import { Wallet } from '@acala-network/sdk';
|
|
@@ -1733,6 +1733,31 @@ var Hydration = {
|
|
|
1733
1733
|
]
|
|
1734
1734
|
}
|
|
1735
1735
|
},
|
|
1736
|
+
{
|
|
1737
|
+
parents: 1,
|
|
1738
|
+
interior: {
|
|
1739
|
+
X4: [
|
|
1740
|
+
{
|
|
1741
|
+
Parachain: 2034
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
GeneralKey: {
|
|
1745
|
+
length: 2,
|
|
1746
|
+
data: "0x7768000000000000000000000000000000000000000000000000000000000000"
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
GeneralIndex: 72
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
GeneralKey: {
|
|
1754
|
+
length: 32,
|
|
1755
|
+
data: "0x000000000000000000000000117cc2133c37b721f49de2a7a74833232b3b4c0c"
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
]
|
|
1759
|
+
}
|
|
1760
|
+
},
|
|
1736
1761
|
{
|
|
1737
1762
|
parents: 1,
|
|
1738
1763
|
interior: {
|
|
@@ -1976,6 +2001,47 @@ var Hydration = {
|
|
|
1976
2001
|
]
|
|
1977
2002
|
}
|
|
1978
2003
|
},
|
|
2004
|
+
{
|
|
2005
|
+
parents: 1,
|
|
2006
|
+
interior: {
|
|
2007
|
+
X4: [
|
|
2008
|
+
{
|
|
2009
|
+
Parachain: 2034
|
|
2010
|
+
},
|
|
2011
|
+
{
|
|
2012
|
+
GeneralKey: {
|
|
2013
|
+
length: 2,
|
|
2014
|
+
data: "0x7768000000000000000000000000000000000000000000000000000000000000"
|
|
2015
|
+
}
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
GeneralIndex: 15
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
GeneralKey: {
|
|
2022
|
+
length: 32,
|
|
2023
|
+
data: "0x3174446b8cc98197d6f2c9e504d6d229f0adb00d2b7566af0e54a84a876fef0f"
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
]
|
|
2027
|
+
}
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
parents: 1,
|
|
2031
|
+
interior: {
|
|
2032
|
+
X2: [
|
|
2033
|
+
{
|
|
2034
|
+
Parachain: 2034
|
|
2035
|
+
},
|
|
2036
|
+
{
|
|
2037
|
+
AccountKey20: {
|
|
2038
|
+
network: null,
|
|
2039
|
+
key: "0xc29286aa0ed2fcb4fc581c8f0a068328e18ef075"
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
]
|
|
2043
|
+
}
|
|
2044
|
+
},
|
|
1979
2045
|
{
|
|
1980
2046
|
parents: 1,
|
|
1981
2047
|
interior: {
|
|
@@ -2260,6 +2326,31 @@ var Hydration = {
|
|
|
2260
2326
|
]
|
|
2261
2327
|
}
|
|
2262
2328
|
},
|
|
2329
|
+
{
|
|
2330
|
+
parents: 1,
|
|
2331
|
+
interior: {
|
|
2332
|
+
X4: [
|
|
2333
|
+
{
|
|
2334
|
+
Parachain: 2034
|
|
2335
|
+
},
|
|
2336
|
+
{
|
|
2337
|
+
GeneralKey: {
|
|
2338
|
+
length: 2,
|
|
2339
|
+
data: "0x7768000000000000000000000000000000000000000000000000000000000000"
|
|
2340
|
+
}
|
|
2341
|
+
},
|
|
2342
|
+
{
|
|
2343
|
+
GeneralIndex: 47
|
|
2344
|
+
},
|
|
2345
|
+
{
|
|
2346
|
+
GeneralKey: {
|
|
2347
|
+
length: 32,
|
|
2348
|
+
data: "0x0000000000000000000000005555555555555555555555555555555555555555"
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
]
|
|
2352
|
+
}
|
|
2353
|
+
},
|
|
2263
2354
|
{
|
|
2264
2355
|
parents: 1,
|
|
2265
2356
|
interior: {
|
|
@@ -2478,6 +2569,22 @@ var Hydration = {
|
|
|
2478
2569
|
]
|
|
2479
2570
|
}
|
|
2480
2571
|
},
|
|
2572
|
+
{
|
|
2573
|
+
parents: 1,
|
|
2574
|
+
interior: {
|
|
2575
|
+
X2: [
|
|
2576
|
+
{
|
|
2577
|
+
Parachain: 2034
|
|
2578
|
+
},
|
|
2579
|
+
{
|
|
2580
|
+
AccountKey20: {
|
|
2581
|
+
network: null,
|
|
2582
|
+
key: "0xa8f540fb7852024da35d30947be0899299ba42f1"
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
]
|
|
2586
|
+
}
|
|
2587
|
+
},
|
|
2481
2588
|
{
|
|
2482
2589
|
parents: 1,
|
|
2483
2590
|
interior: {
|
|
@@ -9672,7 +9779,7 @@ var selectBestExchangeCommon = /*#__PURE__*/function () {
|
|
|
9672
9779
|
_context2.n = 1;
|
|
9673
9780
|
break;
|
|
9674
9781
|
}
|
|
9675
|
-
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(options.currencyFrom), " not found in ").concat(options.from, "."));
|
|
9782
|
+
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(options.currencyFrom, replaceBigInt), " not found in ").concat(options.from, "."));
|
|
9676
9783
|
case 1:
|
|
9677
9784
|
if (!('id' in currencyTo)) {
|
|
9678
9785
|
_context2.n = 2;
|
|
@@ -9951,31 +10058,31 @@ var resolveAssets = function resolveAssets(dex, _ref) {
|
|
|
9951
10058
|
var destinationSpecified = to && to !== dex.chain;
|
|
9952
10059
|
var assetFromOrigin = originSpecified ? findAssetInfo(from, currencyFrom, dex.chain) : undefined;
|
|
9953
10060
|
if (originSpecified && !assetFromOrigin) {
|
|
9954
|
-
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(currencyFrom), " not found in ").concat(from, "."));
|
|
10061
|
+
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(currencyFrom, replaceBigInt), " not found in ").concat(from, "."));
|
|
9955
10062
|
}
|
|
9956
10063
|
var assetFromExchange = originSpecified && assetFromOrigin ? getExchangeAssetByOriginAsset(from, dex.chain, assetFromOrigin) : getExchangeAsset(dex.chain, currencyFrom);
|
|
9957
10064
|
if (!assetFromExchange) {
|
|
9958
10065
|
if (!originSpecified && findAssetInfo(dex.chain, currencyFrom)) {
|
|
9959
|
-
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(currencyFrom), " exists in ").concat(dex.chain, " but is not swappable on ").concat(dex.chain, "."));
|
|
10066
|
+
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(currencyFrom, replaceBigInt), " exists in ").concat(dex.chain, " but is not swappable on ").concat(dex.chain, "."));
|
|
9960
10067
|
}
|
|
9961
|
-
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(currencyFrom), " not found in ").concat(dex.chain, "."));
|
|
10068
|
+
throw new RoutingResolutionError("Currency from ".concat(JSON.stringify(currencyFrom, replaceBigInt), " not found in ").concat(dex.chain, "."));
|
|
9962
10069
|
}
|
|
9963
10070
|
var assetTo = getExchangeAsset(dex.chain, currencyTo);
|
|
9964
10071
|
if (!assetTo) {
|
|
9965
|
-
throw new RoutingResolutionError("Currency to ".concat(JSON.stringify(currencyTo), " not found in ").concat(dex.chain, "."));
|
|
10072
|
+
throw new RoutingResolutionError("Currency to ".concat(JSON.stringify(currencyTo, replaceBigInt), " not found in ").concat(dex.chain, "."));
|
|
9966
10073
|
}
|
|
9967
10074
|
if (destinationSpecified && !getSupportedAssetsImpl(dex.chain, to).some(function (asset) {
|
|
9968
10075
|
return isAssetEqual(asset, assetTo);
|
|
9969
10076
|
})) {
|
|
9970
|
-
throw new RoutingResolutionError("Currency to ".concat(JSON.stringify(currencyTo), " not supported by ").concat(to, "."));
|
|
10077
|
+
throw new RoutingResolutionError("Currency to ".concat(JSON.stringify(currencyTo, replaceBigInt), " not supported by ").concat(to, "."));
|
|
9971
10078
|
}
|
|
9972
10079
|
var feeAssetFromOrigin = feeAsset && originSpecified ? (_findAssetInfo = findAssetInfo(from, feeAsset, dex.chain)) !== null && _findAssetInfo !== void 0 ? _findAssetInfo : undefined : undefined;
|
|
9973
10080
|
if (feeAsset && originSpecified && !feeAssetFromOrigin) {
|
|
9974
|
-
throw new RoutingResolutionError("Fee asset ".concat(JSON.stringify(feeAsset), " not found in ").concat(from, "."));
|
|
10081
|
+
throw new RoutingResolutionError("Fee asset ".concat(JSON.stringify(feeAsset, replaceBigInt), " not found in ").concat(from, "."));
|
|
9975
10082
|
}
|
|
9976
10083
|
var feeAssetFromExchange = feeAsset ? from && feeAssetFromOrigin ? getExchangeAssetByOriginAsset(from, dex.chain, feeAssetFromOrigin) : (_getExchangeAsset = getExchangeAsset(dex.chain, feeAsset)) !== null && _getExchangeAsset !== void 0 ? _getExchangeAsset : undefined : undefined;
|
|
9977
10084
|
if (feeAsset && !feeAssetFromOrigin && !feeAssetFromExchange) {
|
|
9978
|
-
throw new RoutingResolutionError("Fee asset ".concat(JSON.stringify(feeAsset), " not found in ").concat(dex.chain, "."));
|
|
10085
|
+
throw new RoutingResolutionError("Fee asset ".concat(JSON.stringify(feeAsset, replaceBigInt), " not found in ").concat(dex.chain, "."));
|
|
9979
10086
|
}
|
|
9980
10087
|
var resolvedFeeAssetLocation = (_feeAssetFromOrigin$l = feeAssetFromOrigin === null || feeAssetFromOrigin === void 0 ? void 0 : feeAssetFromOrigin.location) !== null && _feeAssetFromOrigin$l !== void 0 ? _feeAssetFromOrigin$l : feeAssetFromExchange === null || feeAssetFromExchange === void 0 ? void 0 : feeAssetFromExchange.location;
|
|
9981
10088
|
if (feeAsset && resolvedFeeAssetLocation) {
|
|
@@ -9983,7 +10090,7 @@ var resolveAssets = function resolveAssets(dex, _ref) {
|
|
|
9983
10090
|
location: resolvedFeeAssetLocation
|
|
9984
10091
|
}, null);
|
|
9985
10092
|
if (!sdkAsset.isFeeAsset) {
|
|
9986
|
-
throw new RoutingResolutionError("Asset ".concat(JSON.stringify(feeAsset), " is not a valid fee asset in ").concat(from !== null && from !== void 0 ? from : dex.chain, "."));
|
|
10093
|
+
throw new RoutingResolutionError("Asset ".concat(JSON.stringify(feeAsset, replaceBigInt), " is not a valid fee asset in ").concat(from !== null && from !== void 0 ? from : dex.chain, "."));
|
|
9987
10094
|
}
|
|
9988
10095
|
}
|
|
9989
10096
|
return {
|
|
@@ -11748,7 +11855,7 @@ var SwapBuilderCore = /*#__PURE__*/function () {
|
|
|
11748
11855
|
key: "amount",
|
|
11749
11856
|
value: function amount(_amount) {
|
|
11750
11857
|
return new SwapBuilderCore(this._api, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
11751
|
-
amount: _amount
|
|
11858
|
+
amount: _amount
|
|
11752
11859
|
}));
|
|
11753
11860
|
}
|
|
11754
11861
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/swap",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.5.0",
|
|
4
4
|
"description": "Tool for XCM cross-chain asset exchanging across Polkadot and Kusama ecosystems",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"@crypto-dex-sdk/parachains-bifrost": "^0.1.5",
|
|
38
38
|
"@crypto-dex-sdk/token-lists": "^0.1.4",
|
|
39
39
|
"@galacticcouncil/descriptors": "^2.9.0",
|
|
40
|
-
"@galacticcouncil/sdk-next": "^2.
|
|
41
|
-
"@paraspell/sdk": "14.
|
|
42
|
-
"@paraspell/sdk-common": "14.
|
|
43
|
-
"@paraspell/sdk-core": "14.
|
|
44
|
-
"@paraspell/sdk-pjs": "14.
|
|
45
|
-
"@polkadot/api": "^17.0.
|
|
46
|
-
"@polkadot/types": "^17.0.
|
|
40
|
+
"@galacticcouncil/sdk-next": "^2.5.0",
|
|
41
|
+
"@paraspell/sdk": "14.5.0",
|
|
42
|
+
"@paraspell/sdk-common": "14.5.0",
|
|
43
|
+
"@paraspell/sdk-core": "14.5.0",
|
|
44
|
+
"@paraspell/sdk-pjs": "14.5.0",
|
|
45
|
+
"@polkadot/api": "^17.0.2",
|
|
46
|
+
"@polkadot/types": "^17.0.2",
|
|
47
47
|
"@polkadot/util": "^14.0.3",
|
|
48
48
|
"@zenlink-types/bifrost": "^1.7.7",
|
|
49
49
|
"ethers": "^5.8.0",
|
|
50
50
|
"ethers-v6": "npm:ethers@6.17.0",
|
|
51
|
-
"polkadot-api": "^3.
|
|
52
|
-
"react": "^19.3.
|
|
51
|
+
"polkadot-api": "^3.3.0",
|
|
52
|
+
"react": "^19.3.1",
|
|
53
53
|
"rxjs": "^7.8.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"@codecov/rollup-plugin": "^2.0.1",
|
|
59
59
|
"@rollup/plugin-babel": "^7.1.0",
|
|
60
60
|
"@rollup/plugin-json": "^6.1.0",
|
|
61
|
-
"@rollup/plugin-typescript": "^12.3.
|
|
62
|
-
"@vitest/coverage-v8": "^5.0.
|
|
63
|
-
"dotenv": "^18.0.
|
|
64
|
-
"rollup": "^4.
|
|
61
|
+
"@rollup/plugin-typescript": "^12.3.1",
|
|
62
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
63
|
+
"dotenv": "^18.0.9",
|
|
64
|
+
"rollup": "^4.66.0",
|
|
65
65
|
"rollup-plugin-dts": "^6.5.1",
|
|
66
66
|
"tsx": "^4.23.15"
|
|
67
67
|
},
|