/** * Fee-juice bridging for the `fee-juice` deploy policy: bridge Fee Juice from L1 * ({@link bridgeFeeJuice}) and wait for the L1→L2 message to become available * ({@link waitForL1ToL2Message}). Fee Juice only — this is not a generic L1→L2 asset bridge. * Node-only (pulls in `@aztec/aztec.js/ethereum` + viem). * * Nothing here sends the L2 claim tx — the caller feeds the returned claim into * `FeeJuicePaymentMethodWithClaim` so the claim lands inside whatever tx the recipient is already * sending. */ import type { AztecAddress } from '@aztec/aztec.js/addresses'; import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum'; import type { AztecNode } from '@aztec/aztec.js/node'; import { Fr } from '@aztec/foundation/curves/bn254'; import type { Hex } from 'viem'; /** Local vs. remote L1→L2 message advancement: warp cheats time forward, poll just waits. */ export type BridgeTimingMode = 'warp' | 'poll'; /** The claim produced by bridging: exactly the shape `FeeJuicePaymentMethodWithClaim` expects. */ export type FeeJuiceClaim = Awaited>; /** * Decides how the L1 signer funds a bridge: mint from the fee-asset faucet handler, or transfer * its existing Fee Juice. Pure — exercised directly by unit tests. * * - Balance covers the requested amount → transfer it (no mint, even when a faucet exists). * - Balance short of the amount + faucet available → mint (the faucet path bridges the handler's * own mint amount and ignores `amount`). * - Balance short + no faucet → throw, reporting the shortfall. * - No `amount` requested → the faucet is required (there is nothing to size a transfer by). */ export declare function pickBridgeRoute(opts: { hasFaucet: boolean; l1Balance: bigint; amount?: bigint; }): { useFaucet: boolean; amount?: bigint; }; export interface BridgeFeeJuiceParams { node: AztecNode; l1RpcUrl: string; l1ChainId: number; recipient: AztecAddress; /** Desired amount in wei. Optional only when a faucet exists (whose `mintAmount()` then wins). */ amount?: bigint; /** L1 private key signing the bridge tx. When omitted, a fresh ephemeral key is generated. */ l1PrivateKey?: Hex; } /** * Bridges fee juice to an L2 recipient, minting from the faucet handler or transferring the * signer's balance per {@link pickBridgeRoute}. Returns the claim; the L1→L2 message it references * becomes available later — see {@link waitForL1ToL2Message}. */ export declare function bridgeFeeJuice(params: BridgeFeeJuiceParams): Promise; export interface WaitForClaimParams { node: AztecNode; messageHash: Fr; /** * On `warp` (local) we cheat L1+L2 time forward via the node debug API until the message shows as * available; on `poll` (every other network) we just check periodically. */ mode: BridgeTimingMode; /** Timeout before giving up (default 30 min for poll, 2 min for warp). */ timeoutMs?: number; /** Warp-only: options for reaching the node's debug API. */ warpOpts?: { nodeUrl?: string; }; } /** Waits until an L1→L2 message is available on the node (warping time forward in `warp` mode). */ export declare function waitForL1ToL2Message(params: WaitForClaimParams): Promise; /** * Local-network helper: advances L1 + L2 time via the node debug API until the given L1→L2 message * shows up as available, warping by one L2 slot (read from the node's rollup constants) per check. * An in-process node (e.g. a test fixture's `AztecNodeService`) implements the debug interface * directly; a remote node is reached via its debug RPC at `nodeUrl` — `warpL2TimeAtLeastBy` needs * `AztecNode & AztecNodeDebug` (it reads the current L1 timestamp via the regular API before * warping), and both clients target the same URL and expose their methods as own properties on the * rpc proxy, so a shallow merge is safe. */ export declare function warpToL1ToL2Message(node: AztecNode, messageHash: Fr, opts?: { nodeUrl?: string; timeoutMs?: number; }): Promise; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnJpZGdpbmcuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kZXBsb3kvYnJpZGdpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7OztHQVNHO0FBQ0gsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDOUQsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFFbkUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFHdEQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBS3BELE9BQU8sS0FBSyxFQUFFLEdBQUcs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