@anywalletkit/protocol-swap2-across 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 +202 -0
- package/README.md +177 -2
- package/dist/activity.cjs +142 -0
- package/dist/activity.cjs.map +1 -0
- package/dist/activity.d.cts +16 -0
- package/dist/activity.d.ts +16 -0
- package/dist/activity.js +10 -0
- package/dist/activity.js.map +1 -0
- package/dist/api.cjs +441 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +207 -0
- package/dist/api.d.ts +207 -0
- package/dist/api.js +35 -0
- package/dist/api.js.map +1 -0
- package/dist/build.cjs +776 -0
- package/dist/build.cjs.map +1 -0
- package/dist/build.d.cts +93 -0
- package/dist/build.d.ts +93 -0
- package/dist/build.js +14 -0
- package/dist/build.js.map +1 -0
- package/dist/chunk-32YJEBZX.js +125 -0
- package/dist/chunk-32YJEBZX.js.map +1 -0
- package/dist/chunk-3UBRQ3ZE.js +255 -0
- package/dist/chunk-3UBRQ3ZE.js.map +1 -0
- package/dist/chunk-5BDZXOOP.js +21 -0
- package/dist/chunk-5BDZXOOP.js.map +1 -0
- package/dist/chunk-6Z4GXNLE.js +102 -0
- package/dist/chunk-6Z4GXNLE.js.map +1 -0
- package/dist/chunk-AWQT5S4V.js +101 -0
- package/dist/chunk-AWQT5S4V.js.map +1 -0
- package/dist/chunk-E5WFOPN2.js +16 -0
- package/dist/chunk-E5WFOPN2.js.map +1 -0
- package/dist/chunk-GX67FRPG.js +194 -0
- package/dist/chunk-GX67FRPG.js.map +1 -0
- package/dist/chunk-KATEONJQ.js +396 -0
- package/dist/chunk-KATEONJQ.js.map +1 -0
- package/dist/chunk-P32AW6XS.js +27 -0
- package/dist/chunk-P32AW6XS.js.map +1 -0
- package/dist/chunk-PPPZIG7S.js +265 -0
- package/dist/chunk-PPPZIG7S.js.map +1 -0
- package/dist/chunk-SJOFLM27.js +138 -0
- package/dist/chunk-SJOFLM27.js.map +1 -0
- package/dist/chunk-YGNP7KPL.js +311 -0
- package/dist/chunk-YGNP7KPL.js.map +1 -0
- package/dist/config.cjs +214 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +119 -0
- package/dist/config.d.ts +119 -0
- package/dist/config.js +47 -0
- package/dist/config.js.map +1 -0
- package/dist/deposit.cjs +252 -0
- package/dist/deposit.cjs.map +1 -0
- package/dist/deposit.d.cts +95 -0
- package/dist/deposit.d.ts +95 -0
- package/dist/deposit.js +19 -0
- package/dist/deposit.js.map +1 -0
- package/dist/index.cjs +1789 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +34 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +242 -0
- package/dist/index.js.map +1 -0
- package/dist/pricing.cjs +132 -0
- package/dist/pricing.cjs.map +1 -0
- package/dist/pricing.d.cts +123 -0
- package/dist/pricing.d.ts +123 -0
- package/dist/pricing.js +42 -0
- package/dist/pricing.js.map +1 -0
- package/dist/protocol.cjs +1596 -0
- package/dist/protocol.cjs.map +1 -0
- package/dist/protocol.d.cts +20 -0
- package/dist/protocol.d.ts +20 -0
- package/dist/protocol.js +17 -0
- package/dist/protocol.js.map +1 -0
- package/dist/provider.cjs +1581 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +45 -0
- package/dist/provider.d.ts +45 -0
- package/dist/provider.js +18 -0
- package/dist/provider.js.map +1 -0
- package/dist/remote.cjs +1659 -0
- package/dist/remote.cjs.map +1 -0
- package/dist/remote.d.cts +55 -0
- package/dist/remote.d.ts +55 -0
- package/dist/remote.js +17 -0
- package/dist/remote.js.map +1 -0
- package/dist/status.cjs +443 -0
- package/dist/status.cjs.map +1 -0
- package/dist/status.d.cts +109 -0
- package/dist/status.d.ts +109 -0
- package/dist/status.js +26 -0
- package/dist/status.js.map +1 -0
- package/dist/verify.cjs +690 -0
- package/dist/verify.cjs.map +1 -0
- package/dist/verify.d.cts +245 -0
- package/dist/verify.d.ts +245 -0
- package/dist/verify.js +69 -0
- package/dist/verify.js.map +1 -0
- package/module.json +32 -0
- package/package.json +124 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,178 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @anywalletkit/protocol-swap2-across
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Across Protocol](https://across.to) for the swap2 engine, with **the SpokePool deposit built on the device and every argument verified before anything is signed**.
|
|
4
|
+
|
|
5
|
+
An Across deposit is one call, `deposit(...)` on the source chain's SpokePool. Its arguments say everything — who is refunded, who is paid, in which token and how much, on which chain, by when, and what runs on arrival — and the SpokePool checks almost none of it: there is no route list on chain, no token pairing, and the `depositor` (refunds, speed-ups) is not bound to the sender. So this module never signs a transaction a quote source hands over. The quote source supplies only **numbers** (the output amount, the quote time); the call is encoded here from the pinned SpokePool and the user's own request, and checked again right before signing.
|
|
6
|
+
|
|
7
|
+
- EVM → EVM, exact input, the same asset on both sides: USDC, USDT / USDT0, ETH / WETH, WBTC, on 17 chains (below). Ethereum as the destination is not priced yet (refused, `route-unpriced`).
|
|
8
|
+
- One source transaction: `deposit` on the source SpokePool — a **direct deposit**, empty message, no exclusive relayer, a fill deadline two hours after the quote time. An ERC-20 input is approved for exactly the input amount, to the pinned SpokePool; the native coin is sent as `value` and wrapped by the SpokePool.
|
|
9
|
+
- Priced from **Across API V5** against **Across's relayer fee** (below). V5's own execution steps (`nextActions`) are never run.
|
|
10
|
+
- No provider SDK: `viem` for the ABI and hashing.
|
|
11
|
+
|
|
12
|
+
The V5 key belongs on a server. Run the provider there, behind `createSwap2Handler`, and the remote provider in the app — it re-runs every check below on the device:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// server
|
|
16
|
+
import {acrossProvider} from "@anywalletkit/protocol-swap2-across";
|
|
17
|
+
import {createSwap2Handler} from "@anywalletkit/protocol-swap2-core/server";
|
|
18
|
+
const across = acrossProvider({apiKey: () => process.env.ACROSS_API_KEY, rpcUrls});
|
|
19
|
+
const handle = createSwap2Handler({providers: [across, /* … */], sealSecret, guard, subject});
|
|
20
|
+
|
|
21
|
+
// app
|
|
22
|
+
import {acrossRemoteProvider} from "@anywalletkit/protocol-swap2-across";
|
|
23
|
+
import {CrossChainRouter} from "@anywalletkit/protocol-swap2-router";
|
|
24
|
+
const router = new CrossChainRouter([acrossRemoteProvider({baseUrl: "https://api.example.com/swap2", rpcUrls}) /*, … */]);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Standalone (server): `new AcrossSwap2Protocol(account, {fromChain: "eip155:8453", apiKey})`. Conventional env names: `ACROSS_ENABLED`, `ACROSS_API_KEY` (the V5 key from dashboard.across.to). Across's integrator id and its V4 key are not used.
|
|
28
|
+
|
|
29
|
+
| `acrossProvider` option | |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `apiKey` | The Across API V5 key, a getter (read on every request) or a string. Sent only as `Authorization: Bearer` to `baseUrl`; an answer that came through a redirect is refused. Without one the provider is disabled (it still builds, verifies and tracks). **Under React Native it throws**: an app bundle keeps no secret. |
|
|
32
|
+
| `enabled` | Dark flag (default true). |
|
|
33
|
+
| `baseUrl` | V5 origin, default `https://api.across.to` (https only; http only for localhost). |
|
|
34
|
+
| `suggestedFeesUrl` | Across's keyless relayer-fee quote, default `https://app.across.to/api/suggested-fees`; `null` prices every quote from the pinned floor. |
|
|
35
|
+
| `rpcUrls` | JSON-RPC URL per CAIP-2 chain: status (the source chain's to read the deposit, the destination's to read its fill), and the quote time when `/suggested-fees` does not answer (Ethereum's and the source chain's latest block). |
|
|
36
|
+
| `maxFeeBps` | The most a deposit may leave to relayers (input − output), in bps of the input. Default 1000, at most 5000. |
|
|
37
|
+
| `quoteTtlMs`, `timeoutMs`, `fetchImpl` | Local quote life (default 60 s, at most 5 min), per-request timeout (default 10 s), your own `fetch`. |
|
|
38
|
+
|
|
39
|
+
`acrossRemoteProvider({baseUrl, maxFeeBps?, rpcUrls?, suggestedFeesUrl?, headers?, timeoutMs?, fetchImpl?})`: the app's fee cap (the server's is not known on this side), and with `rpcUrls` for both chains the deposit's status is read on the device instead of asked of the backend. For every quote the backend sends, dry or live, the app reads **Across's keyless relayer fee itself** (`https://app.across.to/api/suggested-fees` through `fetchImpl` — a browser app's CSP must allow it in `connect-src`; nothing secret is sent) and refuses a deposit that leaves relayers more than 10 % under it (`relayer-price`, `price_check_failed`): a backend cannot get a deposit signed that relayers would leave unfilled, nor win the router's comparison with one. Across refusing the deposit refuses the quote; no answer leaves only routes the pinned floor covers (below), on the per-asset floor, and refuses the rest (`upstream_unavailable`). `suggestedFeesUrl: null` turns the read off, with that same fallback. Right before signing, `preflightDeposit` runs the whole check again by the device's clock before the backend is asked.
|
|
40
|
+
|
|
41
|
+
## Pricing
|
|
42
|
+
|
|
43
|
+
The one number a quote source decides is how much the deposit leaves to relayers. Too much asked of relayers (output too high) and nobody fills: the funds wait for the two-hour fill deadline and then Across's refund bundles. Too little and the user overpays. A V5 quote prices **V5's own route**, not a direct deposit: an execution step on the origin chain (Across's Gateway, its gas charged inside the fee — over $1 on Ethereum origins), sometimes another rail (USDT Ethereum → Arbitrum went to a ~20-minute rail), and an auction whose relayers take large ETH L2 → L2 transfers at ~1 bp, well below what direct deposits are filled at. So the provider (on the server) prices:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
F5 = V5 fee.totalFee − Σ V5 gasEstimates[origin, included_in_transfer_fee] (wei on ETH routes; else USD at the token's price, rounded down)
|
|
47
|
+
Fneed = /suggested-fees totalRelayFee.total while Across answers it
|
|
48
|
+
= floor(asset, origin, size) + 1.5 × V5's destination gas otherwise
|
|
49
|
+
fee = max(F5, Fneed); outputAmount = input − fee
|
|
50
|
+
= Fneed from /suggested-fees alone, when V5's fill estimate is over a minute (V5 priced another rail)
|
|
51
|
+
quoteTimestamp = /suggested-fees `timestamp` (its LP fee was priced there; never ahead of the server's clock), else min(Ethereum's latest block − 60 s, the source chain's)
|
|
52
|
+
fillDeadline = quoteTimestamp + 7200; exclusiveRelayer = 0
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Never more than V5 charges for the same transfer (net of the step a direct deposit does not have; the user's wallet pays the deposit's own gas), never less than direct deposits are filled at. Study of 2026-11-14 (27 V5 / `/suggested-fees` pairs, 8 272 deposits over 24 h on Ethereum, Optimism, Base, Arbitrum): 1 369 of 1 369 organic plain deposits to Base, Arbitrum and Optimism priced at or above the relayer fee were filled — p50 2 s, p90 13 s, p99 76 s.
|
|
56
|
+
- When V5's `expectedFillTimeMs` is over a minute it priced another rail (a CCTP or OFT transfer: USDT Ethereum → Arbitrum at ~20 min and 12× the relayer fee), which is no bound on a direct deposit: the deposit is then priced on `/suggested-fees` alone, and refused without it (`route-unpriced`, `upstream_unavailable`) — never on the floor or on V5.
|
|
57
|
+
- V5 is asked with `maxFee.bps = 5000`: that bounds only V5's own guaranteed minimum (never used); at 1000 it refused Ethereum-origin transfers under ~$17 because of its own origin gas. The user's cap is held on the deposit.
|
|
58
|
+
- The floor without `/suggested-fees` (read off 24 h of fills): stablecoins 1.00 bp, WBTC 3.10 bps, ETH from Ethereum 1.00 bp, ETH from an L2 4.77 bps at $0 → 5.4 at $2 000 → 9.2 at $36 000 (linear), refused above $36 000. It covers Ethereum, Optimism, Base and Arbitrum to Optimism, Base and Arbitrum; other routes are refused without `/suggested-fees` (`relayer-price`) rather than priced on a guess. Across calls `/suggested-fees` legacy: the floor is a snapshot of today's market, and the watch's canary turns `warn` when it answers no more (`fail` when it refuses a pinned corridor).
|
|
59
|
+
- `/suggested-fees` refusing the deposit — any 400: `AMOUNT_TOO_LOW`, `AMOUNT_TOO_HIGH`, `ROUTE_NOT_ENABLED`, `INVALID_PARAM` for a token or chain it does not serve (`unsupported_pair`), a code this module does not know — or `isAmountTooLow`, outside its `limits`, refuses the quote; naming another SpokePool than the pinned one refuses it too (`vault_mismatch`: the pins need a review). Only no answer, a 404 / 5xx, or an answer of another shape falls back to the floor.
|
|
60
|
+
- `providerData` shows how the number was reached: `priceSource` (`suggested-fees`, `suggested-fees (V5 other rail)` or `floor`), `v5Fee` (F5) and `relayerFee` (Fneed), base units.
|
|
61
|
+
|
|
62
|
+
## What is checked
|
|
63
|
+
|
|
64
|
+
Every check has a code; a refusal reads `across: <what was found> [<code>]`. Next to the text it carries `reason`, a stable `Swap2RefusalReason` from `@anywalletkit/protocol-swap2-core` (on the thrown error, as `onRefusal`'s second argument, and through `acrossPins.reasonOf` for the pins' texts): `recipient_mismatch` for a deposit crediting or paying someone else, `vault_mismatch` for a call or approval off the pinned SpokePool, `price_check_failed` for an output under the floor or a fee over the cap, `quote_expired` for a quote time or fill deadline too close, `unsupported_pair` for a route this module does not serve, `policy_refused` for the rest. A malformed request from the caller carries none.
|
|
65
|
+
|
|
66
|
+
**The request names a served route** (`chain-unsupported`, `token-unsupported`, `pair-unsupported`, `native-unsupported`, `wrapped-native-destination`)
|
|
67
|
+
|
|
68
|
+
- two different pinned chains; on each side a pinned token of the same asset with the same decimals;
|
|
69
|
+
- the native coin only where it is ether and the SpokePool has a wrapped native token for it;
|
|
70
|
+
- never the wrapped native token as a destination ERC-20: the destination SpokePool unwraps it for an EOA (`_unwrapwrappedNativeTokenTo`), so WETH asked for would arrive as ETH — ask for the native coin instead.
|
|
71
|
+
|
|
72
|
+
**The transaction is a deposit on the pinned SpokePool** (`tx-chain`, `tx-target`, `tx-selector`, `tx-calldata`)
|
|
73
|
+
|
|
74
|
+
- `to` is the source chain's SpokePool, `chainId` that chain;
|
|
75
|
+
- the calldata is exactly the canonical encoding of `deposit(bytes32,…,bytes)` (selector `0xad5425c6`): clean padding, the message at the only offset the encoding allows, nothing appended — Across's API appends a marker (`73c0de`, with `1dc0de` + an integrator id before it), which this module neither sends nor accepts; every party and token word is an EVM address (upper twelve bytes zero);
|
|
76
|
+
- `unsafeDeposit`, `depositNow`, `depositV3Now`, `speedUpDeposit`, `speedUpV3Deposit`, `multicall` are refused by name, anything else as unknown.
|
|
77
|
+
|
|
78
|
+
**Its arguments are the request**
|
|
79
|
+
|
|
80
|
+
- `depositor` is the signing account (`tx-depositor`) — `QuoteParams.sender`, which the engine sets to the account that signs; it is the address refunded on the source chain and the only one whose signature can speed the deposit up (redirect its output), so it is never a `refundAddress` the caller names: a live request without `sender` is refused, and so is one whose `refundAddress` is another account (`request-invalid`, `recipient_mismatch`); `recipient` is the user's recipient (`tx-recipient`); `destinationChainId` the requested chain (`tx-destination`);
|
|
81
|
+
- `inputToken` is the pinned token, the wrapped native token for the native coin (`tx-input-token`); `inputAmount` exactly the requested amount (`tx-input-amount`);
|
|
82
|
+
- `outputToken` is the same asset on the destination, the wrapped native token for the native coin (`tx-output-token`); `outputAmount` is above zero, at least the caller's floor, and not more than the input — a deposit asking relayers for more than it puts in is never filled (`tx-output-amount`); input − output is at least what relayers take on that asset — stablecoins 1.0 bp, ETH from Ethereum 0.7 bp, ETH from Optimism, Base or Arbitrum 4.5 bps, ETH from another L2 0.7 bp (Across's own relayer fee from Linea and Ink was 1.27 and 2.71 bps; those routes are priced only on it), WBTC 2.5 bps, at or under the lowest fees direct deposits were filled at (zero is refused by name: a deposit relayers do not fill waits hours for its refund, while its output would win any comparison of routes) — and within `maxFeeBps` (`tx-fee`);
|
|
83
|
+
- `message` is empty: a message starting with Across's V5 witness prefix (`keccak256("AcrossV5MessagePrefix.V1")`) is refused as `tx-message-v5`, any other as `tx-message`;
|
|
84
|
+
- no exclusivity: no exclusive relayer and no window — this module never sets one, and a relayer a quote source names would be the only one allowed to fill (`tx-exclusivity`);
|
|
85
|
+
- `quoteTimestamp` is at most 15 s ahead (the SpokePool reverts one ahead of its block; an honest one is minutes in the past) and at most 3600 − 300 s old — the SpokePool takes 3600 s, 300 s are kept for the deposit to land (`tx-quote-time`);
|
|
86
|
+
- `fillDeadline` is at least 30 min ahead, within the SpokePool's 6 h buffer, at most 7800 s after the quote time (Across's API gives 7200 s; an unfilled deposit holds the funds until then, and its refund comes after), and at least 3600 + 1800 s after it — the SpokePool has no lower bound on the fill deadline and takes the deposit until the quote time is 3600 s old, so a deposit that waits to be mined could otherwise land already expired (`tx-fill-deadline`);
|
|
87
|
+
- `value` is the input amount for the native coin and 0 otherwise (`tx-value`); an ERC-20 deposit approves the pinned SpokePool, a native one approves nothing (`tx-approval`).
|
|
88
|
+
|
|
89
|
+
**Around it**
|
|
90
|
+
|
|
91
|
+
- `buildAcrossDeposit(request, normalizedQuote)` encodes the call from the pins and the request and runs the verifier on its own result; `acrossQuoteOf` turns it into a swap2 `Quote` whose amounts are the deposit's (a relayer pays exactly `outputAmount`, so it is both the expected and the guaranteed output) and whose id names the calldata (`across:<from>:<to>:<digest>`).
|
|
92
|
+
- `buildDeposit` and `preflightDeposit` run the verifier again on the exact transaction about to be signed; `preflightDeposit` refuses typed data, a memo or a serialized transaction (`tx-shape`), and an Across speed-up signature by name (`speed-up`). `isAcrossSpeedUpTypedData` is exported for a wallet's signing guard.
|
|
93
|
+
- A dry quote (pricing only, priced for the caller's addresses or a placeholder) is never built or signed; a remote client derives the same request from the same parameters to verify it.
|
|
94
|
+
- `acrossPins` gives `remoteProvider` the same checks on the client of a swap2 server: `callTargets` / `spenders` are the SpokePool, `verifyQuote` and `verifyBuild` run the verifier against the user's own request, plus the gas limit band (`quote-gas`), a quote life of at most five minutes plus clock skew and never past quote time + 3300 s, when a deposit signed then would revert on its quote time (`quote-expiry`), and an id that names the deposit (`quote-intent`; a server's `~<tag>` suffix is accepted). It holds remote quotes to the default fee cap (10 %); `acrossPinsWith({maxFeeBps})` gives the pins the app's own cap — a server's `acrossProvider({maxFeeBps})` is not known on the client.
|
|
95
|
+
- The amounts a quote shows are the deposit's; the quote source's `expectedOutputAmount` is refused above `outputAmount` (`quote-normalized`), and `feeUsd` is the verified fee itself for USDC / USDT (one unit a dollar) and 0 for ETH and WBTC (no price here) — never the quote source's own USD figure. The fee in base units is in `fees`: exactly one included `protocol` fee of input − output in the input token (the zero address for the native coin). The pins hold a remote quote's `fees`, `feeUsd` and `destDecimals` to exactly that (`quote-amounts`): the engine's fee caps (`maxProtocolFeeBps`) add up `fees`, and the router scores by `feeUsd`.
|
|
96
|
+
|
|
97
|
+
**What a quote source can still do**
|
|
98
|
+
|
|
99
|
+
It cannot get a deposit signed for another recipient, depositor, chain, token, amount in, message or SpokePool, nor for an output under the caller's floor, a fee over the cap or under what relayers take on that asset. It chooses the numbers within those bounds: a worse (but capped) output, or a fill deadline inside the limits above (this provider sets two hours). Through `acrossRemoteProvider` the fee is also held to Across's own relayer fee, read on the device (10 % tolerance); with that read off or unanswered, a fee just over the per-asset floor can still be one relayers' prices have risen past on a route the floor covers. A deposit nobody fills is refunded to the signer on the source chain after its fill deadline (at most 7800 s after its quote time) — money is delayed by hours, not lost.
|
|
100
|
+
|
|
101
|
+
## What is refused by design
|
|
102
|
+
|
|
103
|
+
- **Periphery routes**: origin swaps (`swapAndBridge*`), `depositNative` through the periphery, gasless deposits — their target is not the SpokePool (`tx-target`). The native coin goes straight to the SpokePool's own `deposit`.
|
|
104
|
+
- **CCTP and OFT routes** Across's API may return (Circle's TokenMessengerV2, USDT0 OFT): not a SpokePool (`tx-target`).
|
|
105
|
+
- **Destination actions and any non-empty message**, including the MulticallHandler routes Across uses even for some bridge-only quotes (WETH → WETH): the recipient must be the user and nothing may run.
|
|
106
|
+
- **Speed-ups** (`UpdateDepositDetails` under the `ACROSS-V2` domain): never produced, refused if offered.
|
|
107
|
+
- Integrator / app fees, non-EVM chains, same-chain swaps, exact-output.
|
|
108
|
+
|
|
109
|
+
## After the deposit
|
|
110
|
+
|
|
111
|
+
`trackIntent` reads the chains, not Across (with `rpcUrls` for both chains):
|
|
112
|
+
|
|
113
|
+
1. the source receipt: a reverted deposit is `failed`; the deposit is the one `FundsDeposited` of the pinned SpokePool whose fields make the intent's own calldata — the canonical `deposit` call they encode hashes to the intent id's digest (an offset exclusivity resolved against the source block's time) — so another deposit in the transaction, or another transaction's, is never taken for it; a mined transaction without exactly one stays `pending` (a node with partial logs is not a failure);
|
|
114
|
+
2. the relay hash, computed as the destination SpokePool computes it (`keccak256(abi.encode(V3RelayData, destinationChainId))`);
|
|
115
|
+
3. the destination's `fillStatuses(relayHash)` at the latest block, with that block's time:
|
|
116
|
+
|
|
117
|
+
| on chain | swap2 |
|
|
118
|
+
|---|---|
|
|
119
|
+
| no receipt yet, or no source RPC | `pending` |
|
|
120
|
+
| deposit seen, no destination RPC | `pending` (deposit received) |
|
|
121
|
+
| `fillStatuses` 0 or 1, block time ≤ fill deadline | `pending` (deposit received) |
|
|
122
|
+
| `fillStatuses` 2 | `completed` |
|
|
123
|
+
| `fillStatuses` 0 or 1, block time > fill deadline | `expired` — no fill can land any more; Across refunds the depositor on the source chain through its settlement bundles, in hours |
|
|
124
|
+
|
|
125
|
+
A node that does not answer leaves the status `pending`; nothing is signed on what tracking reads. `trackAcrossDeposit` returns the deposit, the relay hash, the fill state (`unfilled`, `slow-fill-requested`, `filled`, `expired`) and the destination block alongside. The refund itself is not detected, so an expired deposit is reported `expired` (terminal: a poller stops) rather than a `refund-pending` that would never move on. The fill status is read at the destination's `latest` block from the app's own RPC (`rpcUrls`): `safe` / `finalized` tags are not served alike on every pinned chain and would hold `completed` back by minutes to an hour.
|
|
126
|
+
|
|
127
|
+
Activity: a `deposit` or `depositV3` call on a pinned SpokePool is recognised (`Bridged USDC`, `Across · Base`). Deposits made through another contract (the periphery, an aggregator, a Safe) and the fill (an ordinary transfer from a relayer) are not claimed.
|
|
128
|
+
|
|
129
|
+
## Pins
|
|
130
|
+
|
|
131
|
+
Read on 2026-11-15 from github.com/across-protocol/contracts @ `d652689f` (`broadcast/deployed-addresses.json`), the HubPool's `crossChainContracts(chainId)` on Ethereum (`0xc186fa914353c44b2e33ebe05f21846f1048beda`), and each SpokePool on chain (`chainId()`, `wrappedNativeToken()`, the 3600 s / 21600 s buffers, `pausedDeposits()` false, the deposit selector in the implementation; on zkSync Era a real deposit traced instead). Tokens from Across's own route and token lists, intersected with the SDK catalog.
|
|
132
|
+
|
|
133
|
+
| chain | SpokePool | tokens |
|
|
134
|
+
|---|---|---|
|
|
135
|
+
| Ethereum | `0x5c7bcd6e7de5423a257d81b442095a1a6ced35c5` | ETH, USDC, USDT, WETH, WBTC |
|
|
136
|
+
| Optimism | `0x6f26bf09b1c792e3228e5467807a900a503c0281` | ETH, USDC, USDT, WETH |
|
|
137
|
+
| Unichain | `0x09aea4b2242abc8bb4bb78d537a67a245a7bec64` | ETH, USDC, USDT0, WETH |
|
|
138
|
+
| Polygon | `0x9295ee1d8c5b022be115a2ad3c30c72e34e7f096` | USDC, USDT, WBTC |
|
|
139
|
+
| Monad | `0xd2ecb3afe598b746f8123cae365a598da831a449` | USDC, USDT0 |
|
|
140
|
+
| zkSync Era | `0xe0b015e54d54fc84a6cb9b666099c46ade9335ff` | ETH, USDT, WETH, WBTC |
|
|
141
|
+
| World Chain | `0x09aea4b2242abc8bb4bb78d537a67a245a7bec64` | ETH, USDC, WETH, WBTC |
|
|
142
|
+
| HyperEVM | `0x35e63ea3eb0fb7a3bc543c71fb66412e1f6b0e04` | USDC, USDT0 |
|
|
143
|
+
| MegaETH | `0x3db06da8f0a24a525f314eec954fc5c6a973d40e` | ETH, USDT0, WETH |
|
|
144
|
+
| Robinhood Chain | `0xd29c85f15df544ba632c9e25829fd29d767d7978` | ETH, WETH |
|
|
145
|
+
| Arc | `0x9b4a302a548c7e313c2b74c461db7b84d3074a84` | USDC (the 6-decimal interface of the gas coin; no native deposits) |
|
|
146
|
+
| Base | `0x09aea4b2242abc8bb4bb78d537a67a245a7bec64` | ETH, USDC, USDT, WETH |
|
|
147
|
+
| Plasma | `0x50039faefebef707cfd94d6d462fe6d10b39207a` | USDT0 |
|
|
148
|
+
| Arbitrum | `0xe35e9842fceaca96570b734083f4a58e8f7c5f2a` | ETH, USDC, USDT0, WETH, WBTC |
|
|
149
|
+
| Avalanche | `0xfe9d541c92e4e90437c7152a00244886de37a658` | USDC, USDT |
|
|
150
|
+
| Ink | `0xef684c38f94f48775959ecf2012d7e864ffb9dd4` | ETH, USDC, USDT0, WETH |
|
|
151
|
+
| Linea | `0x7e63a5f1a8f0b4d0934b2f2327daed3f6bb2ee75` | ETH, USDC, USDT, WETH, WBTC |
|
|
152
|
+
|
|
153
|
+
WETH is a source only (as a destination it arrives as ETH). USDT and USDT0 are one asset (Tether's USDT), as Across bridges them.
|
|
154
|
+
|
|
155
|
+
Not pinned: Scroll (deposits paused on chain), BNB Chain (Across moves its 18-decimal Binance-Peg USDC / USDT only into other assets), and the Across chains the SDK does not carry. `watch.json` has the watch job read each SpokePool's implementation and `pausedDeposits()`, the HubPool's registry entry for every pinned chain, the HubPool's code and owner, `deployed-addresses.json`, `SpokePool.sol`, `V3SpokePoolInterface.sol` and Across's V5 integration notes.
|
|
156
|
+
|
|
157
|
+
## Limits
|
|
158
|
+
|
|
159
|
+
- SpokePools are UUPS proxies the HubPool's owner (a 3-of-5 Safe) can upgrade or re-point; the pins hold the addresses, the watch job reports an upgrade or a re-pointed registry entry, and the decoder refuses any call it does not know.
|
|
160
|
+
- A fill pays a contract recipient the wrapped native token instead of the native coin (only EOAs and EIP-7702 wallets are unwrapped to); the module cannot tell a contract recipient from here.
|
|
161
|
+
- A refund of a native-coin deposit is expected in the wrapped native token: Across's settlement pays refunds as ERC-20 transfers and never unwraps (read from the contract, not yet observed).
|
|
162
|
+
- The device bounds the price, it cannot verify it: the fee cap (`maxFeeBps`, and the app's `acrossPinsWith({maxFeeBps})`) and the per-asset floor. The floors are today's relayer market (2026-11-14); if relayers' prices rise past them a server could still name a fee no relayer takes, which ends in a refund after the fill deadline.
|
|
163
|
+
- Stablecoin transfers cost a few cents more than the relayer market (V5's own fixed overhead stands in F5); large ETH L2 → L2 transfers cost ~2.7 bps more than V5's own route, whose auction relayers take less than direct deposits are filled at. A funded test of a direct ETH deposit at V5's price would show whether that gap can close.
|
|
164
|
+
- `/suggested-fees` is Across's legacy relayer-fee quote; without it the pinned floor prices only the studied chains.
|
|
165
|
+
- A quote's minimum is its output: a relayer pays exactly `outputAmount`, so `toTokenAmountMin` equals `toTokenAmount`. The engine quotes again when it executes, so pass `minAmountOut` a few bps under the quote (`suggestSlippage` gives at least 5): with the quoted minimum itself, a new price a few base units lower refuses the swap (`tx-output-amount`). On 2026-11-15 a 1.9 USDC Base → Arbitrum quote came back 15 base units lower (0.8 bps) at execution.
|
|
166
|
+
|
|
167
|
+
## Checks
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
pnpm test # codec on real calldata, pins against Across's files and the HubPool, a negative for every check,
|
|
171
|
+
# status on recorded receipts and fill statuses (filled, unfilled, expired), activity, refusal reasons,
|
|
172
|
+
# real V5 and /suggested-fees answers through the pricing rule, the engine and createSwap2Handler
|
|
173
|
+
ACROSS_LIVE=1 ACROSS_API_KEY=… pnpm test tests/live.test.ts # live quotes, verified, built, preflighted (read-only)
|
|
174
|
+
pnpm verify:live # keyless: every pin on chain and /suggested-fees on nine corridors; with ACROSS_API_KEY: live quotes
|
|
175
|
+
# through the provider, acrossPins and the server handler (read-only)
|
|
176
|
+
node scripts/record-fixtures.mjs # re-record the status and activity fixtures (read-only, public RPCs)
|
|
177
|
+
ACROSS_API_KEY=… node scripts/record-quotes.mjs # re-record fixtures/api/quotes through the real provider (read-only)
|
|
178
|
+
```
|
|
@@ -0,0 +1,142 @@
|
|
|
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
|
+
ACROSS_MODULE: () => ACROSS_MODULE,
|
|
24
|
+
describeAcrossActivity: () => describeAcrossActivity
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(activity_exports);
|
|
27
|
+
var import_activity = require("@anywalletkit/protocol-swap2-core/activity");
|
|
28
|
+
|
|
29
|
+
// src/config.ts
|
|
30
|
+
var USDC = (address, symbol = "USDC") => Object.freeze({ asset: "USDC", address, symbol, decimals: 6 });
|
|
31
|
+
var USDT = (address, symbol = "USDT") => Object.freeze({ asset: "USDT", address, symbol, decimals: 6 });
|
|
32
|
+
var WETH = (address) => Object.freeze({ asset: "ETH", address, symbol: "WETH", decimals: 18 });
|
|
33
|
+
var WBTC = (address) => Object.freeze({ asset: "WBTC", address, symbol: "WBTC", decimals: 8 });
|
|
34
|
+
var OP_WETH = "0x4200000000000000000000000000000000000006";
|
|
35
|
+
function chain(chainId, key, name, spokePool, wrappedNative, nativeIsEth, tokens) {
|
|
36
|
+
return Object.freeze({ caip2: `eip155:${chainId}`, chainId, key, name, spokePool, wrappedNative, nativeIsEth, tokens: Object.freeze(tokens) });
|
|
37
|
+
}
|
|
38
|
+
var ACROSS_CHAINS = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), Object.fromEntries([
|
|
39
|
+
chain(1, "ethereum", "Ethereum", "0x5c7bcd6e7de5423a257d81b442095a1a6ced35c5", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", true, [
|
|
40
|
+
USDC("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"),
|
|
41
|
+
USDT("0xdac17f958d2ee523a2206206994597c13d831ec7"),
|
|
42
|
+
WETH("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"),
|
|
43
|
+
WBTC("0x2260fac5e5542a773aa44fbcfedf7c193bc2c599")
|
|
44
|
+
]),
|
|
45
|
+
chain(10, "optimism", "Optimism", "0x6f26bf09b1c792e3228e5467807a900a503c0281", OP_WETH, true, [
|
|
46
|
+
USDC("0x0b2c639c533813f4aa9d7837caf62653d097ff85"),
|
|
47
|
+
USDT("0x94b008aa00579c1307b0ef2c499ad98a8ce58e58"),
|
|
48
|
+
WETH(OP_WETH)
|
|
49
|
+
]),
|
|
50
|
+
chain(130, "unichain", "Unichain", "0x09aea4b2242abc8bb4bb78d537a67a245a7bec64", OP_WETH, true, [
|
|
51
|
+
USDC("0x078d782b760474a361dda0af3839290b0ef57ad6"),
|
|
52
|
+
USDT("0x9151434b16b9763660705744891fa906f660ecc5", "USDT0"),
|
|
53
|
+
WETH(OP_WETH)
|
|
54
|
+
]),
|
|
55
|
+
chain(137, "polygon", "Polygon", "0x9295ee1d8c5b022be115a2ad3c30c72e34e7f096", "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", false, [
|
|
56
|
+
USDC("0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"),
|
|
57
|
+
USDT("0xc2132d05d31c914a87c6611c10748aeb04b58e8f"),
|
|
58
|
+
WBTC("0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6")
|
|
59
|
+
]),
|
|
60
|
+
chain(143, "monad", "Monad", "0xd2ecb3afe598b746f8123cae365a598da831a449", "0x3bd359c1119da7da1d913d1c4d2b7c461115433a", false, [
|
|
61
|
+
USDC("0x754704bc059f8c67012fed69bc8a327a5aafb603"),
|
|
62
|
+
USDT("0xe7cd86e13ac4309349f30b3435a9d337750fc82d", "USDT0")
|
|
63
|
+
]),
|
|
64
|
+
chain(324, "zksync", "zkSync Era", "0xe0b015e54d54fc84a6cb9b666099c46ade9335ff", "0x5aea5775959fbc2557cc8789bc1bf90a239d9a91", true, [
|
|
65
|
+
USDT("0x493257fd37edb34451f62edf8d2a0c418852ba4c"),
|
|
66
|
+
WETH("0x5aea5775959fbc2557cc8789bc1bf90a239d9a91"),
|
|
67
|
+
WBTC("0xbbeb516fb02a01611cbbe0453fe3c580d7281011")
|
|
68
|
+
]),
|
|
69
|
+
chain(480, "worldchain", "World Chain", "0x09aea4b2242abc8bb4bb78d537a67a245a7bec64", OP_WETH, true, [
|
|
70
|
+
USDC("0x79a02482a880bce3f13e09da970dc34db4cd24d1"),
|
|
71
|
+
WETH(OP_WETH),
|
|
72
|
+
WBTC("0x03c7054bcb39f7b2e5b2c7acb37583e32d70cfa3")
|
|
73
|
+
]),
|
|
74
|
+
chain(999, "hyperevm", "HyperEVM", "0x35e63ea3eb0fb7a3bc543c71fb66412e1f6b0e04", "0x5555555555555555555555555555555555555555", false, [
|
|
75
|
+
USDC("0xb88339cb7199b77e23db6e890353e22632ba630f"),
|
|
76
|
+
USDT("0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb", "USDT0")
|
|
77
|
+
]),
|
|
78
|
+
chain(4326, "megaeth", "MegaETH", "0x3db06da8f0a24a525f314eec954fc5c6a973d40e", OP_WETH, true, [
|
|
79
|
+
USDT("0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb", "USDT0"),
|
|
80
|
+
WETH(OP_WETH)
|
|
81
|
+
]),
|
|
82
|
+
chain(4663, "robinhood", "Robinhood Chain", "0xd29c85f15df544ba632c9e25829fd29d767d7978", "0x0bd7d308f8e1639fab988df18a8011f41eacad73", true, [
|
|
83
|
+
WETH("0x0bd7d308f8e1639fab988df18a8011f41eacad73")
|
|
84
|
+
]),
|
|
85
|
+
// Arc's gas coin is USDC; 0x3600… is its 6-decimal ERC-20 interface, which is what Across moves. The SpokePool
|
|
86
|
+
// reports no wrapped native token, so no deposit or fill on Arc involves the native coin.
|
|
87
|
+
chain(5042, "arc", "Arc", "0x9b4a302a548c7e313c2b74c461db7b84d3074a84", null, false, [
|
|
88
|
+
USDC("0x3600000000000000000000000000000000000000")
|
|
89
|
+
]),
|
|
90
|
+
chain(8453, "base", "Base", "0x09aea4b2242abc8bb4bb78d537a67a245a7bec64", OP_WETH, true, [
|
|
91
|
+
USDC("0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"),
|
|
92
|
+
USDT("0xfde4c96c8593536e31f229ea8f37b2ada2699bb2"),
|
|
93
|
+
WETH(OP_WETH)
|
|
94
|
+
]),
|
|
95
|
+
chain(9745, "plasma", "Plasma", "0x50039faefebef707cfd94d6d462fe6d10b39207a", "0x6100e367285b01f48d07953803a2d8dca5d19873", false, [
|
|
96
|
+
USDT("0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb", "USDT0")
|
|
97
|
+
]),
|
|
98
|
+
chain(42161, "arbitrum", "Arbitrum", "0xe35e9842fceaca96570b734083f4a58e8f7c5f2a", "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", true, [
|
|
99
|
+
USDC("0xaf88d065e77c8cc2239327c5edb3a432268e5831"),
|
|
100
|
+
USDT("0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", "USDT0"),
|
|
101
|
+
WETH("0x82af49447d8a07e3bd95bd0d56f35241523fbab1"),
|
|
102
|
+
WBTC("0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f")
|
|
103
|
+
]),
|
|
104
|
+
chain(43114, "avalanche", "Avalanche", "0xfe9d541c92e4e90437c7152a00244886de37a658", "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false, [
|
|
105
|
+
USDC("0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e"),
|
|
106
|
+
USDT("0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7")
|
|
107
|
+
]),
|
|
108
|
+
chain(57073, "ink", "Ink", "0xef684c38f94f48775959ecf2012d7e864ffb9dd4", OP_WETH, true, [
|
|
109
|
+
USDC("0x2d270e6886d130d724215a266106e6832161eaed"),
|
|
110
|
+
USDT("0x0200c29006150606b650577bbe7b6248f58470c1", "USDT0"),
|
|
111
|
+
WETH(OP_WETH)
|
|
112
|
+
]),
|
|
113
|
+
chain(59144, "linea", "Linea", "0x7e63a5f1a8f0b4d0934b2f2327daed3f6bb2ee75", "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f", true, [
|
|
114
|
+
USDC("0x176211869ca2b568f2a7d4ee941e073a821ee1ff"),
|
|
115
|
+
USDT("0xa219439258ca9da29e9cc4ce5596924745e12b93"),
|
|
116
|
+
WETH("0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f"),
|
|
117
|
+
WBTC("0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4")
|
|
118
|
+
])
|
|
119
|
+
].map((x) => [x.caip2, x]))));
|
|
120
|
+
function acrossChain(caip2) {
|
|
121
|
+
return typeof caip2 === "string" && Object.prototype.hasOwnProperty.call(ACROSS_CHAINS, caip2) ? ACROSS_CHAINS[caip2] : void 0;
|
|
122
|
+
}
|
|
123
|
+
var ACROSS_DEPOSIT = "0xad5425c6";
|
|
124
|
+
var ACROSS_DEPOSIT_V3 = "0x7b939232";
|
|
125
|
+
var ACROSS_REFUSED_SELECTORS = Object.freeze({
|
|
126
|
+
"0x8b15788e": "unsafeDeposit",
|
|
127
|
+
"0xea86bd46": "depositNow",
|
|
128
|
+
"0x7aef642c": "depositV3Now",
|
|
129
|
+
"0xbabb6aac": "speedUpDeposit",
|
|
130
|
+
"0x577f51f8": "speedUpV3Deposit",
|
|
131
|
+
"0xac9650d8": "multicall"
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// src/activity.ts
|
|
135
|
+
var ACROSS_MODULE = "@anywalletkit/protocol-swap2-across";
|
|
136
|
+
function describeAcrossActivity(tx, ctx) {
|
|
137
|
+
const chain2 = acrossChain(tx.chain);
|
|
138
|
+
if (!chain2) return null;
|
|
139
|
+
if (!(0, import_activity.matchesCall)(tx, [chain2.spokePool], [ACROSS_DEPOSIT, ACROSS_DEPOSIT_V3])) return null;
|
|
140
|
+
return (0, import_activity.describeSwapLike)(tx, ctx, { protocol: ACROSS_MODULE, subtitle: `Across \xB7 ${(0, import_activity.chainLabel)(tx.chain)}`, kind: "bridge", outVerb: "Bridged" });
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=activity.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/activity.ts","../src/config.ts"],"sourcesContent":["/**\n * Activity recognition for Across on every pinned chain: a `deposit` / `depositV3` call on the chain's SpokePool is our\n * source leg (\"Bridged USDC\").\n *\n * Deposits that reach the SpokePool through another contract (Across's periphery, an aggregator, a Safe) are not\n * claimed: the call the history shows is that contract's. The destination leg is not claimed either — a fill is paid\n * by one of many relayers as an ordinary token transfer (or a native payment when the wrapped native token is\n * unwrapped) and reads as a plain incoming transfer.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {chainLabel, describeSwapLike, matchesCall} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {ACROSS_DEPOSIT, ACROSS_DEPOSIT_V3, acrossChain} from \"./config.js\";\n\nexport const ACROSS_MODULE = \"@anywalletkit/protocol-swap2-across\";\n\nexport function describeAcrossActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n const chain = acrossChain(tx.chain);\n if (!chain) return null;\n // Both deposit functions are read here (history is not ours alone); only `deposit` is ever built or signed.\n if (!matchesCall(tx, [chain.spokePool], [ACROSS_DEPOSIT, ACROSS_DEPOSIT_V3])) return null;\n return describeSwapLike(tx, ctx, {protocol: ACROSS_MODULE, subtitle: `Across · ${chainLabel(tx.chain)}`, kind: \"bridge\", outVerb: \"Bridged\"});\n}\n","// Across Protocol — the pins this module signs against. Nothing here is read from an API at run time: the Across API\n// (or an app's own proxy in front of it) is untrusted, and a deposit is signed only for a SpokePool, a chain and a\n// token written in this file.\n//\n// Sources, all read on 2026-11-15:\n// - github.com/across-protocol/contracts @ d652689f67cd9835b9c1ab0acc2f99236902e299, `broadcast/deployed-addresses.json`\n// (\"the current source of truth for deployed contract addresses\", deployments/README.md): `chains.<id>.contracts.\n// SpokePool.address` for every row below, `chains.1.contracts.HubPool.address` for the hub.\n// - On chain, Ethereum: `HubPool.crossChainContracts(chainId)` (selector 0x09474ae2) answers the same SpokePool for\n// every row (publicnode, block 26415696; eth.drpc.org one block later agreed on every row).\n// - On chain, each row over a public RPC: `eth_chainId` and the SpokePool's own `chainId()` are the row's id; the\n// EIP-1967 implementation slot is set (UUPS proxy, upgraded through the HubPool); `crossDomainAdmin()` is the\n// HubPool; `wrappedNativeToken()` is the value pinned below; `depositQuoteTimeBuffer()` = 3600,\n// `fillDeadlineBuffer()` = 21600 and `pausedDeposits()` = false. The implementation carries the `deposit` selector\n// as PUSH4 on every EVM-bytecode chain. zkSync Era runs EraVM bytecode, where that scan does not apply: there a real\n// deposit was traced instead (tx 0x21c702af…f0d96, `debug_traceTransaction` callTracer): a successful call into the\n// SpokePool with selector 0xad5425c6, 420 bytes (empty message), which emitted FundsDeposited.\n// - The contract: contracts/spoke-pools/SpokePool.sol and contracts/interfaces/V3SpokePoolInterface.sol at the same\n// commit (selectors, event, relay hash, fill statuses, the native-coin rules quoted where they are used).\n// - Tokens: Across's own route list (`GET /available-routes`) and token list (`GET /swap/tokens`), read 2026-11-14,\n// intersected with the SDK's asset catalog (`@anywalletkit/swap2-assets`) by address. A token is pinned only when\n// Across bridges it to the SAME asset on another pinned chain with the same decimals; routes Across lists between\n// different assets (USDC → USDC.e, USDC-BNB → USDC, USDT → USDC, USDG → USDC) are not served.\n//\n// Chains Across serves that are NOT pinned, and why:\n// - Scroll (534352): `pausedDeposits()` is true on chain (as on Lens, Mode and Zora, which the SDK does not carry) and\n// it is gone from Across's own chain page.\n// - BNB Chain (56): Across bridges its Binance-Peg USDC and USDT (18 decimals) only into other assets, and its ETH is an\n// ERC-20 the catalog does not list — no same-asset route is left.\n// - Lisk, Soneium, Tempo, Blast, Boba, Solana, Tron, HyperCore, Lighter: not EVM chains of the SDK's catalog.\n// SDK chains Across does not serve: Gnosis, Sonic, Berachain, Celo, Mantle, Katana, Morph, Flare, Elysium, Sei, Plume,\n// X Layer.\n\n/** What a token is across chains. A deposit only ever moves an asset to the same asset. */\nexport type AcrossAsset = \"USDC\" | \"USDT\" | \"ETH\" | \"WBTC\";\n\nexport interface AcrossToken {\n asset: AcrossAsset;\n /** ERC-20 contract on this chain, lowercase. */\n address: string;\n /** The catalog's symbol on this chain (Tether's USDT is `USDT0` where it is issued as USDT0). */\n symbol: string;\n decimals: number;\n}\n\nexport interface AcrossChain {\n caip2: string;\n chainId: number;\n /** The SDK's chain key (`@anywalletkit/swap2-assets`). */\n key: string;\n name: string;\n /** SpokePool proxy on that chain: the only contract a deposit calls and the only spender an approval names. */\n spokePool: string;\n /**\n * `wrappedNativeToken()` of that SpokePool. A deposit that sends the native coin names it as `inputToken`; a fill of\n * it is paid out as the native coin to an EOA. Null where the SpokePool reports the zero address (Arc).\n */\n wrappedNative: string | null;\n /** The chain's native coin is ether, bridged as the ETH asset. */\n nativeIsEth: boolean;\n /** ERC-20s Across bridges to the same asset on another pinned chain. ETH's ERC-20 is the wrapped native token. */\n tokens: readonly AcrossToken[];\n}\n\nconst USDC = (address: string, symbol = \"USDC\"): AcrossToken => Object.freeze({asset: \"USDC\", address, symbol, decimals: 6});\nconst USDT = (address: string, symbol = \"USDT\"): AcrossToken => Object.freeze({asset: \"USDT\", address, symbol, decimals: 6});\nconst WETH = (address: string): AcrossToken => Object.freeze({asset: \"ETH\", address, symbol: \"WETH\", decimals: 18});\nconst WBTC = (address: string): AcrossToken => Object.freeze({asset: \"WBTC\", address, symbol: \"WBTC\", decimals: 8});\n\n/** The OP-stack predeploy WETH9. */\nconst OP_WETH = \"0x4200000000000000000000000000000000000006\";\n\nfunction chain(\n chainId: number, key: string, name: string, spokePool: string, wrappedNative: string | null, nativeIsEth: boolean, tokens: AcrossToken[],\n): AcrossChain {\n return Object.freeze({caip2: `eip155:${chainId}`, chainId, key, name, spokePool, wrappedNative, nativeIsEth, tokens: Object.freeze(tokens)});\n}\n\n/** CAIP-2 → the chain as Across serves it. A null-prototype map: `ACROSS_CHAINS[\"constructor\"]` is undefined. */\nexport const ACROSS_CHAINS: Readonly<Record<string, AcrossChain>> = Object.freeze(Object.assign(Object.create(null) as Record<string, AcrossChain>, Object.fromEntries([\n chain(1, \"ethereum\", \"Ethereum\", \"0x5c7bcd6e7de5423a257d81b442095a1a6ced35c5\", \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\", true, [\n USDC(\"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\"),\n USDT(\"0xdac17f958d2ee523a2206206994597c13d831ec7\"),\n WETH(\"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"),\n WBTC(\"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599\"),\n ]),\n chain(10, \"optimism\", \"Optimism\", \"0x6f26bf09b1c792e3228e5467807a900a503c0281\", OP_WETH, true, [\n USDC(\"0x0b2c639c533813f4aa9d7837caf62653d097ff85\"),\n USDT(\"0x94b008aa00579c1307b0ef2c499ad98a8ce58e58\"),\n WETH(OP_WETH),\n ]),\n chain(130, \"unichain\", \"Unichain\", \"0x09aea4b2242abc8bb4bb78d537a67a245a7bec64\", OP_WETH, true, [\n USDC(\"0x078d782b760474a361dda0af3839290b0ef57ad6\"),\n USDT(\"0x9151434b16b9763660705744891fa906f660ecc5\", \"USDT0\"),\n WETH(OP_WETH),\n ]),\n chain(137, \"polygon\", \"Polygon\", \"0x9295ee1d8c5b022be115a2ad3c30c72e34e7f096\", \"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270\", false, [\n USDC(\"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359\"),\n USDT(\"0xc2132d05d31c914a87c6611c10748aeb04b58e8f\"),\n WBTC(\"0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6\"),\n ]),\n chain(143, \"monad\", \"Monad\", \"0xd2ecb3afe598b746f8123cae365a598da831a449\", \"0x3bd359c1119da7da1d913d1c4d2b7c461115433a\", false, [\n USDC(\"0x754704bc059f8c67012fed69bc8a327a5aafb603\"),\n USDT(\"0xe7cd86e13ac4309349f30b3435a9d337750fc82d\", \"USDT0\"),\n ]),\n chain(324, \"zksync\", \"zkSync Era\", \"0xe0b015e54d54fc84a6cb9b666099c46ade9335ff\", \"0x5aea5775959fbc2557cc8789bc1bf90a239d9a91\", true, [\n USDT(\"0x493257fd37edb34451f62edf8d2a0c418852ba4c\"),\n WETH(\"0x5aea5775959fbc2557cc8789bc1bf90a239d9a91\"),\n WBTC(\"0xbbeb516fb02a01611cbbe0453fe3c580d7281011\"),\n ]),\n chain(480, \"worldchain\", \"World Chain\", \"0x09aea4b2242abc8bb4bb78d537a67a245a7bec64\", OP_WETH, true, [\n USDC(\"0x79a02482a880bce3f13e09da970dc34db4cd24d1\"),\n WETH(OP_WETH),\n WBTC(\"0x03c7054bcb39f7b2e5b2c7acb37583e32d70cfa3\"),\n ]),\n chain(999, \"hyperevm\", \"HyperEVM\", \"0x35e63ea3eb0fb7a3bc543c71fb66412e1f6b0e04\", \"0x5555555555555555555555555555555555555555\", false, [\n USDC(\"0xb88339cb7199b77e23db6e890353e22632ba630f\"),\n USDT(\"0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb\", \"USDT0\"),\n ]),\n chain(4326, \"megaeth\", \"MegaETH\", \"0x3db06da8f0a24a525f314eec954fc5c6a973d40e\", OP_WETH, true, [\n USDT(\"0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb\", \"USDT0\"),\n WETH(OP_WETH),\n ]),\n chain(4663, \"robinhood\", \"Robinhood Chain\", \"0xd29c85f15df544ba632c9e25829fd29d767d7978\", \"0x0bd7d308f8e1639fab988df18a8011f41eacad73\", true, [\n WETH(\"0x0bd7d308f8e1639fab988df18a8011f41eacad73\"),\n ]),\n // Arc's gas coin is USDC; 0x3600… is its 6-decimal ERC-20 interface, which is what Across moves. The SpokePool\n // reports no wrapped native token, so no deposit or fill on Arc involves the native coin.\n chain(5042, \"arc\", \"Arc\", \"0x9b4a302a548c7e313c2b74c461db7b84d3074a84\", null, false, [\n USDC(\"0x3600000000000000000000000000000000000000\"),\n ]),\n chain(8453, \"base\", \"Base\", \"0x09aea4b2242abc8bb4bb78d537a67a245a7bec64\", OP_WETH, true, [\n USDC(\"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913\"),\n USDT(\"0xfde4c96c8593536e31f229ea8f37b2ada2699bb2\"),\n WETH(OP_WETH),\n ]),\n chain(9745, \"plasma\", \"Plasma\", \"0x50039faefebef707cfd94d6d462fe6d10b39207a\", \"0x6100e367285b01f48d07953803a2d8dca5d19873\", false, [\n USDT(\"0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb\", \"USDT0\"),\n ]),\n chain(42161, \"arbitrum\", \"Arbitrum\", \"0xe35e9842fceaca96570b734083f4a58e8f7c5f2a\", \"0x82af49447d8a07e3bd95bd0d56f35241523fbab1\", true, [\n USDC(\"0xaf88d065e77c8cc2239327c5edb3a432268e5831\"),\n USDT(\"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9\", \"USDT0\"),\n WETH(\"0x82af49447d8a07e3bd95bd0d56f35241523fbab1\"),\n WBTC(\"0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f\"),\n ]),\n chain(43114, \"avalanche\", \"Avalanche\", \"0xfe9d541c92e4e90437c7152a00244886de37a658\", \"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7\", false, [\n USDC(\"0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e\"),\n USDT(\"0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7\"),\n ]),\n chain(57073, \"ink\", \"Ink\", \"0xef684c38f94f48775959ecf2012d7e864ffb9dd4\", OP_WETH, true, [\n USDC(\"0x2d270e6886d130d724215a266106e6832161eaed\"),\n USDT(\"0x0200c29006150606b650577bbe7b6248f58470c1\", \"USDT0\"),\n WETH(OP_WETH),\n ]),\n chain(59144, \"linea\", \"Linea\", \"0x7e63a5f1a8f0b4d0934b2f2327daed3f6bb2ee75\", \"0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f\", true, [\n USDC(\"0x176211869ca2b568f2a7d4ee941e073a821ee1ff\"),\n USDT(\"0xa219439258ca9da29e9cc4ce5596924745e12b93\"),\n WETH(\"0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f\"),\n WBTC(\"0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4\"),\n ]),\n].map((x) => [x.caip2, x]))));\n\n/** The chain for a CAIP-2 id, or undefined — own keys only. */\nexport function acrossChain(caip2: string): AcrossChain | undefined {\n return typeof caip2 === \"string\" && Object.prototype.hasOwnProperty.call(ACROSS_CHAINS, caip2) ? ACROSS_CHAINS[caip2] : undefined;\n}\n\n/** The pinned token at `address` on `chain` (any casing), or undefined. */\nexport function acrossToken(chain: AcrossChain, address: string): AcrossToken | undefined {\n if (typeof address !== \"string\") return undefined;\n const a = address.toLowerCase();\n return chain.tokens.find((t) => t.address === a);\n}\n\n/**\n * The HubPool on Ethereum: `crossChainContracts(chainId)` is the registry every pinned SpokePool was checked against.\n * Not a proxy; owned by a 3-of-5 Safe that can re-point the registry and upgrade every SpokePool — a watched fact.\n */\nexport const ACROSS_HUB_POOL = \"0xc186fa914353c44b2e33ebe05f21846f1048beda\";\n/** `crossChainContracts(uint256)` on the HubPool → `(address adapter, address spokePool)`. */\nexport const ACROSS_HUB_CROSS_CHAIN_CONTRACTS = \"0x09474ae2\";\n\n/**\n * `deposit(bytes32 depositor, bytes32 recipient, bytes32 inputToken, bytes32 outputToken, uint256 inputAmount,\n * uint256 outputAmount, uint256 destinationChainId, bytes32 exclusiveRelayer, uint32 quoteTimestamp,\n * uint32 fillDeadline, uint32 exclusivityParameter, bytes message)` payable — the only call this module builds or signs.\n */\nexport const ACROSS_DEPOSIT = \"0xad5425c6\";\n/** `depositV3(address …)`: the address-typed wrapper of `deposit`. Read in history, never built or signed. */\nexport const ACROSS_DEPOSIT_V3 = \"0x7b939232\";\n/**\n * Calls on a SpokePool that are always refused: `unsafeDeposit` (a caller-chosen deposit id that can collide),\n * `depositNow` / `depositV3Now` (the fill deadline set on chain), `speedUpDeposit` / `speedUpV3Deposit` (a depositor\n * signature that lets a relayer pay another recipient or a lower amount), and `multicall`.\n */\nexport const ACROSS_REFUSED_SELECTORS: Readonly<Record<string, string>> = Object.freeze({\n \"0x8b15788e\": \"unsafeDeposit\",\n \"0xea86bd46\": \"depositNow\",\n \"0x7aef642c\": \"depositV3Now\",\n \"0xbabb6aac\": \"speedUpDeposit\",\n \"0x577f51f8\": \"speedUpV3Deposit\",\n \"0xac9650d8\": \"multicall\",\n});\n\n/**\n * `UpdateDepositDetails(uint256 depositId,uint256 originChainId,uint256 updatedOutputAmount,bytes32 updatedRecipient,\n * bytes updatedMessage)` under the domain `ACROSS-V2` / `1.0.0`: the speed-up signature. It can move a deposit's\n * output to another recipient, so nothing carrying this type (or that domain) is ever signed through this module.\n */\nexport const ACROSS_SPEED_UP_TYPEHASH = \"0x8d1994e2bbbd77564cdca06dd819e7ee2a5efa06c80dcb59a4a7b6e39edc538f\";\nexport const ACROSS_SPEED_UP_TYPE = \"UpdateDepositDetails\";\nexport const ACROSS_SPEED_UP_DOMAIN = \"ACROSS-V2\";\n\n/**\n * `FundsDeposited(bytes32 inputToken, bytes32 outputToken, uint256 inputAmount, uint256 outputAmount,\n * uint256 indexed destinationChainId, uint256 indexed depositId, uint32 quoteTimestamp, uint32 fillDeadline,\n * uint32 exclusivityDeadline, bytes32 indexed depositor, bytes32 recipient, bytes32 exclusiveRelayer, bytes message)`.\n */\nexport const ACROSS_FUNDS_DEPOSITED = \"0x32ed1a409ef04c7b0227189c3a103dc5ac10e775a15b785dcc510201f7c25ad3\";\n/** `fillStatuses(bytes32 relayHash)` → 0 unfilled, 1 slow fill requested, 2 filled. */\nexport const ACROSS_FILL_STATUSES = \"0xc35c83fc\";\n\n/**\n * `keccak256(\"AcrossV5MessagePrefix.V1\")`: a deposit message starting with these 32 bytes is an Across V5 witness,\n * consumable only through the Gateway's V5 fill entry points (SpokePool.sol `V5_MAGIC_PREFIX`). Refused by name —\n * this module signs empty messages only.\n */\nexport const ACROSS_V5_MESSAGE_PREFIX = \"0x89ae4bc75915265a3f10e926c3894a29534f1d6362ee8959cb0e5be00f3527fd\";\n\n/** `depositQuoteTimeBuffer()` on every pinned SpokePool: a deposit's `quoteTimestamp` may be at most this old. */\nexport const ACROSS_DEPOSIT_QUOTE_TIME_BUFFER_S = 3600;\n/** `fillDeadlineBuffer()` on every pinned SpokePool: a deposit's `fillDeadline` may be at most this far ahead. */\nexport const ACROSS_FILL_DEADLINE_BUFFER_S = 21_600;\n/** SpokePool `MAX_EXCLUSIVITY_PERIOD_SECONDS`: an `exclusivityParameter` up to this is an offset, above it a timestamp. */\nexport const ACROSS_MAX_EXCLUSIVITY_PERIOD_S = 31_536_000;\n\n/** The native coin in a request (and in Across's own token lists): twenty zero bytes. */\nexport const ACROSS_NATIVE = \"0x0000000000000000000000000000000000000000\";\n\n/** Across API V5: the price source (`api.ts`), with a key from dashboard.across.to kept on a server. */\nexport const ACROSS_API = \"https://api.across.to\";\n\nconst ZERO = /^0x0{40}$/;\nconst isNativeRef = (token: string): boolean => ZERO.test(token);\n\n/** One side of a route: the token as the deposit names it, and whether the user's side of it is the native coin. */\nexport interface AcrossRouteSide {\n chain: AcrossChain;\n /** The token the deposit names: the ERC-20, or the wrapped native token when `native`. */\n token: string;\n native: boolean;\n decimals: number;\n}\n\nexport interface AcrossRoute {\n asset: AcrossAsset;\n input: AcrossRouteSide;\n output: AcrossRouteSide;\n}\n\n/** Why a pair is not served, for a refusal. */\nexport interface AcrossRouteMiss {\n code: \"chain-unsupported\" | \"token-unsupported\" | \"pair-unsupported\" | \"native-unsupported\" | \"wrapped-native-destination\";\n detail: string;\n}\n\n/**\n * The route a request names, or why it is not served. `sourceToken` / `destToken` are contracts (any casing) or the\n * zero address for the native coin. Served: two different pinned chains, the same asset on both sides, the native coin\n * only where it is ether and the SpokePool wraps it, and never the wrapped native token as a destination ERC-20 — an\n * empty-message fill of it pays an EOA the native coin, which is not what was asked for.\n */\nexport function acrossRouteOf(sourceChain: string, sourceToken: string, destChain: string, destToken: string): AcrossRoute | AcrossRouteMiss {\n const src = acrossChain(sourceChain);\n const dst = acrossChain(destChain);\n if (!src) return {code: \"chain-unsupported\", detail: `source chain ${String(sourceChain)} is not a pinned Across chain`};\n if (!dst) return {code: \"chain-unsupported\", detail: `destination chain ${String(destChain)} is not a pinned Across chain`};\n if (src === dst) return {code: \"chain-unsupported\", detail: \"source and destination are the same chain\"};\n if (typeof sourceToken !== \"string\" || typeof destToken !== \"string\") return {code: \"token-unsupported\", detail: \"the tokens are not addresses\"};\n let input: AcrossRouteSide;\n let asset: AcrossAsset;\n if (isNativeRef(sourceToken)) {\n if (!src.nativeIsEth || !src.wrappedNative) return {code: \"native-unsupported\", detail: `${src.name}'s native coin is not bridged by Across`};\n input = {chain: src, token: src.wrappedNative, native: true, decimals: 18};\n asset = \"ETH\";\n } else {\n const t = acrossToken(src, sourceToken);\n if (!t) return {code: \"token-unsupported\", detail: `${sourceToken.toLowerCase()} is not a token pinned on ${src.name}`};\n input = {chain: src, token: t.address, native: false, decimals: t.decimals};\n asset = t.asset;\n }\n let output: AcrossRouteSide;\n if (isNativeRef(destToken)) {\n if (!dst.nativeIsEth || !dst.wrappedNative) return {code: \"native-unsupported\", detail: `${dst.name}'s native coin is not bridged by Across`};\n if (asset !== \"ETH\") return {code: \"pair-unsupported\", detail: `${asset} on ${src.name} is not bridged to ${dst.name}'s native coin`};\n output = {chain: dst, token: dst.wrappedNative, native: true, decimals: 18};\n } else {\n const t = acrossToken(dst, destToken);\n if (!t) return {code: \"token-unsupported\", detail: `${destToken.toLowerCase()} is not a token pinned on ${dst.name}`};\n if (dst.wrappedNative !== null && t.address === dst.wrappedNative) {\n return {code: \"wrapped-native-destination\", detail: `a fill of ${t.symbol} on ${dst.name} pays an EOA the native coin, not ${t.symbol} — ask for the native coin`};\n }\n if (t.asset !== asset) return {code: \"pair-unsupported\", detail: `${asset} is only bridged to ${asset}, not to ${t.symbol}`};\n output = {chain: dst, token: t.address, native: false, decimals: t.decimals};\n }\n if (input.decimals !== output.decimals) return {code: \"pair-unsupported\", detail: \"the two sides have different decimals\"};\n return {asset, input, output};\n}\n\nexport const across = {\n supportsChain(chain: string): boolean {\n return acrossChain(chain) !== undefined;\n },\n /** Two different pinned EVM chains. */\n supports(from: string, to: string): boolean {\n return from !== to && acrossChain(from) !== undefined && acrossChain(to) !== undefined;\n },\n};\n"],"mappings":"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","names":["chain"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Activity recognition for Across on every pinned chain: a `deposit` / `depositV3` call on the chain's SpokePool is our
|
|
5
|
+
* source leg ("Bridged USDC").
|
|
6
|
+
*
|
|
7
|
+
* Deposits that reach the SpokePool through another contract (Across's periphery, an aggregator, a Safe) are not
|
|
8
|
+
* claimed: the call the history shows is that contract's. The destination leg is not claimed either — a fill is paid
|
|
9
|
+
* by one of many relayers as an ordinary token transfer (or a native payment when the wrapped native token is
|
|
10
|
+
* unwrapped) and reads as a plain incoming transfer.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
declare const ACROSS_MODULE = "@anywalletkit/protocol-swap2-across";
|
|
14
|
+
declare function describeAcrossActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
|
|
15
|
+
|
|
16
|
+
export { ACROSS_MODULE, describeAcrossActivity };
|