Skip to content

Instantly share code, notes, and snippets.

@ngundotra
ngundotra / SurfpoolBugReport.md
Last active July 2, 2025 11:31
Surfpool Error Repro

Surfpool RPC Response Parsing Error

Issue Description

When sending transactions that result in errors through surfpool, the Python solana-py client crashes with a panic instead of handling the error gracefully:

thread '<unnamed>' panicked at crates/rpc-responses/src/lib.rs:363:84:
called `Result::unwrap()` on an `Err` value: Error("missing field `data`", line: 0, column: 0)
@ngundotra
ngundotra / solana-x402-flow.md
Last active July 3, 2025 14:01
Solana x402 Permanent Delegate

x402 on Solana: Permanent Delegate Flow

Flow Diagram

sequenceDiagram
    participant User as User<br/>(Has: Wallet, xUSDC)<br/>(Knows: Sign messages)
    participant Client as Client App<br/>(x402 SDK)
    participant Server as Resource Server<br/>(Has: Solana wallet)<br/>(Knows: Basic web)
    participant Facilitator as Facilitator<br/>(Has: Permanent Delegate)<br/>(Knows: Solana txs)
sequenceDiagram
  participant Client
  participant Server
  participant Facilitator

  Client->>Server: GET /api
  Server->>Client: HTTP 402 - Payment Required with { extra: { account: pubkey } }
  Client->>Solana: GET /blockhash
 Client-&gt;&gt;Client: Form templated transaction, cosign, serialize
@ngundotra
ngundotra / top-sas-issuers.ts
Created July 11, 2025 18:50
Get Top SAS Issuers
import {
createSolanaRpc,
getBase58Codec,
getBase64Encoder,
type Address,
type Base58EncodedBytes,
type Codec,
type GetProgramAccountsDatasizeFilter,
type GetProgramAccountsMemcmpFilter,
type Lamports,
@ngundotra
ngundotra / usdc-transfer.ts
Created July 24, 2025 19:40
Solana Transfer Test (Priority Fee)
import {
Connection,
Keypair,
PublicKey,
Transaction,
ComputeBudgetProgram,
sendAndConfirmTransaction,
VersionedTransaction,
TransactionMessage
} from '@solana/web3.js';
@ngundotra
ngundotra / surfpool-jupiter-test.ts
Last active August 14, 2025 19:14
Surfpool-Jupiter Transaction
/**
* Jupiter Swap Test Transaction for Surfpool
* Creates a test transaction that can be executed in the Surfpool environment
* bun run surfpool-jupiter-test.ts
*/
import {
Connection,
PublicKey,
VersionedTransaction,