Skip to content

Instantly share code, notes, and snippets.

View rubpy's full-sized avatar
💭
💥 Phosphorylating

pr3 🪤 rubpy

💭
💥 Phosphorylating
View GitHub Profile
@rubpy
rubpy / rpc_fetch_pump_global_state.ts
Created June 22, 2024 19:35
Tracking changes in Pump.fun global state (initialVirtualTokenReserves, initialVirtualSolReserves, initialRealTokenReserves, tokenTotalSupply, feeBasisPoints).
import * as web3 from "@solana/web3.js";
import bs58 from "bs58";
//////////////////////////////////////////////////
function readBytes(buf: Buffer, offset: number, length: number): Buffer {
const end = offset + length;
if (buf.byteLength < end) throw new RangeError("range out of bounds");
return buf.subarray(offset, end);
}
@rubpy
rubpy / TokenAccountMonitor.ts
Created July 17, 2024 01:00
Crude example of a gRPC/WebSocket-based Solana token price monitor.
import * as web3 from "@solana/web3.js";
import * as spl from "@solana/spl-token";
import bs58 from "bs58";
import GeyserClient, {
SubscribeRequest as GeyserSubscribeRequest,
SubscribeUpdate as GeyserSubscribeUpdate,
CommitmentLevel as GeyserCommitmentLevel,
} from "@triton-one/yellowstone-grpc";
import { ClientDuplexStream } from "@grpc/grpc-js";
import web3 from "@solana/web3.js";
import * as BufferLayout from "@solana/buffer-layout";
import bs58 from "bs58";
//////////////////////////////////////////////////
class BorshString extends BufferLayout.Layout<string> {
constructor(property?: string) {
super(-1, property);
}
import web3 from "@solana/web3.js";
import mmw from "@raydium-io/raydium-sdk";
import QuickLRU from "quick-lru";
//////////////////////////////////////////////////
export const OPAQUE_SIGNATURE = "1111111111111111111111111111111111111111111111111111111111111111";
export const SIGNATURE_PROGRAM = "Program ";
import type {
Commitment,
TransactionForAccounts,
TransactionForFullBase58,
TransactionForFullBase64,
TransactionForFullJsonParsed,
} from '@solana/rpc-types';
import type { TransactionVersion } from '@solana/transaction-messages';
import type { Address } from '@solana/addresses';
import type { Signature } from '@solana/keys';
// --- `@solana/web3.js` v1 ---
import web3 from '@solana/web3.js';
(async (rpcUrl: string) => {
const rpc = new web3.Connection(rpcUrl);
const subject = new web3.PublicKey('j1oAbxxiDUWvoHxEDhWE7THLjEkDQW2cSHYn2vttxTF');
const signatures = await rpc.getSignaturesForAddress(subject, {
limit: 1000,
}, 'finalized');
use std::str::FromStr as _;
use solana_client::{
client_error::{ClientError, ClientErrorKind},
rpc_client::GetConfirmedSignaturesForAddress2Config,
rpc_request::RpcRequest,
};
use solana_program::pubkey::Pubkey;
use solana_sdk::commitment_config::CommitmentConfig;
use solext::rpc::{Client as _, GetAllSignaturesForAddress as _, GetMarkerSignature as _};
import {
address,
createDefaultRpcSubscriptionsTransport,
createSubscriptionRpc,
} from '@solana/web3.js';
import { DEFAULT_RPC_CONFIG } from '@solana/rpc';
import { createSolanaRpcEnhancedSubscriptionsApi } from './enhanced-notifications';
// -----------------------------------------------------------------------------
import web3 from "@solana/web3.js";
import bs58 from "bs58";
//////////////////////////////////////////////////
const utf8TextDecoder = new TextDecoder("utf-8");
function decodeVariableUtf8String(buffer: Buffer, start: number, maxLength: number): string {
const end = start + maxLength;
let pos = start;
This file has been truncated, but you can view the full file.
[
{"mint":"6GatMp82G4xrijpzQX8XaVRRFac3QkGCQ1JCuGYSpump","name":"EchoBot LOL","symbol":"ECHOBT"},
{"mint":"HAkahawiL6c921fBpmfnmDtTLLGhNHVAuq9GrmmEpump","name":"butterfly","symbol":"BUTTERFLY"},
{"mint":"BgmFhJEcEfXP4zngop2iSGq3vr3vnbaGA8kXor8YJ9t5","name":"Trumpcat","symbol":"TCAT"},
{"mint":"Dg6SGuRbnuBLwfhj9a2o9W5owa4mgHACxX9aMpTL3rDs","name":"Delusionals","symbol":"DELUSIONAL"},
{"mint":"8vnqNoW5cC5Dyw2xZBm4pEXnvNEUtkZjZYnbxrsypump","name":"SOLidity ","symbol":"SOLidity"},
{"mint":"xGcvfQHMMGLZsigVQ6z8GyCz13f5uyakiP8SfQxpump","name":"THUG LIFE GLASSES","symbol":"TGG"},
{"mint":"7CfzXt5DLbDA5tSYpahYM3Q9LXReYJBphnAQ2Vkjpump","name":"hypno cat","symbol":"hypno"},
{"mint":"Btf9E81MhMhCof94B56SqyhjMtCqwdhUpM1b2yuQi1EV","name":"No. 1 sugar glider on TikTok","symbol":"Rose"},
{"mint":"B9Jca6TYQ5PnMHQwpkSCZxgPHN8PVBpd5tW8ZTRpump","name":"Coot Fox","symbol":"FOX"},