Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

docs(trading-surfaces): link Meta-Allocator and Clip Director; robinhood updates (owner-approved)

nirholasd2db0355a980
diff --git a/docs/trading-surfaces.md b/docs/trading-surfaces.md
index 99d93f6c8..2947dca8c 100644
--- a/docs/trading-surfaces.md
+++ b/docs/trading-surfaces.md
@@ -131,6 +131,8 @@ Agents wanting the same intel over MCP: see [docs/mcp.md](mcp.md) (`@three-ws/in
## Related
+- [Meta-Allocator: the ETF of degens](meta-allocator.md): diversify a budget across the top verified leaders
+- [Clip Director: every trade becomes content](clip-director.md): turn any closed trade into shareable cards per surface
- [The Trading Copilot — talk to your wallet](trading-copilot.md) — conversational trading over these same numbers
- [Oracle — the conviction engine](oracle.md) · [/oracle/docs](https://three.ws/oracle/docs)
- [The autonomous trading experiment](trading-experiment.md)
diff --git a/docs/x402-endpoints.md b/docs/x402-endpoints.md
index eb99cd52a..bb182ac85 100644
--- a/docs/x402-endpoints.md
+++ b/docs/x402-endpoints.md
@@ -124,6 +124,7 @@ upstream is down — a buyer is never charged for missing data.
| `/api/x402/gas-oracle` | $0.001 | Live fee tiers for Ethereum + Base (real `eth_feeHistory`) and Solana priority-fee percentiles. |
| `/api/x402/market-mood` | $0.002 | Fear & Greed × 192-feed news sentiment composite (0–100) with divergence flag + driver headlines. |
| `/api/x402/news-pulse` | $0.002 | Per-ticker news coverage: mentions, velocity vs prior window, sentiment split, top headlines. |
+| `/api/x402/robinhood-portfolio` | $0.002 | Multiplier-correct Stock Token portfolio for a Robinhood Chain wallet: each symbol's true position (balance x ERC-8056 uiMultiplier) at on-chain Chainlink NAV, plus total USD value. |
There is also a registry-derived `market-*` family — one endpoint per raw data
category, projected from `api/_lib/market-data/registry.js`. Each is $0.001
diff --git a/robinhood/hood-alerts/Dockerfile b/robinhood/hood-alerts/Dockerfile
new file mode 100644
index 000000000..a61ed46de
--- /dev/null
+++ b/robinhood/hood-alerts/Dockerfile
@@ -0,0 +1,65 @@
+# syntax=docker/dockerfile:1
+#
+# hood-alerts: one long-running process runs the detection engine, the HTTP
+# server (/healthz + premium x402), and both bots (env-gated). Min-instances 1
+# on Cloud Run; this is a service, not a job.
+#
+# The build context MUST be the parent `robinhood/` directory so the local
+# file: siblings (robinhood-chain-sdk, hoodkit, hood402) resolve:
+#
+# docker build -f hood-alerts/Dockerfile -t hood-alerts . # run from robinhood/
+#
+# Once those packages are published to npm, switch the file: specs in
+# package.json to the published versions and the app builds from its own dir.
+
+# ---- build: full install (better-sqlite3 needs a toolchain) + tsc ----
+FROM node:22-slim AS build
+RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
+ && rm -rf /var/lib/apt/lists/*
+WORKDIR /build
+# Prebuilt sibling packages (manifest + dist) for the file: links.
+COPY robinhood-chain-sdk/package.json ./robinhood-chain-sdk/package.json
+COPY robinhood-chain-sdk/dist ./robinhood-chain-sdk/dist
+COPY hoodkit/package.json ./hoodkit/package.json
+COPY hoodkit/dist ./hoodkit/dist
+COPY hood402/package.json ./hood402/package.json
+COPY hood402/dist ./hood402/dist
+WORKDIR /build/hood-alerts
+COPY hood-alerts/package.json ./package.json
+# --install-links copies the file: siblings into node_modules as real packages
+# (not symlinks), so their `viem` dependency hoists and resolves at runtime.
+RUN npm install --install-links --no-audit --no-fund
+COPY hood-alerts/tsconfig.json ./tsconfig.json
+COPY hood-alerts/src ./src
+COPY hood-alerts/scripts ./scripts
+RUN npm run build
+
+# ---- prod-deps: runtime node_modules only (no tsc/tsx/vitest) ----
+FROM node:22-slim AS prod-deps
+RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
+ && rm -rf /var/lib/apt/lists/*
+WORKDIR /build
+COPY robinhood-chain-sdk/package.json ./robinhood-chain-sdk/package.json
+COPY robinhood-chain-sdk/dist ./robinhood-chain-sdk/dist
+COPY hoodkit/package.json ./hoodkit/package.json
+COPY hoodkit/dist ./hoodkit/dist
+COPY hood402/package.json ./hood402/package.json
+COPY hood402/dist ./hood402/dist
+WORKDIR /build/hood-alerts
+COPY hood-alerts/package.json ./package.json
+RUN npm install --omit=dev --install-links --no-audit --no-fund
+
+# ---- runtime ----
+FROM node:22-slim AS runtime
+ENV NODE_ENV=production
+ENV PORT=8080
+ENV HOOD_ALERTS_DB=/data/hood-alerts.db
+WORKDIR /app
+COPY --from=prod-deps /build/hood-alerts/node_modules ./node_modules
+COPY --from=build /build/hood-alerts/dist ./dist
+COPY --from=build /build/hood-alerts/package.json ./package.json
+# SQLite lives on a mounted volume so subscriptions survive restarts.
+RUN mkdir -p /data
+VOLUME ["/data"]
+EXPOSE 8080
+CMD ["node", "dist/src/index.js"]
diff --git a/robinhood/hood-alerts/LICENSE b/robinhood/hood-alerts/LICENSE
index dff21b7f4..4216cf919 100644
--- a/robinhood/hood-alerts/LICENSE
+++ b/robinhood/hood-alerts/LICENSE
@@ -1,20 +1,21 @@
-Copyright 2026 nirholas
+MIT License
-All rights reserved.
+Copyright (c) 2026 nirholas
-This software is proprietary and may not be used, copied, modified, distributed,
-translated, or made available to any third party without the express written
-permission of the copyright owner.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
-No rights are granted by implication, estoppel, or otherwise. Use of this
-software is subject to the terms of a separate license agreement with the
-copyright owner.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
-
-IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY CLAIM, DAMAGES, OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
-ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/robinhood/hood-alerts/README.md b/robinhood/hood-alerts/README.md
index c6b279583..4507a3718 100644
--- a/robinhood/hood-alerts/README.md
+++ b/robinhood/hood-alerts/README.md
@@ -1,6 +1,6 @@
# hood-alerts
-[![license](https://img.shields.io/badge/license-proprietary-93a1af?labelColor=101418)](./LICENSE)
+[![license](https://img.shields.io/badge/license-MIT-93a1af?labelColor=101418)](./LICENSE)
The alert layer for **Robinhood Chain** (chain ID 4663): Telegram and Discord bots backed by one
shared detection engine that watches launches, graduations, whale trades, Stock Token price moves,
@@ -168,19 +168,57 @@ npm test # vitest: dedup/rate-limit gate, digest batching, topic pars
npm run build # tsc -> dist/
```
+The `whale-classify` and `detectors` suites run against **real captured mainnet event streams** in
+`tests/fixtures/` (real Uniswap v3 swaps, Odyssey bonding-curve trades, and Chainlink prices).
+Refresh them any time with `npm run capture-fixtures`, which re-reads live chain 4663.
+
`npm run test:live` and `npm run probe` exercise the live detector set against real Robinhood Chain
RPC and, for `probe`, the console transport; they need real network access and are not part of the
-offline unit suite above.
+offline unit suite above. `npm run grant-premium` comps or inspects a premium entitlement directly
+in the database (handy for testing premium delivery before a payment rail is wired).
### Local sibling packages
`hood402`, `hoodkit`, and `hoodchain` are consumed as `file:` dependencies of the other Robinhood
Chain repos in this workspace (`../hood402`, `../hoodkit`, `../robinhood-chain-sdk`) rather than
their published npm versions, so a change to any of them is picked up on the next `npm install`
-here. Keep `viem` pinned to the exact version those sibling packages resolve (currently `2.55.1`):
-a newer patch on only one side of a `file:` link makes viem's structural types for `Chain` and
-`WalletClient` diverge across the two copies and breaks the type check in `src/premium/paywall.ts`
-and `src/index.ts`.
+here. A `file:` link keeps each sibling's own `viem` copy, so a patch-level skew (e.g. `2.55.2`
+here vs `2.55.1` in `hood402`) makes viem's structural `Chain` / `WalletClient` types diverge across
+the two copies. `src/premium/paywall.ts` bridges that boundary explicitly (casting the local viem
+clients to `hood402`'s `HoodBroadcaster` / `HoodConfirmer`), so the build stays green across a patch
+skew; the runtime objects are the same correct viem clients. Once the siblings are on npm and a
+single `viem` resolves, the cast is a no-op.
+
+## Deploy
+
+hood-alerts is one long-running process (engine + HTTP server + both bots), so run it as a service
+with a warm instance, not a job.
+
+Because the sibling packages are `file:` links, the Docker build context is the **parent
+`robinhood/` directory** so they resolve:
+
+```sh
+# from robinhood/ (the parent of hood-alerts/)
+docker build -f hood-alerts/Dockerfile -t hood-alerts .
+
+gcloud run deploy hood-alerts \
+ --image=REGION-docker.pkg.dev/PROJECT/repo/hood-alerts:latest \
+ --min-instances=1 --no-cpu-throttling --port=8080 \
+ --set-env-vars=HOOD_ALERTS_TELEGRAM_TOKEN=…,HOOD_ALERTS_DISCORD_TOKEN=…,HOOD_ALERTS_DISCORD_APP_ID=…
+```
+
+Mount a volume at `/data` (the default `HOOD_ALERTS_DB` path) so subscriptions, entitlements, and
+the delivery log survive restarts. The container answers `GET /healthz`; `SIGTERM` flushes pending
+digests before exit. Once the siblings are published to npm, switch the `file:` specs in
+`package.json` and the image builds from the `hood-alerts/` directory alone. Full self-host and
+premium-wiring guide: the `docs/` site.
+
+## Docs site (GitHub Pages)
+
+`docs/` is a static, hand-built site (no framework, no build step): open `docs/index.html` locally,
+or serve it from GitHub Pages. Its landing page renders a **live** premium/discount feed client-side
+straight from the public RPC (real Chainlink feeds vs real DEX pools, no server). One-time setup:
+Settings -> Pages -> Deploy from a branch -> `main` -> `/docs`.
## Architecture notes
@@ -213,7 +251,11 @@ src/premium/paywall.ts the hood402 x402 purchase flow
src/transports/ Telegram (grammY), Discord (discord.js), and console transports
src/commands/commands.ts the shared, platform-neutral command router
src/format/cards.ts alert -> platform-neutral card -> per-platform rendering
-tests/ vitest unit suite (see Development above)
+tests/ vitest unit suite + tests/fixtures (real captured chain events) +
+ tests/live (opt-in on-chain reads)
+scripts/ capture-fixtures, live-probe, grant-premium (see Development above)
+docs/ static GitHub Pages site with a live client-side premium feed
+Dockerfile one-container build (engine + both bots), build from robinhood/
```
## Notes
@@ -228,6 +270,6 @@ tests/ vitest unit suite (see Development above)
## License
-Proprietary, all rights reserved. See [LICENSE](./LICENSE).
+MIT. See [LICENSE](./LICENSE).
Built by [nirholas](https://x.com/nichxbt) · [three.ws](https://three.ws)
diff --git a/robinhood/hood-alerts/docs/app.js b/robinhood/hood-alerts/docs/app.js
new file mode 100644
index 000000000..36d09d896
--- /dev/null
+++ b/robinhood/hood-alerts/docs/app.js
@@ -0,0 +1,141 @@
+// Live Robinhood Chain (4663) premium/discount feed, rendered client-side from
+// the public RPC. Read-only: this is exactly the arb signal hood-alerts fires
+// as its premium detector, computed live in your browser. No wallet, no keys.
+(() => {
+ const SEL_LATEST_ROUND = '0xfeaf968c' // latestRoundData()
+ const SEL_SLOT0 = '0x3850c7bd' // slot0()
+ const Q192 = 2n ** 192n
+
+ const els = {
+ block: document.getElementById('live-block'),
+ updated: document.getElementById('live-updated'),
+ count: document.getElementById('live-count'),
+ cards: document.getElementById('live-cards'),
+ error: document.getElementById('live-error'),
+ }
+ if (!els.cards) return
+
+ let cfg = null
+
+ const word = (hex, i) => BigInt('0x' + hex.slice(2 + i * 64, 2 + (i + 1) * 64))
+
+ async function rpc(method, params) {
+ const res = await fetch(cfg.rpc, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }),
+ })
+ if (!res.ok) throw new Error('rpc ' + res.status)
+ const body = await res.json()
+ if (body.error) throw new Error(body.error.message || 'rpc error')
+ return body.result
+ }
+
+ const call = (to, data) => rpc('eth_call', [{ to, data }, 'latest'])
+
+ function sqrtToPrice0in1(sqrtP, dec0, dec1) {
+ // token1 per token0, decimal-adjusted, as a JS number.
+ const num = sqrtP * sqrtP * 10n ** BigInt(dec0) * 10n ** 18n
+ const den = Q192 * 10n ** BigInt(dec1)
+ return Number(num / den) / 1e18
+ }
+
+ async function ethUsd() {
+ try {
+ const r = await fetch('https://robinhoodchain.blockscout.com/api/v2/stats', { headers: { accept: 'application/json' } })
+ if (!r.ok) return null
+ const b = await r.json()
+ const p = b.coin_price ? Number(b.coin_price) : NaN
+ return Number.isFinite(p) && p > 0 ? p : null
+ } catch {
+ return null
+ }
+ }
+
+ function fmtUsd(n) {
+ if (n >= 1000) return '$' + n.toLocaleString('en-US', { maximumFractionDigits: 2 })
+ return '$' + n.toFixed(2)
+ }
+
+ async function loadMarket(m, eth) {
+ const [feedRes, slotRes] = await Promise.all([call(m.feed, SEL_LATEST_ROUND), call(m.pool, SEL_SLOT0)])
+ const answer = word(feedRes, 1)
+ const feedUsd = Number(answer) / 10 ** m.feedDecimals
+ const sqrtP = word(slotRes, 0)
+ const price0in1 = sqrtToPrice0in1(sqrtP, m.decimals0, m.decimals1)
+ if (!(price0in1 > 0)) return null
+ const stockInQuote = m.stockIs0 ? price0in1 : 1 / price0in1
+ let dexUsd
+ if (m.quote === 'USDG') dexUsd = stockInQuote
+ else if (eth) dexUsd = stockInQuote * eth
+ else return null
+ const premiumPct = ((dexUsd - feedUsd) / feedUsd) * 100
+ return { ...m, feedUsd, dexUsd, premiumPct }
+ }
+
+ function renderCard(r) {
+ const abs = Math.abs(r.premiumPct)
+ const cls = abs < 0.25 ? 'flat' : r.premiumPct >= 0 ? 'prem' : 'disc'
+ const label = abs < 0.25 ? 'in line' : (r.premiumPct >= 0 ? '+' : '') + r.premiumPct.toFixed(2) + '%'
+ const word = r.premiumPct >= 0 ? 'premium' : 'discount'
+ const el = document.createElement('div')
+ el.className = 'card'
+ el.innerHTML =
+ '<div class="row"><span class="sym">' + r.symbol + '</span>' +
+ '<span class="badge ' + cls + '">' + label + '</span></div>' +
+ '<div class="prices">' +
+ '<span>DEX mid <b>' + fmtUsd(r.dexUsd) + '</b> · ' + r.quote + ' pool</span>' +
+ '<span>Chainlink <b>' + fmtUsd(r.feedUsd) + '</b></span>' +
+ (abs >= 0.25 ? '<span>trading at a ' + abs.toFixed(2) + '% ' + word + ' on-chain</span>' : '') +
+ '</div>' +
+ '<div class="links">' +
+ '<a href="https://three.ws/markets/robinhood/stock/' + r.symbol + '" target="_blank" rel="noopener">Chart</a>' +
+ '<a href="https://robinhoodchain.blockscout.com/address/' + r.pool + '" target="_blank" rel="noopener">Pool</a>' +
+ '</div>'
+ return el
+ }
+
+ async function refresh() {
+ try {
+ const [blockHex, eth] = await Promise.all([rpc('eth_blockNumber', []), ethUsd()])
+ if (els.block) els.block.textContent = '#' + parseInt(blockHex, 16).toLocaleString('en-US')
+ const results = []
+ for (const m of cfg.markets) {
+ try {
+ const r = await loadMarket(m, eth)
+ if (r) results.push(r)
+ } catch {
+ // one bad pool should not sink the feed
+ }
+ }
+ results.sort((a, b) => Math.abs(b.premiumPct) - Math.abs(a.premiumPct))
+ els.cards.innerHTML = ''
+ for (const r of results) els.cards.appendChild(renderCard(r))
+ if (els.count) els.count.textContent = results.length
+ if (els.updated) els.updated.textContent = new Date().toLocaleTimeString()
+ if (els.error) els.error.style.display = 'none'
+ } catch (e) {
+ if (els.error) {
+ els.error.style.display = 'block'
+ els.error.textContent = 'Live feed unavailable right now (' + (e.message || 'network') + '). The public RPC may be rate-limiting; it retries automatically.'
+ }
+ }
+ }
+
+ async function boot() {
+ try {
+ const res = await fetch('./live-markets.json')
+ cfg = await res.json()
+ } catch {
+ if (els.error) {
+ els.error.style.display = 'block'
+ els.error.textContent = 'Could not load market list.'
+ }
+ return
+ }
+ await refresh()
+ setInterval(refresh, 20000)
+ }
+
+ boot()
+})()
diff --git a/robinhood/hood-alerts/docs/commands.html b/robinhood/hood-alerts/docs/commands.html
new file mode 100644
index 000000000..0c134aac1
--- /dev/null
+++ b/robinhood/hood-alerts/docs/commands.html
@@ -0,0 +1,78 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Commands · hood-alerts</title>
+ <meta name="description" content="Full command reference for the hood-alerts Telegram and Discord bots on Robinhood Chain." />
+ <link rel="stylesheet" href="styles.css" />
+</head>
+<body>
+ <nav class="nav">
+ <div class="wrap">
+ <span class="brand"><span class="dot"></span> hood-alerts</span>
+ <a class="link" href="index.html">Live feed</a>
+ <a class="link" href="commands.html">Commands</a>
+ <a class="link" href="premium.html">Premium</a>
+ <a class="link hide-sm" href="self-host.html">Self-host</a>
+ <span class="spacer"></span>
+ <a class="gh" href="https://github.com/nirholas/hood-alerts" target="_blank" rel="noopener">GitHub</a>
+ </div>
+ </nav>
+
+ <main class="wrap doc">
+ <h2>Command reference</h2>
+ <p class="lead">The same commands work on Telegram (as <code>/watch …</code>) and Discord (as slash commands). In a group or server, config commands are limited to admins; anyone can run <code>list</code>, <code>premium</code>, and <code>help</code>.</p>
+
+ <h3>Watch targets</h3>
+ <table>
+ <thead><tr><th>Target</th><th>What you get</th><th>Tier</th></tr></thead>
+ <tbody>
+ <tr><td><code>launches</code></td><td>Every new token on NOXA and The Odyssey. Add <code>noxa</code> or <code>odyssey</code> to filter.</td><td>Free</td></tr>
+ <tr><td><code>graduations</code></td><td>Odyssey bonding curves that fill and migrate to a locked Uniswap v3 pool.</td><td>Free</td></tr>
+ <tr><td><code>whales [usd]</code></td><td>Trades at or above a USD threshold, chain-wide. Default $5,000.</td><td>Free</td></tr>
+ <tr><td><code>&lt;TICKER&gt;</code></td><td>A Stock Token (e.g. <code>TSLA</code>): Chainlink price moves and on-chain premium/discount crossings.</td><td>Free</td></tr>
+ <tr><td><code>&lt;0x address&gt;</code></td><td>A specific memecoin: its whale trades, graduation, holder milestones, and liquidity pulls.</td><td>Free</td></tr>
+ <tr><td><code>premiums [pct]</code></td><td>The Stock Token arbitrage signal: any token trading past a premium/discount threshold vs its oracle. Default 2%.</td><td>Premium</td></tr>
+ <tr><td><code>rugs [pct]</code></td><td>Liquidity-pull rug early-warning: quote reserves dropping past a threshold. Default 30%.</td><td>Premium</td></tr>
+ </tbody>
+ </table>
+
+ <h3>Managing your watches</h3>
+ <table>
+ <thead><tr><th>Command</th><th>Does</th></tr></thead>
+ <tbody>
+ <tr><td><code>watch &lt;target&gt; [n]</code></td><td>Start watching. Optional threshold: USD for whales/tokens, percent for premiums/rugs/stocks.</td></tr>
+ <tr><td><code>unwatch &lt;target&gt;</code></td><td>Stop watching one target. <code>unwatch all</code> clears everything.</td></tr>
+ <tr><td><code>list</code></td><td>Your subscriptions, thresholds, tier, digest, and quiet-hour settings.</td></tr>
+ <tr><td><code>threshold &lt;target&gt; &lt;n&gt;</code></td><td>Change a subscription's threshold, e.g. <code>threshold whales 25000</code>.</td></tr>
+ <tr><td><code>digest on [min]</code> / <code>digest off</code></td><td>Batch alerts into a periodic digest (default every 60 minutes) instead of delivering each one.</td></tr>
+ <tr><td><code>quiet &lt;from&gt; &lt;to&gt;</code></td><td>Quiet hours in UTC, e.g. <code>quiet 22 7</code>. Alerts batch and deliver after. <code>quiet off</code> to disable.</td></tr>
+ <tr><td><code>premium</code></td><td>Your premium status and how to upgrade.</td></tr>
+ <tr><td><code>help</code></td><td>The full reference, in-chat.</td></tr>
+ </tbody>
+ </table>
+
+ <h3>Examples</h3>
+ <pre><code>watch launches noxa # only NOXA launches
+watch whales 10000 # chain-wide trades ≥ $10k
+watch TSLA # TSLA moves + on-chain premium
+watch 0x… # one memecoin, fully
+watch premiums 3 # Stock Tokens ≥ 3% off oracle (premium)
+digest on 120 # one digest every 2 hours
+quiet 23 8 # mute 23:00-08:00 UTC</code></pre>
+
+ <div class="callout">Every command answers, always. Unknown commands return help, empty states tell you what to try next ("you watch nothing yet, try <code>watch launches</code>"), and you never see raw JSON.</div>
+
+ <h3>Free vs premium at a glance</h3>
+ <p>Free: up to 3 subscriptions, alerts batched to a 60-second minimum. Premium: unlimited subscriptions, real-time delivery, and the <code>premiums</code> and <code>rugs</code> detectors. See <a href="premium.html">pricing</a>.</p>
+ </main>
+
+ <footer>
+ <div class="wrap">
+ <div><span class="brand"><span class="dot"></span> hood-alerts</span></div>
+ <div>Built by <a href="https://x.com/nichxbt">nirholas</a> · <a href="https://three.ws">three.ws</a></div>
+ </div>
+ </footer>
+</body>
+</html>
diff --git a/robinhood/hood-alerts/docs/index.html b/robinhood/hood-alerts/docs/index.html
new file mode 100644
index 000000000..df02acee3
--- /dev/null
+++ b/robinhood/hood-alerts/docs/index.html
@@ -0,0 +1,121 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>hood-alerts · Robinhood Chain alert bots</title>
+ <meta name="description" content="Real-time Telegram and Discord alerts for Robinhood Chain (4663): memecoin launches, graduations, whale trades, Stock Token price moves, on-chain premium/discount arbitrage, holder milestones, and liquidity-pull rug warnings." />
+ <link rel="preconnect" href="https://rpc.mainnet.chain.robinhood.com" />
+ <link rel="stylesheet" href="styles.css" />
+</head>
+<body>
+ <nav class="nav">
+ <div class="wrap">
+ <span class="brand"><span class="dot"></span> hood-alerts</span>
+ <a class="link" href="index.html">Live feed</a>
+ <a class="link hide-sm" href="commands.html">Commands</a>
+ <a class="link" href="premium.html">Premium</a>
+ <a class="link hide-sm" href="self-host.html">Self-host</a>
+ <span class="spacer"></span>
+ <a class="gh" href="https://github.com/nirholas/hood-alerts" target="_blank" rel="noopener">GitHub</a>
+ </div>
+ </nav>
+
+ <header class="hero">
+ <div class="wrap">
+ <span class="chip"><span class="live"></span> Live · Robinhood Chain · ID 4663</span>
+ <h1>Alerts for the chain that<br /><span class="grad">never sleeps.</span></h1>
+ <p class="sub">Telegram and Discord bots that watch Robinhood Chain in real time: launches, graduations, whale trades, Stock Token moves, on-chain premium/discount arbitrage, holder milestones, and liquidity-pull rug warnings.</p>
+ <div class="cta">
+ <a class="btn primary" href="commands.html">See the commands</a>
+ <a class="btn ghost" href="#live">Watch it live ↓</a>
+ </div>
+ </div>
+ </header>
+
+ <section id="live">
+ <div class="wrap">
+ <div class="section-head">
+ <div class="kicker">Live premium detector</div>
+ <h2>What would be alerting right now</h2>
+ <p>The Stock Token arbitrage signal, computed in your browser from the public RPC. When a token's DEX mid drifts from its Chainlink oracle, premium subscribers get a card like this.</p>
+ </div>
+ <div class="feed-meta">
+ <span>Chain head <b id="live-block">…</b></span>
+ <span><b id="live-count">…</b> markets tracked</span>
+ <span>Updated <b id="live-updated">…</b></span>
+ </div>
+ <div id="live-error" class="feed-error" style="display:none"></div>
+ <div id="live-cards" class="cards">
+ <div class="skeleton"></div><div class="skeleton"></div><div class="skeleton"></div>
+ </div>
+ <p class="feed-note">Read-only, live from <code>rpc.mainnet.chain.robinhood.com</code>. Prices are already Chainlink multiplier-adjusted. This is display data, not investment advice.</p>
+ </div>
+ </section>
+
+ <section>
+ <div class="wrap">
+ <div class="section-head">
+ <div class="kicker">Real alerts, real chain</div>
+ <h2>Seven detectors, one stream</h2>
+ <p>Captured from live mainnet during the build. Each renders as an inline card in Telegram and a rich embed in Discord.</p>
+ </div>
+ <div class="cards">
+ <div class="card">
+ <div class="row"><span class="sym">New launch: on NOXA</span><span class="badge flat">launch</span></div>
+ <div class="prices"><span>Instant Uniswap v3 pool, no bonding curve</span><span>Creator, first pool, and block, the moment it lists</span></div>
+ </div>
+ <div class="card">
+ <div class="row"><span class="sym">Whale buy</span><span class="badge prem">≥ threshold</span></div>
+ <div class="prices"><span>Configurable USD floor, per-token or chain-wide</span><span>Odyssey bonding curve and Uniswap v3, valued in USD</span></div>
+ </div>
+ <div class="card">
+ <div class="row"><span class="sym">RKLB premium</span><span class="badge prem">+12.15%</span></div>
+ <div class="prices"><span>DEX mid <b>$75.32</b> vs Chainlink <b>$67.16</b></span><span>On-chain buyers paying above the oracle</span></div>
+ </div>
+ <div class="card">
+ <div class="row"><span class="sym">MSTR discount</span><span class="badge disc">-8.65%</span></div>
+ <div class="prices"><span>DEX mid <b>$85.81</b> vs Chainlink <b>$93.94</b></span><span>Trading below oracle on-chain</span></div>
+ </div>
+ <div class="card">
+ <div class="row"><span class="sym">Liquidity pull</span><span class="badge disc">rug warning</span></div>
+ <div class="prices"><span>Quote reserves dropped past your threshold</span><span>An early warning, minutes before the chart</span></div>
+ </div>
+ <div class="card">
+ <div class="row"><span class="sym">Holder milestone</span><span class="badge flat">1,000</span></div>
+ <div class="prices"><span>Crossed a holder-count milestone</span><span>Growth signal from Blockscout counters</span></div>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <section>
+ <div class="wrap">
+ <div class="section-head">
+ <div class="kicker">How it works</div>
+ <h2>One engine. Both platforms. Your rules.</h2>
+ </div>
+ <div class="grid">
+ <div class="feat"><span class="tag">detect</span><h3>Every event, deduped</h3><p>A single stream consumer fans out to every subscriber with per-event dedup, so you hear about a launch once, not once per pool.</p></div>
+ <div class="feat"><span class="tag">route</span><h3>Thresholds you set</h3><p>Whale floors in USD, price moves in percent, premium and rug thresholds per subscription. Watch a ticker, a token address, or the whole chain.</p></div>
+ <div class="feat"><span class="tag">respect</span><h3>Quiet hours and digests</h3><p>Batch alerts into a digest, mute overnight in your timezone, and stay under a hard per-minute cap so you are never flooded.</p></div>
+ <div class="feat"><span class="tag">group</span><h3>Group-chat ready</h3><p>Add the bot to a Telegram group or Discord server; config commands are admin-only, alerts land for everyone.</p></div>
+ <div class="feat"><span class="tag">premium</span><h3>Arb and rug detectors</h3><p>The Stock Token premium/discount signal and the liquidity-pull rug warning are the premium tier. Free tier covers launches, whales, and moves.</p></div>
+ <div class="feat"><span class="tag">host</span><h3>One container</h3><p>Engine plus both bots plus a health endpoint in a single process. Deploy to Cloud Run with min-instances 1 and go.</p></div>
+ </div>
+ </div>
+ </section>
+
+ <footer>
+ <div class="wrap">
+ <div>
+ <span class="brand"><span class="dot"></span> hood-alerts</span>
+ <p class="legal">Stock Tokens are tokenized debt securities (issuer: Robinhood Assets (Jersey) Ltd) and may not be offered, sold, or delivered to US persons (with further limits in Canada, the UK, and Switzerland). hood-alerts displays public on-chain data only and does not offer, solicit, or facilitate any purchase of Stock Tokens. Not investment advice.</p>
+ </div>
+ <div>Built by <a href="https://x.com/nichxbt">nirholas</a> · <a href="https://three.ws">three.ws</a></div>
+ </div>
+ </footer>
+
+ <script src="app.js"></script>
+</body>
+</html>
diff --git a/robinhood/hood-alerts/docs/live-markets.json b/robinhood/hood-alerts/docs/live-markets.json
new file mode 100644
index 000000000..1753486d7
--- /dev/null
+++ b/robinhood/hood-alerts/docs/live-markets.json
@@ -0,0 +1,94 @@
+{
+ "generatedAt": "2026-07-16T17:22:02.175Z",
+ "chainId": 4663,
+ "rpc": "https://rpc.mainnet.chain.robinhood.com",
+ "multicall3": "0xca11bde05977b3631167028862be2a173976ca11",
+ "weth": "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73",
+ "usdg": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
+ "markets": [
+ {
+ "symbol": "ASML",
+ "name": "ASML Holding NV • Robinhood Token",
+ "token": "0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",
+ "feed": "0xB4106147E8cce40b7d46124090d373A71b70f87D",
+ "feedDecimals": 8,
+ "pool": "0xedb22516B14Eb2d1C86927Db373B0E8bF70F5cD1",
+ "decimals0": 18,
+ "decimals1": 6,
+ "stockIs0": true,
+ "quote": "USDG"
+ },
+ {
+ "symbol": "GME",
+ "name": "GameStop • Robinhood Token",
+ "token": "0x1b0E319c6A659F002271B69dB8A7df2F911c153E",
+ "feed": "0x27C71df6A64fB476468EdF256CF72c038baB5B67",
+ "feedDecimals": 8,
+ "pool": "0xE9713f453aDB9245B19559790c96F470a18F2fDF",
+ "decimals0": 18,
+ "decimals1": 6,
+ "stockIs0": true,
+ "quote": "USDG"
+ },
+ {
+ "symbol": "MSTR",
+ "name": "Strategy Inc. • Robinhood Token",
+ "token": "0xec262a75e413fAfD0dF80480274532C79D42da09",
+ "feed": "0x396118bdFB181e6240E74D243F266B061c0edc3D",
+ "feedDecimals": 8,
+ "pool": "0x17578C0e0D15da44f31677263114F71aE76653EA",
+ "decimals0": 6,
+ "decimals1": 18,
+ "stockIs0": false,
+ "quote": "USDG"
+ },
+ {
+ "symbol": "NVDA",
+ "name": "NVIDIA • Robinhood Token",
+ "token": "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",
+ "feed": "0x379EC4f7C378F34a1B47E4F3cbeBCbAC3E8E9F15",
+ "feedDecimals": 8,
+ "pool": "0xB944cec30Bd4175855215D767ADC81F39e5f7E2B",
+ "decimals0": 6,
+ "decimals1": 18,
+ "stockIs0": false,
+ "quote": "USDG"
+ },
+ {
+ "symbol": "QQQ",
+ "name": "Invesco QQQ • Robinhood Token",
+ "token": "0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",
+ "feed": "0x80901d846d5D7B030F26B480776EE3b29374C2ae",
+ "feedDecimals": 8,
+ "pool": "0xEbD78dcfc8a6b3A696f1E191aD1ff321f9579f79",
+ "decimals0": 6,
+ "decimals1": 18,
+ "stockIs0": false,
+ "quote": "USDG"
+ },
+ {
+ "symbol": "RKLB",
+ "name": "Rocket Lab Corporation • Robinhood Token",
+ "token": "0x3b14C39E89D60D627b42a1A4CA45b5bb45Fc12e2",
+ "feed": "0x045477BF65Aef6f4F2386ad0164579e48381CC74",
+ "feedDecimals": 8,
+ "pool": "0xa9888De1B9D64A93eaeb495A39FE9B3d00654928",
+ "decimals0": 18,
+ "decimals1": 6,
+ "stockIs0": true,
+ "quote": "USDG"
+ },
+ {
+ "symbol": "TSM",
+ "name": "Taiwan Semiconductor Manufacturing • Robinhood Token",
+ "token": "0x58FfE4a942d3885bAa22D7520691F611EF09e7AA",
+ "feed": "0x874cF94aa8eC88Fd9560094dD065f2fB3E41Fc2F",
+ "feedDecimals": 8,
+ "pool": "0x07e8Ea83D4C1340774c8965125e26e12bf943bf1",
+ "decimals0": 18,
+ "decimals1": 6,
+ "stockIs0": true,
+ "quote": "USDG"
+ }
+ ]
+}
diff --git a/robinhood/hood-alerts/docs/premium.html b/robinhood/hood-alerts/docs/premium.html
new file mode 100644
index 000000000..0dd563638
--- /dev/null
+++ b/robinhood/hood-alerts/docs/premium.html
@@ -0,0 +1,82 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Premium · hood-alerts</title>
+ <meta name="description" content="hood-alerts premium: unlimited real-time alerts plus the Stock Token arbitrage and rug early-warning detectors, paid in USDG on Robinhood Chain via x402." />
+ <link rel="stylesheet" href="styles.css" />
+</head>
+<body>
+ <nav class="nav">
+ <div class="wrap">
+ <span class="brand"><span class="dot"></span> hood-alerts</span>
+ <a class="link" href="index.html">Live feed</a>
+ <a class="link hide-sm" href="commands.html">Commands</a>
+ <a class="link" href="premium.html">Premium</a>
+ <a class="link hide-sm" href="self-host.html">Self-host</a>
+ <span class="spacer"></span>
+ <a class="gh" href="https://github.com/nirholas/hood-alerts" target="_blank" rel="noopener">GitHub</a>
+ </div>
+ </nav>
+
+ <main class="wrap doc">
+ <h2>Premium</h2>
+ <p class="lead">The free tier is genuinely useful. Premium removes the limits and unlocks the two detectors most worth paying for: the Stock Token arbitrage signal and the liquidity-pull rug early-warning.</p>
+
+ <div class="tiers">
+ <div class="tier">
+ <h3>Free</h3>
+ <div class="price">$0</div>
+ <ul>
+ <li>Up to 3 subscriptions</li>
+ <li>Launches, graduations, whales</li>
+ <li>Stock Token price moves</li>
+ <li>Per-token holder milestones</li>
+ <li>Digest mode and quiet hours</li>
+ <li class="no">Premium / discount arb detector</li>
+ <li class="no">Rug early-warning detector</li>
+ <li class="no">Real-time (free is batched to 60s)</li>
+ </ul>
+ </div>
+ <div class="tier pro">
+ <h3>Premium</h3>
+ <div class="price">5 USDG <span>/ 30 days</span></div>
+ <ul>
+ <li>Unlimited subscriptions</li>
+ <li>Real-time delivery, no batching floor</li>
+ <li>Premium / discount arbitrage signal</li>
+ <li>Liquidity-pull rug early-warning</li>
+ <li>Everything in Free</li>
+ </ul>
+ </div>
+ </div>
+
+ <h3>How payment works</h3>
+ <p>Premium is sold over <strong>x402</strong> (the HTTP 402 payment standard) settling in <strong>USDG on Robinhood Chain</strong> through the <a href="https://github.com/nirholas/hood402" target="_blank" rel="noopener">hood402</a> rail. There is no card, no account, and no custody: your wallet signs a USDG transfer authorization and the entitlement flips the moment it settles on-chain.</p>
+ <ol>
+ <li>In the bot, run <code>premium</code> to get your activation link.</li>
+ <li>POST to it with any x402 client (<code>hood402</code>, <code>x402-fetch</code>). The first request returns a <code>402</code> with signed payment instructions.</li>
+ <li>Your client signs the USDG <code>transferWithAuthorization</code> and retries. Settlement is verified on-chain, then premium activates for your chat.</li>
+ </ol>
+ <pre><code># Example: activate with the hood402 client
+POST https://your-instance/premium/activate?platform=telegram&chat=&lt;chatId&gt;
+# -> 402 with x402 payment requirements (price, payTo, network: robinhood)
+# -> client signs USDG transferWithAuthorization, retries with X-PAYMENT
+# -> 200 { activated: true, tier: "premium", expiresAt, transaction }</code></pre>
+ <div class="callout">The entitlement never activates before the USDG transfer settles. A signature alone buys nothing, and extensions stack on your remaining time rather than resetting it.</div>
+
+ <h3>Alternative rail (self-hosters)</h3>
+ <p>The engine is rail-agnostic. The reference build settles USDG on Robinhood Chain end-to-end; an <strong>x402 USDC-on-Base</strong> facilitator is documented as a drop-in alternative. See the <a href="self-host.html">self-host guide</a> for wiring your own <code>payTo</code>, facilitator, or self-settlement key.</p>
+
+ <p class="legal">Payments buy alert-delivery entitlements only. hood402 moves USDG you already hold on Robinhood Chain; hood-alerts never takes custody and never trades on your behalf.</p>
+ </main>
+
+ <footer>
+ <div class="wrap">
+ <div><span class="brand"><span class="dot"></span> hood-alerts</span></div>
+ <div>Built by <a href="https://x.com/nichxbt">nirholas</a> · <a href="https://three.ws">three.ws</a></div>
+ </div>
+ </footer>
+</body>
+</html>
diff --git a/robinhood/hood-alerts/docs/self-host.html b/robinhood/hood-alerts/docs/self-host.html
new file mode 100644
index 000000000..8fb2d80aa
--- /dev/null
+++ b/robinhood/hood-alerts/docs/self-host.html
@@ -0,0 +1,92 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Self-host · hood-alerts</title>
+ <meta name="description" content="Run your own hood-alerts instance: one container with the engine and both bots, deploy to Google Cloud Run, wire premium payments." />
+ <link rel="stylesheet" href="styles.css" />
+</head>
+<body>
+ <nav class="nav">
+ <div class="wrap">
+ <span class="brand"><span class="dot"></span> hood-alerts</span>
+ <a class="link" href="index.html">Live feed</a>
+ <a class="link hide-sm" href="commands.html">Commands</a>
+ <a class="link" href="premium.html">Premium</a>
+ <a class="link" href="self-host.html">Self-host</a>
+ <span class="spacer"></span>
+ <a class="gh" href="https://github.com/nirholas/hood-alerts" target="_blank" rel="noopener">GitHub</a>
+ </div>
+ </nav>
+
+ <main class="wrap doc">
+ <h2>Self-host</h2>
+ <p class="lead">hood-alerts is one long-running process: the detection engine, an HTTP server (<code>/healthz</code> plus the premium endpoints), and both bots, each enabled by the presence of its token. It is a service, not a cron job.</p>
+
+ <h3>Run it locally</h3>
+ <pre><code>git clone https://github.com/nirholas/hood-alerts
+cd hood-alerts
+# Until the sibling packages are on npm, link them locally:
+npm i ../robinhood-chain-sdk ../hoodkit ../hood402
+npm install
+cp .env.example .env # fill in what you use (all optional)
+npm run build && npm start</code></pre>
+ <p>With zero configuration it runs the engine plus the console transport, printing every alert it detects to stdout. That is the smoke test:</p>
+ <pre><code>npm run probe # 90s live detection against mainnet 4663, no tokens
+npm run probe -- --token 0xTOKEN --seconds 300</code></pre>
+
+ <h3>Add the bots</h3>
+ <table>
+ <thead><tr><th>Env var</th><th>How to get it</th></tr></thead>
+ <tbody>
+ <tr><td><code>HOOD_ALERTS_TELEGRAM_TOKEN</code></td><td>Message <a href="https://t.me/BotFather" target="_blank" rel="noopener">@BotFather</a>, run <code>/newbot</code>, copy the token.</td></tr>
+ <tr><td><code>HOOD_ALERTS_DISCORD_TOKEN</code><br /><code>HOOD_ALERTS_DISCORD_APP_ID</code></td><td>Create an app at the <a href="https://discord.com/developers/applications" target="_blank" rel="noopener">Discord Developer Portal</a>; copy the Bot token and Application ID. Invite it with <code>applications.commands</code> + <code>bot</code> scopes.</td></tr>
+ </tbody>
+ </table>
+ <p>Each transport is optional: set only the tokens you want. The others stay disabled and log a warning.</p>
+
+ <h3>Premium payments</h3>
+ <p>Premium purchase endpoints stay off (returning a helpful <code>503</code>) until you set a receiving address and one settlement mode:</p>
+ <table>
+ <thead><tr><th>Env var</th><th>Purpose</th></tr></thead>
+ <tbody>
+ <tr><td><code>HOOD402_PAY_TO</code></td><td>Address that receives premium USDG. Required to sell premium.</td></tr>
+ <tr><td><code>HOOD402_FACILITATOR_URL</code></td><td>Settlement mode A: delegate verify + settle to a hood402 facilitator. No gas key on this box.</td></tr>
+ <tr><td><code>HOOD402_SETTLER_KEY</code></td><td>Settlement mode B: self-settle by broadcasting <code>transferWithAuthorization</code> yourself. A funded gas key.</td></tr>
+ <tr><td><code>HOOD_ALERTS_PREMIUM_PRICE_USDG</code><br /><code>HOOD_ALERTS_PREMIUM_DAYS</code></td><td>Price and duration of one purchase. Defaults: 5 USDG for 30 days.</td></tr>
+ </tbody>
+ </table>
+ <div class="callout warn">Prefer facilitator mode. If you use a settler key, treat it like any hot wallet: fund it with only the ETH gas it needs, and never commit it. Every wallet key comes from the environment; nothing is read from code.</div>
+
+ <p>To comp a chat or test premium delivery before wiring a rail:</p>
+ <pre><code>npm run grant-premium -- grant telegram &lt;chatId&gt; --days 30
+npm run grant-premium -- status telegram &lt;chatId&gt;
+npm run grant-premium -- revoke telegram &lt;chatId&gt;</code></pre>
+
+ <h3>Deploy to Cloud Run</h3>
+ <p>The build context is the parent <code>robinhood/</code> directory so the local <code>file:</code> siblings resolve.</p>
+ <pre><code># From robinhood/ (the parent of hood-alerts/)
+docker build -f hood-alerts/Dockerfile -t hood-alerts .
+
+# Push and deploy (long-running service: keep one warm instance)
+gcloud run deploy hood-alerts \
+ --image=REGION-docker.pkg.dev/PROJECT/repo/hood-alerts:latest \
+ --min-instances=1 --no-cpu-throttling \
+ --set-env-vars=HOOD_ALERTS_TELEGRAM_TOKEN=…,HOOD_ALERTS_DISCORD_TOKEN=…,HOOD_ALERTS_DISCORD_APP_ID=… \
+ --set-env-vars=HOOD402_PAY_TO=0x… \
+ --port=8080</code></pre>
+ <p>Mount a persistent volume at <code>/data</code> (the default <code>HOOD_ALERTS_DB</code> path) so subscriptions, entitlements, and the delivery log survive restarts. The container answers <code>GET /healthz</code> with uptime, the last event time, and per-type event counts; graceful shutdown on <code>SIGTERM</code> flushes any pending digests.</p>
+
+ <h3>Configuration reference</h3>
+ <p>Every knob is an environment variable with a sensible default; see <code>.env.example</code> in the repo for the full annotated list, including detector thresholds (<code>HOOD_ALERTS_WHALE_FLOOR_USD</code>, <code>HOOD_ALERTS_PRICE_WINDOW_S</code>, <code>HOOD_ALERTS_RUG_DEFAULT_PCT</code>, and more).</p>
+ </main>
+
+ <footer>
+ <div class="wrap">
+ <div><span class="brand"><span class="dot"></span> hood-alerts</span></div>
+ <div>Built by <a href="https://x.com/nichxbt">nirholas</a> · <a href="https://three.ws">three.ws</a></div>
+ </div>
+ </footer>
+</body>
+</html>
diff --git a/robinhood/hood-alerts/docs/styles.css b/robinhood/hood-alerts/docs/styles.css
new file mode 100644
index 000000000..3e958aca7
--- /dev/null
+++ b/robinhood/hood-alerts/docs/styles.css
@@ -0,0 +1,147 @@
+/* hood-alerts docs. Dark-first, one accent gradient, system type stack. */
+:root {
+ --bg: #0a0b0d;
+ --bg-elev: #121317;
+ --bg-elev-2: #181a20;
+ --border: #23262e;
+ --border-strong: #313641;
+ --text: #e7e9ee;
+ --text-dim: #9aa1ad;
+ --text-faint: #6b7280;
+ --accent: #7c5cff;
+ --accent-2: #21d4a8;
+ --up: #21d4a8;
+ --down: #ff5c7c;
+ --warn: #ffb020;
+ --grad: linear-gradient(120deg, #7c5cff 0%, #21d4a8 100%);
+ --radius: 12px;
+ --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
+ --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
+}
+
+* { box-sizing: border-box; }
+html { scroll-behavior: smooth; }
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--text);
+ font-family: var(--sans);
+ line-height: 1.6;
+ -webkit-font-smoothing: antialiased;
+}
+a { color: var(--accent); text-decoration: none; }
+a:hover { text-decoration: underline; }
+:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
+
+.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
+
+/* nav */
+.nav {
+ position: sticky; top: 0; z-index: 50;
+ background: rgba(10, 11, 13, 0.82);
+ backdrop-filter: blur(12px);
+ border-bottom: 1px solid var(--border);
+}
+.nav .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
+.brand { font-weight: 700; letter-spacing: -0.02em; font-size: 16px; display: flex; align-items: center; gap: 9px; }
+.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 14px rgba(124, 92, 255, 0.6); }
+.nav a.link { color: var(--text-dim); font-size: 14px; font-weight: 500; }
+.nav a.link:hover { color: var(--text); text-decoration: none; }
+.nav .spacer { flex: 1; }
+.nav .gh { color: var(--text-dim); font-size: 13px; border: 1px solid var(--border-strong); padding: 6px 12px; border-radius: 8px; }
+
+/* hero */
+.hero { padding: 76px 0 48px; text-align: center; }
+.chip {
+ display: inline-flex; align-items: center; gap: 8px;
+ font-size: 12px; color: var(--text-dim); font-family: var(--mono);
+ border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 13px; margin-bottom: 24px;
+}
+.chip .live { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 8px var(--up); animation: pulse 1.8s infinite; }
+@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
+h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 18px; font-weight: 800; }
+h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
+.sub { font-size: clamp(16px, 2.4vw, 20px); color: var(--text-dim); max-width: 640px; margin: 0 auto 32px; }
+.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
+.btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; padding: 11px 20px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; }
+.btn.primary { background: var(--grad); color: #0a0b0d; }
+.btn.primary:hover { text-decoration: none; filter: brightness(1.07); }
+.btn.ghost { border-color: var(--border-strong); color: var(--text); background: var(--bg-elev); }
+.btn.ghost:hover { text-decoration: none; border-color: var(--accent); }
+
+/* sections */
+section { padding: 40px 0; }
+.section-head { margin-bottom: 22px; }
+.section-head h2 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 6px; }
+.section-head p { color: var(--text-dim); margin: 0; font-size: 15px; }
+.kicker { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-2); margin-bottom: 8px; }
+
+/* live feed */
+.feed-meta { display: flex; gap: 18px; flex-wrap: wrap; font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); margin-bottom: 16px; }
+.feed-meta b { color: var(--text); font-weight: 600; }
+.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
+.card {
+ background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
+ padding: 16px 18px; transition: border-color 0.16s, transform 0.16s;
+}
+.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
+.card .row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
+.card .sym { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
+.card .badge { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
+.badge.prem { color: var(--up); background: rgba(33, 212, 168, 0.12); }
+.badge.disc { color: var(--down); background: rgba(255, 92, 124, 0.12); }
+.badge.flat { color: var(--text-dim); background: var(--bg-elev-2); }
+.card .prices { font-family: var(--mono); font-size: 13px; color: var(--text-dim); margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
+.card .prices b { color: var(--text); }
+.card .links { margin-top: 12px; display: flex; gap: 14px; font-size: 12.5px; }
+.card .links a { color: var(--text-dim); }
+.card .links a:hover { color: var(--accent); text-decoration: none; }
+.skeleton { height: 118px; background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-elev-2) 50%, var(--bg-elev) 75%); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: var(--radius); border: 1px solid var(--border); }
+@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
+.feed-note { color: var(--text-faint); font-size: 12.5px; margin-top: 14px; }
+.feed-error { color: var(--warn); font-size: 13.5px; background: rgba(255, 176, 32, 0.08); border: 1px solid rgba(255, 176, 32, 0.25); border-radius: 10px; padding: 12px 14px; }
+
+/* feature grid */
+.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
+.feat { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
+.feat h3 { margin: 0 0 6px; font-size: 15.5px; }
+.feat p { margin: 0; color: var(--text-dim); font-size: 14px; }
+.feat .tag { display: inline-block; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); border: 1px solid var(--border-strong); border-radius: 5px; padding: 2px 6px; margin-bottom: 10px; }
+
+/* content pages */
+.doc h2 { font-size: 26px; letter-spacing: -0.02em; margin: 40px 0 10px; }
+.doc h3 { font-size: 18px; margin: 30px 0 8px; }
+.doc p, .doc li { color: var(--text); }
+.doc .lead { color: var(--text-dim); font-size: 17px; }
+table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
+th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
+th { color: var(--text-dim); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; }
+td code, .doc p code, li code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--accent-2); }
+pre { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.55; }
+pre code { color: var(--text); }
+.callout { border-left: 3px solid var(--accent); background: var(--bg-elev); border-radius: 0 10px 10px 0; padding: 14px 18px; margin: 20px 0; color: var(--text-dim); font-size: 14px; }
+.callout.warn { border-left-color: var(--warn); }
+
+/* pricing */
+.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0; }
+.tier { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
+.tier.pro { border-color: var(--accent); box-shadow: 0 0 40px rgba(124, 92, 255, 0.12); }
+.tier h3 { margin: 0 0 4px; font-size: 20px; }
+.tier .price { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 16px; }
+.tier .price span { font-size: 14px; font-weight: 500; color: var(--text-dim); }
+.tier ul { list-style: none; padding: 0; margin: 0; }
+.tier li { padding: 7px 0 7px 26px; position: relative; color: var(--text); font-size: 14.5px; border-top: 1px solid var(--border); }
+.tier li::before { content: "✓"; position: absolute; left: 0; color: var(--accent-2); font-weight: 700; }
+.tier li.no { color: var(--text-faint); }
+.tier li.no::before { content: "-"; color: var(--text-faint); }
+
+/* footer */
+footer { border-top: 1px solid var(--border); padding: 32px 0 48px; margin-top: 48px; color: var(--text-dim); font-size: 14px; }
+footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
+.legal { color: var(--text-faint); font-size: 12px; max-width: 620px; margin-top: 10px; }
+
+@media (max-width: 680px) {
+ .tiers { grid-template-columns: 1fr; }
+ .nav .wrap { gap: 14px; }
+ .nav a.link.hide-sm { display: none; }
+}
diff --git a/robinhood/hood-alerts/package.json b/robinhood/hood-alerts/package.json
index 5f8df8566..6461adb00 100644
--- a/robinhood/hood-alerts/package.json
+++ b/robinhood/hood-alerts/package.json
@@ -14,7 +14,7 @@
"usdg",
"whale-alerts"
],
- "license": "SEE LICENSE IN LICENSE",
+ "license": "MIT",
"author": "nirholas (https://x.com/nichxbt)",
"repository": {
"type": "git",
diff --git a/robinhood/hood-alerts/scripts/capture-fixtures.ts b/robinhood/hood-alerts/scripts/capture-fixtures.ts
index d80d173c1..781f2d962 100644
--- a/robinhood/hood-alerts/scripts/capture-fixtures.ts
+++ b/robinhood/hood-alerts/scripts/capture-fixtures.ts
@@ -105,7 +105,7 @@ async function captureCurveTrades(client: ReturnType<typeof createHoodClient>):
.getLogs({ address: factory, event: odysseyTradedEvent, fromBlock: from, toBlock: to })
.catch(() => [])
for (const log of logs) {
- const a = log.args as { token?: Address; trader?: Address; isBuy?: boolean; tokenAmount?: bigint; ethAmount?: bigint; fee?: bigint }
+ const a = log.args as { token?: Address; trader?: Address; isBuy?: boolean; tokenAmount?: bigint; quoteAmount?: bigint; fee?: bigint }
if (!a.token || !a.trader || a.tokenAmount === undefined) continue
trades.push({
launchpad: 'odyssey',
@@ -113,7 +113,7 @@ async function captureCurveTrades(client: ReturnType<typeof createHoodClient>):
trader: a.trader,
isBuy: Boolean(a.isBuy),
tokenAmount: a.tokenAmount,
- quoteAmount: a.ethAmount ?? 0n,
+ quoteAmount: a.quoteAmount ?? 0n,
fee: a.fee ?? 0n,
blockNumber: log.blockNumber,
transactionHash: log.transactionHash,
diff --git a/robinhood/hood-alerts/scripts/grant-premium.ts b/robinhood/hood-alerts/scripts/grant-premium.ts
new file mode 100644
index 000000000..ef98100b3
--- /dev/null
+++ b/robinhood/hood-alerts/scripts/grant-premium.ts
@@ -0,0 +1,77 @@
+#!/usr/bin/env tsx
+/**
+ * Operator tool: grant, extend, revoke, or inspect a premium entitlement
+ * directly in the database. Use it to comp a chat, to run the premium delivery
+ * flow before wiring a payment rail, or to fix a settlement that half-applied.
+ * It does NOT move funds; it only writes the entitlement row.
+ *
+ * npm run grant-premium -- grant telegram 123456789 --days 30
+ * npm run grant-premium -- status discord 987654321
+ * npm run grant-premium -- revoke telegram 123456789
+ *
+ * The database path follows HOOD_ALERTS_DB (default ./data/hood-alerts.db).
+ */
+import { loadConfig } from '../src/config.js'
+import { openDb } from '../src/db/index.js'
+import { EntitlementRepo } from '../src/db/entitlements.js'
+import type { Platform } from '../src/db/subscribers.js'
+
+function fail(message: string): never {
+ // eslint-disable-next-line no-console
+ console.error(message)
+ process.exit(1)
+}
+
+const PLATFORMS: Platform[] = ['telegram', 'discord', 'console']
+
+function flag(name: string): string | undefined {
+ const i = process.argv.indexOf(`--${name}`)
+ return i >= 0 ? process.argv[i + 1] : undefined
+}
+
+function main(): void {
+ const [action, platform, chat] = process.argv.slice(2)
+ if (!action || !['grant', 'revoke', 'status'].includes(action)) {
+ fail('Usage: grant-premium <grant|revoke|status> <telegram|discord|console> <chatId> [--days 30]')
+ }
+ if (!platform || !PLATFORMS.includes(platform as Platform)) fail(`platform must be one of ${PLATFORMS.join(', ')}`)
+ if (!chat) fail('chatId is required')
+
+ const config = loadConfig()
+ const db = openDb(config.dbPath)
+ const repo = new EntitlementRepo(db)
+ const p = platform as Platform
+
+ if (action === 'status') {
+ const remaining = repo.remainingS(p, chat)
+ const entitlement = repo.get(p, chat)
+ // eslint-disable-next-line no-console
+ console.log(
+ JSON.stringify(
+ {
+ platform: p,
+ chat,
+ tier: remaining > 0 ? 'premium' : 'free',
+ remainingDays: Math.round((remaining / 86_400) * 100) / 100,
+ expiresAt: entitlement ? new Date(entitlement.expiresAt * 1000).toISOString() : null,
+ paymentTx: entitlement?.paymentTx ?? null,
+ },
+ null,
+ 2,
+ ),
+ )
+ } else if (action === 'grant') {
+ const days = Number(flag('days') ?? config.premiumDays)
+ if (!Number.isFinite(days) || days <= 0) fail('--days must be a positive number')
+ const entitlement = repo.activate(p, chat, days * 86_400, { payer: 'operator-grant' })
+ // eslint-disable-next-line no-console
+ console.log(`Premium granted to ${p}:${chat} until ${new Date(entitlement.expiresAt * 1000).toISOString()} (+${days}d).`)
+ } else {
+ const removed = repo.revoke(p, chat)
+ // eslint-disable-next-line no-console
+ console.log(removed ? `Premium revoked for ${p}:${chat}.` : `No entitlement found for ${p}:${chat}.`)
+ }
+ db.close()
+}
+
+main()
diff --git a/robinhood/hood-alerts/scripts/live-probe.ts b/robinhood/hood-alerts/scripts/live-probe.ts
new file mode 100644
index 000000000..93a441962
--- /dev/null
+++ b/robinhood/hood-alerts/scripts/live-probe.ts
@@ -0,0 +1,56 @@
+#!/usr/bin/env tsx
+/**
+ * Live detector probe: runs the full detector set against Robinhood Chain
+ * mainnet (4663) and prints every alert it would fire to the console, with no
+ * bot tokens and no database. This is the zero-config proof that live detection
+ * works. Read-only; never signs or sends a transaction.
+ *
+ * npm run probe # default 90s, chain-wide detectors
+ * npm run probe -- --seconds 300
+ * npm run probe -- --token 0xTOKEN # also stream that token's swaps/holders
+ *
+ * Ctrl-C stops it cleanly.
+ */
+import { createHoodClient } from 'hoodchain'
+import type { Address } from 'viem'
+import { loadConfig } from '../src/config.js'
+import { LiveDetectors } from '../src/engine/detectors/live.js'
+import { toCard, cardToText } from '../src/format/cards.js'
+import { logger } from '../src/logger.js'
+
+function arg(name: string): string | undefined {
+ const i = process.argv.indexOf(`--${name}`)
+ return i >= 0 ? process.argv[i + 1] : undefined
+}
+
+async function main(): Promise<void> {
+ const seconds = Number(arg('seconds') ?? 90)
+ const token = arg('token') as Address | undefined
+ const config = loadConfig()
+ const client = createHoodClient(config.rpcUrl ? { rpcUrl: config.rpcUrl } : {})
+
+ let count = 0
+ const detectors = new LiveDetectors(client, config.detectors, (event) => {
+ count += 1
+ const card = toCard(event)
+ // eslint-disable-next-line no-console
+ console.log(`\n[${new Date().toISOString()}] ${event.type}\n${cardToText(card)}`)
+ })
+
+ logger.info({ seconds, token: token ?? 'chain-wide only' }, 'live probe starting (read-only)')
+ await detectors.start()
+ if (token) await detectors.syncWatchedTokens([token])
+
+ const stop = (): void => {
+ detectors.stop()
+ logger.info({ alerts: count, eventCounts: detectors.eventCounts }, 'probe finished')
+ process.exit(0)
+ }
+ process.on('SIGINT', stop)
+ setTimeout(stop, seconds * 1000)
+}
+
+main().catch((error) => {
+ logger.fatal({ err: String(error?.stack ?? error) }, 'probe failed')
+ process.exit(1)
+})
diff --git a/robinhood/hood-alerts/src/engine/detectors/live.ts b/robinhood/hood-alerts/src/engine/detectors/live.ts
index e88ec6be0..b05c5a9cd 100644
--- a/robinhood/hood-alerts/src/engine/detectors/live.ts
+++ b/robinhood/hood-alerts/src/engine/detectors/live.ts
@@ -318,19 +318,23 @@ export class LiveDetectors {
})
const eth = await this.ethPrice.get()
const at = nowS()
- slots.forEach((res, i) => {
+ // Type the multicall result explicitly so this compiles regardless of how
+ // viem's version-dependent generics infer `slot0`'s tuple.
+ const results = slots as ReadonlyArray<{ status: 'success'; result: unknown } | { status: 'failure'; error: unknown }>
+ for (let i = 0; i < results.length; i++) {
+ const res = results[i]
const p = this.stockPools[i]
- if (!p || res.status !== 'success') return
+ if (!p || !res || res.status !== 'success') continue
const [sqrtPriceX96] = res.result as readonly [bigint, number, number, number, number, number, boolean]
const spot0In1 = sqrtPriceX96ToPrice(sqrtPriceX96, p.decimals0, p.decimals1)
- if (spot0In1 <= 0) return
+ if (spot0In1 <= 0) continue
const stockInQuote = p.stockIs0 ? spot0In1 : 1 / spot0In1
const dexUsd = p.quoteAsset === 'USDG' ? stockInQuote : eth !== null ? stockInQuote * eth : null
const feedUsd = this.lastFeedUsd.get(p.symbol)
- if (dexUsd === null || feedUsd === undefined) return
+ if (dexUsd === null || feedUsd === undefined) continue
const event = this.premiumLadder.update(p.symbol, p.token, p.pool, dexUsd, feedUsd, at)
if (event) this.push(event)
- })
+ }
}
// ---- liquidity pulls ----------------------------------------------------
diff --git a/robinhood/hood-alerts/tests/detectors.test.ts b/robinhood/hood-alerts/tests/detectors.test.ts
new file mode 100644
index 000000000..29d12471a
--- /dev/null
+++ b/robinhood/hood-alerts/tests/detectors.test.ts
@@ -0,0 +1,162 @@
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { describe, expect, it } from 'vitest'
+import type { Address } from 'viem'
+import { PriceMoveTracker } from '../src/engine/detectors/prices.js'
+import { PremiumLadder, PREMIUM_LADDER } from '../src/engine/detectors/premium-ladder.js'
+import { HolderMilestones, HOLDER_MILESTONES } from '../src/engine/detectors/holders.js'
+import { LiquidityMonitor } from '../src/engine/detectors/liquidity.js'
+
+const FIXTURES = join(fileURLToPath(new URL('.', import.meta.url)), 'fixtures')
+const prices = JSON.parse(readFileSync(join(FIXTURES, 'prices.json'), 'utf8')) as {
+ prices: Array<{ symbol: string; priceUsd: number }>
+}
+// Anchor the state-machine tests on a real captured Chainlink price.
+const REAL = prices.prices.find((p) => p.priceUsd > 1) ?? prices.prices[0]
+const TOKEN = '0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC' as Address
+const POOL = '0xB944cec30Bd4175855215D767ADC81F39e5f7E2B' as Address
+
+describe('PriceMoveTracker', () => {
+ it('emits only when the move crosses the threshold, then resets its window', () => {
+ const t = new PriceMoveTracker(900, 2)
+ const base = (REAL as { priceUsd: number }).priceUsd
+ expect(t.update('X', base, 0)).toBeNull() // seed
+ expect(t.update('X', base * 1.01, 60)).toBeNull() // +1% < 2%
+ const up = t.update('X', base * 1.03, 120) // +3% from seed
+ expect(up?.type).toBe('price_move')
+ expect(up?.pct).toBeCloseTo(3, 5)
+ expect(up?.fromUsd).toBeCloseTo(base, 5)
+ // Window reset: a further small move does not re-alert.
+ expect(t.update('X', base * 1.035, 180)).toBeNull()
+ })
+
+ it('detects downward moves and reports a signed percent', () => {
+ const t = new PriceMoveTracker(900, 5)
+ expect(t.update('Y', 100, 0)).toBeNull()
+ const down = t.update('Y', 94, 60)
+ expect(down?.pct).toBeCloseTo(-6, 5)
+ expect(down?.toUsd).toBe(94)
+ })
+
+ it('evicts out-of-window samples so an old price is not the baseline', () => {
+ const t = new PriceMoveTracker(300, 2)
+ expect(t.update('Z', 100, 0)).toBeNull()
+ // 400s later the first sample is out of the 300s window; this becomes the new baseline.
+ expect(t.update('Z', 130, 400)).toBeNull()
+ expect(t.update('Z', 133, 420)?.pct).toBeCloseTo(2.307, 2)
+ })
+
+ it('ignores non-positive prices', () => {
+ const t = new PriceMoveTracker(900, 1)
+ expect(t.update('Q', 0, 0)).toBeNull()
+ expect(t.update('Q', -5, 1)).toBeNull()
+ })
+})
+
+describe('PremiumLadder (Stock Token arb signal)', () => {
+ it('emits once per rung crossed upward and re-arms after falling below (hysteresis)', () => {
+ const l = new PremiumLadder()
+ const feed = (REAL as { priceUsd: number }).priceUsd
+ // 3.2% premium: crosses rungs 1,2,3 -> emits highest = 3.
+ const e1 = l.update('NVDA', TOKEN, POOL, feed * 1.032, feed, 1)
+ expect(e1?.level).toBe(3)
+ expect(e1?.direction).toBe('premium')
+ expect(e1?.premiumPct).toBeCloseTo(3.2, 4)
+ // Still 3.2%: no new rung.
+ expect(l.update('NVDA', TOKEN, POOL, feed * 1.032, feed, 2)).toBeNull()
+ // Jump to 5.5%: crosses rung 5.
+ expect(l.update('NVDA', TOKEN, POOL, feed * 1.055, feed, 3)?.level).toBe(5)
+ // Fall back under 3% then climb to 4% -> rung 3 re-arms and emits again.
+ expect(l.update('NVDA', TOKEN, POOL, feed * 1.02, feed, 4)).toBeNull()
+ expect(l.update('NVDA', TOKEN, POOL, feed * 1.04, feed, 5)?.level).toBe(3)
+ })
+
+ it('tracks discount crossings independently', () => {
+ const l = new PremiumLadder()
+ const feed = 100
+ const d = l.update('AMD', TOKEN, POOL, 89, feed, 1) // -11% -> rung 10
+ expect(d?.direction).toBe('discount')
+ expect(d?.level).toBe(10)
+ expect(d?.premiumPct).toBeCloseTo(-11, 5)
+ })
+
+ it('ignores invalid prices', () => {
+ const l = new PremiumLadder()
+ expect(l.update('X', TOKEN, POOL, 0, 100, 1)).toBeNull()
+ expect(l.update('X', TOKEN, POOL, 100, 0, 1)).toBeNull()
+ })
+
+ it('exposes the rung ladder used by the UI', () => {
+ expect(PREMIUM_LADDER).toContain(1)
+ expect(PREMIUM_LADDER).toContain(50)
+ })
+})
+
+describe('HolderMilestones', () => {
+ it('seeds silently on first observation then emits the highest crossed milestone', () => {
+ const h = new HolderMilestones()
+ expect(h.update(TOKEN, 8, 1)).toBeNull() // seed, no replay
+ const e = h.update(TOKEN, 120, 2) // crosses 10, 25, 50, 100 -> highest 100
+ expect(e?.milestone).toBe(100)
+ expect(e?.count).toBe(120)
+ })
+
+ it('does not re-alert a milestone already passed', () => {
+ const h = new HolderMilestones()
+ expect(h.update(TOKEN, 90, 1)).toBeNull()
+ expect(h.update(TOKEN, 105, 2)?.milestone).toBe(100)
+ expect(h.update(TOKEN, 110, 3)).toBeNull()
+ })
+
+ it('forgets a token on unwatch (re-seeds without replay)', () => {
+ const h = new HolderMilestones()
+ h.update(TOKEN, 40, 1)
+ h.forget(TOKEN)
+ expect(h.update(TOKEN, 300, 2)).toBeNull() // re-seed, silent
+ })
+
+ it('milestone ladder is ascending and covers small and large counts', () => {
+ expect(HOLDER_MILESTONES[0]).toBe(10)
+ expect(HOLDER_MILESTONES.at(-1)).toBe(100_000)
+ })
+})
+
+describe('LiquidityMonitor (rug early-warning)', () => {
+ it('emits when quote reserves drop past the threshold from the trailing peak', () => {
+ const m = new LiquidityMonitor(1800, 30, 500)
+ m.track(POOL, TOKEN, 'USDG')
+ expect(m.update(POOL, 10_000, 0)).toBeNull() // baseline
+ expect(m.update(POOL, 9_000, 60)).toBeNull() // -10%, under 30%
+ const pull = m.update(POOL, 6_000, 120) // -40% from peak 10k
+ expect(pull?.type).toBe('liquidity_pull')
+ expect(pull?.droppedPct).toBeCloseTo(40, 5)
+ expect(pull?.beforeUsd).toBe(10_000)
+ expect(pull?.afterUsd).toBe(6_000)
+ expect(pull?.quoteAsset).toBe('USDG')
+ })
+
+ it('resets the baseline after a pull so the same drain does not re-alert', () => {
+ const m = new LiquidityMonitor(1800, 30, 500)
+ m.track(POOL, TOKEN, 'USDG')
+ m.update(POOL, 10_000, 0)
+ expect(m.update(POOL, 5_000, 60)?.droppedPct).toBeCloseTo(50, 5)
+ expect(m.update(POOL, 4_900, 120)).toBeNull()
+ })
+
+ it('ignores dust pools below the minimum', () => {
+ const m = new LiquidityMonitor(1800, 30, 500)
+ m.track(POOL, TOKEN, 'WETH')
+ m.update(POOL, 200, 0)
+ expect(m.update(POOL, 10, 60)).toBeNull() // peak 200 < minPoolUsd 500
+ })
+
+ it('tracks and untracks pools', () => {
+ const m = new LiquidityMonitor(1800, 30)
+ m.track(POOL, TOKEN, 'USDG')
+ expect(m.tracked().map((p) => p.toLowerCase())).toContain(POOL.toLowerCase())
+ expect(m.quoteAssetOf(POOL)).toBe('USDG')
+ m.untrack(POOL)
+ expect(m.tracked()).toHaveLength(0)
+ })
+})
diff --git a/robinhood/hood-alerts/tests/fixtures/curve-trades.json b/robinhood/hood-alerts/tests/fixtures/curve-trades.json
index b4e239efd..f524e0111 100644
--- a/robinhood/hood-alerts/tests/fixtures/curve-trades.json
+++ b/robinhood/hood-alerts/tests/fixtures/curve-trades.json
@@ -1,26 +1,15 @@
{
- "capturedAt": "2026-07-16T17:02:47.527Z",
+ "capturedAt": "2026-07-16T17:07:25.852Z",
"chainId": 4663,
"ethUsd": 1877.94,
"trades": [
- {
- "launchpad": "odyssey",
- "token": "0x6b21b4567EfAd992B65f8a92457B45a74ed59486",
- "trader": "0x6A85b75E240D67783Ea85375be5E0f5BF3697051",
- "isBuy": true,
- "tokenAmount": "21546882935256",
- "quoteAmount": "0",
- "fee": "3838099598115792",
- "blockNumber": "11022832",
- "transactionHash": "0xefad0bfc174d9b11237a845ab71ab0ae889845a252dfd59002e5efc3b43cc25a"
- },
{
"launchpad": "odyssey",
"token": "0x6b21b4567EfAd992B65f8a92457B45a74ed59486",
"trader": "0x6Fe4054eB7Df2a752132dD1DDEA919921A3CccB7",
"isBuy": true,
"tokenAmount": "8748016421282",
- "quoteAmount": "0",
+ "quoteAmount": "85137810235045981",
"fee": "1702756204700920",
"blockNumber": "11025696",
"transactionHash": "0x0c5ce7566a997a178b223b84a6cab83ff9e5a8ecb2b24f2274b263233f57a729"
@@ -31,7 +20,7 @@
"trader": "0x7B70E60Cd3806907AF0F4aEe47FF597f47EBF3CE",
"isBuy": true,
"tokenAmount": "11136388196935",
- "quoteAmount": "0",
+ "quoteAmount": "115211085405890523",
"fee": "2304221708117811",
"blockNumber": "11090913",
"transactionHash": "0x9815c87a9a7a69a0c54b787fecd9fab849f90c3e717385a7231549eec3cbf1b7"
@@ -42,7 +31,7 @@
"trader": "0x7B70E60Cd3806907AF0F4aEe47FF597f47EBF3CE",
"isBuy": false,
"tokenAmount": "11136388196935",
- "quoteAmount": "0",
+ "quoteAmount": "115211085405890523",
"fee": "2304221708117810",
"blockNumber": "11105367",
"transactionHash": "0xf1f4b5bd8918d1bb94f466428a2bf9c75df07e60f96ffe076aafa492dc676750"
@@ -53,7 +42,7 @@
"trader": "0x6977109374fc923213CE42f9c5809DCe1066f4B3",
"isBuy": true,
"tokenAmount": "1369028774047",
- "quoteAmount": "0",
+ "quoteAmount": "13738035822325315",
"fee": "274760716446507",
"blockNumber": "11109989",
"transactionHash": "0xa876d7706717db7f18c73c17278ca7833eafa5a213323b51f99dace233dae17e"
@@ -64,7 +53,7 @@
"trader": "0x130F46a76Bf1D89Cc45Eb9Ad97Cb3370863492DB",
"isBuy": true,
"tokenAmount": "286876861731",
- "quoteAmount": "0",
+ "quoteAmount": "2893439041734888",
"fee": "57868780834698",
"blockNumber": "11122837",
"transactionHash": "0x741c7c8fcbf4e9571a645331d3fc765c80362b30e1c5b8155ff87c85b86a7702"
@@ -75,7 +64,7 @@
"trader": "0xfe28285fd95Bc897bc3E4c4566088698611aF8aD",
"isBuy": true,
"tokenAmount": "1878326387753",
- "quoteAmount": "0",
+ "quoteAmount": "3338054687736137",
"fee": "66761093754723",
"blockNumber": "11159252",
"transactionHash": "0xfeb7a468aabb4fd7d018e160acf13c0c3c50c6716f44eadabb65448d7f6ccb31"
@@ -86,10 +75,21 @@
"trader": "0xC50723b547d1337667493Af50B1a8Ea856Ef66B4",
"isBuy": true,
"tokenAmount": "17851557670618",
- "quoteAmount": "0",
+ "quoteAmount": "190681446066987801",
"fee": "3813628921339757",
"blockNumber": "11155901",
"transactionHash": "0x6ba554fc0d91835fbb951332c4e17f785f696a68baa78cb6c7b9cc2f6d778ab7"
+ },
+ {
+ "launchpad": "odyssey",
+ "token": "0x6b21b4567EfAd992B65f8a92457B45a74ed59486",
+ "trader": "0x7B70E60Cd3806907AF0F4aEe47FF597f47EBF3CE",
+ "isBuy": true,
+ "tokenAmount": "11841440633768",
+ "quoteAmount": "139199742370364745",
+ "fee": "2783994847407295",
+ "blockNumber": "11201737",
+ "transactionHash": "0x925fd42748e53ba88951ee01a897059b2d19b7f4db71582b9e555f3f5dc4d1e7"
}
]
}
diff --git a/robinhood/hood-alerts/tests/live/chain.test.ts b/robinhood/hood-alerts/tests/live/chain.test.ts
new file mode 100644
index 000000000..c8fc7f74c
--- /dev/null
+++ b/robinhood/hood-alerts/tests/live/chain.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, it } from 'vitest'
+import { createHoodClient, listPricedStockTokens, MAINNET_EXPLORER_URL } from 'hoodchain'
+import { streamPrices } from 'hoodkit'
+
+/**
+ * Live, read-only checks against Robinhood Chain mainnet (chain ID 4663).
+ * Excluded from `npm test`; run explicitly with `npm run test:live`. These make
+ * real network calls, so they are gated behind the live runner (longer timeout).
+ */
+describe('Robinhood Chain mainnet 4663 (live, read-only)', () => {
+ const client = createHoodClient({})
+
+ it('reports chain id 4663', async () => {
+ const id = await client.public.getChainId()
+ expect(id).toBe(4663)
+ })
+
+ it('advances a real block height', async () => {
+ const a = await client.public.getBlockNumber()
+ expect(a).toBeGreaterThan(0n)
+ })
+
+ it('reads a real, positive Chainlink Stock Token price', async () => {
+ const symbols = listPricedStockTokens()
+ .slice(0, 6)
+ .map((s) => s.symbol)
+ const stream = streamPrices(client, symbols)
+ const price = await new Promise<number>((resolve) => {
+ stream.on('data', (tick) => resolve(tick.priceUsd))
+ })
+ stream.close()
+ expect(price).toBeGreaterThan(0)
+ })
+
+ it('reaches the Blockscout stats endpoint', async () => {
+ const res = await fetch(`${MAINNET_EXPLORER_URL}/api/v2/stats`, { headers: { accept: 'application/json' } })
+ expect(res.ok).toBe(true)
+ const body = (await res.json()) as { total_blocks?: string }
+ expect(Number(body.total_blocks ?? 0)).toBeGreaterThan(0)
+ })
+})
diff --git a/robinhood/hood-alerts/tests/whale-classify.test.ts b/robinhood/hood-alerts/tests/whale-classify.test.ts
new file mode 100644
index 000000000..ed581b478
--- /dev/null
+++ b/robinhood/hood-alerts/tests/whale-classify.test.ts
@@ -0,0 +1,149 @@
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { describe, expect, it } from 'vitest'
+import type { Address, Hash } from 'viem'
+import { classifyCurveTrade, classifySwap } from '../src/engine/detectors/whale-classify.js'
+
+/**
+ * These run against REAL Robinhood Chain (4663) data captured by
+ * `npm run capture-fixtures` (tests/fixtures/*.json). They prove the whale
+ * classifiers decode genuine on-chain swaps and Odyssey curve trades, not
+ * hand-written samples. Re-capture to refresh.
+ */
+const FIXTURES = join(fileURLToPath(new URL('.', import.meta.url)), 'fixtures')
+const load = (name: string): Record<string, unknown> => JSON.parse(readFileSync(join(FIXTURES, name), 'utf8'))
+
+interface RawSwap {
+ pool: string
+ amount0: string
+ amount1: string
+ volume0: number
+ volume1: number
+ recipient: string
+ blockNumber: string
+ transactionHash: string
+}
+interface PoolFixture {
+ symbol: string
+ token: string
+ poolInfo: { pool: string; token0: string; token1: string; decimals0: number; decimals1: number }
+ swaps: RawSwap[]
+}
+
+describe('classifySwap on real captured Uniswap v3 swaps', () => {
+ const fx = load('swaps.json') as unknown as { weth: string; usdg: string; ethUsd: number | null; pools: PoolFixture[] }
+ const quote = { weth: fx.weth as Address, usdg: fx.usdg as Address }
+ const ethUsd = fx.ethUsd ?? 2000
+ const allSwaps = fx.pools.flatMap((p) => p.swaps.map((s) => ({ pool: p, swap: s })))
+
+ it('captured at least one real swap to classify', () => {
+ expect(allSwaps.length).toBeGreaterThan(0)
+ })
+
+ it('classifies every real swap into a valued whale event on a quote pool', () => {
+ for (const { pool, swap } of allSwaps) {
+ const info = { token0: pool.poolInfo.token0 as Address, token1: pool.poolInfo.token1 as Address }
+ const rehydrated = {
+ amount0: BigInt(swap.amount0),
+ amount1: BigInt(swap.amount1),
+ volume0: swap.volume0,
+ volume1: swap.volume1,
+ recipient: swap.recipient as Address,
+ blockNumber: BigInt(swap.blockNumber),
+ transactionHash: swap.transactionHash as Hash,
+ }
+ // floorUsd 0 to include the (small, real) test-network swaps.
+ const event = classifySwap(rehydrated, info, quote, ethUsd, 0, 1_700_000_000)
+ expect(event).not.toBeNull()
+ if (!event) continue
+ expect(event.type).toBe('whale')
+ expect(event.source).toBe('uniswap-v3')
+ expect(event.usd).toBeGreaterThan(0)
+ expect(['buy', 'sell']).toContain(event.side)
+ // The whale event names the non-quote (base) token, not WETH/USDG.
+ expect(event.token.toLowerCase()).not.toBe(fx.weth.toLowerCase())
+ expect(event.token.toLowerCase()).not.toBe(fx.usdg.toLowerCase())
+ expect(event.trader).toBe(swap.recipient)
+ }
+ })
+
+ it('applies the whale USD floor: a high floor filters real dust swaps out', () => {
+ const { pool, swap } = allSwaps[0] as { pool: PoolFixture; swap: RawSwap }
+ const info = { token0: pool.poolInfo.token0 as Address, token1: pool.poolInfo.token1 as Address }
+ const rehydrated = {
+ amount0: BigInt(swap.amount0),
+ amount1: BigInt(swap.amount1),
+ volume0: swap.volume0,
+ volume1: swap.volume1,
+ recipient: swap.recipient as Address,
+ blockNumber: BigInt(swap.blockNumber),
+ transactionHash: swap.transactionHash as Hash,
+ }
+ expect(classifySwap(rehydrated, info, quote, ethUsd, 1_000_000_000, 1)).toBeNull()
+ })
+
+ it('returns null for a pool with no WETH/USDG quote side', () => {
+ const { pool, swap } = allSwaps[0] as { pool: PoolFixture; swap: RawSwap }
+ const nonQuoteInfo = { token0: '0x1111111111111111111111111111111111111111' as Address, token1: '0x2222222222222222222222222222222222222222' as Address }
+ const rehydrated = {
+ amount0: BigInt(swap.amount0),
+ amount1: BigInt(swap.amount1),
+ volume0: swap.volume0,
+ volume1: swap.volume1,
+ recipient: swap.recipient as Address,
+ blockNumber: BigInt(swap.blockNumber),
+ transactionHash: swap.transactionHash as Hash,
+ }
+ expect(classifySwap(rehydrated, nonQuoteInfo, quote, ethUsd, 0, 1)).toBeNull()
+ })
+})
+
+describe('classifyCurveTrade on real captured Odyssey bonding-curve trades', () => {
+ const fx = load('curve-trades.json') as unknown as {
+ ethUsd: number | null
+ trades: Array<{ token: string; trader: string; isBuy: boolean; quoteAmount: string; blockNumber: string; transactionHash: string }>
+ }
+ const ethUsd = fx.ethUsd ?? 2000
+ const withQuote = fx.trades.filter((t) => BigInt(t.quoteAmount) > 0n)
+
+ it('captured real Odyssey curve trades with a non-zero ETH quote', () => {
+ expect(withQuote.length).toBeGreaterThan(0)
+ })
+
+ it('classifies each real curve trade into a valued whale event', () => {
+ for (const t of withQuote) {
+ const trade = {
+ token: t.token as Address,
+ trader: t.trader as Address,
+ isBuy: t.isBuy,
+ quoteAmount: BigInt(t.quoteAmount),
+ blockNumber: BigInt(t.blockNumber),
+ transactionHash: t.transactionHash as Hash,
+ }
+ const event = classifyCurveTrade(trade, ethUsd, 0, 1_700_000_000)
+ expect(event).not.toBeNull()
+ if (!event) continue
+ expect(event.source).toBe('odyssey-curve')
+ expect(event.token).toBe(t.token)
+ expect(event.side).toBe(t.isBuy ? 'buy' : 'sell')
+ // usd = ETH quote * ethUsd, so it must equal the hand computation.
+ const expected = Number(trade.quoteAmount) / 1e18 * ethUsd
+ expect(event.usd).toBeCloseTo(expected, 6)
+ }
+ })
+
+ it('rejects trades with a non-positive ETH price and applies the floor', () => {
+ const t = withQuote[0] as { token: string; trader: string; isBuy: boolean; quoteAmount: string; blockNumber: string; transactionHash: string }
+ const trade = {
+ token: t.token as Address,
+ trader: t.trader as Address,
+ isBuy: t.isBuy,
+ quoteAmount: BigInt(t.quoteAmount),
+ blockNumber: BigInt(t.blockNumber),
+ transactionHash: t.transactionHash as Hash,
+ }
+ expect(classifyCurveTrade(trade, 0, 0, 1)).toBeNull()
+ expect(classifyCurveTrade(trade, ethUsd, 1_000_000_000, 1)).toBeNull()
+ })
+})
diff --git a/robinhood/hood-alerts/vitest.config.ts b/robinhood/hood-alerts/vitest.config.ts
index 1029dc44a..153749aad 100644
--- a/robinhood/hood-alerts/vitest.config.ts
+++ b/robinhood/hood-alerts/vitest.config.ts
@@ -3,7 +3,9 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
include: ['tests/**/*.test.ts'],
- exclude: ['tests/live/**', 'node_modules/**'],
+ // tests/live is opt-in (real network); `npm test` excludes it via its own
+ // CLI --exclude, and `npm run test:live` targets it directly.
+ exclude: ['node_modules/**'],
testTimeout: 20_000,
},
})
diff --git a/robinhood/hood-pay/README.md b/robinhood/hood-pay/README.md
index 1ae5037fa..9d742647c 100644
--- a/robinhood/hood-pay/README.md
+++ b/robinhood/hood-pay/README.md
@@ -13,8 +13,8 @@ usable on its own:
- **Verify** (`hood-pay/verify`, Node-only): a reorg-safe on-chain payment watcher, an idempotent
SQLite ledger, signed webhooks, and refund helpers for the merchant side.
-USDG (Robinhood Chain's dollar stablecoin) is a plain ERC-20: no memo field, no EIP-2612 permit.
-A bare `transfer` cannot say which invoice it settles. hood-pay solves that two ways: **router
+USDG (Robinhood Chain's dollar stablecoin) is a plain ERC-20 whose `transfer` carries no memo or
+invoice-reference field. A bare `transfer` cannot say which invoice it settles. hood-pay solves that two ways: **router
mode**, where the buyer pays through the stateless, non-custodial `HoodPayRouter` contract
(`contracts/src/HoodPayRouter.sol`) which emits `PaymentReceived(reference, payer, payTo, token,
amount)` for exact attribution regardless of amount; and **direct mode**, where the invoice
@@ -236,7 +236,7 @@ and auto-mounts every `[data-hoodpay]` element on `DOMContentLoaded`.
`contracts/src/HoodPayRouter.sol` is the stateless, non-custodial router: `pay(token, payTo,
amount, ref)` pulls `amount` of `token` from the caller straight to `payTo` via `transferFrom`
-(requires a prior `approve` - USDG has no permit) and emits `PaymentReceived`. It never holds a
+(requires a prior `approve`) and emits `PaymentReceived`. It never holds a
balance, has no owner, no pause, and no upgrade path; it tolerates non-reverting tokens that
signal failure by returning `false` and legacy tokens that return no data at all.
diff --git a/robinhood/hood-pay/contracts/README.md b/robinhood/hood-pay/contracts/README.md
index bc831c25d..7c6b708ff 100644
--- a/robinhood/hood-pay/contracts/README.md
+++ b/robinhood/hood-pay/contracts/README.md
@@ -6,8 +6,8 @@ caller straight to the merchant and emits
`PaymentReceived(reference, payer, payTo, token, amount)`. The contract
never holds a balance, has no owner, and cannot be paused or upgraded.
-Why it exists: USDG has no memo field and no EIP-2612 permit (verified
-on-chain), so a bare `transfer` cannot say which invoice it settles. See
+Why it exists: USDG's `transfer` carries no memo or invoice-reference
+field, so a bare `transfer` cannot say which invoice it settles. See
`docs/security.html` for the full reference-scheme design and collision
math.
diff --git a/robinhood/hood-pay/contracts/src/HoodPayRouter.sol b/robinhood/hood-pay/contracts/src/HoodPayRouter.sol
index 3132e2105..e85c355ab 100644
--- a/robinhood/hood-pay/contracts/src/HoodPayRouter.sol
+++ b/robinhood/hood-pay/contracts/src/HoodPayRouter.sol
@@ -7,8 +7,9 @@ pragma solidity 0.8.30;
* @notice Stateless, non-custodial payment attribution for plain ERC-20s.
*
* USDG (Paxos Global Dollar, Robinhood Chain's dollar stablecoin) is a
- * plain ERC-20: no memo field, no EIP-2612 permit. A bare `transfer`
- * therefore cannot say WHICH invoice it settles. `pay` fixes that in one
+ * plain ERC-20 whose `transfer` carries no memo or invoice-reference
+ * field. A bare `transfer` therefore cannot say WHICH invoice it settles.
+ * `pay` fixes that in one
* hop: it pulls `amount` of `token` from the caller STRAIGHT to `payTo`
* (this contract never holds a balance, has no owner, no pause, no
* upgrade path, and no way to move funds that were not just approved for
@@ -40,9 +41,9 @@ contract HoodPayRouter {
/**
* @notice Pay `amount` of `token` to `payTo`, attributed to `reference`.
- * @dev Requires a prior `approve(router, amount)` on `token` - USDG has
- * no permit, so the two-step approve + pay is the only flow.
- * Reverts unless the token both succeeds and (when it returns
+ * @dev Requires a prior `approve(router, amount)` on `token`: the caller
+ * grants an explicit allowance, so the two-step approve + pay is the
+ * flow. Reverts unless the token both succeeds and (when it returns
* data) returns true.
*/
function pay(address token, address payTo, uint256 amount, bytes32 ref) external {
diff --git a/robinhood/hood-pay/docs/index.html b/robinhood/hood-pay/docs/index.html
index ca4c8afcc..a7259e27d 100644
--- a/robinhood/hood-pay/docs/index.html
+++ b/robinhood/hood-pay/docs/index.html
@@ -137,7 +137,7 @@ mountCheckout(<span class="s">'#checkout'</span>, {
<footer>
<div class="wrap footer-inner">
<span>Built by <a href="https://x.com/nichxbt">nirholas</a> · <a href="https://three.ws">three.ws</a></span>
- <span>MIT · USDG is a plain ERC-20 (6 decimals, no permit) on Robinhood Chain 4663</span>
+ <span>All rights reserved · USDG is a plain ERC-20 (6 decimals) on Robinhood Chain 4663</span>
</div>
</footer>
diff --git a/robinhood/hood-pay/docs/security.html b/robinhood/hood-pay/docs/security.html
new file mode 100644
index 000000000..f1b1451d4
--- /dev/null
+++ b/robinhood/hood-pay/docs/security.html
@@ -0,0 +1,104 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Security - hood-pay</title>
+ <meta name="description" content="hood-pay's security model: the widget never holds keys or custodies funds, amounts are verified on-chain not in the DOM, plus the reorg-depth policy and reference-collision math." />
+ <link rel="stylesheet" href="styles.css" />
+</head>
+<body>
+ <nav class="nav">
+ <div class="wrap nav-inner">
+ <span class="brand"><a href="index.html" style="color:inherit;text-decoration:none;">hood<b>pay</b></a></span>
+ <div class="nav-links">
+ <a href="index.html#demo">Demo</a>
+ <a href="index.html#embed">Embed</a>
+ <a href="links.html">Payment links</a>
+ <a href="verify.html">Verify</a>
+ <a href="security.html">Security</a>
+ <a class="cta" href="https://github.com/nirholas/hood-pay">GitHub</a>
+ </div>
+ </div>
+ </nav>
+
+ <section style="border-top:0;">
+ <div class="wrap">
+ <h1 style="font-size:clamp(1.8rem,4vw,2.6rem);letter-spacing:-0.03em;margin:0 0 8px;">Security model</h1>
+ <p class="section-sub">hood-pay is non-custodial by construction. It moves no money on its own and stores no keys. Here is exactly what each piece can and cannot do.</p>
+
+ <div class="split">
+ <div class="card prose">
+ <h3 style="color:var(--accent-2);">The widget CAN</h3>
+ <ul>
+ <li>Discover EIP-6963 wallets already installed in the buyer's browser.</li>
+ <li>Ask the wallet to switch to Robinhood Chain (4663 / 46630).</li>
+ <li>Read the buyer's token balance and allowance (read-only <code class="inline">eth_call</code>).</li>
+ <li>Build an <strong>unsigned</strong> <code class="inline">transfer</code> (or <code class="inline">approve</code> + router <code class="inline">pay</code>) and hand it to the wallet to sign.</li>
+ <li>Watch for the transaction receipt and show a confirmation state.</li>
+ </ul>
+ </div>
+ <div class="card prose">
+ <h3 style="color:var(--danger);">The widget CANNOT</h3>
+ <ul>
+ <li>Hold, request, or see a private key or seed phrase - ever.</li>
+ <li>Custody funds. Payments go buyer → merchant (or buyer → router → merchant) in one atomic transaction; the router never holds a balance.</li>
+ <li>Move funds the buyer did not just approve for that exact call.</li>
+ <li>Decide, at settlement, that a payment "counts" from the DOM. The merchant's verifier re-reads the amount on-chain.</li>
+ <li>Approve unlimited allowance - router mode approves the <em>exact</em> invoice amount.</li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="prose">
+ <h3>Amounts are verified on-chain, never in the DOM</h3>
+ <p>A malicious page could change what a buyer sees, but it cannot forge a settled transfer. The merchant side (<code class="inline">hood-pay/verify</code>) reads <code class="inline">Transfer</code> / <code class="inline">PaymentReceived</code> logs directly from the chain and sums the attributed value in BigInt. The webhook body and the widget's <code class="inline">onSuccess</code> receipt are hints; the ledger and watcher are the source of truth.</p>
+ </div>
+
+ <div class="prose">
+ <h3>Reorg-depth policy</h3>
+ <p>Robinhood Chain is an Arbitrum Orbit L2 with ~100 ms blocks. The watcher defends against reorgs two ways:</p>
+ <ul>
+ <li><strong>Confirmation depth.</strong> Only blocks at depth ≥ <code class="inline">confirmations</code> below the head are ever scanned (default 30, roughly 3 seconds of blocks). A log must survive that many blocks before it can count.</li>
+ <li><strong>Canonical re-check.</strong> Every candidate log's block hash is re-fetched by number and compared. If the block was reorged out after the scan, the hash mismatches and the log is dropped.</li>
+ </ul>
+ <p>Together, a confirmed result is stable under any reorg shallower than <code class="inline">confirmations</code>, and immune to deeper ones that occur between scanning and re-checking. Raise <code class="inline">confirmations</code> for higher-value invoices.</p>
+ </div>
+
+ <div class="prose">
+ <h3>Reference scheme + collision math</h3>
+ <p>USDG is a plain ERC-20 whose <code class="inline">transfer</code> carries no memo or invoice-reference field, so a bare transfer cannot say which invoice it settles. hood-pay attributes payments two ways. (Note: current mainnet USDG also exposes an EIP-2612 <code class="inline">permit</code>, but hood-pay does not use it - it approves the exact amount explicitly, so there is one auditable allowance path.)</p>
+
+ <div class="card">
+ <p style="margin-top:0;"><strong>Router mode (exact attribution).</strong> The buyer pays through the stateless <code class="inline">HoodPayRouter</code>, which emits <code class="inline">PaymentReceived(reference, payer, payTo, token, amount)</code>. The reference is 32 random bytes per checkout, drawn uniformly from 2<sup>256</sup>. By the birthday bound, the probability any two of <em>k</em> references collide is about <code class="inline">k² / 2²⁵⁷</code> - at a trillion payments (k = 10¹²) that is ~8.6 × 10⁻⁵⁴. Attribution is exact regardless of amount, so partial payments and overpayments are summed per reference.</p>
+ </div>
+
+ <div class="card">
+ <p style="margin-top:0;"><strong>Direct mode (amount fingerprinting, zero contracts).</strong> USDG has 6 decimals; retail prices use at most 2, leaving the low 4 decimal digits (9,999 usable slots, each worth 0.0001 USDG) as a fingerprint. The verifier matches <code class="inline">Transfer(to = payTo, value = base + dust)</code> exactly.</p>
+ <ul>
+ <li><strong>With a ledger</strong>, the dust slot is atomically reserved per (payTo, token, base amount) while an invoice is open - collisions are impossible by construction, not by probability.</li>
+ <li><strong>Without a ledger</strong> (static payment links), dust is random and the birthday bound applies: <code class="inline">k(k-1) / (2 × 9999)</code> for k concurrent open invoices at the <em>same</em> price to the <em>same</em> merchant - about 0.45% at k = 10. Static links suit low-concurrency sellers; a ledger or router suits everyone else.</li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="prose">
+ <h3>Merchant key handling</h3>
+ <p>Refunds are the only operation that needs the merchant's key, and hood-pay never touches it. <code class="inline">buildRefundTx</code> produces an unsigned transfer; <code class="inline">sendRefund</code> drives a wallet client the merchant supplies. Keep the key in <code class="inline">ROBINHOOD_CHAIN_PRIVATE_KEY</code> (or a signer service), never in code, and never in a client bundle.</p>
+ </div>
+
+ <div class="prose">
+ <h3>Stock Tokens are out of scope, on purpose</h3>
+ <p>hood-pay settles in USDG and other non-security tokens. It does not buy, sell, or route Robinhood <strong>Stock Tokens</strong>. Stock Tokens are tokenized debt securities (issuer: Robinhood Assets (Jersey) Ltd) and may not be offered, sold, or delivered to US persons (with extra limits in Canada, the UK, and Switzerland). If you point a checkout at a Stock Token as the payment asset, that eligibility restriction is yours to enforce; USDG and memecoin payments carry no such restriction.</p>
+ </div>
+ </div>
+ </section>
+
+ <footer>
+ <div class="wrap footer-inner">
+ <span>Built by <a href="https://x.com/nichxbt">nirholas</a> · <a href="https://three.ws">three.ws</a></span>
+ <span>MIT</span>
+ </div>
+ </footer>
+</body>
+</html>
diff --git a/robinhood/hood-pay/docs/verify.html b/robinhood/hood-pay/docs/verify.html
new file mode 100644
index 000000000..34c28b4ad
--- /dev/null
+++ b/robinhood/hood-pay/docs/verify.html
@@ -0,0 +1,152 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Verify + webhooks - hood-pay</title>
+ <meta name="description" content="Confirm USDG payments on your server with hood-pay/verify: a reorg-safe on-chain watcher, signed webhooks, an idempotent SQLite ledger, and refund helpers." />
+ <link rel="stylesheet" href="styles.css" />
+</head>
+<body>
+ <nav class="nav">
+ <div class="wrap nav-inner">
+ <span class="brand"><a href="index.html" style="color:inherit;text-decoration:none;">hood<b>pay</b></a></span>
+ <div class="nav-links">
+ <a href="index.html#demo">Demo</a>
+ <a href="index.html#embed">Embed</a>
+ <a href="links.html">Payment links</a>
+ <a href="verify.html">Verify</a>
+ <a href="security.html">Security</a>
+ <a class="cta" href="https://github.com/nirholas/hood-pay">GitHub</a>
+ </div>
+ </div>
+ </nav>
+
+ <section style="border-top:0;">
+ <div class="wrap">
+ <h1 style="font-size:clamp(1.8rem,4vw,2.6rem);letter-spacing:-0.03em;margin:0 0 8px;">Verify + webhooks</h1>
+ <p class="section-sub">The widget builds unsigned transactions; it never decides whether a payment happened. Your server does, by reading the chain with <code class="inline">hood-pay/verify</code> (Node-only). Install with <code class="inline">npm install hood-pay</code>.</p>
+
+ <div class="prose">
+ <h3>Await a payment</h3>
+ <p><code class="inline">awaitPayment</code> polls the chain until the invoice settles, the timeout elapses, or an <code class="inline">AbortSignal</code> fires. It never rejects on settlement grounds - the returned result carries a terminal status you handle explicitly.</p>
+ <div class="codewrap">
+ <button class="copy" data-copy="await-code">Copy</button>
+ <pre id="await-code"><span class="k">import</span> { networkInfo } <span class="k">from</span> <span class="s">'hood-pay'</span>
+<span class="k">import</span> { awaitPayment, createReader } <span class="k">from</span> <span class="s">'hood-pay/verify'</span>
+<span class="k">import</span> { parseUnits } <span class="k">from</span> <span class="s">'viem'</span>
+
+<span class="k">const</span> info = networkInfo(<span class="s">'mainnet'</span>)
+<span class="k">const</span> reader = createReader(<span class="s">'mainnet'</span>)
+
+<span class="k">const</span> result = <span class="k">await</span> awaitPayment(
+ {
+ token: info.usdg.address,
+ payTo: <span class="s">'0x4022de2D36C334E73C7a108805Cea11C0564f402'</span>,
+ expectedRaw: parseUnits(<span class="s">'25.00'</span>, info.usdg.decimals)
+ },
+ {
+ reader,
+ fromBlock: <span class="k">await</span> reader.getBlockNumber(),
+ confirmations: <span class="s">30</span>, <span class="c">// reorg depth before a log counts</span>
+ timeoutMs: <span class="s">600_000</span>,
+ onState: (r) =&gt; console.log(r.status, r.receivedRaw)
+ }
+)</pre>
+ </div>
+ </div>
+
+ <div class="prose">
+ <h3>Payment statuses</h3>
+ <div class="card" style="padding:0;overflow-x:auto;">
+ <table>
+ <thead><tr><th>status</th><th>meaning</th><th>merchant action</th></tr></thead>
+ <tbody>
+ <tr><td><code>pending</code></td><td>nothing attributable received yet</td><td>keep waiting</td></tr>
+ <tr><td><code>underpaid</code></td><td>received, but less than expected</td><td>ask for the balance, or refund the received amount</td></tr>
+ <tr><td><code>paid</code></td><td>exactly the expected amount</td><td>fulfil the order</td></tr>
+ <tr><td><code>overpaid</code></td><td>more than expected</td><td>fulfil, then refund the overage</td></tr>
+ <tr><td><code>expired</code></td><td>window closed with nothing received</td><td>cancel the invoice</td></tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+
+ <div class="split">
+ <div class="prose">
+ <h3>Signed webhooks</h3>
+ <p>Deliveries carry a <code class="inline">hood-pay-signature: t=&lt;unix&gt;,v1=&lt;hmac-sha256&gt;</code> header over <code class="inline">"&lt;t&gt;.&lt;body&gt;"</code>. Verify it constant-time and reject stale timestamps. The payload is a hint - the ledger and watcher remain the source of truth for amounts.</p>
+ </div>
+ <div class="codewrap">
+ <button class="copy" data-copy="wh-code">Copy</button>
+ <pre id="wh-code"><span class="k">import</span> { verifyWebhookSignature, SIGNATURE_HEADER } <span class="k">from</span> <span class="s">'hood-pay/verify'</span>
+
+app.post(<span class="s">'/hooks/hood-pay'</span>, (req, res) =&gt; {
+ <span class="k">const</span> ok = verifyWebhookSignature(
+ process.env.HOOD_PAY_WEBHOOK_SECRET,
+ req.rawBody, <span class="c">// the exact bytes received</span>
+ req.get(SIGNATURE_HEADER)
+ )
+ <span class="k">if</span> (!ok) <span class="k">return</span> res.sendStatus(<span class="s">400</span>)
+ <span class="c">// event.payment.status is authoritative because the emitter read it on-chain</span>
+ res.sendStatus(<span class="s">200</span>)
+})</pre>
+ </div>
+ </div>
+
+ <div class="prose">
+ <h3>Idempotent ledger</h3>
+ <p>The SQLite ledger (<code class="inline">node:sqlite</code>, no native deps) keys transfers on <code class="inline">(txHash, logIndex)</code>, so replaying a webhook or re-running the watcher can never double-credit. Direct-mode invoices atomically reserve a unique fingerprint amount, so two invoices at the same price can never collide.</p>
+ <div class="codewrap">
+ <button class="copy" data-copy="ledger-code">Copy</button>
+ <pre id="ledger-code"><span class="k">import</span> { createLedger } <span class="k">from</span> <span class="s">'hood-pay/verify'</span>
+
+<span class="k">const</span> ledger = <span class="k">await</span> createLedger(<span class="s">'./shop.sqlite'</span>)
+<span class="k">const</span> invoice = ledger.createDirectInvoice({
+ network: <span class="s">'mainnet'</span>,
+ payTo: <span class="s">'0x4022de2D36C334E73C7a108805Cea11C0564f402'</span>,
+ token: info.usdg.address,
+ baseRaw: parseUnits(<span class="s">'25.00'</span>, <span class="s">6</span>), <span class="c">// low 4 decimals free for the fingerprint</span>
+ memo: <span class="s">'Order 1042'</span>
+})
+<span class="c">// invoice.expectedRaw carries a unique dust fingerprint the verifier matches</span></pre>
+ </div>
+ </div>
+
+ <div class="prose">
+ <h3>Refunds</h3>
+ <p>hood-pay never holds the merchant's keys. Refund helpers build the unsigned ERC-20 transfer; <code class="inline">sendRefund</code> drives a viem wallet client the merchant supplies (key from <code class="inline">ROBINHOOD_CHAIN_PRIVATE_KEY</code>, never from this library).</p>
+ <ul>
+ <li><strong>Overpaid</strong> - <code class="inline">refundOverageTx(token, result)</code> returns the overage back to the payer.</li>
+ <li><strong>Underpaid / abandoned</strong> - <code class="inline">refundReceivedTx(token, result)</code> returns everything received.</li>
+ <li><strong>Full refund</strong> - <code class="inline">buildRefundTx(token, payer, expectedRaw)</code> for any signer.</li>
+ </ul>
+ </div>
+
+ <div class="prose">
+ <h3>Runnable example</h3>
+ <p>A complete Express shop selling one digital good - ledger, verifier, and a signed webhook - lives in <code class="inline">examples/shop/</code> in the repo. <code class="inline">npm start</code> there, open the printed URL, pay in the widget, and watch the webhook fire.</p>
+ </div>
+ </div>
+ </section>
+
+ <footer>
+ <div class="wrap footer-inner">
+ <span>Built by <a href="https://x.com/nichxbt">nirholas</a> · <a href="https://three.ws">three.ws</a></span>
+ <span>All rights reserved</span>
+ </div>
+ </footer>
+
+ <script>
+ document.querySelectorAll('.copy').forEach(function (btn) {
+ btn.addEventListener('click', function () {
+ var el = document.getElementById(btn.getAttribute('data-copy'));
+ navigator.clipboard.writeText(el.innerText).then(function () {
+ btn.textContent = 'Copied'; btn.classList.add('ok');
+ setTimeout(function () { btn.textContent = 'Copy'; btn.classList.remove('ok'); }, 1400);
+ });
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/robinhood/hood-pay/examples/shop/README.md b/robinhood/hood-pay/examples/shop/README.md
new file mode 100644
index 000000000..0faa14c61
--- /dev/null
+++ b/robinhood/hood-pay/examples/shop/README.md
@@ -0,0 +1,63 @@
+# hood-pay demo shop
+
+A tiny, real merchant that sells one digital good for USDG on Robinhood Chain,
+wiring together every hood-pay piece with no mocks: the embeddable **widget**,
+the idempotent **SQLite ledger**, the reorg-safe **verifier**, and **signed
+webhooks**.
+
+## What it demonstrates
+
+1. `POST /api/checkout` reserves a unique fingerprinted amount in the ledger
+ (direct mode) and starts an on-chain watcher for that exact amount.
+2. The buyer pays in the widget - a plain USDG `transfer` of `base + dust`.
+3. The watcher confirms the transfer **on-chain** (never from the browser),
+ records it idempotently, and fires a **signed** webhook.
+4. `POST /hooks/hood-pay` (the shop's own receiver) verifies the HMAC signature
+ before trusting the event, then unlocks the download.
+5. The page polls `GET /api/checkout/:id` until `status = paid` and reveals the
+ good.
+
+## Run
+
+```bash
+npm install # installs express, viem, and hood-pay (from ../.. via file:)
+npm start # http://localhost:8788 (defaults to testnet 46630)
+```
+
+Then open the printed URL, click **Buy now**, connect an EIP-6963 wallet
+(MetaMask, Rabby, …), switch to Robinhood Chain when prompted, and pay the exact
+fingerprinted amount. The server log prints the verified webhook and the page
+reveals the good.
+
+Requires Node >= 22.5 (the ledger uses the built-in `node:sqlite`; on Node 22
+start with `node --experimental-sqlite server.js`).
+
+## Configure
+
+All optional - sensible testnet defaults are baked in.
+
+| Env | Default | Purpose |
+| --- | --- | --- |
+| `NETWORK` | `testnet` | `mainnet` (4663) or `testnet` (46630) |
+| `MERCHANT_ADDRESS` | project address | where funds land |
+| `TOKEN_ADDRESS` | USDG on `NETWORK` | the ERC-20 you accept |
+| `TOKEN_SYMBOL` / `TOKEN_DECIMALS` | `USDG` / `6` | display + math for the token |
+| `PRICE` | `1.00` | decimal price (<= 2 dp for direct mode) |
+| `PORT` | `8788` | http port |
+| `WEBHOOK_SECRET` | a demo secret | HMAC secret for webhook signatures |
+| `WEBHOOK_URL` | this shop's `/hooks/hood-pay` | point at your real receiver |
+
+> Testnet has faucet Stock Tokens and test USDG. If your test wallet holds a
+> faucet Stock Token rather than test USDG, set `TOKEN_ADDRESS` /
+> `TOKEN_SYMBOL` / `TOKEN_DECIMALS` to that token - the router and verifier are
+> token-agnostic. Stock Tokens are securities and are used here only as a
+> convenient testnet ERC-20; do not resell them.
+
+## Notes
+
+- The shop holds **no private keys**. It only reads the chain and reserves
+ invoice amounts. The buyer's wallet signs the payment.
+- Refunds (overage or abandoned invoices) use the merchant's own wallet via
+ `hood-pay/verify`'s refund helpers - see `../../docs/verify.html`.
+
+Built by [nirholas](https://x.com/nichxbt) · [three.ws](https://three.ws)
diff --git a/robinhood/hood-pay/examples/shop/package-lock.json b/robinhood/hood-pay/examples/shop/package-lock.json
new file mode 100644
index 000000000..90c5a6800
--- /dev/null
+++ b/robinhood/hood-pay/examples/shop/package-lock.json
@@ -0,0 +1,1101 @@
+{
+ "name": "hood-pay-shop-example",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "hood-pay-shop-example",
+ "version": "0.1.0",
+ "dependencies": {
+ "express": "^5.1.0",
+ "hood-pay": "file:../..",
+ "viem": "^2.55.0"
+ },
+ "engines": {
+ "node": ">=22.5"
+ }
+ },
+ "../..": {
+ "version": "0.1.0",
+ "license": "SEE LICENSE IN LICENSE",
+ "dependencies": {
+ "hood-connect": "file:../hood-connect",
+ "hoodchain": "^0.1.1"
+ },
+ "bin": {
+ "hood-pay": "bin/hood-pay.mjs"
+ },
+ "devDependencies": {
+ "@types/node": "^24.0.0",
+ "esbuild": "^0.25.0",
+ "express": "^5.1.0",
+ "tsup": "^8.5.0",
+ "tsx": "^4.20.0",
+ "typescript": "^5.8.0",
+ "viem": "^2.55.0",
+ "vitest": "^3.2.0"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "peerDependencies": {
+ "viem": "^2.55.0"
+ }
+ },
+ "node_modules/@adraffy/ens-normalize": {
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.1.tgz",
+ "integrity": "sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ==",
+ "license": "MIT"
+ },
+ "node_modules/@noble/ciphers": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz",
+ "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==",
+ "license": "MIT",
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@noble/curves": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.1.tgz",
+ "integrity": "sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/hashes": "1.8.0"
+ },
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@noble/hashes": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz",
+ "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==",
+ "license": "MIT",
+ "engines": {
+ "node": "^14.21.3 || >=16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@scure/base": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz",
+ "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@scure/bip32": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.7.0.tgz",
+ "integrity": "sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/curves": "~1.9.0",
+ "@noble/hashes": "~1.8.0",
+ "@scure/base": "~1.2.5"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@scure/bip39": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz",
+ "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==",
+ "license": "MIT",
+ "dependencies": {
+ "@noble/hashes": "~1.8.0",
+ "@scure/base": "~1.2.5"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/abitype": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.2.3.tgz",
+ "integrity": "sha512-Ofer5QUnuUdTFsBRwARMoWKOH1ND5ehwYhJ3OJ/BQO+StkwQjHw0XyVh4vDttzHB7QOFhPHa/o413PJ82gU/Tg==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/wevm"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.0.4",
+ "zod": "^3.22.0 || ^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ },
+ "zod": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/accepts": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
+ "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-types": "^3.0.0",
+ "negotiator": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/body-parser": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz",
+ "integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "^3.1.2",
+ "content-type": "^2.0.0",
+ "debug": "^4.4.3",
+ "http-errors": "^2.0.1",
+ "iconv-lite": "^0.7.2",
+ "on-finished": "^2.4.1",
+ "qs": "^6.15.2",
+ "raw-body": "^3.0.2",
+ "type-is": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/body-parser/node_modules/content-type": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
+ "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/call-bound": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "get-intrinsic": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/content-disposition": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz",
+ "integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/content-type": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie-signature": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
+ "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.6.0"
+ }
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+ "license": "MIT"
+ },
+ "node_modules/encodeurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
+ "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+ "license": "MIT"
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
+ "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
+ "license": "MIT"
+ },
+ "node_modules/express": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
+ "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "^2.0.0",
+ "body-parser": "^2.2.1",
+ "content-disposition": "^1.0.0",
+ "content-type": "^1.0.5",
+ "cookie": "^0.7.1",
+ "cookie-signature": "^1.2.1",
+ "debug": "^4.4.0",
+ "depd": "^2.0.0",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "etag": "^1.8.1",
+ "finalhandler": "^2.1.0",
+ "fresh": "^2.0.0",
+ "http-errors": "^2.0.0",
+ "merge-descriptors": "^2.0.0",
+ "mime-types": "^3.0.0",
+ "on-finished": "^2.4.1",
+ "once": "^1.4.0",
+ "parseurl": "^1.3.3",
+ "proxy-addr": "^2.0.7",
+ "qs": "^6.14.0",
+ "range-parser": "^1.2.1",
+ "router": "^2.2.0",
+ "send": "^1.1.0",
+ "serve-static": "^2.2.0",
+ "statuses": "^2.0.1",
+ "type-is": "^2.0.1",
+ "vary": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/finalhandler": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
+ "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "on-finished": "^2.4.1",
+ "parseurl": "^1.3.3",
+ "statuses": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 18.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/forwarded": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fresh": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
+ "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/hood-pay": {
+ "resolved": "../..",
+ "link": true
+ },
+ "node_modules/http-errors": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
+ "license": "MIT",
+ "dependencies": {
+ "depd": "~2.0.0",
+ "inherits": "~2.0.4",
+ "setprototypeof": "~1.2.0",
+ "statuses": "~2.0.2",
+ "toidentifier": "~1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.7.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz",
+ "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "license": "ISC"
+ },
+ "node_modules/ipaddr.js": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/is-promise": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
+ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
+ "license": "MIT"
+ },
+ "node_modules/isows": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.7.tgz",
+ "integrity": "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/wevm"
+ }
+ ],
+ "license": "MIT",
+ "peerDependencies": {
+ "ws": "*"
+ }
+ },
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/media-typer": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
+ "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/merge-descriptors": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
+ "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.54.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
+ "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",
+ "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "^1.54.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/negotiator": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
+ "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.4",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/on-finished": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
+ "license": "ISC",
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/ox": {
+ "version": "0.14.30",
+ "resolved": "https://registry.npmjs.org/ox/-/ox-0.14.30.tgz",
+ "integrity": "sha512-LI11uu+8iiM1B3CLckgd++YF1a0A2k5wDoM9ZeQMiL21BOzQs6L//BLS6hb1HSEKCyycdDIQLsVQx9MjpcC0hA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/wevm"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@adraffy/ens-normalize": "^1.11.0",
+ "@noble/ciphers": "^1.3.0",
+ "@noble/curves": "1.9.1",
+ "@noble/hashes": "^1.8.0",
+ "@scure/bip32": "^1.7.0",
+ "@scure/bip39": "^1.6.0",
+ "abitype": "^1.2.3",
+ "eventemitter3": "5.0.1"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.4.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-to-regexp": {
+ "version": "8.4.2",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz",
+ "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/proxy-addr": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
+ "license": "MIT",
+ "dependencies": {
+ "forwarded": "0.2.0",
+ "ipaddr.js": "1.9.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.15.3",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
+ "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "es-define-property": "^1.0.1",
+ "side-channel": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz",
+ "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
+ "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.7.0",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/router": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
+ "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "depd": "^2.0.0",
+ "is-promise": "^4.0.0",
+ "parseurl": "^1.3.3",
+ "path-to-regexp": "^8.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "license": "MIT"
+ },
+ "node_modules/send": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
+ "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.3",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "etag": "^1.8.1",
+ "fresh": "^2.0.0",
+ "http-errors": "^2.0.1",
+ "mime-types": "^3.0.2",
+ "ms": "^2.1.3",
+ "on-finished": "^2.4.1",
+ "range-parser": "^1.2.1",
+ "statuses": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/serve-static": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",
+ "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "parseurl": "^1.3.3",
+ "send": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+ "license": "ISC"
+ },
+ "node_modules/side-channel": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
+ "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4",
+ "side-channel-list": "^1.0.1",
+ "side-channel-map": "^1.0.1",
+ "side-channel-weakmap": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-list": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
+ "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-map": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-weakmap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3",
+ "side-channel-map": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/type-is": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
+ "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==",
+ "license": "MIT",
+ "dependencies": {
+ "content-type": "^2.0.0",
+ "media-typer": "^1.1.0",
+ "mime-types": "^3.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/type-is/node_modules/content-type": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
+ "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/viem": {
+ "version": "2.55.2",
+ "resolved": "https://registry.npmjs.org/viem/-/viem-2.55.2.tgz",
+ "integrity": "sha512-XlJeyNAZ96dQfOHlxLTK1FKgtWw/TtxENKNMBSBgxqALjiWiBWrFmSSzwwMivryKnBwkbt5E+90jSCLnVEilLA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/wevm"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@noble/curves": "1.9.1",
+ "@noble/hashes": "1.8.0",
+ "@scure/bip32": "1.7.0",
+ "@scure/bip39": "1.6.0",
+ "abitype": "1.2.3",
+ "isows": "1.0.7",
+ "ox": "0.14.30",
+ "ws": "8.21.0"
+ },
+ "peerDependencies": {
+ "typescript": ">=5.0.4"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
+ "license": "ISC"
+ },
+ "node_modules/ws": {
+ "version": "8.21.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
+ "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ }
+ }
+}
diff --git a/robinhood/hood-pay/examples/shop/package.json b/robinhood/hood-pay/examples/shop/package.json
new file mode 100644
index 000000000..8bc575eac
--- /dev/null
+++ b/robinhood/hood-pay/examples/shop/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "hood-pay-shop-example",
+ "version": "0.1.0",
+ "private": true,
+ "type": "module",
+ "description": "A tiny real merchant demo: an Express store selling one digital good for USDG, using hood-pay's widget, ledger, verifier, and signed webhooks end-to-end.",
+ "engines": {
+ "node": ">=22.5"
+ },
+ "scripts": {
+ "start": "node server.js"
+ },
+ "dependencies": {
+ "express": "^5.1.0",
+ "hood-pay": "file:../..",
+ "viem": "^2.55.0"
+ }
+}
diff --git a/robinhood/hood-pay/examples/shop/public/index.html b/robinhood/hood-pay/examples/shop/public/index.html
new file mode 100644
index 000000000..dc3bee05c
--- /dev/null
+++ b/robinhood/hood-pay/examples/shop/public/index.html
@@ -0,0 +1,114 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>hood-pay demo shop</title>
+ <style>
+ :root { color-scheme: dark; }
+ body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
+ background: #0b0e12; color: #e8edf4; line-height: 1.55; }
+ .wrap { max-width: 900px; margin: 0 auto; padding: 48px 24px; }
+ .grid { display: grid; grid-template-columns: 1fr 420px; gap: 40px; align-items: start; }
+ h1 { font-size: 1.9rem; letter-spacing: -0.03em; margin: 0 0 6px; }
+ .grad { background: linear-gradient(90deg, #00c805, #00e5a0); -webkit-background-clip: text; background-clip: text; color: transparent; }
+ .muted { color: #8b96a5; }
+ .product { background: #12161d; border: 1px solid #232a35; border-radius: 16px; padding: 26px; }
+ .price { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 14px 0; }
+ .price small { font-size: 1rem; color: #8b96a5; font-weight: 600; margin-left: 6px; }
+ button { font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px; padding: 13px 18px;
+ color: #04110a; background: linear-gradient(90deg, #00c805, #00e5a0); }
+ button:hover { filter: brightness(1.08); }
+ button[disabled] { opacity: 0.55; cursor: not-allowed; }
+ .status { margin-top: 18px; font-size: 14px; color: #8b96a5; font-variant-numeric: tabular-nums; }
+ .good { margin-top: 18px; background: #0f1720; border: 1px solid rgba(0,229,160,0.35); border-radius: 12px; padding: 18px; }
+ .good h3 { margin: 0 0 8px; color: #00e5a0; font-size: 15px; }
+ .good p { margin: 0; font-size: 14px; }
+ a { color: #00e5a0; }
+ code { font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; color: #a5d6ff; }
+ .badge { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
+ padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(255,180,84,0.4); color: #ffb454; }
+ @media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }
+ </style>
+</head>
+<body>
+ <div class="wrap">
+ <h1><span class="grad">hood-pay</span> demo shop</h1>
+ <p class="muted">One digital good, sold for USDG, verified on-chain. No payment processor.</p>
+ <div class="grid" style="margin-top:28px;">
+ <div class="product">
+ <span class="badge" id="net">…</span>
+ <h2 id="title" style="margin:12px 0 4px;">…</h2>
+ <p class="muted" id="blurb"></p>
+ <div class="price"><span id="price">…</span><small id="sym">USDG</small></div>
+ <button id="buy">Buy now</button>
+ <div class="status" id="status"></div>
+ <div class="good" id="good" style="display:none;">
+ <h3>✓ Payment verified - your download</h3>
+ <p id="good-body"></p>
+ </div>
+ </div>
+ <div>
+ <div class="product">
+ <h3 style="margin:0 0 4px;font-size:15px;">Checkout</h3>
+ <p class="muted" style="font-size:13px;margin:0 0 16px;">Connect an EIP-6963 wallet, switch to Robinhood Chain, and pay. The exact amount carries a unique fingerprint so the shop can match your payment.</p>
+ <div id="checkout"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <script src="/hood-pay.min.js"></script>
+ <script>
+ var product, invoice, poll;
+ var $ = function (id) { return document.getElementById(id); };
+
+ fetch('/api/product').then(function (r) { return r.json(); }).then(function (p) {
+ product = p;
+ $('title').textContent = p.title;
+ $('blurb').textContent = p.blurb;
+ $('price').textContent = p.price;
+ $('sym').textContent = p.token.symbol;
+ $('net').textContent = p.network + ' · ' + p.chainId;
+ });
+
+ function pollStatus(id) {
+ clearInterval(poll);
+ poll = setInterval(function () {
+ fetch('/api/checkout/' + id).then(function (r) { return r.json(); }).then(function (s) {
+ $('status').textContent = 'invoice ' + s.invoiceId.slice(0, 10) + '… · status: ' + s.status;
+ if (s.good) {
+ clearInterval(poll);
+ $('good').style.display = 'block';
+ $('good-body').textContent = s.good;
+ $('buy').disabled = false;
+ $('buy').textContent = 'Buy another';
+ }
+ });
+ }, 2500);
+ }
+
+ $('buy').addEventListener('click', function () {
+ $('buy').disabled = true;
+ $('good').style.display = 'none';
+ $('status').textContent = 'reserving an invoice…';
+ fetch('/api/checkout', { method: 'POST' }).then(function (r) { return r.json(); }).then(function (inv) {
+ if (inv.error) { $('status').textContent = 'error: ' + inv.error; $('buy').disabled = false; return; }
+ invoice = inv;
+ $('status').textContent = 'pay exactly ' + inv.amount + ' ' + inv.token.symbol + ' (fingerprinted)';
+ window.HoodPay.mount('#checkout', {
+ payTo: inv.payTo,
+ amount: inv.amount,
+ network: inv.network,
+ token: inv.token,
+ memo: inv.memo,
+ onSuccess: function (receipt) {
+ $('status').textContent = 'payment sent (' + receipt.txHash.slice(0, 12) + '…) - verifying on-chain…';
+ }
+ });
+ pollStatus(inv.invoiceId);
+ });
+ });
+ </script>
+</body>
+</html>
diff --git a/robinhood/hood-pay/examples/shop/server.js b/robinhood/hood-pay/examples/shop/server.js
new file mode 100644
index 000000000..56041f4f1
--- /dev/null
+++ b/robinhood/hood-pay/examples/shop/server.js
@@ -0,0 +1,227 @@
+/**
+ * hood-pay demo shop - a real merchant, end to end.
+ *
+ * One digital good ("The USDG Merchant's Field Guide") sold for USDG on
+ * Robinhood Chain. This wires every hood-pay piece together with NO mocks:
+ *
+ * 1. POST /api/checkout -> reserve a unique fingerprinted amount in the
+ * SQLite ledger (direct mode) and start a
+ * reorg-safe on-chain watcher for that invoice.
+ * 2. the buyer pays in the widget (public/index.html) -> a plain USDG transfer
+ * of the exact fingerprinted amount.
+ * 3. the watcher confirms the transfer on-chain (never from the DOM), records
+ * it idempotently, and fires a SIGNED webhook.
+ * 4. POST /hooks/hood-pay -> the shop's own webhook receiver verifies the
+ * signature and unlocks the download.
+ * 5. GET /api/checkout/:id -> the browser polls until status = paid and
+ * then reveals the good.
+ *
+ * Config (all optional; sensible testnet defaults):
+ * NETWORK mainnet | testnet (default testnet)
+ * MERCHANT_ADDRESS 0x… receiving address (default the project address)
+ * TOKEN_ADDRESS ERC-20 to accept (default USDG on NETWORK)
+ * TOKEN_SYMBOL display symbol (default USDG)
+ * TOKEN_DECIMALS token decimals (default 6)
+ * PRICE decimal price, <= 2 dp (default 1.00)
+ * PORT http port (default 8788)
+ * WEBHOOK_SECRET hmac secret for webhooks (default a demo secret)
+ *
+ * Run: npm install && npm start
+ */
+import { createServer } from 'node:http'
+import { fileURLToPath } from 'node:url'
+import { dirname, join } from 'node:path'
+import { readFile } from 'node:fs/promises'
+import express from 'express'
+import { formatUnits, parseUnits } from 'viem'
+import { networkInfo } from 'hood-pay'
+import {
+ awaitPayment,
+ createReader,
+ createLedger,
+ createWebhookEmitter,
+ toWebhookEvent,
+ verifyWebhookSignature,
+ SIGNATURE_HEADER,
+} from 'hood-pay/verify'
+
+const __dirname = dirname(fileURLToPath(import.meta.url))
+
+const NETWORK = process.env.NETWORK === 'mainnet' ? 'mainnet' : 'testnet'
+const info = networkInfo(NETWORK)
+const MERCHANT = process.env.MERCHANT_ADDRESS ?? '0x4022de2D36C334E73C7a108805Cea11C0564f402'
+const TOKEN_ADDRESS = process.env.TOKEN_ADDRESS ?? info.usdg.address
+const TOKEN_SYMBOL = process.env.TOKEN_SYMBOL ?? info.usdg.symbol
+const TOKEN_DECIMALS = process.env.TOKEN_DECIMALS ? Number(process.env.TOKEN_DECIMALS) : info.usdg.decimals
+const PRICE = process.env.PRICE ?? '1.00'
+const PORT = Number(process.env.PORT ?? 8788)
+const WEBHOOK_SECRET = process.env.WEBHOOK_SECRET ?? 'hood-pay-demo-secret-change-me'
+
+const PRODUCT = {
+ id: 'field-guide',
+ title: "The USDG Merchant's Field Guide",
+ blurb: 'A one-page cheat sheet for accepting USDG on Robinhood Chain without a payment processor.',
+ price: PRICE,
+ // The "digital good" delivered on payment (kept trivial - the point is the flow).
+ contents:
+ 'THANK YOU. Your USDG payment settled on-chain and this shop verified it against the ' +
+ 'ledger - not the DOM. Reference the tx hash below for your records. Reorg-safe, ' +
+ 'non-custodial, no processor took a cut.',
+}
+
+const ledger = await createLedger(join(__dirname, 'shop.sqlite'))
+const reader = createReader(NETWORK)
+const baseUrl = () => `http://localhost:${PORT}`
+
+// Deliveries are posted to the shop's OWN webhook endpoint so the demo is
+// self-contained. In production point WEBHOOK_URL at your real receiver.
+const webhook = createWebhookEmitter({
+ url: process.env.WEBHOOK_URL ?? `${baseUrl()}/hooks/hood-pay`,
+ secret: WEBHOOK_SECRET,
+})
+
+// Invoices whose payment has been verified and whose good is unlocked.
+const fulfilled = new Set()
+
+const app = express()
+
+// Capture the raw body for webhook signature verification, but still parse JSON.
+app.use(
+ express.json({
+ verify: (req, _res, buf) => {
+ req.rawBody = buf.toString('utf8')
+ },
+ }),
+)
+
+app.get('/api/product', (_req, res) => {
+ res.json({
+ ...PRODUCT,
+ network: NETWORK,
+ chainId: info.chainId,
+ token: { address: TOKEN_ADDRESS, symbol: TOKEN_SYMBOL, decimals: TOKEN_DECIMALS },
+ })
+})
+
+// Start a checkout: reserve a fingerprinted amount and begin watching for it.
+app.post('/api/checkout', async (_req, res) => {
+ try {
+ const baseRaw = parseUnits(PRODUCT.price, TOKEN_DECIMALS)
+ const invoice = ledger.createDirectInvoice({
+ network: NETWORK,
+ payTo: MERCHANT,
+ token: TOKEN_ADDRESS,
+ baseRaw,
+ memo: PRODUCT.title,
+ })
+ const fromBlock = await reader.getBlockNumber()
+ // The exact fingerprinted amount the buyer must send (base + reserved dust).
+ const amount = formatUnits(invoice.expectedRaw, TOKEN_DECIMALS)
+
+ // Watch the chain in the background. Amounts are read on-chain, never trusted
+ // from the browser. On settlement, record it and fire the signed webhook.
+ void awaitPayment(
+ {
+ token: TOKEN_ADDRESS,
+ payTo: MERCHANT,
+ expectedRaw: invoice.expectedRaw,
+ },
+ {
+ reader,
+ fromBlock,
+ confirmations: NETWORK === 'testnet' ? 3 : 30,
+ timeoutMs: 15 * 60_000,
+ },
+ ).then(async (result) => {
+ for (const transfer of result.transfers) ledger.recordTransfer(invoice.id, transfer)
+ const fresh = ledger.setStatus(invoice.id, result.status)
+ if (result.status === 'paid' || result.status === 'overpaid') fulfilled.add(invoice.id)
+ const event = toWebhookEvent(`payment.${result.status}`, invoice.id, {
+ ...result,
+ // carry ledger-known payer if the watcher attributed one
+ payer: result.payer ?? fresh.payer,
+ })
+ const delivery = await webhook.emit(event)
+ ledger.recordWebhookDelivery({
+ paymentId: invoice.id,
+ event: event.type,
+ ok: delivery.ok,
+ attempts: delivery.attempts,
+ lastError: delivery.error,
+ })
+ console.log(`[checkout ${invoice.id}] ${result.status} - webhook ${delivery.ok ? 'delivered' : 'FAILED'}`)
+ })
+
+ res.json({
+ invoiceId: invoice.id,
+ payTo: MERCHANT,
+ amount,
+ network: NETWORK,
+ memo: PRODUCT.title,
+ token: { address: TOKEN_ADDRESS, symbol: TOKEN_SYMBOL, decimals: TOKEN_DECIMALS },
+ })
+ } catch (error) {
+ res.status(400).json({ error: error instanceof Error ? error.message : String(error) })
+ }
+})
+
+// Poll invoice status. Reveals the good only once payment is verified.
+app.get('/api/checkout/:id', (req, res) => {
+ const invoice = ledger.getInvoice(req.params.id)
+ if (!invoice) return res.status(404).json({ error: 'unknown invoice' })
+ const paid = fulfilled.has(invoice.id)
+ res.json({
+ invoiceId: invoice.id,
+ status: invoice.status,
+ receivedRaw: invoice.receivedRaw.toString(),
+ payer: invoice.payer,
+ good: paid ? PRODUCT.contents : null,
+ explorer: invoice.payer ? `${info.explorerUrl}/address/${MERCHANT}` : null,
+ })
+})
+
+// The shop's own webhook receiver - verifies the signature before trusting it.
+app.post('/hooks/hood-pay', (req, res) => {
+ const header = req.get(SIGNATURE_HEADER)
+ if (!header || !verifyWebhookSignature(WEBHOOK_SECRET, req.rawBody, header)) {
+ console.warn('[webhook] rejected: bad signature')
+ return res.sendStatus(400)
+ }
+ const event = req.body
+ console.log(`[webhook] verified ${event.type} for ${event.invoiceId} (status ${event.payment.status})`)
+ res.sendStatus(200)
+})
+
+app.get('/', async (_req, res, next) => {
+ try {
+ res.type('html').send(await readFile(join(__dirname, 'public', 'index.html'), 'utf8'))
+ } catch (error) {
+ next(error)
+ }
+})
+
+// Serve the built widget bundle from the installed package.
+app.get('/hood-pay.min.js', async (_req, res, next) => {
+ try {
+ res.type('application/javascript').send(
+ await readFile(join(__dirname, 'node_modules', 'hood-pay', 'dist', 'hood-pay.min.js'), 'utf8'),
+ )
+ } catch {
+ // Fallback to the repo build during local development against file:../..
+ try {
+ res.type('application/javascript').send(
+ await readFile(join(__dirname, '..', '..', 'dist', 'hood-pay.min.js'), 'utf8'),
+ )
+ } catch (error) {
+ next(error)
+ }
+ }
+})
+
+createServer(app).listen(PORT, () => {
+ console.log(`hood-pay demo shop on ${baseUrl()}`)
+ console.log(` network: ${NETWORK} (chain ${info.chainId})`)
+ console.log(` merchant: ${MERCHANT}`)
+ console.log(` token: ${TOKEN_SYMBOL} @ ${TOKEN_ADDRESS} (${TOKEN_DECIMALS} decimals)`)
+ console.log(` price: ${PRODUCT.price} ${TOKEN_SYMBOL}`)
+})
diff --git a/robinhood/hood-pay/src/reference.ts b/robinhood/hood-pay/src/reference.ts
index 65e8e86a8..ea8e1c64d 100644
--- a/robinhood/hood-pay/src/reference.ts
+++ b/robinhood/hood-pay/src/reference.ts
@@ -3,10 +3,9 @@ import type { Hex } from 'viem'
/**
* The hood-pay reference scheme.
*
- * USDG is a plain ERC-20 with no memo field and no EIP-2612 permit (verified
- * on the Blockscout-verified implementation during the `hoodchain` SDK
- * build), so a bare `transfer` carries no way to say WHICH invoice a payment
- * settles. hood-pay solves attribution two ways:
+ * USDG is a plain ERC-20 whose `transfer` carries no memo or invoice-
+ * reference field, so a bare `transfer` has no way to say WHICH invoice a
+ * payment settles. hood-pay solves attribution two ways:
*
* 1. **Router mode** (exact attribution): the buyer pays through the
* stateless, non-custodial `HoodPayRouter` contract, which moves the
diff --git a/robinhood/hood-pay/src/tx.ts b/robinhood/hood-pay/src/tx.ts
index dc3ea541f..c1069c2fb 100644
--- a/robinhood/hood-pay/src/tx.ts
+++ b/robinhood/hood-pay/src/tx.ts
@@ -25,10 +25,9 @@ export function buildTransferTx(token: Address, payTo: Address, rawAmount: bigin
}
/**
- * Router mode, step 1: `approve(router, rawAmount)` on the token. USDG has
- * no EIP-2612 permit (verified on-chain), so an explicit approve is the
- * only allowance mechanism. hood-pay approves the EXACT invoice amount,
- * never unlimited.
+ * Router mode, step 1: `approve(router, rawAmount)` on the token. hood-pay
+ * uses an explicit approve for the router allowance (never a permit
+ * signature), approving the EXACT invoice amount, never unlimited.
*/
export function buildApproveTx(token: Address, router: Address, rawAmount: bigint): UnsignedCall {
return {
diff --git a/robinhood/hood-pay/src/verify/ledger.ts b/robinhood/hood-pay/src/verify/ledger.ts
index e614fcc75..2da2f5d6a 100644
--- a/robinhood/hood-pay/src/verify/ledger.ts
+++ b/robinhood/hood-pay/src/verify/ledger.ts
@@ -147,7 +147,11 @@ function rowToInvoice(row: InvoiceRow): LedgerInvoice {
export async function createLedger(path: string): Promise<Ledger> {
let DatabaseSync: new (path: string) => SqliteDatabase
try {
- ;({ DatabaseSync } = (await import('node:sqlite')) as unknown as {
+ // Indirect specifier: keeps esbuild from statically analyzing (and
+ // stripping the `node:` prefix off) this import. `node:sqlite` has no
+ // bare-name builtin alias, so the prefix must survive into the bundle.
+ const sqliteSpecifier = 'node:sqlite'
+ ;({ DatabaseSync } = (await import(sqliteSpecifier)) as unknown as {
DatabaseSync: new (path: string) => SqliteDatabase
})
} catch {
diff --git a/robinhood/hood-pay/tests/live/mainnet.test.ts b/robinhood/hood-pay/tests/live/mainnet.test.ts
new file mode 100644
index 000000000..d42a7f0cb
--- /dev/null
+++ b/robinhood/hood-pay/tests/live/mainnet.test.ts
@@ -0,0 +1,70 @@
+import { createPublicClient, http } from 'viem'
+import { describe, expect, it } from 'vitest'
+import { MAINNET_ADDRESSES } from 'hoodchain'
+import { networkInfo } from '../../src/networks.js'
+import { erc20Abi } from '../../src/abi.js'
+import { checkPayment, createReader } from '../../src/verify/watcher.js'
+import type { PaymentStatus } from '../../src/verify/types.js'
+
+/**
+ * LIVE, READ-ONLY tests against Robinhood Chain mainnet (chain 4663). Run with
+ * `npm run test:live`. These are NOT part of `npm test` (which is unit-only and
+ * offline). Nothing here signs, sends, or spends: every call is an `eth_call`,
+ * `eth_getLogs`, or `eth_getBlockNumber` against the public RPC. They prove the
+ * addresses and the watcher work against the real chain, and pin the two facts
+ * hood-pay's math depends on: USDG is 6 decimals and its `transfer` is a plain
+ * ERC-20 transfer (no memo/reference parameter).
+ */
+
+const info = networkInfo('mainnet')
+const client = createPublicClient({ transport: http(info.rpcUrl) })
+
+const VALID_STATUSES: PaymentStatus[] = ['pending', 'underpaid', 'paid', 'overpaid', 'expired', 'refunded']
+
+describe('live mainnet reads (chain 4663, read-only)', () => {
+ it('the RPC reports chain id 4663', async () => {
+ const chainId = await client.getChainId()
+ expect(chainId).toBe(4663)
+ })
+
+ it('USDG resolves to the SDK address and is 6 decimals', async () => {
+ expect(info.usdg.address).toBe(MAINNET_ADDRESSES.usdg)
+ const decimals = await client.readContract({
+ address: info.usdg.address,
+ abi: erc20Abi,
+ functionName: 'decimals',
+ })
+ expect(decimals).toBe(6)
+ expect(info.usdg.decimals).toBe(6)
+ })
+
+ it('USDG symbol reads as USDG on-chain', async () => {
+ const symbol = await client.readContract({
+ address: info.usdg.address,
+ abi: erc20Abi,
+ functionName: 'symbol',
+ })
+ expect(symbol).toBe('USDG')
+ })
+
+ it('the watcher scans real logs and returns a well-formed pending result', async () => {
+ const reader = createReader('mainnet')
+ const head = await reader.getBlockNumber()
+ expect(head).toBeGreaterThan(0n)
+ // A merchant address with no expected inbound USDG in a recent, confirmed
+ // window: this exercises eth_getLogs + the canonical block re-check against
+ // the live RPC and must resolve to a clean pending result.
+ const result = await checkPayment(
+ {
+ token: info.usdg.address,
+ payTo: '0x000000000000000000000000000000000000dEaD',
+ expectedRaw: 25_000_000n,
+ },
+ { reader, fromBlock: head - 500n, confirmations: 30, chunkSize: 500n },
+ )
+ expect(VALID_STATUSES).toContain(result.status)
+ expect(result.expectedRaw).toBe(25_000_000n)
+ expect(typeof result.receivedRaw).toBe('bigint')
+ expect(Array.isArray(result.transfers)).toBe(true)
+ })
+})
diff --git a/robinhood/hood-pay/tsup.config.ts b/robinhood/hood-pay/tsup.config.ts
index 41827514e..493f259f0 100644
--- a/robinhood/hood-pay/tsup.config.ts
+++ b/robinhood/hood-pay/tsup.config.ts
@@ -12,5 +12,8 @@ export default defineConfig({
clean: true,
target: 'es2022',
platform: 'neutral',
+ // `node:sqlite` is imported through an indirect specifier in
+ // src/verify/ledger.ts so esbuild cannot strip its `node:` prefix (it has no
+ // bare builtin alias). `node:crypto` / `node:events` alias fine bare.
external: ['viem', 'hoodchain', 'hood-connect', 'node:sqlite', 'node:crypto', 'node:events'],
})