Skip to content

Fix solana wallet context propagation#743

Merged
raymondjacobson merged 2 commits intomainfrom
ray/solana-wallet-context
Mar 28, 2026
Merged

Fix solana wallet context propagation#743
raymondjacobson merged 2 commits intomainfrom
ray/solana-wallet-context

Conversation

@raymondjacobson
Copy link
Copy Markdown
Member

Summary

  • Use c.Locals() instead of c.SetUserContext(context.WithValue(...)) to store the verified wallet
  • All handlers pass c.Context() (fasthttp RequestCtx) to the DB layer, not c.UserContext() — so values set via c.SetUserContext were invisible to TracksKeyed's ctx.Value("solanaWallet") call
  • c.Locals() stores via fasthttp SetUserValue, and RequestCtx.Value() delegates to UserValue(), so the wallet is now visible through c.Context()

Test plan

  • Existing TestSolanaWalletMiddleware passes (updated to read via c.Context().Value() to match real handler behavior)
  • Connect Solana wallet in coin-gated example → tracks with sufficient balance show access.stream: true

🤖 Generated with Claude Code

raymondjacobson and others added 2 commits March 27, 2026 18:01
The middleware now sets the verified wallet on the Go context
(c.SetUserContext) in addition to fiber Locals. TracksKeyed reads
it from ctx.Value, so every endpoint that fetches tracks gets
wallet-based token gate checks automatically — no per-handler
wiring needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…UserContext

Handlers pass c.Context() (fasthttp RequestCtx) to the DB layer, not
c.UserContext() (Go context.Context). Values set via c.SetUserContext
were invisible to TracksKeyed's ctx.Value("solanaWallet") call.

c.Locals() stores via fasthttp SetUserValue, which RequestCtx.Value()
delegates to — so the wallet is now visible through c.Context().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@raymondjacobson raymondjacobson force-pushed the ray/solana-wallet-context branch from 3604020 to 8069e9a Compare March 28, 2026 01:01
@raymondjacobson raymondjacobson merged commit 85beca9 into main Mar 28, 2026
5 checks passed
@raymondjacobson raymondjacobson deleted the ray/solana-wallet-context branch March 28, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant