diff --git a/app/vibenet/demos/validity/ValidityDemo.tsx b/app/vibenet/demos/validity/ValidityDemo.tsx index e53bfd2..5d7888f 100644 --- a/app/vibenet/demos/validity/ValidityDemo.tsx +++ b/app/vibenet/demos/validity/ValidityDemo.tsx @@ -1,13 +1,11 @@ 'use client'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { formatEther, type Hex, type PublicClient } from 'viem'; +import type { Hex, PublicClient } from 'viem'; import { trackValidityOrder } from '../../../analytics/events'; -import { Button } from '../../../components/ui/Button'; import { Card } from '../../../components/ui/Card'; import { Text } from '../../../components/ui/Text'; -import { CopyableValue } from '../../components/CopyableValue'; import { AccountDemoShell } from '../_components/AccountDemoShell'; import { DemoHeader } from '../_components/DemoHeader'; import { newCallRow } from '../account/library/calls'; @@ -41,7 +39,6 @@ import { MAX_NONCELESS_SECONDS, TRADE_VIBE, } from './lib/constants'; -import { VibenetApiError } from '../../library/client'; import { VIBENET_WS_URL } from '../../library/config'; import { ageRestoredOrders, @@ -621,26 +618,6 @@ function ValidityDemoInner() { return marks; }, [hoveredOrderId, orders]); - const fund = useCallback(async () => { - setBusy(true); - setError(null); - try { - setProgress('Requesting ETH from the faucet'); - await engine.requestFaucet(); - } catch (err) { - setError( - err instanceof VibenetApiError && err.status === 429 - ? 'Faucet rate limited — wait a minute and try again.' - : err instanceof Error - ? err.message - : 'Faucet request failed.', - ); - } finally { - setBusy(false); - setProgress(null); - } - }, [engine]); - const inventoryKeyRef = useRef(''); // Mint USDV inventory + approve the helper for the user's own account so @@ -875,8 +852,6 @@ function ValidityDemoInner() { } }; - const address = acct?.address; - const deployed = Boolean(state?.deployment); const tradeLabel = formatTokenAmount(TRADE_VIBE); const canAffordTrade = (() => { if (!draft) return false; @@ -912,97 +887,63 @@ function ValidityDemoInner() { {statusError} ) : null} - {!deployed ? ( - - Shared pool - - The shared VIBE/USDV pool (VIBE is a B20, USDV is the faucet - stablecoin) runs on Vibenet infrastructure — a central actor system - keeps a live market moving. It’s coming online; this page will fill - in automatically. Meanwhile, top up your account so you’re ready to - place a conditional order. - - {address ? ( -
- - Address - - -
- ) : null} -
- - ETH - - {ethBalance === null ? '…' : formatEther(ethBalance)} -
- {error ? {error} : null} - {progress ? {progress} : null} -
- -
-
- ) : ( -
-
- -
- {draft ? ( - { - setSide(next); - setPriceOverrideWad(null); - }} - onOffset={(bps) => { - setOffsetBps(bps); - setPriceOverrideWad(null); - }} - onPriceOverride={setPriceOverrideWad} - onExpiry={setExpirySeconds} - onSubmitMode={(mode) => { - setSubmitMode(mode); - if (mode === 'concurrent' && expirySeconds > MAX_NONCELESS_SECONDS) { - setExpirySeconds(15); - } - }} - onSubmit={() => { - setError(null); - setTxHash(null); - setTxStep('review'); - setTxOpen(true); - }} - /> - ) : ( - - Conditional swap - - Waiting for a live mid from the simulated pool. - - - )} - {progress ? {progress} : null} - {error && !txOpen ? {error} : null} -
+
+
+ +
+ {draft ? ( + { + setSide(next); + setPriceOverrideWad(null); + }} + onOffset={(bps) => { + setOffsetBps(bps); + setPriceOverrideWad(null); + }} + onPriceOverride={setPriceOverrideWad} + onExpiry={setExpirySeconds} + onSubmitMode={(mode) => { + setSubmitMode(mode); + if (mode === 'concurrent' && expirySeconds > MAX_NONCELESS_SECONDS) { + setExpirySeconds(15); + } + }} + onSubmit={() => { + setError(null); + setTxHash(null); + setTxStep('review'); + setTxOpen(true); + }} + /> + ) : ( + + Conditional swap + + Waiting for a live mid from the simulated pool. + + + )} + {progress ? {progress} : null} + {error && !txOpen ? {error} : null}
-
- )} + +
)} {draft ? (