Skip to content

Add coin-gated tracks example app#14012

Merged
raymondjacobson merged 4 commits intomainfrom
ray/coin-gated-example
Mar 26, 2026
Merged

Add coin-gated tracks example app#14012
raymondjacobson merged 4 commits intomainfrom
ray/coin-gated-example

Conversation

@raymondjacobson
Copy link
Copy Markdown
Member

@raymondjacobson raymondjacobson commented Mar 26, 2026

Summary

  • New example web app at packages/web/examples/coin-gated/ demonstrating token-gated track browsing and streaming using artist coins
  • Supports two auth paths: Audius OAuth (PKCE) and direct Solana wallet signing (Phantom)
  • Uses sdk.coins.getCoinByTicker() to look up coins, sdk.users.getTracksByUser() with gateCondition: ['token'] to list gated tracks, and sdk.tracks.streamTrack() for authenticated streaming
  • Companion API changes in Add Solana wallet middleware for coin-gated streams api#738

Test plan

  • cd packages/web/examples/coin-gated && npm install && npm run dev
  • Enter a coin ticker (e.g. YAK) and verify coin info + gated tracks load
  • Sign in with Audius OAuth and verify access status updates on tracks
  • Connect Phantom wallet and verify wallet-based streaming works
  • Verify locked tracks show disabled play button when not authenticated

🤖 Generated with Claude Code

Example web app demonstrating how to browse and stream token-gated
tracks using an artist coin. Supports two auth paths: Audius OAuth
(PKCE) and direct Solana wallet signing via Phantom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 26, 2026

⚠️ No Changeset found

Latest commit: 5284815

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14012.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

raymondjacobson added a commit to AudiusProject/api that referenced this pull request Mar 26, 2026
## Summary
- New `solanaWalletMiddleware` verifies ed25519 signatures from
`X-Solana-Wallet`, `X-Solana-Message`, `X-Solana-Signature` headers
- New `checkSolanaWalletTokenAccess` helper performs real-time on-chain
token balance checks via Solana RPC (derives ATA, calls
`GetTokenAccountBalance`)
- Stream endpoint (`v1TrackStream`) falls back to Solana wallet balance
check when standard access check fails, enabling coin-gated streaming
for non-Audius wallets
- Exported `BuildMediaLink` from `dbv1` package to support building
stream URLs in the fallback path
- Companion example app in AudiusProject/apps#14012

## Test plan
- [ ] Verify existing stream endpoint works unchanged for
OAuth-authenticated users
- [ ] Test Solana wallet headers with valid ed25519 signature → stream
succeeds for wallets holding sufficient tokens
- [ ] Test invalid/missing signature headers → 401 error
- [ ] Test wallet with insufficient token balance → 403 error
- [ ] Verify middleware is no-op when no Solana headers are present

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@raymondjacobson raymondjacobson merged commit 7a495ed into main Mar 26, 2026
8 checks passed
@raymondjacobson raymondjacobson deleted the ray/coin-gated-example branch March 26, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant