@anywalletkit/protocol-swap2-cctp 0.0.0-stage → 0.1.3
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 +95 -2
- package/dist/activity.cjs +89 -0
- package/dist/activity.cjs.map +1 -0
- package/dist/activity.d.cts +19 -0
- package/dist/activity.d.ts +19 -0
- package/dist/activity.js +14 -0
- package/dist/activity.js.map +1 -0
- package/dist/chunk-FLAON5RO.js +29 -0
- package/dist/chunk-FLAON5RO.js.map +1 -0
- package/dist/chunk-I33XRHH3.js +301 -0
- package/dist/chunk-I33XRHH3.js.map +1 -0
- package/dist/chunk-TFQR5KQB.js +27 -0
- package/dist/chunk-TFQR5KQB.js.map +1 -0
- package/dist/chunk-ZR5XR5RO.js +66 -0
- package/dist/chunk-ZR5XR5RO.js.map +1 -0
- package/dist/config.cjs +86 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +27 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -0
- package/dist/index.cjs +416 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.cjs +400 -0
- package/dist/protocol.cjs.map +1 -0
- package/dist/protocol.d.cts +16 -0
- package/dist/protocol.d.ts +16 -0
- package/dist/protocol.js +10 -0
- package/dist/protocol.js.map +1 -0
- package/dist/provider.cjs +384 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +25 -0
- package/dist/provider.d.ts +25 -0
- package/dist/provider.js +9 -0
- package/dist/provider.js.map +1 -0
- package/module.json +12 -0
- package/package.json +79 -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,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @anywalletkit/protocol-swap2-cctp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Circle CCTP V2](https://developers.circle.com/cctp) as a swap2 provider:
|
|
4
|
+
native USDC between EVM chains by **burn-and-mint** — no spread, no
|
|
5
|
+
aggregator fee; Fast Transfer costs the fee Circle publishes per pair (around
|
|
6
|
+
1 bps), Standard is free and waits for source finality.
|
|
7
|
+
|
|
8
|
+
CCTP is **two-phase**. `depositForBurn` on the source chain burns the USDC;
|
|
9
|
+
Circle's attestation service signs the message; `receiveMessage(message,
|
|
10
|
+
attestation)` on the destination mints — and that second transaction is the
|
|
11
|
+
user's own, paid in the destination chain's gas. The swap2 engine learned
|
|
12
|
+
this with the package:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import {cctpProvider} from "@anywalletkit/protocol-swap2-cctp/provider";
|
|
16
|
+
import {RouterSwap2Protocol} from "@anywalletkit/protocol-swap2-router/swap2/router";
|
|
17
|
+
|
|
18
|
+
const swap2 = new RouterSwap2Protocol(baseAccount, {fromChain: "eip155:8453", providers: [cctpProvider({rpcUrls})]});
|
|
19
|
+
const res = await swap2.swap2({fromToken: "USDC", toToken: "USDC", toChain: 42161, fromTokenAmount: 10_000_000n, minAmountOut: 9_998_570n});
|
|
20
|
+
// … poll …
|
|
21
|
+
const status = await swap2.getSwap2Status(res.id); // "pending" → "action-required" once Circle attested
|
|
22
|
+
if (status.status === "action-required") {
|
|
23
|
+
const {hash} = await swap2.claimSwap2(res.id, arbitrumAccount); // receiveMessage on Arbitrum, signed there
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`claimSwap2(id, destinationAccount)` is on every swap2 protocol (router or
|
|
28
|
+
single-provider); providers opt in with `buildClaim(ref)`, which returns the
|
|
29
|
+
destination transaction or `null` while the attestation is pending.
|
|
30
|
+
`IntentStatus.claim = {chain, ready}` tells the app which chain the claim
|
|
31
|
+
lives on. The remote provider forwards it as the `claim` action.
|
|
32
|
+
|
|
33
|
+
## What the provider does
|
|
34
|
+
|
|
35
|
+
- **Mode** `auto` (default) takes Fast when the pair offers it and Circle's
|
|
36
|
+
Fast allowance covers the amount, else Standard; `fast` / `standard` force
|
|
37
|
+
one. Fees come from `GET /v2/burn/USDC/fees/{src}/{dst}` (bps), the
|
|
38
|
+
allowance from `GET /v2/fastBurn/USDC/allowance`.
|
|
39
|
+
- **Output is guaranteed**: `maxFee` in the calldata = published fee + a 10 %
|
|
40
|
+
buffer (`feeBufferPct`), and Circle can deduct at most `maxFee`; the quote's
|
|
41
|
+
`minDestAmount` is `amount − maxFee`. The unused buffer is never charged.
|
|
42
|
+
- **Calldata is sealed in the quote** (recipient, native USDC of the source
|
|
43
|
+
domain, destination domain, `maxFee`, finality threshold) and the engine
|
|
44
|
+
executes exactly that; `approvalAddress` is the TokenMessengerV2.
|
|
45
|
+
- **Preflight with an RPC** (`rpcUrls`): the TokenMessengerV2 the calldata
|
|
46
|
+
targets must point at the expected MessageTransmitterV2, whose
|
|
47
|
+
`localDomain()` must be the source domain, and `getMinFeeAmount(amount)`
|
|
48
|
+
must fit `maxFee`. Without an RPC the on-chain check is skipped.
|
|
49
|
+
- **Tracking**: `GET /v2/messages/{src}?transactionHash=` → `pending` while
|
|
50
|
+
confirmations accrue, `action-required` once `status: complete` with the
|
|
51
|
+
attestation, `completed` once the destination's `usedNonces(nonce)` is set
|
|
52
|
+
(needs the destination RPC; otherwise a recorded claim hash counts).
|
|
53
|
+
- **Claim**: `receiveMessage(message, attestation)` on the destination
|
|
54
|
+
MessageTransmitterV2; the attested message must belong to the route's
|
|
55
|
+
domains. An expired Fast message (`expirationBlock` passed) is sent to
|
|
56
|
+
`POST /v2/reattest/{nonce}` and reported not-ready until Circle re-signs.
|
|
57
|
+
- **Domains**: 17 EVM chains (Ethereum, Avalanche, OP, Arbitrum, Base,
|
|
58
|
+
Polygon, Unichain, Linea, Sonic, World Chain, Monad, Sei, HyperEVM, Ink,
|
|
59
|
+
Plume, Plasma, X Layer), the same TokenMessengerV2 / MessageTransmitterV2 on
|
|
60
|
+
all of them, and each domain's **native** USDC. Chains whose catalog USDC
|
|
61
|
+
is not Circle's (BSC, Gnosis USDC.e) are refused. Solana (domain 5) is not
|
|
62
|
+
executed here yet: the engine runs calldata on EVM only.
|
|
63
|
+
|
|
64
|
+
## Tests
|
|
65
|
+
|
|
66
|
+
`pnpm test` — provider tests over a fake Circle API + fake JSON-RPC (fee
|
|
67
|
+
maths, calldata binding, mode fallbacks, preflight refusals, the whole
|
|
68
|
+
pending → action-required → completed lifecycle, claim building, expiry /
|
|
69
|
+
re-attestation) and the conformance suite; the engine's `claimSwap2` has its
|
|
70
|
+
own tests in `protocol-swap2-core`. `pnpm verify:live` quotes USDC Base →
|
|
71
|
+
Arbitrum $10 in both modes against the live API and preflights on Base.
|
|
72
|
+
|
|
73
|
+
## Status
|
|
74
|
+
|
|
75
|
+
2026-10-10: built, tests green, live quote + preflight verified. No funded
|
|
76
|
+
transfer yet (plan: $10 USDC Base → Arbitrum, Fast and Standard, with the
|
|
77
|
+
claim from the phone).
|
|
78
|
+
|
|
79
|
+
## Activity
|
|
80
|
+
|
|
81
|
+
`describeActivity(tx, ctx)` (on the provider; the protocol class and the router
|
|
82
|
+
delegate to it) recognizes both halves of a CCTP V2 transfer on every domain in
|
|
83
|
+
`config.ts`, by contract + 4-byte selector:
|
|
84
|
+
|
|
85
|
+
| Call | Contract | Kind | Title |
|
|
86
|
+
| --- | --- | --- | --- |
|
|
87
|
+
| `depositForBurn(uint256,uint32,bytes32,address,bytes32,uint256,uint32)` `0x8e0250ee` | TokenMessengerV2 | `bridge` | "Bridged USDC" |
|
|
88
|
+
| `receiveMessage(bytes,bytes)` `0x57ecfd28` | MessageTransmitterV2 | `bridge` | "Received USDC via CCTP" |
|
|
89
|
+
|
|
90
|
+
Assets come from the owner's net transfers (the burn leaves the wallet; the
|
|
91
|
+
mint lands on the `mintRecipient` even when a relayer paid the claim).
|
|
92
|
+
Subtitle `CCTP · <chain>`, counterparty = the contract called. The other leg's
|
|
93
|
+
hash is only known through the kit's intent journal / Circle's attestation API,
|
|
94
|
+
so `related` stays empty. Fixtures in `fixtures/activity/` are public Ethereum
|
|
95
|
+
transactions (two burns, two claims) plus negatives (a LI.FI bridge, a THORChain
|
|
96
|
+
deposit); the conformance suite runs them through `describeActivity`.
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
CCTP_DEPOSIT_FOR_BURN: () => CCTP_DEPOSIT_FOR_BURN,
|
|
24
|
+
CCTP_MODULE: () => CCTP_MODULE,
|
|
25
|
+
CCTP_RECEIVE_MESSAGE: () => CCTP_RECEIVE_MESSAGE,
|
|
26
|
+
describeCctpActivity: () => describeCctpActivity
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(activity_exports);
|
|
29
|
+
var import_activity = require("@anywalletkit/protocol-swap2-core/activity");
|
|
30
|
+
|
|
31
|
+
// src/config.ts
|
|
32
|
+
var import_util = require("@anywalletkit/protocol-swap2-core/util");
|
|
33
|
+
var TOKEN_MESSENGER_V2 = "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d";
|
|
34
|
+
var MESSAGE_TRANSMITTER_V2 = "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64";
|
|
35
|
+
var d = (chainId, domain, name, usdc) => ({
|
|
36
|
+
caip2: `eip155:${chainId}`,
|
|
37
|
+
chainId,
|
|
38
|
+
domain,
|
|
39
|
+
name,
|
|
40
|
+
usdc,
|
|
41
|
+
tokenMessenger: TOKEN_MESSENGER_V2,
|
|
42
|
+
messageTransmitter: MESSAGE_TRANSMITTER_V2
|
|
43
|
+
});
|
|
44
|
+
var CCTP_DOMAINS = Object.freeze(Object.fromEntries([
|
|
45
|
+
d(1, 0, "Ethereum", "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
46
|
+
d(43114, 1, "Avalanche", "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
47
|
+
d(10, 2, "OP Mainnet", "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85"),
|
|
48
|
+
d(42161, 3, "Arbitrum", "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
49
|
+
d(8453, 6, "Base", "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
50
|
+
d(137, 7, "Polygon PoS", "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"),
|
|
51
|
+
d(130, 10, "Unichain", "0x078D782b760474a361dDA0AF3839290b0EF57AD6"),
|
|
52
|
+
d(59144, 11, "Linea", "0x176211869cA2b568f2A7D4EE941E073a821EE1ff"),
|
|
53
|
+
d(146, 13, "Sonic", "0x29219dd400f2Bf60E5a23d13Be72B486D4038894"),
|
|
54
|
+
d(480, 14, "World Chain", "0x79A02482A880bCe3F13E09da970dC34dB4cD24D1"),
|
|
55
|
+
d(143, 15, "Monad", "0x754704Bc059F8C67012fEd69BC8A327a5aafb603"),
|
|
56
|
+
d(1329, 16, "Sei", "0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392"),
|
|
57
|
+
d(999, 19, "HyperEVM", "0xb88339CB7199b77E23DB6E890353E22632Ba630f"),
|
|
58
|
+
d(57073, 21, "Ink", "0x2D270e6886d130D724215A266106e6832161EAEd"),
|
|
59
|
+
d(98866, 22, "Plume", "0x222365EF19F7947e5484218551B56bb3965Aa7aF"),
|
|
60
|
+
d(9745, 33, "Plasma", "0x2d661C89D812261039AF9764eceaAee884f5F67F"),
|
|
61
|
+
d(196, 37, "X Layer", "0xB6CEceAB302E2E4948951eE7843FC24E92933061"),
|
|
62
|
+
// 2026-10-14: Arc and Morph (developers.circle.com/cctp/evm-smart-contracts + usdc-contract-addresses; TokenMessengerV2 /
|
|
63
|
+
// MessageTransmitterV2 have code on both chains, MessageTransmitterV2.localDomain() answers 26 / 30 and
|
|
64
|
+
// TokenMessengerV2.localMessageTransmitter() points at 0x81D4…). Arc's USDC is the chain's gas token: 0x3600… is its
|
|
65
|
+
// 6-decimal ERC-20 interface, which is what CCTP burns and mints.
|
|
66
|
+
d(5042, 26, "Arc", "0x3600000000000000000000000000000000000000"),
|
|
67
|
+
d(2818, 30, "Morph", "0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B")
|
|
68
|
+
].map((x) => [x.caip2, x])));
|
|
69
|
+
var CCTP_BY_DOMAIN = Object.freeze(
|
|
70
|
+
Object.fromEntries(Object.values(CCTP_DOMAINS).map((x) => [x.domain, x]))
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
// src/activity.ts
|
|
74
|
+
var CCTP_MODULE = "@anywalletkit/protocol-swap2-cctp";
|
|
75
|
+
var CCTP_DEPOSIT_FOR_BURN = "0x8e0250ee";
|
|
76
|
+
var CCTP_RECEIVE_MESSAGE = "0x57ecfd28";
|
|
77
|
+
function describeCctpActivity(tx, ctx) {
|
|
78
|
+
const domain = CCTP_DOMAINS[tx.chain];
|
|
79
|
+
if (!domain) return null;
|
|
80
|
+
const subtitle = `CCTP \xB7 ${(0, import_activity.chainLabel)(tx.chain)}`;
|
|
81
|
+
if ((0, import_activity.matchesCall)(tx, [domain.tokenMessenger], [CCTP_DEPOSIT_FOR_BURN])) {
|
|
82
|
+
return (0, import_activity.describeSwapLike)(tx, ctx, { protocol: CCTP_MODULE, subtitle, kind: "bridge", title: "Bridged USDC" });
|
|
83
|
+
}
|
|
84
|
+
if ((0, import_activity.matchesCall)(tx, [domain.messageTransmitter], [CCTP_RECEIVE_MESSAGE])) {
|
|
85
|
+
return (0, import_activity.describeSwapLike)(tx, ctx, { protocol: CCTP_MODULE, subtitle, kind: "bridge", title: "Received USDC via CCTP" });
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=activity.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/activity.ts","../src/config.ts"],"sourcesContent":["/**\n * Activity recognition for Circle CCTP V2 on every domain in `config.ts`:\n * `depositForBurn` on TokenMessengerV2 is our source leg (\"Bridged USDC\"), and\n * `receiveMessage` on MessageTransmitterV2 is the claim that mints on the\n * destination (\"Received USDC via CCTP\") — whoever paid the gas, the USDC lands\n * on the `mintRecipient`. Both are `bridge`; the other leg's hash is only known\n * through the kit's journal / Circle's attestation API, so `related` stays empty.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {chainLabel, describeSwapLike, matchesCall} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {CCTP_DOMAINS} from \"./config.js\";\n\nexport const CCTP_MODULE = \"@anywalletkit/protocol-swap2-cctp\";\n\n/** depositForBurn(uint256,uint32,bytes32,address,bytes32,uint256,uint32) — TokenMessengerV2 */\nexport const CCTP_DEPOSIT_FOR_BURN = \"0x8e0250ee\";\n/** receiveMessage(bytes,bytes) — MessageTransmitterV2 */\nexport const CCTP_RECEIVE_MESSAGE = \"0x57ecfd28\";\n\nexport function describeCctpActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n const domain = CCTP_DOMAINS[tx.chain];\n if (!domain) return null;\n const subtitle = `CCTP · ${chainLabel(tx.chain)}`;\n if (matchesCall(tx, [domain.tokenMessenger], [CCTP_DEPOSIT_FOR_BURN])) {\n return describeSwapLike(tx, ctx, {protocol: CCTP_MODULE, subtitle, kind: \"bridge\", title: \"Bridged USDC\"});\n }\n if (matchesCall(tx, [domain.messageTransmitter], [CCTP_RECEIVE_MESSAGE])) {\n return describeSwapLike(tx, ctx, {protocol: CCTP_MODULE, subtitle, kind: \"bridge\", title: \"Received USDC via CCTP\"});\n }\n return null;\n}\n","// Circle CCTP V2 — mainnet domains, contracts and the native USDC each domain\n// mints. Sources (read 2026-10-10, Arc + Morph 2026-10-14): developers.circle.com/cctp/evm-smart-contracts\n// (domains + TokenMessengerV2 / MessageTransmitterV2, the same addresses on\n// every EVM chain except EDGE), developers.circle.com/stablecoins/usdc-contract-addresses\n// (native USDC). Only chains whose USDC is Circle-native are listed: CCTP\n// burns native USDC, a bridged USDC.e (BSC, Gnosis) cannot ride it.\nimport {evmRef, isEvm} from \"@anywalletkit/protocol-swap2-core/util\";\n\nexport interface CctpDomain {\n caip2: string;\n chainId: number;\n domain: number;\n name: string;\n usdc: string;\n tokenMessenger: string;\n messageTransmitter: string;\n}\n\nexport const TOKEN_MESSENGER_V2 = \"0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d\";\nexport const MESSAGE_TRANSMITTER_V2 = \"0x81D40F21F12A8F0E3252Bccb954D722d4c464B64\";\n\nconst d = (chainId: number, domain: number, name: string, usdc: string): CctpDomain => ({\n caip2: `eip155:${chainId}`, chainId, domain, name, usdc, tokenMessenger: TOKEN_MESSENGER_V2, messageTransmitter: MESSAGE_TRANSMITTER_V2,\n});\n\n/** CAIP-2 → CCTP domain. */\nexport const CCTP_DOMAINS: Readonly<Record<string, CctpDomain>> = Object.freeze(Object.fromEntries([\n d(1, 0, \"Ethereum\", \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"),\n d(43114, 1, \"Avalanche\", \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\"),\n d(10, 2, \"OP Mainnet\", \"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85\"),\n d(42161, 3, \"Arbitrum\", \"0xaf88d065e77c8cC2239327C5EDb3A432268e5831\"),\n d(8453, 6, \"Base\", \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\"),\n d(137, 7, \"Polygon PoS\", \"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359\"),\n d(130, 10, \"Unichain\", \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\"),\n d(59144, 11, \"Linea\", \"0x176211869cA2b568f2A7D4EE941E073a821EE1ff\"),\n d(146, 13, \"Sonic\", \"0x29219dd400f2Bf60E5a23d13Be72B486D4038894\"),\n d(480, 14, \"World Chain\", \"0x79A02482A880bCe3F13E09da970dC34dB4cD24D1\"),\n d(143, 15, \"Monad\", \"0x754704Bc059F8C67012fEd69BC8A327a5aafb603\"),\n d(1329, 16, \"Sei\", \"0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392\"),\n d(999, 19, \"HyperEVM\", \"0xb88339CB7199b77E23DB6E890353E22632Ba630f\"),\n d(57073, 21, \"Ink\", \"0x2D270e6886d130D724215A266106e6832161EAEd\"),\n d(98866, 22, \"Plume\", \"0x222365EF19F7947e5484218551B56bb3965Aa7aF\"),\n d(9745, 33, \"Plasma\", \"0x2d661C89D812261039AF9764eceaAee884f5F67F\"),\n d(196, 37, \"X Layer\", \"0xB6CEceAB302E2E4948951eE7843FC24E92933061\"),\n // 2026-10-14: Arc and Morph (developers.circle.com/cctp/evm-smart-contracts + usdc-contract-addresses; TokenMessengerV2 /\n // MessageTransmitterV2 have code on both chains, MessageTransmitterV2.localDomain() answers 26 / 30 and\n // TokenMessengerV2.localMessageTransmitter() points at 0x81D4…). Arc's USDC is the chain's gas token: 0x3600… is its\n // 6-decimal ERC-20 interface, which is what CCTP burns and mints.\n d(5042, 26, \"Arc\", \"0x3600000000000000000000000000000000000000\"),\n d(2818, 30, \"Morph\", \"0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B\"),\n].map((x) => [x.caip2, x])));\n\n/** CCTP domain → entry. */\nexport const CCTP_BY_DOMAIN: Readonly<Record<number, CctpDomain>> = Object.freeze(\n Object.fromEntries(Object.values(CCTP_DOMAINS).map((x) => [x.domain, x])),\n);\n\n/** Solana is CCTP domain 5 (not executed by this package yet: the engine runs calldata on EVM only). */\nexport const CCTP_SOLANA_DOMAIN = 5;\n\nexport const CCTP_API = \"https://iris-api.circle.com\";\n\n/** Finality thresholds the header carries: Fast Transfer (confirmed) vs Standard (finalized). */\nexport const FINALITY_FAST = 1000;\nexport const FINALITY_STANDARD = 2000;\n\nexport const cctp = {\n supportsChain(chain: string): boolean {\n return isEvm(chain) && !!CCTP_DOMAINS[`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;AASA,sBAAwD;;;ACHxD,kBAA4B;AAYrB,IAAM,qBAAqB;AAC3B,IAAM,yBAAyB;AAEtC,IAAM,IAAI,CAAC,SAAiB,QAAgB,MAAc,UAA8B;AAAA,EACtF,OAAO,UAAU,OAAO;AAAA,EAAI;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAM;AAAA,EAAM,gBAAgB;AAAA,EAAoB,oBAAoB;AACnH;AAGO,IAAM,eAAqD,OAAO,OAAO,OAAO,YAAY;AAAA,EACjG,EAAE,GAAG,GAAG,YAAY,4CAA4C;AAAA,EAChE,EAAE,OAAO,GAAG,aAAa,4CAA4C;AAAA,EACrE,EAAE,IAAI,GAAG,cAAc,4CAA4C;AAAA,EACnE,EAAE,OAAO,GAAG,YAAY,4CAA4C;AAAA,EACpE,EAAE,MAAM,GAAG,QAAQ,4CAA4C;AAAA,EAC/D,EAAE,KAAK,GAAG,eAAe,4CAA4C;AAAA,EACrE,EAAE,KAAK,IAAI,YAAY,4CAA4C;AAAA,EACnE,EAAE,OAAO,IAAI,SAAS,4CAA4C;AAAA,EAClE,EAAE,KAAK,IAAI,SAAS,4CAA4C;AAAA,EAChE,EAAE,KAAK,IAAI,eAAe,4CAA4C;AAAA,EACtE,EAAE,KAAK,IAAI,SAAS,4CAA4C;AAAA,EAChE,EAAE,MAAM,IAAI,OAAO,4CAA4C;AAAA,EAC/D,EAAE,KAAK,IAAI,YAAY,4CAA4C;AAAA,EACnE,EAAE,OAAO,IAAI,OAAO,4CAA4C;AAAA,EAChE,EAAE,OAAO,IAAI,SAAS,4CAA4C;AAAA,EAClE,EAAE,MAAM,IAAI,UAAU,4CAA4C;AAAA,EAClE,EAAE,KAAK,IAAI,WAAW,4CAA4C;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlE,EAAE,MAAM,IAAI,OAAO,4CAA4C;AAAA,EAC/D,EAAE,MAAM,IAAI,SAAS,4CAA4C;AACnE,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAGpB,IAAM,iBAAuD,OAAO;AAAA,EACzE,OAAO,YAAY,OAAO,OAAO,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC1E;;;AD3CO,IAAM,cAAc;AAGpB,IAAM,wBAAwB;AAE9B,IAAM,uBAAuB;AAE7B,SAAS,qBAAqB,IAAa,KAAmD;AACnG,QAAM,SAAS,aAAa,GAAG,KAAK;AACpC,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,WAAW,iBAAU,4BAAW,GAAG,KAAK,CAAC;AAC/C,UAAI,6BAAY,IAAI,CAAC,OAAO,cAAc,GAAG,CAAC,qBAAqB,CAAC,GAAG;AACrE,eAAO,kCAAiB,IAAI,KAAK,EAAC,UAAU,aAAa,UAAU,MAAM,UAAU,OAAO,eAAc,CAAC;AAAA,EAC3G;AACA,UAAI,6BAAY,IAAI,CAAC,OAAO,kBAAkB,GAAG,CAAC,oBAAoB,CAAC,GAAG;AACxE,eAAO,kCAAiB,IAAI,KAAK,EAAC,UAAU,aAAa,UAAU,MAAM,UAAU,OAAO,yBAAwB,CAAC;AAAA,EACrH;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Activity recognition for Circle CCTP V2 on every domain in `config.ts`:
|
|
5
|
+
* `depositForBurn` on TokenMessengerV2 is our source leg ("Bridged USDC"), and
|
|
6
|
+
* `receiveMessage` on MessageTransmitterV2 is the claim that mints on the
|
|
7
|
+
* destination ("Received USDC via CCTP") — whoever paid the gas, the USDC lands
|
|
8
|
+
* on the `mintRecipient`. Both are `bridge`; the other leg's hash is only known
|
|
9
|
+
* through the kit's journal / Circle's attestation API, so `related` stays empty.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
declare const CCTP_MODULE = "@anywalletkit/protocol-swap2-cctp";
|
|
13
|
+
/** depositForBurn(uint256,uint32,bytes32,address,bytes32,uint256,uint32) — TokenMessengerV2 */
|
|
14
|
+
declare const CCTP_DEPOSIT_FOR_BURN = "0x8e0250ee";
|
|
15
|
+
/** receiveMessage(bytes,bytes) — MessageTransmitterV2 */
|
|
16
|
+
declare const CCTP_RECEIVE_MESSAGE = "0x57ecfd28";
|
|
17
|
+
declare function describeCctpActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
|
|
18
|
+
|
|
19
|
+
export { CCTP_DEPOSIT_FOR_BURN, CCTP_MODULE, CCTP_RECEIVE_MESSAGE, describeCctpActivity };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChainTx, DescribeActivityContext, ActivityItem } from '@anywalletkit/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Activity recognition for Circle CCTP V2 on every domain in `config.ts`:
|
|
5
|
+
* `depositForBurn` on TokenMessengerV2 is our source leg ("Bridged USDC"), and
|
|
6
|
+
* `receiveMessage` on MessageTransmitterV2 is the claim that mints on the
|
|
7
|
+
* destination ("Received USDC via CCTP") — whoever paid the gas, the USDC lands
|
|
8
|
+
* on the `mintRecipient`. Both are `bridge`; the other leg's hash is only known
|
|
9
|
+
* through the kit's journal / Circle's attestation API, so `related` stays empty.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
declare const CCTP_MODULE = "@anywalletkit/protocol-swap2-cctp";
|
|
13
|
+
/** depositForBurn(uint256,uint32,bytes32,address,bytes32,uint256,uint32) — TokenMessengerV2 */
|
|
14
|
+
declare const CCTP_DEPOSIT_FOR_BURN = "0x8e0250ee";
|
|
15
|
+
/** receiveMessage(bytes,bytes) — MessageTransmitterV2 */
|
|
16
|
+
declare const CCTP_RECEIVE_MESSAGE = "0x57ecfd28";
|
|
17
|
+
declare function describeCctpActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null;
|
|
18
|
+
|
|
19
|
+
export { CCTP_DEPOSIT_FOR_BURN, CCTP_MODULE, CCTP_RECEIVE_MESSAGE, describeCctpActivity };
|
package/dist/activity.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CCTP_DEPOSIT_FOR_BURN,
|
|
3
|
+
CCTP_MODULE,
|
|
4
|
+
CCTP_RECEIVE_MESSAGE,
|
|
5
|
+
describeCctpActivity
|
|
6
|
+
} from "./chunk-FLAON5RO.js";
|
|
7
|
+
import "./chunk-ZR5XR5RO.js";
|
|
8
|
+
export {
|
|
9
|
+
CCTP_DEPOSIT_FOR_BURN,
|
|
10
|
+
CCTP_MODULE,
|
|
11
|
+
CCTP_RECEIVE_MESSAGE,
|
|
12
|
+
describeCctpActivity
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CCTP_DOMAINS
|
|
3
|
+
} from "./chunk-ZR5XR5RO.js";
|
|
4
|
+
|
|
5
|
+
// src/activity.ts
|
|
6
|
+
import { chainLabel, describeSwapLike, matchesCall } from "@anywalletkit/protocol-swap2-core/activity";
|
|
7
|
+
var CCTP_MODULE = "@anywalletkit/protocol-swap2-cctp";
|
|
8
|
+
var CCTP_DEPOSIT_FOR_BURN = "0x8e0250ee";
|
|
9
|
+
var CCTP_RECEIVE_MESSAGE = "0x57ecfd28";
|
|
10
|
+
function describeCctpActivity(tx, ctx) {
|
|
11
|
+
const domain = CCTP_DOMAINS[tx.chain];
|
|
12
|
+
if (!domain) return null;
|
|
13
|
+
const subtitle = `CCTP \xB7 ${chainLabel(tx.chain)}`;
|
|
14
|
+
if (matchesCall(tx, [domain.tokenMessenger], [CCTP_DEPOSIT_FOR_BURN])) {
|
|
15
|
+
return describeSwapLike(tx, ctx, { protocol: CCTP_MODULE, subtitle, kind: "bridge", title: "Bridged USDC" });
|
|
16
|
+
}
|
|
17
|
+
if (matchesCall(tx, [domain.messageTransmitter], [CCTP_RECEIVE_MESSAGE])) {
|
|
18
|
+
return describeSwapLike(tx, ctx, { protocol: CCTP_MODULE, subtitle, kind: "bridge", title: "Received USDC via CCTP" });
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
CCTP_MODULE,
|
|
25
|
+
CCTP_DEPOSIT_FOR_BURN,
|
|
26
|
+
CCTP_RECEIVE_MESSAGE,
|
|
27
|
+
describeCctpActivity
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=chunk-FLAON5RO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/activity.ts"],"sourcesContent":["/**\n * Activity recognition for Circle CCTP V2 on every domain in `config.ts`:\n * `depositForBurn` on TokenMessengerV2 is our source leg (\"Bridged USDC\"), and\n * `receiveMessage` on MessageTransmitterV2 is the claim that mints on the\n * destination (\"Received USDC via CCTP\") — whoever paid the gas, the USDC lands\n * on the `mintRecipient`. Both are `bridge`; the other leg's hash is only known\n * through the kit's journal / Circle's attestation API, so `related` stays empty.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {chainLabel, describeSwapLike, matchesCall} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {CCTP_DOMAINS} from \"./config.js\";\n\nexport const CCTP_MODULE = \"@anywalletkit/protocol-swap2-cctp\";\n\n/** depositForBurn(uint256,uint32,bytes32,address,bytes32,uint256,uint32) — TokenMessengerV2 */\nexport const CCTP_DEPOSIT_FOR_BURN = \"0x8e0250ee\";\n/** receiveMessage(bytes,bytes) — MessageTransmitterV2 */\nexport const CCTP_RECEIVE_MESSAGE = \"0x57ecfd28\";\n\nexport function describeCctpActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n const domain = CCTP_DOMAINS[tx.chain];\n if (!domain) return null;\n const subtitle = `CCTP · ${chainLabel(tx.chain)}`;\n if (matchesCall(tx, [domain.tokenMessenger], [CCTP_DEPOSIT_FOR_BURN])) {\n return describeSwapLike(tx, ctx, {protocol: CCTP_MODULE, subtitle, kind: \"bridge\", title: \"Bridged USDC\"});\n }\n if (matchesCall(tx, [domain.messageTransmitter], [CCTP_RECEIVE_MESSAGE])) {\n return describeSwapLike(tx, ctx, {protocol: CCTP_MODULE, subtitle, kind: \"bridge\", title: \"Received USDC via CCTP\"});\n }\n return null;\n}\n"],"mappings":";;;;;AASA,SAAQ,YAAY,kBAAkB,mBAAkB;AAGjD,IAAM,cAAc;AAGpB,IAAM,wBAAwB;AAE9B,IAAM,uBAAuB;AAE7B,SAAS,qBAAqB,IAAa,KAAmD;AACnG,QAAM,SAAS,aAAa,GAAG,KAAK;AACpC,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,WAAW,aAAU,WAAW,GAAG,KAAK,CAAC;AAC/C,MAAI,YAAY,IAAI,CAAC,OAAO,cAAc,GAAG,CAAC,qBAAqB,CAAC,GAAG;AACrE,WAAO,iBAAiB,IAAI,KAAK,EAAC,UAAU,aAAa,UAAU,MAAM,UAAU,OAAO,eAAc,CAAC;AAAA,EAC3G;AACA,MAAI,YAAY,IAAI,CAAC,OAAO,kBAAkB,GAAG,CAAC,oBAAoB,CAAC,GAAG;AACxE,WAAO,iBAAiB,IAAI,KAAK,EAAC,UAAU,aAAa,UAAU,MAAM,UAAU,OAAO,yBAAwB,CAAC;AAAA,EACrH;AACA,SAAO;AACT;","names":[]}
|