@paraspell/swap 13.10.1 → 13.11.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 +31 -60
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { firstValueFrom } from 'rxjs';
|
|
|
9
9
|
import { createChainClient, formatUnits } from '@paraspell/sdk-pjs';
|
|
10
10
|
import { options } from '@acala-network/api';
|
|
11
11
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
12
|
-
import { snakeToCamel } from '@paraspell/sdk-common';
|
|
12
|
+
import { lowercaseFirstLetter, snakeToCamel } from '@paraspell/sdk-common';
|
|
13
13
|
import { Amount, Token, getCurrencyCombinations } from '@crypto-dex-sdk/currency';
|
|
14
14
|
import { Percent } from '@crypto-dex-sdk/math';
|
|
15
15
|
import { PAIR_ADDRESSES, isNativeCurrency, addressToNodeCurrency, SwapRouter } from '@crypto-dex-sdk/parachains-bifrost';
|
|
@@ -6096,40 +6096,6 @@ var Acala = {
|
|
|
6096
6096
|
}
|
|
6097
6097
|
}
|
|
6098
6098
|
],
|
|
6099
|
-
[
|
|
6100
|
-
{
|
|
6101
|
-
parents: 1,
|
|
6102
|
-
interior: {
|
|
6103
|
-
X2: [
|
|
6104
|
-
{
|
|
6105
|
-
Parachain: 2000
|
|
6106
|
-
},
|
|
6107
|
-
{
|
|
6108
|
-
GeneralKey: {
|
|
6109
|
-
length: 2,
|
|
6110
|
-
data: "0x0000000000000000000000000000000000000000000000000000000000000000"
|
|
6111
|
-
}
|
|
6112
|
-
}
|
|
6113
|
-
]
|
|
6114
|
-
}
|
|
6115
|
-
},
|
|
6116
|
-
{
|
|
6117
|
-
parents: 1,
|
|
6118
|
-
interior: {
|
|
6119
|
-
X2: [
|
|
6120
|
-
{
|
|
6121
|
-
Parachain: 2032
|
|
6122
|
-
},
|
|
6123
|
-
{
|
|
6124
|
-
GeneralKey: {
|
|
6125
|
-
length: 2,
|
|
6126
|
-
data: "0x0001000000000000000000000000000000000000000000000000000000000000"
|
|
6127
|
-
}
|
|
6128
|
-
}
|
|
6129
|
-
]
|
|
6130
|
-
}
|
|
6131
|
-
}
|
|
6132
|
-
],
|
|
6133
6099
|
[
|
|
6134
6100
|
{
|
|
6135
6101
|
parents: 1,
|
|
@@ -8450,46 +8416,51 @@ var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
|
|
|
8450
8416
|
}]);
|
|
8451
8417
|
}(ExchangeChain);
|
|
8452
8418
|
|
|
8453
|
-
// NetworkId enum variants that polkadot.js `.toJSON()` lowercases when the
|
|
8454
|
-
// variant carries no data (e.g. `Kusama` -> `kusama`). Struct/tuple variants
|
|
8455
|
-
// like `Ethereum { chain_id }` keep their PascalCase.
|
|
8456
|
-
var LOWERCASED_PLAIN_VARIANTS = new Set(['Polkadot', 'Kusama', 'Westend', 'Rococo', 'Wococo', 'BitcoinCore', 'BitcoinCash', 'PolkadotBulletin']);
|
|
8457
8419
|
var isBinary = function isBinary(v) {
|
|
8458
8420
|
return _typeof(v) === 'object' && v !== null && 'asHex' in v && typeof v.asHex === 'function';
|
|
8459
8421
|
};
|
|
8460
8422
|
var JUNCTIONS_VARIANT = /^X[1-8]$/;
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
// Reproduces three pjs `.toJSON()` quirks so output is byte-identical:
|
|
8466
|
-
// - plain NetworkId variants lowercased (`Kusama` -> `kusama`)
|
|
8467
|
-
// - struct field names snake_case -> camelCase (`chain_id` -> `chainId`)
|
|
8468
|
-
// - `Binary` byte values rendered as `0x...` hex strings
|
|
8469
|
-
var _papiLocationToJson = function papiLocationToJson(value) {
|
|
8470
|
-
if (value === undefined) return null;
|
|
8423
|
+
var MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
8424
|
+
var _toJson = function toJson(value, depth) {
|
|
8425
|
+
if (value === undefined || value === null) return null;
|
|
8426
|
+
if (typeof value === 'bigint') return value <= MAX_SAFE ? Number(value) : '0x' + value.toString(16).padStart(32, '0');
|
|
8471
8427
|
if (isBinary(value)) return value.asHex();
|
|
8472
|
-
if (
|
|
8473
|
-
if (
|
|
8428
|
+
if (value instanceof Uint8Array) return toHex(value);
|
|
8429
|
+
if (_typeof(value) !== 'object') return value;
|
|
8430
|
+
if (Array.isArray(value)) return value.map(function (v) {
|
|
8431
|
+
return _toJson(v, depth);
|
|
8432
|
+
});
|
|
8474
8433
|
var obj = value;
|
|
8475
8434
|
if (Object.keys(obj).length === 2 && typeof obj.type === 'string' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
if (
|
|
8479
|
-
return
|
|
8435
|
+
if (/^V\d+$/.test(obj.type)) return _toJson(obj.value, depth);
|
|
8436
|
+
var inner = _toJson(obj.value, depth + 1);
|
|
8437
|
+
if (obj.type === 'GeneralKey' && typeof inner === 'string') {
|
|
8438
|
+
return {
|
|
8439
|
+
GeneralKey: {
|
|
8440
|
+
length: (inner.length - 2) / 2,
|
|
8441
|
+
data: '0x' + inner.slice(2).padEnd(64, '0')
|
|
8442
|
+
}
|
|
8443
|
+
};
|
|
8480
8444
|
}
|
|
8481
|
-
|
|
8482
|
-
|
|
8445
|
+
if (JUNCTIONS_VARIANT.test(obj.type)) {
|
|
8446
|
+
return _defineProperty({}, obj.type, Array.isArray(obj.value) ? inner : [inner]);
|
|
8447
|
+
}
|
|
8448
|
+
var isObjectPayload = obj.value !== null && _typeof(obj.value) === 'object';
|
|
8449
|
+
var key = depth <= 2 || isObjectPayload ? obj.type : lowercaseFirstLetter(obj.type);
|
|
8450
|
+
return _defineProperty({}, key, inner);
|
|
8483
8451
|
}
|
|
8484
8452
|
var out = {};
|
|
8485
8453
|
for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
|
|
8486
8454
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
8487
8455
|
k = _Object$entries$_i[0],
|
|
8488
8456
|
v = _Object$entries$_i[1];
|
|
8489
|
-
out[snakeToCamel(k)] =
|
|
8457
|
+
out[snakeToCamel(k)] = _toJson(v, depth + 1);
|
|
8490
8458
|
}
|
|
8491
8459
|
return out;
|
|
8492
8460
|
};
|
|
8461
|
+
var papiLocationToJson = function papiLocationToJson(loc) {
|
|
8462
|
+
return loc === null || loc === undefined ? undefined : _toJson(loc, 0);
|
|
8463
|
+
};
|
|
8493
8464
|
|
|
8494
8465
|
var getDexConfig$1 = /*#__PURE__*/function () {
|
|
8495
8466
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, chain) {
|
|
@@ -8508,8 +8479,8 @@ var getDexConfig$1 = /*#__PURE__*/function () {
|
|
|
8508
8479
|
_ref2$keyArgs$ = _slicedToArray(_ref2$keyArgs[0], 2),
|
|
8509
8480
|
ml1 = _ref2$keyArgs$[0],
|
|
8510
8481
|
ml2 = _ref2$keyArgs$[1];
|
|
8511
|
-
poolLocations.add(JSON.stringify(
|
|
8512
|
-
poolLocations.add(JSON.stringify(
|
|
8482
|
+
poolLocations.add(JSON.stringify(papiLocationToJson(ml1), replaceBigIntNumeric));
|
|
8483
|
+
poolLocations.add(JSON.stringify(papiLocationToJson(ml2), replaceBigIntNumeric));
|
|
8513
8484
|
});
|
|
8514
8485
|
filteredAssets = assets.filter(function (asset) {
|
|
8515
8486
|
return poolLocations.has(JSON.stringify(asset.location, replaceBigIntNumeric)) || poolLocations.has(JSON.stringify(localizeLocation('AssetHubPolkadot', asset.location), replaceBigIntNumeric));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/swap",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.0",
|
|
4
4
|
"description": "Tool for XCM cross-chain asset exchanging across Polkadot and Kusama ecosystems",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"postcss": "^8.5.16",
|
|
51
51
|
"react": "^19.2.7",
|
|
52
52
|
"rxjs": "^7.8.2",
|
|
53
|
-
"@paraspell/sdk": "13.
|
|
54
|
-
"@paraspell/sdk-common": "13.
|
|
55
|
-
"@paraspell/sdk-core": "13.
|
|
56
|
-
"@paraspell/sdk-pjs": "13.
|
|
53
|
+
"@paraspell/sdk": "13.11.0",
|
|
54
|
+
"@paraspell/sdk-common": "13.11.0",
|
|
55
|
+
"@paraspell/sdk-core": "13.11.0",
|
|
56
|
+
"@paraspell/sdk-pjs": "13.11.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/plugin-syntax-import-attributes": "^7.29.7",
|