Round 1 against STRATEGY-2026-10-23.md's backlog: - Wire register_agent/stake/set_credit_score/deposit_liquidity to the real Casper Testnet contracts (lib/casper/live_bridge.ts), verified live against the real RPC node with a freshly generated (unfunded) keypair (npm run casper:keygen). Honesty flags built in for the Odra payable calling convention and the admin-gated set_credit_score call. - Unblock NEAR's paid x402 route (npm run near:keygen generates a real implicit account id); QIE stays correctly flagged as blocked on unconfirmed external facts (asset contract, facilitator), not env plumbing. - New public Home tab: live-stats hero, how-it-works, a real competitor comparison table, and a "90-second proof" that calls the real API live in the browser (verified end-to-end with gstack browse). - Cold-start UX: visible retry state in X402Playground + the TS SDK, plus a keep-warm self-ping (lib/services/keepalive.ts) so the free Render dyno rarely idles out from under a real first-time caller. - New GET /v1/credit-score/:agentId alias + docs/integrations/ samples for Skyfire/Nevermined/Coinbase x402. - Self-hosting quickstart: root docker-compose.yml + scripts/bootstrap.sh, both run for real; fixed a real EACCES crash-loop bug in infra/Dockerfile (non-root user never owned the /data volume mount) found while verifying. 450/450 tests pass, typecheck clean, frontend build clean.
143 lines
6.7 KiB
TypeScript
143 lines
6.7 KiB
TypeScript
import { useMemo, useState } from "react";
|
|
import { useLedger } from "./hooks/useLedger";
|
|
import { useChainManifest } from "./hooks/useChainManifest";
|
|
import { indexContracts } from "./lib/explorer";
|
|
import { Agents } from "./components/Agents";
|
|
import { Jobs } from "./components/Jobs";
|
|
import { Receipts } from "./components/Receipts";
|
|
import { CreditPool } from "./components/CreditPool";
|
|
import { Disputes } from "./components/Disputes";
|
|
import { Governance } from "./components/Governance";
|
|
import { Multichain } from "./components/Multichain";
|
|
import { Flare } from "./components/Flare";
|
|
import { RealFi } from "./components/RealFi";
|
|
import { Marketplace } from "./components/Marketplace";
|
|
import { Analytics } from "./components/Analytics";
|
|
import { Explorer } from "./components/Explorer";
|
|
import { Developer } from "./components/Developer";
|
|
import { Ops } from "./components/Ops";
|
|
import { Compliance } from "./components/Compliance";
|
|
import { Bureau } from "./components/Bureau";
|
|
import { Trust } from "./components/Trust";
|
|
import { Discovery } from "./components/Discovery";
|
|
import { Network } from "./components/Network";
|
|
import { OnChain } from "./components/OnChain";
|
|
import { X402Playground } from "./components/X402Playground";
|
|
import { Onboard } from "./components/Onboard";
|
|
import { Risk } from "./components/Risk";
|
|
import { NotificationBell } from "./components/NotificationBell";
|
|
import { WalletButton } from "./components/WalletButton";
|
|
import { EventFeed } from "./components/EventFeed";
|
|
import { Controls } from "./components/Controls";
|
|
import { AlgorandX402Console } from "./components/AlgorandX402Console";
|
|
import { Home } from "./components/Home";
|
|
|
|
const TABS = ["Home", "Analytics", "On-Chain", "Onboard", "Agents", "RWA Jobs", "Receipts", "Credit Pool", "Marketplace", "Discovery", "x402", "Algorand x402", "Network", "Risk", "Bureau", "Disputes", "Governance", "Multichain", "Flare", "RealFi", "Trust", "Compliance", "Explorer", "Developer", "Ops"] as const;
|
|
type Tab = (typeof TABS)[number];
|
|
|
|
export function App() {
|
|
const { snapshot, liveEvents, connected, refresh } = useLedger();
|
|
const manifest = useChainManifest();
|
|
const [tab, setTab] = useState<Tab>("Home");
|
|
|
|
const feedEvents = liveEvents.length ? liveEvents : (snapshot?.events ?? []).slice().reverse();
|
|
const contractIndex = useMemo(() => indexContracts(manifest), [manifest]);
|
|
const independentTab = tab === "Algorand x402" || tab === "Home";
|
|
const singleColumn = tab === "On-Chain" || independentTab;
|
|
|
|
return (
|
|
<div className="app">
|
|
<header className="topbar">
|
|
<div className="brand">
|
|
<img className="logo-mark" src="/cred402-mark.png" alt="Cred402" width={40} height={40} />
|
|
<div>
|
|
<h1>Cred402</h1>
|
|
<p className="tagline">Credit scores for autonomous RWA agents on Casper</p>
|
|
</div>
|
|
</div>
|
|
<div className={`status ${connected ? "online" : "offline"}`}>
|
|
<span className="dot" /> {connected ? "streaming events" : "reconnecting…"}
|
|
{manifest && (
|
|
<a className="chain-pill" href={manifest.explorer} target="_blank" rel="noreferrer" title={`${manifest.contract_count} contracts live — open cspr.live`}>
|
|
⛓ {manifest.chain} · {manifest.contract_count} contracts ↗
|
|
</a>
|
|
)}
|
|
{snapshot && <span className="policy">policy {snapshot.policyVersion}</span>}
|
|
<NotificationBell />
|
|
<WalletButton />
|
|
</div>
|
|
</header>
|
|
|
|
<Controls snapshot={snapshot} onAction={refresh} />
|
|
|
|
<nav className="tabs">
|
|
{TABS.map((t) => (
|
|
<button key={t} className={t === tab ? "tab active" : "tab"} onClick={() => setTab(t)}>
|
|
{t}
|
|
</button>
|
|
))}
|
|
</nav>
|
|
|
|
<main className={singleColumn ? "layout single" : "layout"}>
|
|
<section className="content">
|
|
{!snapshot && !independentTab && <div className="empty">Loading on-chain state…</div>}
|
|
{tab === "Home" && <Home onEnterConsole={() => setTab("Analytics")} />}
|
|
{tab === "Algorand x402" && (
|
|
<AlgorandX402Console agentIds={snapshot?.agents.map((agent) => agent.agent_id) ?? []} />
|
|
)}
|
|
{snapshot && tab === "Analytics" && <Analytics />}
|
|
{snapshot && tab === "On-Chain" && <OnChain manifest={manifest} events={feedEvents} connected={connected} />}
|
|
{snapshot && tab === "Explorer" && <Explorer />}
|
|
{snapshot && tab === "Developer" && <Developer />}
|
|
{snapshot && tab === "Ops" && <Ops />}
|
|
{snapshot && tab === "x402" && (
|
|
<X402Playground agentIds={snapshot.agents.map((agent) => agent.agent_id)} />
|
|
)}
|
|
{snapshot && tab === "Onboard" && <Onboard />}
|
|
{snapshot && tab === "Risk" && <Risk />}
|
|
{snapshot && tab === "Bureau" && <Bureau />}
|
|
{snapshot && tab === "Agents" && <Agents snapshot={snapshot} />}
|
|
{snapshot && tab === "RWA Jobs" && <Jobs snapshot={snapshot} />}
|
|
{snapshot && tab === "Receipts" && <Receipts snapshot={snapshot} />}
|
|
{snapshot && tab === "Credit Pool" && <CreditPool snapshot={snapshot} />}
|
|
{snapshot && tab === "Marketplace" && <Marketplace />}
|
|
{snapshot && tab === "Disputes" && <Disputes snapshot={snapshot} onChange={refresh} />}
|
|
{snapshot && tab === "Governance" && <Governance snapshot={snapshot} onChange={refresh} />}
|
|
{snapshot && tab === "Multichain" && <Multichain snapshot={snapshot} onChange={refresh} />}
|
|
{snapshot && tab === "Flare" && <Flare />}
|
|
{snapshot && tab === "RealFi" && <RealFi snapshot={snapshot} onChange={refresh} />}
|
|
{snapshot && tab === "Discovery" && <Discovery />}
|
|
{snapshot && tab === "Network" && <Network />}
|
|
{snapshot && tab === "Trust" && <Trust />}
|
|
{snapshot && tab === "Compliance" && <Compliance />}
|
|
</section>
|
|
{!singleColumn && (
|
|
<aside className="sidebar">
|
|
<EventFeed events={feedEvents} connected={connected} contractIndex={contractIndex} />
|
|
</aside>
|
|
)}
|
|
</main>
|
|
|
|
<footer className="footer">
|
|
{manifest ? (
|
|
<>
|
|
<span className="footer-label">{manifest.contract_count} contracts live on {manifest.chain} ↗</span>
|
|
{manifest.contracts.map((c) => (
|
|
<a key={c.contract_hash} className="contract" href={c.explorer_url} target="_blank" rel="noreferrer" title={`${c.name} · ${c.contract_hash}`}>
|
|
{c.name} ↗
|
|
</a>
|
|
))}
|
|
</>
|
|
) : (
|
|
snapshot &&
|
|
Object.keys(snapshot.contractHashes).map((name) => (
|
|
<span key={name} className="contract" title={name}>
|
|
{name}
|
|
</span>
|
|
))
|
|
)}
|
|
</footer>
|
|
</div>
|
|
);
|
|
}
|