@paraspell/swap 13.0.0-rc.0 → 13.0.0-rc.2
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 +10 -81
- package/package.json +33 -33
package/dist/index.mjs
CHANGED
|
@@ -5323,40 +5323,6 @@ var AcalaDex = {
|
|
|
5323
5323
|
}
|
|
5324
5324
|
}
|
|
5325
5325
|
],
|
|
5326
|
-
[
|
|
5327
|
-
{
|
|
5328
|
-
parents: 1,
|
|
5329
|
-
interior: {
|
|
5330
|
-
X2: [
|
|
5331
|
-
{
|
|
5332
|
-
Parachain: 2000
|
|
5333
|
-
},
|
|
5334
|
-
{
|
|
5335
|
-
GeneralKey: {
|
|
5336
|
-
length: 2,
|
|
5337
|
-
data: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
5338
|
-
}
|
|
5339
|
-
}
|
|
5340
|
-
]
|
|
5341
|
-
}
|
|
5342
|
-
},
|
|
5343
|
-
{
|
|
5344
|
-
parents: 1,
|
|
5345
|
-
interior: {
|
|
5346
|
-
X2: [
|
|
5347
|
-
{
|
|
5348
|
-
Parachain: 2032
|
|
5349
|
-
},
|
|
5350
|
-
{
|
|
5351
|
-
GeneralKey: {
|
|
5352
|
-
length: 2,
|
|
5353
|
-
data: "0x0001000000000000000000000000000000000000000000000000000000000000"
|
|
5354
|
-
}
|
|
5355
|
-
}
|
|
5356
|
-
]
|
|
5357
|
-
}
|
|
5358
|
-
}
|
|
5359
|
-
],
|
|
5360
5326
|
[
|
|
5361
5327
|
{
|
|
5362
5328
|
parents: 1,
|
|
@@ -5841,40 +5807,6 @@ var AcalaDex = {
|
|
|
5841
5807
|
}
|
|
5842
5808
|
}
|
|
5843
5809
|
],
|
|
5844
|
-
[
|
|
5845
|
-
{
|
|
5846
|
-
parents: 1,
|
|
5847
|
-
interior: {
|
|
5848
|
-
X3: [
|
|
5849
|
-
{
|
|
5850
|
-
Parachain: 1000
|
|
5851
|
-
},
|
|
5852
|
-
{
|
|
5853
|
-
PalletInstance: 50
|
|
5854
|
-
},
|
|
5855
|
-
{
|
|
5856
|
-
GeneralIndex: 22222012
|
|
5857
|
-
}
|
|
5858
|
-
]
|
|
5859
|
-
}
|
|
5860
|
-
},
|
|
5861
|
-
{
|
|
5862
|
-
parents: 1,
|
|
5863
|
-
interior: {
|
|
5864
|
-
X2: [
|
|
5865
|
-
{
|
|
5866
|
-
Parachain: 2032
|
|
5867
|
-
},
|
|
5868
|
-
{
|
|
5869
|
-
GeneralKey: {
|
|
5870
|
-
length: 2,
|
|
5871
|
-
data: "0x0001000000000000000000000000000000000000000000000000000000000000"
|
|
5872
|
-
}
|
|
5873
|
-
}
|
|
5874
|
-
]
|
|
5875
|
-
}
|
|
5876
|
-
}
|
|
5877
|
-
],
|
|
5878
5810
|
[
|
|
5879
5811
|
{
|
|
5880
5812
|
parents: 1,
|
|
@@ -9478,7 +9410,7 @@ var createToExchangeBuilder = function createToExchangeBuilder(_ref) {
|
|
|
9478
9410
|
evmSenderAddress = _ref.evmSenderAddress,
|
|
9479
9411
|
amount = _ref.amount,
|
|
9480
9412
|
api = _ref.api;
|
|
9481
|
-
return Builder(api).from(from).to(baseChain).currency({
|
|
9413
|
+
return Builder(api.clone()).from(from).to(baseChain).currency({
|
|
9482
9414
|
location: assetFrom.location,
|
|
9483
9415
|
amount: amount
|
|
9484
9416
|
}).sender(isChainEvm(from) ? evmSenderAddress : sender).recipient(sender);
|
|
@@ -9722,11 +9654,11 @@ var validateTransferOptions = function validateTransferOptions(options) {
|
|
|
9722
9654
|
var FEE_ESTIMATION_UNITS = '100';
|
|
9723
9655
|
var calculateFromExchangeFee = /*#__PURE__*/function () {
|
|
9724
9656
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
9725
|
-
var
|
|
9657
|
+
var exchange, destination, feeCalcAddress, sender, api, dummyAmount, tx, _yield$exchange$api$g, partialFee;
|
|
9726
9658
|
return _regenerator().w(function (_context) {
|
|
9727
9659
|
while (1) switch (_context.n) {
|
|
9728
9660
|
case 0:
|
|
9729
|
-
|
|
9661
|
+
exchange = options.exchange, destination = options.destination, feeCalcAddress = options.feeCalcAddress, sender = options.sender, api = options.api;
|
|
9730
9662
|
if (!(!destination || destination.chain === exchange.baseChain)) {
|
|
9731
9663
|
_context.n = 1;
|
|
9732
9664
|
break;
|
|
@@ -9745,10 +9677,10 @@ var calculateFromExchangeFee = /*#__PURE__*/function () {
|
|
|
9745
9677
|
case 2:
|
|
9746
9678
|
tx = _context.v;
|
|
9747
9679
|
_context.n = 3;
|
|
9748
|
-
return api.getPaymentInfo(tx, feeCalcAddress);
|
|
9680
|
+
return exchange.api.getPaymentInfo(tx, feeCalcAddress);
|
|
9749
9681
|
case 3:
|
|
9750
|
-
_yield$api$
|
|
9751
|
-
partialFee = _yield$api$
|
|
9682
|
+
_yield$exchange$api$g = _context.v;
|
|
9683
|
+
partialFee = _yield$exchange$api$g.partialFee;
|
|
9752
9684
|
return _context.a(2, partialFee);
|
|
9753
9685
|
}
|
|
9754
9686
|
}, _callee);
|
|
@@ -9760,7 +9692,6 @@ var calculateFromExchangeFee = /*#__PURE__*/function () {
|
|
|
9760
9692
|
var createSwapTx = /*#__PURE__*/function () {
|
|
9761
9693
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(exchange, options) {
|
|
9762
9694
|
var isForFeeEstimation,
|
|
9763
|
-
api,
|
|
9764
9695
|
toDestTxFee,
|
|
9765
9696
|
swapResult,
|
|
9766
9697
|
txs,
|
|
@@ -9769,7 +9700,6 @@ var createSwapTx = /*#__PURE__*/function () {
|
|
|
9769
9700
|
while (1) switch (_context2.n) {
|
|
9770
9701
|
case 0:
|
|
9771
9702
|
isForFeeEstimation = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false;
|
|
9772
|
-
api = options.api;
|
|
9773
9703
|
_context2.n = 1;
|
|
9774
9704
|
return calculateFromExchangeFee(options);
|
|
9775
9705
|
case 1:
|
|
@@ -9785,7 +9715,7 @@ var createSwapTx = /*#__PURE__*/function () {
|
|
|
9785
9715
|
swapResult = _context2.v;
|
|
9786
9716
|
_context2.n = 3;
|
|
9787
9717
|
return Promise.all(swapResult.txs.map(function (tx) {
|
|
9788
|
-
return convertTxToTarget(tx, api);
|
|
9718
|
+
return convertTxToTarget(tx, options.exchange.api);
|
|
9789
9719
|
}));
|
|
9790
9720
|
case 3:
|
|
9791
9721
|
txs = _context2.v;
|
|
@@ -10038,7 +9968,7 @@ var dryRunTransaction = /*#__PURE__*/function () {
|
|
|
10038
9968
|
senderResolved = evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender;
|
|
10039
9969
|
resolvedDest = (_ref2 = destChain !== null && destChain !== void 0 ? destChain : destination === null || destination === void 0 ? void 0 : destination.chain) !== null && _ref2 !== void 0 ? _ref2 : exchange.baseChain;
|
|
10040
9970
|
return _context.a(2, dryRun({
|
|
10041
|
-
api: api,
|
|
9971
|
+
api: api.clone(),
|
|
10042
9972
|
tx: tx,
|
|
10043
9973
|
origin: chain,
|
|
10044
9974
|
destination: resolvedDest,
|
|
@@ -10142,11 +10072,11 @@ var dryRunRouter = /*#__PURE__*/function () {
|
|
|
10142
10072
|
|
|
10143
10073
|
var getSwapFee = /*#__PURE__*/function () {
|
|
10144
10074
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(exchange, options, disableFallback) {
|
|
10145
|
-
var
|
|
10075
|
+
var sender, _options$exchange, assetFrom, api, amount, txs, amountOut, isForFeeEstimation, swapResult, buildTx, result, finalFee, _t;
|
|
10146
10076
|
return _regenerator().w(function (_context2) {
|
|
10147
10077
|
while (1) switch (_context2.p = _context2.n) {
|
|
10148
10078
|
case 0:
|
|
10149
|
-
|
|
10079
|
+
sender = options.sender, _options$exchange = options.exchange, assetFrom = _options$exchange.assetFrom, api = _options$exchange.api, amount = options.amount;
|
|
10150
10080
|
isForFeeEstimation = true;
|
|
10151
10081
|
_context2.p = 1;
|
|
10152
10082
|
_context2.n = 2;
|
|
@@ -11141,7 +11071,6 @@ var RouterBuilder = function RouterBuilder(api) {
|
|
|
11141
11071
|
return new RouterBuilderCore(api);
|
|
11142
11072
|
};
|
|
11143
11073
|
|
|
11144
|
-
// @ts-expect-error - Temporary fix till the release to implement breaking changes
|
|
11145
11074
|
registerSwapExtension({
|
|
11146
11075
|
RouterBuilder: RouterBuilder
|
|
11147
11076
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/swap",
|
|
3
|
-
"version": "13.0.0-rc.
|
|
3
|
+
"version": "13.0.0-rc.2",
|
|
4
4
|
"description": "Tool for XCM cross-chain asset exchanging across Polkadot and Kusama ecosystems",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -16,19 +16,6 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"compile": "tsc --noEmit",
|
|
21
|
-
"build": "rollup -c",
|
|
22
|
-
"lint:check": "eslint src",
|
|
23
|
-
"lint": "eslint --fix src",
|
|
24
|
-
"format:check": "prettier --check src",
|
|
25
|
-
"format:write": "prettier --write src",
|
|
26
|
-
"test": "vitest run",
|
|
27
|
-
"test:cov": "vitest run --coverage",
|
|
28
|
-
"test:watch": "vitest",
|
|
29
|
-
"runAll": "pnpm compile && pnpm format:write && pnpm lint && pnpm test",
|
|
30
|
-
"updateAssets": "node --loader ts-node/esm --experimental-specifier-resolution=node ./scripts/updateAssets.ts"
|
|
31
|
-
},
|
|
32
19
|
"keywords": [],
|
|
33
20
|
"author": "",
|
|
34
21
|
"license": "MIT",
|
|
@@ -47,41 +34,54 @@
|
|
|
47
34
|
"@crypto-dex-sdk/math": "^0.1.4",
|
|
48
35
|
"@crypto-dex-sdk/parachains-bifrost": "^0.1.4",
|
|
49
36
|
"@crypto-dex-sdk/token-lists": "^0.1.4",
|
|
50
|
-
"@galacticcouncil/sdk": "^10.
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@polkadot/
|
|
55
|
-
"@polkadot/
|
|
56
|
-
"@polkadot/types": "^16.5.4",
|
|
57
|
-
"@polkadot/types-codec": "^16.5.4",
|
|
58
|
-
"@polkadot/util": "^14.0.1",
|
|
37
|
+
"@galacticcouncil/sdk": "^10.8.0",
|
|
38
|
+
"@polkadot/api": "^16.5.6",
|
|
39
|
+
"@polkadot/api-base": "^16.5.6",
|
|
40
|
+
"@polkadot/types": "^16.5.6",
|
|
41
|
+
"@polkadot/types-codec": "^16.5.6",
|
|
42
|
+
"@polkadot/util": "^14.0.3",
|
|
59
43
|
"@zenlink-types/bifrost": "^1.7.7",
|
|
60
|
-
"axios": "^1.
|
|
44
|
+
"axios": "^1.14.0",
|
|
61
45
|
"ethers": "^5.8.0",
|
|
62
46
|
"ethers-v6": "npm:ethers@^6.16.0",
|
|
63
47
|
"jsbi": "^4.3.2",
|
|
64
48
|
"lodash-es": "^4.17.23",
|
|
65
49
|
"polkadot-api": "^1.23.3",
|
|
66
|
-
"postcss": "^8.5.
|
|
50
|
+
"postcss": "^8.5.8",
|
|
67
51
|
"react": "^19.2.4",
|
|
68
|
-
"rxjs": "^7.8.2"
|
|
52
|
+
"rxjs": "^7.8.2",
|
|
53
|
+
"@paraspell/sdk": "13.0.0-rc.1",
|
|
54
|
+
"@paraspell/sdk-core": "13.0.0-rc.1",
|
|
55
|
+
"@paraspell/sdk-pjs": "13.0.0-rc.1"
|
|
69
56
|
},
|
|
70
57
|
"devDependencies": {
|
|
71
58
|
"@babel/core": "^7.29.0",
|
|
72
59
|
"@babel/plugin-syntax-import-attributes": "^7.28.6",
|
|
73
|
-
"@babel/preset-env": "^7.29.
|
|
60
|
+
"@babel/preset-env": "^7.29.2",
|
|
74
61
|
"@codecov/rollup-plugin": "^1.9.1",
|
|
75
|
-
"@rollup/plugin-babel": "^
|
|
62
|
+
"@rollup/plugin-babel": "^7.0.0",
|
|
76
63
|
"@rollup/plugin-json": "^6.1.0",
|
|
77
64
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
78
65
|
"@types/lodash-es": "^4.17.12",
|
|
79
|
-
"@vitest/coverage-v8": "^4.
|
|
66
|
+
"@vitest/coverage-v8": "^4.1.2",
|
|
80
67
|
"dotenv": "^17.3.1",
|
|
81
|
-
"rollup": "^4.
|
|
82
|
-
"rollup-plugin-dts": "^6.
|
|
68
|
+
"rollup": "^4.60.1",
|
|
69
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
83
70
|
"ts-node": "^10.9.2",
|
|
84
71
|
"tslib": "^2.8.1",
|
|
85
|
-
"@galacticcouncil/api-augment": "^0.
|
|
72
|
+
"@galacticcouncil/api-augment": "^0.10.0"
|
|
73
|
+
},
|
|
74
|
+
"scripts": {
|
|
75
|
+
"compile": "tsc --noEmit",
|
|
76
|
+
"build": "rollup -c",
|
|
77
|
+
"lint:check": "eslint src",
|
|
78
|
+
"lint": "eslint --fix src",
|
|
79
|
+
"format:check": "prettier --check src",
|
|
80
|
+
"format:write": "prettier --write src",
|
|
81
|
+
"test": "vitest run",
|
|
82
|
+
"test:cov": "vitest run --coverage",
|
|
83
|
+
"test:watch": "vitest",
|
|
84
|
+
"runAll": "pnpm compile && pnpm format:write && pnpm lint && pnpm test",
|
|
85
|
+
"updateAssets": "node --loader ts-node/esm --experimental-specifier-resolution=node ./scripts/updateAssets.ts"
|
|
86
86
|
}
|
|
87
|
-
}
|
|
87
|
+
}
|