@provablehq/aleo-bridge-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +390 -0
- package/dist/agent/index.d.ts +23 -0
- package/dist/agent/index.js +7 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/chunk-NTWXJE7R.js +93 -0
- package/dist/chunk-NTWXJE7R.js.map +1 -0
- package/dist/chunk-OU6GVGG7.js +606 -0
- package/dist/chunk-OU6GVGG7.js.map +1 -0
- package/dist/createBridgeClient-DzmEyXfG.d.ts +1058 -0
- package/dist/index.d.ts +739 -0
- package/dist/index.js +3882 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +28 -0
- package/dist/mcp/index.js +13 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/solana/index.d.ts +113 -0
- package/dist/solana/index.js +15 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/solana-D5Qr6SLa.d.ts +725 -0
- package/package.json +74 -0
|
@@ -0,0 +1,1058 @@
|
|
|
1
|
+
import { WalletClient, TransactionInput, ProvingProgressHandler, Transaction, Client } from '@provablehq/veil-core';
|
|
2
|
+
import { a as BridgeReceipt, c as BridgePlan, n as BridgeEndpoint, S as SolanaClient, P as PrepareParameters, q as BridgeFee, e as SolanaHyperlaneTransferQuote, d as BridgeCheckpoint, g as SolanaHyperlaneTransferExecution, b as BridgeProgress, w as BridgeStatus, B as BridgeRegistry, h as BridgeEnvironment } from './solana-D5Qr6SLa.js';
|
|
3
|
+
import { Address, Hex, Hash, LocalAccount, PublicClient, WalletClient as WalletClient$1 } from 'viem';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Supplies a fetch-compatible HTTP response for Circle attestation requests.
|
|
7
|
+
*
|
|
8
|
+
* @property ok Whether the response status is successful.
|
|
9
|
+
* @property status Numeric HTTP status used to distinguish pending attestations.
|
|
10
|
+
* @property json Parses the response body as JSON.
|
|
11
|
+
*/
|
|
12
|
+
type XReserveHttpResponse = {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
status: number;
|
|
15
|
+
json: () => Promise<unknown>;
|
|
16
|
+
};
|
|
17
|
+
/** Sends an HTTP request without coupling the bridge client to a runtime global. */
|
|
18
|
+
type XReserveHttpTransport = (url: string, init?: {
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}) => Promise<XReserveHttpResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Captures reviewed Ethereum-to-Aleo xReserve deployment values.
|
|
23
|
+
*
|
|
24
|
+
* @property xReserveContract Ethereum contract receiving deposits.
|
|
25
|
+
* @property sourceChainId Expected EIP-155 wallet chain id.
|
|
26
|
+
* @property sourceDomain Circle domain included in the deposit nonce.
|
|
27
|
+
* @property remoteDomain Aleo Circle domain passed to `depositToRemote`.
|
|
28
|
+
* @property remoteTokenBytes32 Aleo USDCx token identifier in Circle wire form.
|
|
29
|
+
* @property minimumAmountAtomic Smallest supported deposit in USDC base units.
|
|
30
|
+
* @property maxFeeAtomic Maximum Circle fee in USDC base units.
|
|
31
|
+
* @property bridgeProgram Aleo program handling public and record mints.
|
|
32
|
+
* @property wrapperProgram Aleo program handling private wrapper mints.
|
|
33
|
+
* @property attestationBaseUrl Circle endpoint prefix for individual message hashes.
|
|
34
|
+
*/
|
|
35
|
+
type EvmXReserveRouteMetadata = {
|
|
36
|
+
xReserveContract: Address;
|
|
37
|
+
sourceChainId: number;
|
|
38
|
+
sourceDomain: number;
|
|
39
|
+
remoteDomain: number;
|
|
40
|
+
remoteTokenBytes32: Hex;
|
|
41
|
+
minimumAmountAtomic: bigint;
|
|
42
|
+
maxFeeAtomic: bigint;
|
|
43
|
+
bridgeProgram: string;
|
|
44
|
+
wrapperProgram: string;
|
|
45
|
+
attestationBaseUrl: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Supplies an Ethereum-to-Aleo xReserve transfer for current balance and allowance checks.
|
|
49
|
+
*
|
|
50
|
+
* @property plan Route, amount, Aleo recipient, and privacy preference selected for the transfer.
|
|
51
|
+
* @property privateMintSecretNonce Secret Aleo scalar committed by private hook data. Defaults to `0scalar`.
|
|
52
|
+
*/
|
|
53
|
+
type QuoteEvmXReserveTransferParameters = {
|
|
54
|
+
plan: BridgePlan;
|
|
55
|
+
privateMintSecretNonce?: string | undefined;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Captures atomic values and allowance state required by an xReserve deposit.
|
|
59
|
+
*
|
|
60
|
+
* @property routeId Reviewed route used for the quote.
|
|
61
|
+
* @property xReserveContract Contract receiving the deposit.
|
|
62
|
+
* @property tokenAddress USDC contract approved and deposited.
|
|
63
|
+
* @property sourceChainId Expected EIP-155 wallet chain id.
|
|
64
|
+
* @property remoteDomain Aleo Circle domain supplied to the contract.
|
|
65
|
+
* @property remoteRecipientBytes32 User or wrapper address in wire form.
|
|
66
|
+
* @property amountAtomic Deposit amount in USDC base units.
|
|
67
|
+
* @property maxFeeAtomic Maximum Circle fee in USDC base units.
|
|
68
|
+
* @property hookData Fixed 65-byte Aleo mint instruction.
|
|
69
|
+
* @property balanceAtomic Connected account balance in USDC base units.
|
|
70
|
+
* @property allowanceAtomic Current xReserve allowance in USDC base units.
|
|
71
|
+
* @property approvalRequired Whether execution must submit an approval first.
|
|
72
|
+
*/
|
|
73
|
+
type EvmXReserveTransferQuote = {
|
|
74
|
+
routeId: string;
|
|
75
|
+
xReserveContract: Address;
|
|
76
|
+
tokenAddress: Address;
|
|
77
|
+
sourceChainId: number;
|
|
78
|
+
remoteDomain: number;
|
|
79
|
+
remoteRecipientBytes32: Hex;
|
|
80
|
+
amountAtomic: bigint;
|
|
81
|
+
maxFeeAtomic: bigint;
|
|
82
|
+
hookData: Hex;
|
|
83
|
+
balanceAtomic: bigint;
|
|
84
|
+
allowanceAtomic: bigint;
|
|
85
|
+
approvalRequired: boolean;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Configures an Ethereum-to-Aleo xReserve deposit submission.
|
|
89
|
+
*
|
|
90
|
+
* @property plan Route, amount, Aleo recipient, and privacy preference selected for the transfer.
|
|
91
|
+
* @property privateMintSecretNonce Secret Aleo scalar committed by private hook data. Defaults to `0scalar`.
|
|
92
|
+
* @property pollingIntervalMs Delay between receipt checks. Defaults to 1,000 milliseconds.
|
|
93
|
+
* @property confirmationTimeoutMs Maximum receipt wait per transaction. Defaults to 120,000 milliseconds.
|
|
94
|
+
* @property resume Previously checkpointed source receipt. When supplied, execution
|
|
95
|
+
* verifies that transaction and never repeats its submission.
|
|
96
|
+
* @property onSubmitted Durable checkpoint hook called immediately after an approval
|
|
97
|
+
* or deposit is broadcast and before receipt polling begins.
|
|
98
|
+
*/
|
|
99
|
+
type ExecuteEvmXReserveTransferParameters = {
|
|
100
|
+
plan: BridgePlan;
|
|
101
|
+
privateMintSecretNonce?: string | undefined;
|
|
102
|
+
pollingIntervalMs?: number | undefined;
|
|
103
|
+
confirmationTimeoutMs?: number | undefined;
|
|
104
|
+
resume?: BridgeReceipt | undefined;
|
|
105
|
+
onSubmitted?: ((receipt: BridgeReceipt) => void | Promise<void>) | undefined;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Captures wallet transactions and resumable xReserve progress after execution.
|
|
109
|
+
*
|
|
110
|
+
* @property receipt Protocol-neutral status plus Circle payload identifiers.
|
|
111
|
+
* @property approvalTxIds ERC-20 approvals submitted before the deposit.
|
|
112
|
+
*/
|
|
113
|
+
type EvmXReserveTransferExecution = {
|
|
114
|
+
receipt: BridgeReceipt;
|
|
115
|
+
approvalTxIds: Hash[];
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Selects a Circle attestation by its 32-byte message hash.
|
|
119
|
+
*
|
|
120
|
+
* @property routeId Route supplying the environment-specific Circle endpoint.
|
|
121
|
+
* @property messageHash Keccak-256 hash returned by deposit execution.
|
|
122
|
+
* @property signal Optional cancellation signal. Defaults to no cancellation.
|
|
123
|
+
*/
|
|
124
|
+
type GetXReserveAttestationParameters = {
|
|
125
|
+
routeId: string;
|
|
126
|
+
messageHash: Hash;
|
|
127
|
+
signal?: AbortSignal | undefined;
|
|
128
|
+
};
|
|
129
|
+
/** Reports whether Circle has produced the signature for an xReserve message. */
|
|
130
|
+
type XReserveAttestationResult = {
|
|
131
|
+
status: 'pending';
|
|
132
|
+
messageHash: Hash;
|
|
133
|
+
} | {
|
|
134
|
+
status: 'complete';
|
|
135
|
+
messageHash: Hash;
|
|
136
|
+
payload: Hex;
|
|
137
|
+
attestation: Hex;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Submits one Aleo program execution through an application-provided wallet client.
|
|
142
|
+
*
|
|
143
|
+
* The required method is available on Veil wallet clients and connected Aleo
|
|
144
|
+
* wallet adapters.
|
|
145
|
+
*
|
|
146
|
+
* @property executeTransaction Prompts the wallet to prove, sign, and broadcast a program call.
|
|
147
|
+
*/
|
|
148
|
+
type AleoWalletClient = Pick<WalletClient, 'executeTransaction'>;
|
|
149
|
+
/**
|
|
150
|
+
* Controls conversion of a public Aleo token balance into a private record.
|
|
151
|
+
*
|
|
152
|
+
* @property asset Aleo chain and token selected for the private conversion. The token MUST support shielding.
|
|
153
|
+
* @property amount Positive decimal amount in the asset's display units.
|
|
154
|
+
* @property recipient Optional Aleo recipient for ARC-22 assets. Defaults to the active wallet address.
|
|
155
|
+
* @property privateFee Whether the Aleo wallet pays its fee privately. Defaults to false.
|
|
156
|
+
* @property onProgress Optional awaited callback for proving and submission boundaries.
|
|
157
|
+
* @property onPrepared Optional awaited callback receiving the proved transaction before broadcast.
|
|
158
|
+
*/
|
|
159
|
+
type ShieldParameters = {
|
|
160
|
+
asset: BridgeEndpoint;
|
|
161
|
+
amount: string;
|
|
162
|
+
recipient?: string | undefined;
|
|
163
|
+
privateFee?: boolean | undefined;
|
|
164
|
+
onProgress?: ProvingProgressHandler | undefined;
|
|
165
|
+
onPrepared?: ((transaction: Transaction) => void | Promise<void>) | undefined;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Controls conversion of an Aleo private record into a public token balance.
|
|
169
|
+
*
|
|
170
|
+
* @property asset Aleo chain and token selected for the public conversion. The token MUST support unshielding.
|
|
171
|
+
* @property amount Positive decimal amount in the asset's display units.
|
|
172
|
+
* @property record Optional encoded `Token` record or wallet record request. Defaults to wallet selection by minimum amount.
|
|
173
|
+
* @property recipient Optional Aleo public recipient for ARC-22 assets. Defaults to the active wallet address.
|
|
174
|
+
* @property merkleProof Optional ARC-22 freeze-list proof literal. Defaults to the canonical empty-tree proof pair.
|
|
175
|
+
* @property privateFee Whether the Aleo wallet pays its fee privately. Defaults to false.
|
|
176
|
+
* @property onProgress Optional awaited callback for proving and submission boundaries.
|
|
177
|
+
* @property onPrepared Optional awaited callback receiving the proved transaction before broadcast.
|
|
178
|
+
*/
|
|
179
|
+
type UnshieldParameters = {
|
|
180
|
+
asset: BridgeEndpoint;
|
|
181
|
+
amount: string;
|
|
182
|
+
record?: TransactionInput | undefined;
|
|
183
|
+
recipient?: string | undefined;
|
|
184
|
+
merkleProof?: string | undefined;
|
|
185
|
+
privateFee?: boolean | undefined;
|
|
186
|
+
onProgress?: ProvingProgressHandler | undefined;
|
|
187
|
+
onPrepared?: ((transaction: Transaction) => void | Promise<void>) | undefined;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Captures a submitted Aleo public/private asset conversion.
|
|
191
|
+
*
|
|
192
|
+
* @property transactionId Aleo transaction id returned by the wallet.
|
|
193
|
+
* @property assetId Chain-scoped asset identifier converted by the transaction.
|
|
194
|
+
* @property amount Original decimal amount supplied by the caller.
|
|
195
|
+
* @property amountAtomic Exact amount submitted as a u128 atomic value.
|
|
196
|
+
*/
|
|
197
|
+
type AleoPrivacyExecution = {
|
|
198
|
+
transactionId: string;
|
|
199
|
+
assetId: string;
|
|
200
|
+
amount: string;
|
|
201
|
+
amountAtomic: bigint;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Configures submission of the user-authorized USDCx wrapper mint.
|
|
205
|
+
*
|
|
206
|
+
* @property plan Original private-mint transfer plan.
|
|
207
|
+
* @property privateMintSecretNonce Secret Aleo scalar committed by the source deposit. Defaults to `0scalar`.
|
|
208
|
+
* @property deposit Confirmed EVM deposit receipt carrying the canonical payload.
|
|
209
|
+
* @property attestation Completed Circle payload and signature response.
|
|
210
|
+
* @property privateFee Whether the Aleo wallet should pay its fee privately. Defaults to false.
|
|
211
|
+
* @property onSubmitted Durable checkpoint hook called immediately after the wallet returns a transaction id.
|
|
212
|
+
* @property onProgress Optional awaited callback for Aleo proving and submission boundaries.
|
|
213
|
+
* @property onPrepared Durable callback invoked with a fully proved transaction before network broadcast.
|
|
214
|
+
*/
|
|
215
|
+
type ExecuteXReservePrivateMintParameters = {
|
|
216
|
+
plan: BridgePlan;
|
|
217
|
+
privateMintSecretNonce?: string | undefined;
|
|
218
|
+
deposit: BridgeReceipt;
|
|
219
|
+
attestation: XReserveAttestationResult;
|
|
220
|
+
privateFee?: boolean | undefined;
|
|
221
|
+
onSubmitted?: ((receipt: BridgeReceipt) => void | Promise<void>) | undefined;
|
|
222
|
+
onProgress?: ProvingProgressHandler | undefined;
|
|
223
|
+
onPrepared?: ((transaction: Transaction) => void | Promise<void>) | undefined;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Captures the submitted wrapper transaction and resumable destination state.
|
|
227
|
+
*
|
|
228
|
+
* @property transactionId Aleo transaction id returned by the connected wallet.
|
|
229
|
+
* @property receipt Transfer state retaining source, Circle, and destination identifiers.
|
|
230
|
+
*/
|
|
231
|
+
type XReservePrivateMintExecution = {
|
|
232
|
+
transactionId: string;
|
|
233
|
+
receipt: BridgeReceipt;
|
|
234
|
+
};
|
|
235
|
+
/** Selects which deployed USDCx burn transition the Aleo wallet calls. */
|
|
236
|
+
type XReserveBurnMode = 'private' | 'public' | 'public-as-signer';
|
|
237
|
+
/**
|
|
238
|
+
* Describes one validated Aleo USDCx burn call without submitting it.
|
|
239
|
+
*
|
|
240
|
+
* @property routeId Aleo-to-Ethereum xReserve route used for the burn.
|
|
241
|
+
* @property mode Transition variant selected by the caller.
|
|
242
|
+
* @property program Deployed bridge or wrapper program receiving the transaction.
|
|
243
|
+
* @property function Exact burn transition invoked by the wallet.
|
|
244
|
+
* @property inputs Ordered Aleo literals and wallet record requests.
|
|
245
|
+
* @property amountAtomic Burn amount in USDCx base units.
|
|
246
|
+
* @property nativeDomain Circle Ethereum destination domain, fixed to 0.
|
|
247
|
+
* @property nativeRecipientBytes32 Ethereum recipient left-padded to 32 bytes.
|
|
248
|
+
*/
|
|
249
|
+
type XReserveBurnCall = {
|
|
250
|
+
routeId: string;
|
|
251
|
+
mode: XReserveBurnMode;
|
|
252
|
+
program: string;
|
|
253
|
+
function: 'burn_public_as_signer' | 'burn_public' | 'private_burn';
|
|
254
|
+
inputs: TransactionInput[];
|
|
255
|
+
amountAtomic: bigint;
|
|
256
|
+
nativeDomain: number;
|
|
257
|
+
nativeRecipientBytes32: `0x${string}`;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Configures an Aleo USDCx burn destined for Ethereum USDC.
|
|
261
|
+
*
|
|
262
|
+
* @property plan Aleo-to-Ethereum plan returned with the transfer quote.
|
|
263
|
+
* @property mode Burn transition to submit. Defaults to `private`.
|
|
264
|
+
* @property userRecord Wallet record request or encoded USDCx token record. Required only for `private`.
|
|
265
|
+
* @property merkleProof Encoded `[MerkleProof; 2]` Aleo literal. Required only for `private`.
|
|
266
|
+
* @property privateFee Whether the Aleo wallet should pay its fee privately. Defaults to false.
|
|
267
|
+
* @property onSubmitted Durable checkpoint hook called immediately after the wallet returns a transaction id.
|
|
268
|
+
* @property onProgress Optional awaited callback for Aleo proving and submission boundaries.
|
|
269
|
+
* @property onPrepared Durable callback invoked with a fully proved transaction before network broadcast.
|
|
270
|
+
*/
|
|
271
|
+
type ExecuteXReserveBurnParameters = {
|
|
272
|
+
plan: BridgePlan;
|
|
273
|
+
mode?: XReserveBurnMode | undefined;
|
|
274
|
+
userRecord?: TransactionInput | undefined;
|
|
275
|
+
merkleProof?: string | undefined;
|
|
276
|
+
privateFee?: boolean | undefined;
|
|
277
|
+
onSubmitted?: ((receipt: BridgeReceipt) => void | Promise<void>) | undefined;
|
|
278
|
+
onProgress?: ProvingProgressHandler | undefined;
|
|
279
|
+
onPrepared?: ((transaction: Transaction) => void | Promise<void>) | undefined;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Captures the submitted Aleo burn and the service-managed delivery state.
|
|
283
|
+
*
|
|
284
|
+
* @property transactionId Aleo transaction id returned by the connected wallet.
|
|
285
|
+
* @property receipt Transfer state retained while the Aleo attestation service forwards the burn to Circle.
|
|
286
|
+
*/
|
|
287
|
+
type XReserveBurnExecution = {
|
|
288
|
+
transactionId: string;
|
|
289
|
+
receipt: BridgeReceipt;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Configures one live Hyperlane hook gas payment quote.
|
|
293
|
+
*
|
|
294
|
+
* @property routeId Aleo-origin Hyperlane route whose destination gas is quoted.
|
|
295
|
+
*/
|
|
296
|
+
type QuoteAleoHyperlaneGasPaymentParameters = {
|
|
297
|
+
routeId: string;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* Captures one live destination gas quote for an Aleo-origin Hyperlane transfer.
|
|
301
|
+
*
|
|
302
|
+
* The on-chain hook asserts that the paid amount exactly equals the quote it
|
|
303
|
+
* recomputes at finalization, so the caller should quote shortly before submission.
|
|
304
|
+
*
|
|
305
|
+
* @property routeId Route the quote applies to.
|
|
306
|
+
* @property gasLimit Destination gas limit charged by the route, after the on-chain 50000 zero-limit fallback.
|
|
307
|
+
* @property gasOverhead Destination gas overhead added by the interchain gas paymaster.
|
|
308
|
+
* @property gasPrice Destination gas price reported by the on-chain oracle.
|
|
309
|
+
* @property exchangeRate Destination-to-Aleo exchange rate reported by the on-chain oracle.
|
|
310
|
+
* @property paymentMicrocredits Exact hook payment in microcredits (u64) the transfer must allow.
|
|
311
|
+
* @property executionFeeMicrocredits Always `null`; calculating the Aleo execution fee requires building an account-authorized execution.
|
|
312
|
+
* @property totalMicrocredits Always `null` until an execution fee is available. The hook payment alone is not the sender's total cost.
|
|
313
|
+
*/
|
|
314
|
+
type AleoHyperlaneGasQuote = {
|
|
315
|
+
routeId: string;
|
|
316
|
+
gasLimit: bigint;
|
|
317
|
+
gasOverhead: bigint;
|
|
318
|
+
gasPrice: bigint;
|
|
319
|
+
exchangeRate: bigint;
|
|
320
|
+
paymentMicrocredits: bigint;
|
|
321
|
+
executionFeeMicrocredits: null;
|
|
322
|
+
totalMicrocredits: null;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Describes one locally constructed Aleo Hyperlane transfer call.
|
|
326
|
+
*
|
|
327
|
+
* @property routeId Directional Hyperlane route used to construct the call.
|
|
328
|
+
* @property program Aleo Warp Route program receiving the transaction.
|
|
329
|
+
* @property function Exact Warp Route transition invoked by the wallet.
|
|
330
|
+
* @property inputs Seven ordered Aleo literals expected by the selected transfer transition.
|
|
331
|
+
* @property amountAtomic Source amount expressed in the Aleo token's base units.
|
|
332
|
+
* @property usesPlaceholderConfiguration Whether unresolved deployment values make the call unsafe to submit.
|
|
333
|
+
* @property placeholderFields Registry fields that must be replaced before submission is enabled.
|
|
334
|
+
*/
|
|
335
|
+
type AleoHyperlaneTransferRemoteCall = {
|
|
336
|
+
routeId: string;
|
|
337
|
+
program: string;
|
|
338
|
+
function: 'transfer_remote' | 'transfer_remote_as_signer';
|
|
339
|
+
inputs: TransactionInput[];
|
|
340
|
+
amountAtomic: bigint;
|
|
341
|
+
usesPlaceholderConfiguration: boolean;
|
|
342
|
+
placeholderFields: readonly string[];
|
|
343
|
+
};
|
|
344
|
+
/**
|
|
345
|
+
* Configures construction or submission of an Aleo Hyperlane withdrawal.
|
|
346
|
+
*
|
|
347
|
+
* @property plan Aleo-origin Hyperlane plan returned with the transfer quote.
|
|
348
|
+
* @property mode Whether the program burns from `self.caller` or the EOA-bound `self.signer`. Defaults to `caller`.
|
|
349
|
+
* @property privateFee Whether the Aleo wallet should pay its fee privately. Defaults to false.
|
|
350
|
+
* @property gasPaymentMicrocredits Live hook payment in microcredits (u64) from `quote`. Optional for inspection-only call construction; required by the route-specific execution implementation.
|
|
351
|
+
* @property onSubmitted Durable checkpoint hook called immediately after the wallet
|
|
352
|
+
* returns a transaction id.
|
|
353
|
+
* @property onProgress Optional awaited callback for Aleo proving and submission boundaries.
|
|
354
|
+
* @property onPrepared Durable callback invoked with a fully proved transaction before network broadcast.
|
|
355
|
+
*/
|
|
356
|
+
type ExecuteAleoHyperlaneTransferRemoteParameters = {
|
|
357
|
+
plan: BridgePlan;
|
|
358
|
+
mode?: 'caller' | 'signer' | undefined;
|
|
359
|
+
privateFee?: boolean | undefined;
|
|
360
|
+
gasPaymentMicrocredits?: bigint | undefined;
|
|
361
|
+
onSubmitted?: ((receipt: BridgeReceipt) => void | Promise<void>) | undefined;
|
|
362
|
+
onProgress?: ProvingProgressHandler | undefined;
|
|
363
|
+
onPrepared?: ((transaction: Transaction) => void | Promise<void>) | undefined;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* Captures a submitted Aleo Hyperlane dispatch.
|
|
367
|
+
*
|
|
368
|
+
* @property transactionId Aleo transaction id returned by the connected wallet.
|
|
369
|
+
* @property receipt Resumable receipt awaiting Hyperlane delivery.
|
|
370
|
+
*/
|
|
371
|
+
type AleoHyperlaneTransferRemoteExecution = {
|
|
372
|
+
transactionId: string;
|
|
373
|
+
receipt: BridgeReceipt;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Configures Aleo network and optional wallet access for one named bridge chain.
|
|
378
|
+
* @property publicClient Required Veil public client used for chain reads.
|
|
379
|
+
* @property account Optional Veil-compatible wallet client used for execution.
|
|
380
|
+
*/
|
|
381
|
+
type AleoClientConfig = {
|
|
382
|
+
publicClient: Client;
|
|
383
|
+
account?: AleoWalletClient | undefined;
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Holds materialized Aleo public and wallet capabilities.
|
|
387
|
+
* @property family Prevents this client from being used for an EVM or Solana route stored under the wrong chain identifier.
|
|
388
|
+
* @property publicClient Required Veil public client.
|
|
389
|
+
* @property walletClient Optional Veil-compatible execution client.
|
|
390
|
+
*/
|
|
391
|
+
type AleoClient = {
|
|
392
|
+
family: 'aleo';
|
|
393
|
+
publicClient: Client;
|
|
394
|
+
walletClient?: AleoWalletClient | undefined;
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* Selects the Aleo wallet that may authorize bridge and privacy transactions.
|
|
398
|
+
*
|
|
399
|
+
* The wallet retains custody of its account and proving configuration. This
|
|
400
|
+
* helper does not connect to Aleo, request approval, or move funds.
|
|
401
|
+
*
|
|
402
|
+
* @param client Veil wallet client or compatible wallet adapter supplied by the application.
|
|
403
|
+
* @returns The same wallet with only its transaction-execution capability exposed to the bridge.
|
|
404
|
+
* @example const account = aleoWallet(aleoWalletClient)
|
|
405
|
+
*/
|
|
406
|
+
declare function aleoWallet(client: AleoWalletClient): AleoWalletClient;
|
|
407
|
+
/**
|
|
408
|
+
* Creates the Aleo client used to read bridge state and optionally authorize transactions.
|
|
409
|
+
*
|
|
410
|
+
* Construction stores the supplied clients without contacting Aleo or prompting
|
|
411
|
+
* the wallet. Read-only actions need only `publicClient`; fund-moving actions
|
|
412
|
+
* also require `account`.
|
|
413
|
+
*
|
|
414
|
+
* @param config Aleo network access and optional wallet authorization supplied by the application.
|
|
415
|
+
* @returns Aleo read and optional wallet capabilities used by bridge actions.
|
|
416
|
+
* @throws BridgeError When the public client is absent.
|
|
417
|
+
* @example const client = createAleoClient({ publicClient, account: walletClient })
|
|
418
|
+
*/
|
|
419
|
+
declare function createAleoClient(config: AleoClientConfig): AleoClient;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Sends one EIP-1193-compatible request.
|
|
423
|
+
*
|
|
424
|
+
* @param args JSON-RPC method and parameters.
|
|
425
|
+
* @returns The provider's decoded JSON-RPC result.
|
|
426
|
+
*/
|
|
427
|
+
type EvmRequest = (args: {
|
|
428
|
+
method: string;
|
|
429
|
+
params?: readonly unknown[] | Record<string, unknown> | undefined;
|
|
430
|
+
}) => Promise<unknown>;
|
|
431
|
+
/**
|
|
432
|
+
* Configures Fetch API behavior for an EVM HTTP transport.
|
|
433
|
+
*
|
|
434
|
+
* @property fetch Optional Fetch API implementation used instead of the client-level transport.
|
|
435
|
+
*/
|
|
436
|
+
type EvmHttpOptions = {
|
|
437
|
+
fetch?: typeof globalThis.fetch | undefined;
|
|
438
|
+
};
|
|
439
|
+
/** Stores either an HTTP endpoint or custom EIP-1193 request function without contacting Ethereum. */
|
|
440
|
+
type EvmTransport = {
|
|
441
|
+
type: 'http';
|
|
442
|
+
url: string;
|
|
443
|
+
fetch?: typeof globalThis.fetch | undefined;
|
|
444
|
+
} | {
|
|
445
|
+
type: 'custom';
|
|
446
|
+
request: EvmRequest;
|
|
447
|
+
};
|
|
448
|
+
/** Selects whether an injected provider or application-held viem account authorizes transactions. */
|
|
449
|
+
type EvmAccount = {
|
|
450
|
+
type: 'provider';
|
|
451
|
+
provider: {
|
|
452
|
+
request: EvmRequest;
|
|
453
|
+
};
|
|
454
|
+
account?: Address | undefined;
|
|
455
|
+
} | {
|
|
456
|
+
type: 'local';
|
|
457
|
+
account: LocalAccount;
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* Configures EVM network and optional wallet access for one named bridge chain.
|
|
461
|
+
*
|
|
462
|
+
* @property transport Lazy public JSON-RPC transport.
|
|
463
|
+
* @property publicClient Existing viem public client used directly.
|
|
464
|
+
* @property account Injected-provider or local signing authority.
|
|
465
|
+
* @property walletClient Existing viem wallet client used directly.
|
|
466
|
+
*/
|
|
467
|
+
type EvmClientConfig = {
|
|
468
|
+
transport?: EvmTransport | undefined;
|
|
469
|
+
publicClient?: PublicClient | undefined;
|
|
470
|
+
account?: EvmAccount | undefined;
|
|
471
|
+
walletClient?: WalletClient$1 | undefined;
|
|
472
|
+
};
|
|
473
|
+
/**
|
|
474
|
+
* Describes an EVM call used by bridge protocol actions.
|
|
475
|
+
*
|
|
476
|
+
* @property to Contract address.
|
|
477
|
+
* @property data ABI-encoded calldata.
|
|
478
|
+
* @property account Optional call sender.
|
|
479
|
+
*/
|
|
480
|
+
type EvmCallParameters = {
|
|
481
|
+
to: Address;
|
|
482
|
+
data: Hex;
|
|
483
|
+
account?: Address | undefined;
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* Describes an EVM transaction used by bridge protocol actions.
|
|
487
|
+
*
|
|
488
|
+
* @property chainId Expected EIP-155 chain id, checked immediately before submission.
|
|
489
|
+
* @property from Optional expected sender, checked against the connected account.
|
|
490
|
+
* @property to Transaction destination.
|
|
491
|
+
* @property data ABI-encoded calldata.
|
|
492
|
+
* @property value Optional native-token value in wei.
|
|
493
|
+
*/
|
|
494
|
+
type EvmTransactionParameters = {
|
|
495
|
+
chainId: number;
|
|
496
|
+
from?: Address | undefined;
|
|
497
|
+
to: Address;
|
|
498
|
+
data: Hex;
|
|
499
|
+
value?: bigint | undefined;
|
|
500
|
+
};
|
|
501
|
+
/**
|
|
502
|
+
* Represents normalized EVM receipt fields consumed by bridge actions.
|
|
503
|
+
*
|
|
504
|
+
* @property status Viem-normalized execution result.
|
|
505
|
+
* @property transactionHash Canonical transaction hash when returned by the client.
|
|
506
|
+
* @property blockNumber Block containing the transaction when available.
|
|
507
|
+
* @property logs Receipt-log envelopes used to verify protocol events.
|
|
508
|
+
*/
|
|
509
|
+
type EvmReceipt = {
|
|
510
|
+
status: 'success' | 'reverted';
|
|
511
|
+
transactionHash: Hash;
|
|
512
|
+
blockNumber?: bigint | undefined;
|
|
513
|
+
logs: readonly {
|
|
514
|
+
address?: Address | undefined;
|
|
515
|
+
data: Hex;
|
|
516
|
+
topics: readonly Hex[];
|
|
517
|
+
logIndex?: number | undefined;
|
|
518
|
+
}[];
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* Represents one finalized EVM log used to recover a source bridge submission.
|
|
522
|
+
*
|
|
523
|
+
* @property address Contract that emitted the event.
|
|
524
|
+
* @property blockNumber Block containing the event.
|
|
525
|
+
* @property transactionHash Transaction that emitted the event.
|
|
526
|
+
* @property logIndex Event position used by protocols such as xReserve.
|
|
527
|
+
* @property data ABI-encoded non-indexed event values.
|
|
528
|
+
* @property topics ABI event signature and indexed values.
|
|
529
|
+
*/
|
|
530
|
+
type EvmLog = {
|
|
531
|
+
address: Address;
|
|
532
|
+
blockNumber: bigint;
|
|
533
|
+
transactionHash: Hash;
|
|
534
|
+
logIndex: number;
|
|
535
|
+
data: Hex;
|
|
536
|
+
topics: readonly Hex[];
|
|
537
|
+
};
|
|
538
|
+
/**
|
|
539
|
+
* Represents the source transaction fields needed to identify a recovered bridge submission.
|
|
540
|
+
*
|
|
541
|
+
* @property hash Canonical transaction identifier.
|
|
542
|
+
* @property blockNumber Block containing the transaction, or `null` while pending.
|
|
543
|
+
* @property from Account that authorized the transaction.
|
|
544
|
+
* @property to Destination contract, or `null` for contract creation.
|
|
545
|
+
* @property input ABI-encoded call data.
|
|
546
|
+
*/
|
|
547
|
+
type EvmTransaction = {
|
|
548
|
+
hash: Hash;
|
|
549
|
+
blockNumber: bigint | null;
|
|
550
|
+
from: Address;
|
|
551
|
+
to: Address | null;
|
|
552
|
+
input: Hex;
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Selects one contract and inclusive block range for a recovery event scan.
|
|
556
|
+
*
|
|
557
|
+
* @property address Contract whose events should be returned.
|
|
558
|
+
* @property fromBlock First block included in the scan.
|
|
559
|
+
* @property toBlock Last block included in the scan. Defaults to the latest block.
|
|
560
|
+
*/
|
|
561
|
+
type EvmGetLogsParameters = {
|
|
562
|
+
address: Address;
|
|
563
|
+
fromBlock: bigint;
|
|
564
|
+
toBlock?: bigint | undefined;
|
|
565
|
+
};
|
|
566
|
+
/**
|
|
567
|
+
* Exposes account-free EVM operations used by bridge actions.
|
|
568
|
+
*
|
|
569
|
+
* @property getChainId Reads the current EIP-155 chain id.
|
|
570
|
+
* @property getBalance Reads one account's native-currency balance in atomic units.
|
|
571
|
+
* @property call Executes a read-only EVM call.
|
|
572
|
+
* @property getTransactionReceipt Reads a receipt or returns `null` while unavailable.
|
|
573
|
+
* @property getLogs Reads finalized contract events within an inclusive block range.
|
|
574
|
+
* @property getTransaction Reads a transaction or returns `null` while unavailable.
|
|
575
|
+
*/
|
|
576
|
+
type EvmPublicClient = {
|
|
577
|
+
getChainId: () => Promise<number>;
|
|
578
|
+
getBalance: (address: Address) => Promise<bigint>;
|
|
579
|
+
call: (params: EvmCallParameters) => Promise<Hex>;
|
|
580
|
+
getTransactionReceipt: (hash: Hash) => Promise<EvmReceipt | null>;
|
|
581
|
+
getLogs: (params: EvmGetLogsParameters) => Promise<readonly EvmLog[]>;
|
|
582
|
+
getTransaction: (hash: Hash) => Promise<EvmTransaction | null>;
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* Exposes account-authorized EVM operations used by bridge actions.
|
|
586
|
+
*
|
|
587
|
+
* @property getAddress Resolves the active account.
|
|
588
|
+
* @property sendTransaction Validates chain and sender, then signs and broadcasts.
|
|
589
|
+
*/
|
|
590
|
+
type EvmWalletClient = {
|
|
591
|
+
getAddress: () => Promise<Address>;
|
|
592
|
+
sendTransaction: (params: EvmTransactionParameters) => Promise<Hash>;
|
|
593
|
+
};
|
|
594
|
+
/**
|
|
595
|
+
* Holds materialized EVM public and wallet capabilities.
|
|
596
|
+
*
|
|
597
|
+
* @property family Prevents this client from being used for a Solana or Aleo route stored under the wrong chain identifier.
|
|
598
|
+
* @property publicClient Required read capability.
|
|
599
|
+
* @property walletClient Optional signing capability.
|
|
600
|
+
*/
|
|
601
|
+
type EvmClient = {
|
|
602
|
+
family: 'evm';
|
|
603
|
+
publicClient: EvmPublicClient;
|
|
604
|
+
walletClient?: EvmWalletClient | undefined;
|
|
605
|
+
};
|
|
606
|
+
/**
|
|
607
|
+
* Defines the EVM JSON-RPC endpoint used when a bridge action reads or submits.
|
|
608
|
+
*
|
|
609
|
+
* Creating the transport does not contact the endpoint.
|
|
610
|
+
*
|
|
611
|
+
* @param url EVM JSON-RPC endpoint contacted by the resulting client.
|
|
612
|
+
* @param options Optional Fetch API implementation. Defaults to `globalThis.fetch` when the client is created.
|
|
613
|
+
* @returns Deferred HTTP configuration accepted by `createEvmClient`.
|
|
614
|
+
* @example const transport = evmHttp('https://rpc.example')
|
|
615
|
+
*/
|
|
616
|
+
declare function evmHttp(url: string, options?: EvmHttpOptions): EvmTransport;
|
|
617
|
+
/**
|
|
618
|
+
* Defines EVM network access through an application-supplied EIP-1193 request function.
|
|
619
|
+
*
|
|
620
|
+
* Creating the transport does not call the request function.
|
|
621
|
+
*
|
|
622
|
+
* @param request Function that sends JSON-RPC methods when a bridge action needs network access.
|
|
623
|
+
* @returns Deferred custom transport configuration accepted by `createEvmClient`.
|
|
624
|
+
* @example const transport = evmCustom(window.ethereum.request.bind(window.ethereum))
|
|
625
|
+
*/
|
|
626
|
+
declare function evmCustom(request: EvmRequest): EvmTransport;
|
|
627
|
+
/**
|
|
628
|
+
* Selects an injected EIP-1193 wallet to authorize EVM bridge transactions.
|
|
629
|
+
*
|
|
630
|
+
* The provider retains custody of the account and controls every signature
|
|
631
|
+
* request. This helper does not connect to the wallet or request a signature.
|
|
632
|
+
*
|
|
633
|
+
* @param provider Browser or application wallet exposing an EIP-1193 `request` function.
|
|
634
|
+
* @param options Optional account that MUST authorize transactions. Defaults to the first account returned by `eth_accounts` at submission time.
|
|
635
|
+
* @returns Deferred wallet configuration accepted by `createEvmClient`.
|
|
636
|
+
* @example const account = evmProvider(window.ethereum)
|
|
637
|
+
*/
|
|
638
|
+
declare function evmProvider(provider: {
|
|
639
|
+
request: EvmRequest;
|
|
640
|
+
}, options?: {
|
|
641
|
+
account?: Address | undefined;
|
|
642
|
+
}): EvmAccount;
|
|
643
|
+
/**
|
|
644
|
+
* Selects an application-held EVM private key for unattended bridge transactions.
|
|
645
|
+
*
|
|
646
|
+
* The key is converted to a viem account that signs on the caller's device or
|
|
647
|
+
* server. This helper does not contact a chain or submit a transaction; the
|
|
648
|
+
* application remains responsible for keeping the key secret.
|
|
649
|
+
*
|
|
650
|
+
* @param privateKey Secret 32-byte hexadecimal key held by the application.
|
|
651
|
+
* @returns Deferred local signing configuration accepted by `createEvmClient`.
|
|
652
|
+
* @example const account = evmPrivateKey(process.env.EVM_PRIVATE_KEY as Hex)
|
|
653
|
+
*/
|
|
654
|
+
declare function evmPrivateKey(privateKey: Hex): EvmAccount;
|
|
655
|
+
/**
|
|
656
|
+
* Selects an existing viem local account for unattended bridge transactions.
|
|
657
|
+
*
|
|
658
|
+
* The account signs on the caller's device or server. This helper does not
|
|
659
|
+
* contact a chain, request an external wallet approval, or submit a transaction.
|
|
660
|
+
*
|
|
661
|
+
* @param account Viem account whose signer and address remain owned by the application.
|
|
662
|
+
* @returns Deferred local signing configuration accepted by `createEvmClient`.
|
|
663
|
+
* @example const account = evmLocalAccount(privateKeyToAccount(privateKey))
|
|
664
|
+
*/
|
|
665
|
+
declare function evmLocalAccount(account: LocalAccount): EvmAccount;
|
|
666
|
+
/**
|
|
667
|
+
* Creates the EVM client used to read bridge state and optionally authorize transactions.
|
|
668
|
+
*
|
|
669
|
+
* Construction wires together existing clients or deferred transports without
|
|
670
|
+
* making an RPC request. Read-only actions need only a transport or public
|
|
671
|
+
* client; fund-moving actions also require an account or wallet client.
|
|
672
|
+
*
|
|
673
|
+
* @param config EVM network access and optional wallet authorization supplied by the application.
|
|
674
|
+
* @returns EVM read and optional wallet capabilities used by bridge actions.
|
|
675
|
+
* @throws BridgeError When multiple alternatives are supplied for one capability, no capability is supplied, or a local signer has no network access.
|
|
676
|
+
* @example const client = createEvmClient({ transport: evmHttp(rpcUrl), account: evmPrivateKey(key) })
|
|
677
|
+
*/
|
|
678
|
+
declare function createEvmClient(config: EvmClientConfig): EvmClient;
|
|
679
|
+
|
|
680
|
+
/** Represents the EVM, Solana, or Aleo network access stored for one registry chain. */
|
|
681
|
+
type BridgeChainClient = EvmClient | SolanaClient | AleoClient;
|
|
682
|
+
/** Stores network and optional wallet access under the same chain identifiers used by routes. */
|
|
683
|
+
type BridgeChainClients = Readonly<Record<string, BridgeChainClient>>;
|
|
684
|
+
|
|
685
|
+
/** Identifies the Ethereum Hyperlane router's collateral model. */
|
|
686
|
+
type EvmHyperlaneRouterType = 'native' | 'collateral';
|
|
687
|
+
/**
|
|
688
|
+
* Captures the reviewed metadata required to dispatch an Ethereum Warp Route transfer.
|
|
689
|
+
*
|
|
690
|
+
* @property routerAddress Contract receiving `transferRemote`.
|
|
691
|
+
* @property sourceChainId EIP-155 chain id expected from the connected wallet.
|
|
692
|
+
* @property destinationDomain Hyperlane domain passed to `transferRemote` as a uint32.
|
|
693
|
+
* @property routerType Whether the router locks native ETH or ERC-20 collateral.
|
|
694
|
+
* @property tokenAddress ERC-20 collateral contract. Required for collateral routers.
|
|
695
|
+
* @property destinationRouter Protocol-native identifier of the enrolled Aleo router.
|
|
696
|
+
* @property mailboxAddress Ethereum Hyperlane Mailbox used by the reviewed deployment.
|
|
697
|
+
* @property interchainGasPaymaster Ethereum gas-paymaster identifier used by the reviewed deployment.
|
|
698
|
+
* @property interchainSecurityModule Route-specific ISM, or the zero address when the Mailbox default applies.
|
|
699
|
+
* @property registryCommit Hyperlane Registry commit containing the deployment snapshot.
|
|
700
|
+
* @property requiresApprovalReset Whether a non-zero ERC-20 allowance must be reset before changing it.
|
|
701
|
+
*/
|
|
702
|
+
type EvmHyperlaneRouteMetadata = {
|
|
703
|
+
routerAddress: Address;
|
|
704
|
+
sourceChainId: number;
|
|
705
|
+
destinationDomain: number;
|
|
706
|
+
routerType: EvmHyperlaneRouterType;
|
|
707
|
+
tokenAddress?: Address | undefined;
|
|
708
|
+
destinationRouter: string;
|
|
709
|
+
mailboxAddress: Address;
|
|
710
|
+
interchainGasPaymaster: Address;
|
|
711
|
+
interchainSecurityModule: Address;
|
|
712
|
+
registryCommit: string;
|
|
713
|
+
requiresApprovalReset?: boolean | undefined;
|
|
714
|
+
};
|
|
715
|
+
/**
|
|
716
|
+
* Supplies an Ethereum-to-Aleo Hyperlane transfer for current fee calculation.
|
|
717
|
+
*
|
|
718
|
+
* @property plan Route, assets, amount, and recipient selected for the transfer.
|
|
719
|
+
* @property recipientBytes32 Aleo recipient in the exact 32-byte encoding expected by the enrolled Warp Route.
|
|
720
|
+
*/
|
|
721
|
+
type QuoteEvmHyperlaneTransferParameters = {
|
|
722
|
+
plan: BridgePlan;
|
|
723
|
+
recipientBytes32: Hex;
|
|
724
|
+
};
|
|
725
|
+
/**
|
|
726
|
+
* Captures the atomic values required by an Ethereum Warp Route transaction.
|
|
727
|
+
*
|
|
728
|
+
* @property routeId Route whose deployment and amount were quoted.
|
|
729
|
+
* @property routerAddress Contract that supplied the quote.
|
|
730
|
+
* @property sourceChainId EIP-155 chain id on which submission must occur.
|
|
731
|
+
* @property destinationDomain Hyperlane destination domain supplied to the router.
|
|
732
|
+
* @property recipientBytes32 Wire-format destination recipient.
|
|
733
|
+
* @property amountAtomic Asset amount passed to `transferRemote`.
|
|
734
|
+
* @property nativeValueAtomic Total `msg.value` required by the router.
|
|
735
|
+
* @property nativeFeeAtomic Native fee above the bridged amount for native routes, or the full native fee for collateral routes.
|
|
736
|
+
* @property tokenAmountAtomic ERC-20 amount requiring allowance for collateral routes.
|
|
737
|
+
* @property tokenAddress ERC-20 collateral contract for collateral routes.
|
|
738
|
+
*/
|
|
739
|
+
type EvmHyperlaneTransferQuote = {
|
|
740
|
+
routeId: string;
|
|
741
|
+
routerAddress: Address;
|
|
742
|
+
sourceChainId: number;
|
|
743
|
+
destinationDomain: number;
|
|
744
|
+
recipientBytes32: Hex;
|
|
745
|
+
amountAtomic: bigint;
|
|
746
|
+
nativeValueAtomic: bigint;
|
|
747
|
+
nativeFeeAtomic: bigint;
|
|
748
|
+
tokenAmountAtomic?: bigint | undefined;
|
|
749
|
+
tokenAddress?: Address | undefined;
|
|
750
|
+
};
|
|
751
|
+
/**
|
|
752
|
+
* Configures an Ethereum Hyperlane submission.
|
|
753
|
+
*
|
|
754
|
+
* The action requotes immediately before submission. ERC-20 allowance is
|
|
755
|
+
* checked first and only insufficient allowances generate approval calls.
|
|
756
|
+
*
|
|
757
|
+
* @property plan Route, assets, amount, and recipient selected for the transfer.
|
|
758
|
+
* @property recipientBytes32 Aleo recipient in the exact 32-byte encoding expected by the enrolled Warp Route.
|
|
759
|
+
* @property pollingIntervalMs Delay between transaction-receipt checks. Defaults to 1,000 milliseconds.
|
|
760
|
+
* @property confirmationTimeoutMs Maximum time to wait for each approval or dispatch receipt. Defaults to 120,000 milliseconds; a timeout returns resumable pending state.
|
|
761
|
+
* @property resume Previously checkpointed approval or source receipt. Verification resumes without repeating its transaction.
|
|
762
|
+
* @property onSubmitted Durable checkpoint hook called after each approval or dispatch broadcast and before receipt polling begins.
|
|
763
|
+
*/
|
|
764
|
+
type ExecuteEvmHyperlaneTransferParameters = {
|
|
765
|
+
plan: BridgePlan;
|
|
766
|
+
recipientBytes32: Hex;
|
|
767
|
+
pollingIntervalMs?: number | undefined;
|
|
768
|
+
confirmationTimeoutMs?: number | undefined;
|
|
769
|
+
resume?: BridgeReceipt | undefined;
|
|
770
|
+
onSubmitted?: ((receipt: BridgeReceipt) => void | Promise<void>) | undefined;
|
|
771
|
+
};
|
|
772
|
+
/**
|
|
773
|
+
* Captures wallet transactions and resumable Hyperlane progress after execution.
|
|
774
|
+
*
|
|
775
|
+
* @property receipt Protocol-neutral transfer state, including the source transaction and message id when confirmed.
|
|
776
|
+
* @property approvalTxIds ERC-20 approval transactions submitted before dispatch.
|
|
777
|
+
*/
|
|
778
|
+
type EvmHyperlaneTransferExecution = {
|
|
779
|
+
receipt: BridgeReceipt;
|
|
780
|
+
approvalTxIds: Hash[];
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Describes the cross-chain transfer whose current cost is calculated.
|
|
785
|
+
*
|
|
786
|
+
* The same source, destination, amount, and recipient become the plan returned
|
|
787
|
+
* with the quote, so the caller can execute exactly what was priced.
|
|
788
|
+
*
|
|
789
|
+
* @property privateMintSecretNonce Secret Aleo scalar committed by a private xReserve deposit. Defaults to `0scalar` and is never persisted in a checkpoint.
|
|
790
|
+
*/
|
|
791
|
+
type QuoteParameters = PrepareParameters & {
|
|
792
|
+
privateMintSecretNonce?: string | undefined;
|
|
793
|
+
};
|
|
794
|
+
/** Identifies the route implementation that produced a transfer quote. */
|
|
795
|
+
type BridgeQuoteKind = 'aleo-hyperlane' | 'aleo-xreserve' | 'evm-hyperlane' | 'evm-xreserve' | 'solana-hyperlane';
|
|
796
|
+
/**
|
|
797
|
+
* Reports the locally known values for an Aleo-origin xReserve burn.
|
|
798
|
+
*
|
|
799
|
+
* The route has no separate source-chain quote call, so the result carries
|
|
800
|
+
* the prepared amount and fees with a `not-queried` status.
|
|
801
|
+
*
|
|
802
|
+
* @property kind Aleo-origin xReserve route discriminator.
|
|
803
|
+
* @property routeId Directional route selected by the plan.
|
|
804
|
+
* @property protocol Circle xReserve protocol discriminator.
|
|
805
|
+
* @property amountIn Decimal source amount.
|
|
806
|
+
* @property amountOut Decimal destination amount when locally determinable.
|
|
807
|
+
* @property fees Fee categories known during preparation.
|
|
808
|
+
* @property status Indicates that no live quote endpoint was queried.
|
|
809
|
+
*/
|
|
810
|
+
type AleoXReserveQuote = {
|
|
811
|
+
kind: 'aleo-xreserve';
|
|
812
|
+
routeId: string;
|
|
813
|
+
protocol: 'xreserve';
|
|
814
|
+
amountIn: string;
|
|
815
|
+
amountOut?: string | undefined;
|
|
816
|
+
fees: BridgeFee[];
|
|
817
|
+
status: 'not-queried';
|
|
818
|
+
};
|
|
819
|
+
/** Captures every quote returned by the protocol-neutral transfer action. */
|
|
820
|
+
type BridgeQuote = ({
|
|
821
|
+
plan: BridgePlan;
|
|
822
|
+
}) & (({
|
|
823
|
+
kind: 'aleo-hyperlane';
|
|
824
|
+
} & AleoHyperlaneGasQuote) | AleoXReserveQuote | ({
|
|
825
|
+
kind: 'evm-hyperlane';
|
|
826
|
+
} & EvmHyperlaneTransferQuote) | ({
|
|
827
|
+
kind: 'evm-xreserve';
|
|
828
|
+
} & EvmXReserveTransferQuote) | ({
|
|
829
|
+
kind: 'solana-hyperlane';
|
|
830
|
+
} & SolanaHyperlaneTransferQuote));
|
|
831
|
+
/**
|
|
832
|
+
* Controls how the source wallet begins a cross-chain transfer.
|
|
833
|
+
*
|
|
834
|
+
* Current fees and approval requirements are recalculated before funds are
|
|
835
|
+
* committed, so a previously displayed quote is not treated as final.
|
|
836
|
+
*
|
|
837
|
+
* @property plan Route, assets, amount, and recipient selected for the transfer.
|
|
838
|
+
* @property pollingIntervalMs Delay between source confirmation checks. Defaults to 1,000 milliseconds where polling applies.
|
|
839
|
+
* @property confirmationTimeoutMs Maximum source confirmation wait. Defaults to 120,000 milliseconds where polling applies.
|
|
840
|
+
* @property onCheckpoint Optional durable hook receiving compact recovery state before supported local Aleo broadcasts and after every submission.
|
|
841
|
+
* @property mode Aleo Hyperlane caller mode or xReserve burn mode. Defaults to `caller` for Hyperlane and `private` for xReserve.
|
|
842
|
+
* @property userRecord Wallet record request or encoded USDCx record required by a private Aleo xReserve burn.
|
|
843
|
+
* @property merkleProof Encoded `[MerkleProof; 2]` literal required by a private Aleo xReserve burn.
|
|
844
|
+
* @property privateFee Whether an Aleo wallet pays its execution fee privately. Defaults to false.
|
|
845
|
+
* @property gasPaymentMicrocredits Optional exact Aleo Hyperlane hook payment override. Defaults to a fresh live quote.
|
|
846
|
+
* @property privateMintSecretNonce Secret Aleo scalar committed by a private xReserve deposit. Defaults to `0scalar` and is never persisted in a checkpoint.
|
|
847
|
+
* @property onProgress Optional awaited callback for Aleo proving and submission boundaries. Non-Aleo routes emit no events.
|
|
848
|
+
*/
|
|
849
|
+
type ExecuteParameters = {
|
|
850
|
+
plan: BridgePlan;
|
|
851
|
+
pollingIntervalMs?: number | undefined;
|
|
852
|
+
confirmationTimeoutMs?: number | undefined;
|
|
853
|
+
onCheckpoint?: ((checkpoint: BridgeCheckpoint) => void | Promise<void>) | undefined;
|
|
854
|
+
mode?: 'caller' | 'signer' | XReserveBurnMode | undefined;
|
|
855
|
+
userRecord?: TransactionInput | undefined;
|
|
856
|
+
merkleProof?: string | undefined;
|
|
857
|
+
privateFee?: boolean | undefined;
|
|
858
|
+
gasPaymentMicrocredits?: bigint | undefined;
|
|
859
|
+
privateMintSecretNonce?: string | undefined;
|
|
860
|
+
onProgress?: ProvingProgressHandler | undefined;
|
|
861
|
+
};
|
|
862
|
+
/** Identifies the route implementation that submitted a transfer. */
|
|
863
|
+
type BridgeExecutionKind = 'aleo-hyperlane' | 'aleo-xreserve' | 'evm-hyperlane' | 'evm-xreserve' | 'solana-hyperlane';
|
|
864
|
+
/** Captures every result returned by the protocol-neutral execution action. */
|
|
865
|
+
type BridgeExecution = ({
|
|
866
|
+
kind: 'aleo-hyperlane';
|
|
867
|
+
} & AleoHyperlaneTransferRemoteExecution) | ({
|
|
868
|
+
kind: 'aleo-xreserve';
|
|
869
|
+
} & XReserveBurnExecution) | ({
|
|
870
|
+
kind: 'evm-hyperlane';
|
|
871
|
+
} & EvmHyperlaneTransferExecution) | ({
|
|
872
|
+
kind: 'evm-xreserve';
|
|
873
|
+
} & EvmXReserveTransferExecution) | ({
|
|
874
|
+
kind: 'solana-hyperlane';
|
|
875
|
+
} & SolanaHyperlaneTransferExecution);
|
|
876
|
+
/**
|
|
877
|
+
* Supplies an in-progress cross-chain transfer for one status check.
|
|
878
|
+
*
|
|
879
|
+
* @property plan Route, assets, amount, and recipient for the transfer.
|
|
880
|
+
* @property receipt Latest known state and submitted transaction identifiers.
|
|
881
|
+
* @property signal Optional cancellation signal for protocol HTTP reads. Defaults to no cancellation.
|
|
882
|
+
*/
|
|
883
|
+
type GetStatusParameters = {
|
|
884
|
+
plan: BridgePlan;
|
|
885
|
+
receipt: BridgeReceipt;
|
|
886
|
+
signal?: AbortSignal | undefined;
|
|
887
|
+
};
|
|
888
|
+
/**
|
|
889
|
+
* Controls the wallet transaction that privately delivers USDCx on Aleo.
|
|
890
|
+
*
|
|
891
|
+
* @property privateMintSecretNonce Secret Aleo scalar required by a private xReserve mint. Defaults to `0scalar`.
|
|
892
|
+
* @property privateFee Whether the Aleo wallet pays its fee privately. Defaults to false.
|
|
893
|
+
* @property onCheckpoint Durable hook called before supported local Aleo broadcast and again after destination submission.
|
|
894
|
+
* @property onProgress Optional awaited callback for Aleo proving and submission boundaries.
|
|
895
|
+
*/
|
|
896
|
+
type CompleteOptions = {
|
|
897
|
+
privateMintSecretNonce?: string | undefined;
|
|
898
|
+
privateFee?: boolean | undefined;
|
|
899
|
+
onCheckpoint?: ((checkpoint: BridgeCheckpoint) => void | Promise<void>) | undefined;
|
|
900
|
+
onProgress?: ProvingProgressHandler | undefined;
|
|
901
|
+
};
|
|
902
|
+
/**
|
|
903
|
+
* Supplies the state and wallet preferences required to receive private USDCx on Aleo.
|
|
904
|
+
*
|
|
905
|
+
* An application returning after an interruption passes recovered progress. An
|
|
906
|
+
* application that stayed open passes the original transfer details and latest
|
|
907
|
+
* receipt.
|
|
908
|
+
*
|
|
909
|
+
* @property progress Recovered progress whose next operation is `complete`.
|
|
910
|
+
* @property plan Route, assets, amount, and recipient retained while the application stayed open.
|
|
911
|
+
* @property receipt Circle-attested transfer state retained while the application stayed open.
|
|
912
|
+
* @property privateMintSecretNonce Secret Aleo scalar required by a private xReserve mint. Defaults to `0scalar` and must match the source deposit.
|
|
913
|
+
* @property privateFee Whether the Aleo wallet pays its fee privately. Defaults to false.
|
|
914
|
+
* @property onCheckpoint Optional durable hook called before supported local Aleo broadcast and again after destination submission.
|
|
915
|
+
*/
|
|
916
|
+
type CompleteParameters = CompleteOptions & ({
|
|
917
|
+
progress: Extract<BridgeProgress, {
|
|
918
|
+
next: 'complete';
|
|
919
|
+
}>;
|
|
920
|
+
plan?: never;
|
|
921
|
+
receipt?: never;
|
|
922
|
+
} | {
|
|
923
|
+
progress?: never;
|
|
924
|
+
plan: BridgePlan;
|
|
925
|
+
receipt: BridgeReceipt;
|
|
926
|
+
});
|
|
927
|
+
/**
|
|
928
|
+
* Supplies saved public transfer information for recovery after an interruption.
|
|
929
|
+
*
|
|
930
|
+
* @property checkpoint Compact checkpoint emitted at a wallet submission boundary.
|
|
931
|
+
* @property signal Optional cancellation signal. Defaults to no cancellation.
|
|
932
|
+
*/
|
|
933
|
+
type RecoverParameters = {
|
|
934
|
+
checkpoint: BridgeCheckpoint;
|
|
935
|
+
signal?: AbortSignal | undefined;
|
|
936
|
+
};
|
|
937
|
+
/**
|
|
938
|
+
* Controls submission of a source-chain transaction left unfinished after an interruption.
|
|
939
|
+
*
|
|
940
|
+
* @property progress Recovery result whose next operation is `resume`.
|
|
941
|
+
* @property privateMintSecretNonce Secret Aleo scalar required to resume a private xReserve deposit. Defaults to `0scalar` and must match the checkpointed hook.
|
|
942
|
+
* @property pollingIntervalMs Delay between source confirmation reads. Defaults to 1,000 milliseconds.
|
|
943
|
+
* @property confirmationTimeoutMs Maximum source confirmation wait. Defaults to 120,000 milliseconds.
|
|
944
|
+
* @property onCheckpoint Optional durable hook called immediately after a new transaction is broadcast.
|
|
945
|
+
*/
|
|
946
|
+
type ResumeParameters = {
|
|
947
|
+
progress: Extract<BridgeProgress, {
|
|
948
|
+
next: 'resume';
|
|
949
|
+
}>;
|
|
950
|
+
privateMintSecretNonce?: string | undefined;
|
|
951
|
+
pollingIntervalMs?: number | undefined;
|
|
952
|
+
confirmationTimeoutMs?: number | undefined;
|
|
953
|
+
onCheckpoint?: ((checkpoint: BridgeCheckpoint) => void | Promise<void>) | undefined;
|
|
954
|
+
};
|
|
955
|
+
/**
|
|
956
|
+
* Controls how a recovered cross-chain transfer is followed until it finishes or needs a wallet.
|
|
957
|
+
*
|
|
958
|
+
* @property progress Current transfer details, receipt, and required next operation.
|
|
959
|
+
* @property until Optional protocol statuses that also stop polling. Defaults to wallet authorization and terminal boundaries.
|
|
960
|
+
* @property pollingIntervalMs Delay between reads. Defaults to 15,000 milliseconds.
|
|
961
|
+
* @property timeoutMs Maximum polling duration. Defaults to 1,200,000 milliseconds.
|
|
962
|
+
* @property onUpdate Optional callback invoked after each receipt transition.
|
|
963
|
+
* @property signal Optional cancellation signal. Defaults to no cancellation.
|
|
964
|
+
*/
|
|
965
|
+
type WaitParameters = {
|
|
966
|
+
progress: BridgeProgress;
|
|
967
|
+
until?: readonly BridgeStatus[] | undefined;
|
|
968
|
+
pollingIntervalMs?: number | undefined;
|
|
969
|
+
timeoutMs?: number | undefined;
|
|
970
|
+
onUpdate?: ((progress: BridgeProgress) => void | Promise<void>) | undefined;
|
|
971
|
+
signal?: AbortSignal | undefined;
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* Carries validated registry and materialized client state into bound actions.
|
|
976
|
+
* @property registry Validated deployment registry.
|
|
977
|
+
* @property clients Materialized chain capabilities keyed by registry chain id.
|
|
978
|
+
* @property fetch Fetch implementation used for protocol HTTP requests.
|
|
979
|
+
*/
|
|
980
|
+
type BridgeActionsConfig = {
|
|
981
|
+
registry: BridgeRegistry;
|
|
982
|
+
clients: BridgeChainClients;
|
|
983
|
+
fetch: typeof globalThis.fetch;
|
|
984
|
+
};
|
|
985
|
+
/**
|
|
986
|
+
* Groups the complete cross-chain transfer lifecycle exposed by a bridge client.
|
|
987
|
+
*
|
|
988
|
+
* Quoting validates the transfer and reads chains or providers where current
|
|
989
|
+
* costs are available. Execution, resumption, completion, shielding, and
|
|
990
|
+
* unshielding can request wallet authorization and move funds.
|
|
991
|
+
*/
|
|
992
|
+
type BridgeActions = {
|
|
993
|
+
quote: (params: QuoteParameters) => Promise<BridgeQuote>;
|
|
994
|
+
execute: (params: ExecuteParameters) => Promise<BridgeExecution>;
|
|
995
|
+
getStatus: (params: GetStatusParameters) => Promise<BridgeReceipt>;
|
|
996
|
+
complete: (params: CompleteParameters) => Promise<BridgeExecution>;
|
|
997
|
+
recover: (params: RecoverParameters) => Promise<BridgeProgress>;
|
|
998
|
+
resume: (params: ResumeParameters) => Promise<BridgeExecution>;
|
|
999
|
+
wait: (params: WaitParameters) => Promise<BridgeProgress>;
|
|
1000
|
+
shield: (params: ShieldParameters) => Promise<AleoPrivacyExecution>;
|
|
1001
|
+
unshield: (params: UnshieldParameters) => Promise<AleoPrivacyExecution>;
|
|
1002
|
+
};
|
|
1003
|
+
/**
|
|
1004
|
+
* Binds configured chains, wallets, and provider HTTP access to every bridge action.
|
|
1005
|
+
*
|
|
1006
|
+
* Calling this function only creates closures; it does not contact a chain,
|
|
1007
|
+
* request a signature, submit a transaction, move funds, or store state.
|
|
1008
|
+
*/
|
|
1009
|
+
declare function bridgeActions(config: BridgeActionsConfig): BridgeActions;
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Configures the chains, wallets, providers, and route catalog available to a bridge client.
|
|
1013
|
+
*
|
|
1014
|
+
* @property environment Default route environment. Defaults to `mainnet`.
|
|
1015
|
+
* @property registry Optional replacement catalog of supported assets, routes, and reviewed provider deployments. Defaults to the package catalog.
|
|
1016
|
+
* @property clients Network and optional wallet access keyed by the matching chain identifier in the catalog.
|
|
1017
|
+
* @property fetch Optional Fetch API implementation used for provider status requests. Defaults to `globalThis.fetch`.
|
|
1018
|
+
* @property key Stable client key. Defaults to `bridge`.
|
|
1019
|
+
* @property name Display name. Defaults to `Bridge Client`.
|
|
1020
|
+
*/
|
|
1021
|
+
type BridgeClientConfig = {
|
|
1022
|
+
environment?: BridgeEnvironment | undefined;
|
|
1023
|
+
registry?: BridgeRegistry | undefined;
|
|
1024
|
+
clients?: BridgeChainClients | undefined;
|
|
1025
|
+
fetch?: typeof globalThis.fetch | undefined;
|
|
1026
|
+
key?: string | undefined;
|
|
1027
|
+
name?: string | undefined;
|
|
1028
|
+
};
|
|
1029
|
+
/**
|
|
1030
|
+
* Exposes the actions for discovering, pricing, submitting, following, and recovering cross-chain transfers.
|
|
1031
|
+
*
|
|
1032
|
+
* @property key Stable client key.
|
|
1033
|
+
* @property name Client display name.
|
|
1034
|
+
* @property environment Default route environment.
|
|
1035
|
+
* @property registry Validated catalog of supported assets, routes, and provider deployments.
|
|
1036
|
+
*/
|
|
1037
|
+
type BridgeClient = BridgeActions & {
|
|
1038
|
+
key: string;
|
|
1039
|
+
name: string;
|
|
1040
|
+
environment: BridgeEnvironment;
|
|
1041
|
+
registry: BridgeRegistry;
|
|
1042
|
+
};
|
|
1043
|
+
/**
|
|
1044
|
+
* Creates a client for discovering, pricing, submitting, following, and recovering cross-chain transfers.
|
|
1045
|
+
*
|
|
1046
|
+
* Construction validates the configured catalog and stores the supplied network
|
|
1047
|
+
* and wallet clients. It does not contact a chain or provider, request a
|
|
1048
|
+
* signature, submit a transaction, move funds, or manage application storage.
|
|
1049
|
+
*
|
|
1050
|
+
* @param config Networks, wallets, provider HTTP access, and optional replacement route catalog.
|
|
1051
|
+
* @returns Bridge actions bound to the configured chains, wallets, providers, and environment.
|
|
1052
|
+
* @throws BridgeError When the route catalog contains duplicate, missing, or incompatible references.
|
|
1053
|
+
* @example
|
|
1054
|
+
* const bridge = createBridgeClient({ environment: 'mainnet' })
|
|
1055
|
+
*/
|
|
1056
|
+
declare function createBridgeClient(config?: BridgeClientConfig): BridgeClient;
|
|
1057
|
+
|
|
1058
|
+
export { type EvmLog as $, type AleoPrivacyExecution as A, type BridgeChainClients as B, type CompleteParameters as C, type AleoClient as D, type ExecuteParameters as E, type AleoClientConfig as F, type GetStatusParameters as G, type BridgeActions as H, type BridgeActionsConfig as I, type BridgeChainClient as J, type BridgeClient as K, type BridgeClientConfig as L, type BridgeExecutionKind as M, type BridgeQuoteKind as N, type EvmAccount as O, type EvmCallParameters as P, type QuoteParameters as Q, type RecoverParameters as R, type ShieldParameters as S, type EvmClientConfig as T, type UnshieldParameters as U, type EvmGetLogsParameters as V, type WaitParameters as W, type XReserveHttpTransport as X, type EvmHttpOptions as Y, type EvmHyperlaneRouteMetadata as Z, type EvmHyperlaneRouterType as _, type BridgeExecution as a, type EvmPublicClient as a0, type EvmReceipt as a1, type EvmRequest as a2, type EvmTransaction as a3, type EvmTransactionParameters as a4, type EvmTransport as a5, type EvmXReserveRouteMetadata as a6, type XReserveBurnMode as a7, type XReserveHttpResponse as a8, aleoWallet as a9, bridgeActions as aa, createAleoClient as ab, createBridgeClient as ac, createEvmClient as ad, evmCustom as ae, evmHttp as af, evmLocalAccount as ag, evmPrivateKey as ah, evmProvider as ai, type BridgeQuote as b, type ResumeParameters as c, type QuoteAleoHyperlaneGasPaymentParameters as d, type AleoHyperlaneGasQuote as e, type AleoWalletClient as f, type ExecuteAleoHyperlaneTransferRemoteParameters as g, type AleoHyperlaneTransferRemoteExecution as h, type EvmClient as i, type QuoteEvmHyperlaneTransferParameters as j, type EvmHyperlaneTransferQuote as k, type EvmWalletClient as l, type ExecuteEvmHyperlaneTransferParameters as m, type EvmHyperlaneTransferExecution as n, type QuoteEvmXReserveTransferParameters as o, type EvmXReserveTransferQuote as p, type ExecuteEvmXReserveTransferParameters as q, type EvmXReserveTransferExecution as r, type GetXReserveAttestationParameters as s, type XReserveAttestationResult as t, type ExecuteXReservePrivateMintParameters as u, type XReservePrivateMintExecution as v, type ExecuteXReserveBurnParameters as w, type XReserveBurnExecution as x, type XReserveBurnCall as y, type AleoHyperlaneTransferRemoteCall as z };
|