UNPKG

@nori-zk/mina-token-bridge

Version:

Nori ethereum state settelment and nETH token bridge zkApp

30 lines 1.25 kB
// --------------------------------------------------------------------------- // Deposit-root window helpers (reusable for client code) // --------------------------------------------------------------------------- import { fetchAccount, Reducer } from 'o1js'; /** * Fetch the deposit-root actions currently in the contract's active window. * Reads `windowStart` from on-chain state and fetches actions from that * action-state hash forward to the current tip. * Returns a flat array of Field values in dispatch order. */ export async function fetchWindowRoots(bridge) { await fetchAccount({ publicKey: bridge.address }); const windowStart = bridge.windowStart.get(); const actionBatches = await bridge.reducer.fetchActions({ fromActionState: windowStart, }); return actionBatches.flat(); } /** * Fetch ALL dispatched deposit-root actions from genesis. * Useful for debugging / full history, but prefer `fetchWindowRoots` * for normal operation. */ export async function fetchAllDispatchedRoots(bridge) { const actionBatches = await bridge.reducer.fetchActions({ fromActionState: Reducer.initialActionState, }); return actionBatches.flat(); } //# sourceMappingURL=NoriTokenBridge.utils.js.map