Skip to content

[SDK Example] Add coin-gated text posts to coin-gated web example#14252

Open
dylanjeffers wants to merge 1 commit intomainfrom
claude/distracted-jepsen-e93e01
Open

[SDK Example] Add coin-gated text posts to coin-gated web example#14252
dylanjeffers wants to merge 1 commit intomainfrom
claude/distracted-jepsen-e93e01

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

Extends the existing packages/web/examples/coin-gated/ Vite/React example to also fetch and display coin-gated fan-club text posts, so devs can verify that connecting a Solana wallet through the SDK correctly decrypts members-only post bodies for holders of the artist's coin.

  • App.tsx: new useFanClubPosts hook calling sdk.comments.getFanClubFeed({ mint, userId, sortMethod: 'newest' }), query key includes walletPubkey so connect/disconnect refetches automatically. UI shows a Members-only/Public badge plus an Access granted/Locked indicator per post; locked posts render a placeholder, unlocked ones render the full message body.
  • index.css: styles for the new post list.
  • README: adds a "Verifying coin-gated text posts work via Solana wallet auth" walkthrough and references getFanClubFeed/X-Solana-Wallet for SDK search.

The relevant SDK plumbing already exists: sdk.solanaWallet.auth(provider) stores {publicKey, message, signature} and addSolanaWalletSignatureMiddleware injects X-Solana-Wallet/X-Solana-Message/X-Solana-Signature on every request, which the API uses to gate fan-club content by holdings (CommentsAPI.getFanClubFeed: "API enforces holder gate").

Test plan

  • npm install && npm run build -w @audius/sdk, then cd packages/web/examples/coin-gated && cp .env .env.local (set VITE_AUDIUS_API_KEY), npm install, npm run dev -> opens http://localhost:5178
  • Browse a coin whose creator has at least one members-only fan-club text post (e.g. YAK)
  • Without auth: members-only posts show Locked with placeholder body; public posts show full body
  • Click Connect Solana Wallet with a Phantom wallet that holds the coin, approve the signature -> members-only posts refetch and show the full message + Access granted
  • Click Disconnect -> members-only posts return to Locked
  • Optional: Sign in with Audius (OAuth) using an account whose linked wallet holds the coin -> same gating effect via OAuth path

🤖 Generated with Claude Code

Extends the coin-gated example to also fetch and display members-only
fan-club text posts via `sdk.comments.getFanClubFeed`. Verifies that
when a Solana wallet holding the artist coin is connected through the
SDK, the API decrypts members-only post bodies via X-Solana-* headers.

- App.tsx: `useFanClubPosts` hook keyed on wallet pubkey + userId so
  connecting/disconnecting refetches; renders a Members-only/Public
  badge plus Access granted/Locked indicator per post.
- index.css: styles for the new post list.
- README: adds verification walkthrough and getFanClubFeed reference.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 6, 2026

⚠️ No Changeset found

Latest commit: 8e22def

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 May 6, 2026

🌐 Web preview ready

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

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

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