@anywalletkit/protocol-swap2-chainflip 0.0.0-stage → 0.2.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 (50) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +81 -2
  3. package/dist/activity.cjs +62 -0
  4. package/dist/activity.cjs.map +1 -0
  5. package/dist/activity.d.cts +12 -0
  6. package/dist/activity.d.ts +12 -0
  7. package/dist/activity.js +10 -0
  8. package/dist/activity.js.map +1 -0
  9. package/dist/chunk-GXHOO3CT.js +54 -0
  10. package/dist/chunk-GXHOO3CT.js.map +1 -0
  11. package/dist/chunk-H6GJVVWS.js +22 -0
  12. package/dist/chunk-H6GJVVWS.js.map +1 -0
  13. package/dist/chunk-R6EYDH5N.js +142 -0
  14. package/dist/chunk-R6EYDH5N.js.map +1 -0
  15. package/dist/chunk-XF7BEBET.js +27 -0
  16. package/dist/chunk-XF7BEBET.js.map +1 -0
  17. package/dist/chunk-ZFCYBCOT.js +223 -0
  18. package/dist/chunk-ZFCYBCOT.js.map +1 -0
  19. package/dist/codec.cjs +162 -0
  20. package/dist/codec.cjs.map +1 -0
  21. package/dist/codec.d.cts +60 -0
  22. package/dist/codec.d.ts +60 -0
  23. package/dist/codec.js +25 -0
  24. package/dist/codec.js.map +1 -0
  25. package/dist/config.cjs +74 -0
  26. package/dist/config.cjs.map +1 -0
  27. package/dist/config.d.cts +46 -0
  28. package/dist/config.d.ts +46 -0
  29. package/dist/config.js +19 -0
  30. package/dist/config.js.map +1 -0
  31. package/dist/index.cjs +447 -0
  32. package/dist/index.cjs.map +1 -0
  33. package/dist/index.d.cts +10 -0
  34. package/dist/index.d.ts +10 -0
  35. package/dist/index.js +56 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/protocol.cjs +426 -0
  38. package/dist/protocol.cjs.map +1 -0
  39. package/dist/protocol.d.cts +16 -0
  40. package/dist/protocol.d.ts +16 -0
  41. package/dist/protocol.js +11 -0
  42. package/dist/protocol.js.map +1 -0
  43. package/dist/provider.cjs +412 -0
  44. package/dist/provider.cjs.map +1 -0
  45. package/dist/provider.d.cts +12 -0
  46. package/dist/provider.d.ts +12 -0
  47. package/dist/provider.js +10 -0
  48. package/dist/provider.js.map +1 -0
  49. package/module.json +20 -0
  50. package/package.json +90 -3
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,82 @@
1
- # Temporary Holding Version
1
+ # @anywalletkit/protocol-swap2-chainflip
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [Chainflip](https://docs.chainflip.io) vault swaps as a swap2 provider: native
4
+ BTC / ETH / SOL / TRX and USDC / USDT between Ethereum, Arbitrum, Solana, Tron
5
+ and Bitcoin, priced by Chainflip's JIT AMM. Quotes and encoding come from
6
+ Chainflip's public backend (`chainflip-swap.chainflip.io`). You need no broker
7
+ account, there is no API key, and the commission is 0 bps.
8
+
9
+ ```ts
10
+ import {chainflipProvider} from "@anywalletkit/protocol-swap2-chainflip/provider";
11
+ import {RouterSwap2Protocol} from "@anywalletkit/protocol-swap2-router/swap2/router";
12
+
13
+ const swap2 = new RouterSwap2Protocol(tronAccount, {fromChain: "tron:728126428", providers: [chainflipProvider()]});
14
+ const res = await swap2.swap2({fromToken: "USDT", toToken: "USDC", toChain: 42161, fromTokenAmount: 20_000_000n});
15
+ const status = await swap2.getSwap2Status(res.id); // pending → depositReceived → completed (+ egress tx) | refunded
16
+ ```
17
+
18
+ | From (sources) | How the swap is sent |
19
+ |---|---|
20
+ | Ethereum, Arbitrum | `xSwapNative` / `xSwapToken` on the Chainflip Vault; tokens get an exact approval to the Vault first |
21
+ | Tron | TRC-20 USDT (or TRX) **to the Vault**, with the swap as a binary note in `raw_data.data` (`memoEncoding: "hex"`) |
22
+
23
+ Destinations: Ethereum (ETH, USDC, USDT, WBTC), Arbitrum (ETH, USDC, USDT),
24
+ Solana (SOL, USDC, USDT), Tron (TRX, USDT) and Bitcoin (BTC). Solana and
25
+ Bitcoin as **sources** are not wired yet.
26
+
27
+ ## Why vault swaps and not deposit channels
28
+
29
+ A deposit channel is an address that Chainflip's broker opens for you. The
30
+ client cannot prove where that address forwards the funds: the backend has no
31
+ lookup by deposit address. With a vault swap, the swap parameters are in the
32
+ transaction itself — calldata on EVM, the note on Tron — so the wallet can
33
+ decode and check them before signing. A Tron vault swap also skips the
34
+ channel's ingress cost (live 2026-10-20: $20 USDT → 19.48 USDC through the
35
+ Vault vs −19.5 % through a channel).
36
+
37
+ ## What is checked before signing
38
+
39
+ The provider never forwards the encoder's output blindly. `getQuote` decodes it
40
+ (SCALE `VersionedCfParameters` V1, the Tron note, or the EVM Vault ABI) and
41
+ refuses the quote unless all of the following hold:
42
+
43
+ - the target is the known Vault for the source chain (`CF_VAULTS`). On Tron it
44
+ must be a TRC-20 `transfer(Vault, amountIn)` of the quoted token;
45
+ - the destination chain id, output asset id and destination address bytes
46
+ match the request (EVM hex, Tron 20 B, Solana 32 B, BTC as ASCII);
47
+ - the refund address is the sender, and the swap is fill-or-kill:
48
+ `minPriceX128 ≥ ceil(minOut · 2^128 / amountIn)`, retry ≤ 600 blocks, and the
49
+ oracle slippage guard is what we asked for;
50
+ - there is no DCA, no boost, no broker commission and no affiliates.
51
+
52
+ The minimum output is either the caller's `minAmountOut` or the expected
53
+ amount less the slippage (`slippageBps`, or the backend's recommendation when
54
+ none is given). If the price can't be met within the retry window, Chainflip
55
+ refunds the input to the sender.
56
+
57
+ ## Minimums
58
+
59
+ These are Chainflip's per-asset ingress minimums. A smaller amount gets no quote.
60
+ Ethereum USDC/USDT: $20. Arbitrum, Solana and Tron stables: $10. BTC: 40 000 sat.
61
+ TRX: 30.
62
+
63
+ ## Status
64
+
65
+ `trackIntent` reads `GET /v2/swaps/{sourceTxHash}`:
66
+
67
+ - 404 means the swap is not seen yet (pending);
68
+ - RECEIVING, SWAPPING and SENDING mean the deposit was received;
69
+ - COMPLETED returns the destination tx (`swapEgress.txRef`);
70
+ - FAILED returns `refunded` if a refund egress exists, otherwise `failed`.
71
+
72
+ The endpoint rate-limits (429); the provider retries once.
73
+
74
+ ## Config
75
+
76
+ ```ts
77
+ chainflipProvider({
78
+ enabled: true, // default
79
+ apiUrl: "https://chainflip-swap.chainflip.io",
80
+ maxOraclePriceSlippageBps: 100, // oracle guard in the fill-or-kill params; default = the quote's recommendation, null = off
81
+ })
82
+ ```
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/activity.ts
21
+ var activity_exports = {};
22
+ __export(activity_exports, {
23
+ CHAINFLIP_MODULE: () => CHAINFLIP_MODULE,
24
+ describeChainflipActivity: () => describeChainflipActivity
25
+ });
26
+ module.exports = __toCommonJS(activity_exports);
27
+ var import_activity = require("@anywalletkit/protocol-swap2-core/activity");
28
+
29
+ // src/config.ts
30
+ var CF_ASSETS = [
31
+ { chain: "Ethereum", asset: "ETH", id: 1, decimals: 18, token: null, minDeposit: 10n ** 16n },
32
+ { chain: "Ethereum", asset: "USDC", id: 3, decimals: 6, token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", minDeposit: 20000000n },
33
+ { chain: "Ethereum", asset: "USDT", id: 8, decimals: 6, token: "0xdAC17F958D2ee523a2206206994597C13D831ec7", minDeposit: 20000000n },
34
+ { chain: "Ethereum", asset: "WBTC", id: 14, decimals: 8, token: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", minDeposit: 40000n },
35
+ { chain: "Bitcoin", asset: "BTC", id: 5, decimals: 8, token: null, minDeposit: 40000n },
36
+ { chain: "Arbitrum", asset: "ETH", id: 6, decimals: 18, token: null, minDeposit: 3900000000000000n },
37
+ { chain: "Arbitrum", asset: "USDC", id: 7, decimals: 6, token: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", minDeposit: 10000000n },
38
+ { chain: "Arbitrum", asset: "USDT", id: 15, decimals: 6, token: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", minDeposit: 10000000n },
39
+ { chain: "Solana", asset: "SOL", id: 9, decimals: 9, token: null, minDeposit: 68000000n },
40
+ { chain: "Solana", asset: "USDC", id: 10, decimals: 6, token: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", minDeposit: 10000000n },
41
+ { chain: "Solana", asset: "USDT", id: 16, decimals: 6, token: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", minDeposit: 10000000n },
42
+ { chain: "Tron", asset: "TRX", id: 17, decimals: 6, token: null, minDeposit: 30000000n },
43
+ { chain: "Tron", asset: "USDT", id: 18, decimals: 6, token: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", minDeposit: 10000000n }
44
+ ];
45
+ var CF_VAULTS = {
46
+ "eip155:1": "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
47
+ "eip155:42161": "0x79001a5e762f3bEFC8e5871b42F6734e00498920",
48
+ "tron:728126428": "TEcDijvKSXcfWT7S6rd44H5vNgufm7Y4XC"
49
+ };
50
+
51
+ // src/activity.ts
52
+ var CHAINFLIP_MODULE = "@anywalletkit/protocol-swap2-chainflip";
53
+ var same = (chain, a, b) => !!a && (chain.startsWith("eip155:") ? a.toLowerCase() === b.toLowerCase() : a === b);
54
+ var CHAIN_ALIAS = { "tron:0x2b6653dc": "tron:728126428" };
55
+ function describeChainflipActivity(tx, ctx) {
56
+ const vault = CF_VAULTS[CHAIN_ALIAS[tx.chain] ?? tx.chain];
57
+ if (!vault) return null;
58
+ const toVault = same(tx.chain, tx.to, vault) || tx.transfers.some((t) => same(tx.chain, t.to, vault) && ctx.own.has(t.from));
59
+ if (!toVault) return null;
60
+ return (0, import_activity.describeSwapLike)(tx, ctx, { protocol: CHAINFLIP_MODULE, subtitle: "Chainflip", kind: "bridge", counterparty: vault, inSuffix: "via Chainflip" });
61
+ }
62
+ //# sourceMappingURL=activity.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/activity.ts","../src/config.ts"],"sourcesContent":["/**\n * Activity recognition for Chainflip vault swaps: the source leg is a call to (EVM) or a transfer into (Tron) the\n * Chainflip Vault — a fixed, well-known counterparty, so the leg is recognizable offline. The destination leg is a\n * transfer from Chainflip's egress keys (rotating), tied back through the intent journal.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {describeSwapLike} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {CF_VAULTS} from \"./config.js\";\n\nexport const CHAINFLIP_MODULE = \"@anywalletkit/protocol-swap2-chainflip\";\n\nconst same = (chain: string, a: string | null | undefined, b: string) => !!a && (chain.startsWith(\"eip155:\") ? a.toLowerCase() === b.toLowerCase() : a === b);\n\n/** Wallet history names Tron by its genesis-hash form (`tron:0x2b6653dc`); swap2 routes by chain id (`tron:728126428`). */\nconst CHAIN_ALIAS: Readonly<Record<string, string>> = {\"tron:0x2b6653dc\": \"tron:728126428\"};\n\nexport function describeChainflipActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n const vault = CF_VAULTS[CHAIN_ALIAS[tx.chain] ?? tx.chain];\n if (!vault) return null;\n const toVault = same(tx.chain, (tx as {to?: string}).to, vault) || tx.transfers.some((t) => same(tx.chain, t.to, vault) && ctx.own.has(t.from));\n if (!toVault) return null;\n return describeSwapLike(tx, ctx, {protocol: CHAINFLIP_MODULE, subtitle: \"Chainflip\", kind: \"bridge\", counterparty: vault, inSuffix: \"via Chainflip\"});\n}\n","/**\n * Chainflip (JIT-AMM state chain) — chains, assets and contracts as the public backend and the vault encodings name them.\n * Asset ids, chain ids and decimals are the protocol's own (`cf_environment` / networkInfo, verified 2026-10-20); the\n * contract addresses are Chainflip's mainnet deployments (docs mainnet-addresses, confirmed by live encodings).\n *\n * Only VAULT SWAPS are offered: the donor signs a transaction whose every Chainflip parameter (destination, minimum price,\n * refund address) is decoded and checked locally before signing — no off-chain deposit channel to trust, and on Tron no\n * 3.4 USDT ingress fee. Sources: EVM (Ethereum, Arbitrum) and Tron in this release; Solana / Bitcoin vault swaps need an\n * instruction / OP_RETURN builder and come next. Destinations: every live chain.\n */\nexport type CfChain = \"Ethereum\" | \"Bitcoin\" | \"Arbitrum\" | \"Solana\" | \"Tron\";\n\nexport interface CfAsset {\n chain: CfChain;\n /** the API's asset symbol */\n asset: string;\n /** the u32 asset id inside vault encodings */\n id: number;\n decimals: number;\n /** token contract / mint on its chain, null for the native coin */\n token: string | null;\n /** smallest deposit the state chain accepts (base units) */\n minDeposit: bigint;\n}\n\n/**\n * CAIP-2 → Chainflip chain: `id` = the ForeignChain number an EVM vault call names (`dstChain`), `addrTag` = the\n * EncodedAddress variant a Tron note names (Eth 0, Dot 1, Btc 2, Arb 3, Sol 4, Hub 5, Tron 6) — two different enums.\n */\nexport const CF_CHAINS: Readonly<Record<string, {name: CfChain; id: number; addrTag: number}>> = {\n \"eip155:1\": {name: \"Ethereum\", id: 1, addrTag: 0},\n \"bitcoin:mainnet\": {name: \"Bitcoin\", id: 3, addrTag: 2},\n \"eip155:42161\": {name: \"Arbitrum\", id: 4, addrTag: 3},\n \"solana:mainnet\": {name: \"Solana\", id: 5, addrTag: 4},\n \"tron:728126428\": {name: \"Tron\", id: 7, addrTag: 6},\n};\n\nexport const CF_ASSETS: readonly CfAsset[] = [\n {chain: \"Ethereum\", asset: \"ETH\", id: 1, decimals: 18, token: null, minDeposit: 10n ** 16n},\n {chain: \"Ethereum\", asset: \"USDC\", id: 3, decimals: 6, token: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\", minDeposit: 20_000_000n},\n {chain: \"Ethereum\", asset: \"USDT\", id: 8, decimals: 6, token: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\", minDeposit: 20_000_000n},\n {chain: \"Ethereum\", asset: \"WBTC\", id: 14, decimals: 8, token: \"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599\", minDeposit: 40_000n},\n {chain: \"Bitcoin\", asset: \"BTC\", id: 5, decimals: 8, token: null, minDeposit: 40_000n},\n {chain: \"Arbitrum\", asset: \"ETH\", id: 6, decimals: 18, token: null, minDeposit: 3_900_000_000_000_000n},\n {chain: \"Arbitrum\", asset: \"USDC\", id: 7, decimals: 6, token: \"0xaf88d065e77c8cC2239327C5EDb3A432268e5831\", minDeposit: 10_000_000n},\n {chain: \"Arbitrum\", asset: \"USDT\", id: 15, decimals: 6, token: \"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9\", minDeposit: 10_000_000n},\n {chain: \"Solana\", asset: \"SOL\", id: 9, decimals: 9, token: null, minDeposit: 68_000_000n},\n {chain: \"Solana\", asset: \"USDC\", id: 10, decimals: 6, token: \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\", minDeposit: 10_000_000n},\n {chain: \"Solana\", asset: \"USDT\", id: 16, decimals: 6, token: \"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB\", minDeposit: 10_000_000n},\n {chain: \"Tron\", asset: \"TRX\", id: 17, decimals: 6, token: null, minDeposit: 30_000_000n},\n {chain: \"Tron\", asset: \"USDT\", id: 18, decimals: 6, token: \"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t\", minDeposit: 10_000_000n},\n];\n\n/** Vault contracts that receive vault swaps (the deposit transaction's target). */\nexport const CF_VAULTS: Readonly<Record<string, string>> = {\n \"eip155:1\": \"0xF5e10380213880111522dd0efD3dbb45b9f62Bcc\",\n \"eip155:42161\": \"0x79001a5e762f3bEFC8e5871b42F6734e00498920\",\n \"tron:728126428\": \"TEcDijvKSXcfWT7S6rd44H5vNgufm7Y4XC\",\n};\n\n/** Sources this release signs (vault swaps the engine can execute and the verifier can decode). */\nexport const CF_SOURCE_CHAINS = new Set([\"eip155:1\", \"eip155:42161\", \"tron:728126428\"]);\n\nexport const CF_API_DEFAULT = \"https://chainflip-swap.chainflip.io\";\n\nconst sameToken = (chain: string, a: string, b: string) => (chain.startsWith(\"eip155:\") ? a.toLowerCase() === b.toLowerCase() : a === b);\nconst NATIVE = new Set([\"\", \"native\", \"0x0000000000000000000000000000000000000000\"]);\n\n/** The Chainflip asset for a CAIP-2 chain + token (contract / mint, a native marker, or the asset symbol). */\nexport function cfAsset(chain: string, token: string): CfAsset | undefined {\n const c = CF_CHAINS[chain];\n if (!c) return undefined;\n const on = CF_ASSETS.filter((a) => a.chain === c.name);\n if (NATIVE.has(token.toLowerCase())) return on.find((a) => a.token === null);\n return on.find((a) => (a.token !== null && sameToken(chain, a.token, token)) || a.asset === token.toUpperCase());\n}\n\nexport const chainflip = {\n supportsChain: (chain: string) => !!CF_CHAINS[chain],\n supports: (from: string, to: string) => CF_SOURCE_CHAINS.has(from) && !!CF_CHAINS[to] && from !== to,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,sBAA+B;;;AC+BxB,IAAM,YAAgC;AAAA,EAC3C,EAAC,OAAO,YAAY,OAAO,OAAO,IAAI,GAAG,UAAU,IAAI,OAAO,MAAM,YAAY,OAAO,IAAG;AAAA,EAC1F,EAAC,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,CAAC,OAAe,GAA8B,MAAc,CAAC,CAAC,MAAM,MAAM,WAAW,SAAS,IAAI,EAAE,YAAY,MAAM,EAAE,YAAY,IAAI,MAAM;AAG3J,IAAM,cAAgD,EAAC,mBAAmB,iBAAgB;AAEnF,SAAS,0BAA0B,IAAa,KAAmD;AACxG,QAAM,QAAQ,UAAU,YAAY,GAAG,KAAK,KAAK,GAAG,KAAK;AACzD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,UAAU,KAAK,GAAG,OAAQ,GAAqB,IAAI,KAAK,KAAK,GAAG,UAAU,KAAK,CAAC,MAAM,KAAK,GAAG,OAAO,EAAE,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,EAAE,IAAI,CAAC;AAC9I,MAAI,CAAC,QAAS,QAAO;AACrB,aAAO,kCAAiB,IAAI,KAAK,EAAC,UAAU,kBAAkB,UAAU,aAAa,MAAM,UAAU,cAAc,OAAO,UAAU,gBAAe,CAAC;AACtJ;","names":[]}
@@ -0,0 +1,12 @@
1
+ import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
2
+
3
+ /**
4
+ * Activity recognition for Chainflip vault swaps: the source leg is a call to (EVM) or a transfer into (Tron) the
5
+ * Chainflip Vault — a fixed, well-known counterparty, so the leg is recognizable offline. The destination leg is a
6
+ * transfer from Chainflip's egress keys (rotating), tied back through the intent journal.
7
+ */
8
+
9
+ declare const CHAINFLIP_MODULE = "@anywalletkit/protocol-swap2-chainflip";
10
+ declare function describeChainflipActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
11
+
12
+ export { CHAINFLIP_MODULE, describeChainflipActivity };
@@ -0,0 +1,12 @@
1
+ import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
2
+
3
+ /**
4
+ * Activity recognition for Chainflip vault swaps: the source leg is a call to (EVM) or a transfer into (Tron) the
5
+ * Chainflip Vault — a fixed, well-known counterparty, so the leg is recognizable offline. The destination leg is a
6
+ * transfer from Chainflip's egress keys (rotating), tied back through the intent journal.
7
+ */
8
+
9
+ declare const CHAINFLIP_MODULE = "@anywalletkit/protocol-swap2-chainflip";
10
+ declare function describeChainflipActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
11
+
12
+ export { CHAINFLIP_MODULE, describeChainflipActivity };
@@ -0,0 +1,10 @@
1
+ import {
2
+ CHAINFLIP_MODULE,
3
+ describeChainflipActivity
4
+ } from "./chunk-H6GJVVWS.js";
5
+ import "./chunk-GXHOO3CT.js";
6
+ export {
7
+ CHAINFLIP_MODULE,
8
+ describeChainflipActivity
9
+ };
10
+ //# sourceMappingURL=activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,54 @@
1
+ // src/config.ts
2
+ var CF_CHAINS = {
3
+ "eip155:1": { name: "Ethereum", id: 1, addrTag: 0 },
4
+ "bitcoin:mainnet": { name: "Bitcoin", id: 3, addrTag: 2 },
5
+ "eip155:42161": { name: "Arbitrum", id: 4, addrTag: 3 },
6
+ "solana:mainnet": { name: "Solana", id: 5, addrTag: 4 },
7
+ "tron:728126428": { name: "Tron", id: 7, addrTag: 6 }
8
+ };
9
+ var CF_ASSETS = [
10
+ { chain: "Ethereum", asset: "ETH", id: 1, decimals: 18, token: null, minDeposit: 10n ** 16n },
11
+ { chain: "Ethereum", asset: "USDC", id: 3, decimals: 6, token: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", minDeposit: 20000000n },
12
+ { chain: "Ethereum", asset: "USDT", id: 8, decimals: 6, token: "0xdAC17F958D2ee523a2206206994597C13D831ec7", minDeposit: 20000000n },
13
+ { chain: "Ethereum", asset: "WBTC", id: 14, decimals: 8, token: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", minDeposit: 40000n },
14
+ { chain: "Bitcoin", asset: "BTC", id: 5, decimals: 8, token: null, minDeposit: 40000n },
15
+ { chain: "Arbitrum", asset: "ETH", id: 6, decimals: 18, token: null, minDeposit: 3900000000000000n },
16
+ { chain: "Arbitrum", asset: "USDC", id: 7, decimals: 6, token: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", minDeposit: 10000000n },
17
+ { chain: "Arbitrum", asset: "USDT", id: 15, decimals: 6, token: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", minDeposit: 10000000n },
18
+ { chain: "Solana", asset: "SOL", id: 9, decimals: 9, token: null, minDeposit: 68000000n },
19
+ { chain: "Solana", asset: "USDC", id: 10, decimals: 6, token: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", minDeposit: 10000000n },
20
+ { chain: "Solana", asset: "USDT", id: 16, decimals: 6, token: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", minDeposit: 10000000n },
21
+ { chain: "Tron", asset: "TRX", id: 17, decimals: 6, token: null, minDeposit: 30000000n },
22
+ { chain: "Tron", asset: "USDT", id: 18, decimals: 6, token: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", minDeposit: 10000000n }
23
+ ];
24
+ var CF_VAULTS = {
25
+ "eip155:1": "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
26
+ "eip155:42161": "0x79001a5e762f3bEFC8e5871b42F6734e00498920",
27
+ "tron:728126428": "TEcDijvKSXcfWT7S6rd44H5vNgufm7Y4XC"
28
+ };
29
+ var CF_SOURCE_CHAINS = /* @__PURE__ */ new Set(["eip155:1", "eip155:42161", "tron:728126428"]);
30
+ var CF_API_DEFAULT = "https://chainflip-swap.chainflip.io";
31
+ var sameToken = (chain, a, b) => chain.startsWith("eip155:") ? a.toLowerCase() === b.toLowerCase() : a === b;
32
+ var NATIVE = /* @__PURE__ */ new Set(["", "native", "0x0000000000000000000000000000000000000000"]);
33
+ function cfAsset(chain, token) {
34
+ const c = CF_CHAINS[chain];
35
+ if (!c) return void 0;
36
+ const on = CF_ASSETS.filter((a) => a.chain === c.name);
37
+ if (NATIVE.has(token.toLowerCase())) return on.find((a) => a.token === null);
38
+ return on.find((a) => a.token !== null && sameToken(chain, a.token, token) || a.asset === token.toUpperCase());
39
+ }
40
+ var chainflip = {
41
+ supportsChain: (chain) => !!CF_CHAINS[chain],
42
+ supports: (from, to) => CF_SOURCE_CHAINS.has(from) && !!CF_CHAINS[to] && from !== to
43
+ };
44
+
45
+ export {
46
+ CF_CHAINS,
47
+ CF_ASSETS,
48
+ CF_VAULTS,
49
+ CF_SOURCE_CHAINS,
50
+ CF_API_DEFAULT,
51
+ cfAsset,
52
+ chainflip
53
+ };
54
+ //# sourceMappingURL=chunk-GXHOO3CT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config.ts"],"sourcesContent":["/**\n * Chainflip (JIT-AMM state chain) — chains, assets and contracts as the public backend and the vault encodings name them.\n * Asset ids, chain ids and decimals are the protocol's own (`cf_environment` / networkInfo, verified 2026-10-20); the\n * contract addresses are Chainflip's mainnet deployments (docs mainnet-addresses, confirmed by live encodings).\n *\n * Only VAULT SWAPS are offered: the donor signs a transaction whose every Chainflip parameter (destination, minimum price,\n * refund address) is decoded and checked locally before signing — no off-chain deposit channel to trust, and on Tron no\n * 3.4 USDT ingress fee. Sources: EVM (Ethereum, Arbitrum) and Tron in this release; Solana / Bitcoin vault swaps need an\n * instruction / OP_RETURN builder and come next. Destinations: every live chain.\n */\nexport type CfChain = \"Ethereum\" | \"Bitcoin\" | \"Arbitrum\" | \"Solana\" | \"Tron\";\n\nexport interface CfAsset {\n chain: CfChain;\n /** the API's asset symbol */\n asset: string;\n /** the u32 asset id inside vault encodings */\n id: number;\n decimals: number;\n /** token contract / mint on its chain, null for the native coin */\n token: string | null;\n /** smallest deposit the state chain accepts (base units) */\n minDeposit: bigint;\n}\n\n/**\n * CAIP-2 → Chainflip chain: `id` = the ForeignChain number an EVM vault call names (`dstChain`), `addrTag` = the\n * EncodedAddress variant a Tron note names (Eth 0, Dot 1, Btc 2, Arb 3, Sol 4, Hub 5, Tron 6) — two different enums.\n */\nexport const CF_CHAINS: Readonly<Record<string, {name: CfChain; id: number; addrTag: number}>> = {\n \"eip155:1\": {name: \"Ethereum\", id: 1, addrTag: 0},\n \"bitcoin:mainnet\": {name: \"Bitcoin\", id: 3, addrTag: 2},\n \"eip155:42161\": {name: \"Arbitrum\", id: 4, addrTag: 3},\n \"solana:mainnet\": {name: \"Solana\", id: 5, addrTag: 4},\n \"tron:728126428\": {name: \"Tron\", id: 7, addrTag: 6},\n};\n\nexport const CF_ASSETS: readonly CfAsset[] = [\n {chain: \"Ethereum\", asset: \"ETH\", id: 1, decimals: 18, token: null, minDeposit: 10n ** 16n},\n {chain: \"Ethereum\", asset: \"USDC\", id: 3, decimals: 6, token: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\", minDeposit: 20_000_000n},\n {chain: \"Ethereum\", asset: \"USDT\", id: 8, decimals: 6, token: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\", minDeposit: 20_000_000n},\n {chain: \"Ethereum\", asset: \"WBTC\", id: 14, decimals: 8, token: \"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599\", minDeposit: 40_000n},\n {chain: \"Bitcoin\", asset: \"BTC\", id: 5, decimals: 8, token: null, minDeposit: 40_000n},\n {chain: \"Arbitrum\", asset: \"ETH\", id: 6, decimals: 18, token: null, minDeposit: 3_900_000_000_000_000n},\n {chain: \"Arbitrum\", asset: \"USDC\", id: 7, decimals: 6, token: \"0xaf88d065e77c8cC2239327C5EDb3A432268e5831\", minDeposit: 10_000_000n},\n {chain: \"Arbitrum\", asset: \"USDT\", id: 15, decimals: 6, token: \"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9\", minDeposit: 10_000_000n},\n {chain: \"Solana\", asset: \"SOL\", id: 9, decimals: 9, token: null, minDeposit: 68_000_000n},\n {chain: \"Solana\", asset: \"USDC\", id: 10, decimals: 6, token: \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\", minDeposit: 10_000_000n},\n {chain: \"Solana\", asset: \"USDT\", id: 16, decimals: 6, token: \"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB\", minDeposit: 10_000_000n},\n {chain: \"Tron\", asset: \"TRX\", id: 17, decimals: 6, token: null, minDeposit: 30_000_000n},\n {chain: \"Tron\", asset: \"USDT\", id: 18, decimals: 6, token: \"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t\", minDeposit: 10_000_000n},\n];\n\n/** Vault contracts that receive vault swaps (the deposit transaction's target). */\nexport const CF_VAULTS: Readonly<Record<string, string>> = {\n \"eip155:1\": \"0xF5e10380213880111522dd0efD3dbb45b9f62Bcc\",\n \"eip155:42161\": \"0x79001a5e762f3bEFC8e5871b42F6734e00498920\",\n \"tron:728126428\": \"TEcDijvKSXcfWT7S6rd44H5vNgufm7Y4XC\",\n};\n\n/** Sources this release signs (vault swaps the engine can execute and the verifier can decode). */\nexport const CF_SOURCE_CHAINS = new Set([\"eip155:1\", \"eip155:42161\", \"tron:728126428\"]);\n\nexport const CF_API_DEFAULT = \"https://chainflip-swap.chainflip.io\";\n\nconst sameToken = (chain: string, a: string, b: string) => (chain.startsWith(\"eip155:\") ? a.toLowerCase() === b.toLowerCase() : a === b);\nconst NATIVE = new Set([\"\", \"native\", \"0x0000000000000000000000000000000000000000\"]);\n\n/** The Chainflip asset for a CAIP-2 chain + token (contract / mint, a native marker, or the asset symbol). */\nexport function cfAsset(chain: string, token: string): CfAsset | undefined {\n const c = CF_CHAINS[chain];\n if (!c) return undefined;\n const on = CF_ASSETS.filter((a) => a.chain === c.name);\n if (NATIVE.has(token.toLowerCase())) return on.find((a) => a.token === null);\n return on.find((a) => (a.token !== null && sameToken(chain, a.token, token)) || a.asset === token.toUpperCase());\n}\n\nexport const chainflip = {\n supportsChain: (chain: string) => !!CF_CHAINS[chain],\n supports: (from: string, to: string) => CF_SOURCE_CHAINS.has(from) && !!CF_CHAINS[to] && from !== to,\n};\n"],"mappings":";A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,EAAE,KAAK,SAAS;AACpG;","names":[]}
@@ -0,0 +1,22 @@
1
+ import {
2
+ CF_VAULTS
3
+ } from "./chunk-GXHOO3CT.js";
4
+
5
+ // src/activity.ts
6
+ import { describeSwapLike } from "@anywalletkit/protocol-swap2-core/activity";
7
+ var CHAINFLIP_MODULE = "@anywalletkit/protocol-swap2-chainflip";
8
+ var same = (chain, a, b) => !!a && (chain.startsWith("eip155:") ? a.toLowerCase() === b.toLowerCase() : a === b);
9
+ var CHAIN_ALIAS = { "tron:0x2b6653dc": "tron:728126428" };
10
+ function describeChainflipActivity(tx, ctx) {
11
+ const vault = CF_VAULTS[CHAIN_ALIAS[tx.chain] ?? tx.chain];
12
+ if (!vault) return null;
13
+ const toVault = same(tx.chain, tx.to, vault) || tx.transfers.some((t) => same(tx.chain, t.to, vault) && ctx.own.has(t.from));
14
+ if (!toVault) return null;
15
+ return describeSwapLike(tx, ctx, { protocol: CHAINFLIP_MODULE, subtitle: "Chainflip", kind: "bridge", counterparty: vault, inSuffix: "via Chainflip" });
16
+ }
17
+
18
+ export {
19
+ CHAINFLIP_MODULE,
20
+ describeChainflipActivity
21
+ };
22
+ //# sourceMappingURL=chunk-H6GJVVWS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/activity.ts"],"sourcesContent":["/**\n * Activity recognition for Chainflip vault swaps: the source leg is a call to (EVM) or a transfer into (Tron) the\n * Chainflip Vault — a fixed, well-known counterparty, so the leg is recognizable offline. The destination leg is a\n * transfer from Chainflip's egress keys (rotating), tied back through the intent journal.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {describeSwapLike} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {CF_VAULTS} from \"./config.js\";\n\nexport const CHAINFLIP_MODULE = \"@anywalletkit/protocol-swap2-chainflip\";\n\nconst same = (chain: string, a: string | null | undefined, b: string) => !!a && (chain.startsWith(\"eip155:\") ? a.toLowerCase() === b.toLowerCase() : a === b);\n\n/** Wallet history names Tron by its genesis-hash form (`tron:0x2b6653dc`); swap2 routes by chain id (`tron:728126428`). */\nconst CHAIN_ALIAS: Readonly<Record<string, string>> = {\"tron:0x2b6653dc\": \"tron:728126428\"};\n\nexport function describeChainflipActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n const vault = CF_VAULTS[CHAIN_ALIAS[tx.chain] ?? tx.chain];\n if (!vault) return null;\n const toVault = same(tx.chain, (tx as {to?: string}).to, vault) || tx.transfers.some((t) => same(tx.chain, t.to, vault) && ctx.own.has(t.from));\n if (!toVault) return null;\n return describeSwapLike(tx, ctx, {protocol: CHAINFLIP_MODULE, subtitle: \"Chainflip\", kind: \"bridge\", counterparty: vault, inSuffix: \"via Chainflip\"});\n}\n"],"mappings":";;;;;AAMA,SAAQ,wBAAuB;AAGxB,IAAM,mBAAmB;AAEhC,IAAM,OAAO,CAAC,OAAe,GAA8B,MAAc,CAAC,CAAC,MAAM,MAAM,WAAW,SAAS,IAAI,EAAE,YAAY,MAAM,EAAE,YAAY,IAAI,MAAM;AAG3J,IAAM,cAAgD,EAAC,mBAAmB,iBAAgB;AAEnF,SAAS,0BAA0B,IAAa,KAAmD;AACxG,QAAM,QAAQ,UAAU,YAAY,GAAG,KAAK,KAAK,GAAG,KAAK;AACzD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,UAAU,KAAK,GAAG,OAAQ,GAAqB,IAAI,KAAK,KAAK,GAAG,UAAU,KAAK,CAAC,MAAM,KAAK,GAAG,OAAO,EAAE,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,EAAE,IAAI,CAAC;AAC9I,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,iBAAiB,IAAI,KAAK,EAAC,UAAU,kBAAkB,UAAU,aAAa,MAAM,UAAU,cAAc,OAAO,UAAU,gBAAe,CAAC;AACtJ;","names":[]}