@provablehq/aleo-bridge-sdk 0.8.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +325 -0
- package/dist/agent/index.d.ts +22 -0
- package/dist/agent/index.js +7 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/chunk-KG3LFIU5.js +61 -0
- package/dist/chunk-KG3LFIU5.js.map +1 -0
- package/dist/createBridgeClient-CjHY-JvW.d.ts +779 -0
- package/dist/index.d.ts +421 -0
- package/dist/index.js +1627 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +26 -0
- package/dist/mcp/index.js +13 -0
- package/dist/mcp/index.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Provable Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# @provablehq/aleo-bridge-sdk
|
|
2
|
+
|
|
3
|
+
A protocol-oriented bridge client for Aleo. USDCx transfers use Circle
|
|
4
|
+
xReserve. ETH, WBTC, USDT, SOL, ALEO, and USAD transfers use Hyperlane Warp Routes.
|
|
5
|
+
|
|
6
|
+
The package is in preview and is not published to npm. It provides reviewed
|
|
7
|
+
route discovery, non-fund-moving transfer plans, and injected-wallet execution
|
|
8
|
+
for Ethereum-to-Aleo xReserve USDC deposits and Hyperlane routes carrying ETH,
|
|
9
|
+
WBTC, and USDT. Aleo-origin and Solana execution paths remain under development.
|
|
10
|
+
|
|
11
|
+
## Current API
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { createBridgeClient } from '@provablehq/aleo-bridge-sdk'
|
|
15
|
+
|
|
16
|
+
const bridge = createBridgeClient({ environment: 'mainnet' })
|
|
17
|
+
|
|
18
|
+
const routes = bridge.getRoutes({
|
|
19
|
+
protocol: 'xreserve',
|
|
20
|
+
sourceChainId: 'ethereum',
|
|
21
|
+
destinationChainId: 'aleo',
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const plan = bridge.prepareTransfer({
|
|
25
|
+
routeId: routes[0]!.id,
|
|
26
|
+
amount: '25',
|
|
27
|
+
recipient: aleoAddress,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
plan.steps
|
|
31
|
+
// approve → deposit → wait-attestation → mint
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`prepareTransfer` is pure and local. It validates the route, amount precision,
|
|
35
|
+
and recipient format, then identifies every execution step and the first
|
|
36
|
+
irreversible operation. It does not query live fees, sign, submit, or move
|
|
37
|
+
funds.
|
|
38
|
+
|
|
39
|
+
## Ethereum xReserve execution
|
|
40
|
+
|
|
41
|
+
The xReserve action derives the Aleo wire recipient and 65-byte hook from the
|
|
42
|
+
plan. Select `public`, `record`, or `private`; the deprecated
|
|
43
|
+
`privateRecipient: true` option remains an alias for `mintMode: 'private'`.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const bridge = createBridgeClient({
|
|
47
|
+
environment: 'testnet',
|
|
48
|
+
executors: { evm: injectedProvider },
|
|
49
|
+
xReserveHttpTransport: (url, init) => fetch(url, init),
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const plan = bridge.prepareTransfer({
|
|
53
|
+
routeId: 'xreserve:sepolia/usdc->aleo-testnet/usdcx',
|
|
54
|
+
amount: '25',
|
|
55
|
+
recipient: aleoAddress,
|
|
56
|
+
sender: connectedEthereumAccount,
|
|
57
|
+
mintMode: 'private',
|
|
58
|
+
privateMintSecretNonce: '7scalar', // Optional; defaults to 0scalar.
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const quote = await bridge.quoteEvmXReserveTransfer({ plan })
|
|
62
|
+
const execution = await bridge.executeEvmXReserveTransfer({ plan })
|
|
63
|
+
const attestation = await bridge.getXReserveAttestation({
|
|
64
|
+
routeId: plan.route.id,
|
|
65
|
+
messageHash: execution.receipt.id as `0x${string}`,
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Execution reads USDC balance and allowance, submits an exact-amount approval
|
|
70
|
+
when needed, waits for confirmation, and calls the nonpayable
|
|
71
|
+
`depositToRemote`. It then validates `DepositedToRemote`, derives Circle's
|
|
72
|
+
deposit nonce, builds the canonical 305-byte payload, and returns
|
|
73
|
+
`ATTESTATION_PENDING` with the message hash and resumable protocol state.
|
|
74
|
+
|
|
75
|
+
Private mode lazily loads the optional `@provablehq/sdk` peer dependency. It
|
|
76
|
+
commits the intended recipient with BHP256 and directs the xReserve deposit to
|
|
77
|
+
`shielded_usdcx_wrapper.aleo`. Public and record modes do not load Aleo WASM.
|
|
78
|
+
Circle attestation HTTP access is injected so browser, Node, and React Native
|
|
79
|
+
applications can supply their own fetch-compatible transport.
|
|
80
|
+
|
|
81
|
+
Public and record USDCx destination mints are protocol-driven. Only private
|
|
82
|
+
USDCx minting requires a second user transaction on Aleo. Once Circle returns a
|
|
83
|
+
completed attestation, submit the wrapper call through a Veil wallet client:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
const bridge = createBridgeClient({
|
|
87
|
+
environment: 'testnet',
|
|
88
|
+
executors: {
|
|
89
|
+
evm: injectedEvmProvider,
|
|
90
|
+
aleo: aleoWalletClient,
|
|
91
|
+
},
|
|
92
|
+
xReserveHttpTransport: (url, init) => fetch(url, init),
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const mint = await bridge.executeXReservePrivateMint({
|
|
96
|
+
plan,
|
|
97
|
+
deposit: execution.receipt,
|
|
98
|
+
attestation,
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
This calls `shielded_usdcx_wrapper.aleo/private_mint` with the 305-byte payload,
|
|
103
|
+
65-byte Circle signature, 32-byte message hash, the plan's secret scalar nonce,
|
|
104
|
+
and intended Aleo recipient. The wrapper reproduces the recipient commitment, mints publicly to
|
|
105
|
+
its own program address, and transfers the amount to the recipient as a record.
|
|
106
|
+
|
|
107
|
+
## Ethereum Hyperlane execution
|
|
108
|
+
|
|
109
|
+
Pass an EIP-1193-compatible provider from MetaMask, Phantom, or another injected
|
|
110
|
+
wallet. The bridge never receives the wallet's private key.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { createBridgeClient, type EvmBridgeExecutor } from '@provablehq/aleo-bridge-sdk'
|
|
114
|
+
|
|
115
|
+
const bridge = createBridgeClient({
|
|
116
|
+
environment: 'mainnet',
|
|
117
|
+
executors: {
|
|
118
|
+
evm: injectedProvider as EvmBridgeExecutor,
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
const plan = bridge.prepareTransfer({
|
|
123
|
+
routeId: 'hyperlane:ethereum/wbtc->aleo/wbtc',
|
|
124
|
+
amount: '0.001',
|
|
125
|
+
recipient: aleoAddress,
|
|
126
|
+
sender: connectedEthereumAccount,
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
const quote = await bridge.quoteEvmHyperlaneTransfer({
|
|
130
|
+
plan,
|
|
131
|
+
recipientBytes32: encodedAleoRecipient,
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
const execution = await bridge.executeEvmHyperlaneTransfer({
|
|
135
|
+
plan,
|
|
136
|
+
recipientBytes32: encodedAleoRecipient,
|
|
137
|
+
})
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
`quoteEvmHyperlaneTransfer` calls the route's `quoteTransferRemote` function and
|
|
141
|
+
returns atomic native payment and token-allowance requirements. It does not sign
|
|
142
|
+
or submit a transaction.
|
|
143
|
+
|
|
144
|
+
`executeEvmHyperlaneTransfer` requotes immediately before submission. For WBTC
|
|
145
|
+
and USDT it reads the current ERC-20 allowance, submits `approve` only when the
|
|
146
|
+
allowance is insufficient, waits for confirmation, and then submits
|
|
147
|
+
`transferRemote`. USDT's non-zero allowance is reset to zero before setting a
|
|
148
|
+
new value. Native ETH routes skip approval and send the quoted total as
|
|
149
|
+
`msg.value`.
|
|
150
|
+
|
|
151
|
+
The wire recipient is currently explicit. `recipientBytes32` MUST be the exact
|
|
152
|
+
32-byte Aleo recipient encoding accepted by the enrolled Hyperlane router; it is
|
|
153
|
+
validated for width but is not derived from `plan.recipient` yet.
|
|
154
|
+
|
|
155
|
+
Receipt timeouts return `SOURCE_APPROVAL_PENDING` or `SOURCE_CONFIRMING` with the
|
|
156
|
+
submitted transaction identifiers. A timeout does not report the transaction as
|
|
157
|
+
failed. A confirmed dispatch returns `DELIVERY_PENDING` and includes the
|
|
158
|
+
Hyperlane message id when the Mailbox `DispatchId` event is present.
|
|
159
|
+
|
|
160
|
+
Inbound Hyperlane Aleo minting is performed by the Hyperlane relayer. The user
|
|
161
|
+
submits only the source-chain approval and dispatch transactions; no Aleo wallet
|
|
162
|
+
transaction is requested for Hyperlane delivery.
|
|
163
|
+
|
|
164
|
+
## Aleo USDCx burns
|
|
165
|
+
|
|
166
|
+
USDCx burns submit one Aleo transaction. The Aleo-operated burn attestation
|
|
167
|
+
service observes accepted burns and forwards them to Circle; the bridge client
|
|
168
|
+
does not submit a second attestation or Ethereum withdrawal transaction.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
const plan = bridge.prepareTransfer({
|
|
172
|
+
routeId: 'xreserve:aleo/usdcx->ethereum/usdc',
|
|
173
|
+
amount: '25',
|
|
174
|
+
recipient: ethereumRecipient,
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
const burn = await bridge.executeXReserveBurn({
|
|
178
|
+
plan,
|
|
179
|
+
userRecord,
|
|
180
|
+
merkleProof,
|
|
181
|
+
// Default: private
|
|
182
|
+
})
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Private burning is the default. Three transition modes remain available:
|
|
186
|
+
|
|
187
|
+
- `private` calls `shielded_usdcx_wrapper.aleo/private_burn` and requires a
|
|
188
|
+
USDCx `Token` record input plus an encoded `[MerkleProof; 2]` literal.
|
|
189
|
+
- `public` calls `burn_public` for public or program-owned balances.
|
|
190
|
+
- `public-as-signer` calls `burn_public_as_signer` when the public balance must
|
|
191
|
+
be proven to belong to the EOA signer.
|
|
192
|
+
|
|
193
|
+
Ethereum's native destination domain is pinned to `0u32`; its address is
|
|
194
|
+
left-padded to `[u8; 32]`. ARC domain `26u32` is recorded in the registry but is
|
|
195
|
+
not selectable through the Ethereum route. Pause, freeze-list, and mutable
|
|
196
|
+
minimum/maximum burn checks execute atomically in the deployed Aleo program.
|
|
197
|
+
|
|
198
|
+
## Registry
|
|
199
|
+
|
|
200
|
+
`DEFAULT_BRIDGE_REGISTRY` is a versioned snapshot of chains, chain-specific
|
|
201
|
+
assets, and directional routes. Applications can pass a reviewed replacement:
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
const bridge = createBridgeClient({
|
|
205
|
+
environment: 'testnet',
|
|
206
|
+
registry: companyReviewedRegistry,
|
|
207
|
+
})
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
xReserve entries include Circle's published Ethereum/Sepolia USDC contracts,
|
|
211
|
+
Aleo domain, and USDCx program identifiers. Ethereum-to-Aleo ETH, WBTC, and USDT
|
|
212
|
+
routes pin router, domain, ISM, token, Mailbox, and gas-payment metadata to
|
|
213
|
+
Hyperlane Registry commit `2621c16f2db1ccb46643265c110dac5ca2c7c51a` and are
|
|
214
|
+
active. Reverse and other Hyperlane routes remain `metadata-required` until
|
|
215
|
+
their deployment metadata is complete and reviewed.
|
|
216
|
+
|
|
217
|
+
### Aleo-origin Hyperlane placeholders
|
|
218
|
+
|
|
219
|
+
The Aleo-origin ETH, WBTC, USDT, SOL, and USAD routes expose the complete
|
|
220
|
+
`transfer_remote` call shape for these programs:
|
|
221
|
+
|
|
222
|
+
- `hyp_warp_token_eth_v2.aleo`
|
|
223
|
+
- `hyp_warp_token_wbtc_v2.aleo`
|
|
224
|
+
- `hyp_warp_token_usdt_v2.aleo`
|
|
225
|
+
- `hyp_warp_token_sol_v2.aleo`
|
|
226
|
+
- `hyp_warp_token_usad_v2.aleo`
|
|
227
|
+
|
|
228
|
+
**These routes contain dummy development values and are not executable.** They
|
|
229
|
+
remain `metadata-required`, carry `aleoPlaceholderConfiguration: true`, and
|
|
230
|
+
`executeAleoHyperlaneTransferRemote` throws before calling the wallet. Use
|
|
231
|
+
`buildAleoHyperlaneTransferRemoteCall` only to inspect and integrate the ABI
|
|
232
|
+
until the configuration below has been reviewed and replaced.
|
|
233
|
+
|
|
234
|
+
Except for the verified ETH, WBTC, USDT, and SOL route data described below,
|
|
235
|
+
the current dummy values are:
|
|
236
|
+
|
|
237
|
+
- `token_type`: `0u8`; `token_id`: `0field`
|
|
238
|
+
- `token_owner`, `ism`, `hook`, and all four allowance spenders: the same
|
|
239
|
+
development-only Aleo address
|
|
240
|
+
- remote-router recipient: 32 zero bytes; remote-router gas: `0u128`
|
|
241
|
+
- destination recipient limbs are derived from the Ethereum or Solana address
|
|
242
|
+
in the transfer plan
|
|
243
|
+
- all four credit allowance amounts: `0u64`
|
|
244
|
+
|
|
245
|
+
The WBTC route is partially populated from mainnet
|
|
246
|
+
[`hyp_warp_token_wbtc_v2.aleo`](https://explorer.provable.com/program/hyp_warp_token_wbtc_v2.aleo),
|
|
247
|
+
edition `0`. Its `app_metadata[true]` token type, owner, ISM, hook, token ID,
|
|
248
|
+
and `8u8` local/remote decimals are verified and are not placeholders. Its
|
|
249
|
+
first hook allowance amount remains unresolved, so the route is still
|
|
250
|
+
non-executable.
|
|
251
|
+
|
|
252
|
+
The WBTC Ethereum remote router is also verified: domain `1u32`, recipient
|
|
253
|
+
`0x20CDC85778b732073F7EecEF3DF25c0d310f8772` left-padded to `[u8; 32]`, and
|
|
254
|
+
gas `68000u128`. `transfer_remote_as_signer` is selectable with
|
|
255
|
+
`mode: 'signer'`. Its allowance spender positions and three unused zero amounts
|
|
256
|
+
match the reviewed call shape. The first hook allowance amount remains dynamic;
|
|
257
|
+
the observed `9138947u64` applies only to the sample transaction and is not
|
|
258
|
+
stored as a route-wide cap.
|
|
259
|
+
|
|
260
|
+
The ETH route is populated from current mainnet app metadata and the reviewed
|
|
261
|
+
[`transfer_remote_as_signer` transaction](https://explorer.provable.com/transaction/at1vu0yckkms887zkl3qz7plnncd56jtf5zeal4uj2808upsjkusy8q7yp9v8).
|
|
262
|
+
Its Ethereum router is `0x38D447694f5c1f773ae3132cf93bF30B7Ec1Fa5A`,
|
|
263
|
+
left-padded to `[u8; 32]`, with domain `1u32` and gas `44000u128`. The
|
|
264
|
+
transaction's `8174147u64` first allowance is an observed dispatch quote and is
|
|
265
|
+
not stored as a route-wide cap. As with WBTC, only the first hook allowance
|
|
266
|
+
amount remains unresolved. Ethereum recipient limbs are derived from
|
|
267
|
+
`plan.recipient`.
|
|
268
|
+
|
|
269
|
+
The USDT route uses current edition `1` app metadata and the verified Ethereum
|
|
270
|
+
remote router at domain `1u32`: `0x3C2064D78e4578E8F936E3db42aEF044E33FBF31`
|
|
271
|
+
with gas `68000u128`. The reviewed signer transaction targets BSC domain `56`,
|
|
272
|
+
so it validates the shared allowance layout but is not used as the Ethereum
|
|
273
|
+
router source. Its `1994463u64` first allowance is transaction-specific. The
|
|
274
|
+
official Hyperlane route config records Aleo and Ethereum USDT as 6-decimal
|
|
275
|
+
assets with a `1000000000000` scale; the Aleo program's app metadata must still
|
|
276
|
+
be passed exactly as `local_decimals: 6u8, remote_decimals: 18u8`. The builder
|
|
277
|
+
therefore reads these contract metadata decimals instead of inferring both from
|
|
278
|
+
the endpoint assets.
|
|
279
|
+
|
|
280
|
+
The SOL route uses verified edition `0` app metadata with 9 local and remote
|
|
281
|
+
decimals. Its Solana destination is Hyperlane domain `1399811149u32`, router
|
|
282
|
+
`8YGT2pZwyZe94qBpGzWfY2TMEVcwaQ1bXAE7YAgpUaM7`, and gas `300000u128`. The
|
|
283
|
+
reviewed signer transition confirms the shared allowance layout; its
|
|
284
|
+
`7661056u64` first allowance is transaction-specific and is not stored as a
|
|
285
|
+
route-wide value. The Aleo SOL asset locator now points to the v2 warp program
|
|
286
|
+
and token identifier from the pinned Hyperlane route configuration.
|
|
287
|
+
|
|
288
|
+
All Aleo Warp Routes share the verified mainnet
|
|
289
|
+
[`hyp_mailbox.aleo`](https://explorer.provable.com/program/hyp_mailbox.aleo)
|
|
290
|
+
mailbox configuration, edition `0`. The `transfer_remote` input now uses its
|
|
291
|
+
`default_hook` and `required_hook`. The registry also records the local domain,
|
|
292
|
+
default ISM, dispatch proxy, owner, and the nonce/process count observed during
|
|
293
|
+
the 2026-08-17 review. The nonce and process count are mutable observations and
|
|
294
|
+
are not transaction inputs.
|
|
295
|
+
|
|
296
|
+
Before enabling submission, replace and verify every field still reported by
|
|
297
|
+
`placeholderFields` for that route. Implement the dynamic hook credit quote for
|
|
298
|
+
ETH, WBTC, USDT, and SOL. Then remove `aleoPlaceholderConfiguration` and change
|
|
299
|
+
the route availability to `active` in a reviewed registry snapshot.
|
|
300
|
+
|
|
301
|
+
## Exports
|
|
302
|
+
|
|
303
|
+
- `createBridgeClient`
|
|
304
|
+
- `getAssets` and `getRoutes`
|
|
305
|
+
- `prepareTransfer`
|
|
306
|
+
- `quoteEvmHyperlaneTransfer` and `executeEvmHyperlaneTransfer`
|
|
307
|
+
- `quoteEvmXReserveTransfer`, `executeEvmXReserveTransfer`, and `getXReserveAttestation`
|
|
308
|
+
- `executeXReservePrivateMint`
|
|
309
|
+
- `buildXReserveBurnCall` and `executeXReserveBurn`
|
|
310
|
+
- `buildAleoHyperlaneTransferRemoteCall` and `executeAleoHyperlaneTransferRemote`
|
|
311
|
+
- Aleo address, xReserve hook, nonce, payload, and message-hash utilities
|
|
312
|
+
- Ethereum and Solana Hyperlane recipient serialization for Aleo-origin transfers
|
|
313
|
+
- `DEFAULT_BRIDGE_REGISTRY` and `validateBridgeRegistry`
|
|
314
|
+
- Protocol-neutral asset, route, plan, fee, step, status, and receipt types
|
|
315
|
+
- `createBridgeAgentTools` from `/agent`
|
|
316
|
+
- `createBridgeMcpServer` from `/mcp`
|
|
317
|
+
|
|
318
|
+
The agent and MCP surfaces expose discovery and planning only. They do not expose
|
|
319
|
+
fund-moving wallet actions.
|
|
320
|
+
|
|
321
|
+
## Next implementation phases
|
|
322
|
+
|
|
323
|
+
1. Add protocol delivery tracking for relayer-driven xReserve and Hyperlane mints.
|
|
324
|
+
2. Replace and review the Aleo-origin Hyperlane placeholders, then add destination confirmation.
|
|
325
|
+
3. Add injected Solana execution and gated protocol testnets.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AgentTool } from '@provablehq/veil-core/agent';
|
|
2
|
+
export { AgentTool, AgentToolHandler, AgentToolSchema } from '@provablehq/veil-core/agent';
|
|
3
|
+
import { y as BridgeClient } from '../createBridgeClient-CjHY-JvW.js';
|
|
4
|
+
import '@provablehq/veil-core';
|
|
5
|
+
import 'viem';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Builds read-only discovery and non-fund-moving planning tools.
|
|
9
|
+
*
|
|
10
|
+
* The current tool set cannot sign or submit transactions. A later execution
|
|
11
|
+
* phase adds privileged tools only after xReserve and Hyperlane adapters expose
|
|
12
|
+
* inspectable transaction plans.
|
|
13
|
+
*
|
|
14
|
+
* @param client Protocol bridge client supplying registry-bound actions.
|
|
15
|
+
* @returns Agent tools for asset discovery, route discovery, and transfer planning.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const tools = createBridgeAgentTools(createBridgeClient())
|
|
19
|
+
*/
|
|
20
|
+
declare function createBridgeAgentTools(client: BridgeClient): AgentTool[];
|
|
21
|
+
|
|
22
|
+
export { createBridgeAgentTools };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// src/agent/tools.ts
|
|
2
|
+
function createBridgeAgentTools(client) {
|
|
3
|
+
return [
|
|
4
|
+
{
|
|
5
|
+
schema: {
|
|
6
|
+
name: "bridge_list_assets",
|
|
7
|
+
description: "List chain-specific xReserve and Hyperlane assets from the reviewed bridge registry. Returns stable asset ids, chain ids, decimals, and known onchain locators.",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
environment: { type: "string", enum: ["mainnet", "testnet"] },
|
|
12
|
+
chainId: { type: "string" },
|
|
13
|
+
symbol: { type: "string" }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
handler: async (params) => client.getAssets(params)
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
schema: {
|
|
21
|
+
name: "bridge_list_routes",
|
|
22
|
+
description: "List directional protocol routes. USDCx routes use Circle xReserve; ETH, WBTC, SOL, ALEO, and USAD routes use Hyperlane. metadata-required means the route is known but its execution deployment is not pinned yet.",
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
environment: { type: "string", enum: ["mainnet", "testnet"] },
|
|
27
|
+
protocol: { type: "string", enum: ["xreserve", "hyperlane"] },
|
|
28
|
+
sourceChainId: { type: "string" },
|
|
29
|
+
destinationChainId: { type: "string" },
|
|
30
|
+
symbol: { type: "string" },
|
|
31
|
+
includeUnavailable: { type: "boolean" }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
handler: async (params) => client.getRoutes(params)
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
schema: {
|
|
39
|
+
name: "bridge_prepare_transfer",
|
|
40
|
+
description: "Validate a route, amount, and recipient, then return the ordered xReserve or Hyperlane execution plan. This tool is pure and local: it does not query fees, sign transactions, or move funds.",
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: "object",
|
|
43
|
+
properties: {
|
|
44
|
+
routeId: { type: "string" },
|
|
45
|
+
amount: { type: "string", description: "Positive decimal amount in source-asset display units." },
|
|
46
|
+
recipient: { type: "string" },
|
|
47
|
+
sender: { type: "string" },
|
|
48
|
+
privateRecipient: { type: "boolean" }
|
|
49
|
+
},
|
|
50
|
+
required: ["routeId", "amount", "recipient"]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
handler: async (params) => client.prepareTransfer(params)
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
createBridgeAgentTools
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=chunk-KG3LFIU5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/agent/tools.ts"],"sourcesContent":["import type { AgentTool } from '@provablehq/veil-core/agent'\nimport type { BridgeClient } from '../clients/createBridgeClient.js'\n\n/**\n * Builds read-only discovery and non-fund-moving planning tools.\n *\n * The current tool set cannot sign or submit transactions. A later execution\n * phase adds privileged tools only after xReserve and Hyperlane adapters expose\n * inspectable transaction plans.\n *\n * @param client Protocol bridge client supplying registry-bound actions.\n * @returns Agent tools for asset discovery, route discovery, and transfer planning.\n *\n * @example\n * const tools = createBridgeAgentTools(createBridgeClient())\n */\nexport function createBridgeAgentTools(client: BridgeClient): AgentTool[] {\n return [\n {\n schema: {\n name: 'bridge_list_assets',\n description: 'List chain-specific xReserve and Hyperlane assets from the reviewed bridge registry. Returns stable asset ids, chain ids, decimals, and known onchain locators.',\n inputSchema: {\n type: 'object',\n properties: {\n environment: { type: 'string', enum: ['mainnet', 'testnet'] },\n chainId: { type: 'string' },\n symbol: { type: 'string' },\n },\n },\n },\n handler: async (params) => client.getAssets(params),\n },\n {\n schema: {\n name: 'bridge_list_routes',\n description: 'List directional protocol routes. USDCx routes use Circle xReserve; ETH, WBTC, SOL, ALEO, and USAD routes use Hyperlane. metadata-required means the route is known but its execution deployment is not pinned yet.',\n inputSchema: {\n type: 'object',\n properties: {\n environment: { type: 'string', enum: ['mainnet', 'testnet'] },\n protocol: { type: 'string', enum: ['xreserve', 'hyperlane'] },\n sourceChainId: { type: 'string' },\n destinationChainId: { type: 'string' },\n symbol: { type: 'string' },\n includeUnavailable: { type: 'boolean' },\n },\n },\n },\n handler: async (params) => client.getRoutes(params),\n },\n {\n schema: {\n name: 'bridge_prepare_transfer',\n description: 'Validate a route, amount, and recipient, then return the ordered xReserve or Hyperlane execution plan. This tool is pure and local: it does not query fees, sign transactions, or move funds.',\n inputSchema: {\n type: 'object',\n properties: {\n routeId: { type: 'string' },\n amount: { type: 'string', description: 'Positive decimal amount in source-asset display units.' },\n recipient: { type: 'string' },\n sender: { type: 'string' },\n privateRecipient: { type: 'boolean' },\n },\n required: ['routeId', 'amount', 'recipient'],\n },\n },\n handler: async (params) => client.prepareTransfer(params as Parameters<BridgeClient['prepareTransfer']>[0]),\n },\n ]\n}\n"],"mappings":";AAgBO,SAAS,uBAAuB,QAAmC;AACxE,SAAO;AAAA,IACL;AAAA,MACE,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,QACb,aAAa;AAAA,UACX,MAAM;AAAA,UACN,YAAY;AAAA,YACV,aAAa,EAAE,MAAM,UAAU,MAAM,CAAC,WAAW,SAAS,EAAE;AAAA,YAC5D,SAAS,EAAE,MAAM,SAAS;AAAA,YAC1B,QAAQ,EAAE,MAAM,SAAS;AAAA,UAC3B;AAAA,QACF;AAAA,MACF;AAAA,MACA,SAAS,OAAO,WAAW,OAAO,UAAU,MAAM;AAAA,IACpD;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,QACb,aAAa;AAAA,UACX,MAAM;AAAA,UACN,YAAY;AAAA,YACV,aAAa,EAAE,MAAM,UAAU,MAAM,CAAC,WAAW,SAAS,EAAE;AAAA,YAC5D,UAAU,EAAE,MAAM,UAAU,MAAM,CAAC,YAAY,WAAW,EAAE;AAAA,YAC5D,eAAe,EAAE,MAAM,SAAS;AAAA,YAChC,oBAAoB,EAAE,MAAM,SAAS;AAAA,YACrC,QAAQ,EAAE,MAAM,SAAS;AAAA,YACzB,oBAAoB,EAAE,MAAM,UAAU;AAAA,UACxC;AAAA,QACF;AAAA,MACF;AAAA,MACA,SAAS,OAAO,WAAW,OAAO,UAAU,MAAM;AAAA,IACpD;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,QACb,aAAa;AAAA,UACX,MAAM;AAAA,UACN,YAAY;AAAA,YACV,SAAS,EAAE,MAAM,SAAS;AAAA,YAC1B,QAAQ,EAAE,MAAM,UAAU,aAAa,yDAAyD;AAAA,YAChG,WAAW,EAAE,MAAM,SAAS;AAAA,YAC5B,QAAQ,EAAE,MAAM,SAAS;AAAA,YACzB,kBAAkB,EAAE,MAAM,UAAU;AAAA,UACtC;AAAA,UACA,UAAU,CAAC,WAAW,UAAU,WAAW;AAAA,QAC7C;AAAA,MACF;AAAA,MACA,SAAS,OAAO,WAAW,OAAO,gBAAgB,MAAwD;AAAA,IAC5G;AAAA,EACF;AACF;","names":[]}
|