@vultisig/core-chain 2.30.0 → 2.31.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/CHANGELOG.md +28 -0
- package/dist/Chain.d.ts +3 -0
- package/dist/Chain.d.ts.map +1 -1
- package/dist/Chain.js +1 -0
- package/dist/Chain.js.map +1 -1
- package/dist/ChainKind.d.ts +1 -0
- package/dist/ChainKind.d.ts.map +1 -1
- package/dist/ChainKind.js +1 -0
- package/dist/ChainKind.js.map +1 -1
- package/dist/chains/evm/chainInfo.d.ts +57 -0
- package/dist/chains/evm/chainInfo.d.ts.map +1 -1
- package/dist/chains/evm/chainInfo.js +22 -0
- package/dist/chains/evm/chainInfo.js.map +1 -1
- package/dist/chains/evm/tx/fee/index.d.ts.map +1 -1
- package/dist/chains/evm/tx/fee/index.js +1 -0
- package/dist/chains/evm/tx/fee/index.js.map +1 -1
- package/dist/coin/coinType.d.ts.map +1 -1
- package/dist/coin/coinType.js +1 -0
- package/dist/coin/coinType.js.map +1 -1
- package/dist/coin/find/resolvers/evm/index.d.ts.map +1 -1
- package/dist/coin/find/resolvers/evm/index.js +31 -2
- package/dist/coin/find/resolvers/evm/index.js.map +1 -1
- package/dist/coin/knownTokens/index.d.ts +1 -1
- package/dist/coin/knownTokens/index.d.ts.map +1 -1
- package/dist/coin/knownTokens/index.js +506 -0
- package/dist/coin/knownTokens/index.js.map +1 -1
- package/dist/coin/price/evm/getErc20Prices.d.ts.map +1 -1
- package/dist/coin/price/evm/getErc20Prices.js +1 -0
- package/dist/coin/price/evm/getErc20Prices.js.map +1 -1
- package/dist/coin/token/metadata/chains.d.ts +1 -1
- package/dist/coin/token/metadata/chains.d.ts.map +1 -1
- package/dist/security/blockaid/evmChains.d.ts.map +1 -1
- package/dist/security/blockaid/evmChains.js +2 -0
- package/dist/security/blockaid/evmChains.js.map +1 -1
- package/dist/security/dangerousAddresses.d.ts +16 -1
- package/dist/security/dangerousAddresses.d.ts.map +1 -1
- package/dist/security/dangerousAddresses.js +26 -7
- package/dist/security/dangerousAddresses.js.map +1 -1
- package/dist/swap/general/knownAggregatorRouters.d.ts.map +1 -1
- package/dist/swap/general/knownAggregatorRouters.js +7 -1
- package/dist/swap/general/knownAggregatorRouters.js.map +1 -1
- package/dist/swap/general/kyber/chains.d.ts +1 -1
- package/dist/swap/general/kyber/chains.d.ts.map +1 -1
- package/dist/swap/general/kyber/chains.js +1 -0
- package/dist/swap/general/kyber/chains.js.map +1 -1
- package/dist/swap/general/lifi/LifiSwapEnabledChains.d.ts +1 -1
- package/dist/swap/general/lifi/LifiSwapEnabledChains.d.ts.map +1 -1
- package/dist/swap/general/oneInch/OneInchSwapEnabledChains.d.ts +1 -1
- package/dist/swap/general/oneInch/OneInchSwapEnabledChains.d.ts.map +1 -1
- package/dist/swap/general/oneInch/OneInchSwapEnabledChains.js +3 -0
- package/dist/swap/general/oneInch/OneInchSwapEnabledChains.js.map +1 -1
- package/dist/swap/native/api/getNativeSwapQuote.d.ts.map +1 -1
- package/dist/swap/native/api/getNativeSwapQuote.js +10 -4
- package/dist/swap/native/api/getNativeSwapQuote.js.map +1 -1
- package/dist/swap/native/limitSwapCancelBucket.d.ts +47 -0
- package/dist/swap/native/limitSwapCancelBucket.d.ts.map +1 -0
- package/dist/swap/native/limitSwapCancelBucket.js +86 -0
- package/dist/swap/native/limitSwapCancelBucket.js.map +1 -0
- package/dist/swap/native/limitSwapCancelDust.d.ts +36 -0
- package/dist/swap/native/limitSwapCancelDust.d.ts.map +1 -0
- package/dist/swap/native/limitSwapCancelDust.js +100 -0
- package/dist/swap/native/limitSwapCancelDust.js.map +1 -0
- package/dist/swap/native/limitSwapCancelEligibility.d.ts +96 -0
- package/dist/swap/native/limitSwapCancelEligibility.d.ts.map +1 -0
- package/dist/swap/native/limitSwapCancelEligibility.js +165 -0
- package/dist/swap/native/limitSwapCancelEligibility.js.map +1 -0
- package/dist/swap/native/limitSwapCancelMemo.d.ts +123 -0
- package/dist/swap/native/limitSwapCancelMemo.d.ts.map +1 -0
- package/dist/swap/native/limitSwapCancelMemo.js +158 -0
- package/dist/swap/native/limitSwapCancelMemo.js.map +1 -0
- package/dist/swap/native/limitSwapMemo.d.ts.map +1 -1
- package/dist/swap/native/limitSwapMemo.js +7 -3
- package/dist/swap/native/limitSwapMemo.js.map +1 -1
- package/dist/swap/swapEnabledChains.d.ts +1 -1
- package/dist/swap/swapEnabledChains.d.ts.map +1 -1
- package/dist/tx/fee/evm/clampEvmPriorityFee.d.ts.map +1 -1
- package/dist/tx/fee/evm/clampEvmPriorityFee.js +2 -1
- package/dist/tx/fee/evm/clampEvmPriorityFee.js.map +1 -1
- package/dist/tx/fee/evm/evmGasLimit.d.ts.map +1 -1
- package/dist/tx/fee/evm/evmGasLimit.js +2 -0
- package/dist/tx/fee/evm/evmGasLimit.js.map +1 -1
- package/dist/utils/getBlockExplorerUrl/index.d.ts.map +1 -1
- package/dist/utils/getBlockExplorerUrl/index.js +4 -1
- package/dist/utils/getBlockExplorerUrl/index.js.map +1 -1
- package/package.json +22 -2
|
@@ -12,6 +12,8 @@ export const blockaidEvmChain = {
|
|
|
12
12
|
[EvmChain.Polygon]: 'polygon',
|
|
13
13
|
[EvmChain.Sei]: 'sei',
|
|
14
14
|
[EvmChain.Zksync]: 'zksync',
|
|
15
|
+
// Robinhood (4663) deliberately absent: Blockaid does not list the chain
|
|
16
|
+
// yet (same posture as CronosChain). Recheck when Blockaid adds support.
|
|
15
17
|
};
|
|
16
18
|
export const blockaidSupportedEvmChains = Object.keys(blockaidEvmChain);
|
|
17
19
|
//# sourceMappingURL=evmChains.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evmChains.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/security/blockaid/evmChains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,CAAC,QAAQ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/B,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS;IAC7B,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK;IACrB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ;IAC3B,yEAAyE;IACzE,yEAAyE;CACjE,CAAA;AAIV,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAgC,CAAA"}
|
|
@@ -42,11 +42,26 @@ export declare const XRP_DANGEROUS_ADDRESSES: Record<string, string>;
|
|
|
42
42
|
* Return the dangerous-address reason string if `address` is a known EVM burn
|
|
43
43
|
* address, otherwise `undefined`. Shape-based: any `0x`+40-hex string is vetted
|
|
44
44
|
* against the EVM burn-list regardless of the chain it's destined for.
|
|
45
|
+
*
|
|
46
|
+
* Prototype-safe: uses `Object.prototype.hasOwnProperty` so that keys like
|
|
47
|
+
* `__proto__`, `toString`, or `constructor` never produce a false-positive.
|
|
48
|
+
* Input is trimmed so whitespace-padded copies of a burn address don't escape.
|
|
45
49
|
*/
|
|
46
50
|
export declare const getEvmDangerousReason: (address: string) => string | undefined;
|
|
47
51
|
/** True iff `address` is a known EVM burn / dead address. */
|
|
48
52
|
export declare const isEvmBurnAddress: (address: string) => boolean;
|
|
49
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Return the chain-specific dangerous-address reason, if one applies.
|
|
55
|
+
*
|
|
56
|
+
* Prototype-safe: all map lookups go through `Object.prototype.hasOwnProperty`
|
|
57
|
+
* so that a crafted input like `__proto__` never produces a false-positive
|
|
58
|
+
* throw on an otherwise-valid chain.
|
|
59
|
+
*
|
|
60
|
+
* Chain-alias normalization: lowercase so that canonical enum values
|
|
61
|
+
* (`'Ripple'`, `'Bitcoin-Cash'`) and common aliases (`'xrp'`, `'bitcoincash'`)
|
|
62
|
+
* both resolve. Only the lookup key is normalised; the address is kept verbatim
|
|
63
|
+
* (non-EVM burn lists are case-sensitive base58/b58 strings).
|
|
64
|
+
*/
|
|
50
65
|
export declare const getChainDangerousReason: (chain: string, address: string) => string | undefined;
|
|
51
66
|
/**
|
|
52
67
|
* Throws a descriptive error if `address` is a known EVM burn / dead address.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dangerousAddresses.d.ts","sourceRoot":"","sources":["../../../../../packages/core/chain/security/dangerousAddresses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,sFAAsF;AACtF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK1D,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAM7D,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG3D,CAAA;AAED,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAI1D,CAAA;AAaD
|
|
1
|
+
{"version":3,"file":"dangerousAddresses.d.ts","sourceRoot":"","sources":["../../../../../packages/core/chain/security/dangerousAddresses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,sFAAsF;AACtF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK1D,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAM7D,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG3D,CAAA;AAED,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAI1D,CAAA;AAaD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,KAAG,MAAM,GAAG,SAKhE,CAAA;AAED,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,KAAG,OAAuD,CAAA;AAE1G;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,EAAE,SAAS,MAAM,KAAG,MAAM,GAAG,SAmBjF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,KAAG,IAK1D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAM9E"}
|
|
@@ -66,26 +66,45 @@ const EVM_ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/i;
|
|
|
66
66
|
* Return the dangerous-address reason string if `address` is a known EVM burn
|
|
67
67
|
* address, otherwise `undefined`. Shape-based: any `0x`+40-hex string is vetted
|
|
68
68
|
* against the EVM burn-list regardless of the chain it's destined for.
|
|
69
|
+
*
|
|
70
|
+
* Prototype-safe: uses `Object.prototype.hasOwnProperty` so that keys like
|
|
71
|
+
* `__proto__`, `toString`, or `constructor` never produce a false-positive.
|
|
72
|
+
* Input is trimmed so whitespace-padded copies of a burn address don't escape.
|
|
69
73
|
*/
|
|
70
74
|
export const getEvmDangerousReason = (address) => {
|
|
71
|
-
|
|
75
|
+
const trimmed = address.trim();
|
|
76
|
+
if (!EVM_ADDRESS_RE.test(trimmed))
|
|
72
77
|
return undefined;
|
|
73
|
-
|
|
78
|
+
const key = trimmed.toLowerCase();
|
|
79
|
+
return Object.prototype.hasOwnProperty.call(EVM_DANGEROUS_ADDRESSES, key) ? EVM_DANGEROUS_ADDRESSES[key] : undefined;
|
|
74
80
|
};
|
|
75
81
|
/** True iff `address` is a known EVM burn / dead address. */
|
|
76
82
|
export const isEvmBurnAddress = (address) => getEvmDangerousReason(address) !== undefined;
|
|
77
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Return the chain-specific dangerous-address reason, if one applies.
|
|
85
|
+
*
|
|
86
|
+
* Prototype-safe: all map lookups go through `Object.prototype.hasOwnProperty`
|
|
87
|
+
* so that a crafted input like `__proto__` never produces a false-positive
|
|
88
|
+
* throw on an otherwise-valid chain.
|
|
89
|
+
*
|
|
90
|
+
* Chain-alias normalization: lowercase so that canonical enum values
|
|
91
|
+
* (`'Ripple'`, `'Bitcoin-Cash'`) and common aliases (`'xrp'`, `'bitcoincash'`)
|
|
92
|
+
* both resolve. Only the lookup key is normalised; the address is kept verbatim
|
|
93
|
+
* (non-EVM burn lists are case-sensitive base58/b58 strings).
|
|
94
|
+
*/
|
|
78
95
|
export const getChainDangerousReason = (chain, address) => {
|
|
79
96
|
const normalizedChain = chain.trim().toLowerCase();
|
|
80
97
|
const destination = address.trim();
|
|
98
|
+
const safeGet = (map, key) => Object.prototype.hasOwnProperty.call(map, key) ? map[key] : undefined;
|
|
81
99
|
if (normalizedChain === 'solana') {
|
|
82
|
-
return SOLANA_DANGEROUS_ADDRESSES
|
|
100
|
+
return safeGet(SOLANA_DANGEROUS_ADDRESSES, destination);
|
|
83
101
|
}
|
|
84
102
|
if (UTXO_CHAINS.has(normalizedChain)) {
|
|
85
|
-
return UTXO_DANGEROUS_ADDRESSES
|
|
103
|
+
return safeGet(UTXO_DANGEROUS_ADDRESSES, destination);
|
|
86
104
|
}
|
|
87
|
-
|
|
88
|
-
|
|
105
|
+
// Accept both canonical enum ('Ripple') and common API alias ('xrp').
|
|
106
|
+
if (normalizedChain === 'ripple' || normalizedChain === 'xrp') {
|
|
107
|
+
return safeGet(XRP_DANGEROUS_ADDRESSES, destination);
|
|
89
108
|
}
|
|
90
109
|
return undefined;
|
|
91
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dangerousAddresses.js","sourceRoot":"","sources":["../../../../../packages/core/chain/security/dangerousAddresses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,sFAAsF;AACtF,MAAM,CAAC,MAAM,uBAAuB,GAA2B;IAC7D,4CAA4C,EAC1C,4EAA4E;IAC9E,4CAA4C,EAAE,oEAAoE;IAClH,4CAA4C,EAAE,+CAA+C;CAC9F,CAAA;AAED,kGAAkG;AAClG,MAAM,CAAC,MAAM,0BAA0B,GAA2B;IAChE,kCAAkC,EAAE,6DAA6D;IACjG,2CAA2C,EAAE,oDAAoD;IACjG,2CAA2C,EAAE,mDAAmD;IAChG,6CAA6C,EAC3C,4EAA4E;CAC/E,CAAA;AAED,+EAA+E;AAC/E,MAAM,CAAC,MAAM,wBAAwB,GAA2B;IAC9D,6BAA6B,EAAE,+CAA+C;IAC9E,oCAAoC,EAAE,wDAAwD;CAC/F,CAAA;AAED,iFAAiF;AACjF,MAAM,CAAC,MAAM,uBAAuB,GAA2B;IAC7D,2BAA2B,EAAE,uEAAuE;IACpG,0BAA0B,EACxB,iGAAiG;CACpG,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAEjG;;qBAEqB;AACrB,MAAM,cAAc,GAAG,sBAAsB,CAAA;AAE7C
|
|
1
|
+
{"version":3,"file":"dangerousAddresses.js","sourceRoot":"","sources":["../../../../../packages/core/chain/security/dangerousAddresses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,sFAAsF;AACtF,MAAM,CAAC,MAAM,uBAAuB,GAA2B;IAC7D,4CAA4C,EAC1C,4EAA4E;IAC9E,4CAA4C,EAAE,oEAAoE;IAClH,4CAA4C,EAAE,+CAA+C;CAC9F,CAAA;AAED,kGAAkG;AAClG,MAAM,CAAC,MAAM,0BAA0B,GAA2B;IAChE,kCAAkC,EAAE,6DAA6D;IACjG,2CAA2C,EAAE,oDAAoD;IACjG,2CAA2C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8CAA8C,WAAW,SAAS,MAAM,GAAG,CAAC,CAAA;IAC9F,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knownAggregatorRouters.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/swap/general/knownAggregatorRouters.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"knownAggregatorRouters.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/swap/general/knownAggregatorRouters.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAwEnC,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAA;AAclE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,wCAAwC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAkB9G;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sCAAsC,CACpD,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,KAAK,GACX,IAAI,CASN;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CA0BjH;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAK1F"}
|
|
@@ -56,6 +56,10 @@ const ONE_INCH_V6_STANDARD_ROUTER = '0x111111125421ca6dc452d289314280a0f8842a65'
|
|
|
56
56
|
// V6 on zkSync Era ONLY — live-confirmed 2026-07-08 via a real api.vultisig.com/1inch
|
|
57
57
|
// v6.0 quote request returning this address (NOT the standard one above).
|
|
58
58
|
const ONE_INCH_V6_ZKSYNC_ROUTER = '0x6fd4383cb451173d5f9304f041c7bcbf27d561ff';
|
|
59
|
+
// V6 on Robinhood (4663) ONLY — the second chain-specific 1inch deployment after zkSync.
|
|
60
|
+
// Live-confirmed 2026-07-27: /approve/spender AND a real v6.0 /swap both return this
|
|
61
|
+
// address (NOT the standard one), and eth_getCode on 4663 shows 24,542 bytes deployed.
|
|
62
|
+
const ONE_INCH_V6_ROBINHOOD_ROUTER = '0x5a705de8982235a7fa45bb83dcacf03a211389c7';
|
|
59
63
|
// KyberSwap MetaAggregationRouterV2 — same address confirmed live 2026-07-08 on every
|
|
60
64
|
// kyberSwapEnabledChains chain through aggregator-api.kyberswap.com's /routes
|
|
61
65
|
// (Ethereum, BSC, Arbitrum, Optimism, Avalanche, Base, Polygon).
|
|
@@ -170,7 +174,9 @@ export function assertKnownAggregatorRouter(provider, address, chain) {
|
|
|
170
174
|
isOneOf(chain, cowSwapSupportedChains) && normalized === COW_VAULT_RELAYER_ADDRESS.toLowerCase()
|
|
171
175
|
: chain === Chain.Zksync
|
|
172
176
|
? normalized === ONE_INCH_V6_ZKSYNC_ROUTER
|
|
173
|
-
:
|
|
177
|
+
: chain === Chain.Robinhood
|
|
178
|
+
? normalized === ONE_INCH_V6_ROBINHOOD_ROUTER
|
|
179
|
+
: normalized === ONE_INCH_V5_ROUTER || normalized === ONE_INCH_V6_STANDARD_ROUTER;
|
|
174
180
|
if (!isKnown) {
|
|
175
181
|
throw new Error(`${provider} swap quote returned an unrecognized router address (${address}) on ${chain} — refusing to build a signable transaction against it.`);
|
|
176
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knownAggregatorRouters.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/swap/general/knownAggregatorRouters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAE3D,OAAO,EAAE,KAA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U,KAAK,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"knownAggregatorRouters.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/swap/general/knownAggregatorRouters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,wDAAwD;AACxD,0FAA0F;AAC1F,4FAA4F;AAC5F,wFAAwF;AACxF,qFAAqF;AACrF,oDAAoD;AACpD,MAAM,kBAAkB,GAAG,4CAA4C,CAAA;AAEvE,sFAAsF;AACtF,yEAAyE;AACzE,MAAM,2BAA2B,GAAG,4CAA4C,CAAA;AAEhF,sFAAsF;AACtF,0EAA0E;AAC1E,MAAM,yBAAyB,GAAG,4CAA4C,CAAA;AAE9E,yFAAyF;AACzF,qFAAqF;AACrF,uFAAuF;AACvF,MAAM,4BAA4B,GAAG,4CAA4C,CAAA;AAEjF,sFAAsF;AACtF,8EAA8E;AAC9E,iEAAiE;AACjE,MAAM,qBAAqB,GAAG,4CAA4C,CAAA;AAI1E,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAA;AAErH,8FAA8F;AAC9F,2FAA2F;AAC3F,+FAA+F;AAC/F,2FAA2F;AAC3F,sFAAsF;AACtF,+FAA+F;AAC/F,8FAA8F;AAC9F,oGAAoG;AACpG,MAAM,+BAA+B,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,CAAA;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,UAAU,wCAAwC,CAAC,QAAgB,E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C7F,8FAA8F;gBAC9F,0FAA0F;gBAC1F,4FAA4F;gBAC5F,uDAAuD;gBACvD,OAAO,CAAC,KAAK,EAAE,sBAAsB,CAAC,IAAI,UAAU,KAAK,yBAAyB,CAAC,WAAW,EAAE;YAClG,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,MAAM;gBACtB,CAAC,CAAC,UAAU,KAAK,yBAAyB;gBAC1C,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,SAAS;oBACzB,CAAC,CAAC,UAAU,KAAK,4BAA4B;oBAC7C,CAAC,CAAC,UAAU,KAAK,kBAAkB,IAAI,UAAU,KAAK,2BAA2B,CAAA;IAE3F,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,GAAG,QAAQ,wDAAwD,OAAO,QAAQ,KAAK,yDAAyD,CACjJ,CAAA;IACH,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAAC,QAAgB,EAAE,OAAe;IAClF,OAAO,CAAC,IAAI,CAAC,8FAA8F,EAAE;QAC3G,QAAQ;QACR,OAAO;KACR,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const kyberSwapEnabledChains: readonly ["Ethereum", "BSC", "Arbitrum", "Polygon", "Optimism", "Avalanche", "Base"];
|
|
1
|
+
export declare const kyberSwapEnabledChains: readonly ["Ethereum", "BSC", "Arbitrum", "Polygon", "Optimism", "Avalanche", "Base", "Robinhood"];
|
|
2
2
|
export type KyberSwapEnabledChain = (typeof kyberSwapEnabledChains)[number];
|
|
3
3
|
//# sourceMappingURL=chains.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/kyber/chains.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/kyber/chains.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,sBAAsB,mGASzB,CAAA;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/kyber/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAElD,gEAAgE;AAChE,uEAAuE;AACvE,0EAA0E;AAC1E,2EAA2E;AAC3E,2BAA2B;AAC3B,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,GAAG;IACT,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,OAAO;IACb,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/kyber/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAElD,gEAAgE;AAChE,uEAAuE;AACvE,0EAA0E;AAC1E,2EAA2E;AAC3E,2BAA2B;AAC3B,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,GAAG;IACT,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,OAAO;IACb,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,IAAI;IACV,KAAK,CAAC,SAAS;CACP,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChainId } from '@lifi/sdk';
|
|
2
|
-
export declare const lifiSwapEnabledChains: readonly [...("Arbitrum" | "Base" | "Blast" | "Optimism" | "Zksync" | "Mantle" | "Avalanche" | "CronosChain" | "BSC" | "Ethereum" | "Polygon" | "Hyperliquid" | "Sei")[], import("@vultisig/core-chain/Chain").OtherChain.Solana];
|
|
2
|
+
export declare const lifiSwapEnabledChains: readonly [...("Arbitrum" | "Base" | "Blast" | "Optimism" | "Zksync" | "Mantle" | "Robinhood" | "Avalanche" | "CronosChain" | "BSC" | "Ethereum" | "Polygon" | "Hyperliquid" | "Sei")[], import("@vultisig/core-chain/Chain").OtherChain.Solana];
|
|
3
3
|
export type LifiSwapEnabledChain = (typeof lifiSwapEnabledChains)[number];
|
|
4
4
|
export declare const lifiSwapChainId: Record<LifiSwapEnabledChain, ChainId>;
|
|
5
5
|
//# sourceMappingURL=LifiSwapEnabledChains.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LifiSwapEnabledChains.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/lifi/LifiSwapEnabledChains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"LifiSwapEnabledChains.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/lifi/LifiSwapEnabledChains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,qBAAqB,iPAAsD,CAAA;AAExF,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzE,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,oBAAoB,EAAE,OAAO,CAGjE,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const oneInchSwapEnabledChains: readonly ["Ethereum", "Arbitrum", "Zksync", "BSC", "Avalanche", "Optimism", "Polygon", "Base"];
|
|
1
|
+
export declare const oneInchSwapEnabledChains: readonly ["Ethereum", "Arbitrum", "Zksync", "BSC", "Avalanche", "Optimism", "Polygon", "Base", "Robinhood"];
|
|
2
2
|
//# sourceMappingURL=OneInchSwapEnabledChains.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneInchSwapEnabledChains.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/oneInch/OneInchSwapEnabledChains.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"OneInchSwapEnabledChains.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/oneInch/OneInchSwapEnabledChains.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,6GAY3B,CAAA"}
|
|
@@ -8,5 +8,8 @@ export const oneInchSwapEnabledChains = [
|
|
|
8
8
|
Chain.Optimism,
|
|
9
9
|
Chain.Polygon,
|
|
10
10
|
Chain.Base,
|
|
11
|
+
// Live-confirmed on 4663: /quote and /swap return executable calldata to
|
|
12
|
+
// 1inch's deployed router (0x5a70…89c7).
|
|
13
|
+
Chain.Robinhood,
|
|
11
14
|
];
|
|
12
15
|
//# sourceMappingURL=OneInchSwapEnabledChains.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneInchSwapEnabledChains.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/oneInch/OneInchSwapEnabledChains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAElD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,MAAM;IACZ,KAAK,CAAC,GAAG;IACT,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,OAAO;IACb,KAAK,CAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"OneInchSwapEnabledChains.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/general/oneInch/OneInchSwapEnabledChains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAElD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,MAAM;IACZ,KAAK,CAAC,GAAG;IACT,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,OAAO;IACb,KAAK,CAAC,IAAI;IACV,yEAAyE;IACzE,yCAAyC;IACzC,KAAK,CAAC,SAAS;CACP,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNativeSwapQuote.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/native/api/getNativeSwapQuote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getNativeSwapQuote.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/native/api/getNativeSwapQuote.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAA;AAGnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAIzE,OAAO,EAEL,eAAe,EAGhB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EAAwB,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAE7E,KAAK,uBAAuB,GAAG,MAAM,CAAC,iBAAiB,EAAE,WAAW,CAAC,GAAG;IACtE,SAAS,EAAE,eAAe,CAAA;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,qBAAqB,CAAC,EAAE,yBAAyB,CAAA;CAClD,CAAA;AASD,eAAO,MAAM,0CAA0C,MAAM,CAAA;AAiG7D,eAAO,MAAM,kBAAkB,GAAU,oHAUtC,uBAAuB,KAAG,OAAO,CAAC,eAAe,CAiGnD,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toChainAmount } from '@vultisig/core-chain/amount/toChainAmount';
|
|
2
2
|
import { Chain } from '@vultisig/core-chain/Chain';
|
|
3
|
+
import { isChainOfKind } from '@vultisig/core-chain/ChainKind';
|
|
3
4
|
import { isInError } from '@vultisig/lib-utils/error/isInError';
|
|
4
5
|
import { queryUrl } from '@vultisig/lib-utils/query/queryUrl';
|
|
5
6
|
import { chainFeeCoin } from '../../../coin/chainFeeCoin.js';
|
|
@@ -35,7 +36,7 @@ const requestNativeSwapQuote = async ({ swapChain, swapBaseUrl, fromAsset, toAss
|
|
|
35
36
|
const url = `${swapBaseUrl}?${params.toString()}`;
|
|
36
37
|
return queryUrl(url);
|
|
37
38
|
};
|
|
38
|
-
const assertOkQuote = (result, from) => {
|
|
39
|
+
const assertOkQuote = (result, from, to, destination) => {
|
|
39
40
|
if ('error' in result) {
|
|
40
41
|
if (isInError(result.error, 'not enough asset to pay for fees')) {
|
|
41
42
|
const { ticker } = chainFeeCoin[from.chain];
|
|
@@ -43,6 +44,11 @@ const assertOkQuote = (result, from) => {
|
|
|
43
44
|
}
|
|
44
45
|
throw new Error(result.error);
|
|
45
46
|
}
|
|
47
|
+
const memoDestination = typeof result.memo === 'string' ? result.memo.split(':')[2] : undefined;
|
|
48
|
+
const normalizeDestination = (value) => (isChainOfKind(to.chain, 'evm') ? value.toLowerCase() : value);
|
|
49
|
+
if (!memoDestination || normalizeDestination(memoDestination) !== normalizeDestination(destination)) {
|
|
50
|
+
throw new Error(`Native swap quote destination mismatch: requested "${destination}", but executable memo routes to "${memoDestination ?? ''}".`);
|
|
51
|
+
}
|
|
46
52
|
return result;
|
|
47
53
|
};
|
|
48
54
|
// Cardano is enabled as a MayaChain source at the enabled-chains/quote level
|
|
@@ -83,7 +89,7 @@ export const getNativeSwapQuote = async ({ swapChain, destination, from, to, amo
|
|
|
83
89
|
nativeAffiliateConfig,
|
|
84
90
|
});
|
|
85
91
|
return {
|
|
86
|
-
...assertOkQuote(result, from),
|
|
92
|
+
...assertOkQuote(result, from, to, destination),
|
|
87
93
|
swapChain,
|
|
88
94
|
liquidity_tolerance_bps: slippageToleranceBps,
|
|
89
95
|
};
|
|
@@ -101,7 +107,7 @@ export const getNativeSwapQuote = async ({ swapChain, destination, from, to, amo
|
|
|
101
107
|
referral,
|
|
102
108
|
nativeAffiliateConfig,
|
|
103
109
|
});
|
|
104
|
-
const rapid = assertOkQuote(rapidResult, from);
|
|
110
|
+
const rapid = assertOkQuote(rapidResult, from, to, destination);
|
|
105
111
|
const totalBps = rapid.fees.total_bps;
|
|
106
112
|
if (totalBps === undefined || totalBps <= THORCHAIN_STREAMING_SLIPPAGE_THRESHOLD_BPS) {
|
|
107
113
|
return { ...rapid, swapChain, liquidity_tolerance_bps: slippageToleranceBps };
|
|
@@ -125,7 +131,7 @@ export const getNativeSwapQuote = async ({ swapChain, destination, from, to, amo
|
|
|
125
131
|
referral,
|
|
126
132
|
nativeAffiliateConfig,
|
|
127
133
|
});
|
|
128
|
-
streaming = assertOkQuote(streamingRes, from);
|
|
134
|
+
streaming = assertOkQuote(streamingRes, from, to, destination);
|
|
129
135
|
}
|
|
130
136
|
catch (error) {
|
|
131
137
|
console.warn('[thorchain] streaming quote failed after elevated rapid slippage; using rapid quote', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNativeSwapQuote.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/swap/native/api/getNativeSwapQuote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"getNativeSwapQuote.js","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1
|
+
import { LimitSwapCancelInputs } from './limitSwapCancelMemo.js';
|
|
2
|
+
/**
|
|
3
|
+
* Collapse a memo asset to its layer-1 form, the way `Asset.GetLayer1Asset()`
|
|
4
|
+
* does when THORNode builds the queue index key.
|
|
5
|
+
*
|
|
6
|
+
* On their side this clears the synth/trade/secured flags while keeping chain
|
|
7
|
+
* and symbol; on the wire those flavours are spelled with `/`, `~` and `-`
|
|
8
|
+
* where the L1 asset uses `.`. So: the FIRST separator becomes `.`, and the
|
|
9
|
+
* result is upper-cased (secured denoms arrive lower-case).
|
|
10
|
+
*
|
|
11
|
+
* An asset already in L1 form is left alone — its first separator IS the `.`,
|
|
12
|
+
* and the `-` in a contract-suffixed asset like `ETH.USDC-0XA0B…` comes after
|
|
13
|
+
* it, so it must not be touched.
|
|
14
|
+
*/
|
|
15
|
+
export declare const toThorchainLayer1MemoAsset: (asset: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Reproduce THORNode's advanced-swap-queue index key for a limit order — the
|
|
18
|
+
* tuple that decides which orders are mutually indistinguishable to a cancel.
|
|
19
|
+
*
|
|
20
|
+
* Mirrors `getAdvSwapQueueIndexKey` + `getRatio` + `rewriteRatio`:
|
|
21
|
+
*
|
|
22
|
+
* ratio = (sourceAmount × 1e8) / tradeTarget // integer division
|
|
23
|
+
* key = "<l1Source>><l1Target>/<ratio normalised to 18 chars>/"
|
|
24
|
+
*
|
|
25
|
+
* THORNode scans this bucket for a swap whose `FromAddress` matches the sender
|
|
26
|
+
* and takes the FIRST match — orders are never addressed by tx hash. So two
|
|
27
|
+
* orders reducing to the same key are not independently cancellable.
|
|
28
|
+
*/
|
|
29
|
+
export declare const getThorchainLimitOrderBucketKey: ({ sourceAsset, sourceAmount, targetAsset, tradeTarget, }: LimitSwapCancelInputs) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether two orders would be addressed by the same cancel.
|
|
32
|
+
*
|
|
33
|
+
* Compared on the bucket key, NOT on equal amounts: two orders with different
|
|
34
|
+
* deposits and different trade targets collide whenever their ratio matches
|
|
35
|
+
* (selling 1 and selling 2 at the same price land in one bucket). Comparing
|
|
36
|
+
* amounts for equality would under-report exactly the duplicates a user most
|
|
37
|
+
* needs warning about.
|
|
38
|
+
*
|
|
39
|
+
* Assets are layer-1-normalised because THORNode's key is — a secured or synth
|
|
40
|
+
* representation and the plain L1 asset collapse to the same key on-chain.
|
|
41
|
+
*
|
|
42
|
+
* Deliberately tuned to over-report: warning that two orders might be confused
|
|
43
|
+
* when they would not be is a mild annoyance, whereas missing a real collision
|
|
44
|
+
* means the wrong order closes with no warning at all.
|
|
45
|
+
*/
|
|
46
|
+
export declare const areLimitOrdersCancelIndistinguishable: (a: LimitSwapCancelInputs, b: LimitSwapCancelInputs) => boolean;
|
|
47
|
+
//# sourceMappingURL=limitSwapCancelBucket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limitSwapCancelBucket.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/swap/native/limitSwapCancelBucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAcnG;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,MAAM,KAAG,MAO1D,CAAA;AAcD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,GAAI,0DAK7C,qBAAqB,KAAG,MAa1B,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qCAAqC,GAAI,GAAG,qBAAqB,EAAE,GAAG,qBAAqB,KAAG,OAChC,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { assertPositiveLimitSwapCancelAmounts } from './limitSwapCancelMemo.js';
|
|
2
|
+
/**
|
|
3
|
+
* THORChain's fixed-point exponent, the `1e8` the ratio is scaled by.
|
|
4
|
+
*/
|
|
5
|
+
const thorchainFixedPointExponent = 8n;
|
|
6
|
+
/**
|
|
7
|
+
* THORNode's `ratioLength`. Its own comment: "a value of 18 means that
|
|
8
|
+
* granularity is maxed out at 1 trillion to 1 ratio". Changing it on their side
|
|
9
|
+
* is a kvstore migration, so it is safe to pin.
|
|
10
|
+
*/
|
|
11
|
+
const thorchainRatioLength = 18;
|
|
12
|
+
/**
|
|
13
|
+
* Collapse a memo asset to its layer-1 form, the way `Asset.GetLayer1Asset()`
|
|
14
|
+
* does when THORNode builds the queue index key.
|
|
15
|
+
*
|
|
16
|
+
* On their side this clears the synth/trade/secured flags while keeping chain
|
|
17
|
+
* and symbol; on the wire those flavours are spelled with `/`, `~` and `-`
|
|
18
|
+
* where the L1 asset uses `.`. So: the FIRST separator becomes `.`, and the
|
|
19
|
+
* result is upper-cased (secured denoms arrive lower-case).
|
|
20
|
+
*
|
|
21
|
+
* An asset already in L1 form is left alone — its first separator IS the `.`,
|
|
22
|
+
* and the `-` in a contract-suffixed asset like `ETH.USDC-0XA0B…` comes after
|
|
23
|
+
* it, so it must not be touched.
|
|
24
|
+
*/
|
|
25
|
+
export const toThorchainLayer1MemoAsset = (asset) => {
|
|
26
|
+
const separators = ['/', '~', '-', '.'];
|
|
27
|
+
const index = [...asset].findIndex(char => separators.includes(char));
|
|
28
|
+
if (index === -1 || asset[index] === '.') {
|
|
29
|
+
return asset.toUpperCase();
|
|
30
|
+
}
|
|
31
|
+
return `${asset.slice(0, index)}.${asset.slice(index + 1)}`.toUpperCase();
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Normalise a ratio the way THORNode's `rewriteRatio` does.
|
|
35
|
+
*
|
|
36
|
+
* Not cosmetic: short ratios are zero-padded so keys sort in numeric order, and
|
|
37
|
+
* longer ones are TRUNCATED from the right, which deliberately collapses very
|
|
38
|
+
* large ratios into one bucket. Both behaviours have to be reproduced or a
|
|
39
|
+
* duplicate check disagrees with the chain at exactly the extremes where it
|
|
40
|
+
* matters.
|
|
41
|
+
*/
|
|
42
|
+
const rewriteThorchainRatio = (ratio) => ratio.length < thorchainRatioLength ? ratio.padStart(thorchainRatioLength, '0') : ratio.slice(0, thorchainRatioLength);
|
|
43
|
+
/**
|
|
44
|
+
* Reproduce THORNode's advanced-swap-queue index key for a limit order — the
|
|
45
|
+
* tuple that decides which orders are mutually indistinguishable to a cancel.
|
|
46
|
+
*
|
|
47
|
+
* Mirrors `getAdvSwapQueueIndexKey` + `getRatio` + `rewriteRatio`:
|
|
48
|
+
*
|
|
49
|
+
* ratio = (sourceAmount × 1e8) / tradeTarget // integer division
|
|
50
|
+
* key = "<l1Source>><l1Target>/<ratio normalised to 18 chars>/"
|
|
51
|
+
*
|
|
52
|
+
* THORNode scans this bucket for a swap whose `FromAddress` matches the sender
|
|
53
|
+
* and takes the FIRST match — orders are never addressed by tx hash. So two
|
|
54
|
+
* orders reducing to the same key are not independently cancellable.
|
|
55
|
+
*/
|
|
56
|
+
export const getThorchainLimitOrderBucketKey = ({ sourceAsset, sourceAmount, targetAsset, tradeTarget, }) => {
|
|
57
|
+
// Exported separately from the memo builder, so it can be reached before any
|
|
58
|
+
// memo is validated — `areLimitOrdersCancelIndistinguishable` runs it over
|
|
59
|
+
// stored orders. A zero trade target would make bigint division raise
|
|
60
|
+
// `RangeError`, crashing a duplicate check that is supposed to fail closed;
|
|
61
|
+
// the shared assertion raises the same typed error the sibling modules do, so
|
|
62
|
+
// a caller can branch on `reason` rather than string-matching.
|
|
63
|
+
assertPositiveLimitSwapCancelAmounts({ sourceAmount, tradeTarget });
|
|
64
|
+
const ratio = (sourceAmount * 10n ** thorchainFixedPointExponent) / tradeTarget;
|
|
65
|
+
const source = toThorchainLayer1MemoAsset(sourceAsset);
|
|
66
|
+
const target = toThorchainLayer1MemoAsset(targetAsset);
|
|
67
|
+
return `${source}>${target}/${rewriteThorchainRatio(ratio.toString())}/`;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Whether two orders would be addressed by the same cancel.
|
|
71
|
+
*
|
|
72
|
+
* Compared on the bucket key, NOT on equal amounts: two orders with different
|
|
73
|
+
* deposits and different trade targets collide whenever their ratio matches
|
|
74
|
+
* (selling 1 and selling 2 at the same price land in one bucket). Comparing
|
|
75
|
+
* amounts for equality would under-report exactly the duplicates a user most
|
|
76
|
+
* needs warning about.
|
|
77
|
+
*
|
|
78
|
+
* Assets are layer-1-normalised because THORNode's key is — a secured or synth
|
|
79
|
+
* representation and the plain L1 asset collapse to the same key on-chain.
|
|
80
|
+
*
|
|
81
|
+
* Deliberately tuned to over-report: warning that two orders might be confused
|
|
82
|
+
* when they would not be is a mild annoyance, whereas missing a real collision
|
|
83
|
+
* means the wrong order closes with no warning at all.
|
|
84
|
+
*/
|
|
85
|
+
export const areLimitOrdersCancelIndistinguishable = (a, b) => getThorchainLimitOrderBucketKey(a) === getThorchainLimitOrderBucketKey(b);
|
|
86
|
+
//# sourceMappingURL=limitSwapCancelBucket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limitSwapCancelBucket.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/swap/native/limitSwapCancelBucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAyB,MAAM,uBAAuB,CAAA;AAEnG;;GAEG;AACH,MAAM,2BAA2B,GAAG,EAAE,CAAA;AAEtC;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,EAAE,CAAA;AAE/B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,KAAa,EAAU,EAAE;IAClE,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;IACvC,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;IACrE,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,C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BAA+B,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ThorchainInboundAddress } from '../../chains/cosmos/thor/getThorchainInboundAddress.js';
|
|
2
|
+
export declare const limitSwapCancelDustErrors: readonly ["thresholdUnavailable", "malformedThreshold", "unusablePrecision", "belowObservableMinimum", "exceedsCeiling"];
|
|
3
|
+
export type LimitSwapCancelDustErrorReason = (typeof limitSwapCancelDustErrors)[number];
|
|
4
|
+
export declare class LimitSwapCancelDustError extends Error {
|
|
5
|
+
readonly reason: LimitSwapCancelDustErrorReason;
|
|
6
|
+
constructor(reason: LimitSwapCancelDustErrorReason, message: string);
|
|
7
|
+
}
|
|
8
|
+
type GetLimitSwapCancelDustInput = {
|
|
9
|
+
/** The live inbound row for the source chain. */
|
|
10
|
+
inbound: Pick<ThorchainInboundAddress, 'chain' | 'dust_threshold'>;
|
|
11
|
+
/** The source coin's own precision — 18 for an EVM gas asset, 8 for a UTXO one. */
|
|
12
|
+
decimals: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* How much to attach to a cancel sent FROM an L1 chain, in the source coin's
|
|
16
|
+
* smallest units.
|
|
17
|
+
*
|
|
18
|
+
* A cancel carries no value; the amount exists solely so Bifrost observes the
|
|
19
|
+
* transaction at all. Both failure modes are silent, which is why every branch
|
|
20
|
+
* here throws rather than defaulting:
|
|
21
|
+
*
|
|
22
|
+
* - Under-funded, and Bifrost drops it before it becomes a `MsgObservedTxIn` —
|
|
23
|
+
* the transaction confirms, the fee is spent, nothing is cancelled.
|
|
24
|
+
* - Over-funded, and the excess is irreversibly donated.
|
|
25
|
+
*
|
|
26
|
+
* The conversion is the part that has actually gone wrong in practice: a cancel
|
|
27
|
+
* was once signed for **2000 wei** — THORChain's 1e8-unit threshold used
|
|
28
|
+
* verbatim as an 18-decimal chain's smallest unit — which `ConvertAmount`
|
|
29
|
+
* truncates to zero. So the threshold is rescaled from 1e8 into the coin's own
|
|
30
|
+
* precision, and a result that rounds away is refused rather than nudged up to
|
|
31
|
+
* the bare observable minimum, which would be the same silent failure one order
|
|
32
|
+
* of magnitude higher.
|
|
33
|
+
*/
|
|
34
|
+
export declare const getLimitSwapCancelDust: ({ inbound, decimals }: GetLimitSwapCancelDustInput) => bigint;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=limitSwapCancelDust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limitSwapCancelDust.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/swap/native/limitSwapCancelDust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AA2C7F,eAAO,MAAM,yBAAyB,0HAM5B,CAAA;AAEV,MAAM,MAAM,8BAA8B,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvF,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,MAAM,EAAE,8BAA8B,CAAA;gBAEnC,MAAM,EAAE,8BAA8B,EAAE,OAAO,EAAE,MAAM;CAKpE;AAED,KAAK,2BAA2B,GAAG;IACjC,iDAAiD;IACjD,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAA;IAClE,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,GAAI,uBAAuB,2BAA2B,KAAG,MAiD3F,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THORChain publishes `dust_threshold` in its own 1e8 fixed point, regardless
|
|
3
|
+
* of the source chain's native precision.
|
|
4
|
+
*/
|
|
5
|
+
const thorchainFixedPointDecimals = 8;
|
|
6
|
+
/**
|
|
7
|
+
* Safety multiple over the larger floor.
|
|
8
|
+
*
|
|
9
|
+
* A cancel sitting exactly ON a threshold is a coin flip: THORNode's own
|
|
10
|
+
* comparisons are not uniformly `>=`, and the published threshold can move
|
|
11
|
+
* between the inbound fetch and the transaction landing. Doubling removes both
|
|
12
|
+
* without a magic absolute floor that would be wrong on some chain's units
|
|
13
|
+
* (10,000 is dust on an 18-decimal chain and real money on an 8-decimal one).
|
|
14
|
+
*/
|
|
15
|
+
const dustSafetyMultiple = 2n;
|
|
16
|
+
/**
|
|
17
|
+
* Largest `dust_threshold`, in THORChain's own 1e8 units, that is plausible for
|
|
18
|
+
* any chain — one whole unit of the asset.
|
|
19
|
+
*
|
|
20
|
+
* `dust_threshold` is a REMOTE value that directly decides how much of the
|
|
21
|
+
* user's money is irreversibly donated: there is no refund path for anything
|
|
22
|
+
* attached to an `m=<`. So the bound has to be ABSOLUTE. A ceiling expressed as
|
|
23
|
+
* a multiple of the threshold itself cannot work — a hostile value scales both
|
|
24
|
+
* sides equally and is honoured verbatim.
|
|
25
|
+
*
|
|
26
|
+
* Real thresholds are orders of magnitude below this (Bitcoin's is 10000, or
|
|
27
|
+
* 0.0001 BTC), so the bound rejects only the absurd.
|
|
28
|
+
*/
|
|
29
|
+
const maximumThresholdIn1e8 = 100000000n;
|
|
30
|
+
/**
|
|
31
|
+
* Largest coin precision this rescaling supports.
|
|
32
|
+
*
|
|
33
|
+
* Without it, any non-negative integer is accepted and `decimals: 1000` yields
|
|
34
|
+
* a 993-digit multiplier and a meaningless amount. 36 is far above every real
|
|
35
|
+
* chain (18 is the EVM maximum) while keeping the arithmetic bounded.
|
|
36
|
+
*/
|
|
37
|
+
const maximumDecimals = 36;
|
|
38
|
+
export const limitSwapCancelDustErrors = [
|
|
39
|
+
'thresholdUnavailable',
|
|
40
|
+
'malformedThreshold',
|
|
41
|
+
'unusablePrecision',
|
|
42
|
+
'belowObservableMinimum',
|
|
43
|
+
'exceedsCeiling',
|
|
44
|
+
];
|
|
45
|
+
export class LimitSwapCancelDustError extends Error {
|
|
46
|
+
reason;
|
|
47
|
+
constructor(reason, message) {
|
|
48
|
+
super(message);
|
|
49
|
+
this.reason = reason;
|
|
50
|
+
this.name = 'LimitSwapCancelDustError';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* How much to attach to a cancel sent FROM an L1 chain, in the source coin's
|
|
55
|
+
* smallest units.
|
|
56
|
+
*
|
|
57
|
+
* A cancel carries no value; the amount exists solely so Bifrost observes the
|
|
58
|
+
* transaction at all. Both failure modes are silent, which is why every branch
|
|
59
|
+
* here throws rather than defaulting:
|
|
60
|
+
*
|
|
61
|
+
* - Under-funded, and Bifrost drops it before it becomes a `MsgObservedTxIn` —
|
|
62
|
+
* the transaction confirms, the fee is spent, nothing is cancelled.
|
|
63
|
+
* - Over-funded, and the excess is irreversibly donated.
|
|
64
|
+
*
|
|
65
|
+
* The conversion is the part that has actually gone wrong in practice: a cancel
|
|
66
|
+
* was once signed for **2000 wei** — THORChain's 1e8-unit threshold used
|
|
67
|
+
* verbatim as an 18-decimal chain's smallest unit — which `ConvertAmount`
|
|
68
|
+
* truncates to zero. So the threshold is rescaled from 1e8 into the coin's own
|
|
69
|
+
* precision, and a result that rounds away is refused rather than nudged up to
|
|
70
|
+
* the bare observable minimum, which would be the same silent failure one order
|
|
71
|
+
* of magnitude higher.
|
|
72
|
+
*/
|
|
73
|
+
export const getLimitSwapCancelDust = ({ inbound, decimals }) => {
|
|
74
|
+
const { chain, dust_threshold: threshold } = inbound;
|
|
75
|
+
if (!threshold?.trim()) {
|
|
76
|
+
throw new LimitSwapCancelDustError('thresholdUnavailable', `cancel dust: ${chain} inbound carries no dust_threshold, so the minimum Bifrost will observe is unknown`);
|
|
77
|
+
}
|
|
78
|
+
if (!/^\d+$/.test(threshold.trim())) {
|
|
79
|
+
throw new LimitSwapCancelDustError('malformedThreshold', `cancel dust: ${chain} dust_threshold is not an integer: ${JSON.stringify(threshold)}`);
|
|
80
|
+
}
|
|
81
|
+
if (!Number.isInteger(decimals) || decimals < 0 || decimals > maximumDecimals) {
|
|
82
|
+
throw new LimitSwapCancelDustError('unusablePrecision', `cancel dust: ${chain} source coin declares an unusable precision (${decimals})`);
|
|
83
|
+
}
|
|
84
|
+
const thresholdIn1e8 = BigInt(threshold.trim());
|
|
85
|
+
if (thresholdIn1e8 > maximumThresholdIn1e8) {
|
|
86
|
+
throw new LimitSwapCancelDustError('exceedsCeiling', `cancel dust: ${chain} dust_threshold ${thresholdIn1e8} (1e8) exceeds the plausible ceiling ${maximumThresholdIn1e8}`);
|
|
87
|
+
}
|
|
88
|
+
// Rescale from THORChain's 1e8 into the coin's own precision. Integer-only,
|
|
89
|
+
// in a direction chosen per branch so nothing is silently lost.
|
|
90
|
+
const scaled = decimals >= thorchainFixedPointDecimals
|
|
91
|
+
? thresholdIn1e8 * 10n ** BigInt(decimals - thorchainFixedPointDecimals)
|
|
92
|
+
: thresholdIn1e8 / 10n ** BigInt(thorchainFixedPointDecimals - decimals);
|
|
93
|
+
const dust = scaled * dustSafetyMultiple;
|
|
94
|
+
if (thresholdIn1e8 > 0n && dust <= 0n) {
|
|
95
|
+
throw new LimitSwapCancelDustError('belowObservableMinimum', `cancel dust: ${chain} threshold ${thresholdIn1e8} (1e8) rounds away at ${decimals} decimals, ` +
|
|
96
|
+
'so no attachable amount would be observed');
|
|
97
|
+
}
|
|
98
|
+
return dust;
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=limitSwapCancelDust.js.map
|