@vultisig/core-chain 2.30.0 → 2.31.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/Chain.d.ts +3 -0
  3. package/dist/Chain.d.ts.map +1 -1
  4. package/dist/Chain.js +1 -0
  5. package/dist/Chain.js.map +1 -1
  6. package/dist/ChainKind.d.ts +1 -0
  7. package/dist/ChainKind.d.ts.map +1 -1
  8. package/dist/ChainKind.js +1 -0
  9. package/dist/ChainKind.js.map +1 -1
  10. package/dist/chains/evm/chainInfo.d.ts +54 -0
  11. package/dist/chains/evm/chainInfo.d.ts.map +1 -1
  12. package/dist/chains/evm/chainInfo.js +22 -0
  13. package/dist/chains/evm/chainInfo.js.map +1 -1
  14. package/dist/chains/evm/tx/fee/index.d.ts.map +1 -1
  15. package/dist/chains/evm/tx/fee/index.js +1 -0
  16. package/dist/chains/evm/tx/fee/index.js.map +1 -1
  17. package/dist/coin/coinType.d.ts.map +1 -1
  18. package/dist/coin/coinType.js +1 -0
  19. package/dist/coin/coinType.js.map +1 -1
  20. package/dist/coin/find/resolvers/evm/index.d.ts.map +1 -1
  21. package/dist/coin/find/resolvers/evm/index.js +31 -2
  22. package/dist/coin/find/resolvers/evm/index.js.map +1 -1
  23. package/dist/coin/knownTokens/index.d.ts +1 -1
  24. package/dist/coin/knownTokens/index.d.ts.map +1 -1
  25. package/dist/coin/knownTokens/index.js +506 -0
  26. package/dist/coin/knownTokens/index.js.map +1 -1
  27. package/dist/coin/price/evm/getErc20Prices.d.ts.map +1 -1
  28. package/dist/coin/price/evm/getErc20Prices.js +1 -0
  29. package/dist/coin/price/evm/getErc20Prices.js.map +1 -1
  30. package/dist/coin/token/metadata/chains.d.ts +1 -1
  31. package/dist/coin/token/metadata/chains.d.ts.map +1 -1
  32. package/dist/security/blockaid/evmChains.d.ts.map +1 -1
  33. package/dist/security/blockaid/evmChains.js +2 -0
  34. package/dist/security/blockaid/evmChains.js.map +1 -1
  35. package/dist/swap/general/knownAggregatorRouters.d.ts.map +1 -1
  36. package/dist/swap/general/knownAggregatorRouters.js +7 -1
  37. package/dist/swap/general/knownAggregatorRouters.js.map +1 -1
  38. package/dist/swap/general/kyber/chains.d.ts +1 -1
  39. package/dist/swap/general/kyber/chains.d.ts.map +1 -1
  40. package/dist/swap/general/kyber/chains.js +1 -0
  41. package/dist/swap/general/kyber/chains.js.map +1 -1
  42. package/dist/swap/general/lifi/LifiSwapEnabledChains.d.ts +1 -1
  43. package/dist/swap/general/lifi/LifiSwapEnabledChains.d.ts.map +1 -1
  44. package/dist/swap/general/oneInch/OneInchSwapEnabledChains.d.ts +1 -1
  45. package/dist/swap/general/oneInch/OneInchSwapEnabledChains.d.ts.map +1 -1
  46. package/dist/swap/general/oneInch/OneInchSwapEnabledChains.js +3 -0
  47. package/dist/swap/general/oneInch/OneInchSwapEnabledChains.js.map +1 -1
  48. package/dist/swap/native/limitSwapCancelBucket.d.ts +47 -0
  49. package/dist/swap/native/limitSwapCancelBucket.d.ts.map +1 -0
  50. package/dist/swap/native/limitSwapCancelBucket.js +86 -0
  51. package/dist/swap/native/limitSwapCancelBucket.js.map +1 -0
  52. package/dist/swap/native/limitSwapCancelDust.d.ts +36 -0
  53. package/dist/swap/native/limitSwapCancelDust.d.ts.map +1 -0
  54. package/dist/swap/native/limitSwapCancelDust.js +100 -0
  55. package/dist/swap/native/limitSwapCancelDust.js.map +1 -0
  56. package/dist/swap/native/limitSwapCancelEligibility.d.ts +96 -0
  57. package/dist/swap/native/limitSwapCancelEligibility.d.ts.map +1 -0
  58. package/dist/swap/native/limitSwapCancelEligibility.js +165 -0
  59. package/dist/swap/native/limitSwapCancelEligibility.js.map +1 -0
  60. package/dist/swap/native/limitSwapCancelMemo.d.ts +123 -0
  61. package/dist/swap/native/limitSwapCancelMemo.d.ts.map +1 -0
  62. package/dist/swap/native/limitSwapCancelMemo.js +158 -0
  63. package/dist/swap/native/limitSwapCancelMemo.js.map +1 -0
  64. package/dist/swap/native/limitSwapMemo.d.ts.map +1 -1
  65. package/dist/swap/native/limitSwapMemo.js +7 -3
  66. package/dist/swap/native/limitSwapMemo.js.map +1 -1
  67. package/dist/swap/swapEnabledChains.d.ts +1 -1
  68. package/dist/swap/swapEnabledChains.d.ts.map +1 -1
  69. package/dist/tx/fee/evm/clampEvmPriorityFee.d.ts.map +1 -1
  70. package/dist/tx/fee/evm/clampEvmPriorityFee.js +2 -1
  71. package/dist/tx/fee/evm/clampEvmPriorityFee.js.map +1 -1
  72. package/dist/tx/fee/evm/evmGasLimit.d.ts.map +1 -1
  73. package/dist/tx/fee/evm/evmGasLimit.js +2 -0
  74. package/dist/tx/fee/evm/evmGasLimit.js.map +1 -1
  75. package/dist/utils/getBlockExplorerUrl/index.d.ts.map +1 -1
  76. package/dist/utils/getBlockExplorerUrl/index.js +4 -1
  77. package/dist/utils/getBlockExplorerUrl/index.js.map +1 -1
  78. package/package.json +21 -1
@@ -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,CAAC,QAAQ,CAAC,EAAE,UAAU;IAC/B,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,WAAW;IACjC,CAAC,QAAQ,CAAC,IAAI,CA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,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"}
@@ -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;AAmEnC,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,CAwBjH;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAK1F"}
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
- : normalized === ONE_INCH_V5_ROUTER || normalized === ONE_INCH_V6_STANDARD_ROUTER;
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,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,sFAAsF;AACtF,8EAA8E;AAC9E,iEAAiE;AACjE,MAAM,qBAAqB,GAAG,4CAA4C,CAAA;AAI1E,MAAM,yBA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,OAAO,8CAA8C,iBAAiB,QAAQ,KAAK,wDAAwD,CAClL,CAAA;IACH,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,QAAgC,EAAE,OAAe,EAAE,KAAY;IACzG,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAA;IACxC,MAAM,OAAO,GACX,QAAQ,KAAK,OAAO;QAClB,CAAC,CAAC,UAAU,KAAK,qBAAqB;QACtC,CAAC,CAAC,QAAQ,KAAK,SAAS;YACtB,CAAC,CAAC,4FAA4F;gBAC5F,2EAA2E;gBAC3E,qFAAqF;gBACrF,6FAA6F;gBAC7F,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,UAAU,KAAK,kBAAkB,IAAI,UAAU,KAAK,2BAA2B,CAAA;IAEzF,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
+ {"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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,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,sFAQzB,CAAA;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA"}
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"}
@@ -12,5 +12,6 @@ export const kyberSwapEnabledChains = [
12
12
  Chain.Optimism,
13
13
  Chain.Avalanche,
14
14
  Chain.Base,
15
+ Chain.Robinhood,
15
16
  ];
16
17
  //# sourceMappingURL=chains.js.map
@@ -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;CACF,CAAA"}
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,mOAAsD,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
+ {"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,gGAS3B,CAAA"}
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;CACF,CAAA"}
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"}
@@ -0,0 +1,47 @@
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":["../../../../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E;IAC7E,2EAA2E;IAC3E,sEAAsE;IACtE,4EAA4E;IAC5E,8EAA8E;IAC9E,+DAA+D;IAC/D,oCAAoC,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAA;IAEnE,MAAM,KAAK,GAAG,CAAC,YAAY,GAAG,GAAG,IAAI,2BAA2B,CAAC,GAAG,WAAW,CAAA;IAC/E,MAAM,MAAM,GAAG,0BAA0B,CAAC,WAAW,CAAC,CAAA;IACtD,MAAM,MAAM,GAAG,0BAA0B,CAAC,WAAW,CAAC,CAAA;IACtD,OAAO,GAAG,MAAM,IAAI,MAAM,IAAI,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAA;AAC1E,CAAC,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAwB,EAAE,CAAwB,EAAW,EAAE,CACnH,+BAA+B,CAAC,CAAC,CAAC,KAAK,+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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limitSwapCancelDust.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/swap/native/limitSwapCancelDust.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,2BAA2B,GAAG,CAAC,CAAA;AAErC;;;;;;;;GAQG;AACH,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAE7B;;;;;;;;;;;;GAYG;AACH,MAAM,qBAAqB,GAAG,UAAY,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,EAAE,CAAA;AAE1B,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,sBAAsB;IACtB,oBAAoB;IACpB,mBAAmB;IACnB,wBAAwB;IACxB,gBAAgB;CACR,CAAA;AAIV,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACxC,MAAM,CAAgC;IAE/C,YAAY,MAAsC,EAAE,OAAe;QACjE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;IACxC,CAAC;CACF;AASD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAA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GAAG,MAAM,GAAG,kBAAkB,CAAA;IAExC,IAAI,cAAc,GAAG,EAAE,IAAI,IAAI,IAAI,EAAE,EAAE,CAAC;QACtC,MAAM,IAAI,wBAAwB,CAChC,wBAAwB,EACxB,gBAAgB,KAAK,cAAc,cAAc,yBAAyB,QAAQ,aAAa;YAC7F,2CAA2C,CAC9C,CAAA;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
@@ -0,0 +1,96 @@
1
+ import { LimitSwapCancelInputs } from './limitSwapCancelMemo.js';
2
+ export declare const limitSwapCancelBlockers: readonly ["terminal", "cancelAlreadyBroadcast", "missingSignedData", "signedDataDisagreesWithChain", "memoTooLongForSourceChain", "unroutableSourceChain"];
3
+ export type LimitSwapCancelBlocker = (typeof limitSwapCancelBlockers)[number];
4
+ /**
5
+ * Which spelling of an asset a cancel memo may use, or why there isn't one.
6
+ */
7
+ export type LimitSwapCancelAssetResolution = {
8
+ resolved: string;
9
+ } | {
10
+ problem: 'disagrees';
11
+ } | {
12
+ problem: 'unknown';
13
+ };
14
+ type ResolveLimitSwapCancelAssetInput = {
15
+ /** The PLACEMENT memo's spelling — lossy, usable only when not truncated. */
16
+ stored: string;
17
+ /** The full form captured locally at signing, when it exists. */
18
+ signed?: string;
19
+ /** The queue's own report, after `fuzzyAssetMatch` resolved the placement. */
20
+ observed?: string;
21
+ };
22
+ /**
23
+ * Resolve which spelling of one of the order's assets a cancel may use.
24
+ *
25
+ * Three sources, in decreasing order of how much they prove:
26
+ *
27
+ * 1. **The queue's own report** — the string THORChain built this order's index
28
+ * entry from. Authoritative by construction, and the only source for an
29
+ * order placed before the full form was recorded locally.
30
+ * 2. **The full form captured at signing** — derived from the coin's own
31
+ * contract, so exact whenever it exists.
32
+ * 3. **The stored placement spelling** — usable ONLY when it carries no
33
+ * truncated identifier, which makes it full by construction. That covers
34
+ * every native leg (`BTC.BTC`, `THOR.RUNE`) and every secured denom.
35
+ *
36
+ * `disagrees` when a local spelling and the chain's own differ: one is wrong
37
+ * and there is no way to tell which. This is the check a real failure needed —
38
+ * the amounts were cross-checked and agreed, the assets were never compared,
39
+ * and the asset was the entire defect.
40
+ *
41
+ * Compared case-insensitively: the sources differ on case by convention (a
42
+ * secured denom is emitted lower-case and reported upper-case, and
43
+ * `common.ParseCoin` upper-cases whatever it is given). Anything beyond case is
44
+ * a real difference.
45
+ */
46
+ export declare const resolveLimitSwapCancelAsset: ({ stored, signed, observed, }: ResolveLimitSwapCancelAssetInput) => LimitSwapCancelAssetResolution;
47
+ export type LimitSwapCancelCandidate = {
48
+ /** Whether the order has already closed. */
49
+ isTerminal: boolean;
50
+ /** Whether a cancel has already been broadcast against this order. */
51
+ hasPendingCancel?: boolean;
52
+ /** Source asset as the PLACEMENT memo spelled it. */
53
+ sourceAsset: string;
54
+ /** Target asset as the PLACEMENT memo spelled it. */
55
+ targetAsset: string;
56
+ /** Full source spelling captured at signing, if recorded. */
57
+ signedSourceAsset?: string;
58
+ /** Full target spelling captured at signing, if recorded. */
59
+ signedTargetAsset?: string;
60
+ /** Deposited source amount recorded at signing, in 1e8. */
61
+ signedSourceAmount?: bigint;
62
+ /** Trade target recorded at signing, in 1e8. */
63
+ signedTradeTarget?: bigint;
64
+ /** The queue's `coins[0].asset`, once polled. */
65
+ observedSourceAsset?: string;
66
+ /** The queue's `target_asset`, once polled. */
67
+ observedTargetAsset?: string;
68
+ /** The queue's `state.deposit`, once polled. */
69
+ observedDeposit?: bigint;
70
+ /** The queue's `trade_target`, once polled. */
71
+ observedTradeTarget?: bigint;
72
+ };
73
+ export type LimitSwapCancelEligibility = {
74
+ cancellable: LimitSwapCancelInputs;
75
+ } | {
76
+ blocked: LimitSwapCancelBlocker;
77
+ };
78
+ /**
79
+ * Decide whether an order can be cancelled, and if so with which exact amounts.
80
+ *
81
+ * **Fails closed at every unknown.** The failure this guards against is not a
82
+ * crash or an error dialog — it is a cancel that is accepted, costs a fee, and
83
+ * silently matches no order at all. Every branch that cannot prove the values
84
+ * are the ones THORChain holds returns a blocker.
85
+ *
86
+ * The signed-versus-observed cross-check covers assets as well as amounts.
87
+ * Absence is NOT disagreement: an order placed seconds ago has not been polled,
88
+ * and refusing to cancel until the first poll lands would be a worse failure
89
+ * than the one this prevents. But present-and-unparseable blocks exactly as a
90
+ * mismatch does — "not polled yet" and "polled, and the wire carried something
91
+ * we do not model" are different claims, and only the first is safe to proceed
92
+ * through.
93
+ */
94
+ export declare const getLimitSwapCancelEligibility: (candidate: LimitSwapCancelCandidate) => LimitSwapCancelEligibility;
95
+ export {};
96
+ //# sourceMappingURL=limitSwapCancelEligibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limitSwapCancelEligibility.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/swap/native/limitSwapCancelEligibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,qBAAqB,EACtB,MAAM,uBAAuB,CAAA;AAG9B,eAAO,MAAM,uBAAuB,4JA+B1B,CAAA;AAEV,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,CAAA;AAErH,KAAK,gCAAgC,GAAG;IACtC,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAA;IACd,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAOD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,2BAA2B,GAAI,+BAIzC,gCAAgC,KAAG,8BAmBrC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,4CAA4C;IAC5C,UAAU,EAAE,OAAO,CAA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