@anywalletkit/protocol-swap2-stargate 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +502 -2
- package/dist/abi.cjs +91 -0
- package/dist/abi.cjs.map +1 -0
- package/dist/abi.d.cts +810 -0
- package/dist/abi.d.ts +810 -0
- package/dist/abi.js +13 -0
- package/dist/abi.js.map +1 -0
- package/dist/amounts.cjs +73 -0
- package/dist/amounts.cjs.map +1 -0
- package/dist/amounts.d.cts +21 -0
- package/dist/amounts.d.ts +21 -0
- package/dist/amounts.js +15 -0
- package/dist/amounts.js.map +1 -0
- package/dist/bus-Cdw8iwOv.d.cts +59 -0
- package/dist/bus-vAWqTAkq.d.ts +59 -0
- package/dist/bus.cjs +237 -0
- package/dist/bus.cjs.map +1 -0
- package/dist/bus.d.cts +4 -0
- package/dist/bus.d.ts +4 -0
- package/dist/bus.js +22 -0
- package/dist/bus.js.map +1 -0
- package/dist/chunk-3NTMZUAU.js +128 -0
- package/dist/chunk-3NTMZUAU.js.map +1 -0
- package/dist/chunk-4HU46QF2.js +256 -0
- package/dist/chunk-4HU46QF2.js.map +1 -0
- package/dist/chunk-4IDDRIE2.js +125 -0
- package/dist/chunk-4IDDRIE2.js.map +1 -0
- package/dist/chunk-EANM3EI3.js +71 -0
- package/dist/chunk-EANM3EI3.js.map +1 -0
- package/dist/chunk-ERC6LKMN.js +87 -0
- package/dist/chunk-ERC6LKMN.js.map +1 -0
- package/dist/chunk-FLAXDJPE.js +24 -0
- package/dist/chunk-FLAXDJPE.js.map +1 -0
- package/dist/chunk-N54YIG6T.js +33 -0
- package/dist/chunk-N54YIG6T.js.map +1 -0
- package/dist/chunk-OUGUX3JK.js +53 -0
- package/dist/chunk-OUGUX3JK.js.map +1 -0
- package/dist/chunk-PJXDMVW3.js +909 -0
- package/dist/chunk-PJXDMVW3.js.map +1 -0
- package/dist/chunk-QNVTQEOV.js +72 -0
- package/dist/chunk-QNVTQEOV.js.map +1 -0
- package/dist/chunk-UDJL7BUP.js +249 -0
- package/dist/chunk-UDJL7BUP.js.map +1 -0
- package/dist/chunk-YHHV3XHY.js +139 -0
- package/dist/chunk-YHHV3XHY.js.map +1 -0
- package/dist/compose-dex.cjs +148 -0
- package/dist/compose-dex.cjs.map +1 -0
- package/dist/compose-dex.d.cts +113 -0
- package/dist/compose-dex.d.ts +113 -0
- package/dist/compose-dex.js +25 -0
- package/dist/compose-dex.js.map +1 -0
- package/dist/compose-route.cjs +1019 -0
- package/dist/compose-route.cjs.map +1 -0
- package/dist/compose-route.d.cts +93 -0
- package/dist/compose-route.d.ts +93 -0
- package/dist/compose-route.js +45 -0
- package/dist/compose-route.js.map +1 -0
- package/dist/compose.cjs +287 -0
- package/dist/compose.cjs.map +1 -0
- package/dist/compose.d.cts +293 -0
- package/dist/compose.d.ts +293 -0
- package/dist/compose.js +30 -0
- package/dist/compose.js.map +1 -0
- package/dist/deployments.cjs +350 -0
- package/dist/deployments.cjs.map +1 -0
- package/dist/deployments.d.cts +12 -0
- package/dist/deployments.d.ts +12 -0
- package/dist/deployments.js +11 -0
- package/dist/deployments.js.map +1 -0
- package/dist/index.cjs +1862 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/native-drop.cjs +117 -0
- package/dist/native-drop.cjs.map +1 -0
- package/dist/native-drop.d.cts +13 -0
- package/dist/native-drop.d.ts +13 -0
- package/dist/native-drop.js +11 -0
- package/dist/native-drop.js.map +1 -0
- package/dist/pins.cjs +1618 -0
- package/dist/pins.cjs.map +1 -0
- package/dist/pins.d.cts +39 -0
- package/dist/pins.d.ts +39 -0
- package/dist/pins.js +21 -0
- package/dist/pins.js.map +1 -0
- package/dist/protocol.cjs +1851 -0
- package/dist/protocol.cjs.map +1 -0
- package/dist/protocol.d.cts +24 -0
- package/dist/protocol.d.ts +24 -0
- package/dist/protocol.js +18 -0
- package/dist/protocol.js.map +1 -0
- package/dist/provider.cjs +1833 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.cts +30 -0
- package/dist/provider.d.ts +30 -0
- package/dist/provider.js +17 -0
- package/dist/provider.js.map +1 -0
- package/dist/quote-r1bA8XbO.d.cts +102 -0
- package/dist/quote-t7UJSxbU.d.ts +102 -0
- package/dist/quote.cjs +618 -0
- package/dist/quote.cjs.map +1 -0
- package/dist/quote.d.cts +3 -0
- package/dist/quote.d.ts +3 -0
- package/dist/quote.js +16 -0
- package/dist/quote.js.map +1 -0
- package/dist/registry.cjs +100 -0
- package/dist/registry.cjs.map +1 -0
- package/dist/registry.d.cts +42 -0
- package/dist/registry.d.ts +42 -0
- package/dist/registry.js +8 -0
- package/dist/registry.js.map +1 -0
- package/dist/tracking.cjs +1143 -0
- package/dist/tracking.cjs.map +1 -0
- package/dist/tracking.d.cts +57 -0
- package/dist/tracking.d.ts +57 -0
- package/dist/tracking.js +23 -0
- package/dist/tracking.js.map +1 -0
- package/package.json +134 -3
package/README.md
CHANGED
|
@@ -1,3 +1,503 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @anywalletkit/protocol-swap2-stargate
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Direct Stargate V2 **Taxi** transfers between 15 EVM chains: quotes read straight from the
|
|
4
|
+
pinned pools, the source `sendToken` call is rebuilt and checked on the client, and delivery
|
|
5
|
+
counts only when the destination pool's payout is proven from finalized receipts. Cached
|
|
6
|
+
tokens and undelivered LayerZero messages get separately reviewed, separately paid recovery.
|
|
7
|
+
Historical Bus transfers stay trackable. No LayerZero API key is needed.
|
|
8
|
+
|
|
9
|
+
`stargateProvider` and `StargateSwap2Protocol` are off by default: pass `enabled: true`.
|
|
10
|
+
The executable compose route (Taxi into the pinned Ethereum LI.FI composer plus one checked
|
|
11
|
+
Uniswap V3 swap) is a second, separate opt-in: `compose: {enabled: true}` on the backend
|
|
12
|
+
provider **and** the client pins. Value Transfer API routes live in the separate, still
|
|
13
|
+
private `protocol-swap2-layerzero` package. Work tracked in
|
|
14
|
+
[SDK-321](https://megabunny.xyz/b/SDK/t/321).
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import {stargateProvider} from '@anywalletkit/protocol-swap2-stargate/provider'
|
|
18
|
+
|
|
19
|
+
const stargate = stargateProvider({
|
|
20
|
+
enabled: true,
|
|
21
|
+
// Source AND destination RPCs: quotes, client checks and payout proofs read both chains.
|
|
22
|
+
rpcUrls: {'eip155:42161': ARBITRUM_RPC, 'eip155:8453': BASE_RPC},
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Pass the reviewed `toTokenAmountMin` as `minAmountOut`, persist an `operationStore`, and on
|
|
27
|
+
`Swap2MaybeSentError` resume the returned id instead of sending again (see
|
|
28
|
+
`examples/swap/src/stargate.ts` and `examples/server/src/stargate.ts`).
|
|
29
|
+
|
|
30
|
+
## Current service availability
|
|
31
|
+
|
|
32
|
+
New transfers use Taxi only. Bus was retired on **October 1, 2026**, per the
|
|
33
|
+
[LayerZero announcement](https://layerzero.network/blog/ecosystem-update-september-2026).
|
|
34
|
+
Bus quotes, selected Bus routes and source builds are refused, including client-side
|
|
35
|
+
validation of remote quotes. Historical Bus tracking and recovery remain available.
|
|
36
|
+
|
|
37
|
+
Scroll is the only pinned chain in the current Stargate sunset list. New transfers
|
|
38
|
+
involving Scroll are refused from **2026-12-08 00:00 UTC**; quote expiry is capped at
|
|
39
|
+
that boundary. Historical deployment identities remain available for tracking.
|
|
40
|
+
This is a conservative interpretation of the effective date in the
|
|
41
|
+
[updated support announcement](https://layerzero.network/blog/support-update-july-24-2026).
|
|
42
|
+
A configured peer is not a promise of continued service.
|
|
43
|
+
|
|
44
|
+
## Funded mainnet verification
|
|
45
|
+
|
|
46
|
+
`scripts/verify-mainnet.mjs` runs the production shape on public mainnet: quotes and builds
|
|
47
|
+
cross a sealed HTTP backend, the client applies its own pins and RPCs, the router journals
|
|
48
|
+
every step in SQLite, and tracking waits for finalized receipts. Without flags it only quotes.
|
|
49
|
+
`--send <case>` broadcasts one capped transfer (amount and attached native value are hard
|
|
50
|
+
limits checked in the review callback); `--resume <operationId>` reopens the journal in a
|
|
51
|
+
fresh process with a read-only account. The signer phrase is read from `STARGATE_ENV_FILE`
|
|
52
|
+
and never printed. Results go to `tests/fixtures/mainnet-funded.json`.
|
|
53
|
+
|
|
54
|
+
| Date | Transfer | Result |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| 2026-11-17 | Arbitrum → Base, 2 USDC (exact approval) | Received 1.998793 USDC, equal to the source `OFTSent` amount and the destination balance delta; 0.000688 ETH messaging paid against a 0.00085 ETH cap (headroom refunded); zero residual allowance; `completed` after both chains finalized (~18 min); fresh read-only process resumed to `completed` with one source step |
|
|
57
|
+
| 2026-11-17 | Base → Arbitrum, 2 USDC | Payout 1.998785 USDC proven from the finalized `OFTReceived`; 0.000695 ETH spent against a 0.000866 ETH cap; `completed` |
|
|
58
|
+
| 2026-11-17 | **Compose** Arbitrum 2 USDC → Ethereum DAI | Bridge 1.998759 USDC into the LI.FI receiver; the LayerZero executor ran `lzCompose` and the swap paid 1.998378 DAI (minimum 1.988386); client reported `completed` from the finalized executor events; 0.001884 ETH spent against a 0.002344 ETH cap (Ethereum compose gas included) |
|
|
59
|
+
|
|
60
|
+
## Run the foundation checks
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate build
|
|
64
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate test
|
|
65
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate typecheck
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Tests are offline. Refresh evidence explicitly, after building:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate fixtures:upstream
|
|
72
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate fixtures:live
|
|
73
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate registry:capture
|
|
74
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate fixtures:receipts
|
|
75
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate fixtures:bus
|
|
76
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate fixtures:recovery
|
|
77
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate fixtures:compose
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Local mainnet fork integration
|
|
81
|
+
|
|
82
|
+
With Anvil installed and the workspace dependencies built:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
pnpm --filter @anywalletkit/protocol-swap2-stargate verify:fork
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This starts owned Base/Arbitrum forks on loopback. Public upstreams sit behind a
|
|
89
|
+
read-only RPC proxy; transaction submission goes only to the local nodes. Optional
|
|
90
|
+
`RPC_8453`, `RPC_42161` and `ANVIL_BIN` select upstreams/the executable. It uses public
|
|
91
|
+
test derivation vectors, rejects test addresses with existing delegated/deployed code,
|
|
92
|
+
and does not load a real signer or private credentials for signing.
|
|
93
|
+
|
|
94
|
+
Three scenarios execute the SDK wallet/router through an HTTP quote backend with
|
|
95
|
+
client pins: ETH, USDC with a lost broadcast reply, and ETH with a recipient that
|
|
96
|
+
temporarily rejects payment. They verify exact approvals, zero residual allowance,
|
|
97
|
+
source dust/messaging refunds, destination balance deltas, reviewed endpoint/token
|
|
98
|
+
recovery, refusal of consumed-message replay, and resuming a SQLite journal in a
|
|
99
|
+
fresh read-only Node process without another source transaction.
|
|
100
|
+
|
|
101
|
+
`tests/fixtures/fork.json` records the upstream block identities, local transaction
|
|
102
|
+
hashes, reviews, journal steps and observed balances. **These are local fork hashes,
|
|
103
|
+
not public explorer transactions.** Funding, receive-library/DVN verification and
|
|
104
|
+
any nonce-gap alignment are simulated; the cached-token case injects a local reverting
|
|
105
|
+
receiver. This does not establish real DVN delivery, public-network finality, latency
|
|
106
|
+
or operation on a mobile device. The report is replaced only after every case passes.
|
|
107
|
+
|
|
108
|
+
`fixtures:upstream` retrieves only interfaces from deployment artifacts at the
|
|
109
|
+
immutable commit recorded in `tests/fixtures/upstream.json`. Artifact URLs and SHA-256
|
|
110
|
+
digests identify the source. Tests compare parameter types, tuple layouts, output
|
|
111
|
+
types, mutability and event indexing against that artifact.
|
|
112
|
+
|
|
113
|
+
`fixtures:live` checks five deployments across Base, Arbitrum and BNB Chain and captures
|
|
114
|
+
four directions in both Taxi and Bus mode. Each chain is read at one block, 24 blocks
|
|
115
|
+
behind its head, whose number, hash and timestamp are recorded. The block hash is
|
|
116
|
+
checked again before writing. This margin is not a universal finality guarantee.
|
|
117
|
+
Every `eth_call` request and raw result/revert is retained. RPC URLs are not retained;
|
|
118
|
+
optional `RPC_8453`, `RPC_42161` and `RPC_56` overrides may contain credentials.
|
|
119
|
+
|
|
120
|
+
The snapshot records deployment identity, code hash, metadata provenance and
|
|
121
|
+
TokenMessaging asset/peer checks. It is a candidate verification sample, **not a
|
|
122
|
+
production allowlist or proof that deployed bytecode matches the source commit**.
|
|
123
|
+
The quote caller/recipient is a public placeholder; quotes do not simulate delivery.
|
|
124
|
+
|
|
125
|
+
The current fixture has four successful Taxi quotes and four Bus refusals with
|
|
126
|
+
`Bus_InvalidFare(false)` (the no-native-drop mode). This is a historical observation at the recorded blocks, not a permanent
|
|
127
|
+
statement about the protocol. A transport failure aborts capture; an observed quote
|
|
128
|
+
revert is retained as an unavailable route. Failed capture preserves the previous
|
|
129
|
+
snapshot. Refreshes require review, including changes to availability assertions.
|
|
130
|
+
|
|
131
|
+
The deployment artifact, pinned `src/libs/Bus.sol` and observed revert use
|
|
132
|
+
`Bus_InvalidFare(bool)`. The collector preserves and decodes the raw revert, rather
|
|
133
|
+
than assuming Bus is available whenever TokenMessaging peers are configured.
|
|
134
|
+
|
|
135
|
+
## Reviewed registry and coverage
|
|
136
|
+
|
|
137
|
+
`src/deployments.ts` pins 25 deployments in 15 SDK networks and 210 directed
|
|
138
|
+
TokenMessaging peer relationships. `src/registry.ts` resolves exact token addresses
|
|
139
|
+
and matching asset IDs, validates identities and shared precision, and returns frozen
|
|
140
|
+
copies of call targets and ERC20 spenders. Native pools and messaging contracts are
|
|
141
|
+
never ERC20 spenders. Same-chain swaps and missing directions are not routes.
|
|
142
|
+
|
|
143
|
+
The candidate evidence in `tests/fixtures/registry.json` records 117 metadata entries
|
|
144
|
+
across 55 chains, 36 verified deployments across 17 SDK chains, and 272 checked peer
|
|
145
|
+
relationships. Verification compares metadata with deployment addresses at a pinned
|
|
146
|
+
upstream revision, then checks token/config/type/active status, decimals, endpoint/eid,
|
|
147
|
+
asset mappings and messaging peers at recorded blocks. Code hashes record the
|
|
148
|
+
observed deployment; they do not prove source/bytecode equivalence.
|
|
149
|
+
|
|
150
|
+
| SDK network | Pinned token symbols (lookup uses addresses) | Verified but excluded from runtime: absent from SDK token catalog |
|
|
151
|
+
|---|---|---|
|
|
152
|
+
| Arbitrum | USDC, native ETH | — |
|
|
153
|
+
| Avalanche | USDC, USDt | — |
|
|
154
|
+
| Base | USDC, native ETH | — |
|
|
155
|
+
| Berachain | — | USDC.e, WETH, EURC.e |
|
|
156
|
+
| BNB Chain | USDC, USDT | — |
|
|
157
|
+
| Ethereum | USDC, USDT, native ETH | mETH, EURC |
|
|
158
|
+
| Flare | USDC.e, WETH (OFT) | USDT |
|
|
159
|
+
| Ink | — | USDC.e |
|
|
160
|
+
| Mantle | USDC, WETH, mETH | — |
|
|
161
|
+
| Optimism | USDC, native ETH | — |
|
|
162
|
+
| Plasma | WETH (OFT) | — |
|
|
163
|
+
| Plume | WETH (OFT) | USDC.e, USDT, EURC.e |
|
|
164
|
+
| Polygon | USDC | — |
|
|
165
|
+
| Scroll | native ETH | USDC |
|
|
166
|
+
| Sei | WETH (OFT) | — |
|
|
167
|
+
| Sonic | USDC | — |
|
|
168
|
+
| Unichain | native ETH | — |
|
|
169
|
+
|
|
170
|
+
Linea was discovered but excluded because no matching TokenMessaging artifact was
|
|
171
|
+
found at the pinned revision. Other discovered networks have no SDK chain entry;
|
|
172
|
+
the evidence records each exclusion. Catalog omissions need a separate reviewed
|
|
173
|
+
catalog update; metadata symbols cannot silently select another token.
|
|
174
|
+
|
|
175
|
+
**Verified does not mean currently quotable.** Peers are chain relationships, not
|
|
176
|
+
210 guaranteed token routes. Both endpoints must share an asset ID, and quotes must
|
|
177
|
+
still check current credits, fees, paused state and mode availability. Mantle mETH
|
|
178
|
+
currently has no included destination. Bus availability is not inferred from peers.
|
|
179
|
+
|
|
180
|
+
`registry:capture` writes candidate evidence only, never runtime pins. Optional
|
|
181
|
+
`RPC_<chainId>` overrides select an RPC without storing its URL. A missing artifact,
|
|
182
|
+
RPC failure or identity mismatch produces an explicit exclusion; a detected reorg
|
|
183
|
+
aborts publication. Review candidate changes and edit the static manifest deliberately.
|
|
184
|
+
The manifest records the evidence digest, and offline tests require exact agreement
|
|
185
|
+
with the reviewed entries and raw contract responses. No runtime fetch trusts metadata.
|
|
186
|
+
|
|
187
|
+
## Historical delivery evidence
|
|
188
|
+
|
|
189
|
+
`fixtures:receipts` refreshes five fixed historical GUIDs, without a signer or sends:
|
|
190
|
+
Base→Arbitrum native ETH and USDC, BNB Chain→Arbitrum USDC (18→6 decimals),
|
|
191
|
+
Flare→Arbitrum USDC.e (OFT→pool), and Arbitrum→Plume ETH/WETH (pool→OFT).
|
|
192
|
+
LayerZero Scan discovers transaction hashes. Successful source/destination receipts,
|
|
193
|
+
block hashes and raw logs are retained in `tests/fixtures/receipts.json`.
|
|
194
|
+
|
|
195
|
+
The collector checks the source endpoint's `PacketSent`, messaging peers, GUID,
|
|
196
|
+
Taxi asset/recipient/amount payload, source `OFTSent`, and destination pool
|
|
197
|
+
`OFTReceived`. Amounts must match after local-decimal conversion. The same checks
|
|
198
|
+
replay offline. These examples establish delivery to the named receiver for plain
|
|
199
|
+
Taxi, without proving unrelated compose actions or implementing a runtime tracker.
|
|
200
|
+
Packet layout: [PacketV1Codec](https://github.com/LayerZero-Labs/LayerZero-v2/blob/main/packages/layerzero-v2/evm/protocol/contracts/messagelib/libs/PacketV1Codec.sol);
|
|
201
|
+
payload layout: [TaxiCodec](https://github.com/stargate-protocol/stargate-v2/blob/414f47412123d7737520c6ba331c1376ec874a88/packages/stg-evm-v2/src/libs/TaxiCodec.sol).
|
|
202
|
+
|
|
203
|
+
## Amount and fee contract
|
|
204
|
+
|
|
205
|
+
`splitSourceAmount` separates the shared-decimal amount from source dust and enforces
|
|
206
|
+
the uint64 wire limit. `destinationAmount` converts a quote receipt from source local
|
|
207
|
+
units to destination units and rejects an unaligned receipt. `sourceMinimum` rounds
|
|
208
|
+
the user's destination floor upward to a representable shared amount before encoding
|
|
209
|
+
it in source units. Negative signed fee details are charges; positive details are
|
|
210
|
+
rewards. A reward must not be rejected merely because output exceeds input.
|
|
211
|
+
|
|
212
|
+
`createStargateQuoter` and `stargateProvider` reject zero effective input/output,
|
|
213
|
+
clipped exact-input receipts, inconsistent signed fees and insufficient output
|
|
214
|
+
credits (including rewards). Caller floors and slippage floors are rounded upward
|
|
215
|
+
to shared precision. Native
|
|
216
|
+
assets are identified by `token() == address(0)`: the captured native pool reports
|
|
217
|
+
`approvalRequired() == true`, so this flag alone must not trigger an ERC20 approve.
|
|
218
|
+
|
|
219
|
+
Quotes verify both chains, deployment identities, reciprocal messaging peers and
|
|
220
|
+
active status at fixed blocks, then recheck block hashes. Nodes more than five
|
|
221
|
+
minutes behind are refused. Credits are not reserved. `etaSeconds`, source gas
|
|
222
|
+
and approval gas are explicitly unknown; the signing wallet estimates execution
|
|
223
|
+
gas. `Quote.etaSeconds` is nullable throughout swap2, its API, router and extension
|
|
224
|
+
view. Unknown ETA receives no speed bonus or fastest tag.
|
|
225
|
+
|
|
226
|
+
The low-level quote separates requested input, actual sent input, dust, protocol
|
|
227
|
+
fee/reward, current messaging fee and its cap (25% default headroom, rounded up).
|
|
228
|
+
ERC20 dust remains in the wallet; native dust is attached with the original input
|
|
229
|
+
and becomes surplus messaging payment sent to the sender as a refund. Native
|
|
230
|
+
refunds depend on the recipient accepting them. `sourceAmount` remains the user's
|
|
231
|
+
requested maximum, while `providerData.sentAmount` and `dust` disclose the wire
|
|
232
|
+
amount. Protocol charges are already deducted from output. Messaging cap is
|
|
233
|
+
additional; neither its unused headroom nor rewards are counted as protocol fees.
|
|
234
|
+
There is no USD oracle in this provider (`feeUsdKnown: "false"`); applications can
|
|
235
|
+
use the router's valuation callback with their own prices.
|
|
236
|
+
|
|
237
|
+
Taxi native drop uses a type-3 executor option addressed to the transfer recipient.
|
|
238
|
+
`nativeDrop: {taxi: amount}` opts in on the provider and client pins. Historical Bus
|
|
239
|
+
recovery uses its recorded batch drop parameters. Arbitrary options and compose
|
|
240
|
+
bytes do not enter the direct executable provider.
|
|
241
|
+
|
|
242
|
+
References: [StargateBase](https://github.com/stargate-protocol/stargate-v2/blob/414f47412123d7737520c6ba331c1376ec874a88/packages/stg-evm-v2/src/StargateBase.sol),
|
|
243
|
+
[native pool](https://github.com/stargate-protocol/stargate-v2/blob/414f47412123d7737520c6ba331c1376ec874a88/packages/stg-evm-v2/src/StargatePoolNative.sol).
|
|
244
|
+
|
|
245
|
+
## Executable compose route
|
|
246
|
+
|
|
247
|
+
With `compose: {enabled: true}` on both the provider and the client pins, a source USDC or
|
|
248
|
+
USDT deployment with an Ethereum counterpart can deliver **another ERC20 on Ethereum**
|
|
249
|
+
(`routeId: "compose"`, also offered by `getQuotes` next to Taxi). The bridge leg is Taxi into
|
|
250
|
+
the pinned LI.FI `ReceiverStargateV2`; its compose message carries one swap that this SDK
|
|
251
|
+
encodes itself: 1inch V6 `unoswap2` through two canonical Uniswap V3 pools (via WETH, USDC or
|
|
252
|
+
USDT), priced by QuoterV2 at one block. No LI.FI or 1inch API is called.
|
|
253
|
+
|
|
254
|
+
- **Exact bridge leg.** The bridge minimum equals the quoted output, so the swap input is
|
|
255
|
+
known exactly; if Stargate's fee rises before the send, the source call reverts instead of
|
|
256
|
+
delivering less than the encoded swap needs.
|
|
257
|
+
- **Self-contained intent.** `stargate:2:compose:…` carries every parameter (amounts, both
|
|
258
|
+
pool words, swap minimum, compose gas, LI.FI transaction id). Clients rebuild the whole
|
|
259
|
+
`sendToken` calldata and refuse any byte of difference, a changed recipient or minimum.
|
|
260
|
+
- **Client preflight.** Before signing, the pins re-quote the bridge (fee within the reviewed
|
|
261
|
+
cap, output unchanged), check the receiver, executor, router and factory bytecode and the
|
|
262
|
+
receiver's executor/endpoint/TokenMessaging wiring, confirm both pools through
|
|
263
|
+
`factory.getPool`, require compose gas ≥ `recoverGas` + 250k, and re-price the exact path:
|
|
264
|
+
a destination price already below the reviewed minimum refuses the build.
|
|
265
|
+
- **Gas.** Compose gas is the receiver's `recoverGas` (100k today) plus 400k for the swap
|
|
266
|
+
(`compose.swapGas`); a two-hop V3 swap measures ~166k. It is paid inside the messaging fee,
|
|
267
|
+
so Ethereum-bound compose quotes cost more than plain Taxi.
|
|
268
|
+
|
|
269
|
+
Tracking states:
|
|
270
|
+
|
|
271
|
+
| State | Evidence |
|
|
272
|
+
|---|---|
|
|
273
|
+
| `completed` | Finalized `ComposeDelivered` plus the executor's swap and an actual final-token payment ≥ the reviewed minimum |
|
|
274
|
+
| `partial` | The receiver's `LiFiTransferRecovered`: the swap did not run and the bridged USDC/USDT was paid to the recipient on Ethereum |
|
|
275
|
+
| `action-required` | Bridge delivered, the Endpoint `composeQueue` still holds the exact message hash, and `composeRetryAfterS` (default 600 s) has passed since delivery. The client's own setting decides: a backend offering the retry earlier is refused at `verifyRecovery` |
|
|
276
|
+
| `pending` | Otherwise, including a consumed queue whose outcome receipt is not yet indexed or finalized |
|
|
277
|
+
|
|
278
|
+
The `compose` recovery offer calls `EndpointV2.lzCompose` with the original message, zero
|
|
279
|
+
value and an explicit `gasLimit` (compose gas or `recoverGas` + 250k, whichever is larger,
|
|
280
|
+
plus 250k overhead): wallet gas estimation would otherwise settle on the receiver's cheaper
|
|
281
|
+
fallback path. A consumed queue is never offered again. `lzCompose` is permissionless, and
|
|
282
|
+
LI.FI documents that anyone can call it first with too little gas and force the fallback
|
|
283
|
+
([ReceiverStargateV2 v1.1.0](https://etherscan.io/address/0xB539B40793171211DCA8834da044fC14bCe64BDC#code));
|
|
284
|
+
the user then holds the bridged token and the route reports `partial`. The receiver does not
|
|
285
|
+
check `composeFrom`, so a user-sent compose is accepted like LI.FI's own.
|
|
286
|
+
|
|
287
|
+
`scripts/verify-fork-compose.mjs` (Anvil forks of Arbitrum and Ethereum, `RPC_42161`/`RPC_1`)
|
|
288
|
+
sends Arbitrum USDC → Ethereum DAI through the HTTP backend and client pins, relays the packet
|
|
289
|
+
locally, then covers two cases: the executor never runs `lzCompose` (a client on the default
|
|
290
|
+
window reports `pending` and refuses to sign the backend's early offer; with the window at 0
|
|
291
|
+
the retry executes and delivers DAI ≥ the minimum),
|
|
292
|
+
and an underfunded third-party `lzCompose` (receiver fallback → `partial`, USDC paid, no
|
|
293
|
+
further offers). Report: `tests/fixtures/fork-compose.json`.
|
|
294
|
+
|
|
295
|
+
## Compose evidence adapter
|
|
296
|
+
|
|
297
|
+
The `./compose` entry point provides a **read-only** adapter for the Ethereum LI.FI
|
|
298
|
+
`ReceiverStargateV2` and its Executor. Receiver and Executor runtime bytecode hashes
|
|
299
|
+
are pinned against fully verified non-proxy contracts. Official deployment/source
|
|
300
|
+
URLs, explorer verification digests, historical identity reads and both code snapshots
|
|
301
|
+
are recorded in `tests/fixtures/compose.json`.
|
|
302
|
+
|
|
303
|
+
`proveLifiStargateCompose` binds the source pool event and Endpoint packet to the exact
|
|
304
|
+
compose sender/payload, bridge asset, composer, final recipient and expected output
|
|
305
|
+
asset. It checks the composer received the bridged tokens and the exact `ComposeSent`
|
|
306
|
+
message. Inputs must come from independently verified canonical finalized blocks;
|
|
307
|
+
passing an API's receipt JSON is not independent chain verification.
|
|
308
|
+
|
|
309
|
+
`lifiStargateComposeOutcome` returns:
|
|
310
|
+
|
|
311
|
+
| Outcome | Required evidence |
|
|
312
|
+
| --- | --- |
|
|
313
|
+
| `completed` | Matching Endpoint delivery, executor swap/completion events and actual final ERC20 payment meeting the caller's minimum |
|
|
314
|
+
| `intermediate-refunded` | Matching Endpoint delivery, pinned receiver recovery event and payment of the bridged asset to the final recipient |
|
|
315
|
+
| `unverified` | Missing/mismatched evidence, ambiguous batches or final native-coin output without independent payment proof |
|
|
316
|
+
|
|
317
|
+
The recorded success is Arbitrum USDC → Ethereum → WLFI via a LI.FI/1inch call. The
|
|
318
|
+
second case returns bridged USDT after the destination swap fails, even though Scan
|
|
319
|
+
reports compose `SUCCEEDED`. This is a destination fallback, not a refund on the source
|
|
320
|
+
chain. Executor `LiFiTransferCompleted` names the input asset and can report a gross
|
|
321
|
+
balance: the adapter counts final-token transfers instead.
|
|
322
|
+
|
|
323
|
+
`stargateComposeQueueState` distinguishes absent (`0`), pending (exact message hash),
|
|
324
|
+
consumed (`1`) and foreign commitments. Consumed messages cannot be replayed. Successful
|
|
325
|
+
fallback consumes the queue too; it cannot be fixed by replaying `lzCompose`.
|
|
326
|
+
`stargateComposeOptions` encodes positive uint128 gas for index zero with no native value.
|
|
327
|
+
|
|
328
|
+
The separate `./compose-dex` entry point exports `validateLifiUnoswap2Compose` for one
|
|
329
|
+
narrow operation: Ethereum 1inch V6 `unoswap2`, two canonical Uniswap V3 pools, ERC20
|
|
330
|
+
input/output. It checks pinned router/factory/composer code at one block, exact input,
|
|
331
|
+
encoded minimum, spender, recipient, pool directions and factory `getPool` identities,
|
|
332
|
+
then rechecks the block hash. Permit2, native unwrap, unknown flags, other selectors
|
|
333
|
+
and arbitrary trailing bytes are refused. The only accepted suffix is the observed
|
|
334
|
+
four bytes `2a94d114` (or no suffix); the pinned router's reviewed `unoswap2` path does
|
|
335
|
+
not read trailing calldata. No ownership or authorization is inferred from that marker.
|
|
336
|
+
|
|
337
|
+
The fixture records raw pool reads and exact runtime hashes. The router is fully
|
|
338
|
+
verified on Blockscout. The factory has **partial** source verification there; its
|
|
339
|
+
runtime hash is pinned separately, and its address matches the
|
|
340
|
+
[official Uniswap Ethereum deployment](https://developers.uniswap.org/docs/protocols/v3/deployments/v3-ethereum-deployments).
|
|
341
|
+
This is not a claim of a reproducible factory source build. The success fixture passes
|
|
342
|
+
the DEX validator; the opaque aggregator call in the fallback fixture is refused.
|
|
343
|
+
|
|
344
|
+
Historical proofs and DEX validation results have `executionSupported: false`: they
|
|
345
|
+
establish observed payment and one call's constraints, not execution authorization. Only
|
|
346
|
+
proofs built by `stargateComposeProof` for an SDK-encoded intent report `true`. Arbitrary
|
|
347
|
+
DEX calldata stays refused, and read-only proof support must not be used as a spender or
|
|
348
|
+
contract allowlist. API access is not needed to refresh these
|
|
349
|
+
historical fixtures. The receiver may return the intermediate asset on insufficient
|
|
350
|
+
compose gas or swap failure; successful queue consumption does not guarantee a swap.
|
|
351
|
+
|
|
352
|
+
## Server and mobile examples
|
|
353
|
+
|
|
354
|
+
Workspace examples: `examples/server/src/stargate.ts`
|
|
355
|
+
and `examples/swap/src/stargate.ts`. The backend
|
|
356
|
+
holds RPC credentials and quote sealing secrets. The mobile client uses its own pins
|
|
357
|
+
and independent/public or application-proxied RPCs, requires execution review and a
|
|
358
|
+
durable operation store. No LayerZero API key is needed for direct Taxi. React Native
|
|
359
|
+
must install the normal Hermes polyfills before importing wallet/protocol packages.
|
|
360
|
+
`stargatePins` also supplies independent client tracking and recovery validation:
|
|
361
|
+
backend status cannot substitute for verified payout, and each recovery offer is
|
|
362
|
+
checked against the client's current on-chain commitment before signing.
|
|
363
|
+
|
|
364
|
+
`module.json` registers this package in the module registry. The separate LayerZero
|
|
365
|
+
discovery transport is not an executable protocol module and stays private.
|
|
366
|
+
|
|
367
|
+
## Execution and tracking contract
|
|
368
|
+
|
|
369
|
+
| Flow | Evidence and identity | Completion / recovery |
|
|
370
|
+
|---|---|---|
|
|
371
|
+
| Taxi | Source receipt, pool, asset mapping, GUID, destination TokenMessaging peer | Verify destination pool `OFTReceived` for the expected receiver/asset/amount |
|
|
372
|
+
| Bus | `BusRode` ticket/passenger, then the matching `BusDriven` ticket range and GUID | Track the specific passenger; one package GUID does not identify one payout |
|
|
373
|
+
| Cached token | Destination `UnreceivedTokenCached` and matching `unreceivedTokens` commitment | Revalidate and build `retryReceiveToken`; completion requires payout evidence |
|
|
374
|
+
| Undelivered LayerZero message | Verified endpoint packet/pathway and current execution state | Separate endpoint retry; do not confuse it with cached-token recovery |
|
|
375
|
+
| Compose | Bridge delivery plus adapter-specific final action evidence | Final swap completes only after the requested action; recovery depends on the actual composer |
|
|
376
|
+
|
|
377
|
+
Taxi runtime tracking replays all five historical mainnet transfers. It verifies
|
|
378
|
+
source sender/amount, endpoint packet/pathway, GUID, asset and receiver, then checks
|
|
379
|
+
the destination pool's payout and canonical receipt/log identities. Scan supplies
|
|
380
|
+
candidate transaction hashes only. By default receipts must be below the RPC's
|
|
381
|
+
`finalized` head; `confirmations[chain]` explicitly substitutes an app's chosen
|
|
382
|
+
confirmation depth. RPC outages, unindexed messages and reorgs remain pending.
|
|
383
|
+
A finalized reverted direct source call is failed, never refunded.
|
|
384
|
+
|
|
385
|
+
Cached-token recovery requires the exact `unreceivedTokens` commitment. Endpoint
|
|
386
|
+
retry separately requires the exact `inboundPayloadHash` of GUID + message; cleared
|
|
387
|
+
or nilified payloads are refused. Both quote a distinct destination transaction
|
|
388
|
+
with separately paid wallet gas. Token retries and plain Taxi message retries attach
|
|
389
|
+
zero value; Bus message retries fund native drops for the entire batch. Client validation rereads
|
|
390
|
+
the commitment after review. They integrate with the durable `recoverSwap2` flow,
|
|
391
|
+
whose operation ID and transaction hash are separate from the original source.
|
|
392
|
+
Taxi native drops require a successful `NativeDropApplied` from a reviewed Executor,
|
|
393
|
+
matching source/destination EIDs, TokenMessaging peers, message nonce, recipient and
|
|
394
|
+
successfully paid amount. The built-in executor pin currently covers Base; other chains
|
|
395
|
+
remain `partial` unless the app supplies explicitly reviewed `taxiExecutors` pins.
|
|
396
|
+
The pinned Base address is backed by official metadata, historical endpoint/EID reads,
|
|
397
|
+
code hash and immutable upstream Executor/IExecutor sources in `fixtures/recovery.json`.
|
|
398
|
+
Native drop and token payout may occur in different transactions; each receipt is
|
|
399
|
+
verified independently. Scan supplies hashes only, never payout authority.
|
|
400
|
+
Bus native drops require matching TokenMessaging drop events
|
|
401
|
+
and one authenticated Endpoint `PacketDelivered` in the destination receipt. Ambiguous
|
|
402
|
+
batch attribution or failed drops remain `partial` even when the token was paid.
|
|
403
|
+
`fixtures/recovery.json` includes a real Arbitrum → Ethereum cached native-token
|
|
404
|
+
delivery and its later `retryReceiveToken` payout, with historical commitment reads
|
|
405
|
+
before/after the retry. It also includes an Arbitrum → Base Taxi transfer whose token
|
|
406
|
+
and native-drop payouts are independently checked. Synthetic mutations are labelled.
|
|
407
|
+
|
|
408
|
+
Bus tracking replays four historical batches containing twelve passengers: three
|
|
409
|
+
Base → Arbitrum batches (mixed ETH/USDC and one native drop), plus a Base → Ethereum
|
|
410
|
+
batch delivered by a direct permissionless `Endpoint.lzReceive` call. The latter records
|
|
411
|
+
the pending payload commitment before execution and its clearing afterwards, and replays
|
|
412
|
+
the actual recovery calldata through both passengers' tracker/recovery paths. It proves
|
|
413
|
+
manual execution of a verified pending message; it does not claim an earlier reverted
|
|
414
|
+
execution attempt. These records are in `fixtures/bus-receipts.json`.
|
|
415
|
+
`fixtures:bus` refreshes these fixed GUIDs with read-only receipt, block and log queries.
|
|
416
|
+
The runtime links the source `BusRode` ticket to its exact seat in the driven packet.
|
|
417
|
+
Because `OFTReceived` omits the seat, it checks the complete ordered payout/cache sequence
|
|
418
|
+
for that asset; two identical passengers cannot claim each other's payment. Later cached
|
|
419
|
+
token retries must also match the exact pool calldata and seat.
|
|
420
|
+
|
|
421
|
+
Default Bus discovery scans at most eight pages of 2,000 blocks. Apps can configure
|
|
422
|
+
`busLogPageSize`/`busLogPages` or supply `findBusDrive` and `queuedBusPassengers` indexer
|
|
423
|
+
callbacks for older queues. Hints never replace receipt verification or the current
|
|
424
|
+
on-chain queue hash-chain commitment. Queue wait time remains unknown.
|
|
425
|
+
|
|
426
|
+
`stargatePins(config)` requires the client's own source/destination RPCs and reviewed
|
|
427
|
+
registry. It verifies the entire canonical `sendToken` calldata, including mode,
|
|
428
|
+
recipient, amount, minimum, refund address, options, native value and spender.
|
|
429
|
+
Remote builds additionally recheck current chain state and fees on the client,
|
|
430
|
+
including after the backend's preflight. A backend cannot substitute that check.
|
|
431
|
+
`getQuotes` enumerates Taxi only for previews; an explicit retired Bus selector is refused without fallback.
|
|
432
|
+
|
|
433
|
+
Bus acceleration assembles the valid current queue prefix through the user's ticket,
|
|
434
|
+
checks its hash chain and obtains `quoteDriveBus`. It reviews a separate source-chain
|
|
435
|
+
payment for the entire prefix, with gas additional. The current queue and exact fee are
|
|
436
|
+
revalidated after review, including competing drives. No offer is returned if the ticket
|
|
437
|
+
cannot fit in the next permitted batch or indexed passenger bytes are incomplete.
|
|
438
|
+
See [TokenMessaging](https://github.com/stargate-protocol/stargate-v2/blob/414f47412123d7737520c6ba331c1376ec874a88/packages/stg-evm-v2/src/messaging/TokenMessaging.sol)
|
|
439
|
+
and [Bus events](https://github.com/stargate-protocol/stargate-v2/blob/414f47412123d7737520c6ba331c1376ec874a88/packages/stg-evm-v2/src/libs/Bus.sol).
|
|
440
|
+
|
|
441
|
+
## Integration boundaries and remaining work
|
|
442
|
+
|
|
443
|
+
### Wallet history
|
|
444
|
+
|
|
445
|
+
The provider's `describeActivity` hook is used by both the standalone protocol and
|
|
446
|
+
the router. Confirmed local legs require the original receipt in
|
|
447
|
+
`ChainTx.raw.tx.receipt`, as supplied by history-evm RPC/Alchemy enrichment. It checks
|
|
448
|
+
receipt/log identity and reads `OFTSent` / `OFTReceived` only from the reviewed pool.
|
|
449
|
+
Bus deposits are labelled queued; incoming payouts are labelled received. A separate
|
|
450
|
+
owned `BusDriven` transaction is shown as a queue payment. These are local history
|
|
451
|
+
items, not an assertion that the full cross-chain intent is complete.
|
|
452
|
+
|
|
453
|
+
Assets use actual event amounts, excluding messaging fees from the bridged principal.
|
|
454
|
+
The history fee contains the owner's transaction gas when available (plus the attached
|
|
455
|
+
payment for a Bus drive); it does not reconstruct messaging refunds or native drops.
|
|
456
|
+
The destination executor's gas is never charged to the recipient in history. Ordinary
|
|
457
|
+
token movements, cached-token events and confirmed transactions without receipt
|
|
458
|
+
enrichment are left to generic history. Pending/failed direct `sendToken` calls can
|
|
459
|
+
be labelled without fabricating successful asset movements.
|
|
460
|
+
|
|
461
|
+
### Remaining stages
|
|
462
|
+
|
|
463
|
+
- SDK-323: implemented reviewed registry and evidence collection for the current
|
|
464
|
+
supported intersection; coverage and explicit exclusions are listed above.
|
|
465
|
+
- SDK-324: core/router now support optional display candidates, stable `routeId`,
|
|
466
|
+
`using(provider, routeId)`, sealed remote candidates and pinned requotes. Existing
|
|
467
|
+
`getQuote`, `using(provider)` and tracking IDs remain compatible. Stargate's
|
|
468
|
+
provider now implements these hooks.
|
|
469
|
+
- SDK-325: core now provides application-owned atomic journals, read-only reconciliation
|
|
470
|
+
and a separate reviewed/value-bounded EVM recovery path. Stargate supplies the
|
|
471
|
+
on-chain validators and recovery offers described under SDK-328/329. Old `awk1` IDs and zero-value
|
|
472
|
+
claims retain their existing contracts.
|
|
473
|
+
- SDK-326/327: direct quoting, execution and client pins are implemented and tested.
|
|
474
|
+
SDK-328: Taxi payout tracking, cached-token recovery and native-drop evidence are
|
|
475
|
+
implemented, with recorded recovery and Base native-drop receipts/state.
|
|
476
|
+
- SDK-329: Bus ticket/batch/passenger tracking, native-drop evidence and paid queue
|
|
477
|
+
recovery are implemented. Historical batches and manual endpoint execution are replayed;
|
|
478
|
+
queue races and duplicate-passenger/cache cases also use labelled synthetic evidence.
|
|
479
|
+
- SDK-330/SDK-331: API discovery and resumable steps, key held server-side. Include only
|
|
480
|
+
routes for which every wallet operation has a validator. EVM multicall, signatures
|
|
481
|
+
and fresh Solana transactions need separate adapters. Unknown VM steps fail closed.
|
|
482
|
+
- SDK-332: executable compose route (opt-in) built on the Ethereum LI.FI composer evidence
|
|
483
|
+
adapter: SDK-encoded intent, client preflight, router candidate, journalled execution,
|
|
484
|
+
`completed` / `partial` tracking and a gas-bounded `lzCompose` retry, verified on mainnet
|
|
485
|
+
forks and one funded mainnet transfer (Arbitrum USDC → Ethereum DAI). Other DEX variants
|
|
486
|
+
and composers remain out of scope.
|
|
487
|
+
- SDK-333: history, documentation, exports, module registry entry, changeset and conformance
|
|
488
|
+
are in place. Funded Taxi transfers passed in both directions (Arbitrum ⇄ Base USDC) with a
|
|
489
|
+
fresh-process resume. Published as 0.1.0 on 2026-11-17; a funded native ETH transfer and
|
|
490
|
+
validation of the persistent journal on a mobile device are still owed.
|
|
491
|
+
|
|
492
|
+
The shared `pnpm test:hermes` smoke includes Stargate bigint/dust and uint72 ticket
|
|
493
|
+
handling, recorded cached-token recovery receipts, native-drop tuple decoding and
|
|
494
|
+
LayerZero public discovery, compose success/fallback and canonical DEX pool validation.
|
|
495
|
+
It passed 370 checks in the React Native 0.81.5 Hermes VM.
|
|
496
|
+
This offline VM check does not replace a mobile end-to-end transfer.
|
|
497
|
+
|
|
498
|
+
Stage 1 remains open for authenticated API contract fixtures. Taxi native-drop executor
|
|
499
|
+
coverage beyond Base requires separately reviewed pins. The collection commands above
|
|
500
|
+
never send transactions; only `verify-mainnet.mjs --send` does.
|
|
501
|
+
|
|
502
|
+
Protocol documentation: [Stargate integration](https://docs.layerzero.network/v2/developers/evm/stargate/overview),
|
|
503
|
+
[Value Transfer API](https://docs.layerzero.network/v2/developers/value-transfer-api/overview).
|
package/dist/abi.cjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
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/abi.ts
|
|
21
|
+
var abi_exports = {};
|
|
22
|
+
__export(abi_exports, {
|
|
23
|
+
ENDPOINT_ABI: () => ENDPOINT_ABI,
|
|
24
|
+
EXECUTOR_ABI: () => EXECUTOR_ABI,
|
|
25
|
+
STARGATE_ABI: () => STARGATE_ABI,
|
|
26
|
+
TOKEN_MESSAGING_ABI: () => TOKEN_MESSAGING_ABI
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(abi_exports);
|
|
29
|
+
var import_viem = require("viem");
|
|
30
|
+
var EXECUTOR_ABI = (0, import_viem.parseAbi)([
|
|
31
|
+
"struct Origin { uint32 srcEid; bytes32 sender; uint64 nonce; }",
|
|
32
|
+
"struct NativeDropParams { address receiver; uint256 amount; }",
|
|
33
|
+
"function endpoint() view returns (address)",
|
|
34
|
+
"function localEid() view returns (uint32)",
|
|
35
|
+
"event NativeDropApplied(Origin origin, uint32 dstEid, address oapp, NativeDropParams[] params, bool[] success)"
|
|
36
|
+
]);
|
|
37
|
+
var ENDPOINT_ABI = (0, import_viem.parseAbi)([
|
|
38
|
+
"struct Origin { uint32 srcEid; bytes32 sender; uint64 nonce; }",
|
|
39
|
+
"function inboundPayloadHash(address receiver, uint32 srcEid, bytes32 sender, uint64 nonce) view returns (bytes32)",
|
|
40
|
+
"function lzReceive(Origin origin, address receiver, bytes32 guid, bytes message, bytes extraData) payable",
|
|
41
|
+
"event PacketSent(bytes encodedPayload, bytes options, address sendLibrary)",
|
|
42
|
+
"event PacketDelivered(Origin origin, address receiver)"
|
|
43
|
+
]);
|
|
44
|
+
var STARGATE_ABI = (0, import_viem.parseAbi)([
|
|
45
|
+
"struct SendParam { uint32 dstEid; bytes32 to; uint256 amountLD; uint256 minAmountLD; bytes extraOptions; bytes composeMsg; bytes oftCmd; }",
|
|
46
|
+
"struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; }",
|
|
47
|
+
"struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; }",
|
|
48
|
+
"struct OFTLimit { uint256 minAmountLD; uint256 maxAmountLD; }",
|
|
49
|
+
"struct OFTFeeDetail { int256 feeAmountLD; string description; }",
|
|
50
|
+
"struct OFTReceipt { uint256 amountSentLD; uint256 amountReceivedLD; }",
|
|
51
|
+
"struct Ticket { uint72 ticketId; bytes passengerBytes; }",
|
|
52
|
+
"struct AddressConfig { address feeLib; address planner; address treasurer; address tokenMessaging; address creditMessaging; address lzToken; }",
|
|
53
|
+
"function token() view returns (address)",
|
|
54
|
+
"function sharedDecimals() view returns (uint8)",
|
|
55
|
+
"function approvalRequired() pure returns (bool)",
|
|
56
|
+
"function localEid() view returns (uint32)",
|
|
57
|
+
"function endpoint() view returns (address)",
|
|
58
|
+
"function status() view returns (uint8)",
|
|
59
|
+
"function stargateType() pure returns (uint8)",
|
|
60
|
+
"function paths(uint32 eid) view returns (uint64 credit)",
|
|
61
|
+
"function getAddressConfig() view returns (AddressConfig)",
|
|
62
|
+
"function quoteOFT(SendParam s) view returns (OFTLimit limit, OFTFeeDetail[] oftFeeDetails, OFTReceipt receipt)",
|
|
63
|
+
"function quoteSend(SendParam s, bool payInLzToken) view returns (MessagingFee fee)",
|
|
64
|
+
"function send(SendParam s, MessagingFee fee, address refundAddress) payable returns (MessagingReceipt msgReceipt, OFTReceipt oftReceipt)",
|
|
65
|
+
"function sendToken(SendParam s, MessagingFee fee, address refundAddress) payable returns (MessagingReceipt msgReceipt, OFTReceipt oftReceipt, Ticket ticket)",
|
|
66
|
+
"function unreceivedTokens(bytes32 guid, uint8 index) view returns (bytes32)",
|
|
67
|
+
"function retryReceiveToken(bytes32 guid, uint8 index, uint32 srcEid, address receiver, uint256 amountLD, bytes composeMsg)",
|
|
68
|
+
"event OFTSent(bytes32 indexed guid, uint32 dstEid, address indexed fromAddress, uint256 amountSentLD, uint256 amountReceivedLD)",
|
|
69
|
+
"event OFTReceived(bytes32 indexed guid, uint32 srcEid, address indexed toAddress, uint256 amountReceivedLD)",
|
|
70
|
+
"event UnreceivedTokenCached(bytes32 guid, uint8 index, uint32 srcEid, address receiver, uint256 amountLD, bytes composeMsg)"
|
|
71
|
+
]);
|
|
72
|
+
var TOKEN_MESSAGING_ABI = (0, import_viem.parseAbi)([
|
|
73
|
+
"error Bus_InvalidFare(bool nativeDrop)",
|
|
74
|
+
"struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; }",
|
|
75
|
+
"struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; }",
|
|
76
|
+
"function assetIds(address stargateImpl) view returns (uint16)",
|
|
77
|
+
"function stargateImpls(uint16 assetId) view returns (address)",
|
|
78
|
+
"function peers(uint32 eid) view returns (bytes32)",
|
|
79
|
+
"function endpoint() view returns (address)",
|
|
80
|
+
"function nativeDropAmounts(uint32 eid) view returns (uint128)",
|
|
81
|
+
"function queueCapacity() view returns (uint16)",
|
|
82
|
+
"function busQueues(uint32 eid) view returns (uint8 maxNumPassengers, uint80 busFare, uint80 busAndNativeDropFare, uint16 qLength, uint72 nextTicketId)",
|
|
83
|
+
"function getPassengerHash(uint32 eid, uint16 index) view returns (bytes32)",
|
|
84
|
+
"function quoteDriveBus(uint32 dstEid, bytes passengers) view returns (MessagingFee fee)",
|
|
85
|
+
"function driveBus(uint32 dstEid, bytes passengers) payable returns (MessagingReceipt receipt)",
|
|
86
|
+
"event BusRode(uint32 dstEid, uint72 ticketId, uint80 fare, bytes passenger)",
|
|
87
|
+
"event BusDriven(uint32 dstEid, uint72 startTicketId, uint8 numPassengers, bytes32 guid)",
|
|
88
|
+
"event NativeDropApplied(address receiver, uint128 amount)",
|
|
89
|
+
"event NativeDropFailed(address receiver, uint128 amount)"
|
|
90
|
+
]);
|
|
91
|
+
//# sourceMappingURL=abi.cjs.map
|
package/dist/abi.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/abi.ts"],"sourcesContent":["import {parseAbi} from \"viem\";\n\n// LayerZero-v2 592625b9e5967643853476445ffe0e777360b906: historical Executor/IExecutor.\nexport const EXECUTOR_ABI = parseAbi([\n \"struct Origin { uint32 srcEid; bytes32 sender; uint64 nonce; }\",\n \"struct NativeDropParams { address receiver; uint256 amount; }\",\n \"function endpoint() view returns (address)\",\n \"function localEid() view returns (uint32)\",\n \"event NativeDropApplied(Origin origin, uint32 dstEid, address oapp, NativeDropParams[] params, bool[] success)\",\n]);\n\nexport const ENDPOINT_ABI = parseAbi([\n \"struct Origin { uint32 srcEid; bytes32 sender; uint64 nonce; }\",\n \"function inboundPayloadHash(address receiver, uint32 srcEid, bytes32 sender, uint64 nonce) view returns (bytes32)\",\n \"function lzReceive(Origin origin, address receiver, bytes32 guid, bytes message, bytes extraData) payable\",\n \"event PacketSent(bytes encodedPayload, bytes options, address sendLibrary)\",\n \"event PacketDelivered(Origin origin, address receiver)\",\n]);\n\n// SDK-322: checked against pinned upstream deployment ABI by abi.test.ts.\n// Provenance: tests/fixtures/upstream.json. This is an interface, not a deployment allowlist.\nexport const STARGATE_ABI = parseAbi([\n \"struct SendParam { uint32 dstEid; bytes32 to; uint256 amountLD; uint256 minAmountLD; bytes extraOptions; bytes composeMsg; bytes oftCmd; }\",\n \"struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; }\",\n \"struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; }\",\n \"struct OFTLimit { uint256 minAmountLD; uint256 maxAmountLD; }\",\n \"struct OFTFeeDetail { int256 feeAmountLD; string description; }\",\n \"struct OFTReceipt { uint256 amountSentLD; uint256 amountReceivedLD; }\",\n \"struct Ticket { uint72 ticketId; bytes passengerBytes; }\",\n \"struct AddressConfig { address feeLib; address planner; address treasurer; address tokenMessaging; address creditMessaging; address lzToken; }\",\n \"function token() view returns (address)\",\n \"function sharedDecimals() view returns (uint8)\",\n \"function approvalRequired() pure returns (bool)\",\n \"function localEid() view returns (uint32)\",\n \"function endpoint() view returns (address)\",\n \"function status() view returns (uint8)\",\n \"function stargateType() pure returns (uint8)\",\n \"function paths(uint32 eid) view returns (uint64 credit)\",\n \"function getAddressConfig() view returns (AddressConfig)\",\n \"function quoteOFT(SendParam s) view returns (OFTLimit limit, OFTFeeDetail[] oftFeeDetails, OFTReceipt receipt)\",\n \"function quoteSend(SendParam s, bool payInLzToken) view returns (MessagingFee fee)\",\n \"function send(SendParam s, MessagingFee fee, address refundAddress) payable returns (MessagingReceipt msgReceipt, OFTReceipt oftReceipt)\",\n \"function sendToken(SendParam s, MessagingFee fee, address refundAddress) payable returns (MessagingReceipt msgReceipt, OFTReceipt oftReceipt, Ticket ticket)\",\n \"function unreceivedTokens(bytes32 guid, uint8 index) view returns (bytes32)\",\n \"function retryReceiveToken(bytes32 guid, uint8 index, uint32 srcEid, address receiver, uint256 amountLD, bytes composeMsg)\",\n \"event OFTSent(bytes32 indexed guid, uint32 dstEid, address indexed fromAddress, uint256 amountSentLD, uint256 amountReceivedLD)\",\n \"event OFTReceived(bytes32 indexed guid, uint32 srcEid, address indexed toAddress, uint256 amountReceivedLD)\",\n \"event UnreceivedTokenCached(bytes32 guid, uint8 index, uint32 srcEid, address receiver, uint256 amountLD, bytes composeMsg)\",\n]);\n\nexport const TOKEN_MESSAGING_ABI = parseAbi([\n \"error Bus_InvalidFare(bool nativeDrop)\",\n \"struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; }\",\n \"struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; }\",\n \"function assetIds(address stargateImpl) view returns (uint16)\",\n \"function stargateImpls(uint16 assetId) view returns (address)\",\n \"function peers(uint32 eid) view returns (bytes32)\",\n \"function endpoint() view returns (address)\",\n \"function nativeDropAmounts(uint32 eid) view returns (uint128)\",\n \"function queueCapacity() view returns (uint16)\",\n \"function busQueues(uint32 eid) view returns (uint8 maxNumPassengers, uint80 busFare, uint80 busAndNativeDropFare, uint16 qLength, uint72 nextTicketId)\",\n \"function getPassengerHash(uint32 eid, uint16 index) view returns (bytes32)\",\n \"function quoteDriveBus(uint32 dstEid, bytes passengers) view returns (MessagingFee fee)\",\n \"function driveBus(uint32 dstEid, bytes passengers) payable returns (MessagingReceipt receipt)\",\n \"event BusRode(uint32 dstEid, uint72 ticketId, uint80 fare, bytes passenger)\",\n \"event BusDriven(uint32 dstEid, uint72 startTicketId, uint8 numPassengers, bytes32 guid)\",\n \"event NativeDropApplied(address receiver, uint128 amount)\",\n \"event NativeDropFailed(address receiver, uint128 amount)\",\n]);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AAGhB,IAAM,mBAAe,sBAAS;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,mBAAe,sBAAS;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAIM,IAAM,mBAAe,sBAAS;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,0BAAsB,sBAAS;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":[]}
|