Skip to content
Merged

Dev #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
VITE_ALLOCATOR_URL=https://testnet-dev.epochprotocol.xyz
# Testnet
VITE_MIDEN_TESTNET_RPC_URL=https://rpc.testnet.miden.io
VITE_TESTNET_ALLOCATOR_URL=http://localhost:3000

# Devnet (optional)
# VITE_MIDEN_DEVNET_RPC_URL=https://rpc.devnet.miden.io
# VITE_DEVNET_ALLOCATOR_URL=http://localhost:3000
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Miden ⇄ EVM Epoch Integration Example

Reference dapp showing how to use [`@epoch-protocol/epoch-intents-sdk`](https://www.npmjs.com/package/@epoch-protocol/epoch-intents-sdk) to move value between Epoch testnet EVM chains and Miden testnet via Epoch intents.
Reference dapp showing how to use [`@epoch-protocol/epoch-intents-sdk`](https://www.npmjs.com/package/@epoch-protocol/epoch-intents-sdk) to move value between Epoch testnet EVM chains and Miden devnet or testnet via Epoch intents.

Two flows:

Expand Down Expand Up @@ -33,7 +33,13 @@ Testnet tokens (USDC, DAI, USDT, etc.) share the same contract addresses across
```
`.env`:
```
VITE_ALLOCATOR_URL=https://testnet-dev.epochprotocol.xyz
# Run the devnet-compatible smallocator locally.
VITE_DEVNET_ALLOCATOR_URL=http://localhost:3000

# Testnet stays disabled until both endpoints are configured for the same
# network. Do not point either value at a devnet service.
# VITE_MIDEN_TESTNET_RPC_URL=https://your-testnet-rpc.example
# VITE_TESTNET_ALLOCATOR_URL=https://your-testnet-allocator.example
```
2. Install + start:
```bash
Expand All @@ -49,24 +55,24 @@ Testnet tokens (USDC, DAI, USDT, etc.) share the same contract addresses across

## Test Funds

- **Miden testnet tokens**: claim from official Miden faucet in Miden Wallet.
- **Miden devnet tokens**: claim from the [official devnet faucet](https://faucet.devnet.miden.io/) in a devnet Miden wallet. Testnet becomes selectable only after its RPC and Epoch allocator have both been configured.
- **EVM testnet tokens**: ping Epoch team with your Ethereum address; team will send testnet USDC.

## Key Files

| Path | Purpose |
| ------------------------------------ | --------------------------------------------------------- |
| `src/services/epoch-bridge.ts` | Epoch SDK wrapper (intent build / submit / poll) |
| `src/hooks/useEpochIntent.ts` | Miden→EVM intent submission flow |
| `src/hooks/useWithdrawIntent.ts` | EVM→Miden withdraw flow |
| `src/hooks/useMidenWalletAdapter.ts` | Miden wallet connect/state |
| `src/hooks/useMidenTransfer.ts` | P2IDE note creation on Miden |
| `src/hooks/useIntentFlowStatus.ts` | Intent lifecycle polling |
| `src/constants/chains.ts` | Testnet EVM chains + Miden virtual chain id (`999999999`) |
| `src/config/wagmi.ts` | wagmi/RainbowKit config |
| Path | Purpose |
| -------------------------------------- | --------------------------------------------------------- |
| `src/services/epoch-bridge.ts` | Epoch SDK wrapper (intent build / submit / poll) |
| `src/hooks/useEpochIntent.ts` | Miden→EVM intent submission flow |
| `src/hooks/useWithdrawIntent.ts` | EVM→Miden withdraw flow |
| `src/hooks/useMidenWalletAdapter.ts` | Miden wallet connect/state |
| `src/hooks/useMidenP2IDNoteFactory.ts` | Wallet-submitted P2IDE collateral-note creation |
| `src/hooks/useIntentFlowStatus.ts` | Intent lifecycle polling |
| `src/constants/chains.ts` | Testnet EVM chains + Miden virtual chain id (`999999999`) |
| `src/config/wagmi.ts` | wagmi/RainbowKit config |

## Notes

- `MIDEN_DESTINATION_CHAIN_ID = 999999999` is the virtual chain id used as `tokenOut.chainId` when Miden is the intent output. Do not set this to a real EVM chain id.
- Allocator URL is configurable via `VITE_ALLOCATOR_URL`. Default points at Epoch testnet-dev.
- Devnet allocator URL is configurable via `VITE_DEVNET_ALLOCATOR_URL` (with `VITE_ALLOCATOR_URL` retained as a compatibility fallback). Testnet requires both `VITE_MIDEN_TESTNET_RPC_URL` and `VITE_TESTNET_ALLOCATOR_URL`.
- Build: `pnpm build` (`tsc -b && vite build`). Lint: `pnpm lint`.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"@epoch-protocol/epoch-intents-sdk": "^1.0.38",
"@fontsource-variable/jetbrains-mono": "^5.2.8",
"@metamask/sdk": "^0.34.0",
"@miden-sdk/miden-sdk": "^0.15.2",
"@miden-sdk/miden-wallet-adapter-base": "^0.15.1",
"@miden-sdk/miden-wallet-adapter-react": "^0.15.1",
"@miden-sdk/react": "^0.15.2",
"@miden-sdk/miden-sdk": "0.16.0",
"@miden-sdk/miden-wallet-adapter-base": "0.16.0",
"@miden-sdk/miden-wallet-adapter-react": "0.16.0",
"@miden-sdk/react": "0.16.0",
"@phosphor-icons/react": "^2.1.10",
"@rainbow-me/rainbowkit": "^2.2.10",
"@tanstack/react-query": "^5.90.20",
Expand Down
Loading