Skip to content

Instantly share code, notes, and snippets.

@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)
@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 / mcp-response.json
Created June 11, 2025 20:25
OpenAI MCP network call
{
"connector": {
"id": "connector_6849e5b098d4819183df84983fb13a6e",
"created_at": "2025-06-11T20:23:12.597222Z",
"connector_type": "MCP",
"name": "Solana Developer Resources",
"description": "Returns the most up to date resources for documentation across the Solana ecosystem",
"service": "https://mcp.solana.com",
"logo_url": null,
"logo_url_dark": null,
@ngundotra
ngundotra / enriched_nodes.json
Last active June 2, 2025 03:57
Living IP Enriched Json
This file has been truncated, but you can view the full file.
[
{
"key": "def_valueBasedHealthCare",
"title": "Value-Based Health Care",
"definition": "Value-based health care, which focuses on measuring health outcomes and costs",
"lines": [
"3-4"
],
"article_id": "9b72d5ebf17648c3a68e95fa57f1542b",
@ngundotra
ngundotra / classes-v0.json
Last active May 19, 2025 13:34
All Classes - Logical Data v0
[
{
"catalogType": "definitions",
"items": [
{
"key": "Def_0to1Innovation",
"title": "0 to 1 Innovation",
"definition": "Intensive progress involves going from 0 to 1 (not simply the 1 to n of globalization).",
"lines": [
"assay3:41",
@ngundotra
ngundotra / lighthouse.codama.json
Created December 31, 2024 15:36
Lighthouse Codama With No Hook Links
{"kind":"rootNode","standard":"codama","version":"1.2.0","program":{"kind":"programNode","name":"lighthouse","publicKey":"L2TExMFKdjpN9kozasaurPirfHy9P8sbXoAN1qA3S95","version":"2.0.0","origin":"shank","docs":[],"accounts":[],"instructions":[{"kind":"instructionNode","name":"memoryWrite","docs":[],"optionalAccountStrategy":"programId","accounts":[{"kind":"instructionAccountNode","name":"programId","isWritable":false,"isSigner":false,"isOptional":false,"docs":["Lighthouse program"],"defaultValue":{"kind":"programIdValueNode"}},{"kind":"instructionAccountNode","name":"systemProgram","isWritable":false,"isSigner":false,"isOptional":false,"docs":["System program"],"defaultValue":{"kind":"publicKeyValueNode","publicKey":"11111111111111111111111111111111","identifier":"splSystem"}},{"kind":"instructionAccountNode","name":"payer","isWritable":true,"isSigner":true,"isOptional":false,"docs":["Payer account"],"defaultValue":{"kind":"payerValueNode"}},{"kind":"instructionAccountNode","name":"memory","isWritable":true,"i
@ngundotra
ngundotra / parseLighthouseTx.ts
Last active December 31, 2024 15:37
Parse Lighthouse Instructions
import {
address,
createSolanaRpc,
getBase58Decoder,
getBase58Encoder,
signature,
} from "@solana/web3.js";
import { parseInstructionData } from "@codama/dynamic-parsers";
import { readFileSync } from "fs";
@ngundotra
ngundotra / tensor.ts
Last active November 20, 2023 19:35
tensorBuySell.ts
import { AnchorProvider, Wallet } from "@project-serum/anchor";
import {
Connection,
Keypair,
MessageV0,
PublicKey,
TransactionInstruction,
VersionedMessage,
VersionedTransaction,
AccountMeta,
@ngundotra
ngundotra / spl-gov-idl.json
Created August 18, 2022 21:29
Mostly functional SPL Gov Anchor IDL
{
"version": "0.1.0",
"name": "governance",
"instructions": [
{
"name": "createRealm",
"accounts": [
{
"name": "governanceRealmAccount",
"isMut": true,
import { Metaplex, keypairIdentity, bundlrStorage } from '@metaplex-foundation/js';
import { Connection, Keypair, clusterApiUrl } from '@solana/web3.js';
import { readFileSync } from 'fs';
async function sleep(delay: number) {
return new Promise((resolve) => {
setTimeout(() => resolve(null), delay);
});
}