mirror of
https://github.com/Such-Software/hash-wallet-prices.git
synced 2026-10-17 05:51:28 +02:00
- 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).
24 lines
762 B
TOML
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
|