Hope Wallet SDK
Docs
Session API
Four HTTP routes the SDK polls so phone-camera connect can POST proof to your origin.
Implement on the same HTTPS origin as the page. Serverless hosts (Vercel) need a shared store — Redis/KV or Explorer’s hope_wallet_link_* RPCs — not an in-memory Map.
| Method | Path | Purpose |
|---|---|---|
| POST | /api/hope-wallet/sessions | Create { session_id, status: pending } |
| GET | /api/hope-wallet/sessions/:id | Row for the SDK poll |
| DELETE | /api/hope-wallet/sessions/:id | cancelled |
| POST | /api/hope-wallet/sessions/:id/confirm | Wallet posts { session_id, address, pubkey_base64? } |
Poll every 1.5s until status === "connected" or 5 minutes.
This portal implements the four routes. On production they persist through Explorer pairing RPCs so create, phone confirm, and GET can hit different instances.
Recommended row shape:
{
"session_id": "cs_...",
"status": "pending",
"address": null,
"pubkey_base64": null,
"created_at": "2026-08-19T00:00:00.000Z",
"expires_at": "2026-08-19T00:05:00.000Z"
}Transition rules:
- create:
pending - confirm from wallet:
connected+ storeaddressandpubkey_base64 - cancel from page:
cancelled - TTL expiry: treat as expired / missing
What the SDK expects from GET /sessions/:id:
- the same
session_id statusaddresswhen connected- optional
pubkey_base64
Copy-paste: package docs/hosted/sessions.ts.
