docs: add Sepolia ↔ Miden bridging tutorial via Epoch (+ examples/bridging-app)#199
docs: add Sepolia ↔ Miden bridging tutorial via Epoch (+ examples/bridging-app)#199Keinberger wants to merge 2 commits into
Conversation
…dging-app) Adds a single-page web-client tutorial covering Miden→EVM and EVM→Miden bridging through the Epoch protocol intent SDK, plus a runnable Vite + React reference app under examples/bridging-app/ that the tutorial's code blocks paste-verify against (a snippet check enforces byte-identity). The example app is forked from epochprotocol/miden-integration-example@efc3a690 with bridging-specific adaptations: the '1000' reclaim-height literal replaced with a runtime currentMidenBlock + 1000 computation, the dead wagmi Miden chain placeholder + no-op midenClient removed, the RainbowKit projectId made env-driven (with a setup screen instead of a blank-page crash when unset), the WithdrawForm token decimals corrected to 18, and the general-purpose Miden wallet UI stripped to keep the example focused on bridging. The tutorial covers wiring the SDK against a wagmi walletClient with the Miden virtual chain id override, the Miden→EVM four-stage pipeline (getTaskData → getIntentQuote → solveIntent → polling), the EVM→Miden reverse direction through Epoch's Compact contract on Sepolia, an 11-method API reference card, and the inherited Epoch integration pitfalls. It stays within the 2,000-2,500 word band and ships unit coverage for the epoch-bridge task-data builders.
feat(bridging-app): reference-app-walkthrough reframe, bigint-safe Miden balance, info-panel consume
|
Did a fresh pass against the latest PR head and the current Epoch materials, some feedbacks! 1 Status polling should be destination-chain aware.The latest Epoch example does not treat “first non-Miden status row” as the final EVM settlement. It filters status rows to the actual destination chain, waits while any destination-chain row is still pending, then takes the last destination-chain success. This PR currently does:
That can pick up an internal Compact/SIO row instead of the user’s destination-chain settlement. The upstream example explicitly calls this out because SIO can surface a prior-step success alongside an in-flight destination-chain tx. Can we port the destination-chain-aware logic from the latest Epoch example into this PR? Just to make sure dvelopers/agents are aware of potential unsettled transctions in the list. 2 The
|
Summary
This PR ships a single-page web-client tutorial (
docs/src/web-client/bridging_with_epoch_tutorial.md) covering Miden↔Sepolia bridging via the Epoch protocol intent SDK, plus a runnable Vite + React reference app underexamples/bridging-app/that the tutorial's snippets paste-verify against.The tutorial is framed as a guided tour of the reference app: clone it, run it, then read the steps as annotations on the integration points you'd port into your own Miden frontend. Every fenced code block is byte-identical to a slice of
examples/bridging-app/src/..., with a preceding**From <file> (lines X–Y):**prose line plus an HTML<!-- source: ... -->comment that the agent task-workflow verifier checks against the real source. Both directions were exercised live on Sepolia + Miden testnet through a wallet-enabled Playwright MCP browser — forward: EVM tx0xe8d4eb1b…1112status: successwith P2IDE note0xc03ec01…cc798consumed on Miden; reverse: Sepolia compact-deposit tx0xe0e7f415…a063ad86with Miden P2ID note0x5d577237…612c5378delivered to the recipient wallet.Companion sidebar + Bridging DocCard in
0xMiden/docs#297.Key Changes
EpochIntentSDKAPI reference card sourced todist/index.d.tsline ranges.examples/bridging-app/forked fromepochprotocol/miden-integration-example@efc3a690with bridging-specific adaptations:midenReclaimHeightcomputed at the call site ascurrentMidenBlock + 1000(was a literal upstream), env-drivenVITE_RAINBOWKIT_PROJECT_ID+VITE_ALLOCATOR_URL, auto-derived Miden faucet ID for known tokens, sharedMidenWalletAdapterProvidercontext so the wallet'srequestAssets()popup fires once per page load instead of per consumer, lazy-mount-then-keep tabs so an in-flight withdraw quote survives a tab switch, and an informationalWithdrawConsumepanel that points readers at the auto-consumed P2ID note on Midenscan.Balance:label — usesviem'sformatUnitsagainst the faucet's decimals instead ofNumber(amount)(the raw base-unit display was a real bug surfaced live by a fresh-reader pass through the tutorial).Miden x Epoch Bridgereplacing the scaffold default.WithdrawConsumepanel, and theIntentFormbalance render;tsc -b --noEmit,vite build,prettier --check "**/*.md",yarn lint, the docsnpm run build:dev, and the snippet verifier all clean.Out of scope
protocol/crates/miden-agglayer/SPEC.md. A web-Agglayer tutorial will be its own PR after a feasibility pass.Open Questions
<details>if you'd prefer breathing room.Reviewers: Brian (docs IA), an Epoch team rep for technical accuracy, Keinberger for voice.