@anywalletkit/protocol-swap2-curve 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,119 @@
1
- # Temporary Holding Version
1
+ # @anywalletkit/protocol-swap2-curve
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
+ [![npm](https://img.shields.io/npm/v/@anywalletkit/protocol-swap2-curve?label=npm)](https://www.npmjs.com/package/@anywalletkit/protocol-swap2-curve)
4
+
5
+ [Curve](https://docs.curve.finance) same-chain swaps as a swap2 module, straight from the contracts: the router's own
6
+ `get_dy` quotes and its `exchange` executes, on the Router NG deployments in `src/deployments.ts`, over a curated pool
7
+ allowlist the package pins. No API on the money path, no key, no fee. Standalone through `CurveSwap2Protocol`, or as one
8
+ provider of the router.
9
+
10
+ Chains (18): Ethereum (router v1.2), Arbitrum, Base, OP Mainnet, Polygon, Gnosis, Avalanche, BNB Chain — the `[5][5]`
11
+ routers; Sonic, Unichain, HyperEVM, Mantle, Monad, Plasma, Robinhood Chain (v1.1.1), Ink, X Layer, Plume — the `[4][5]`
12
+ routers, which drive NG pools only. A chain is offered when it has a pinned router, allowlisted pools and an RPC: today
13
+ Ethereum, Arbitrum, Base, OP Mainnet, Gnosis, Monad, Plasma and X Layer (the generated allowlist has no pool that
14
+ passes the rules on the others; `module.json` lists only the chains offered).
15
+
16
+ ## Install
17
+
18
+ ```sh
19
+ npm install @anywalletkit/protocol-swap2-curve @anywalletkit/core
20
+ # or: pnpm add @anywalletkit/protocol-swap2-curve @anywalletkit/core · yarn add @anywalletkit/protocol-swap2-curve @anywalletkit/core
21
+ ```
22
+
23
+ On npm: [@anywalletkit/protocol-swap2-curve](https://www.npmjs.com/package/@anywalletkit/protocol-swap2-curve), published from the [release workflow](https://github.com/ultratestbro/anywalletkit/blob/main/RELEASING.md) with provenance.
24
+
25
+ ## Configure
26
+
27
+ ```ts
28
+ import { curveProvider } from '@anywalletkit/protocol-swap2-curve'
29
+
30
+ const curve = curveProvider({
31
+ rpcUrls: { 1: ['https://eth.example/rpc'], 42161: ['https://arb.example/rpc'] },
32
+ })
33
+ ```
34
+
35
+ | Option | Default | Meaning |
36
+ |---|---|---|
37
+ | `rpcUrls` | — | `{ chainId: [url…] }`, tried in order. Quotes, preflight and receipts. A chain without one is not offered. |
38
+ | `defaultSlippageBps` | auto | Used when the caller passes none. Default: swap2-core's `suggestSlippage` for the pair and the route's price impact (stable ↔ stable 10 bps, majors 50, others 100, plus half the impact). |
39
+ | `quoteTtlMs` | `180000` | The only expiry: Router NG has no deadline. Long enough for an approval to be mined on Ethereum. |
40
+ | `onWarning` | `console.warn` | Told when a chain's AddressProvider lists another router than the pinned one (never acted on). |
41
+ | `deployments`, `pools` | shipped tables | Overrides for tests. |
42
+
43
+ ## How a swap is built
44
+
45
+ - **Routes come only from the allowlist** (`src/pools/`, generated by `scripts/build-allowlist.mjs` from Curve's pool
46
+ lists, checked on-chain — coins by address, code hash, TVL and age thresholds — and reviewed in the diff; see
47
+ `scripts/README-allowlist.md`). One or two pools per route. A token the route hands the swap through between two
48
+ pools must be listed in the swap2-assets catalog on that chain (by address), or be the native coin or the pinned
49
+ wrapped native; the source and destination follow the engine's listed / unlisted policy, and a pool's other coins,
50
+ which the route does not touch, may be anything the allowlist admitted. `exchange_underlying` runs only on a
51
+ metapool whose base pool is in the allowlist too (never on a lending pool). The router's own pseudo-hops are added: swap_type 8 between the native coin and the
52
+ pinned wrapped native, and on Ethereum's v1.2 router swap_type 9 between crvUSD and scrvUSD (ERC-4626). Never type 9
53
+ on a v1.1 or `[4][5]` router, and `[4][5]` routers only drive pool types 10/20/30 (NG). Refused whatever a list
54
+ says: the registered fake-USDT pool, the four pools drained in 2023 (alETH, pETH, msETH, CRV/ETH), the Iron Bank
55
+ lending pool (cyDAI/cyUSDC/cyUSDT) and Polygon amWBTC/renBTC.
56
+ - **Quotes** are the router's `get_dy` for every candidate (at most 30, JSON-RPC batches of at most 10); the best
57
+ output wins. Price impact comes from a probe at 1/1000 of the amount on the same route.
58
+ - **Execution** is the explicit-receiver `exchange` — `0xc872a3c5` (`[5][5]`, zero `_pools`) or `0xfd44959c`
59
+ (`[4][5]`) — paying the recipient, with `min_dy` from the slippage (never 0; a caller's `minAmountOut` floor is
60
+ refused when the minimum is below it). A native input is sent as exactly that `value`; an ERC-20 input approves
61
+ exactly the input to the pinned router (the engine resets USDT to 0 first) and sends no value. The router call
62
+ carries no gas limit: the wallet estimates the exact call (with headroom) right before broadcast, after any approval
63
+ — a per-step formula ran some routes out of gas and overcharged where the limit is what is paid (Monad).
64
+ - **Before use**, once per chain, the router's runtime code hash and `version()` are checked against the pins. The
65
+ chain's AddressProvider is only compared (its id 2 may change at its admin's will) — a difference is a warning, the
66
+ pinned router is still used.
67
+ - **Right before broadcast** (`preflightDeposit`): the transaction is byte for byte the quoted call; the route passes
68
+ the same rules again; every hop pool's code and coins are re-read and must still be the pinned ones; and a fresh
69
+ `get_dy` of the exact route still pays at least the minimum. The router's code hash and version are not re-read
70
+ here: they are checked once per chain per process (above), and the router is immutable. Anything else refuses with
71
+ the reason.
72
+
73
+ Router NG approves each pool it meets for the maximum from its own balance; that touches only what is in transit
74
+ through the router, never the user's allowance, which is exact and spent in the same transaction. The router also
75
+ sweeps any dust it holds into the output (a few wei at most).
76
+
77
+ **Ethereum and MEV.** `min_dy` caps what a sandwich can take at the slippage; it does not stop one from taking up to
78
+ that. Keep the default (small) slippage on stable pairs and send Ethereum swaps through an MEV-protected RPC (a private
79
+ transaction relay) where the app can. Other chains in the list have sequencers or much less public-mempool exposure.
80
+
81
+ **The ERC-4626 hop.** For crvUSD → scrvUSD the router's `get_dy` uses `convertToShares`, which can sit a hair above
82
+ what `deposit` mints (2026-11-05: 2 × 10⁻⁸ on 1 000 crvUSD); the minimum covers it.
83
+
84
+ ## Behind `remoteProvider`
85
+
86
+ When the provider runs on your server, spread its pins into the app's stub:
87
+ `remoteProvider({name: "curve", baseUrl, ...curvePins})`. The engine then lets the EVM route call and approve only the
88
+ pinned Router NG, and `curveVerifyQuote` opens the router call on the device against the app's own request: the
89
+ explicit-receiver `exchange`, exactly the input, the destination token, the quote's minimum (never 0), paid to the
90
+ recipient, no zap pools, and a route through allowlisted pools only — synchronous, from the shipped tables. For the
91
+ build checked on chain as well, use `remoteProvider({name: "curve", baseUrl, ...curveRemotePins({rpcUrls})})`: over
92
+ the app's RPCs it checks the router (code hash and version, once per chain), each hop pool's code and coins, and a
93
+ fresh `get_dy` of the exact route ≥ the minimum. It then holds the backend's figures to that fresh `get_dy`, so the
94
+ minimum is the device's own: the quote's output may sit at most the slippage above it, and `min_dy` at most the
95
+ slippage below it (or below the quoted output, if lower). The slippage is the request's `slippageBps`; without one,
96
+ the `defaultSlippageBps` you pass (set it to the backend provider's, if it sets one); without that, the provider's auto
97
+ slippage re-derived on the device from a fresh 1/1000 probe, plus `CURVE_AUTO_SLIPPAGE_DRIFT_BPS` (5) for the impact
98
+ moving between quote and build. A backend that names `min_dy = 1` or an inflated output is refused at build time. Each
99
+ quote carries its own intent id (`curve:<chainId>:<nonce>`), so a build is checked against the request it answered.
100
+
101
+ ## Activity
102
+
103
+ `describeActivity(tx, ctx)` recognizes a call into the chain's pinned Router NG — and Ethereum's older v1.1
104
+ (`0x16C6…5353`) and v1.0 (`0xF0d4…8b8D`) routers, for history — with one of the family's `exchange` entry points
105
+ (`[5][5]`: `0x371dc447`, `0x5c9c18e2`, `0xc872a3c5`; `[4][5]`: `0xaad348a2`, `0xfd44959c`) as `swap`, "Swapped A → B"
106
+ from the owner's net transfers. Subtitle `Curve · <chain>`, counterparty = the router. When the receiver (the calldata's
107
+ `_receiver`, else the router's `Exchange` log) is not one of the owner's addresses, the subtitle ends in
108
+ `· paid to 0x…` and the receiver is the counterparty. `curveKnownContracts(chainId)` gives tx-preview its labels.
109
+
110
+ Fixtures (`fixtures/activity/`, public transactions captured with `scripts/capture-fixtures.mjs`, 2026-11-05): Ethereum
111
+ v1.2 CRV → crvUSD (`0x5c9c18e2`), Plasma `[4][5]` WXPL → XPL (`0xaad348a2`); negatives: a Uniswap SwapRouter02 swap, a
112
+ WETH9 deposit.
113
+
114
+ ## Live check
115
+
116
+ `node scripts/verify-live.mjs [chainId,…]` (after `pnpm build`): per chain the router's code hash, version, wrapped
117
+ native and ABI family against the pins, then up to three quotes from the allowlist, each simulated with `eth_call` as a
118
+ dummy wallet funded by a state override (balance and router allowance); the router's return must reach the minimum.
119
+ Read-only, nothing signed.
@@ -0,0 +1,196 @@
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
+ CURVE_MODULE: () => CURVE_MODULE,
24
+ describeCurveActivity: () => describeCurveActivity
25
+ });
26
+ module.exports = __toCommonJS(activity_exports);
27
+ var import_activity = require("@anywalletkit/protocol-swap2-core/activity");
28
+ var import_util = require("@anywalletkit/protocol-swap2-core/util");
29
+
30
+ // src/abi.ts
31
+ var import_viem = require("viem");
32
+
33
+ // src/deployments.ts
34
+ var CURVE_ETH = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
35
+ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
36
+ var SCRVUSD = "0x0655977FEb2f289A4aB78af67BAB0d17aAb84367";
37
+ var CRVUSD_ETHEREUM = "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E";
38
+ var AP = "0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98";
39
+ var R_OP_POLY_GNO_AVAX = "0x0DCDED3545D565bA3B19E683431381007245d983";
40
+ var R_UNI_HYPER = "0xd2002373543Ce3527023C75e7518C274A51ce712";
41
+ var R_MONAD_PLASMA_RH = "0xFF5Cb29241F002fFeD2eAa224e3e996D24A6E8d1";
42
+ var R_BASE_MANTLE = "0x4f37A9d177470499A2dD084621020b023fcffc1F";
43
+ var AP_UNI_HYPER = "0x1764ee18e8B3ccA4787249Ceb249356192594585";
44
+ var AP_MONAD_PLASMA_RH = "0x4574921eb950d3Fd5B01562162EC566Cb8bc3648";
45
+ var OP_WETH = "0x4200000000000000000000000000000000000006";
46
+ var d = (o) => Object.freeze({ eth: CURVE_ETH, ...o });
47
+ var CURVE_DEPLOYMENTS = Object.freeze({
48
+ // [5][5] routers. Ethereum runs v1.2 (the router Curve's UI, curve-js and the curve-router-ng README use; the only one
49
+ // with the ERC-4626 hop) — the AddressProvider still lists v1.1 there.
50
+ 1: d({ label: "Ethereum", family: "ng5", router: "0x45312ea0eFf7E09C83CBE249fa1d7598c4C8cd4e", version: "1.2.0", codeHash: "0xbe5f7301254e95d27c6aa1be0fedc0aa04d6c36097e089bc9d2cccaa9d26b164", weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", addressProvider: AP, addressProviderRouter: "0x16C6521Dff6baB339122a0FE25a9116693265353", erc4626: { vault: SCRVUSD, asset: CRVUSD_ETHEREUM } }),
51
+ 42161: d({ label: "Arbitrum", family: "ng5", router: "0x2191718CD32d02B8E60BAdFFeA33E4B5DD9A0A0D", version: "1.1.0", codeHash: "0x9b387b5dc8fe161c7af8e850a67662e93d7116b0e66ab6bc7761d5910093bcef", weth: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", addressProvider: AP, addressProviderRouter: "0x2191718CD32d02B8E60BAdFFeA33E4B5DD9A0A0D" }),
52
+ 8453: d({ label: "Base", family: "ng5", router: R_BASE_MANTLE, version: "1.1.0", codeHash: "0x3abb7fe467b6c925ab1b25771cf1c75cc507aec2f873a8d03ee95160c5a83579", weth: OP_WETH, addressProvider: AP, addressProviderRouter: R_BASE_MANTLE }),
53
+ 10: d({ label: "OP Mainnet", family: "ng5", router: R_OP_POLY_GNO_AVAX, version: "1.1.0", codeHash: "0x12ae037c1e9a21aeb6ba1b08863217de2babebbee58dbe8860a01ded6a974825", weth: OP_WETH, addressProvider: AP, addressProviderRouter: R_OP_POLY_GNO_AVAX }),
54
+ 137: d({ label: "Polygon", family: "ng5", router: R_OP_POLY_GNO_AVAX, version: "1.1.0", codeHash: "0x340f3ba3f30181c50e694f1a4da2f6ec670fc7eb0adce50d66a733f17ab150f4", weth: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", addressProvider: AP, addressProviderRouter: R_OP_POLY_GNO_AVAX }),
55
+ 100: d({ label: "Gnosis", family: "ng5", router: R_OP_POLY_GNO_AVAX, version: "1.1.0", codeHash: "0x38dc1cc456be010539e596d2ee0aa82c271316bdc6daaaffea7990a0c47176ee", weth: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d", addressProvider: AP, addressProviderRouter: R_OP_POLY_GNO_AVAX }),
56
+ 43114: d({ label: "Avalanche", family: "ng5", router: R_OP_POLY_GNO_AVAX, version: "1.1.0", codeHash: "0xf1f679ec6382cd9c0138870e320e6128193f75144501691e67dcd5831edaed2b", weth: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", addressProvider: AP, addressProviderRouter: R_OP_POLY_GNO_AVAX }),
57
+ 56: d({ label: "BNB Chain", family: "ng5", router: "0xA72C85C258A81761433B4e8da60505Fe3Dd551CC", version: "1.1.0", codeHash: "0x19db989a1cca08711ff68049326a5a7a8d1f64d87f356d35243150215c722120", weth: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", addressProvider: AP, addressProviderRouter: "0xA72C85C258A81761433B4e8da60505Fe3Dd551CC" }),
58
+ // [4][5] routers (curve-core, NG pools only, no swap_type 9).
59
+ 146: d({ label: "Sonic", family: "lite4", router: "0x5eeE3091f747E60a045a2E715a4c71e600e31F6E", version: "1.1.0", codeHash: "0xc5f238aee45c18efc927708fe57821cca4a84ec1bff4f22e778dfcd108411b99", weth: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38", addressProvider: "0x87FE17697D0f14A222e8bEf386a0860eCffDD617", addressProviderRouter: "0x5eeE3091f747E60a045a2E715a4c71e600e31F6E" }),
60
+ 130: d({ label: "Unichain", family: "lite4", router: R_UNI_HYPER, version: "1.1.0", codeHash: "0xe911928fab7efb72e10ee3a918dcdfb44ac5bae1c4d46eb5534bea0259d2594c", weth: OP_WETH, addressProvider: AP_UNI_HYPER, addressProviderRouter: R_UNI_HYPER }),
61
+ 999: d({ label: "HyperEVM", family: "lite4", router: R_UNI_HYPER, version: "1.1.0", codeHash: "0x1040124f623348643d919029ed513670cdb825bd0135f846ce9028329d8eb77d", weth: "0x5555555555555555555555555555555555555555", addressProvider: AP_UNI_HYPER, addressProviderRouter: R_UNI_HYPER }),
62
+ 5e3: d({ label: "Mantle", family: "lite4", router: R_BASE_MANTLE, version: "1.1.0", codeHash: "0xe76d585fb4163cd886c99f1c12361c5644e18b8dab2d86e3fe223307e7a16f29", weth: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8", addressProvider: AP, addressProviderRouter: R_BASE_MANTLE }),
63
+ 143: d({ label: "Monad", family: "lite4", router: R_MONAD_PLASMA_RH, version: "1.1.0", codeHash: "0x7668fc406894fb811ab7f9a1099f2e33ef8d80f58327e623bbe4c4d51e406f58", weth: "0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A", addressProvider: AP_MONAD_PLASMA_RH, addressProviderRouter: R_MONAD_PLASMA_RH }),
64
+ 9745: d({ label: "Plasma", family: "lite4", router: R_MONAD_PLASMA_RH, version: "1.1.0", codeHash: "0xeede894a379cb95c73ece834e836ff9bbaa1ff613fb7913d0cbc3a48b2897120", weth: "0x6100E367285b01F48D07953803A2d8dCA5D19873", addressProvider: AP_MONAD_PLASMA_RH, addressProviderRouter: R_MONAD_PLASMA_RH }),
65
+ // v1.1.1: ETH_ADDRESS is a constructor immutable — 0xEeee… here, read from the code tail with WETH_ADDRESS.
66
+ 4663: d({ label: "Robinhood Chain", family: "lite4", router: R_MONAD_PLASMA_RH, version: "1.1.1", codeHash: "0x716ad3720f54c96effe415598d3a62b9907e53c58c7e3d3004cba6cdb5c297a6", weth: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73", eth: CURVE_ETH, addressProvider: AP_MONAD_PLASMA_RH, addressProviderRouter: R_MONAD_PLASMA_RH }),
67
+ 57073: d({ label: "Ink", family: "lite4", router: "0xd7E72f3615aa65b92A4DBdC211E296a35512988B", version: "1.1.0", codeHash: "0x511c1733063263ba386b0e6b01b51d777deb02ea1b6e75fcde1e572e47f22436", weth: OP_WETH, addressProvider: "0x604388Bb1159AFd21eB5191cE22b4DeCdEE2Ae22", addressProviderRouter: "0xd7E72f3615aa65b92A4DBdC211E296a35512988B" }),
68
+ 196: d({ label: "X Layer", family: "lite4", router: "0xBFab8ebc836E1c4D81837798FC076D219C9a1855", version: "1.1.0", codeHash: "0xfc0a3b12868c10a8a46e33f17504f8751c83d3842f715c665c3d827bfc4ed625", weth: "0xe538905cf8410324e03A5A23C1c177a474D59b2b", addressProvider: AP, addressProviderRouter: "0xBFab8ebc836E1c4D81837798FC076D219C9a1855" }),
69
+ 98866: d({ label: "Plume", family: "lite4", router: "0x3F5A41B922a76759b9C77D36b3d337E88cD1dc5e", version: "1.1.0", codeHash: "0x0819b95039f1e0ac56aefffc8a727e996b3afa831fd3bb2047a3737bf23ab5e4", weth: "0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1", addressProvider: "0x907CE289E9Ee0BBcb0F69132B1C28A9Affc29FCA", addressProviderRouter: "0x3F5A41B922a76759b9C77D36b3d337E88cD1dc5e" })
70
+ });
71
+ var CURVE_LEGACY_ROUTERS = Object.freeze({
72
+ 1: Object.freeze([
73
+ { router: "0x16C6521Dff6baB339122a0FE25a9116693265353", version: "1.1.0", codeHash: "0xf041e5b17dc8b2c417a9561eb265145e442ab25b789d9bd3527c6b68a840577b" },
74
+ { router: "0xF0d4c12A5768D806021F80a262B4d39d26C58b8D", version: "1.0.0", codeHash: "0xdfc206a29f04b4cee5b7b8d5b60ffcd2574fc9ff17cc5ec00c58b17013ea3f3b" }
75
+ ])
76
+ });
77
+ var CURVE_DENIED_POOLS = Object.freeze({
78
+ 1: /* @__PURE__ */ new Set([
79
+ "0xa6d9f4f3a67b35e81dfa560b0fcde9b0751f1f53",
80
+ "0xc4c319e2d4d66cca4464c0c2b32c9bd23ebe784e",
81
+ "0x9848482da3ee3076165ce6497eda906e66bb85c5",
82
+ "0xc897b98272aa23714464ea2a0bd5180f1b8c0025",
83
+ "0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511",
84
+ "0x2dded6da1bf5dbdf597c45fcfaa3194e53ecfeaf"
85
+ ]),
86
+ 137: /* @__PURE__ */ new Set([
87
+ "0xc2d95eef97ec6c17551d45e77b590dc1f9117c67"
88
+ ])
89
+ });
90
+ function deploymentOf(table, chainId) {
91
+ return Object.prototype.hasOwnProperty.call(table, chainId) ? table[chainId] : void 0;
92
+ }
93
+
94
+ // src/abi.ts
95
+ var ROUTER_NG5_ABI = (0, import_viem.parseAbi)([
96
+ "function exchange(address[11] _route, uint256[5][5] _swap_params, uint256 _amount, uint256 _min_dy) payable returns (uint256)",
97
+ "function exchange(address[11] _route, uint256[5][5] _swap_params, uint256 _amount, uint256 _min_dy, address[5] _pools) payable returns (uint256)",
98
+ "function exchange(address[11] _route, uint256[5][5] _swap_params, uint256 _amount, uint256 _min_dy, address[5] _pools, address _receiver) payable returns (uint256)",
99
+ "function get_dy(address[11] _route, uint256[5][5] _swap_params, uint256 _amount) view returns (uint256)",
100
+ "function version() view returns (string)"
101
+ ]);
102
+ var ROUTER_LITE4_ABI = (0, import_viem.parseAbi)([
103
+ "function exchange(address[11] _route, uint256[4][5] _swap_params, uint256 _amount, uint256 _min_dy) payable returns (uint256)",
104
+ "function exchange(address[11] _route, uint256[4][5] _swap_params, uint256 _amount, uint256 _min_dy, address _receiver) payable returns (uint256)",
105
+ "function get_dy(address[11] _route, uint256[4][5] _swap_params, uint256 _amount) view returns (uint256)",
106
+ "function version() view returns (string)"
107
+ ]);
108
+ var VERSION_ABI = (0, import_viem.parseAbi)(["function version() view returns (string)"]);
109
+ var ADDRESS_PROVIDER_ABI = (0, import_viem.parseAbi)(["function get_address(uint256 _id) view returns (address)"]);
110
+ var EXCHANGE_SELECTOR = Object.freeze({ ng5: "0xc872a3c5", lite4: "0xfd44959c" });
111
+ var GET_DY_SELECTOR = Object.freeze({ ng5: "0x81889a2c", lite4: "0x11e21386" });
112
+ var ROUTER_SELECTORS = Object.freeze({
113
+ ng5: /* @__PURE__ */ new Set(["0x371dc447", "0x5c9c18e2", "0xc872a3c5"]),
114
+ lite4: /* @__PURE__ */ new Set(["0xaad348a2", "0xfd44959c"])
115
+ });
116
+ var EXCHANGE_TOPIC = Object.freeze({
117
+ ng5: "0x56d0661e240dfb199ef196e16e6f42473990366314f0226ac978f7be3cd9ee83",
118
+ lite4: "0x6324485a21bc5138ec352d4949d0adc75d8e1382a687e1aa1ce6863f40c9e463"
119
+ });
120
+ var ZERO_POOLS = Object.freeze([ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS]);
121
+ function decodeExchange(family, data) {
122
+ if (!/^0x[0-9a-fA-F]*$/.test(data) || data.length < 10) return null;
123
+ const selector = data.slice(0, 10).toLowerCase();
124
+ if (!ROUTER_SELECTORS[family].has(selector)) return null;
125
+ try {
126
+ if (family === "ng5") {
127
+ const c2 = (0, import_viem.decodeFunctionData)({ abi: ROUTER_NG5_ABI, data });
128
+ if (c2.functionName !== "exchange") return null;
129
+ const a2 = c2.args;
130
+ return {
131
+ selector,
132
+ route: a2[0],
133
+ params: a2[1],
134
+ amount: a2[2],
135
+ minDy: a2[3],
136
+ pools: a2.length >= 5 ? a2[4] : null,
137
+ receiver: a2.length >= 6 ? a2[5] : null
138
+ };
139
+ }
140
+ const c = (0, import_viem.decodeFunctionData)({ abi: ROUTER_LITE4_ABI, data });
141
+ if (c.functionName !== "exchange") return null;
142
+ const a = c.args;
143
+ return {
144
+ selector,
145
+ route: a[0],
146
+ params: a[1],
147
+ amount: a[2],
148
+ minDy: a[3],
149
+ pools: null,
150
+ receiver: a.length >= 5 ? a[4] : null
151
+ };
152
+ } catch {
153
+ return null;
154
+ }
155
+ }
156
+
157
+ // src/activity.ts
158
+ var CURVE_MODULE = "@anywalletkit/protocol-swap2-curve";
159
+ function familyOf(deployments, chainId, to) {
160
+ const d2 = deploymentOf(deployments, chainId);
161
+ if (d2 && d2.router.toLowerCase() === to) return d2.family;
162
+ const legacy = Object.prototype.hasOwnProperty.call(CURVE_LEGACY_ROUTERS, chainId) ? CURVE_LEGACY_ROUTERS[chainId] : [];
163
+ return legacy.some((r) => r.router.toLowerCase() === to) ? "ng5" : null;
164
+ }
165
+ function receiverOf(tx, family) {
166
+ const data = tx.call?.data;
167
+ if (data) {
168
+ const call = decodeExchange(family, data);
169
+ if (call?.receiver) return call.receiver.toLowerCase();
170
+ if (call) return tx.from.toLowerCase();
171
+ }
172
+ const logs = tx.raw?.logs ?? tx.raw?.receipt?.logs;
173
+ if (Array.isArray(logs)) {
174
+ const to = (0, import_activity.calledContract)(tx);
175
+ for (const l of logs) {
176
+ if (l?.address?.toLowerCase() !== to || l.topics?.[0]?.toLowerCase() !== EXCHANGE_TOPIC[family]) continue;
177
+ const t = l.topics[2];
178
+ if (typeof t === "string" && /^0x[0-9a-fA-F]{64}$/.test(t)) return `0x${t.slice(-40)}`.toLowerCase();
179
+ }
180
+ }
181
+ return tx.from.toLowerCase();
182
+ }
183
+ function describeCurveActivity(tx, ctx, deployments = CURVE_DEPLOYMENTS) {
184
+ if (!(0, import_util.isEvm)(tx.chain)) return null;
185
+ const to = (0, import_activity.calledContract)(tx);
186
+ if (!to) return null;
187
+ const family = familyOf(deployments, (0, import_util.evmRef)(tx.chain), to);
188
+ if (!family) return null;
189
+ const sel = tx.call?.selector?.toLowerCase() ?? tx.call?.data?.slice(0, 10).toLowerCase();
190
+ if (!sel || !ROUTER_SELECTORS[family].has(sel)) return null;
191
+ const receiver = receiverOf(tx, family);
192
+ const ownReceiver = ctx.own.has(receiver) || [...ctx.own].some((a) => a.toLowerCase() === receiver);
193
+ const subtitle = `Curve \xB7 ${(0, import_activity.chainLabel)(tx.chain)}${ownReceiver ? "" : ` \xB7 paid to ${(0, import_activity.shortAddress)(receiver)}`}`;
194
+ return (0, import_activity.describeSwapLike)(tx, ctx, { protocol: CURVE_MODULE, subtitle, kind: "swap", ...ownReceiver ? {} : { counterparty: receiver } });
195
+ }
196
+ //# sourceMappingURL=activity.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/activity.ts","../src/abi.ts","../src/deployments.ts"],"sourcesContent":["/**\n * Activity recognition for Curve: a call into the chain's pinned Router NG — or, on Ethereum, the older v1.1 / v1.0\n * routers (history only) — with one of the family's `exchange` entry points → `swap`, \"Swapped A → B\" from the owner's\n * net transfers. A swap whose receiver is not one of the owner's addresses (an explicit `_receiver`, read from the\n * calldata or the router's `Exchange` log) says so in the subtitle and names that receiver as the counterparty.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {calledContract, chainLabel, describeSwapLike, shortAddress} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {evmRef, isEvm} from \"@anywalletkit/protocol-swap2-core/util\";\nimport {EXCHANGE_TOPIC, ROUTER_SELECTORS, decodeExchange} from \"./abi.js\";\nimport {CURVE_DEPLOYMENTS, CURVE_LEGACY_ROUTERS, deploymentOf, type CurveDeployment, type CurveRouterFamily} from \"./deployments.js\";\n\nexport const CURVE_MODULE = \"@anywalletkit/protocol-swap2-curve\";\n\n/** The router family `to` speaks on `chainId`, when it is a router this module knows there. */\nfunction familyOf(deployments: Readonly<Record<number, CurveDeployment>>, chainId: number, to: string): CurveRouterFamily | null {\n const d = deploymentOf(deployments, chainId);\n if (d && d.router.toLowerCase() === to) return d.family;\n const legacy = Object.prototype.hasOwnProperty.call(CURVE_LEGACY_ROUTERS, chainId) ? CURVE_LEGACY_ROUTERS[chainId]! : [];\n return legacy.some((r) => r.router.toLowerCase() === to) ? \"ng5\" : null;\n}\n\n/** Who the swap paid: the calldata's `_receiver`, else the router's `Exchange` log (topic 2), else the sender. */\nfunction receiverOf(tx: ChainTx, family: CurveRouterFamily): string {\n const data = tx.call?.data;\n if (data) {\n const call = decodeExchange(family, data);\n if (call?.receiver) return call.receiver.toLowerCase();\n if (call) return tx.from.toLowerCase();\n }\n const logs = (tx.raw as {logs?: unknown} | undefined)?.logs ?? (tx.raw as {receipt?: {logs?: unknown}} | undefined)?.receipt?.logs;\n if (Array.isArray(logs)) {\n const to = calledContract(tx);\n for (const l of logs as {address?: string; topics?: string[]}[]) {\n if (l?.address?.toLowerCase() !== to || l.topics?.[0]?.toLowerCase() !== EXCHANGE_TOPIC[family]) continue;\n const t = l.topics[2];\n if (typeof t === \"string\" && /^0x[0-9a-fA-F]{64}$/.test(t)) return `0x${t.slice(-40)}`.toLowerCase();\n }\n }\n return tx.from.toLowerCase();\n}\n\nexport function describeCurveActivity(\n tx: ChainTx,\n ctx: DescribeActivityContext,\n deployments: Readonly<Record<number, CurveDeployment>> = CURVE_DEPLOYMENTS,\n): ActivityItem | null {\n if (!isEvm(tx.chain)) return null;\n const to = calledContract(tx);\n if (!to) return null;\n const family = familyOf(deployments, evmRef(tx.chain), to);\n if (!family) return null;\n const sel = tx.call?.selector?.toLowerCase() ?? tx.call?.data?.slice(0, 10).toLowerCase();\n if (!sel || !ROUTER_SELECTORS[family].has(sel)) return null;\n const receiver = receiverOf(tx, family);\n const ownReceiver = ctx.own.has(receiver) || [...ctx.own].some((a) => a.toLowerCase() === receiver);\n const subtitle = `Curve · ${chainLabel(tx.chain)}${ownReceiver ? \"\" : ` · paid to ${shortAddress(receiver)}`}`;\n return describeSwapLike(tx, ctx, {protocol: CURVE_MODULE, subtitle, kind: \"swap\", ...(ownReceiver ? {} : {counterparty: receiver})});\n}\n","import {decodeFunctionData, encodeFunctionData, parseAbi} from \"viem\";\nimport type {CurveRouterFamily} from \"./deployments.js\";\nimport {ZERO_ADDRESS} from \"./deployments.js\";\nimport type {Hex} from \"./pools/types.js\";\n\n/**\n * Router NG entry points, both ABI families (selectors with `viem toFunctionSelector`, checked against every pinned\n * router's code 2026-11-05). This module writes only the explicit-receiver `exchange` of each family and reads\n * `get_dy`; the other forms are listed for history recognition.\n */\nexport const ROUTER_NG5_ABI = parseAbi([\n \"function exchange(address[11] _route, uint256[5][5] _swap_params, uint256 _amount, uint256 _min_dy) payable returns (uint256)\",\n \"function exchange(address[11] _route, uint256[5][5] _swap_params, uint256 _amount, uint256 _min_dy, address[5] _pools) payable returns (uint256)\",\n \"function exchange(address[11] _route, uint256[5][5] _swap_params, uint256 _amount, uint256 _min_dy, address[5] _pools, address _receiver) payable returns (uint256)\",\n \"function get_dy(address[11] _route, uint256[5][5] _swap_params, uint256 _amount) view returns (uint256)\",\n \"function version() view returns (string)\",\n]);\nexport const ROUTER_LITE4_ABI = parseAbi([\n \"function exchange(address[11] _route, uint256[4][5] _swap_params, uint256 _amount, uint256 _min_dy) payable returns (uint256)\",\n \"function exchange(address[11] _route, uint256[4][5] _swap_params, uint256 _amount, uint256 _min_dy, address _receiver) payable returns (uint256)\",\n \"function get_dy(address[11] _route, uint256[4][5] _swap_params, uint256 _amount) view returns (uint256)\",\n \"function version() view returns (string)\",\n]);\nexport const VERSION_ABI = parseAbi([\"function version() view returns (string)\"]);\n/** `coins(uint256)` (every NG pool and most plain ones) and `coins(int128)` (the oldest stable pools). */\nexport const COINS_UINT: Hex = \"0xc6610657\";\nexport const COINS_INT: Hex = \"0x23746eb8\";\nexport const ADDRESS_PROVIDER_ABI = parseAbi([\"function get_address(uint256 _id) view returns (address)\"]);\n\n/** The `exchange` this module builds: with an explicit receiver. */\nexport const EXCHANGE_SELECTOR: Readonly<Record<CurveRouterFamily, Hex>> = Object.freeze({ng5: \"0xc872a3c5\", lite4: \"0xfd44959c\"});\nexport const GET_DY_SELECTOR: Readonly<Record<CurveRouterFamily, Hex>> = Object.freeze({ng5: \"0x81889a2c\", lite4: \"0x11e21386\"});\n/** Every swap entry point per family, for history: `[5][5]` 4-, 5- and 6-argument forms; `[4][5]` 4- and 5-argument. */\nexport const ROUTER_SELECTORS: Readonly<Record<CurveRouterFamily, ReadonlySet<string>>> = Object.freeze({\n ng5: new Set([\"0x371dc447\", \"0x5c9c18e2\", \"0xc872a3c5\"]),\n lite4: new Set([\"0xaad348a2\", \"0xfd44959c\"]),\n});\n/** topic0 of the router's `Exchange` event per family (`[5][5]` logs `pools` too). */\nexport const EXCHANGE_TOPIC: Readonly<Record<CurveRouterFamily, Hex>> = Object.freeze({\n ng5: \"0x56d0661e240dfb199ef196e16e6f42473990366314f0226ac978f7be3cd9ee83\",\n lite4: \"0x6324485a21bc5138ec352d4949d0adc75d8e1382a687e1aa1ce6863f40c9e463\",\n});\n\n/** A route as the router takes it: 11 addresses and one swap-params row per step (5 rows; 5 or 4 columns). */\nexport interface RouterArgs {\n route: readonly Hex[];\n params: readonly (readonly bigint[])[];\n}\n\n/** One router call, decoded. `receiver` is null when the call names none (the router then pays `msg.sender`). */\nexport interface DecodedExchange extends RouterArgs {\n amount: bigint;\n minDy: bigint;\n pools: readonly Hex[] | null;\n receiver: Hex | null;\n selector: Hex;\n}\n\nconst ZERO_POOLS: readonly Hex[] = Object.freeze([ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS]);\ntype Row5 = readonly [bigint, bigint, bigint, bigint, bigint];\ntype Row4 = readonly [bigint, bigint, bigint, bigint];\nconst tuple11 = (a: readonly Hex[]) => a as unknown as readonly [Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex, Hex];\nconst rows5 = (p: readonly (readonly bigint[])[]) => p as unknown as readonly [Row5, Row5, Row5, Row5, Row5];\nconst rows4 = (p: readonly (readonly bigint[])[]) => p as unknown as readonly [Row4, Row4, Row4, Row4, Row4];\nconst pools5 = (a: readonly Hex[]) => a as unknown as readonly [Hex, Hex, Hex, Hex, Hex];\n\nfunction checkShape(family: CurveRouterFamily, args: RouterArgs): void {\n const cols = family === \"ng5\" ? 5 : 4;\n if (args.route.length !== 11 || args.params.length !== 5 || args.params.some((r) => r.length !== cols)) {\n throw new Error(`curve: a ${family} route is address[11] and uint256[${cols}][5]`);\n }\n}\n\n/** `exchange(route, params, amount, minDy, [zero pools,] receiver)` for the router family. */\nexport function encodeExchange(family: CurveRouterFamily, args: RouterArgs, amount: bigint, minDy: bigint, receiver: Hex): Hex {\n checkShape(family, args);\n return family === \"ng5\"\n ? encodeFunctionData({abi: ROUTER_NG5_ABI, functionName: \"exchange\", args: [tuple11(args.route), rows5(args.params), amount, minDy, pools5(ZERO_POOLS), receiver]})\n : encodeFunctionData({abi: ROUTER_LITE4_ABI, functionName: \"exchange\", args: [tuple11(args.route), rows4(args.params), amount, minDy, receiver]});\n}\n\n/** `get_dy(route, params, amount)` for the router family. */\nexport function encodeGetDy(family: CurveRouterFamily, args: RouterArgs, amount: bigint): Hex {\n checkShape(family, args);\n return family === \"ng5\"\n ? encodeFunctionData({abi: ROUTER_NG5_ABI, functionName: \"get_dy\", args: [tuple11(args.route), rows5(args.params), amount]})\n : encodeFunctionData({abi: ROUTER_LITE4_ABI, functionName: \"get_dy\", args: [tuple11(args.route), rows4(args.params), amount]});\n}\n\n/** Any of the family's `exchange` forms, decoded; null for anything else (another selector, malformed data). */\nexport function decodeExchange(family: CurveRouterFamily, data: string): DecodedExchange | null {\n if (!/^0x[0-9a-fA-F]*$/.test(data) || data.length < 10) return null;\n const selector = data.slice(0, 10).toLowerCase() as Hex;\n if (!ROUTER_SELECTORS[family].has(selector)) return null;\n try {\n if (family === \"ng5\") {\n const c = decodeFunctionData({abi: ROUTER_NG5_ABI, data: data as Hex});\n if (c.functionName !== \"exchange\") return null;\n const a = c.args as readonly unknown[];\n return {\n selector,\n route: a[0] as readonly Hex[],\n params: a[1] as readonly (readonly bigint[])[],\n amount: a[2] as bigint,\n minDy: a[3] as bigint,\n pools: a.length >= 5 ? (a[4] as readonly Hex[]) : null,\n receiver: a.length >= 6 ? (a[5] as Hex) : null,\n };\n }\n const c = decodeFunctionData({abi: ROUTER_LITE4_ABI, data: data as Hex});\n if (c.functionName !== \"exchange\") return null;\n const a = c.args as readonly unknown[];\n return {\n selector,\n route: a[0] as readonly Hex[],\n params: a[1] as readonly (readonly bigint[])[],\n amount: a[2] as bigint,\n minDy: a[3] as bigint,\n pools: null,\n receiver: a.length >= 5 ? (a[4] as Hex) : null,\n };\n } catch {\n return null;\n }\n}\n","import type {Hex} from \"./pools/types.js\";\n\n/**\n * Curve Router NG deployments this module trusts, one per chain, keyed by chain id (the same address means a different\n * contract on another chain: `0x4f37…fc1F` is a `[5][5]` router on Base and a `[4][5]` one on Mantle). Every entry was\n * read on-chain on 2026-11-05: the runtime code's keccak (the router has no owner and no proxy; its immutables — the\n * wrapped native, and on `[5][5]` routers the two calc zaps — are inside the code, so the hash pins them too),\n * `version()`, the wrapped native read from the code's immutable tail, and what the chain's AddressProvider lists as\n * id 2. The provider re-checks the code hash and the version once per chain before quoting (`verifyDeployment`).\n *\n * The router address is never resolved at runtime: the AddressProvider is an informational registry its admin (an\n * individual, not the DAO) can change at any time, so its id 2 is only compared and a difference only warned about.\n */\n\n/** ABI family of a router: `ng5` = `uint256[5][5]` swap params `[i, j, swap_type, pool_type, n_coins]` plus a\n * `_pools[5]` argument (curve-router-ng `Router.vy`); `lite4` = `uint256[4][5]` `[i, j, swap_type, pool_type]`, no\n * `_pools` (curve-core `router_v_110.vy` / `router_v_111.vy`, NG pools only). */\nexport type CurveRouterFamily = \"ng5\" | \"lite4\";\n\nexport interface CurveDeployment {\n /** Human label for logs and subtitles. */\n label: string;\n family: CurveRouterFamily;\n router: Hex;\n /** `version()` as the router reports it. */\n version: \"1.2.0\" | \"1.1.0\" | \"1.1.1\";\n /** keccak256 of the router's runtime code. */\n codeHash: Hex;\n /** The wrapped native the router's swap_type 8 hop wraps / unwraps (its `WETH_ADDRESS` immutable). */\n weth: Hex;\n /** The router's native sentinel (`ETH_ADDRESS`; a constructor immutable on v1.1.1). */\n eth: Hex;\n /** The chain's Curve AddressProvider (watch signal only) and the address its id 2 listed when pinned. */\n addressProvider: Hex;\n addressProviderRouter: Hex;\n /** ERC-4626 pseudo-hop (swap_type 9) the router may use — only on router v1.2 (Ethereum: crvUSD ↔ scrvUSD). */\n erc4626?: {vault: Hex; asset: Hex};\n}\n\n/** The native sentinel every pinned router uses (checked against the v1.1.1 routers' immutable). */\nexport const CURVE_ETH: Hex = \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\";\nexport const ZERO_ADDRESS: Hex = \"0x0000000000000000000000000000000000000000\";\n/** Most pool hops one route crosses (pseudo-hops — wrap, ERC-4626 — come on top). */\nexport const MAX_ROUTE_POOLS = 2;\n/** Most router steps one route may have: two pools, a wrap in front and an unwrap or an ERC-4626 hop behind. */\nexport const MAX_ROUTE_STEPS = 4;\n\n/** Savings crvUSD (Yearn V3 vault, ERC-4626 over crvUSD) on Ethereum, and crvUSD itself. */\nexport const SCRVUSD: Hex = \"0x0655977FEb2f289A4aB78af67BAB0d17aAb84367\";\nexport const CRVUSD_ETHEREUM: Hex = \"0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E\";\n\nconst AP: Hex = \"0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98\";\nconst R_OP_POLY_GNO_AVAX: Hex = \"0x0DCDED3545D565bA3B19E683431381007245d983\";\nconst R_UNI_HYPER: Hex = \"0xd2002373543Ce3527023C75e7518C274A51ce712\";\nconst R_MONAD_PLASMA_RH: Hex = \"0xFF5Cb29241F002fFeD2eAa224e3e996D24A6E8d1\";\nconst R_BASE_MANTLE: Hex = \"0x4f37A9d177470499A2dD084621020b023fcffc1F\";\nconst AP_UNI_HYPER: Hex = \"0x1764ee18e8B3ccA4787249Ceb249356192594585\";\nconst AP_MONAD_PLASMA_RH: Hex = \"0x4574921eb950d3Fd5B01562162EC566Cb8bc3648\";\nconst OP_WETH: Hex = \"0x4200000000000000000000000000000000000006\";\n\nconst d = (o: Omit<CurveDeployment, \"eth\"> & {eth?: Hex}): CurveDeployment => Object.freeze({eth: CURVE_ETH, ...o});\n\nexport const CURVE_DEPLOYMENTS: Readonly<Record<number, CurveDeployment>> = Object.freeze({\n // [5][5] routers. Ethereum runs v1.2 (the router Curve's UI, curve-js and the curve-router-ng README use; the only one\n // with the ERC-4626 hop) — the AddressProvider still lists v1.1 there.\n 1: d({label: \"Ethereum\", family: \"ng5\", router: \"0x45312ea0eFf7E09C83CBE249fa1d7598c4C8cd4e\", version: \"1.2.0\", codeHash: \"0xbe5f7301254e95d27c6aa1be0fedc0aa04d6c36097e089bc9d2cccaa9d26b164\", weth: \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\", addressProvider: AP, addressProviderRouter: \"0x16C6521Dff6baB339122a0FE25a9116693265353\", erc4626: {vault: SCRVUSD, asset: CRVUSD_ETHEREUM}}),\n 42161: d({label: \"Arbitrum\", family: \"ng5\", router: \"0x2191718CD32d02B8E60BAdFFeA33E4B5DD9A0A0D\", version: \"1.1.0\", codeHash: \"0x9b387b5dc8fe161c7af8e850a67662e93d7116b0e66ab6bc7761d5910093bcef\", weth: \"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\", addressProvider: AP, addressProviderRouter: \"0x2191718CD32d02B8E60BAdFFeA33E4B5DD9A0A0D\"}),\n 8453: d({label: \"Base\", family: \"ng5\", router: R_BASE_MANTLE, version: \"1.1.0\", codeHash: \"0x3abb7fe467b6c925ab1b25771cf1c75cc507aec2f873a8d03ee95160c5a83579\", weth: OP_WETH, addressProvider: AP, addressProviderRouter: R_BASE_MANTLE}),\n 10: d({label: \"OP Mainnet\", family: \"ng5\", router: R_OP_POLY_GNO_AVAX, version: \"1.1.0\", codeHash: \"0x12ae037c1e9a21aeb6ba1b08863217de2babebbee58dbe8860a01ded6a974825\", weth: OP_WETH, addressProvider: AP, addressProviderRouter: R_OP_POLY_GNO_AVAX}),\n 137: d({label: \"Polygon\", family: \"ng5\", router: R_OP_POLY_GNO_AVAX, version: \"1.1.0\", codeHash: \"0x340f3ba3f30181c50e694f1a4da2f6ec670fc7eb0adce50d66a733f17ab150f4\", weth: \"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270\", addressProvider: AP, addressProviderRouter: R_OP_POLY_GNO_AVAX}),\n 100: d({label: \"Gnosis\", family: \"ng5\", router: R_OP_POLY_GNO_AVAX, version: \"1.1.0\", codeHash: \"0x38dc1cc456be010539e596d2ee0aa82c271316bdc6daaaffea7990a0c47176ee\", weth: \"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d\", addressProvider: AP, addressProviderRouter: R_OP_POLY_GNO_AVAX}),\n 43114: d({label: \"Avalanche\", family: \"ng5\", router: R_OP_POLY_GNO_AVAX, version: \"1.1.0\", codeHash: \"0xf1f679ec6382cd9c0138870e320e6128193f75144501691e67dcd5831edaed2b\", weth: \"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7\", addressProvider: AP, addressProviderRouter: R_OP_POLY_GNO_AVAX}),\n 56: d({label: \"BNB Chain\", family: \"ng5\", router: \"0xA72C85C258A81761433B4e8da60505Fe3Dd551CC\", version: \"1.1.0\", codeHash: \"0x19db989a1cca08711ff68049326a5a7a8d1f64d87f356d35243150215c722120\", weth: \"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c\", addressProvider: AP, addressProviderRouter: \"0xA72C85C258A81761433B4e8da60505Fe3Dd551CC\"}),\n // [4][5] routers (curve-core, NG pools only, no swap_type 9).\n 146: d({label: \"Sonic\", family: \"lite4\", router: \"0x5eeE3091f747E60a045a2E715a4c71e600e31F6E\", version: \"1.1.0\", codeHash: \"0xc5f238aee45c18efc927708fe57821cca4a84ec1bff4f22e778dfcd108411b99\", weth: \"0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38\", addressProvider: \"0x87FE17697D0f14A222e8bEf386a0860eCffDD617\", addressProviderRouter: \"0x5eeE3091f747E60a045a2E715a4c71e600e31F6E\"}),\n 130: d({label: \"Unichain\", family: \"lite4\", router: R_UNI_HYPER, version: \"1.1.0\", codeHash: \"0xe911928fab7efb72e10ee3a918dcdfb44ac5bae1c4d46eb5534bea0259d2594c\", weth: OP_WETH, addressProvider: AP_UNI_HYPER, addressProviderRouter: R_UNI_HYPER}),\n 999: d({label: \"HyperEVM\", family: \"lite4\", router: R_UNI_HYPER, version: \"1.1.0\", codeHash: \"0x1040124f623348643d919029ed513670cdb825bd0135f846ce9028329d8eb77d\", weth: \"0x5555555555555555555555555555555555555555\", addressProvider: AP_UNI_HYPER, addressProviderRouter: R_UNI_HYPER}),\n 5000: d({label: \"Mantle\", family: \"lite4\", router: R_BASE_MANTLE, version: \"1.1.0\", codeHash: \"0xe76d585fb4163cd886c99f1c12361c5644e18b8dab2d86e3fe223307e7a16f29\", weth: \"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8\", addressProvider: AP, addressProviderRouter: R_BASE_MANTLE}),\n 143: d({label: \"Monad\", family: \"lite4\", router: R_MONAD_PLASMA_RH, version: \"1.1.0\", codeHash: \"0x7668fc406894fb811ab7f9a1099f2e33ef8d80f58327e623bbe4c4d51e406f58\", weth: \"0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A\", addressProvider: AP_MONAD_PLASMA_RH, addressProviderRouter: R_MONAD_PLASMA_RH}),\n 9745: d({label: \"Plasma\", family: \"lite4\", router: R_MONAD_PLASMA_RH, version: \"1.1.0\", codeHash: \"0xeede894a379cb95c73ece834e836ff9bbaa1ff613fb7913d0cbc3a48b2897120\", weth: \"0x6100E367285b01F48D07953803A2d8dCA5D19873\", addressProvider: AP_MONAD_PLASMA_RH, addressProviderRouter: R_MONAD_PLASMA_RH}),\n // v1.1.1: ETH_ADDRESS is a constructor immutable — 0xEeee… here, read from the code tail with WETH_ADDRESS.\n 4663: d({label: \"Robinhood Chain\", family: \"lite4\", router: R_MONAD_PLASMA_RH, version: \"1.1.1\", codeHash: \"0x716ad3720f54c96effe415598d3a62b9907e53c58c7e3d3004cba6cdb5c297a6\", weth: \"0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73\", eth: CURVE_ETH, addressProvider: AP_MONAD_PLASMA_RH, addressProviderRouter: R_MONAD_PLASMA_RH}),\n 57073: d({label: \"Ink\", family: \"lite4\", router: \"0xd7E72f3615aa65b92A4DBdC211E296a35512988B\", version: \"1.1.0\", codeHash: \"0x511c1733063263ba386b0e6b01b51d777deb02ea1b6e75fcde1e572e47f22436\", weth: OP_WETH, addressProvider: \"0x604388Bb1159AFd21eB5191cE22b4DeCdEE2Ae22\", addressProviderRouter: \"0xd7E72f3615aa65b92A4DBdC211E296a35512988B\"}),\n 196: d({label: \"X Layer\", family: \"lite4\", router: \"0xBFab8ebc836E1c4D81837798FC076D219C9a1855\", version: \"1.1.0\", codeHash: \"0xfc0a3b12868c10a8a46e33f17504f8751c83d3842f715c665c3d827bfc4ed625\", weth: \"0xe538905cf8410324e03A5A23C1c177a474D59b2b\", addressProvider: AP, addressProviderRouter: \"0xBFab8ebc836E1c4D81837798FC076D219C9a1855\"}),\n 98866: d({label: \"Plume\", family: \"lite4\", router: \"0x3F5A41B922a76759b9C77D36b3d337E88cD1dc5e\", version: \"1.1.0\", codeHash: \"0x0819b95039f1e0ac56aefffc8a727e996b3afa831fd3bb2047a3737bf23ab5e4\", weth: \"0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1\", addressProvider: \"0x907CE289E9Ee0BBcb0F69132B1C28A9Affc29FCA\", addressProviderRouter: \"0x3F5A41B922a76759b9C77D36b3d337E88cD1dc5e\"}),\n});\n\n/**\n * Older Ethereum routers recognized in history only (never quoted or approved): Router NG v1.1 (what the\n * AddressProvider lists as id 2) and v1.0. Both `[5][5]`, both immutable (checked 2026-11-05).\n */\nexport const CURVE_LEGACY_ROUTERS: Readonly<Record<number, readonly {router: Hex; version: string; codeHash: Hex}[]>> = Object.freeze({\n 1: Object.freeze([\n {router: \"0x16C6521Dff6baB339122a0FE25a9116693265353\" as Hex, version: \"1.1.0\", codeHash: \"0xf041e5b17dc8b2c417a9561eb265145e442ab25b789d9bd3527c6b68a840577b\" as Hex},\n {router: \"0xF0d4c12A5768D806021F80a262B4d39d26C58b8D\" as Hex, version: \"1.0.0\", codeHash: \"0xdfc206a29f04b4cee5b7b8d5b60ffcd2574fc9ff17cc5ec00c58b17013ea3f3b\" as Hex},\n ]),\n});\n\n/**\n * Pools a route never crosses, whatever an allowlist says (defense in depth; the allowlist generator excludes the same\n * addresses). Ethereum: a registered stable-ng pool pairing real USDT with a token that calls itself \"USDT\"\n * (`0x810e…ae9`); the four pools drained by the 2023 Vyper reentrancy-lock bug (alETH, pETH, msETH, CRV/ETH — still\n * registered on-chain); the Iron Bank lending pool cyDAI/cyUSDC/cyUSDT, whose underlying route redeems Iron Bank\n * cTokens. Polygon: amWBTC/renBTC (renBTC is dead).\n */\nexport const CURVE_DENIED_POOLS: Readonly<Record<number, ReadonlySet<string>>> = Object.freeze({\n 1: new Set([\n \"0xa6d9f4f3a67b35e81dfa560b0fcde9b0751f1f53\",\n \"0xc4c319e2d4d66cca4464c0c2b32c9bd23ebe784e\",\n \"0x9848482da3ee3076165ce6497eda906e66bb85c5\",\n \"0xc897b98272aa23714464ea2a0bd5180f1b8c0025\",\n \"0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511\",\n \"0x2dded6da1bf5dbdf597c45fcfaa3194e53ecfeaf\",\n ]),\n 137: new Set([\n \"0xc2d95eef97ec6c17551d45e77b590dc1f9117c67\",\n ]),\n});\n\n/** The chain id of an `eip155:<id>` CAIP-2 string, or NaN. */\nexport function chainIdOf(caip2: string): number {\n return /^eip155:[0-9]+$/.test(caip2) ? Number(caip2.slice(7)) : NaN;\n}\n\n/** The deployment pinned for `chainId` in `table` (own keys only), or undefined. */\nexport function deploymentOf(table: Readonly<Record<number, CurveDeployment>>, chainId: number): CurveDeployment | undefined {\n return Object.prototype.hasOwnProperty.call(table, chainId) ? table[chainId] : undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,sBAAyE;AACzE,kBAA4B;;;ACR5B,kBAA+D;;;ACwCxD,IAAM,YAAiB;AACvB,IAAM,eAAoB;AAO1B,IAAM,UAAe;AACrB,IAAM,kBAAuB;AAEpC,IAAM,KAAU;AAChB,IAAM,qBAA0B;AAChC,IAAM,cAAmB;AACzB,IAAM,oBAAyB;AAC/B,IAAM,gBAAqB;AAC3B,IAAM,eAAoB;AAC1B,IAAM,qBAA0B;AAChC,IAAM,UAAe;AAErB,IAAM,IAAI,CAAC,MAAmE,OAAO,OAAO,EAAC,KAAK,WAAW,GAAG,EAAC,CAAC;AAE3G,IAAM,oBAA+D,OAAO,OAAO;AAAA;AAAA;AAAA,EAGxF,GAAG,EAAE,EAAC,OAAO,YAAY,QAAQ,OAAO,QAAQ,8CAA8C,SAAS,SAAS,UAAU,sEAAsE,MAAM,8CAA8C,iBAAiB,IAAI,uBAAuB,8CAA8C,SAAS,EAAC,OAAO,SAAS,OAAO,gBAAe,EAAC,CAAC;AAAA,EAChY,OAAO,EAAE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,YAAY,KAAK,GAAG,MAAM,MAAM,MAAM,GAAG,EAAE,EAAE,YAAY;AACxF,MAAI,CAAC,OAAO,CAAC,iBAAiB,MAAM,EAAE,IAAI,GAAG,EAAG,QAAO;AACvD,QAAM,WAAW,WAAW,IAAI,MAAM;AACtC,QAAM,cAAc,IAAI,IAAI,IAAI,QAAQ,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,YAAY,MAAM,QAAQ;AAClG,QAAM,WAAW,kBAAW,4BAAW,GAAG,KAAK,CAAC,GAAG,cAAc,KAAK,qBAAc,8BAAa,QAAQ,CAAC,EAAE;AAC5G,aAAO,kCAAiB,IAAI,KAAK,EAAC,UAAU,cAAc,UAAU,MAAM,QAAQ,GAAI,cAAc,CAAC,IAAI,EAAC,cAAc,SAAQ,EAAE,CAAC;AACrI;","names":["c","a","d"]}
@@ -0,0 +1,15 @@
1
+ import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
2
+ import { a as CurveDeployment } from './deployments-D4pk2tPy.cjs';
3
+ import 'viem';
4
+
5
+ /**
6
+ * Activity recognition for Curve: a call into the chain's pinned Router NG — or, on Ethereum, the older v1.1 / v1.0
7
+ * routers (history only) — with one of the family's `exchange` entry points → `swap`, "Swapped A → B" from the owner's
8
+ * net transfers. A swap whose receiver is not one of the owner's addresses (an explicit `_receiver`, read from the
9
+ * calldata or the router's `Exchange` log) says so in the subtitle and names that receiver as the counterparty.
10
+ */
11
+
12
+ declare const CURVE_MODULE = "@anywalletkit/protocol-swap2-curve";
13
+ declare function describeCurveActivity(tx: ChainTx, ctx: DescribeActivityContext, deployments?: Readonly<Record<number, CurveDeployment>>): ActivityItem | null;
14
+
15
+ export { CURVE_MODULE, describeCurveActivity };
@@ -0,0 +1,15 @@
1
+ import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
2
+ import { a as CurveDeployment } from './deployments-D4pk2tPy.js';
3
+ import 'viem';
4
+
5
+ /**
6
+ * Activity recognition for Curve: a call into the chain's pinned Router NG — or, on Ethereum, the older v1.1 / v1.0
7
+ * routers (history only) — with one of the family's `exchange` entry points → `swap`, "Swapped A → B" from the owner's
8
+ * net transfers. A swap whose receiver is not one of the owner's addresses (an explicit `_receiver`, read from the
9
+ * calldata or the router's `Exchange` log) says so in the subtitle and names that receiver as the counterparty.
10
+ */
11
+
12
+ declare const CURVE_MODULE = "@anywalletkit/protocol-swap2-curve";
13
+ declare function describeCurveActivity(tx: ChainTx, ctx: DescribeActivityContext, deployments?: Readonly<Record<number, CurveDeployment>>): ActivityItem | null;
14
+
15
+ export { CURVE_MODULE, describeCurveActivity };