Files
hash-wallet-prices/wrangler.toml
T
jwinterm 4f7c515808 Add Trocador webhook receiver, trade-status cache, and sparkline history
- POST /v1/trocador-webhook: Trocador hits this on every trade status change;
  stored in KV under trade:<id> for 14 days (matching Trocador's retention).
- GET /v1/trade/🆔 returns the cached trade body so the wallet can poll us
  instead of Trocador, dramatically reducing load on their infra per their
  commercial team's request.
- GET /v1/sparkline?coin=BTC&hours=24: returns hourly history points for
  rendering balance sparklines. Cron appends one entry per UTC hour per coin,
  capped at 168 points (1 week).
2026-05-14 15:57:17 -04:00

24 lines
762 B
TOML

name = "hash-wallet-prices"
main = "src/index.ts"
compatibility_date = "2026-05-14"
workers_dev = true
# KV namespace for cached prices.
# Run `wrangler kv:namespace create PRICES` once, then paste the returned id below.
# (The script also works without KV — it falls back to fetching upstream on each request.)
[[kv_namespaces]]
binding = "PRICES"
id = "ccd6f69c03f14d9b8317eeaed2bf9f23"
# Run the refresh every 60 seconds.
# Cloudflare cron triggers fire once per minute at minimum.
[triggers]
crons = ["* * * * *"]
# Custom domain. Will be auto-bound to neroswap.com's DNS zone via the
# Cloudflare Workers UI when you "Add Custom Domain" — you do NOT create a
# CNAME manually for this.
[[routes]]
pattern = "prices.neroswap.com"
custom_domain = true