Sharematch Web App

Feature documentation — all functionality explained

Solana Devnet v1.3 — March 2026 Internal Ops Tool
What is the Sharematch Web App?

The Sharematch Web App is a lightweight, single-page internal operations tool that gives the team real-time visibility and control over the Sharematch custodial treasury on Solana Devnet. It connects directly to the Sharematch REST API (api.sharematch.me), which in turn communicates with two on-chain Anchor programs: Treasury and Markets.


How the stack fits together

sharematch-web
Static HTML/JS
nginx on GCP
port 8080
sharematch-api
NestJS REST API
Docker on GCP
api.sharematch.me
Solana Devnet
Treasury Program
Markets Program
SPL Token accounts

Both the web app and API run as Docker containers in docker-compose on GCP instance instance-20260306-093803 (us-central1-c). The web container serves static files via nginx. The API container runs on port 3000 and is reverse-proxied to api.sharematch.me.

All functionality on the page

🔍
User Account Lookup
Fetch on-chain addresses and live token balances for any Sharematch user
Always Visible

The primary input at the top of the page. Enter a Sharematch User ID (UUID format) and click Look up (or press Enter). The app fires two API calls in parallel and populates the results section below.

1
Type or paste a UUID user ID into the input field — e.g. 23a81421-e3d6-acf7-d2f3-b774d6d7c242
2
Click Look up. Two API calls fire simultaneously — /derive (pure math, no RPC) and /balance (live Solana RPC).
3
Results expand below: QR code, on-chain addresses, live balances, and the deposit form — all pre-populated.
GET https://api.sharematch.me/users/{userId}/derive
Derives UserState PDA, SMT ATA, and USDC ATA deterministically from the UUID — no on-chain call needed.
Example Response
{
  "userId":       "23a81421-e3d6-acf7-d2f3-b774d6d7c242",
  "userStatePda": "HxNXMtaVSs6JBJ99znmkDy5AQgPE8s3PWTKzTJCfBPgt",
  "smtAta":       "CxU7Nn2TzCFDQC6Awgc34Wa9yNrtEJ9DXZKyimipFRne",
  "usdcAta":      "9Hk3m...USDC ATA address"
}
GET https://api.sharematch.me/users/{userId}/balance
Reads live token account balances from the Solana RPC for the user's SMT and USDC ATAs.
Example Response
{
  "smtBalance":  1250.00,
  "usdcBalance": 0.00
}
📱
QR Code — USDC Deposit Address
Scannable wallet address for funding a user account
Post-Lookup

After a successful lookup, a QR code is generated client-side from the user's USDC Associated Token Account (ATA) address. Scanning it with any Solana-compatible wallet app opens a payment to that address. The address is also displayed as text and can be clicked to copy to the clipboard.

The QR code encodes the UserState PDA's USDC ATA — not a personal wallet. USDC sent here is swept by the operator and converted to SMT 1:1 via the Process Deposit instruction on-chain.
🔗
On-chain Addresses
All three Solana addresses linked to a user account, with direct Explorer links
Post-Lookup

Displays the three core addresses derived for every Sharematch user. Each address links directly to Solana Explorer (Devnet) in a new tab.

AddressTypeDescription
UserState PDA Program Account The user's on-chain state account, owned by the Treasury program. Seeds: ["user", user_id_bytes]
SMT ATA Token Account Associated Token Account for SMT (Sharematch Token) owned by the UserState PDA
USDC ATA Token Account Associated Token Account for USDC owned by the UserState PDA — this is the deposit address
💰
Live User Balances
Real-time SMT and USDC token balances for the looked-up user
GET

Displays the live on-chain token balances for the user's SMT and USDC token accounts. Values are fetched in parallel with the derive call during lookup and formatted to up to 6 decimal places. SMT balances are shown in purple, USDC in green.

Balances are snapshot values fetched at lookup time. Re-run the lookup to refresh them after a deposit or withdrawal.
📖
API Explorer Card
Quick link to the interactive Swagger UI for all API endpoints
Always Visible

A card sitting below the user lookup form links directly to the Sharematch REST API's Swagger UI documentation at https://api.sharematch.me/api/docs. There is also a pill-shaped API Docs button in the top-right header for quick access from anywhere on the page.

The Swagger UI lets you browse all endpoints, inspect request/response schemas, and execute live API calls directly in the browser — useful for testing or exploring the full capability of the API beyond what the web app exposes.

https://api.sharematch.me/api/docs
Interactive Swagger / OpenAPI documentation for all Treasury and Admin endpoints.
🏦
Treasury Wallet Balance
Live SMT and USDC balances for the operator/admin wallet — loads automatically on page visit
GET

Always visible at the bottom of the page. On every page load the app calls GET /admin/treasury-balance, which reads the operator keypair on the server, derives its SMT and USDC token accounts, and returns live balances. A Refresh button allows re-fetching at any time without reloading the page.

FieldTypeDescription
wallet string Base58 public key of the operator wallet — currently 8BTN2sJUBYa12u9sdUc9AbMknPrTE6DHrGYoDVey7wok
smtBalance number SMT token balance held in the operator's SMT ATA
usdcBalance number USDC token balance held in the operator's USDC ATA — this is where swept deposits land
GET https://api.sharematch.me/admin/treasury-balance
Server reads the operator keypair from /secrets/operator-keypair.json and returns live on-chain balances.
Example Response
{
  "wallet":      "8BTN2sJUBYa12u9sdUc9AbMknPrTE6DHrGYoDVey7wok",
  "smtBalance":  0.00,
  "usdcBalance": 38.00
}
⬇️
Process Deposit
Sweep USDC into the treasury and mint SMT 1:1 for a user — appears after a successful lookup
POST

After looking up a user, a Process Deposit form appears pre-filled with the user's ID and a freshly generated deposit hash. This calls the on-chain process_deposit instruction via the API, which sweeps USDC from the user's ATA to the treasury and mints an equivalent amount of SMT 1:1 to the user.

1
User ID — auto-filled (read-only) from the lookup. Cannot be changed without running a new lookup.
2
Amount (USDC) — enter in whole USDC (e.g. 50). The app automatically multiplies by 1,000,000 to convert to micro-units before sending.
3
Deposit Hash — a 64-character hex string used as an idempotency key on-chain. Auto-generated using crypto.getRandomValues(). Click Regen to generate a new one, or paste your own blake3 hash.
4
Click + Process Deposit. On success, the Solana transaction signature is shown in green. A new deposit hash is auto-generated ready for the next deposit.
POST https://api.sharematch.me/users/{userId}/deposit
Operator signs a process_deposit transaction on-chain — idempotent via a DepositReceipt PDA keyed on the hash.
Request Body
{
  "amount":      50000000,  // USDC in micro-units (50 USDC = 50,000,000)
  "depositHash": "a3f1c2d4...64 hex chars"  // blake3 idempotency key
}
Success Response
{
  "signature": "5J8xKqP...Solana tx signature"
}
ValidationRuleBehaviour
userIdRequiredError shown if no lookup has been run yet
amount> 0Blocks submission with inline error
depositHashExactly 64 hex charsAuto-generated if blank; validated before sending
The deposit hash is a one-time idempotency key. Re-submitting the same hash for the same user will be rejected on-chain because the DepositReceipt PDA already exists. The UI automatically regens the hash after each successful deposit.

SMT and USDC on Solana Devnet

TokenMint AddressRole
SMT 7oqAQc5ZSyk2JSmtS79DncwtxQBwRfgvQYCt1V9VZgmU Sharematch's internal token. Minted 1:1 when USDC is deposited. Burned when USDC is withdrawn. Used as collateral in the Markets program.
USDC 4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU Devnet USDC (test token). The external settlement currency. Held in the treasury after deposit sweeps.

Deposit flow: User sends USDC → operator calls process_deposit → USDC moves to operator's treasury ATA → SMT minted 1:1 to user's SMT ATA.

Withdrawal flow: User requests withdrawal → operator queues it → admin executes after delay → SMT burned → USDC transferred to destination.

Recent changes to the web app

2026-03-07 — commit a593eb8
Process Deposit form added
  • Deposit card appears in results section after a successful user lookup
  • User ID auto-filled (read-only) from lookup; Amount entered in whole USDC and auto-converted to micro-units
  • Deposit hash auto-generated using crypto.getRandomValues() with a Regen button
  • On success: tx signature shown in green; hash regenerated automatically
  • Calls POST /users/{userId}/deposit
2026-03-07 — commit cfc41a6
Treasury Wallet balance card added
  • New always-visible card showing the operator wallet pubkey and live SMT/USDC balances
  • Loads automatically on page visit; Refresh button for on-demand updates
  • New API endpoint GET /admin/treasury-balance added to the NestJS API
  • API reads operator keypair from /secrets/operator-keypair.json and queries live Solana RPC balances
2026-03-07 — commit de57a6c
Initial web app — User Lookup + API Docs link
  • Static HTML/nginx deployed to GCP, served at sharematch.me
  • User Account Lookup with UUID input, parallel derive + balance API calls
  • QR code generated client-side for the USDC deposit address (click-to-copy)
  • On-chain addresses panel with Solana Explorer links (Devnet)
  • Live SMT and USDC balance display for the user's PDA
  • API Docs pill button in header + API Explorer card linking to Swagger UI
  • GitHub repo MR-Coder-Coder/sharematch-web created

All endpoints called by the web app

GET /users/{userId}/derive
Derives UserState PDA, SMT ATA, USDC ATA from a UUID. Pure math — no Solana RPC call.
GET /users/{userId}/balance
Returns live SMT and USDC token account balances for the user's PDA-owned ATAs via Solana RPC.
POST /users/{userId}/deposit
Executes the on-chain deposit instruction — sweeps USDC and mints SMT 1:1. Body: { amount, depositHash }
GET /admin/treasury-balance
Returns the operator wallet pubkey and its live SMT + USDC balances. No body required.

The full API — including user creation, LP credit, withdrawal management, and markets — is documented at api.sharematch.me/api/docs.