Skip to content
This repository was archived by the owner on Apr 3, 2026. It is now read-only.

threshold-network/tbtcscan_website_info

 
 

Repository files navigation

tBTC website

Provide insight into the workings of the tBTC systems - deposits, redemptions, who bonds for what, governance actions, etc.

It incorporates work from️:

@miracle2k: Thanks for his allthekeep subgraph.

Live at : https://tbtcscan.com/

Deploying to Cloudflare (Wrangler)

Prereqs (one-time per machine):

  • corepack enable so yarn v1.22.22 is available.
  • npm i -g wrangler or let npx wrangler auto-install.
  • Authenticate: npx wrangler login (opens browser) or npx wrangler login --browser none and paste the URL/token flow in a headless shell.

Config highlights:

  • wrangler.jsonc sets the Worker entry (worker.js) and serves static assets from dist using the ASSETS binding.
  • SPA fallback is handled in worker.js by returning index.html on 404s.

One-liner deploy (production):

scripts/deploy-cloudflare.sh prod

What the script does:

  1. Rewrites .graphclientrc.yml for the chosen target (prod or staging).
  2. Runs yarn codegen.
  3. Builds (yarn build-prod or yarn build:staging) into dist/.
  4. Runs npx wrangler deploy using wrangler.jsonc.

Manual deploy (if you prefer explicit steps):

MODE=production ./scripts/set-graph-endpoint.sh production
yarn codegen
yarn build-prod           # or yarn build:staging
npx wrangler deploy

Subgraph proxy and codegen

  1. Environment files

    • .env.production and .env.staging define VITE_SUBGRAPH_PROXY_BASE plus explicit overrides VITE_SUBGRAPH_PROXY_MAINNET / VITE_SUBGRAPH_PROXY_TESTNET for each environment.
    • yarn build uses .env.production; yarn build:staging uses .env.staging. Local dev can override inline, e.g. VITE_SUBGRAPH_PROXY_BASE=... yarn start.
  2. Codegen endpoint

    • Graphclient reads its endpoint from .graphclientrc.yml; env interpolation was unreliable, so we rewrite that file before codegen/build.
    • Use scripts/set-graph-endpoint.sh staging|prod to set .graphclientrc.yml to the correct proxy before yarn codegen.
  3. Common commands (endpoint + codegen + build)

    • yarn start:staging: set staging endpoint → yarn codegenyarn build:stagingyarn preview.
    • yarn start:prod: set prod endpoint → yarn codegenyarn build-prodyarn preview.
    • yarn deploy:staging / yarn deploy:prod: set endpoint → yarn codegen → build (no preview). Use these for CI or manual deploys.
  4. CORS expectations (proxy side)

    • Staging proxy allows http://localhost:4001 for local preview.
    • Production proxy allows https://tbtcscan.com and https://threshold.network only.
  5. Preflight checklist

    • Confirm you edited the right env file for the target (.env.production or .env.staging).
    • Run scripts/set-graph-endpoint.sh staging|prod (or rely on the commands above) so .graphclientrc.yml matches the build target.
    • Run yarn codegen after switching endpoints.
    • (Optional) Run scripts/which-endpoint.sh to print the active codegen endpoint and current proxy env values.

Installation

git clone https://github.com/suntzu93/tbtcv2_website_info.git
cd tbtcv2_website_info
npm install -g yarn
yarn install
yarn codegen

# run in dev mode
yarn start

# run in produce mode
yarn build-prod
yarn preview

# http://localhost:4401

``

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 90.3%
  • CSS 7.4%
  • HTML 1.2%
  • Other 1.1%