cookbook tokens: point Token-2022 fetch examples at mainnet#1467
cookbook tokens: point Token-2022 fetch examples at mainnet#1467catmcgee wants to merge 1 commit into
Conversation
get-token-account and get-token-balance hit Token-2022 accounts that the docs Run-button surfnet doesn't lazy-clone cleanly (the rewriter swaps localhost for the hosted surfnet, which returns null for these two). Other read-only pages still work because their accounts are classic-Token / Token Program itself, which surfnet does have. Switch the URL to api.mainnet.solana.com so the Run button leaves it alone and the code hits real mainnet. Token-2022 logic stays.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 6 Skipped Deployments
|
Greptile SummaryThis PR fixes three Token-2022 cookbook examples (
Confidence Score: 5/5Safe to merge — all changes are single-line URL swaps in read-only cookbook examples with no logic modifications. Every changed file replaces http://localhost:8899 with https://api.mainnet.solana.com, which is the current official Solana mainnet endpoint documented at solana.com/docs/rpc. All three examples perform only read-only RPC calls on known, stable mainnet accounts, and the vitest tests import the modules end-to-end, so the fix is exercised on each test run. The only observable difference in CI is that these three tests now call the public mainnet RPC directly rather than through the surfnet proxy, introducing a mild rate-limit dependency, but this is consistent with how the playground is intended to work post-fix. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User as Docs Playground User
participant Rewriter as Surfnet URL Rewriter
participant Surfnet as Hosted Surfnet
participant Mainnet as api.mainnet.solana.com
Note over User,Mainnet: Before this PR (localhost:8899)
User->>Rewriter: Run example (localhost:8899)
Rewriter->>Surfnet: Rewrites to hosted surfnet
Surfnet-->>User: null (Token-2022 accounts not cloned)
Note over User,Mainnet: After this PR (api.mainnet.solana.com)
User->>Rewriter: Run example (api.mainnet.solana.com)
Rewriter-->>User: URL left unchanged (not localhost)
User->>Mainnet: Direct RPC call
Mainnet-->>User: Token-2022 account data ✓
Reviews (1): Last reviewed commit: "cookbook tokens: point Token-2022 fetch ..." | Re-trigger Greptile |
|
closing as we're just going to fix surfpool instead |
Problem
get-token-account, get-token-balance, and get-token-mint hit Token-2022 accounts that the surfnet doesn't lazy-clone cleanly (the rewriter swaps localhost for the hosted surfnet, which returns null for these two)
Other read-only pages still work because their accounts are classic-Token / Token Program itself, which surfnet does have
Summary of Changes
Switch the URL to api.mainnet.solana.com so the Run button leaves it alone and the code hits mainnet