@anywalletkit/protocol-swap2-usdt0 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,96 @@
1
- # Temporary Holding Version
1
+ # @anywalletkit/protocol-swap2-usdt0
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
+ [USDT0](https://docs.usdt0.to) — Tether's USDT as a LayerZero OFT — as a swap2
4
+ provider: USDT / USDT0 between 16 EVM chains in **one source transaction**.
5
+ `send(SendParam, MessagingFee, refund)` on the chain's OFT with the LayerZero
6
+ messaging fee as `msg.value`; LayerZero's DVNs verify the packet and the
7
+ executor delivers on the destination (USDT0 minted, or USDT released from the
8
+ Ethereum adapter). No spread, no protocol fee today — the only cost is the
9
+ LayerZero fee in the source chain's native coin (≈ 0.0000024 ETH for
10
+ Arbitrum → HyperEVM on 2026-10-20). It is the only direct USDT path into
11
+ HyperEVM.
12
+
13
+ ```ts
14
+ import {usdt0Provider} from "@anywalletkit/protocol-swap2-usdt0/provider";
15
+ import {RouterSwap2Protocol} from "@anywalletkit/protocol-swap2-router/swap2/router";
16
+
17
+ const swap2 = new RouterSwap2Protocol(arbitrumAccount, {fromChain: "eip155:42161", providers: [usdt0Provider({rpcUrls})]});
18
+ const res = await swap2.swap2({fromToken: "USDT0", toToken: "USDT0", toChain: 999, fromTokenAmount: 10_000_000n, minAmountOut: 10_000_000n});
19
+ // … poll …
20
+ const status = await swap2.getSwap2Status(res.id); // "pending" → "completed" with the HyperEVM delivery hash
21
+ ```
22
+
23
+ `rpcUrls` (CAIP-2 → URL or URLs) is required for every chain the provider
24
+ quotes **from**: the fee and the received amount come from the OFT itself,
25
+ not from an API.
26
+
27
+ ## What the provider does
28
+
29
+ - **Quote** = two `eth_call`s on the source OFT. `quoteOFT(SendParam)` gives
30
+ the limits, any OFT fee rows and `amountReceivedLD` — what really arrives
31
+ after dust removal (shared decimals = 6 on every deployment, so nothing is
32
+ removed today). That amount becomes `minAmountLD`, and `quoteSend` prices
33
+ the message with it. The contract reverts rather than deliver less.
34
+ - **Calldata is sealed in the quote**: `send(SendParam{dstEid, to, amountLD,
35
+ minAmountLD, extraOptions: 0x, composeMsg: 0x, oftCmd: 0x}, {nativeFee, 0},
36
+ refundAddress)`, `value` = `nativeFee` = the quoted LayerZero fee **+ 25 %
37
+ headroom** — the fee is paid at send time and moves with gas (live: +1.7 % in
38
+ a minute on Ethereum); OAppSender needs `msg.value == nativeFee` and the
39
+ endpoint refunds the unused part to `refundAddress` in the same transaction
40
+ (declared as `txRequest.nativeFee`
41
+ so the engine caps it per chain and the router prices it). `extraOptions`
42
+ stays empty: every deployment's `enforcedOptions` already carry the
43
+ executor gas (type-3, `lzReceive` gas 80 000, read on-chain 2026-10-20).
44
+ - **Approvals**: Ethereum locks USDT in an OFT *adapter* (`approvalRequired()`
45
+ = true) → `approvalAddress` is the adapter, exact amount. Every other chain's
46
+ OFT burns the caller's USDT0 through the token's mint/burn role
47
+ (`approvalRequired()` = false) → no approval at all.
48
+ - **Bound on-chain**: before the first quote on a chain the OFT's `token()`
49
+ and `approvalRequired()` must match `config.ts`; per pair, `peers(dstEid)`
50
+ must be the destination OFT. A mismatch refuses the route with its reason.
51
+ - **Preflight** (right before signing): target is the source OFT, peer still
52
+ wired, and the *current* `quoteSend` fee still fits the sealed `value` —
53
+ the endpoint reverts an underpaid send, so a fee past the headroom means re-quote.
54
+ - **Tracking**: LayerZero Scan `GET /v1/messages/tx/{sourceTxHash}`, matched
55
+ to the route's eids and the source OFT. `INFLIGHT` / `CONFIRMING` /
56
+ `BLOCKED` → pending; `DELIVERED` → completed with the destination hash;
57
+ `PAYLOAD_STORED` → action-required; `FAILED` and the burned / skipped /
58
+ malformed statuses → failed; a hash whose message belongs to another
59
+ pathway → failed.
60
+ - **Claim** (`buildClaim`, through the engine's `claimSwap2`): a delivery that
61
+ reverted on the destination is stored by the endpoint and can be retried
62
+ by anyone — `EndpointV2.lzReceive(origin, receiver, guid, message, 0x)` with
63
+ the exact packet Scan recorded, on the destination chain. Null otherwise.
64
+ - **Deployments** (docs.usdt0.to, every address re-read on-chain 2026-10-20):
65
+ Ethereum (eid 30101, adapter), Arbitrum 30110, OP Mainnet 30111, Polygon
66
+ 30109, HyperEVM 30367, Ink 30339, Berachain 30362, Unichain 30320, Sei
67
+ 30280, Plasma 30383, Monad 30390, MegaETH 30398, X Layer 30274, Mantle 30181, Morph 30322, Flare 30295. USDT0 is also live on
68
+ Conflux eSpace, Hedera, Rootstock, Stable, Tempo, HyperCore, IOTA and Stellar —
69
+ not wallet chains here yet.
70
+ OP's catalog `USDT` is the legacy bridged token (not the OFT); `USDT0` is.
71
+
72
+ ## Tests
73
+
74
+ `pnpm test` — provider tests over a fake JSON-RPC + fake LayerZero Scan
75
+ (route gating, quote maths incl. dust and OFT fee rows, calldata binding,
76
+ every named refusal, on-chain binding failures, preflight, the whole
77
+ pending → completed / action-required / failed lifecycle, the `lzReceive`
78
+ claim, the router snapshot) and the conformance suite incl. the behaviour
79
+ fixture (the engine executes exactly the reviewed plan, no approval).
80
+ `USDT0_LIVE=1 pnpm test` adds a live read-only quote on Arbitrum.
81
+ `pnpm verify:live` re-reads all 13 deployments on-chain and quotes
82
+ 10 USDT0 Arbitrum → HyperEVM with the preflight.
83
+
84
+ ## Status
85
+
86
+ 2026-10-20: built, tests green, all 13 deployments verified on-chain, live
87
+ quote + preflight verified. No funded transfer yet (plan: 10 USDT Arbitrum →
88
+ HyperEVM from the phone, then the status through LayerZero Scan).
89
+
90
+ ## Activity
91
+
92
+ `describeActivity`: `send` on the OFT → "Bridged USDT0" ("Bridged USDT" on
93
+ Ethereum); the executor's delivery (USDT0 minted to the owner, or USDT
94
+ released by the adapter, in a transaction the owner did not send) → "Received
95
+ USDT0 via LayerZero"; the owner's own `lzReceive` retry → the same. Fixtures
96
+ are recorded mainnet transactions (`fixtures/activity`).
@@ -0,0 +1,124 @@
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
+ LZ_RECEIVE: () => LZ_RECEIVE,
24
+ USDT0_MODULE: () => USDT0_MODULE,
25
+ USDT0_SEND: () => USDT0_SEND,
26
+ describeUsdt0Activity: () => describeUsdt0Activity
27
+ });
28
+ module.exports = __toCommonJS(activity_exports);
29
+ var import_activity = require("@anywalletkit/protocol-swap2-core/activity");
30
+ var import_viem = require("viem");
31
+
32
+ // src/config.ts
33
+ var import_util = require("@anywalletkit/protocol-swap2-core/util");
34
+ var LZ_ENDPOINT_A = "0x1a44076050125825900e736c501f859c50fE728c";
35
+ var LZ_ENDPOINT_B = "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B";
36
+ var c = (chainId, eid, name, token, oft, endpoint, adapter = false) => ({
37
+ caip2: `eip155:${chainId}`,
38
+ chainId,
39
+ eid,
40
+ name,
41
+ token,
42
+ oft,
43
+ endpoint,
44
+ adapter
45
+ });
46
+ var USDT0_CHAINS = Object.freeze(Object.fromEntries([
47
+ c(1, 30101, "Ethereum", "0xdAC17F958D2ee523a2206206994597C13D831ec7", "0x6C96dE32CEa08842dcc4058c14d3aaAD7Fa41dee", LZ_ENDPOINT_A, true),
48
+ c(42161, 30110, "Arbitrum", "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", "0x14E4A1B13bf7F943c8ff7C51fb60FA964A298D92", LZ_ENDPOINT_A),
49
+ c(10, 30111, "OP Mainnet", "0x01bFF41798a0BcF287b996046Ca68b395DbC1071", "0xF03b4d9AC1D5d1E7c4cEf54C2A313b9fe051A0aD", LZ_ENDPOINT_A),
50
+ c(137, 30109, "Polygon PoS", "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", "0x6BA10300f0DC58B7a1e4c0e41f5daBb7D7829e13", LZ_ENDPOINT_A),
51
+ c(999, 30367, "HyperEVM", "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb", "0x904861a24F30EC96ea7CFC3bE9EA4B476d237e98", "0x3A73033C0b1407574C76BdBAc67f126f6b4a9AA9"),
52
+ c(57073, 30339, "Ink", "0x0200C29006150606B650577BBE7B6248F58470c1", "0x1cB6De532588fCA4a21B7209DE7C456AF8434A65", "0xca29f3A6f966Cb2fc0dE625F8f325c0C46dbE958"),
53
+ c(80094, 30362, "Berachain", "0x779Ded0c9e1022225f8E0630b35a9b54bE713736", "0x3Dc96399109df5ceb2C226664A086140bD0379cB", LZ_ENDPOINT_B),
54
+ c(130, 30320, "Unichain", "0x9151434b16b9763660705744891fA906F660EcC5", "0xc07bE8994D035631c36fb4a89C918CeFB2f03EC3", LZ_ENDPOINT_B),
55
+ c(1329, 30280, "Sei", "0x9151434b16b9763660705744891fA906F660EcC5", "0x56Fe74A2e3b484b921c447357203431a3485CC60", LZ_ENDPOINT_A),
56
+ c(9745, 30383, "Plasma", "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb", "0x02ca37966753bDdDf11216B73B16C1dE756A7CF9", LZ_ENDPOINT_B),
57
+ c(143, 30390, "Monad", "0xe7cd86e13AC4309349F30B3435a9d337750fC82D", "0x9151434b16b9763660705744891fA906F660EcC5", LZ_ENDPOINT_B),
58
+ c(4326, 30398, "MegaETH", "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb", "0x9151434b16b9763660705744891fA906F660EcC5", LZ_ENDPOINT_B),
59
+ c(196, 30274, "X Layer", "0x779Ded0c9e1022225f8E0630b35a9b54bE713736", "0x94bcCa6BdfD6a61817aB0E960BfedE4984505554", LZ_ENDPOINT_A),
60
+ // 2026-10-20 (evm-chains-6 batch): docs.usdt0.to deployments, re-read on-chain (token(), approvalRequired() = false,
61
+ // sharedDecimals() = 6, endpoint(), peers(30110) = the Arbitrum OFT).
62
+ c(5e3, 30181, "Mantle", "0x779Ded0c9e1022225f8E0630b35a9b54bE713736", "0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC", LZ_ENDPOINT_A),
63
+ c(2818, 30322, "Morph", "0xe7cd86e13AC4309349F30B3435a9d337750fC82D", "0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC", LZ_ENDPOINT_B),
64
+ c(14, 30295, "Flare", "0xe7cd86e13AC4309349F30B3435a9d337750fC82D", "0x567287d2A9829215a37e3B88843d32f9221E7588", LZ_ENDPOINT_A)
65
+ ].map((x) => [x.caip2, x])));
66
+ var USDT0_BY_EID = Object.freeze(
67
+ Object.fromEntries(Object.values(USDT0_CHAINS).map((x) => [x.eid, x]))
68
+ );
69
+ var USDT0_SYMBOLS = Object.freeze(["USDT0", "USDT", "USD\u20AE0", "USD\u20AE"]);
70
+
71
+ // src/activity.ts
72
+ var SEND_ABI = (0, import_viem.parseAbi)([
73
+ "struct SendParam { uint32 dstEid; bytes32 to; uint256 amountLD; uint256 minAmountLD; bytes extraOptions; bytes composeMsg; bytes oftCmd; }",
74
+ "struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; }",
75
+ "function send(SendParam sp, MessagingFee fee, address refundAddress)"
76
+ ]);
77
+ var USDT0_MODULE = "@anywalletkit/protocol-swap2-usdt0";
78
+ var USDT0_SEND = "0xc7c7f5b3";
79
+ var LZ_RECEIVE = "0x0c0c389e";
80
+ var ZERO = "0x0000000000000000000000000000000000000000";
81
+ function symbolFor(chain) {
82
+ return chain.adapter || [42161, 10, 137].includes(chain.chainId) ? "USDT" : "USDT0";
83
+ }
84
+ function sendDestination(tx) {
85
+ const data = tx.call?.data;
86
+ if (!data || data.length < 10 + 64 * 2) return null;
87
+ try {
88
+ const [sp] = (0, import_viem.decodeFunctionData)({ abi: SEND_ABI, data }).args;
89
+ return USDT0_BY_EID[sp.dstEid] ?? null;
90
+ } catch {
91
+ return null;
92
+ }
93
+ }
94
+ var lc = (a) => a.toLowerCase();
95
+ function describeUsdt0Activity(tx, ctx) {
96
+ const chain = USDT0_CHAINS[tx.chain];
97
+ if (!chain) return null;
98
+ const subtitle = `USDT0 \xB7 ${(0, import_activity.chainLabel)(tx.chain)}`;
99
+ if ((0, import_activity.matchesCall)(tx, [chain.oft], [USDT0_SEND])) {
100
+ const dst = sendDestination(tx);
101
+ const item = (0, import_activity.describeSwapLike)(tx, ctx, { protocol: USDT0_MODULE, subtitle, kind: "bridge", outVerb: "Bridged" });
102
+ if (!item) return null;
103
+ const native = item.assetsOut.filter((a) => a.token === null).reduce((sum, a) => sum + a.amount, 0n);
104
+ item.assetsOut = item.assetsOut.filter((a) => a.token !== null);
105
+ if (native > 0n) item.fee = (item.fee ?? 0n) + native;
106
+ const srcSym = item.assetsOut[0]?.symbol ?? symbolFor(chain);
107
+ if (dst) {
108
+ item.title = `Bridged ${srcSym} \u2192 ${symbolFor(dst)}`;
109
+ item.subtitle = `USDT0 \xB7 ${(0, import_activity.chainLabel)(tx.chain)} \u2192 ${dst.name}`;
110
+ } else item.title = `Bridged ${srcSym}`;
111
+ return item;
112
+ }
113
+ if ((0, import_activity.matchesCall)(tx, [chain.endpoint], [LZ_RECEIVE])) {
114
+ return (0, import_activity.describeSwapLike)(tx, ctx, { protocol: USDT0_MODULE, subtitle, kind: "bridge", inSuffix: "via LayerZero" });
115
+ }
116
+ const called = (0, import_activity.calledContract)(tx);
117
+ if (called && called === lc(chain.token)) return null;
118
+ const own = new Set([...ctx.own].map(lc));
119
+ const origin = chain.adapter ? lc(chain.oft) : ZERO;
120
+ const delivered = tx.transfers.some((t) => t.token !== null && lc(t.token) === lc(chain.token) && lc(t.from) === origin && own.has(lc(t.to)));
121
+ if (!delivered || own.has(lc(tx.from))) return null;
122
+ return (0, import_activity.describeSwapLike)(tx, ctx, { protocol: USDT0_MODULE, subtitle, kind: "bridge", inSuffix: "via LayerZero", counterparty: chain.oft });
123
+ }
124
+ //# sourceMappingURL=activity.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/activity.ts","../src/config.ts"],"sourcesContent":["/**\n * Activity recognition for USDT0 on every chain in `config.ts`:\n * - `send(...)` on the chain's OFT is our source leg (\"Bridged USDT0\", or\n * \"Bridged USDT\" on Ethereum where the adapter locks plain USDT);\n * - the inbound leg is the executor's delivery — the user signs nothing, so\n * it is recognized by its effect: the chain's USDT0 minted to the owner\n * (from the zero address), or USDT released by the Ethereum adapter to the\n * owner, inside a transaction that did NOT call the token itself (a plain\n * transfer is not a bridge);\n * - `lzReceive` on the LayerZero endpoint is the owner's own retry of a\n * stored payload (`claimSwap2`).\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {calledContract, chainLabel, describeSwapLike, matchesCall} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {decodeFunctionData, parseAbi, type Hex} from \"viem\";\nimport {USDT0_BY_EID, USDT0_CHAINS, type Usdt0Chain} from \"./config.js\";\n\nconst SEND_ABI = parseAbi([\n \"struct SendParam { uint32 dstEid; bytes32 to; uint256 amountLD; uint256 minAmountLD; bytes extraOptions; bytes composeMsg; bytes oftCmd; }\",\n \"struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; }\",\n \"function send(SendParam sp, MessagingFee fee, address refundAddress)\",\n]);\n\nexport const USDT0_MODULE = \"@anywalletkit/protocol-swap2-usdt0\";\n\n/** send((uint32,bytes32,uint256,uint256,bytes,bytes,bytes),(uint256,uint256),address) — IOFT */\nexport const USDT0_SEND = \"0xc7c7f5b3\";\n/** lzReceive((uint32,bytes32,uint64),address,bytes32,bytes,bytes) — EndpointV2 */\nexport const LZ_RECEIVE = \"0x0c0c389e\";\n\nconst ZERO = \"0x0000000000000000000000000000000000000000\";\n\n/** The symbol the catalog uses on each deployment: USDT where the OFT wraps Tether's USDT, USDT0 elsewhere. */\nfunction symbolFor(chain: Usdt0Chain): string {\n return chain.adapter || [42161, 10, 137].includes(chain.chainId) ? \"USDT\" : \"USDT0\";\n}\n\n/** `send(SendParam, …)` → the destination deployment (dstEid is the first word of the tuple), null when the calldata is absent or foreign. */\nfunction sendDestination(tx: ChainTx): Usdt0Chain | null {\n const data = tx.call?.data;\n if (!data || data.length < 10 + 64 * 2) return null;\n try {\n const [sp] = decodeFunctionData({abi: SEND_ABI, data: data as Hex}).args as unknown as [{dstEid: number}];\n return USDT0_BY_EID[sp.dstEid] ?? null;\n } catch {\n return null;\n }\n}\nconst lc = (a: string) => a.toLowerCase();\n\nexport function describeUsdt0Activity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n const chain = USDT0_CHAINS[tx.chain];\n if (!chain) return null;\n const subtitle = `USDT0 · ${chainLabel(tx.chain)}`;\n if (matchesCall(tx, [chain.oft], [USDT0_SEND])) {\n // The native value is the LayerZero messaging fee (plus the headroom the\n // endpoint refunds), not an asset the owner swapped away: it rides in `fee`\n // next to the gas, and the title names both ends when the calldata says\n // where the tokens go.\n const dst = sendDestination(tx);\n const item = describeSwapLike(tx, ctx, {protocol: USDT0_MODULE, subtitle, kind: \"bridge\", outVerb: \"Bridged\"});\n if (!item) return null;\n const native = item.assetsOut.filter((a) => a.token === null).reduce((sum, a) => sum + a.amount, 0n);\n item.assetsOut = item.assetsOut.filter((a) => a.token !== null);\n if (native > 0n) item.fee = (item.fee ?? 0n) + native;\n const srcSym = item.assetsOut[0]?.symbol ?? symbolFor(chain);\n if (dst) {\n item.title = `Bridged ${srcSym} → ${symbolFor(dst)}`;\n item.subtitle = `USDT0 · ${chainLabel(tx.chain)} → ${dst.name}`;\n } else item.title = `Bridged ${srcSym}`;\n return item;\n }\n if (matchesCall(tx, [chain.endpoint], [LZ_RECEIVE])) {\n return describeSwapLike(tx, ctx, {protocol: USDT0_MODULE, subtitle, kind: \"bridge\", inSuffix: \"via LayerZero\"});\n }\n // Delivery by the LayerZero executor: the token moves out of nowhere (mint)\n // or out of the adapter into the owner, and the call target is not the token.\n const called = calledContract(tx);\n if (called && called === lc(chain.token)) return null;\n const own = new Set([...ctx.own].map(lc));\n const origin = chain.adapter ? lc(chain.oft) : ZERO;\n const delivered = tx.transfers.some((t) => t.token !== null && lc(t.token) === lc(chain.token) && lc(t.from) === origin && own.has(lc(t.to)));\n if (!delivered || own.has(lc(tx.from))) return null;\n return describeSwapLike(tx, ctx, {protocol: USDT0_MODULE, subtitle, kind: \"bridge\", inSuffix: \"via LayerZero\", counterparty: chain.oft});\n}\n","// USDT0 — Tether's LayerZero OFT for USDT. Source: docs.usdt0.to\n// (technical-documentation/deployments, read 2026-10-20) — every row below was\n// then re-read on-chain over public RPCs the same day: the OFT's `token()` is\n// the listed token, `endpoint()` is the listed endpoint (and reports the\n// listed eid), `approvalRequired()` is true only for the Ethereum adapter,\n// `sharedDecimals()` = 6 everywhere, and `peers(eid)` are wired between the\n// chains. `oftVersion()` = (0x02e49c2c, 1) on all of them.\n//\n// Only chains the SDK ships (swap2-assets / wallet-evm) are listed. USDT0 is\n// also deployed on Conflux eSpace (1030, eid 30212), Flare (14, 30295),\n// Hedera (295, 30316), Mantle (5000, 30181), Morph (2818, 30322), Rootstock\n// (30, 30333), Stable (988, 30396), Tempo (4217, 30410), plus HyperCore, IOTA\n// and Stellar (non-EVM) — not wallet chains here, so not routable here.\nimport {evmRef, isEvm} from \"@anywalletkit/protocol-swap2-core/util\";\n\nexport interface Usdt0Chain {\n caip2: string;\n chainId: number;\n /** LayerZero V2 endpoint id. */\n eid: number;\n name: string;\n /** The ERC-20 the user holds: USDT on Ethereum, USDT0 elsewhere (6 decimals everywhere). */\n token: string;\n /**\n * The OFT contract `quoteSend` / `send` are called on. On Ethereum it is the\n * OFT *adapter* that locks USDT (`approvalRequired()` = true, approve the\n * token to it); elsewhere it is the OUpgradeable OFT that burns the caller's\n * USDT0 through the token's mint/burn role — no approval.\n */\n oft: string;\n /** LayerZero V2 EndpointV2 on that chain (`lzReceive` retries of a stored payload go here). */\n endpoint: string;\n /** True on Ethereum: the OFT is a lockbox adapter in front of plain USDT. */\n adapter: boolean;\n}\n\nconst LZ_ENDPOINT_A = \"0x1a44076050125825900e736c501f859c50fE728c\";\nconst LZ_ENDPOINT_B = \"0x6F475642a6e85809B1c36Fa62763669b1b48DD5B\";\n\nconst c = (chainId: number, eid: number, name: string, token: string, oft: string, endpoint: string, adapter = false): Usdt0Chain => ({\n caip2: `eip155:${chainId}`, chainId, eid, name, token, oft, endpoint, adapter,\n});\n\n/** CAIP-2 → USDT0 deployment. */\nexport const USDT0_CHAINS: Readonly<Record<string, Usdt0Chain>> = Object.freeze(Object.fromEntries([\n c(1, 30101, \"Ethereum\", \"0xdAC17F958D2ee523a2206206994597C13D831ec7\", \"0x6C96dE32CEa08842dcc4058c14d3aaAD7Fa41dee\", LZ_ENDPOINT_A, true),\n c(42161, 30110, \"Arbitrum\", \"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9\", \"0x14E4A1B13bf7F943c8ff7C51fb60FA964A298D92\", LZ_ENDPOINT_A),\n c(10, 30111, \"OP Mainnet\", \"0x01bFF41798a0BcF287b996046Ca68b395DbC1071\", \"0xF03b4d9AC1D5d1E7c4cEf54C2A313b9fe051A0aD\", LZ_ENDPOINT_A),\n c(137, 30109, \"Polygon PoS\", \"0xc2132D05D31c914a87C6611C10748AEb04B58e8F\", \"0x6BA10300f0DC58B7a1e4c0e41f5daBb7D7829e13\", LZ_ENDPOINT_A),\n c(999, 30367, \"HyperEVM\", \"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb\", \"0x904861a24F30EC96ea7CFC3bE9EA4B476d237e98\", \"0x3A73033C0b1407574C76BdBAc67f126f6b4a9AA9\"),\n c(57073, 30339, \"Ink\", \"0x0200C29006150606B650577BBE7B6248F58470c1\", \"0x1cB6De532588fCA4a21B7209DE7C456AF8434A65\", \"0xca29f3A6f966Cb2fc0dE625F8f325c0C46dbE958\"),\n c(80094, 30362, \"Berachain\", \"0x779Ded0c9e1022225f8E0630b35a9b54bE713736\", \"0x3Dc96399109df5ceb2C226664A086140bD0379cB\", LZ_ENDPOINT_B),\n c(130, 30320, \"Unichain\", \"0x9151434b16b9763660705744891fA906F660EcC5\", \"0xc07bE8994D035631c36fb4a89C918CeFB2f03EC3\", LZ_ENDPOINT_B),\n c(1329, 30280, \"Sei\", \"0x9151434b16b9763660705744891fA906F660EcC5\", \"0x56Fe74A2e3b484b921c447357203431a3485CC60\", LZ_ENDPOINT_A),\n c(9745, 30383, \"Plasma\", \"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb\", \"0x02ca37966753bDdDf11216B73B16C1dE756A7CF9\", LZ_ENDPOINT_B),\n c(143, 30390, \"Monad\", \"0xe7cd86e13AC4309349F30B3435a9d337750fC82D\", \"0x9151434b16b9763660705744891fA906F660EcC5\", LZ_ENDPOINT_B),\n c(4326, 30398, \"MegaETH\", \"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb\", \"0x9151434b16b9763660705744891fA906F660EcC5\", LZ_ENDPOINT_B),\n c(196, 30274, \"X Layer\", \"0x779Ded0c9e1022225f8E0630b35a9b54bE713736\", \"0x94bcCa6BdfD6a61817aB0E960BfedE4984505554\", LZ_ENDPOINT_A),\n // 2026-10-20 (evm-chains-6 batch): docs.usdt0.to deployments, re-read on-chain (token(), approvalRequired() = false,\n // sharedDecimals() = 6, endpoint(), peers(30110) = the Arbitrum OFT).\n c(5000, 30181, \"Mantle\", \"0x779Ded0c9e1022225f8E0630b35a9b54bE713736\", \"0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC\", LZ_ENDPOINT_A),\n c(2818, 30322, \"Morph\", \"0xe7cd86e13AC4309349F30B3435a9d337750fC82D\", \"0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC\", LZ_ENDPOINT_B),\n c(14, 30295, \"Flare\", \"0xe7cd86e13AC4309349F30B3435a9d337750fC82D\", \"0x567287d2A9829215a37e3B88843d32f9221E7588\", LZ_ENDPOINT_A),\n].map((x) => [x.caip2, x])));\n\n/** LayerZero eid → deployment. */\nexport const USDT0_BY_EID: Readonly<Record<number, Usdt0Chain>> = Object.freeze(\n Object.fromEntries(Object.values(USDT0_CHAINS).map((x) => [x.eid, x])),\n);\n\n/** LayerZero Scan — message status by source transaction hash. */\nexport const LZ_SCAN_API = \"https://scan.layerzero-api.com\";\n\n/** Token symbols the catalog uses for the same asset across chains. */\nexport const USDT0_SYMBOLS: readonly string[] = Object.freeze([\"USDT0\", \"USDT\", \"USD₮0\", \"USD₮\"]);\n\nexport const usdt0 = {\n supportsChain(chain: string): boolean {\n return isEvm(chain) && !!USDT0_CHAINS[`eip155:${evmRef(chain)}`];\n },\n supports(from: string, to: string): boolean {\n return from !== to && this.supportsChain(from) && this.supportsChain(to);\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,sBAAwE;AACxE,kBAAqD;;;ACDrD,kBAA4B;AAuB5B,IAAM,gBAAgB;AACtB,IAAM,gBAAgB;AAEtB,IAAM,IAAI,CAAC,SAAiB,KAAa,MAAc,OAAe,KAAa,UAAkB,UAAU,WAAuB;AAAA,EACpI,OAAO,UAAU,OAAO;AAAA,EAAI;AAAA,EAAS;AAAA,EAAK;AAAA,EAAM;AAAA,EAAO;AAAA,EAAK;AAAA,EAAU;AACxE;AAGO,IAAM,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AS,GAAI,MAAK,OAAO,KAAK,OAAO,MAAM;AAC/C,UAAM,SAAS,KAAK,UAAU,CAAC,GAAG,UAAU,UAAU,KAAK;AAC3D,QAAI,KAAK;AACP,WAAK,QAAQ,WAAW,MAAM,WAAM,UAAU,GAAG,CAAC;AAClD,WAAK,WAAW,kBAAW,4BAAW,GAAG,KAAK,CAAC,WAAM,IAAI,IAAI;AAAA,IAC/D,MAAO,MAAK,QAAQ,WAAW,MAAM;AACrC,WAAO;AAAA,EACT;AACA,UAAI,6BAAY,IAAI,CAAC,MAAM,QAAQ,GAAG,CAAC,UAAU,CAAC,GAAG;AACnD,eAAO,kCAAiB,IAAI,KAAK,EAAC,UAAU,cAAc,UAAU,MAAM,UAAU,UAAU,gBAAe,CAAC;AAAA,EAChH;AAGA,QAAM,aAAS,gCAAe,EAAE;AAChC,MAAI,UAAU,WAAW,GAAG,MAAM,KAAK,EAAG,QAAO;AACjD,QAAM,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC;AACxC,QAAM,SAAS,MAAM,UAAU,GAAG,MAAM,GAAG,IAAI;AAC/C,QAAM,YAAY,GAAG,UAAU,KAAK,CAAC,MAAM,EAAE,UAAU,QAAQ,GAAG,EAAE,KAAK,MAAM,GAAG,MAAM,KAAK,KAAK,GAAG,EAAE,IAAI,MAAM,UAAU,IAAI,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;AAC5I,MAAI,CAAC,aAAa,IAAI,IAAI,GAAG,GAAG,IAAI,CAAC,EAAG,QAAO;AAC/C,aAAO,kCAAiB,IAAI,KAAK,EAAC,UAAU,cAAc,UAAU,MAAM,UAAU,UAAU,iBAAiB,cAAc,MAAM,IAAG,CAAC;AACzI;","names":[]}
@@ -0,0 +1,23 @@
1
+ import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
2
+
3
+ /**
4
+ * Activity recognition for USDT0 on every chain in `config.ts`:
5
+ * - `send(...)` on the chain's OFT is our source leg ("Bridged USDT0", or
6
+ * "Bridged USDT" on Ethereum where the adapter locks plain USDT);
7
+ * - the inbound leg is the executor's delivery — the user signs nothing, so
8
+ * it is recognized by its effect: the chain's USDT0 minted to the owner
9
+ * (from the zero address), or USDT released by the Ethereum adapter to the
10
+ * owner, inside a transaction that did NOT call the token itself (a plain
11
+ * transfer is not a bridge);
12
+ * - `lzReceive` on the LayerZero endpoint is the owner's own retry of a
13
+ * stored payload (`claimSwap2`).
14
+ */
15
+
16
+ declare const USDT0_MODULE = "@anywalletkit/protocol-swap2-usdt0";
17
+ /** send((uint32,bytes32,uint256,uint256,bytes,bytes,bytes),(uint256,uint256),address) — IOFT */
18
+ declare const USDT0_SEND = "0xc7c7f5b3";
19
+ /** lzReceive((uint32,bytes32,uint64),address,bytes32,bytes,bytes) — EndpointV2 */
20
+ declare const LZ_RECEIVE = "0x0c0c389e";
21
+ declare function describeUsdt0Activity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
22
+
23
+ export { LZ_RECEIVE, USDT0_MODULE, USDT0_SEND, describeUsdt0Activity };
@@ -0,0 +1,23 @@
1
+ import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
2
+
3
+ /**
4
+ * Activity recognition for USDT0 on every chain in `config.ts`:
5
+ * - `send(...)` on the chain's OFT is our source leg ("Bridged USDT0", or
6
+ * "Bridged USDT" on Ethereum where the adapter locks plain USDT);
7
+ * - the inbound leg is the executor's delivery — the user signs nothing, so
8
+ * it is recognized by its effect: the chain's USDT0 minted to the owner
9
+ * (from the zero address), or USDT released by the Ethereum adapter to the
10
+ * owner, inside a transaction that did NOT call the token itself (a plain
11
+ * transfer is not a bridge);
12
+ * - `lzReceive` on the LayerZero endpoint is the owner's own retry of a
13
+ * stored payload (`claimSwap2`).
14
+ */
15
+
16
+ declare const USDT0_MODULE = "@anywalletkit/protocol-swap2-usdt0";
17
+ /** send((uint32,bytes32,uint256,uint256,bytes,bytes,bytes),(uint256,uint256),address) — IOFT */
18
+ declare const USDT0_SEND = "0xc7c7f5b3";
19
+ /** lzReceive((uint32,bytes32,uint64),address,bytes32,bytes,bytes) — EndpointV2 */
20
+ declare const LZ_RECEIVE = "0x0c0c389e";
21
+ declare function describeUsdt0Activity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
22
+
23
+ export { LZ_RECEIVE, USDT0_MODULE, USDT0_SEND, describeUsdt0Activity };
@@ -0,0 +1,14 @@
1
+ import {
2
+ LZ_RECEIVE,
3
+ USDT0_MODULE,
4
+ USDT0_SEND,
5
+ describeUsdt0Activity
6
+ } from "./chunk-SFWB4C4U.js";
7
+ import "./chunk-AGN4M7OO.js";
8
+ export {
9
+ LZ_RECEIVE,
10
+ USDT0_MODULE,
11
+ USDT0_SEND,
12
+ describeUsdt0Activity
13
+ };
14
+ //# sourceMappingURL=activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,56 @@
1
+ // src/config.ts
2
+ import { evmRef, isEvm } from "@anywalletkit/protocol-swap2-core/util";
3
+ var LZ_ENDPOINT_A = "0x1a44076050125825900e736c501f859c50fE728c";
4
+ var LZ_ENDPOINT_B = "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B";
5
+ var c = (chainId, eid, name, token, oft, endpoint, adapter = false) => ({
6
+ caip2: `eip155:${chainId}`,
7
+ chainId,
8
+ eid,
9
+ name,
10
+ token,
11
+ oft,
12
+ endpoint,
13
+ adapter
14
+ });
15
+ var USDT0_CHAINS = Object.freeze(Object.fromEntries([
16
+ c(1, 30101, "Ethereum", "0xdAC17F958D2ee523a2206206994597C13D831ec7", "0x6C96dE32CEa08842dcc4058c14d3aaAD7Fa41dee", LZ_ENDPOINT_A, true),
17
+ c(42161, 30110, "Arbitrum", "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", "0x14E4A1B13bf7F943c8ff7C51fb60FA964A298D92", LZ_ENDPOINT_A),
18
+ c(10, 30111, "OP Mainnet", "0x01bFF41798a0BcF287b996046Ca68b395DbC1071", "0xF03b4d9AC1D5d1E7c4cEf54C2A313b9fe051A0aD", LZ_ENDPOINT_A),
19
+ c(137, 30109, "Polygon PoS", "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", "0x6BA10300f0DC58B7a1e4c0e41f5daBb7D7829e13", LZ_ENDPOINT_A),
20
+ c(999, 30367, "HyperEVM", "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb", "0x904861a24F30EC96ea7CFC3bE9EA4B476d237e98", "0x3A73033C0b1407574C76BdBAc67f126f6b4a9AA9"),
21
+ c(57073, 30339, "Ink", "0x0200C29006150606B650577BBE7B6248F58470c1", "0x1cB6De532588fCA4a21B7209DE7C456AF8434A65", "0xca29f3A6f966Cb2fc0dE625F8f325c0C46dbE958"),
22
+ c(80094, 30362, "Berachain", "0x779Ded0c9e1022225f8E0630b35a9b54bE713736", "0x3Dc96399109df5ceb2C226664A086140bD0379cB", LZ_ENDPOINT_B),
23
+ c(130, 30320, "Unichain", "0x9151434b16b9763660705744891fA906F660EcC5", "0xc07bE8994D035631c36fb4a89C918CeFB2f03EC3", LZ_ENDPOINT_B),
24
+ c(1329, 30280, "Sei", "0x9151434b16b9763660705744891fA906F660EcC5", "0x56Fe74A2e3b484b921c447357203431a3485CC60", LZ_ENDPOINT_A),
25
+ c(9745, 30383, "Plasma", "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb", "0x02ca37966753bDdDf11216B73B16C1dE756A7CF9", LZ_ENDPOINT_B),
26
+ c(143, 30390, "Monad", "0xe7cd86e13AC4309349F30B3435a9d337750fC82D", "0x9151434b16b9763660705744891fA906F660EcC5", LZ_ENDPOINT_B),
27
+ c(4326, 30398, "MegaETH", "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb", "0x9151434b16b9763660705744891fA906F660EcC5", LZ_ENDPOINT_B),
28
+ c(196, 30274, "X Layer", "0x779Ded0c9e1022225f8E0630b35a9b54bE713736", "0x94bcCa6BdfD6a61817aB0E960BfedE4984505554", LZ_ENDPOINT_A),
29
+ // 2026-10-20 (evm-chains-6 batch): docs.usdt0.to deployments, re-read on-chain (token(), approvalRequired() = false,
30
+ // sharedDecimals() = 6, endpoint(), peers(30110) = the Arbitrum OFT).
31
+ c(5e3, 30181, "Mantle", "0x779Ded0c9e1022225f8E0630b35a9b54bE713736", "0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC", LZ_ENDPOINT_A),
32
+ c(2818, 30322, "Morph", "0xe7cd86e13AC4309349F30B3435a9d337750fC82D", "0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC", LZ_ENDPOINT_B),
33
+ c(14, 30295, "Flare", "0xe7cd86e13AC4309349F30B3435a9d337750fC82D", "0x567287d2A9829215a37e3B88843d32f9221E7588", LZ_ENDPOINT_A)
34
+ ].map((x) => [x.caip2, x])));
35
+ var USDT0_BY_EID = Object.freeze(
36
+ Object.fromEntries(Object.values(USDT0_CHAINS).map((x) => [x.eid, x]))
37
+ );
38
+ var LZ_SCAN_API = "https://scan.layerzero-api.com";
39
+ var USDT0_SYMBOLS = Object.freeze(["USDT0", "USDT", "USD\u20AE0", "USD\u20AE"]);
40
+ var usdt0 = {
41
+ supportsChain(chain) {
42
+ return isEvm(chain) && !!USDT0_CHAINS[`eip155:${evmRef(chain)}`];
43
+ },
44
+ supports(from, to) {
45
+ return from !== to && this.supportsChain(from) && this.supportsChain(to);
46
+ }
47
+ };
48
+
49
+ export {
50
+ USDT0_CHAINS,
51
+ USDT0_BY_EID,
52
+ LZ_SCAN_API,
53
+ USDT0_SYMBOLS,
54
+ usdt0
55
+ };
56
+ //# sourceMappingURL=chunk-AGN4M7OO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config.ts"],"sourcesContent":["// USDT0 — Tether's LayerZero OFT for USDT. Source: docs.usdt0.to\n// (technical-documentation/deployments, read 2026-10-20) — every row below was\n// then re-read on-chain over public RPCs the same day: the OFT's `token()` is\n// the listed token, `endpoint()` is the listed endpoint (and reports the\n// listed eid), `approvalRequired()` is true only for the Ethereum adapter,\n// `sharedDecimals()` = 6 everywhere, and `peers(eid)` are wired between the\n// chains. `oftVersion()` = (0x02e49c2c, 1) on all of them.\n//\n// Only chains the SDK ships (swap2-assets / wallet-evm) are listed. USDT0 is\n// also deployed on Conflux eSpace (1030, eid 30212), Flare (14, 30295),\n// Hedera (295, 30316), Mantle (5000, 30181), Morph (2818, 30322), Rootstock\n// (30, 30333), Stable (988, 30396), Tempo (4217, 30410), plus HyperCore, IOTA\n// and Stellar (non-EVM) — not wallet chains here, so not routable here.\nimport {evmRef, isEvm} from \"@anywalletkit/protocol-swap2-core/util\";\n\nexport interface Usdt0Chain {\n caip2: string;\n chainId: number;\n /** LayerZero V2 endpoint id. */\n eid: number;\n name: string;\n /** The ERC-20 the user holds: USDT on Ethereum, USDT0 elsewhere (6 decimals everywhere). */\n token: string;\n /**\n * The OFT contract `quoteSend` / `send` are called on. On Ethereum it is the\n * OFT *adapter* that locks USDT (`approvalRequired()` = true, approve the\n * token to it); elsewhere it is the OUpgradeable OFT that burns the caller's\n * USDT0 through the token's mint/burn role — no approval.\n */\n oft: string;\n /** LayerZero V2 EndpointV2 on that chain (`lzReceive` retries of a stored payload go here). */\n endpoint: string;\n /** True on Ethereum: the OFT is a lockbox adapter in front of plain USDT. */\n adapter: boolean;\n}\n\nconst LZ_ENDPOINT_A = \"0x1a44076050125825900e736c501f859c50fE728c\";\nconst LZ_ENDPOINT_B = \"0x6F475642a6e85809B1c36Fa62763669b1b48DD5B\";\n\nconst c = (chainId: number, eid: number, name: string, token: string, oft: string, endpoint: string, adapter = false): Usdt0Chain => ({\n caip2: `eip155:${chainId}`, chainId, eid, name, token, oft, endpoint, adapter,\n});\n\n/** CAIP-2 → USDT0 deployment. */\nexport const USDT0_CHAINS: Readonly<Record<string, Usdt0Chain>> = Object.freeze(Object.fromEntries([\n c(1, 30101, \"Ethereum\", \"0xdAC17F958D2ee523a2206206994597C13D831ec7\", \"0x6C96dE32CEa08842dcc4058c14d3aaAD7Fa41dee\", LZ_ENDPOINT_A, true),\n c(42161, 30110, \"Arbitrum\", \"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9\", \"0x14E4A1B13bf7F943c8ff7C51fb60FA964A298D92\", LZ_ENDPOINT_A),\n c(10, 30111, \"OP Mainnet\", \"0x01bFF41798a0BcF287b996046Ca68b395DbC1071\", \"0xF03b4d9AC1D5d1E7c4cEf54C2A313b9fe051A0aD\", LZ_ENDPOINT_A),\n c(137, 30109, \"Polygon PoS\", \"0xc2132D05D31c914a87C6611C10748AEb04B58e8F\", \"0x6BA10300f0DC58B7a1e4c0e41f5daBb7D7829e13\", LZ_ENDPOINT_A),\n c(999, 30367, \"HyperEVM\", \"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb\", \"0x904861a24F30EC96ea7CFC3bE9EA4B476d237e98\", \"0x3A73033C0b1407574C76BdBAc67f126f6b4a9AA9\"),\n c(57073, 30339, \"Ink\", \"0x0200C29006150606B650577BBE7B6248F58470c1\", \"0x1cB6De532588fCA4a21B7209DE7C456AF8434A65\", \"0xca29f3A6f966Cb2fc0dE625F8f325c0C46dbE958\"),\n c(80094, 30362, \"Berachain\", \"0x779Ded0c9e1022225f8E0630b35a9b54bE713736\", \"0x3Dc96399109df5ceb2C226664A086140bD0379cB\", LZ_ENDPOINT_B),\n c(130, 30320, \"Unichain\", \"0x9151434b16b9763660705744891fA906F660EcC5\", \"0xc07bE8994D035631c36fb4a89C918CeFB2f03EC3\", LZ_ENDPOINT_B),\n c(1329, 30280, \"Sei\", \"0x9151434b16b9763660705744891fA906F660EcC5\", \"0x56Fe74A2e3b484b921c447357203431a3485CC60\", LZ_ENDPOINT_A),\n c(9745, 30383, \"Plasma\", \"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb\", \"0x02ca37966753bDdDf11216B73B16C1dE756A7CF9\", LZ_ENDPOINT_B),\n c(143, 30390, \"Monad\", \"0xe7cd86e13AC4309349F30B3435a9d337750fC82D\", \"0x9151434b16b9763660705744891fA906F660EcC5\", LZ_ENDPOINT_B),\n c(4326, 30398, \"MegaETH\", \"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb\", \"0x9151434b16b9763660705744891fA906F660EcC5\", LZ_ENDPOINT_B),\n c(196, 30274, \"X Layer\", \"0x779Ded0c9e1022225f8E0630b35a9b54bE713736\", \"0x94bcCa6BdfD6a61817aB0E960BfedE4984505554\", LZ_ENDPOINT_A),\n // 2026-10-20 (evm-chains-6 batch): docs.usdt0.to deployments, re-read on-chain (token(), approvalRequired() = false,\n // sharedDecimals() = 6, endpoint(), peers(30110) = the Arbitrum OFT).\n c(5000, 30181, \"Mantle\", \"0x779Ded0c9e1022225f8E0630b35a9b54bE713736\", \"0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC\", LZ_ENDPOINT_A),\n c(2818, 30322, \"Morph\", \"0xe7cd86e13AC4309349F30B3435a9d337750fC82D\", \"0xcb768e263FB1C62214E7cab4AA8d036D76dc59CC\", LZ_ENDPOINT_B),\n c(14, 30295, \"Flare\", \"0xe7cd86e13AC4309349F30B3435a9d337750fC82D\", \"0x567287d2A9829215a37e3B88843d32f9221E7588\", LZ_ENDPOINT_A),\n].map((x) => [x.caip2, x])));\n\n/** LayerZero eid → deployment. */\nexport const USDT0_BY_EID: Readonly<Record<number, Usdt0Chain>> = Object.freeze(\n Object.fromEntries(Object.values(USDT0_CHAINS).map((x) => [x.eid, x])),\n);\n\n/** LayerZero Scan — message status by source transaction hash. */\nexport const LZ_SCAN_API = \"https://scan.layerzero-api.com\";\n\n/** Token symbols the catalog uses for the same asset across chains. */\nexport const USDT0_SYMBOLS: readonly string[] = Object.freeze([\"USDT0\", \"USDT\", \"USD₮0\", \"USD₮\"]);\n\nexport const usdt0 = {\n supportsChain(chain: string): boolean {\n return isEvm(chain) && !!USDT0_CHAINS[`eip155:${evmRef(chain)}`];\n },\n supports(from: string, to: string): boolean {\n return from !== to && this.supportsChain(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