Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: upgrade agent-payments-sdk to v3.1.0 with v2 bonding curve support
nirholas1146e4427a73
diff --git a/agent-payments-sdk/package.json b/agent-payments-sdk/package.jsonindex 595b4209d..af26f3258 100644--- a/agent-payments-sdk/package.json+++ b/agent-payments-sdk/package.json@@ -1,11 +1,11 @@{"name": "@pump-fun/agent-payments-sdk",- "version": "3.0.1",+ "version": "3.1.0","description": "TypeScript SDK for Pump Agent Payments","publishConfig": {"access": "public"},- "author": "Pump Fun",+ "author": "nirholas","license": "ISC","type": "module","main": "./dist/index.cjs",@@ -17,15 +17,30 @@"import": "./dist/index.js","require": "./dist/index.cjs"},+ "./evm": {+ "types": "./dist/evm/index.d.ts",+ "import": "./dist/evm/index.js",+ "require": "./dist/evm/index.cjs"+ },+ "./solana": {+ "types": "./dist/solana/index.d.ts",+ "import": "./dist/solana/index.js",+ "require": "./dist/solana/index.cjs"+ },+ "./solana/legacy-agent-payments": {+ "types": "./dist/solana/legacy-agent-payments/index.d.ts",+ "import": "./dist/solana/legacy-agent-payments/index.js",+ "require": "./dist/solana/legacy-agent-payments/index.cjs"+ },+ "./solana/solana-agent-kit": {+ "types": "./dist/solana/solana-agent-kit/index.d.ts",+ "import": "./dist/solana/solana-agent-kit/index.js",+ "require": "./dist/solana/solana-agent-kit/index.cjs"+ },"./x402": {"types": "./dist/x402/index.d.ts","import": "./dist/x402/index.js","require": "./dist/x402/index.cjs"- },- "./solana-agent-kit": {- "types": "./dist/solana-agent-kit/index.d.ts",- "import": "./dist/solana-agent-kit/index.js",- "require": "./dist/solana-agent-kit/index.cjs"}},"files": [@@ -44,8 +59,11 @@},"dependencies": {"@coral-xyz/anchor": "^0.31.1",+ "@pump-fun/pump-sdk": "^1.35.0","@solana/spl-token": "^0.4.9",- "@solana/web3.js": "^1.98.0"+ "@solana/web3.js": "^1.98.0",+ "bn.js": "^5.2.1",+ "viem": "^2.0.0"},"peerDependencies": {"zod": "^3.0.0"diff --git a/agent-payments-sdk/src/CrossChainPaymentClient.ts b/agent-payments-sdk/src/CrossChainPaymentClient.tsnew file mode 100644index 000000000..bd4523230--- /dev/null+++ b/agent-payments-sdk/src/CrossChainPaymentClient.ts@@ -0,0 +1,143 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { Connection, PublicKey } from "@solana/web3.js";+import type { Address } from "viem";+import { PumpAgent } from "./solana/PumpAgent.js";+import type {+ CrossChainPaymentStatusResult,+ CrossChainQuote,+ EvmPaymentParams,+ EvmPaymentReceipt,+ EvmPaymentTransaction,+ SupportedEvmChainId,+} from "./types.js";+import { getChain, isSupported } from "./chains.js";+import { getQuote, type QuoteRequest } from "./evm/quote.js";+import { buildEvmPaymentTransaction } from "./evm/transaction.js";+import { getPaymentStatus, waitForSolanaArrival } from "./evm/validate.js";++export interface CrossChainPaymentClientConfig {+ /** Solana RPC endpoint */+ rpcEndpoint: string;+ /** Agent token mint (base58) */+ agentMint: string;+ /** "mainnet" | "devnet" — defaults to mainnet */+ environment?: "mainnet" | "devnet";+ /** Optional Pump.fun API key for higher rate limits */+ apiKey?: string;+}++/**+ * CrossChainPaymentClient — unified entry point for agent payments from any chain.+ *+ * Solana-native flow (existing):+ * client.solana.buildAcceptPaymentInstructions(...)+ *+ * EVM cross-chain flow (new):+ * const quote = await client.getEvmQuote(...)+ * const txs = await client.buildEvmPayment({ quote, ... })+ * // user signs txs.approval then txs.bridge in their EVM wallet+ * const receipt = await client.submitEvmPayment(bridgeTxHash, quote)+ * const result = await client.waitForArrival(receipt)+ */+export class CrossChainPaymentClient {+ readonly agentMint: string;+ readonly solana: PumpAgent;+ private readonly apiKey?: string;++ constructor(config: CrossChainPaymentClientConfig) {+ this.agentMint = config.agentMint;+ this.apiKey = config.apiKey;++ const connection = new Connection(config.rpcEndpoint, "confirmed");+ const mint = new PublicKey(config.agentMint);+ this.solana = new PumpAgent(mint, config.environment ?? "mainnet", connection);+ }++ // ---------------------------------------------------------------------------+ // EVM → Solana cross-chain flow+ // ---------------------------------------------------------------------------++ /**+ * Get a cross-chain payment quote.+ * Always fetch a fresh quote immediately before building the transaction.+ */+ async getEvmQuote(+ fromChainId: SupportedEvmChainId,+ fromToken: Address | "native",+ fromAmount: bigint+ ): Promise<CrossChainQuote> {+ if (!isSupported(fromChainId)) {+ throw new Error(`Chain ${fromChainId} is not supported`);+ }+ const req: QuoteRequest = {+ fromChainId,+ fromToken,+ fromAmount,+ agentMint: this.agentMint,+ };+ return getQuote(req, this.apiKey);+ }++ /**+ * Build the EVM transaction(s) for a cross-chain payment.+ * Send approval first (if present), then bridge.+ */+ async buildEvmPayment(+ quote: CrossChainQuote,+ sender: Address,+ destinationSolanaWallet: string,+ memo: string+ ): Promise<EvmPaymentTransaction> {+ const params: EvmPaymentParams = {+ quote,+ agentMint: this.agentMint,+ destinationSolanaWallet,+ memo,+ sender,+ };+ return buildEvmPaymentTransaction(params, this.apiKey);+ }++ /**+ * After the user submits the bridge transaction, create a receipt+ * to track the cross-chain payment through to Solana.+ */+ createReceipt(+ bridgeTxHash: `0x${string}`,+ quote: CrossChainQuote,+ depositId: string+ ): EvmPaymentReceipt {+ return {+ txHash: bridgeTxHash,+ chainId: quote.fromChainId,+ fromAmount: quote.fromAmount,+ fromToken: quote.fromToken,+ depositId,+ estimatedArrivalAt:+ Math.floor(Date.now() / 1000) + quote.estimatedTimeSeconds,+ };+ }++ /** Poll until the payment arrives on Solana or times out. */+ async waitForArrival(+ receipt: EvmPaymentReceipt,+ opts: { timeoutMs?: number; pollIntervalMs?: number } = {}+ ): Promise<CrossChainPaymentStatusResult> {+ return waitForSolanaArrival(receipt, opts);+ }++ /** Single status check without blocking. */+ async getPaymentStatus(+ depositId: string+ ): Promise<CrossChainPaymentStatusResult> {+ return getPaymentStatus(depositId);+ }++ /** Chain metadata helper. */+ getChainConfig(chainId: SupportedEvmChainId) {+ return getChain(chainId);+ }+}diff --git a/agent-payments-sdk/src/chains.ts b/agent-payments-sdk/src/chains.tsnew file mode 100644index 000000000..f04973914--- /dev/null+++ b/agent-payments-sdk/src/chains.ts@@ -0,0 +1,74 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { EvmChainConfig, SupportedEvmChainId } from "./types.js";++export const EVM_CHAINS: Record<SupportedEvmChainId, EvmChainConfig> = {+ 1: {+ id: 1,+ name: "Ethereum",+ rpcUrl: "https://eth.llamarpc.com",+ blockExplorer: "https://etherscan.io",+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },+ usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",+ moonpayNetwork: "eth",+ },+ 8453: {+ id: 8453,+ name: "Base",+ rpcUrl: "https://mainnet.base.org",+ blockExplorer: "https://basescan.org",+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },+ usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",+ moonpayNetwork: "base",+ },+ 42161: {+ id: 42161,+ name: "Arbitrum One",+ rpcUrl: "https://arb1.arbitrum.io/rpc",+ blockExplorer: "https://arbiscan.io",+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },+ usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",+ moonpayNetwork: "arbitrum",+ },+ 137: {+ id: 137,+ name: "Polygon",+ rpcUrl: "https://polygon-rpc.com",+ blockExplorer: "https://polygonscan.com",+ nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },+ usdc: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",+ moonpayNetwork: "polygon",+ },+ 56: {+ id: 56,+ name: "BNB Smart Chain",+ rpcUrl: "https://bsc-dataseed.binance.org",+ blockExplorer: "https://bscscan.com",+ nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },+ usdc: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",+ moonpayNetwork: "bsc",+ },+ 43114: {+ id: 43114,+ name: "Avalanche",+ rpcUrl: "https://api.avax.network/ext/bc/C/rpc",+ blockExplorer: "https://snowtrace.io",+ nativeCurrency: { name: "AVAX", symbol: "AVAX", decimals: 18 },+ usdc: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",+ moonpayNetwork: "avaxc",+ },+};++export const SUPPORTED_CHAIN_IDS = Object.keys(EVM_CHAINS).map(Number) as SupportedEvmChainId[];++export function getChain(chainId: SupportedEvmChainId): EvmChainConfig {+ const chain = EVM_CHAINS[chainId];+ if (!chain) throw new Error(`Unsupported chain: ${chainId}`);+ return chain;+}++export function isSupported(chainId: number): chainId is SupportedEvmChainId {+ return chainId in EVM_CHAINS;+}diff --git a/agent-payments-sdk/src/constants.ts b/agent-payments-sdk/src/constants.tsnew file mode 100644index 000000000..7dbcc2ce1--- /dev/null+++ b/agent-payments-sdk/src/constants.ts@@ -0,0 +1,55 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/** Pump.fun cross-chain deposit API (MoonPay-powered) */+export const PUMP_CROSSCHAIN_API = "https://api.pump.fun/crosschain";++/** MoonPay widget base URL for fallback UI */+export const MOONPAY_WIDGET_URL = "https://buy.moonpay.com";++/** Solana USDC mint */+export const USDC_SOLANA_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";++/** Pump Agent Payments program */+export const PUMP_AGENT_PAYMENTS_PROGRAM = "AgenTMiC2hvxGebTsgmsD4HHBa8WEcqGFf87iwRRxLo7";++/** ERC-20 transfer + approve function selectors */+export const ERC20_ABI = [+ {+ name: "approve",+ type: "function",+ stateMutability: "nonpayable",+ inputs: [+ { name: "spender", type: "address" },+ { name: "amount", type: "uint256" },+ ],+ outputs: [{ name: "", type: "bool" }],+ },+ {+ name: "allowance",+ type: "function",+ stateMutability: "view",+ inputs: [+ { name: "owner", type: "address" },+ { name: "spender", type: "address" },+ ],+ outputs: [{ name: "", type: "uint256" }],+ },+ {+ name: "balanceOf",+ type: "function",+ stateMutability: "view",+ inputs: [{ name: "account", type: "address" }],+ outputs: [{ name: "", type: "uint256" }],+ },+] as const;++/** Quote expiry buffer — reject quotes within this many seconds of expiry */+export const QUOTE_EXPIRY_BUFFER_SECONDS = 30;++/** How often to poll for cross-chain payment status (ms) */+export const STATUS_POLL_INTERVAL_MS = 5_000;++/** Max wait before declaring a cross-chain payment failed (ms) */+export const STATUS_TIMEOUT_MS = 30 * 60 * 1_000; // 30 mindiff --git a/agent-payments-sdk/src/evm/EvmAgent.ts b/agent-payments-sdk/src/evm/EvmAgent.tsnew file mode 100644index 000000000..5a6dd616c--- /dev/null+++ b/agent-payments-sdk/src/evm/EvmAgent.ts@@ -0,0 +1,207 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import {+ createPublicClient,+ http,+ type Address,+ type Hash,+ type PublicClient,+} from "viem";+import { AGENT_PAYMENTS_ABI } from "./abi.js";+import { getEvmChain, type EvmChainId } from "./addresses.js";+import { EvmAgentOffline } from "./EvmAgentOffline.js";+import { getInvoiceId } from "./invoice.js";+import { parseEvmAgentEvents } from "./events.js";+import type {+ EvmAgentBalances,+ EvmAgentConfig,+ EvmInvoiceValidationResult,+ EvmPaymentAcceptedEvent,+ EvmPaymentStats,+} from "./types.js";+import { NATIVE_TOKEN_ADDRESS } from "./addresses.js";++/**+ * EvmAgent — extends EvmAgentOffline with RPC reads and invoice validation.+ * Mirrors PumpAgent from the Solana SDK.+ *+ * Usage:+ * const agent = new EvmAgent("0xYourAgentToken", 8453);+ * const config = await agent.getAgentConfig();+ * const balances = await agent.getBalances("0xUSDC...");+ * const valid = await agent.validateInvoicePayment({ invoiceId, payer, amount, ... });+ */+export class EvmAgent extends EvmAgentOffline {+ private readonly client: PublicClient;++ constructor(+ agentToken: Address,+ chainId: EvmChainId,+ rpcUrl?: string+ ) {+ super(agentToken, chainId);+ const chain = getEvmChain(chainId);+ this.client = createPublicClient({+ transport: http(rpcUrl ?? chain.rpcUrl),+ });+ }++ // ── Read functions ────────────────────────────────────────────────────────++ /** Fetch the agent's on-chain config. Mirrors PumpAgent.getAgentConfig(). */+ async getAgentConfig(): Promise<EvmAgentConfig> {+ const [authority, buybackBps, exists] = await this.client.readContract({+ address: this.contractAddress,+ abi: AGENT_PAYMENTS_ABI,+ functionName: "getAgentConfig",+ args: [this.agentToken],+ }) as [Address, number, boolean];++ return { agentToken: this.agentToken, authority, buybackBps, exists };+ }++ /** Fetch vault balances for a given currency. Mirrors PumpAgent.getAgentBalances(). */+ async getBalances(currencyToken: Address): Promise<EvmAgentBalances> {+ const [paymentVault, buybackVault, withdrawVault] = await this.client.readContract({+ address: this.contractAddress,+ abi: AGENT_PAYMENTS_ABI,+ functionName: "getBalances",+ args: [this.agentToken, currencyToken],+ }) as [bigint, bigint, bigint];++ return {+ agentToken: this.agentToken,+ currencyToken,+ paymentVault,+ buybackVault,+ withdrawVault,+ };+ }++ /** Fetch cumulative payment stats. Mirrors PumpAgent.getPaymentStats(). */+ async getPaymentStats(currencyToken: Address): Promise<EvmPaymentStats> {+ const [totalPayments, totalBuybacks, totalWithdrawn, tokensBurned] =+ await this.client.readContract({+ address: this.contractAddress,+ abi: AGENT_PAYMENTS_ABI,+ functionName: "getPaymentStats",+ args: [this.agentToken, currencyToken],+ }) as [bigint, bigint, bigint, bigint];++ return {+ agentToken: this.agentToken,+ currencyToken,+ totalPayments,+ totalBuybacks,+ totalWithdrawn,+ tokensBurned,+ };+ }++ /** Check if an invoice has already been paid. */+ async isInvoicePaid(invoiceId: Hash): Promise<boolean> {+ return this.client.readContract({+ address: this.contractAddress,+ abi: AGENT_PAYMENTS_ABI,+ functionName: "isInvoicePaid",+ args: [invoiceId],+ }) as Promise<boolean>;+ }++ // ── Invoice validation ────────────────────────────────────────────────────++ /**+ * Validate that a specific invoice has been paid on-chain.+ * Mirrors PumpAgent.validateInvoicePayment().+ *+ * Primary path: checks the isInvoicePaid mapping directly.+ * Fallback: scans PaymentAccepted events for matching parameters.+ */+ async validateInvoicePayment(params: {+ currencyToken: Address | "native";+ amount: bigint;+ memo: bigint;+ startTime: bigint;+ endTime: bigint;+ payer?: Address;+ }): Promise<EvmInvoiceValidationResult> {+ const currency =+ params.currencyToken === "native" ? NATIVE_TOKEN_ADDRESS : params.currencyToken;++ const invoiceId = getInvoiceId(+ this.agentToken,+ currency,+ params.amount,+ params.memo,+ params.startTime,+ params.endTime+ );++ // Primary: direct mapping lookup+ const paid = await this.isInvoicePaid(invoiceId);+ if (paid) {+ return { paid: true, invoiceId };+ }++ // Fallback: scan event logs for a matching PaymentAccepted event+ try {+ const logs = await this.client.getLogs({+ address: this.contractAddress,+ event: AGENT_PAYMENTS_ABI.find((x) => x.type === "event" && x.name === "PaymentAccepted") as any,+ args: { agentToken: this.agentToken, payer: params.payer },+ fromBlock: "earliest",+ });++ const events = parseEvmAgentEvents(logs as any);+ const match = events.find(+ (e): e is EvmPaymentAcceptedEvent =>+ e.name === "PaymentAccepted" &&+ e.invoiceId.toLowerCase() === invoiceId.toLowerCase()+ );++ if (match) {+ return {+ paid: true,+ invoiceId,+ txHash: match.txHash,+ blockNumber: match.blockNumber,+ };+ }+ } catch {+ // Fallback failed — return primary result+ }++ return { paid: false, invoiceId };+ }++ /**+ * Get recent PaymentAccepted events for this agent.+ * Mirrors PumpAgent payment history queries.+ */+ async getPaymentHistory(opts: {+ currencyToken?: Address;+ payer?: Address;+ fromBlock?: bigint;+ toBlock?: bigint;+ } = {}) {+ const logs = await this.client.getLogs({+ address: this.contractAddress,+ event: AGENT_PAYMENTS_ABI.find((x) => x.type === "event" && x.name === "PaymentAccepted") as any,+ args: {+ agentToken: this.agentToken,+ ...(opts.payer ? { payer: opts.payer } : {}),+ },+ fromBlock: opts.fromBlock ?? "earliest",+ toBlock: opts.toBlock ?? "latest",+ });++ return parseEvmAgentEvents(logs as any).filter(+ (e): e is EvmPaymentAcceptedEvent =>+ e.name === "PaymentAccepted" &&+ (!opts.currencyToken ||+ e.currencyToken.toLowerCase() === opts.currencyToken.toLowerCase())+ );+ }+}diff --git a/agent-payments-sdk/src/evm/EvmAgentOffline.ts b/agent-payments-sdk/src/evm/EvmAgentOffline.tsnew file mode 100644index 000000000..c9dc6eabd--- /dev/null+++ b/agent-payments-sdk/src/evm/EvmAgentOffline.ts@@ -0,0 +1,262 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import {+ encodeFunctionData,+ maxUint256,+ type Address,+ type Hex,+} from "viem";+import { AGENT_PAYMENTS_ABI, ERC20_ABI } from "./abi.js";+import { getEvmChain, NATIVE_TOKEN_ADDRESS, type EvmChainId } from "./addresses.js";+import { getInvoiceId, buildInvoiceWindow, generateMemo } from "./invoice.js";+import type {+ EvmAcceptPaymentParams,+ EvmBuybackTriggerParams,+ EvmCreateParams,+ EvmDistributePaymentsParams,+ EvmTxBundle,+ EvmUnsignedTx,+ EvmUpdateAuthorityParams,+ EvmUpdateBuybackBpsParams,+ EvmWithdrawParams,+} from "./types.js";++/**+ * EvmAgentOffline — builds unsigned EVM transactions for the Agent Payments contract.+ * No RPC connection required. Mirrors PumpAgentOffline from the Solana SDK.+ *+ * Usage:+ * const agent = new EvmAgentOffline("0xYourAgentToken", 8453);+ * const bundle = agent.buildAcceptPaymentTx({ ... });+ * // send bundle.approval then bundle.tx via user's wallet+ */+export class EvmAgentOffline {+ readonly agentToken: Address;+ readonly chainId: EvmChainId;+ readonly contractAddress: Address;++ constructor(agentToken: Address, chainId: EvmChainId) {+ this.agentToken = agentToken;+ this.chainId = chainId;+ this.contractAddress = getEvmChain(chainId).agentPayments;+ }++ // ── Agent setup ────────────────────────────────────────────────────────────++ /** Build the createAgent transaction (one-time agent registration). */+ buildCreateAgentTx(params: EvmCreateParams): EvmUnsignedTx {+ return {+ to: this.contractAddress,+ data: encodeFunctionData({+ abi: AGENT_PAYMENTS_ABI,+ functionName: "createAgent",+ args: [params.agentToken, params.agentAuthority, params.buybackBps],+ }),+ value: 0n,+ chainId: this.chainId,+ };+ }++ // ── Payment acceptance ────────────────────────────────────────────────────++ /**+ * Build the acceptPayment transaction bundle.+ * Returns an optional ERC-20 approval + the main payment tx.+ *+ * For native currency (ETH/BNB/AVAX), pass currencyToken as "native".+ * The value field on the tx will be set to the payment amount.+ */+ buildAcceptPaymentTx(+ params: EvmAcceptPaymentParams,+ payer: Address+ ): EvmTxBundle {+ const isNative = params.currencyToken === "native";++ if (isNative) {+ return {+ tx: {+ to: this.contractAddress,+ data: encodeFunctionData({+ abi: AGENT_PAYMENTS_ABI,+ functionName: "acceptPaymentNative",+ args: [+ params.agentToken,+ params.memo,+ params.startTime,+ params.endTime,+ ],+ }),+ value: params.amount,+ chainId: this.chainId,+ },+ };+ }++ const approval: EvmUnsignedTx = {+ to: params.currencyToken as Address,+ data: encodeFunctionData({+ abi: ERC20_ABI,+ functionName: "approve",+ args: [this.contractAddress, maxUint256],+ }),+ value: 0n,+ chainId: this.chainId,+ };++ const tx: EvmUnsignedTx = {+ to: this.contractAddress,+ data: encodeFunctionData({+ abi: AGENT_PAYMENTS_ABI,+ functionName: "acceptPayment",+ args: [+ params.agentToken,+ params.currencyToken as Address,+ params.amount,+ params.memo,+ params.startTime,+ params.endTime,+ ],+ }),+ value: 0n,+ chainId: this.chainId,+ };++ return { approval, tx };+ }++ /**+ * Convenience wrapper: auto-generates memo + time window.+ * Mirrors PumpAgentOffline.buildAcceptPaymentInstructions().+ */+ buildAcceptPaymentInstructions(opts: {+ agentToken: Address;+ currencyToken: Address | "native";+ amount: bigint;+ payer: Address;+ windowSeconds?: number;+ }): { bundle: EvmTxBundle; memo: bigint; invoiceId: Hex } {+ const memo = generateMemo();+ const { startTime, endTime } = buildInvoiceWindow(opts.windowSeconds);+ const currencyAddress =+ opts.currencyToken === "native" ? NATIVE_TOKEN_ADDRESS : opts.currencyToken;++ const invoiceId = getInvoiceId(+ opts.agentToken,+ currencyAddress,+ opts.amount,+ memo,+ startTime,+ endTime+ );++ const bundle = this.buildAcceptPaymentTx(+ {+ agentToken: opts.agentToken,+ currencyToken: opts.currencyToken,+ amount: opts.amount,+ memo,+ startTime,+ endTime,+ },+ opts.payer+ );++ return { bundle, memo, invoiceId };+ }++ // ── Distribution + buyback ─────────────────────────────────────────────────++ /** Build the distributePayments transaction. Permissionless. */+ buildDistributePaymentsTx(params: EvmDistributePaymentsParams): EvmUnsignedTx {+ return {+ to: this.contractAddress,+ data: encodeFunctionData({+ abi: AGENT_PAYMENTS_ABI,+ functionName: "distributePayments",+ args: [params.agentToken, params.currencyToken],+ }),+ value: 0n,+ chainId: this.chainId,+ };+ }++ /** Build the buybackTrigger transaction. Caller must be global buyback authority. */+ buildBuybackTriggerTx(params: EvmBuybackTriggerParams): EvmUnsignedTx {+ return {+ to: this.contractAddress,+ data: encodeFunctionData({+ abi: AGENT_PAYMENTS_ABI,+ functionName: "buybackTrigger",+ args: [+ params.agentToken,+ params.currencyToken,+ params.swapRouter,+ params.swapData,+ ],+ }),+ value: 0n,+ chainId: this.chainId,+ };+ }++ // ── Withdrawal ─────────────────────────────────────────────────────────────++ /** Build the withdraw transaction. Caller must be agent authority. */+ buildWithdrawTx(params: EvmWithdrawParams): EvmUnsignedTx {+ return {+ to: this.contractAddress,+ data: encodeFunctionData({+ abi: AGENT_PAYMENTS_ABI,+ functionName: "withdraw",+ args: [params.agentToken, params.currencyToken, params.receiver],+ }),+ value: 0n,+ chainId: this.chainId,+ };+ }++ // ── Config updates ─────────────────────────────────────────────────────────++ buildUpdateBuybackBpsTx(params: EvmUpdateBuybackBpsParams): EvmUnsignedTx {+ return {+ to: this.contractAddress,+ data: encodeFunctionData({+ abi: AGENT_PAYMENTS_ABI,+ functionName: "updateBuybackBps",+ args: [params.agentToken, params.buybackBps],+ }),+ value: 0n,+ chainId: this.chainId,+ };+ }++ buildUpdateAuthorityTx(params: EvmUpdateAuthorityParams): EvmUnsignedTx {+ return {+ to: this.contractAddress,+ data: encodeFunctionData({+ abi: AGENT_PAYMENTS_ABI,+ functionName: "updateAuthority",+ args: [params.agentToken, params.newAuthority],+ }),+ value: 0n,+ chainId: this.chainId,+ };+ }++ // ── Helpers ────────────────────────────────────────────────────────────────++ /** Compute the invoice ID for a payment without sending anything. */+ computeInvoiceId(+ currencyToken: Address | "native",+ amount: bigint,+ memo: bigint,+ startTime: bigint,+ endTime: bigint+ ): Hex {+ const currency =+ currencyToken === "native" ? NATIVE_TOKEN_ADDRESS : currencyToken;+ return getInvoiceId(this.agentToken, currency, amount, memo, startTime, endTime);+ }+}diff --git a/agent-payments-sdk/src/evm/abi.ts b/agent-payments-sdk/src/evm/abi.tsnew file mode 100644index 000000000..56ae1b4e0--- /dev/null+++ b/agent-payments-sdk/src/evm/abi.ts@@ -0,0 +1,287 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * ABI for the EVM Agent Payments contract.+ * Mirrors the Solana pump_agent_payments program interface.+ *+ * Functions:+ * createAgent — register an agent (mirrors agentInitialize)+ * acceptPayment — user pays agent (mirrors agentAcceptPayment)+ * distributePayments— split vault to buyback + withdraw (mirrors agentDistributePayments)+ * buybackTrigger — swap + burn agent token (mirrors agentBuybackTrigger)+ * withdraw — owner pulls from withdraw vault (mirrors agentWithdraw)+ * updateBuybackBps — change buyback split+ * updateAuthority — transfer agent authority+ */+export const AGENT_PAYMENTS_ABI = [+ // ── Write functions ──────────────────────────────────────────────────────++ {+ name: "createAgent",+ type: "function",+ stateMutability: "nonpayable",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "agentAuthority", type: "address" },+ { name: "buybackBps", type: "uint16" },+ ],+ outputs: [],+ },++ {+ name: "acceptPayment",+ type: "function",+ stateMutability: "nonpayable",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "currencyToken", type: "address" },+ { name: "amount", type: "uint256" },+ { name: "memo", type: "uint64" },+ { name: "startTime", type: "int64" },+ { name: "endTime", type: "int64" },+ ],+ outputs: [{ name: "invoiceId", type: "bytes32" }],+ },++ {+ name: "acceptPaymentNative",+ type: "function",+ stateMutability: "payable",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "memo", type: "uint64" },+ { name: "startTime", type: "int64" },+ { name: "endTime", type: "int64" },+ ],+ outputs: [{ name: "invoiceId", type: "bytes32" }],+ },++ {+ name: "distributePayments",+ type: "function",+ stateMutability: "nonpayable",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "currencyToken", type: "address" },+ ],+ outputs: [],+ },++ {+ name: "buybackTrigger",+ type: "function",+ stateMutability: "nonpayable",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "currencyToken", type: "address" },+ { name: "swapRouter", type: "address" },+ { name: "swapData", type: "bytes" },+ ],+ outputs: [{ name: "tokensBurned", type: "uint256" }],+ },++ {+ name: "withdraw",+ type: "function",+ stateMutability: "nonpayable",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "currencyToken", type: "address" },+ { name: "receiver", type: "address" },+ ],+ outputs: [{ name: "amount", type: "uint256" }],+ },++ {+ name: "updateBuybackBps",+ type: "function",+ stateMutability: "nonpayable",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "buybackBps", type: "uint16" },+ ],+ outputs: [],+ },++ {+ name: "updateAuthority",+ type: "function",+ stateMutability: "nonpayable",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "newAuthority", type: "address" },+ ],+ outputs: [],+ },++ // ── Read functions ───────────────────────────────────────────────────────++ {+ name: "getAgentConfig",+ type: "function",+ stateMutability: "view",+ inputs: [{ name: "agentToken", type: "address" }],+ outputs: [+ { name: "authority", type: "address" },+ { name: "buybackBps", type: "uint16" },+ { name: "exists", type: "bool" },+ ],+ },++ {+ name: "getBalances",+ type: "function",+ stateMutability: "view",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "currencyToken", type: "address" },+ ],+ outputs: [+ { name: "paymentVault", type: "uint256" },+ { name: "buybackVault", type: "uint256" },+ { name: "withdrawVault", type: "uint256" },+ ],+ },++ {+ name: "getPaymentStats",+ type: "function",+ stateMutability: "view",+ inputs: [+ { name: "agentToken", type: "address" },+ { name: "currencyToken", type: "address" },+ ],+ outputs: [+ { name: "totalPayments", type: "uint256" },+ { name: "totalBuybacks", type: "uint256" },+ { name: "totalWithdrawn", type: "uint256" },+ { name: "tokensBurned", type: "uint256" },+ ],+ },++ {+ name: "isInvoicePaid",+ type: "function",+ stateMutability: "view",+ inputs: [{ name: "invoiceId", type: "bytes32" }],+ outputs: [{ name: "", type: "bool" }],+ },++ // ── Events ───────────────────────────────────────────────────────────────++ {+ name: "AgentCreated",+ type: "event",+ inputs: [+ { name: "agentToken", type: "address", indexed: true },+ { name: "authority", type: "address", indexed: true },+ { name: "buybackBps", type: "uint16", indexed: false },+ ],+ },++ {+ name: "PaymentAccepted",+ type: "event",+ inputs: [+ { name: "agentToken", type: "address", indexed: true },+ { name: "payer", type: "address", indexed: true },+ { name: "currencyToken", type: "address", indexed: false },+ { name: "amount", type: "uint256", indexed: false },+ { name: "memo", type: "uint64", indexed: false },+ { name: "invoiceId", type: "bytes32", indexed: false },+ ],+ },++ {+ name: "PaymentsDistributed",+ type: "event",+ inputs: [+ { name: "agentToken", type: "address", indexed: true },+ { name: "currencyToken", type: "address", indexed: false },+ { name: "buybackAmount", type: "uint256", indexed: false },+ { name: "withdrawAmount", type: "uint256", indexed: false },+ ],+ },++ {+ name: "BuybackTriggered",+ type: "event",+ inputs: [+ { name: "agentToken", type: "address", indexed: true },+ { name: "currencyToken", type: "address", indexed: false },+ { name: "currencySpent", type: "uint256", indexed: false },+ { name: "tokensBurned", type: "uint256", indexed: false },+ ],+ },++ {+ name: "Withdrawn",+ type: "event",+ inputs: [+ { name: "agentToken", type: "address", indexed: true },+ { name: "authority", type: "address", indexed: true },+ { name: "currencyToken", type: "address", indexed: false },+ { name: "amount", type: "uint256", indexed: false },+ { name: "receiver", type: "address", indexed: false },+ ],+ },++ {+ name: "AuthorityUpdated",+ type: "event",+ inputs: [+ { name: "agentToken", type: "address", indexed: true },+ { name: "oldAuthority", type: "address", indexed: false },+ { name: "newAuthority", type: "address", indexed: false },+ ],+ },++ {+ name: "BuybackBpsUpdated",+ type: "event",+ inputs: [+ { name: "agentToken", type: "address", indexed: true },+ { name: "oldBps", type: "uint16", indexed: false },+ { name: "newBps", type: "uint16", indexed: false },+ ],+ },+] as const;++export const ERC20_ABI = [+ {+ name: "approve",+ type: "function",+ stateMutability: "nonpayable",+ inputs: [+ { name: "spender", type: "address" },+ { name: "amount", type: "uint256" },+ ],+ outputs: [{ name: "", type: "bool" }],+ },+ {+ name: "allowance",+ type: "function",+ stateMutability: "view",+ inputs: [+ { name: "owner", type: "address" },+ { name: "spender", type: "address" },+ ],+ outputs: [{ name: "", type: "uint256" }],+ },+ {+ name: "balanceOf",+ type: "function",+ stateMutability: "view",+ inputs: [{ name: "account", type: "address" }],+ outputs: [{ name: "", type: "uint256" }],+ },+ {+ name: "decimals",+ type: "function",+ stateMutability: "view",+ inputs: [],+ outputs: [{ name: "", type: "uint8" }],+ },+] as const;diff --git a/agent-payments-sdk/src/evm/addresses.ts b/agent-payments-sdk/src/evm/addresses.tsnew file mode 100644index 000000000..b45658042--- /dev/null+++ b/agent-payments-sdk/src/evm/addresses.ts@@ -0,0 +1,102 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { Address } from "viem";++export type EvmChainId = 1 | 8453 | 42161 | 137 | 56 | 43114;++export interface EvmChainConfig {+ id: EvmChainId;+ name: string;+ rpcUrl: string;+ blockExplorer: string;+ nativeCurrency: { name: string; symbol: string; decimals: number };+ /** USDC token address on this chain */+ usdc: Address;+ /** WETH/wrapped native address */+ wrappedNative: Address;+ /** Deployed AgentPayments contract — set after deployment */+ agentPayments: Address;+}++/** Placeholder — replace with deployed contract addresses post-deployment */+const UNDEPLOYED = "0x0000000000000000000000000000000000000000" as Address;++export const EVM_CHAINS: Record<EvmChainId, EvmChainConfig> = {+ 1: {+ id: 1,+ name: "Ethereum",+ rpcUrl: "https://eth.llamarpc.com",+ blockExplorer: "https://etherscan.io",+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },+ usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",+ wrappedNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",+ agentPayments: UNDEPLOYED,+ },+ 8453: {+ id: 8453,+ name: "Base",+ rpcUrl: "https://mainnet.base.org",+ blockExplorer: "https://basescan.org",+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },+ usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",+ wrappedNative: "0x4200000000000000000000000000000000000006",+ agentPayments: UNDEPLOYED,+ },+ 42161: {+ id: 42161,+ name: "Arbitrum One",+ rpcUrl: "https://arb1.arbitrum.io/rpc",+ blockExplorer: "https://arbiscan.io",+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },+ usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",+ wrappedNative: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",+ agentPayments: UNDEPLOYED,+ },+ 137: {+ id: 137,+ name: "Polygon",+ rpcUrl: "https://polygon-rpc.com",+ blockExplorer: "https://polygonscan.com",+ nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },+ usdc: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",+ wrappedNative: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",+ agentPayments: UNDEPLOYED,+ },+ 56: {+ id: 56,+ name: "BNB Smart Chain",+ rpcUrl: "https://bsc-dataseed.binance.org",+ blockExplorer: "https://bscscan.com",+ nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },+ usdc: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",+ wrappedNative: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",+ agentPayments: UNDEPLOYED,+ },+ 43114: {+ id: 43114,+ name: "Avalanche",+ rpcUrl: "https://api.avax.network/ext/bc/C/rpc",+ blockExplorer: "https://snowtrace.io",+ nativeCurrency: { name: "AVAX", symbol: "AVAX", decimals: 18 },+ usdc: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",+ wrappedNative: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",+ agentPayments: UNDEPLOYED,+ },+};++export const SUPPORTED_CHAIN_IDS = Object.keys(EVM_CHAINS).map(Number) as EvmChainId[];++export function getEvmChain(chainId: EvmChainId): EvmChainConfig {+ const chain = EVM_CHAINS[chainId];+ if (!chain) throw new Error(`Unsupported EVM chain: ${chainId}`);+ return chain;+}++export function isEvmChainSupported(chainId: number): chainId is EvmChainId {+ return chainId in EVM_CHAINS;+}++/** Native ETH/BNB/AVAX sentinel address (matches EIP-7528) */+export const NATIVE_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" as Address;diff --git a/agent-payments-sdk/src/evm/events.ts b/agent-payments-sdk/src/evm/events.tsnew file mode 100644index 000000000..82fb4b506--- /dev/null+++ b/agent-payments-sdk/src/evm/events.ts@@ -0,0 +1,97 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { Log } from "viem";+import type {+ EvmAgentEvent,+ EvmAgentCreatedEvent,+ EvmPaymentAcceptedEvent,+ EvmPaymentsDistributedEvent,+ EvmBuybackTriggeredEvent,+ EvmWithdrawnEvent,+} from "./types.js";++type RawLog = Log & { args?: Record<string, unknown>; eventName?: string };++/**+ * Parse raw viem event logs into typed EvmAgentEvent objects.+ * Mirrors parseAgentEvents() from the Solana SDK.+ */+export function parseEvmAgentEvents(logs: RawLog[]): EvmAgentEvent[] {+ const events: EvmAgentEvent[] = [];++ for (const log of logs) {+ const name = log.eventName;+ const args = log.args ?? {};+ const meta = {+ txHash: log.transactionHash ?? "0x",+ blockNumber: log.blockNumber ?? 0n,+ } as const;++ try {+ switch (name) {+ case "AgentCreated":+ events.push({+ name: "AgentCreated",+ agentToken: args.agentToken as `0x${string}`,+ authority: args.authority as `0x${string}`,+ buybackBps: Number(args.buybackBps),+ ...meta,+ } satisfies EvmAgentCreatedEvent);+ break;++ case "PaymentAccepted":+ events.push({+ name: "PaymentAccepted",+ agentToken: args.agentToken as `0x${string}`,+ payer: args.payer as `0x${string}`,+ currencyToken: args.currencyToken as `0x${string}`,+ amount: BigInt(String(args.amount ?? 0n)),+ memo: BigInt(String(args.memo ?? 0n)),+ invoiceId: args.invoiceId as `0x${string}`,+ ...meta,+ } satisfies EvmPaymentAcceptedEvent);+ break;++ case "PaymentsDistributed":+ events.push({+ name: "PaymentsDistributed",+ agentToken: args.agentToken as `0x${string}`,+ currencyToken: args.currencyToken as `0x${string}`,+ buybackAmount: BigInt(String(args.buybackAmount ?? 0n)),+ withdrawAmount: BigInt(String(args.withdrawAmount ?? 0n)),+ ...meta,+ } satisfies EvmPaymentsDistributedEvent);+ break;++ case "BuybackTriggered":+ events.push({+ name: "BuybackTriggered",+ agentToken: args.agentToken as `0x${string}`,+ currencyToken: args.currencyToken as `0x${string}`,+ currencySpent: BigInt(String(args.currencySpent ?? 0n)),+ tokensBurned: BigInt(String(args.tokensBurned ?? 0n)),+ ...meta,+ } satisfies EvmBuybackTriggeredEvent);+ break;++ case "Withdrawn":+ events.push({+ name: "Withdrawn",+ agentToken: args.agentToken as `0x${string}`,+ authority: args.authority as `0x${string}`,+ currencyToken: args.currencyToken as `0x${string}`,+ amount: BigInt(String(args.amount ?? 0n)),+ receiver: args.receiver as `0x${string}`,+ ...meta,+ } satisfies EvmWithdrawnEvent);+ break;+ }+ } catch {+ // skip malformed logs+ }+ }++ return events;+}diff --git a/agent-payments-sdk/src/evm/index.ts b/agent-payments-sdk/src/evm/index.tsnew file mode 100644index 000000000..ccbc38d28--- /dev/null+++ b/agent-payments-sdk/src/evm/index.ts@@ -0,0 +1,41 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++export { EvmAgentOffline } from "./EvmAgentOffline.js";+export { EvmAgent } from "./EvmAgent.js";+export { AGENT_PAYMENTS_ABI, ERC20_ABI } from "./abi.js";+export {+ EVM_CHAINS,+ SUPPORTED_CHAIN_IDS,+ NATIVE_TOKEN_ADDRESS,+ getEvmChain,+ isEvmChainSupported,+} from "./addresses.js";+export { getInvoiceId, buildInvoiceWindow, generateMemo } from "./invoice.js";+export { parseEvmAgentEvents } from "./events.js";+export type {+ EvmChainId,+ EvmChainConfig,+} from "./addresses.js";+export type {+ EvmAgentConfig,+ EvmAgentBalances,+ EvmPaymentStats,+ EvmCreateParams,+ EvmAcceptPaymentParams,+ EvmDistributePaymentsParams,+ EvmBuybackTriggerParams,+ EvmWithdrawParams,+ EvmUpdateBuybackBpsParams,+ EvmUpdateAuthorityParams,+ EvmUnsignedTx,+ EvmTxBundle,+ EvmInvoiceValidationResult,+ EvmAgentEvent,+ EvmAgentCreatedEvent,+ EvmPaymentAcceptedEvent,+ EvmPaymentsDistributedEvent,+ EvmBuybackTriggeredEvent,+ EvmWithdrawnEvent,+} from "./types.js";diff --git a/agent-payments-sdk/src/evm/invoice.ts b/agent-payments-sdk/src/evm/invoice.tsnew file mode 100644index 000000000..8596486aa--- /dev/null+++ b/agent-payments-sdk/src/evm/invoice.ts@@ -0,0 +1,64 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { encodeAbiParameters, keccak256 } from "viem";+import type { Address } from "viem";++/**+ * Derives a deterministic invoice ID — the EVM equivalent of the Solana InvoiceId PDA.+ *+ * Mirrors PDA seeds: ["invoice-id", tokenMint, currencyMint, amount, memo, startTime, endTime]+ *+ * On-chain the contract computes:+ * keccak256(abi.encode(agentToken, currencyToken, amount, memo, startTime, endTime))+ */+export function getInvoiceId(+ agentToken: Address,+ currencyToken: Address,+ amount: bigint,+ memo: bigint,+ startTime: bigint,+ endTime: bigint+): `0x${string}` {+ return keccak256(+ encodeAbiParameters(+ [+ { type: "address" },+ { type: "address" },+ { type: "uint256" },+ { type: "uint64" },+ { type: "int64" },+ { type: "int64" },+ ],+ [agentToken, currencyToken, amount, memo, startTime, endTime]+ )+ );+}++/**+ * Build a time-bounded invoice window matching the Solana SDK's convention.+ * Returns startTime and endTime as unix timestamps (seconds).+ *+ * @param windowSeconds How long the invoice is valid (default: 5 minutes)+ */+export function buildInvoiceWindow(windowSeconds = 300): {+ startTime: bigint;+ endTime: bigint;+} {+ const now = BigInt(Math.floor(Date.now() / 1000));+ return {+ startTime: now,+ endTime: now + BigInt(windowSeconds),+ };+}++/**+ * Generate a random memo ID — same helper pattern as the Solana SDK.+ * Returns a random u64 as bigint.+ */+export function generateMemo(): bigint {+ const arr = new Uint8Array(8);+ crypto.getRandomValues(arr);+ return arr.reduce((acc, byte) => (acc << 8n) | BigInt(byte), 0n);+}diff --git a/agent-payments-sdk/src/evm/quote.ts b/agent-payments-sdk/src/evm/quote.tsnew file mode 100644index 000000000..9b540c0a2--- /dev/null+++ b/agent-payments-sdk/src/evm/quote.ts@@ -0,0 +1,113 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { Address } from "viem";+import type { CrossChainQuote, SupportedEvmChainId } from "../types.js";+import { getChain } from "../chains.js";+import { PUMP_CROSSCHAIN_API, QUOTE_EXPIRY_BUFFER_SECONDS } from "../constants.js";++export interface QuoteRequest {+ fromChainId: SupportedEvmChainId;+ /** Token address to pay with, or "native" for the chain's native currency */+ fromToken: Address | "native";+ /** Amount in the token's smallest unit (wei for ETH, 6-decimal for USDC) */+ fromAmount: bigint;+ /** Solana agent token mint the payment is destined for */+ agentMint: string;+}++interface PumpCrossChainQuoteResponse {+ quoteId: string;+ fromChainId: number;+ fromToken: string;+ fromAmount: string;+ toAmountUsdc: string;+ estimatedUsd: number;+ bridgeFeeUsd: number;+ estimatedTimeSeconds: number;+ expiresAt: number;+}++/**+ * Fetch a cross-chain payment quote from Pump.fun's routing API.+ * The quote is valid for ~60 seconds (check expiresAt before submitting).+ */+export async function getQuote(+ request: QuoteRequest,+ apiKey?: string+): Promise<CrossChainQuote> {+ const chain = getChain(request.fromChainId);+ const fromTokenAddr =+ request.fromToken === "native"+ ? "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"+ : request.fromToken;++ const params = new URLSearchParams({+ fromChainId: String(request.fromChainId),+ fromToken: fromTokenAddr,+ fromAmount: String(request.fromAmount),+ toNetwork: "solana",+ toToken: "usdc",+ agentMint: request.agentMint,+ fromNetwork: chain.moonpayNetwork,+ });++ const headers: Record<string, string> = {+ "Content-Type": "application/json",+ };+ if (apiKey) headers["x-api-key"] = apiKey;++ const res = await fetch(`${PUMP_CROSSCHAIN_API}/quote?${params}`, { headers });++ if (!res.ok) {+ const body = await res.text().catch(() => "");+ throw new Error(`Quote request failed (${res.status}): ${body}`);+ }++ const data: PumpCrossChainQuoteResponse = await res.json();++ return {+ fromChainId: request.fromChainId,+ fromToken: request.fromToken,+ fromAmount: BigInt(data.fromAmount),+ toAmountUsdc: BigInt(data.toAmountUsdc),+ estimatedUsd: data.estimatedUsd,+ bridgeFeeUsd: data.bridgeFeeUsd,+ estimatedTimeSeconds: data.estimatedTimeSeconds,+ quoteId: data.quoteId,+ expiresAt: data.expiresAt,+ };+}++/** Throws if the quote has expired (with buffer). */+export function assertQuoteValid(quote: CrossChainQuote): void {+ const nowSeconds = Math.floor(Date.now() / 1000);+ if (nowSeconds >= quote.expiresAt - QUOTE_EXPIRY_BUFFER_SECONDS) {+ throw new Error(+ `Quote ${quote.quoteId} has expired. Fetch a new quote before submitting.`+ );+ }+}++/**+ * Convenience: get the USD price of a token amount using Pump.fun price API.+ * Useful for displaying "you're paying ~$X" before fetching a full quote.+ */+export async function getTokenUsdPrice(+ chainId: SupportedEvmChainId,+ tokenAddress: Address | "native"+): Promise<number> {+ const chain = getChain(chainId);+ const addr =+ tokenAddress === "native"+ ? "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"+ : tokenAddress;++ const res = await fetch(+ `${PUMP_CROSSCHAIN_API}/price?network=${chain.moonpayNetwork}&token=${addr}`+ );+ if (!res.ok) throw new Error(`Price fetch failed (${res.status})`);+ const data: { usdPrice: number } = await res.json();+ return data.usdPrice;+}diff --git a/agent-payments-sdk/src/evm/transaction.ts b/agent-payments-sdk/src/evm/transaction.tsnew file mode 100644index 000000000..fa8eaebbb--- /dev/null+++ b/agent-payments-sdk/src/evm/transaction.ts@@ -0,0 +1,138 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import {+ encodeFunctionData,+ maxUint256,+ type Address,+ type Hex,+} from "viem";+import type { EvmPaymentParams, EvmPaymentTransaction } from "../types.js";+import { getChain } from "../chains.js";+import { ERC20_ABI, PUMP_CROSSCHAIN_API } from "../constants.js";+import { assertQuoteValid } from "./quote.js";++interface PumpBridgeTxResponse {+ /** Address of the Pump/MoonPay bridge contract to call */+ to: string;+ /** Encoded calldata */+ data: string;+ /** Native value to send (hex string) */+ value: string;+ /** ERC-20 spender that needs approval (absent when paying with native) */+ approvalSpender?: string;+}++/**+ * Fetch the bridge transaction calldata from Pump.fun's cross-chain API+ * and wrap it with an optional ERC-20 approval transaction.+ *+ * The returned transactions should be sent in order:+ * 1. approval (if present) — wait for confirmation+ * 2. bridge+ */+export async function buildEvmPaymentTransaction(+ params: EvmPaymentParams,+ apiKey?: string+): Promise<EvmPaymentTransaction> {+ assertQuoteValid(params.quote);++ const chain = getChain(params.quote.fromChainId);+ const headers: Record<string, string> = { "Content-Type": "application/json" };+ if (apiKey) headers["x-api-key"] = apiKey;++ const res = await fetch(`${PUMP_CROSSCHAIN_API}/build-tx`, {+ method: "POST",+ headers,+ body: JSON.stringify({+ quoteId: params.quote.quoteId,+ fromChainId: params.quote.fromChainId,+ fromToken:+ params.quote.fromToken === "native"+ ? "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"+ : params.quote.fromToken,+ fromAmount: params.quote.fromAmount.toString(),+ sender: params.sender,+ agentMint: params.agentMint,+ destinationSolanaWallet: params.destinationSolanaWallet,+ memo: params.memo,+ }),+ });++ if (!res.ok) {+ const body = await res.text().catch(() => "");+ throw new Error(`Bridge tx build failed (${res.status}): ${body}`);+ }++ const data: PumpBridgeTxResponse = await res.json();++ const bridge: EvmPaymentTransaction["bridge"] = {+ to: data.to as Address,+ data: data.data as Hex,+ value: BigInt(data.value),+ chainId: params.quote.fromChainId,+ };++ // ERC-20 approval required when not paying with native currency+ if (+ params.quote.fromToken !== "native" &&+ data.approvalSpender+ ) {+ const approvalData = encodeFunctionData({+ abi: ERC20_ABI,+ functionName: "approve",+ args: [data.approvalSpender as Address, maxUint256],+ });++ return {+ approval: {+ to: params.quote.fromToken as Address,+ data: approvalData,+ value: 0n,+ },+ bridge,+ };+ }++ return { bridge };+}++/**+ * Check whether the sender already has sufficient ERC-20 allowance,+ * so the UI can skip showing an approval step.+ */+export async function checkAllowance(+ tokenAddress: Address,+ owner: Address,+ spender: Address,+ amount: bigint,+ rpcUrl: string+): Promise<boolean> {+ const body = {+ jsonrpc: "2.0",+ id: 1,+ method: "eth_call",+ params: [+ {+ to: tokenAddress,+ data: encodeFunctionData({+ abi: ERC20_ABI,+ functionName: "allowance",+ args: [owner, spender],+ }),+ },+ "latest",+ ],+ };++ const res = await fetch(rpcUrl, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify(body),+ });++ const json: { result: Hex } = await res.json();+ const allowance = BigInt(json.result);+ return allowance >= amount;+}diff --git a/agent-payments-sdk/src/evm/types.ts b/agent-payments-sdk/src/evm/types.tsnew file mode 100644index 000000000..6f3614043--- /dev/null+++ b/agent-payments-sdk/src/evm/types.ts@@ -0,0 +1,166 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { Address, Hash, Hex } from "viem";+import type { EvmChainId } from "./addresses.js";++/** Mirrors Solana's TokenAgentPayments account */+export interface EvmAgentConfig {+ agentToken: Address;+ authority: Address;+ buybackBps: number;+ exists: boolean;+}++/** Mirrors Solana's AgentBalances */+export interface EvmAgentBalances {+ agentToken: Address;+ currencyToken: Address;+ paymentVault: bigint;+ buybackVault: bigint;+ withdrawVault: bigint;+}++/** Mirrors Solana's TokenAgentPaymentInCurrency */+export interface EvmPaymentStats {+ agentToken: Address;+ currencyToken: Address;+ totalPayments: bigint;+ totalBuybacks: bigint;+ totalWithdrawn: bigint;+ tokensBurned: bigint;+}++/** Mirrors Solana's CreateParams */+export interface EvmCreateParams {+ agentToken: Address;+ agentAuthority: Address;+ buybackBps: number;+}++/** Mirrors Solana's AcceptPaymentSimpleParams */+export interface EvmAcceptPaymentParams {+ agentToken: Address;+ currencyToken: Address | "native";+ amount: bigint;+ memo: bigint;+ startTime: bigint;+ endTime: bigint;+}++/** Mirrors Solana's DistributePaymentsParams */+export interface EvmDistributePaymentsParams {+ agentToken: Address;+ currencyToken: Address;+}++/** Mirrors Solana's BuybackTriggerParams */+export interface EvmBuybackTriggerParams {+ agentToken: Address;+ currencyToken: Address;+ swapRouter: Address;+ swapData: Hex;+}++/** Mirrors Solana's WithdrawParams */+export interface EvmWithdrawParams {+ agentToken: Address;+ currencyToken: Address;+ receiver: Address;+}++export interface EvmUpdateBuybackBpsParams {+ agentToken: Address;+ buybackBps: number;+}++export interface EvmUpdateAuthorityParams {+ agentToken: Address;+ newAuthority: Address;+}++/** A built unsigned EVM transaction ready for the user's wallet to sign */+export interface EvmUnsignedTx {+ to: Address;+ data: Hex;+ value: bigint;+ chainId: EvmChainId;+}++/** An optional ERC-20 approval + main transaction pair */+export interface EvmTxBundle {+ /** ERC-20 approval — present when paying with an ERC-20 token */+ approval?: EvmUnsignedTx;+ /** The main contract call */+ tx: EvmUnsignedTx;+}++/** Mirrors Solana's invoice validation result */+export interface EvmInvoiceValidationResult {+ paid: boolean;+ invoiceId: Hash;+ txHash?: Hash;+ blockNumber?: bigint;+}++// ── Events (mirrors Solana event types) ─────────────────────────────────────++export interface EvmAgentCreatedEvent {+ name: "AgentCreated";+ agentToken: Address;+ authority: Address;+ buybackBps: number;+ txHash: Hash;+ blockNumber: bigint;+}++export interface EvmPaymentAcceptedEvent {+ name: "PaymentAccepted";+ agentToken: Address;+ payer: Address;+ currencyToken: Address;+ amount: bigint;+ memo: bigint;+ invoiceId: Hash;+ txHash: Hash;+ blockNumber: bigint;+}++export interface EvmPaymentsDistributedEvent {+ name: "PaymentsDistributed";+ agentToken: Address;+ currencyToken: Address;+ buybackAmount: bigint;+ withdrawAmount: bigint;+ txHash: Hash;+ blockNumber: bigint;+}++export interface EvmBuybackTriggeredEvent {+ name: "BuybackTriggered";+ agentToken: Address;+ currencyToken: Address;+ currencySpent: bigint;+ tokensBurned: bigint;+ txHash: Hash;+ blockNumber: bigint;+}++export interface EvmWithdrawnEvent {+ name: "Withdrawn";+ agentToken: Address;+ authority: Address;+ currencyToken: Address;+ amount: bigint;+ receiver: Address;+ txHash: Hash;+ blockNumber: bigint;+}++export type EvmAgentEvent =+ | EvmAgentCreatedEvent+ | EvmPaymentAcceptedEvent+ | EvmPaymentsDistributedEvent+ | EvmBuybackTriggeredEvent+ | EvmWithdrawnEvent;diff --git a/agent-payments-sdk/src/evm/validate.ts b/agent-payments-sdk/src/evm/validate.tsnew file mode 100644index 000000000..0c52c9b0c--- /dev/null+++ b/agent-payments-sdk/src/evm/validate.ts@@ -0,0 +1,87 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type {+ CrossChainPaymentStatusResult,+ EvmPaymentReceipt,+} from "../types.js";+import { PUMP_CROSSCHAIN_API, STATUS_POLL_INTERVAL_MS, STATUS_TIMEOUT_MS } from "../constants.js";++/**+ * Poll Pump.fun's cross-chain API until the payment arrives on Solana+ * or the timeout is reached.+ *+ * Resolves with status "arrived_on_solana" and the Solana tx signature,+ * or rejects with the last known status on timeout.+ */+export async function waitForSolanaArrival(+ receipt: EvmPaymentReceipt,+ opts: { timeoutMs?: number; pollIntervalMs?: number } = {}+): Promise<CrossChainPaymentStatusResult> {+ const timeout = opts.timeoutMs ?? STATUS_TIMEOUT_MS;+ const interval = opts.pollIntervalMs ?? STATUS_POLL_INTERVAL_MS;+ const deadline = Date.now() + timeout;++ while (Date.now() < deadline) {+ const status = await getPaymentStatus(receipt.depositId);++ if (status.status === "arrived_on_solana" || status.status === "failed") {+ return status;+ }++ await new Promise((resolve) => setTimeout(resolve, interval));+ }++ throw new Error(+ `Cross-chain payment ${receipt.depositId} did not arrive within ${timeout / 1000}s`+ );+}++/** Single status check — use this if you want to poll manually. */+export async function getPaymentStatus(+ depositId: string+): Promise<CrossChainPaymentStatusResult> {+ const res = await fetch(`${PUMP_CROSSCHAIN_API}/status/${depositId}`);++ if (!res.ok) {+ const body = await res.text().catch(() => "");+ throw new Error(`Status check failed (${res.status}): ${body}`);+ }++ const data: {+ status: string;+ solanaSignature?: string;+ error?: string;+ } = await res.json();++ const mapped = mapStatus(data.status);++ return {+ status: mapped,+ depositId,+ solanaSignature: data.solanaSignature,+ error: data.error,+ };+}++function mapStatus(raw: string): CrossChainPaymentStatusResult["status"] {+ switch (raw) {+ case "pending":+ case "waitingForDeposit":+ return "pending_evm_confirmation";+ case "processing":+ case "bridging":+ case "inTransit":+ return "bridging";+ case "completed":+ case "settled":+ return "arrived_on_solana";+ case "failed":+ case "expired":+ case "refunded":+ return "failed";+ default:+ return "bridging";+ }+}diff --git a/agent-payments-sdk/src/index.ts b/agent-payments-sdk/src/index.tsindex 757cd0e75..a16553cbc 100644--- a/agent-payments-sdk/src/index.ts+++ b/agent-payments-sdk/src/index.ts@@ -1,115 +1,14 @@-/**- * @pump-fun/agent-payments-sdk- * TypeScript SDK for Pump Agent Payments- */+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.-// IDL type-export type { PumpAgentPayments } from "./idl/pump_agent_payments";+// ── Solana — full source (PumpAgent, PumpAgentOffline, PDAs, events, x402, solana-agent-kit)+export * from "./solana/index.js";-// Program helpers-export {- getPumpProgram,- OFFLINE_PUMP_PROGRAM,- getPumpProgramWithFallback,- getOfflineProgram,-} from "./program";+// ── EVM — EvmAgent, EvmAgentOffline, ABI, addresses, events, invoice utils+export * from "./evm/index.js";-// PDA derivation-export {- PROGRAM_ID,- PUMP_PROGRAM_ID,- GLOBAL_CONFIG_SEED,- TOKEN_AGENT_PAYMENTS_SEED,- PAYMENT_IN_CURRENCY_SEED,- INVOICE_ID_SEED,- BUYBACK_AUTHORITY_SEED,- WITHDRAW_AUTHORITY_SEED,- BONDING_CURVE_SEED,- TOKEN_AGENT_PAYMENTS_MIN_RENT_EXEMPT_LAMPORTS,- getGlobalConfigPDA,- getTokenAgentPaymentsPDA,- getPaymentInCurrencyPDA,- getInvoiceIdPDA,- getBuybackAuthorityPDA,- getWithdrawAuthorityPDA,- getBondingCurvePDA,-} from "./pdas";--// Classes-export { PumpAgentOffline } from "./PumpAgentOffline";-export { PumpAgent } from "./PumpAgent";--// Decoders-export {- decodeGlobalConfig,- decodeTokenAgentPaymentInCurrency,- decodeTokenAgentPayments,-} from "./decoders";--// Types-export type {- PumpEnvironment,- VaultBalance,- AgentBalances,- CreateParams,- WithdrawParams,- UpdateBuybackBpsParams,- UpdateBuybackBpsOptions,- AcceptPaymentParams,- AcceptPaymentSimpleParams,- BuildAcceptPaymentParams,- DistributePaymentsParams,- BuybackTriggerParams,- ExtendAccountParams,- UpdateAuthorityParams,- CloseAccountParams,- GlobalConfig,- TokenAgentPaymentInCurrency,- TokenAgentPayments,-} from "./types";--// Convenience re-export-import { PublicKey, type Connection } from "@solana/web3.js";-import type { Program } from "@coral-xyz/anchor";-import type { PumpAgentPayments } from "./idl/pump_agent_payments";-import IDL from "./idl/pump_agent_payments.json";-import { getPumpProgram } from "./program";--export const PUMP_AGENT_PAYMENTS_PROGRAM_ID = new PublicKey(IDL.address);--export function getProgram(- connection: Connection,-): Program<PumpAgentPayments> {- return getPumpProgram(connection);-}--// Events-export {- createEventParser,- parseAgentEvents,- subscribeToAgentEvents,-} from "./events";-export type {- AgentAcceptPaymentEvent,- AgentBuybackTriggerEvent,- AgentDistributePaymentsEvent,- AgentInitializeEvent,- AgentUpdateAuthorityEvent,- AgentUpdateBuybackBpsEvent,- AgentWithdrawEvent,- ExtendAccountEvent,- GlobalAddNewCurrencyEvent,- GlobalConfigInitializeEvent,- GlobalUpdateAuthoritiesEvent,- AgentEventName,- AgentEventData,- ParsedAgentEvent,- EventSubscriptionOptions,- EventSubscription,-} from "./events";--// solana-agent-kit plugin-export { PumpAgentPaymentsPlugin } from "./solana-agent-kit";--// x402 protocol-export * as x402 from "./x402";+// ── Namespaced sub-path re-exports+export * as solana from "./solana/index.js";+export * as evm from "./evm/index.js";+export * as x402Evm from "./x402/index.js";diff --git a/agent-payments-sdk/src/solana/PumpAgent.test.ts b/agent-payments-sdk/src/solana/PumpAgent.test.tsnew file mode 100644index 000000000..0f1f52ea2--- /dev/null+++ b/agent-payments-sdk/src/solana/PumpAgent.test.ts@@ -0,0 +1,158 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { describe, it, expect, beforeEach, vi } from "vitest";+import { Keypair, PublicKey, type AccountInfo } from "@solana/web3.js";+import {+ NATIVE_MINT,+ TOKEN_PROGRAM_ID,+ TOKEN_2022_PROGRAM_ID,+} from "@solana/spl-token";++import { PumpAgent } from "./PumpAgent";+import { PumpAgentOffline, USDC_MINT } from "./PumpAgentOffline";++function fakeAccountInfo(+ data: Buffer,+ owner = TOKEN_PROGRAM_ID,+): AccountInfo<Buffer> {+ return {+ executable: false,+ lamports: 1_000_000,+ owner,+ data,+ rentEpoch: 0,+ };+}++describe("PumpAgent.getAllCurrencyBalances", () => {+ beforeEach(() => {+ PumpAgentOffline._clearCoinQuoteMintCache();+ });++ it("returns SOL + every non-default mint from GlobalConfig, keyed by base58", async () => {+ const agentMint = Keypair.generate().publicKey;+ const otherMint = Keypair.generate().publicKey;++ // Mock connection: provides token-program owner for SPL mints + token+ // balances for ATAs.+ const getMultipleAccountsInfo = vi.fn(async (keys: PublicKey[]) =>+ keys.map((k) =>+ // USDC and otherMint return TOKEN_PROGRAM_ID owner; otherMint+ // returns TOKEN_2022_PROGRAM_ID to exercise that path.+ k.equals(otherMint)+ ? fakeAccountInfo(Buffer.alloc(82), TOKEN_2022_PROGRAM_ID)+ : fakeAccountInfo(Buffer.alloc(82), TOKEN_PROGRAM_ID),+ ),+ );+ const getTokenAccountBalance = vi.fn(async () => ({+ value: { amount: "123", decimals: 6, uiAmount: 0.000123, uiAmountString: "0.000123" },+ context: { slot: 0 },+ }));++ const connection = {+ getMultipleAccountsInfo,+ getTokenAccountBalance,+ } as unknown as import("@solana/web3.js").Connection;++ const agent = new PumpAgent(agentMint, "mainnet", connection);++ // Spy on getGlobalConfig which internally calls program.account.GlobalConfig.fetch.+ vi.spyOn(agent, "getGlobalConfig").mockResolvedValue({+ supportedCurrenciesMint: [+ USDC_MINT,+ otherMint,+ ...Array(8).fill(PublicKey.default),+ ],+ } as never);++ const balances = await agent.getAllCurrencyBalances();++ expect(balances.has(NATIVE_MINT.toBase58())).toBe(true);+ expect(balances.has(USDC_MINT.toBase58())).toBe(true);+ expect(balances.has(otherMint.toBase58())).toBe(true);+ expect(balances.size).toBe(3);++ const sol = balances.get(NATIVE_MINT.toBase58())!;+ expect(sol.quoteMint.equals(NATIVE_MINT)).toBe(true);+ expect(sol.paymentVault.balance).toBe(123n);+ expect(sol.buybackVault.balance).toBe(123n);+ expect(sol.withdrawVault.balance).toBe(123n);++ const usdc = balances.get(USDC_MINT.toBase58())!;+ expect(usdc.quoteMint.equals(USDC_MINT)).toBe(true);++ // 3 SPL ATAs × 3 vaults + 3 SOL ATAs = 9; + 1 batched account fetch for token programs+ expect(getMultipleAccountsInfo).toHaveBeenCalledTimes(1);+ // Each currency has 3 vault balance lookups → 9 calls total+ expect(getTokenAccountBalance).toHaveBeenCalledTimes(9);+ });++ it("returns just SOL when GlobalConfig has no SPL currencies", async () => {+ const agentMint = Keypair.generate().publicKey;++ const getMultipleAccountsInfo = vi.fn(async () => []);+ const getTokenAccountBalance = vi.fn(async () => ({+ value: { amount: "0", decimals: 9, uiAmount: 0, uiAmountString: "0" },+ context: { slot: 0 },+ }));++ const connection = {+ getMultipleAccountsInfo,+ getTokenAccountBalance,+ } as unknown as import("@solana/web3.js").Connection;++ const agent = new PumpAgent(agentMint, "mainnet", connection);++ vi.spyOn(agent, "getGlobalConfig").mockResolvedValue({+ supportedCurrenciesMint: Array(10).fill(PublicKey.default),+ } as never);++ const balances = await agent.getAllCurrencyBalances();+ expect(balances.size).toBe(1);+ expect(balances.has(NATIVE_MINT.toBase58())).toBe(true);+ // No SPL mints → no batched RPC for owners.+ expect(getMultipleAccountsInfo).not.toHaveBeenCalled();+ });+});++describe("PumpAgent.getCoinQuoteMint", () => {+ beforeEach(() => {+ PumpAgentOffline._clearCoinQuoteMintCache();+ });++ it("delegates to the static cached helper", async () => {+ const agentMint = Keypair.generate().publicKey;+ const baseMint = Keypair.generate().publicKey;++ // Synthetic bonding-curve buffer with USDC quote.+ const buf = Buffer.alloc(8 + 40 + 1 + 32 + 1 + 1 + 32);+ USDC_MINT.toBuffer().copy(buf, 8 + 40 + 1 + 32 + 1 + 1);++ const connection = {+ getAccountInfo: vi.fn().mockResolvedValue(fakeAccountInfo(buf)),+ } as unknown as import("@solana/web3.js").Connection;++ const agent = new PumpAgent(agentMint, "mainnet", connection);+ const q = await agent.getCoinQuoteMint(baseMint);+ expect(q.equals(USDC_MINT)).toBe(true);+ });+});++describe("PumpAgent.getBalances", () => {+ it("populates the new quoteMint field", async () => {+ const agentMint = Keypair.generate().publicKey;+ const connection = {+ getTokenAccountBalance: vi.fn(async () => ({+ value: { amount: "5", decimals: 6, uiAmount: 0, uiAmountString: "0" },+ context: { slot: 0 },+ })),+ } as unknown as import("@solana/web3.js").Connection;++ const agent = new PumpAgent(agentMint, "mainnet", connection);+ const balances = await agent.getBalances(USDC_MINT);+ expect(balances.quoteMint.equals(USDC_MINT)).toBe(true);+ expect(balances.paymentVault.balance).toBe(5n);+ });+});diff --git a/agent-payments-sdk/src/PumpAgent.ts b/agent-payments-sdk/src/solana/PumpAgent.tssimilarity index 80%rename from agent-payments-sdk/src/PumpAgent.tsrename to agent-payments-sdk/src/solana/PumpAgent.tsindex 526a0efa8..994031d38 100644--- a/agent-payments-sdk/src/PumpAgent.ts+++ b/agent-payments-sdk/src/solana/PumpAgent.ts@@ -1,15 +1,20 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+import {type Connection,PublicKey,type TransactionInstruction,} from "@solana/web3.js";import {+ NATIVE_MINT,TOKEN_PROGRAM_ID,getAssociatedTokenAddressSync,} from "@solana/spl-token";import { BN, EventParser } from "@coral-xyz/anchor";-import { PumpAgentOffline } from "./PumpAgentOffline";+import { PumpAgentOffline, resolveTokenProgramForMint } from "./PumpAgentOffline";import { getPumpProgramWithFallback } from "./program";import {getBuybackAuthorityPDA,@@ -104,12 +109,93 @@ export class PumpAgent extends PumpAgentOffline {]);return {+ quoteMint: currencyMint,paymentVault: { address: paymentAta, balance: paymentBal },buybackVault: { address: buybackAta, balance: buybackBal },withdrawVault: { address: withdrawAta, balance: withdrawBal },};}+ /**+ * Fetch balances for every currency this agent could receive — i.e. SOL+ * (always) plus every non-default mint in `GlobalConfig.supportedCurrenciesMint`.+ *+ * Returned map is keyed by `mint.toBase58()`. Lookups happen concurrently.+ */+ async getAllCurrencyBalances(): Promise<Map<string, AgentBalances>> {+ const connection = this.connection;+ if (!connection) throw new Error("Connection is required");++ const cfg = await this.getGlobalConfig();++ const splMints = cfg.supportedCurrenciesMint.filter(+ (m: PublicKey) => !PublicKey.default.equals(m),+ );++ // Resolve token programs for SPL mints in one batched RPC.+ const accountInfos = splMints.length+ ? await connection.getMultipleAccountsInfo(splMints)+ : [];++ type MintTp = { mint: PublicKey; tokenProgram: PublicKey };+ const queries: MintTp[] = [+ { mint: NATIVE_MINT, tokenProgram: TOKEN_PROGRAM_ID },+ ];+ for (const [idx, mint] of splMints.entries()) {+ // Skip NATIVE_MINT if it somehow appears in the SPL list — already added.+ if (mint.equals(NATIVE_MINT)) continue;+ const info = accountInfos[idx];+ if (!info) continue;+ queries.push({ mint, tokenProgram: info.owner });+ }++ const results = await Promise.all(+ queries.map(async ({ mint, tokenProgram }) => {+ const balances = await this.getBalances(mint, tokenProgram);+ return [mint.toBase58(), balances] as const;+ }),+ );++ return new Map(results);+ }++ async getCoinQuoteMint(baseMint: PublicKey): Promise<PublicKey> {+ const connection = this.connection;+ if (!connection) throw new Error("Connection is required");+ return PumpAgentOffline.getCoinQuoteMint(connection, baseMint);+ }++ async getCoinPaymentSummary(baseMint: PublicKey): Promise<{+ quoteMint: PublicKey;+ totalPaymentsReceived: BN;+ pendingBuyback: BN;+ pendingWithdrawal: BN;+ readyToDistribute: boolean;+ }> {+ const connection = this.connection;+ if (!connection) throw new Error("Connection is required");++ const quoteMint = await PumpAgentOffline.getCoinQuoteMint(connection, baseMint);+ const tp = await resolveTokenProgramForMint(connection, quoteMint);++ const [balances, stats] = await Promise.all([+ this.getBalances(quoteMint, tp),+ this.getPaymentStats(quoteMint).catch(() => null),+ ]);++ const totalPaymentsReceived = stats+ ? new BN(stats.totalInvoicePaymentsMade.toString())+ : new BN(0);++ return {+ quoteMint,+ totalPaymentsReceived,+ pendingBuyback: new BN(balances.buybackVault.balance.toString()),+ pendingWithdrawal: new BN(balances.withdrawVault.balance.toString()),+ readyToDistribute: balances.paymentVault.balance > 0n,+ };+ }+/*** Returns the `agent_update_buyback_bps` instruction and auto-fetches* supported currencies from GlobalConfig when options are omitted.diff --git a/agent-payments-sdk/src/solana/PumpAgentOffline.test.ts b/agent-payments-sdk/src/solana/PumpAgentOffline.test.tsnew file mode 100644index 000000000..ee232cb3e--- /dev/null+++ b/agent-payments-sdk/src/solana/PumpAgentOffline.test.ts@@ -0,0 +1,287 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { describe, it, expect, beforeEach, vi, afterEach } from "vitest";+import { Keypair, PublicKey, type AccountInfo } from "@solana/web3.js";+import { NATIVE_MINT, TOKEN_PROGRAM_ID } from "@solana/spl-token";+import { BN } from "@coral-xyz/anchor";++import {+ PumpAgentOffline,+ USDC_MINT,+ decodeBondingCurveQuoteMint,+} from "./PumpAgentOffline";+import { JupiterUnavailableError } from "./errors";+import { getBondingCurvePDA } from "./pdas";++function buildBondingCurveBuffer(quoteMint: PublicKey): Buffer {+ const buf = Buffer.alloc(8 + 40 + 1 + 32 + 1 + 1 + 32);+ buf.writeUInt8(23, 0);+ quoteMint.toBuffer().copy(buf, 8 + 40 + 1 + 32 + 1 + 1);+ return buf;+}++function fakeAccountInfo(+ data: Buffer,+ owner = TOKEN_PROGRAM_ID,+): AccountInfo<Buffer> {+ return {+ executable: false,+ lamports: 1_000_000,+ owner,+ data,+ rentEpoch: 0,+ };+}++function makeMockProgram(supportedMints: PublicKey[]) {+ return {+ account: {+ GlobalConfig: {+ fetch: vi+ .fn()+ .mockResolvedValue({ supportedCurrenciesMint: supportedMints }),+ },+ },+ } as never;+}++describe("decodeBondingCurveQuoteMint", () => {+ it("returns NATIVE_MINT for legacy buffers shorter than the post-multi-quote layout", () => {+ expect(decodeBondingCurveQuoteMint(Buffer.alloc(50))).toEqual(NATIVE_MINT);+ });++ it("returns the embedded quote mint for full buffers", () => {+ const usdcBuf = buildBondingCurveBuffer(USDC_MINT);+ expect(decodeBondingCurveQuoteMint(usdcBuf).equals(USDC_MINT)).toBe(true);+ });++ it("returns NATIVE_MINT when quote_mint is the all-zero default", () => {+ const buf = buildBondingCurveBuffer(PublicKey.default);+ expect(decodeBondingCurveQuoteMint(buf).equals(NATIVE_MINT)).toBe(true);+ });+});++describe("PumpAgentOffline.getCoinQuoteMint", () => {+ const baseMint = Keypair.generate().publicKey;++ beforeEach(() => {+ PumpAgentOffline._clearCoinQuoteMintCache();+ });++ it("decodes USDC from the bonding-curve account and caches the result", async () => {+ const buf = buildBondingCurveBuffer(USDC_MINT);+ const getAccountInfo = vi.fn().mockResolvedValue(fakeAccountInfo(buf));+ const connection = {+ getAccountInfo,+ } as unknown as import("@solana/web3.js").Connection;++ const quote = await PumpAgentOffline.getCoinQuoteMint(connection, baseMint);+ expect(quote.equals(USDC_MINT)).toBe(true);+ expect(getAccountInfo).toHaveBeenCalledTimes(1);++ const quote2 = await PumpAgentOffline.getCoinQuoteMint(+ connection,+ baseMint,+ );+ expect(quote2.equals(USDC_MINT)).toBe(true);+ expect(getAccountInfo).toHaveBeenCalledTimes(1);++ const [bcPda] = getBondingCurvePDA(baseMint);+ expect(getAccountInfo.mock.calls[0]?.[0].equals(bcPda)).toBe(true);+ });++ it("throws when the bonding curve account does not exist", async () => {+ const connection = {+ getAccountInfo: vi.fn().mockResolvedValue(null),+ } as unknown as import("@solana/web3.js").Connection;++ await expect(+ PumpAgentOffline.getCoinQuoteMint(connection, baseMint),+ ).rejects.toThrow(/Bonding curve account not found/);+ });+});++describe("PumpAgentOffline.acceptPaymentForCoin", () => {+ beforeEach(() => {+ PumpAgentOffline._clearCoinQuoteMintCache();+ });++ it("resolves quoteMint via bonding curve and forwards it as currencyMint", async () => {+ const baseMint = Keypair.generate().publicKey;+ const user = Keypair.generate().publicKey;+ const userAta = Keypair.generate().publicKey;++ const bcBuf = buildBondingCurveBuffer(USDC_MINT);+ const connection = {+ getAccountInfo: vi+ .fn()+ .mockResolvedValueOnce(fakeAccountInfo(bcBuf))+ .mockResolvedValue(fakeAccountInfo(Buffer.alloc(82), TOKEN_PROGRAM_ID)),+ } as unknown as import("@solana/web3.js").Connection;++ const agent = PumpAgentOffline.load(Keypair.generate().publicKey);+ const acceptSpy = vi.spyOn(agent, "acceptPayment");++ await agent.acceptPaymentForCoin({+ connection,+ user,+ userTokenAccount: userAta,+ baseMint,+ amount: new BN(1_000_000),+ memo: new BN(42),+ startTime: new BN(0),+ endTime: new BN(9999999999),+ });++ expect(acceptSpy).toHaveBeenCalledTimes(1);+ const fwd = acceptSpy.mock.calls[0]?.[0];+ expect(fwd?.currencyMint.equals(USDC_MINT)).toBe(true);+ expect(fwd?.tokenProgram?.equals(TOKEN_PROGRAM_ID)).toBe(true);+ expect(fwd?.user.equals(user)).toBe(true);+ expect(fwd?.amount.toString()).toBe("1000000");+ });+});++describe("PumpAgentOffline.validateCurrencySupport", () => {+ beforeEach(() => {+ PumpAgentOffline._clearCoinQuoteMintCache();+ });++ it("returns supported=false when quote mint is not in GlobalConfig", async () => {+ const baseMint = Keypair.generate().publicKey;+ const bcBuf = buildBondingCurveBuffer(USDC_MINT);+ const connection = {+ getAccountInfo: vi.fn().mockResolvedValue(fakeAccountInfo(bcBuf)),+ } as unknown as import("@solana/web3.js").Connection;++ const otherMint = Keypair.generate().publicKey;+ const agent = new PumpAgentOffline(+ Keypair.generate().publicKey,+ makeMockProgram([otherMint, PublicKey.default]),+ );++ await expect(+ agent.validateCurrencySupport({ connection, baseMint }),+ ).resolves.toMatchObject({ supported: false });+ });++ it("returns supported=true for SOL (NATIVE_MINT) coins regardless of GlobalConfig", async () => {+ const baseMint = Keypair.generate().publicKey;+ const bcBuf = buildBondingCurveBuffer(PublicKey.default);+ const connection = {+ getAccountInfo: vi.fn().mockResolvedValue(fakeAccountInfo(bcBuf)),+ } as unknown as import("@solana/web3.js").Connection;++ const agent = new PumpAgentOffline(+ Keypair.generate().publicKey,+ makeMockProgram([]),+ );++ await expect(+ agent.validateCurrencySupport({ connection, baseMint }),+ ).resolves.toMatchObject({ supported: true });+ });++ it("returns supported=true when quote mint IS in GlobalConfig", async () => {+ const baseMint = Keypair.generate().publicKey;+ const bcBuf = buildBondingCurveBuffer(USDC_MINT);+ const connection = {+ getAccountInfo: vi.fn().mockResolvedValue(fakeAccountInfo(bcBuf)),+ } as unknown as import("@solana/web3.js").Connection;++ const agent = new PumpAgentOffline(+ Keypair.generate().publicKey,+ makeMockProgram([USDC_MINT, PublicKey.default]),+ );++ await expect(+ agent.validateCurrencySupport({ connection, baseMint }),+ ).resolves.toMatchObject({ supported: true });+ });+});++describe("PumpAgentOffline.buildJupiterSwapData (static)", () => {+ const originalFetch = globalThis.fetch;++ afterEach(() => {+ globalThis.fetch = originalFetch;+ vi.restoreAllMocks();+ });++ it("returns a non-empty Buffer with SOL as inputMint", async () => {+ const outputMint = Keypair.generate().publicKey;+ const sampleData = Buffer.from([1, 2, 3, 4, 5]).toString("base64");+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {+ const url = String(input);+ if (url.includes("/quote?")) {+ expect(url).toContain(`inputMint=${NATIVE_MINT.toBase58()}`);+ expect(url).toContain(`outputMint=${outputMint.toBase58()}`);+ expect(url).toContain("slippageBps=50");+ return new Response(JSON.stringify({ outAmount: "100" }), { status: 200 });+ }+ if (url.includes("/swap-instructions")) {+ return new Response(+ JSON.stringify({ swapInstruction: { data: sampleData } }),+ { status: 200 },+ );+ }+ throw new Error(`Unexpected fetch ${url}`);+ });+ globalThis.fetch = fetchMock as unknown as typeof fetch;++ const data = await PumpAgentOffline.buildJupiterSwapData({+ inputMint: NATIVE_MINT,+ outputMint,+ amount: new BN(1_000_000_000),+ });++ expect(Buffer.isBuffer(data)).toBe(true);+ expect(data.length).toBeGreaterThan(0);+ expect(Array.from(data)).toEqual([1, 2, 3, 4, 5]);+ });++ it("returns a non-empty Buffer with USDC as inputMint", async () => {+ const outputMint = Keypair.generate().publicKey;+ const sampleData = Buffer.from([9, 8, 7]).toString("base64");+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {+ const url = String(input);+ if (url.includes("/quote?")) {+ expect(url).toContain(`inputMint=${USDC_MINT.toBase58()}`);+ return new Response(JSON.stringify({ outAmount: "1" }), { status: 200 });+ }+ if (url.includes("/swap-instructions")) {+ return new Response(+ JSON.stringify({ swapInstruction: { data: sampleData } }),+ { status: 200 },+ );+ }+ throw new Error(`Unexpected fetch ${url}`);+ });+ globalThis.fetch = fetchMock as unknown as typeof fetch;++ const data = await PumpAgentOffline.buildJupiterSwapData({+ inputMint: USDC_MINT,+ outputMint,+ amount: new BN(1_000_000),+ });+ expect(data.length).toBe(3);+ });++ it("throws JupiterUnavailableError when /quote returns 5xx after 3 retries", async () => {+ const fetchMock = vi.fn(async () => new Response("nope", { status: 503 }));+ globalThis.fetch = fetchMock as unknown as typeof fetch;++ const outputMint = Keypair.generate().publicKey;+ await expect(+ PumpAgentOffline.buildJupiterSwapData({+ inputMint: USDC_MINT,+ outputMint,+ amount: new BN(1),+ }),+ ).rejects.toBeInstanceOf(JupiterUnavailableError);++ expect(fetchMock).toHaveBeenCalledTimes(3);+ });+});diff --git a/agent-payments-sdk/src/PumpAgentOffline.ts b/agent-payments-sdk/src/solana/PumpAgentOffline.tssimilarity index 59%rename from agent-payments-sdk/src/PumpAgentOffline.tsrename to agent-payments-sdk/src/solana/PumpAgentOffline.tsindex 931db430c..4201d4cde 100644--- a/agent-payments-sdk/src/PumpAgentOffline.ts+++ b/agent-payments-sdk/src/solana/PumpAgentOffline.ts@@ -1,4 +1,9 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+import {+ type AccountMeta,ComputeBudgetProgram,PublicKey,SystemProgram,@@ -8,6 +13,7 @@ import {import {getAssociatedTokenAddressSync,TOKEN_PROGRAM_ID,+ TOKEN_2022_PROGRAM_ID,NATIVE_MINT,createAssociatedTokenAccountIdempotentInstruction,createSyncNativeInstruction,@@ -39,6 +45,67 @@ import type {UpdateBuybackBpsParams,WithdrawParams,} from "./types";+import {+ CurrencyNotSupportedError,+ JupiterUnavailableError,+} from "./errors";++/**+ * USDC mainnet mint — recognised quote currency for pump-fun USDC coins.+ */+export const USDC_MINT = new PublicKey(+ "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",+);++/** Anchor account discriminator length (8 bytes). */+const ANCHOR_DISCRIMINATOR_LEN = 8;++/**+ * Offset of `quote_mint` inside a pump bonding-curve account:+ * - 8 bytes Anchor discriminator+ * - 5 * u64 reserves / supply (40 bytes)+ * - bool complete (1 byte)+ * - pubkey creator (32 bytes)+ * - bool is_mayhem_mode (1 byte)+ * - bool is_cashback_coin (1 byte)+ * → 83+ */+const BONDING_CURVE_QUOTE_MINT_OFFSET =+ ANCHOR_DISCRIMINATOR_LEN + 5 * 8 + 1 + 32 + 1 + 1;++/**+ * Decode the `quote_mint` field from a raw pump BondingCurve account+ * buffer. Returns NATIVE_MINT for legacy accounts shorter than the+ * post-multi-quote layout (those are SOL-only by definition).+ */+export function decodeBondingCurveQuoteMint(data: Buffer): PublicKey {+ if (data.length < BONDING_CURVE_QUOTE_MINT_OFFSET + 32) {+ return NATIVE_MINT;+ }+ const slice = data.subarray(+ BONDING_CURVE_QUOTE_MINT_OFFSET,+ BONDING_CURVE_QUOTE_MINT_OFFSET + 32,+ );+ const pk = new PublicKey(slice);+ return PublicKey.default.equals(pk) ? NATIVE_MINT : pk;+}++/**+ * Resolve the SPL token program (classic or Token-2022) for a mint.+ * Falls back to TOKEN_PROGRAM_ID for SOL/USDC and on RPC misses.+ */+export async function resolveTokenProgramForMint(+ connection: Connection,+ mint: PublicKey,+): Promise<PublicKey> {+ if (mint.equals(NATIVE_MINT) || mint.equals(USDC_MINT)) {+ return TOKEN_PROGRAM_ID;+ }+ const info = await connection.getAccountInfo(mint);+ if (!info) return TOKEN_PROGRAM_ID;+ if (info.owner.equals(TOKEN_2022_PROGRAM_ID)) return TOKEN_2022_PROGRAM_ID;+ return TOKEN_PROGRAM_ID;+}function toBN(value: bigint | number | string): BN {return new BN(value.toString());@@ -429,4 +496,195 @@ export class PumpAgentOffline {}).instruction();}++ // ─── Multi-currency / USDC-aware helpers ────────────────────────────────++ private static readonly _coinQuoteMintCache = new Map<string, PublicKey>();++ static async getCoinQuoteMint(+ connection: Connection,+ baseMint: PublicKey,+ ): Promise<PublicKey> {+ const key = baseMint.toBase58();+ const cached = PumpAgentOffline._coinQuoteMintCache.get(key);+ if (cached) return cached;++ const [bondingCurve] = getBondingCurvePDA(baseMint);+ const info = await connection.getAccountInfo(bondingCurve);+ if (!info) {+ throw new Error(+ `Bonding curve account not found for mint ${key} (PDA ${bondingCurve.toBase58()})`,+ );+ }++ const quoteMint = decodeBondingCurveQuoteMint(info.data);+ PumpAgentOffline._coinQuoteMintCache.set(key, quoteMint);+ return quoteMint;+ }++ static _clearCoinQuoteMintCache(): void {+ PumpAgentOffline._coinQuoteMintCache.clear();+ }++ async acceptPaymentForCoin(params: {+ connection: Connection;+ user: PublicKey;+ userTokenAccount: PublicKey;+ baseMint: PublicKey;+ amount: BN;+ memo: BN;+ startTime: BN;+ endTime: BN;+ }): Promise<TransactionInstruction> {+ const { connection, user, userTokenAccount, baseMint, amount, memo, startTime, endTime } =+ params;++ const quoteMint = await PumpAgentOffline.getCoinQuoteMint(connection, baseMint);+ const tokenProgram = await resolveTokenProgramForMint(connection, quoteMint);++ return this.acceptPayment({+ user,+ userTokenAccount,+ currencyMint: quoteMint,+ amount,+ memo,+ startTime,+ endTime,+ tokenProgram,+ });+ }++ async distributeAndBuybackForCoin(params: {+ connection: Connection;+ user: PublicKey;+ globalBuybackAuthority: PublicKey;+ baseMint: PublicKey;+ swapProgramToInvoke: PublicKey;+ swapInstructionData: Buffer;+ remainingAccounts: AccountMeta[];+ }): Promise<[TransactionInstruction, TransactionInstruction]> {+ const {+ connection,+ user,+ globalBuybackAuthority,+ baseMint,+ swapProgramToInvoke,+ swapInstructionData,+ remainingAccounts,+ } = params;++ const quoteMint = await PumpAgentOffline.getCoinQuoteMint(connection, baseMint);+ const tpCurrency = await resolveTokenProgramForMint(connection, quoteMint);++ const [distributeIx] = await this.distributePayments({+ user,+ currencyMint: quoteMint,+ tokenProgram: tpCurrency,+ });++ const buybackIx = await this.buybackTrigger({+ globalBuybackAuthority,+ currencyMint: quoteMint,+ swapProgramToInvoke,+ swapInstructionData,+ remainingAccounts,+ tokenProgramCurrency: tpCurrency,+ tokenProgram: TOKEN_PROGRAM_ID,+ });++ return [distributeIx, buybackIx];+ }++ static async buildJupiterSwapData(params: {+ inputMint: PublicKey;+ outputMint: PublicKey;+ amount: BN;+ slippageBps?: number;+ jupiterApiBase?: string;+ }): Promise<Buffer> {+ const {+ inputMint,+ outputMint,+ amount,+ slippageBps = 50,+ jupiterApiBase = "https://quote-api.jup.ag/v6",+ } = params;++ const baseUrl = jupiterApiBase.replace(/\/+$/, "");+ const amountStr = amount.toString();++ const retryFetch = async (url: string, init?: RequestInit): Promise<Response> => {+ let lastErr: unknown;+ for (let i = 0; i < 3; i++) {+ if (i > 0) {+ await new Promise<void>((r) => setTimeout(r, 200 * 2 ** (i - 1)));+ }+ try {+ const resp = await fetch(url, init);+ if (resp.ok) return resp;+ lastErr = new JupiterUnavailableError(+ `HTTP ${resp.status} from Jupiter API`,+ url,+ resp.status,+ );+ } catch (err) {+ lastErr = err;+ }+ }+ const msg = lastErr instanceof Error ? lastErr.message : String(lastErr);+ throw new JupiterUnavailableError(+ `Jupiter unavailable after 3 attempts: ${msg}`,+ url,+ );+ };++ const quoteUrl =+ `${baseUrl}/quote` ++ `?inputMint=${inputMint.toBase58()}` ++ `&outputMint=${outputMint.toBase58()}` ++ `&amount=${amountStr}` ++ `&slippageBps=${slippageBps}`;++ const quoteResp = await retryFetch(quoteUrl);+ const quoteResponse = (await quoteResp.json()) as unknown;++ const swapUrl = `${baseUrl}/swap-instructions`;+ const swapResp = await retryFetch(swapUrl, {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify({ quoteResponse, wrapAndUnwrapSol: false }),+ });++ const swapJson = (await swapResp.json()) as { swapInstruction?: { data?: string } };+ const dataB64 = swapJson.swapInstruction?.data;+ if (!dataB64) {+ throw new JupiterUnavailableError(+ "Jupiter swap-instructions response missing swapInstruction.data",+ swapUrl,+ );+ }+ return Buffer.from(dataB64, "base64");+ }++ async validateCurrencySupport(params: {+ connection: Connection;+ baseMint: PublicKey;+ }): Promise<{ supported: boolean; quoteMint: PublicKey; registeredCurrencies: PublicKey[] }> {+ const { connection, baseMint } = params;++ const quoteMint = await PumpAgentOffline.getCoinQuoteMint(connection, baseMint);++ const [globalConfigPda] = getGlobalConfigPDA();+ const cfg = await this.program.account.GlobalConfig.fetch(globalConfigPda);++ const registeredCurrencies = (cfg.supportedCurrenciesMint as PublicKey[]).filter(+ (m) => !PublicKey.default.equals(m),+ );++ const supported =+ quoteMint.equals(NATIVE_MINT) ||+ registeredCurrencies.some((m) => m.equals(quoteMint));++ return { supported, quoteMint, registeredCurrencies };+ }}diff --git a/agent-payments-sdk/src/solana/PumpTradeClient.test.ts b/agent-payments-sdk/src/solana/PumpTradeClient.test.tsnew file mode 100644index 000000000..e489c1236--- /dev/null+++ b/agent-payments-sdk/src/solana/PumpTradeClient.test.ts@@ -0,0 +1,673 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * PumpTradeClient unit tests+ *+ * Strategy: mock @pump-fun/pump-sdk at the module boundary and simulate+ * Connection RPC responses using vi.fn() stubs.+ *+ * Required coverage per spec:+ * - resolveQuoteMint: USDC coin, legacy SOL coin, cache (single getAccountInfo for 2x calls)+ * - quoteForBuy: correct expectedBaseTokens & maxQuoteCost, priceImpactPct > 0+ * - buildBuyInstructions: count > 0, programId = PUMP_PROGRAM_ID, buyV2 discriminator+ * - CoinGraduatedError / CoinNotFoundError+ * - buildSellInstructions: programId, sellV2 discriminator+ * - buildBuyExactQuoteInInstructions: buyExactQuoteInV2 discriminator+ * - fee recipient is always from global.feeRecipients pool+ */++import { BN } from "@coral-xyz/anchor";+import { NATIVE_MINT, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@solana/spl-token";+import { AccountInfo, Connection, PublicKey } from "@solana/web3.js";+import { beforeEach, describe, expect, it, vi } from "vitest";++// ─── Shared test fixtures ────────────────────────────────────────────────────++const FAKE_MINT = new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"); // arbitrary test mint+const FAKE_USER = new PublicKey("DRiP2Pn2K6fuMLKQmt5rZWyHiUZ6WK3GChEySUpHSS4");+const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");++// Discriminators from pump-public-docs/idl/pump.ts+const BUY_V2_DISC = [184, 23, 238, 97, 103, 197, 211, 61];+const SELL_V2_DISC = [93, 246, 130, 60, 231, 233, 64, 178];+const BUY_EXACT_QUOTE_IN_V2_DISC = [194, 171, 28, 70, 104, 77, 91, 47];++// Minimal BondingCurve shape that PumpTradeClient uses+function makeBondingCurve(overrides: Partial<Record<string, unknown>> = {}) {+ return {+ virtualTokenReserves: new BN("1000000000000"),+ virtualQuoteReserves: new BN("30000000000"),+ realTokenReserves: new BN("793100000000000"),+ realQuoteReserves: new BN(0),+ tokenTotalSupply: new BN("1000000000000000"),+ complete: false,+ creator: new PublicKey("DRiP2Pn2K6fuMLKQmt5rZWyHiUZ6WK3GChEySUpHSS4"),+ isMayhemMode: false,+ isCashbackCoin: false,+ quoteMint: PublicKey.default,+ ...overrides,+ };+}++function makeGlobal() {+ return {+ initialized: true,+ authority: PublicKey.default,+ feeRecipient: new PublicKey("CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM"),+ initialVirtualTokenReserves: new BN("1073000000000000"),+ initialVirtualSolReserves: new BN("30000000000"),+ initialRealTokenReserves: new BN("793100000000000"),+ tokenTotalSupply: new BN("1000000000000000"),+ feeBasisPoints: new BN(100),+ withdrawAuthority: PublicKey.default,+ enableMigrate: true,+ poolMigrationFee: new BN(0),+ creatorFeeBasisPoints: new BN(500),+ feeRecipients: [],+ setCreatorAuthority: PublicKey.default,+ adminSetCreatorAuthority: PublicKey.default,+ createV2Enabled: true,+ whitelistPda: PublicKey.default,+ reservedFeeRecipient: new PublicKey("CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM"),+ mayhemModeEnabled: false,+ reservedFeeRecipients: [],+ isCashbackEnabled: true,+ buybackFeeRecipients: [],+ buybackBasisPoints: new BN(0),+ initialVirtualQuoteReserves: new BN("30000000000"),+ whitelistedQuoteMints: [],+ };+}++function makeFeeConfig() {+ return {+ admin: PublicKey.default,+ flatFees: {+ lpFeeBps: new BN(0),+ protocolFeeBps: new BN(100),+ creatorFeeBps: new BN(500),+ },+ feeTiers: [{ marketCapLamportsThreshold: new BN(0), fees: { protocolFeeBps: new BN(100), creatorFeeBps: new BN(500) } }],+ };+}++/** Build a fake AccountInfo<Buffer> wrapping any data. */+function fakeAccountInfo(owner = TOKEN_2022_PROGRAM_ID): AccountInfo<Buffer> {+ return {+ executable: false,+ lamports: 1_000_000,+ owner,+ rentEpoch: 0,+ data: Buffer.alloc(256),+ };+}++// ─── SDK mocks ───────────────────────────────────────────────────────────────++const mockBondingCurve = makeBondingCurve();+const mockGlobal = makeGlobal();+const mockFeeConfig = makeFeeConfig();++vi.mock("@pump-fun/pump-sdk", async (importOriginal) => {+ const orig = await importOriginal<typeof import("@pump-fun/pump-sdk")>();++ const fakePumpSdk = {+ decodeGlobal: vi.fn(() => mockGlobal),+ decodeFeeConfig: vi.fn(() => mockFeeConfig),+ decodeBondingCurve: vi.fn(() => mockBondingCurve),+ decodeUserVolumeAccumulator: vi.fn(() => ({+ currentSolVolume: new BN(1000),+ cashbackEarned: new BN(100),+ })),+ buyV2Instructions: vi.fn(async () => [+ {+ programId: new PublicKey("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),+ keys: Array(10).fill({ pubkey: PublicKey.default, isSigner: false, isWritable: false }),+ data: Buffer.from([184, 23, 238, 97, 103, 197, 211, 61, ...Array(16).fill(0)]),+ },+ ]),+ sellV2Instructions: vi.fn(async () => [+ {+ programId: new PublicKey("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),+ keys: Array(10).fill({ pubkey: PublicKey.default, isSigner: false, isWritable: false }),+ data: Buffer.from([93, 246, 130, 60, 231, 233, 64, 178, ...Array(16).fill(0)]),+ },+ ]),+ claimCashbackV2Instruction: vi.fn(async () => ({+ programId: new PublicKey("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),+ keys: [],+ data: Buffer.from([]),+ })),+ };++ // Fake program for buyExactQuoteInV2+ const fakeInstruction = {+ programId: new PublicKey("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"),+ keys: Array(20).fill({ pubkey: PublicKey.default, isSigner: false, isWritable: false }),+ data: Buffer.from([194, 171, 28, 70, 104, 77, 91, 47]), // buyExactQuoteInV2 discriminator+ };+ const fakeMethodBuilder = {+ accountsPartial: vi.fn().mockReturnThis(),+ instruction: vi.fn(async () => fakeInstruction),+ };+ const fakePumpProgram = {+ methods: {+ buyExactQuoteInV2: vi.fn(() => fakeMethodBuilder),+ },+ };++ return {+ ...orig,+ PUMP_SDK: fakePumpSdk,+ OnlinePumpSdk: class {+ fetchGlobal = vi.fn(async () => mockGlobal);+ fetchFeeConfig = vi.fn(async () => mockFeeConfig);+ },+ getPumpProgram: vi.fn(() => fakePumpProgram),+ // re-export real PDA helpers and math functions from orig+ bondingCurvePda: orig.bondingCurvePda,+ bondingCurveMarketCap: orig.bondingCurveMarketCap,+ getBuyTokenAmountFromSolAmount: orig.getBuyTokenAmountFromSolAmount,+ getBuySolAmountFromTokenAmount: orig.getBuySolAmountFromTokenAmount,+ getSellSolAmountFromTokenAmount: orig.getSellSolAmountFromTokenAmount,+ creatorVaultPda: orig.creatorVaultPda,+ feeSharingConfigPda: orig.feeSharingConfigPda,+ userVolumeAccumulatorPda: orig.userVolumeAccumulatorPda,+ GLOBAL_PDA: orig.GLOBAL_PDA,+ GLOBAL_VOLUME_ACCUMULATOR_PDA: orig.GLOBAL_VOLUME_ACCUMULATOR_PDA,+ PUMP_EVENT_AUTHORITY_PDA: orig.PUMP_EVENT_AUTHORITY_PDA,+ PUMP_FEE_CONFIG_PDA: orig.PUMP_FEE_CONFIG_PDA,+ PUMP_FEE_PROGRAM_ID: orig.PUMP_FEE_PROGRAM_ID,+ PUMP_PROGRAM_ID: orig.PUMP_PROGRAM_ID,+ };+});++// ─── Import after mocks are set up ───────────────────────────────────────────++import {+ CoinGraduatedError,+ CoinNotFoundError,+ InsufficientLiquidityError,+ PumpTradeClient,+} from "./PumpTradeClient.js";++// ─── Connection factory ───────────────────────────────────────────────────────++function makeConnection(overrides: {+ getMultipleAccountsInfo?: (...args: unknown[]) => unknown;+ getAccountInfo?: (...args: unknown[]) => unknown;+ getTokenAccountsByOwner?: (...args: unknown[]) => unknown;+} = {}): Connection {+ const conn = {+ // Default: return 4 slots (Global + FeeConfig + bondingCurve + optional userAta/extra)+ getMultipleAccountsInfo: vi.fn(async () => [+ fakeAccountInfo(), // Global+ fakeAccountInfo(), // FeeConfig+ fakeAccountInfo(), // bondingCurve+ null, // userAta (not created yet)+ ]),+ // Used by resolveQuoteMint and _baseTokenProgram / _quoteTokenProgram+ getAccountInfo: vi.fn(async () => fakeAccountInfo(TOKEN_PROGRAM_ID)),+ getTokenAccountsByOwner: vi.fn(async () => ({ value: [] })),+ ...overrides,+ };+ return conn as unknown as Connection;+}++// ─── Tests ───────────────────────────────────────────────────────────────────++describe("PumpTradeClient", () => {+ // ── resolveQuoteMint ───────────────────────────────────────────────────────++ describe("resolveQuoteMint", () => {+ it("returns NATIVE_MINT for a legacy coin (quoteMint === PublicKey.default)", async () => {+ // mockBondingCurve.quoteMint is already PublicKey.default → NATIVE_MINT+ const conn = makeConnection({+ getAccountInfo: vi.fn(async () => fakeAccountInfo()),+ });+ const client = new PumpTradeClient(conn);+ const result = await client.resolveQuoteMint(FAKE_MINT);+ expect(result.equals(NATIVE_MINT)).toBe(true);+ });++ it("returns the on-chain quoteMint for a v2 USDC coin", async () => {+ const { PUMP_SDK: pumpSdk } = await import("@pump-fun/pump-sdk");+ vi.mocked(pumpSdk.decodeBondingCurve).mockReturnValueOnce(+ makeBondingCurve({ quoteMint: USDC_MINT }) as ReturnType<+ typeof pumpSdk.decodeBondingCurve+ >,+ );++ const conn = makeConnection({+ getAccountInfo: vi.fn(async () => fakeAccountInfo()),+ });+ const client = new PumpTradeClient(conn);+ const result = await client.resolveQuoteMint(FAKE_MINT);+ expect(result.equals(USDC_MINT)).toBe(true);+ });++ it("caches result — second call does not trigger another getAccountInfo", async () => {+ const conn = makeConnection({+ getAccountInfo: vi.fn(async () => fakeAccountInfo()),+ });+ const client = new PumpTradeClient(conn);+ await client.resolveQuoteMint(FAKE_MINT);+ await client.resolveQuoteMint(FAKE_MINT);+ // resolveQuoteMint calls getAccountInfo once for the bonding curve PDA+ // _baseTokenProgram is NOT called here, so exactly 1 call+ expect(conn.getAccountInfo).toHaveBeenCalledTimes(1);+ });++ it("throws CoinNotFoundError when bonding curve account is null", async () => {+ const conn = makeConnection({+ getAccountInfo: vi.fn(async () => null),+ });+ const client = new PumpTradeClient(conn);+ await expect(client.resolveQuoteMint(FAKE_MINT)).rejects.toThrow(+ CoinNotFoundError,+ );+ });+ });++ // ── quoteForBuy ────────────────────────────────────────────────────────────++ describe("quoteForBuy", () => {+ it("returns expectedBaseTokens > 0 and priceImpactPct > 0 for a valid quote", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.quoteForBuy({+ mint: FAKE_MINT,+ quoteAmount: new BN(1_000_000_000), // 1 SOL+ });++ expect(result.quoteMint.equals(NATIVE_MINT)).toBe(true);+ expect(result.expectedBaseTokens.gtn(0)).toBe(true);+ expect(result.maxQuoteCost.gtn(0)).toBe(true);+ expect(result.priceImpactPct).toBeGreaterThan(0);+ });++ it("throws CoinNotFoundError when bonding curve is missing", async () => {+ const conn = makeConnection({+ getMultipleAccountsInfo: vi.fn(async () => [+ fakeAccountInfo(),+ fakeAccountInfo(),+ null, // missing bonding curve+ ]),+ });+ const client = new PumpTradeClient(conn);+ await expect(+ client.quoteForBuy({ mint: FAKE_MINT, quoteAmount: new BN(1_000_000_000) }),+ ).rejects.toThrow(CoinNotFoundError);+ });++ it("throws CoinGraduatedError when bondingCurve.complete === true", async () => {+ const { PUMP_SDK: pumpSdk } = await import("@pump-fun/pump-sdk");+ vi.mocked(pumpSdk.decodeBondingCurve).mockReturnValueOnce(+ makeBondingCurve({ complete: true }) as ReturnType<+ typeof pumpSdk.decodeBondingCurve+ >,+ );++ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ await expect(+ client.quoteForBuy({ mint: FAKE_MINT, quoteAmount: new BN(1_000_000_000) }),+ ).rejects.toThrow(CoinGraduatedError);+ });+ });++ // ── quoteForSell ───────────────────────────────────────────────────────────++ describe("quoteForSell", () => {+ it("returns expectedQuoteOut > 0 and priceImpactPct > 0 for a valid quote", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.quoteForSell({+ mint: FAKE_MINT,+ baseAmount: new BN(10_000_000_000), // 10k tokens (6 decimals)+ });++ expect(result.quoteMint.equals(NATIVE_MINT)).toBe(true);+ expect(result.expectedQuoteOut.gtn(0)).toBe(true);+ expect(result.minQuoteOut.lte(result.expectedQuoteOut)).toBe(true);+ expect(result.priceImpactPct).toBeGreaterThanOrEqual(0);+ });++ it("throws CoinGraduatedError when bondingCurve.complete === true", async () => {+ const { PUMP_SDK: pumpSdk } = await import("@pump-fun/pump-sdk");+ vi.mocked(pumpSdk.decodeBondingCurve).mockReturnValueOnce(+ makeBondingCurve({ complete: true }) as ReturnType<+ typeof pumpSdk.decodeBondingCurve+ >,+ );++ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ await expect(+ client.quoteForSell({ mint: FAKE_MINT, baseAmount: new BN(10_000_000) }),+ ).rejects.toThrow(CoinGraduatedError);+ });+ });++ // ── buildBuyInstructions ───────────────────────────────────────────────────++ describe("buildBuyInstructions", () => {+ it("returns at least one instruction", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.buildBuyInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ quoteAmount: new BN(1_000_000_000),+ });++ expect(result.instructions.length).toBeGreaterThan(0);+ expect(result.quoteMint.equals(NATIVE_MINT)).toBe(true);+ expect(result.quoteTokenProgram.equals(TOKEN_PROGRAM_ID)).toBe(true);+ expect(result.expectedBaseTokens.gtn(0)).toBe(true);+ });++ it("buy instruction programId equals PUMP_PROGRAM_ID", async () => {+ const { PUMP_PROGRAM_ID } = await import("@pump-fun/pump-sdk");+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.buildBuyInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ quoteAmount: new BN(1_000_000_000),+ });+ const buyIx = result.instructions[result.instructions.length - 1];+ expect(buyIx.programId.equals(PUMP_PROGRAM_ID)).toBe(true);+ });++ it("buy instruction data first 8 bytes match buyV2 discriminator", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.buildBuyInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ quoteAmount: new BN(1_000_000_000),+ });+ const buyIx = result.instructions[result.instructions.length - 1];+ expect(Array.from(buyIx.data.slice(0, 8))).toEqual(BUY_V2_DISC);+ });++ it("returns USDC quote mint for v2 USDC coin", async () => {+ const { PUMP_SDK: pumpSdk } = await import("@pump-fun/pump-sdk");+ // Once — auto-resets after the single decodeBondingCurve call in buildBuyInstructions.+ vi.mocked(pumpSdk.decodeBondingCurve).mockReturnValueOnce(+ makeBondingCurve({ quoteMint: USDC_MINT }) as ReturnType<+ typeof pumpSdk.decodeBondingCurve+ >,+ );++ const conn = makeConnection({+ // Return TOKEN_PROGRAM_ID as USDC's owner (for both base mint and quote mint lookups)+ getAccountInfo: vi.fn(async () => fakeAccountInfo(TOKEN_PROGRAM_ID)),+ });+ const client = new PumpTradeClient(conn);+ const result = await client.buildBuyInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ quoteAmount: new BN(1_000_000), // 1 USDC+ });++ expect(result.quoteMint.equals(USDC_MINT)).toBe(true);+ expect(result.quoteTokenProgram.equals(TOKEN_PROGRAM_ID)).toBe(true);+ });++ it("throws CoinGraduatedError when bondingCurve.complete === true", async () => {+ const { PUMP_SDK: pumpSdk } = await import("@pump-fun/pump-sdk");+ vi.mocked(pumpSdk.decodeBondingCurve).mockReturnValueOnce(+ makeBondingCurve({ complete: true }) as ReturnType<+ typeof pumpSdk.decodeBondingCurve+ >,+ );++ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ await expect(+ client.buildBuyInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ quoteAmount: new BN(1_000_000_000),+ }),+ ).rejects.toThrow(CoinGraduatedError);+ });++ it("throws CoinNotFoundError when bonding curve account is null", async () => {+ const conn = makeConnection({+ getMultipleAccountsInfo: vi.fn(async () => [+ fakeAccountInfo(),+ fakeAccountInfo(),+ null,+ ]),+ });+ const client = new PumpTradeClient(conn);+ await expect(+ client.buildBuyInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ quoteAmount: new BN(1_000_000_000),+ }),+ ).rejects.toThrow(CoinNotFoundError);+ });++ it("fee recipient is a member of global.feeRecipients pool", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.buildBuyInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ quoteAmount: new BN(1_000_000_000),+ });+ // mockGlobal has feeRecipient + feeRecipients — the picked recipient must be one of them+ const pool = [mockGlobal.feeRecipient, ...mockGlobal.feeRecipients].map((p) =>+ p.toBase58(),+ );+ expect(pool).toContain(result.feeRecipient.toBase58());+ });+ });++ // ── buildSellInstructions ──────────────────────────────────────────────────++ describe("buildSellInstructions", () => {+ it("returns at least one instruction", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.buildSellInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ baseAmount: new BN(10_000_000_000),+ });++ expect(result.instructions.length).toBeGreaterThan(0);+ expect(result.quoteMint.equals(NATIVE_MINT)).toBe(true);+ expect(result.quoteTokenProgram.equals(TOKEN_PROGRAM_ID)).toBe(true);+ expect(result.expectedQuoteOut.gten(0)).toBe(true);+ });++ it("sell instruction programId equals PUMP_PROGRAM_ID", async () => {+ const { PUMP_PROGRAM_ID } = await import("@pump-fun/pump-sdk");+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.buildSellInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ baseAmount: new BN(10_000_000_000),+ });+ const sellIx = result.instructions[result.instructions.length - 1];+ expect(sellIx.programId.equals(PUMP_PROGRAM_ID)).toBe(true);+ });++ it("sell instruction data first 8 bytes match sellV2 discriminator", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.buildSellInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ baseAmount: new BN(10_000_000_000),+ });+ const sellIx = result.instructions[result.instructions.length - 1];+ expect(Array.from(sellIx.data.slice(0, 8))).toEqual(SELL_V2_DISC);+ });++ it("throws CoinGraduatedError when bondingCurve.complete === true", async () => {+ const { PUMP_SDK: pumpSdk } = await import("@pump-fun/pump-sdk");+ vi.mocked(pumpSdk.decodeBondingCurve).mockReturnValueOnce(+ makeBondingCurve({ complete: true }) as ReturnType<+ typeof pumpSdk.decodeBondingCurve+ >,+ );++ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ await expect(+ client.buildSellInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ baseAmount: new BN(10_000_000),+ }),+ ).rejects.toThrow(CoinGraduatedError);+ });++ it("throws CoinNotFoundError when bonding curve account is null", async () => {+ const conn = makeConnection({+ getMultipleAccountsInfo: vi.fn(async () => [+ fakeAccountInfo(),+ fakeAccountInfo(),+ null,+ ]),+ });+ const client = new PumpTradeClient(conn);+ await expect(+ client.buildSellInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ baseAmount: new BN(10_000_000),+ }),+ ).rejects.toThrow(CoinNotFoundError);+ });+ });++ // ── buildBuyExactQuoteInInstructions ───────────────────────────────────────++ describe("buildBuyExactQuoteInInstructions", () => {+ it("returns instruction list with ATA creates prepended", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.buildBuyExactQuoteInInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ spendableQuoteIn: new BN(1_000_000_000),+ minBaseOut: new BN(1_000_000),+ });++ // Should have at least: createBaseATA + buyExactQuoteInV2 ix+ expect(result.instructions.length).toBeGreaterThanOrEqual(2);+ expect(result.quoteMint.equals(NATIVE_MINT)).toBe(true);+ expect(result.quoteTokenProgram.equals(TOKEN_PROGRAM_ID)).toBe(true);+ });++ it("buyExactQuoteInV2 instruction discriminator matches [194,171,28,70,104,77,91,47]", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const result = await client.buildBuyExactQuoteInInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ spendableQuoteIn: new BN(1_000_000_000),+ minBaseOut: new BN(1_000_000),+ });+ // last ix is the buyExactQuoteInV2 ix (after idempotent ATA creates)+ const exactIx = result.instructions[result.instructions.length - 1];+ expect(Array.from(exactIx.data.slice(0, 8))).toEqual(BUY_EXACT_QUOTE_IN_V2_DISC);+ });++ it("throws CoinGraduatedError when bondingCurve.complete === true", async () => {+ const { PUMP_SDK: pumpSdk } = await import("@pump-fun/pump-sdk");+ vi.mocked(pumpSdk.decodeBondingCurve).mockReturnValueOnce(+ makeBondingCurve({ complete: true }) as ReturnType<+ typeof pumpSdk.decodeBondingCurve+ >,+ );++ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ await expect(+ client.buildBuyExactQuoteInInstructions({+ mint: FAKE_MINT,+ user: FAKE_USER,+ spendableQuoteIn: new BN(1_000_000_000),+ minBaseOut: new BN(0),+ }),+ ).rejects.toThrow(CoinGraduatedError);+ });+ });++ // ── buildClaimCashbackInstructions ─────────────────────────────────────────++ describe("buildClaimCashbackInstructions", () => {+ it("returns zero instructions when discovery finds no non-zero ATAs", async () => {+ const conn = makeConnection({+ getTokenAccountsByOwner: vi.fn(async () => ({ value: [] })),+ });+ const client = new PumpTradeClient(conn);+ const ixs = await client.buildClaimCashbackInstructions({ user: FAKE_USER });+ expect(ixs.length).toBe(0);+ });++ it("returns two instructions when explicit quoteMints are passed", async () => {+ const conn = makeConnection();+ const client = new PumpTradeClient(conn);+ const ixs = await client.buildClaimCashbackInstructions({+ user: FAKE_USER,+ quoteMints: [NATIVE_MINT, USDC_MINT],+ });+ expect(ixs.length).toBe(2);+ });++ it("discovers mints from non-zero ATAs on the UserVolumeAccumulator PDA", async () => {+ // Encode a fake token account: mint at offset 0, amount (u64 LE) at offset 64+ const fakeMintBytes = USDC_MINT.toBuffer();+ const fakeAtaData = Buffer.alloc(165);+ fakeMintBytes.copy(fakeAtaData, 0);+ fakeAtaData.writeBigUInt64LE(BigInt(500_000), 64); // non-zero balance++ const conn = makeConnection({+ getTokenAccountsByOwner: vi.fn()+ .mockResolvedValueOnce({ value: [{ account: { data: fakeAtaData, owner: TOKEN_PROGRAM_ID } }] })+ .mockResolvedValueOnce({ value: [] }),+ });+ const client = new PumpTradeClient(conn);+ const ixs = await client.buildClaimCashbackInstructions({ user: FAKE_USER });+ expect(ixs.length).toBe(1);+ });+ });++ // ── Error types ────────────────────────────────────────────────────────────++ describe("exported error types", () => {+ it("CoinGraduatedError is an instanceof Error", () => {+ const e = new CoinGraduatedError(FAKE_MINT);+ expect(e).toBeInstanceOf(Error);+ expect(e.name).toBe("CoinGraduatedError");+ expect(e.message).toContain("complete");+ });++ it("CoinNotFoundError is an instanceof Error", () => {+ const e = new CoinNotFoundError(FAKE_MINT);+ expect(e).toBeInstanceOf(Error);+ expect(e.name).toBe("CoinNotFoundError");+ expect(e.message).toContain("not found");+ });++ it("InsufficientLiquidityError is an instanceof Error", () => {+ const e = new InsufficientLiquidityError("reserves exhausted");+ expect(e).toBeInstanceOf(Error);+ expect(e.name).toBe("InsufficientLiquidityError");+ expect(e.message).toContain("reserves exhausted");+ });+ });+});diff --git a/agent-payments-sdk/src/solana/PumpTradeClient.ts b/agent-payments-sdk/src/solana/PumpTradeClient.tsnew file mode 100644index 000000000..fb6eeea1a--- /dev/null+++ b/agent-payments-sdk/src/solana/PumpTradeClient.ts@@ -0,0 +1,602 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * PumpTradeClient — v2 bonding-curve buy / sell / exact-quote / cashback.+ *+ * All build* methods batch Global + FeeConfig + bondingCurve (+ userAta for buy)+ * into a SINGLE getMultipleAccountsInfo call. No sequential RPC.+ *+ * Routing: reads bondingCurve.quoteMint on-chain → SOL-paired or USDC-paired+ * coins are handled identically. Zero changes needed when USDC coins go live.+ */++import { BN } from "@coral-xyz/anchor";+import {+ ASSOCIATED_TOKEN_PROGRAM_ID,+ NATIVE_MINT,+ TOKEN_2022_PROGRAM_ID,+ TOKEN_PROGRAM_ID,+ createAssociatedTokenAccountIdempotentInstruction,+ getAssociatedTokenAddressSync,+} from "@solana/spl-token";+import {+ Connection,+ PublicKey,+ SystemProgram,+ TransactionInstruction,+} from "@solana/web3.js";+import {+ GLOBAL_PDA,+ GLOBAL_VOLUME_ACCUMULATOR_PDA,+ PUMP_EVENT_AUTHORITY_PDA,+ PUMP_FEE_CONFIG_PDA,+ PUMP_FEE_PROGRAM_ID,+ PUMP_PROGRAM_ID,+ PUMP_SDK,+ bondingCurveMarketCap,+ bondingCurvePda,+ creatorVaultPda,+ feeSharingConfigPda,+ getBuySolAmountFromTokenAmount,+ getBuyTokenAmountFromSolAmount,+ getPumpProgram,+ getSellSolAmountFromTokenAmount,+ userVolumeAccumulatorPda,+} from "@pump-fun/pump-sdk";+import { pickBuybackFeeRecipient, pickFeeRecipient } from "./constants.js";+import type {+ BuyQuote,+ BuyResult,+ ExactQuoteResult,+ SellQuote,+ SellResult,+} from "./types.js";++// ─── Errors ───────────────────────────────────────────────────────────────────++/** Coin has graduated (bondingCurve.complete === true). Use AMM. */+export class CoinGraduatedError extends Error {+ constructor(mint: PublicKey) {+ super(+ `Bonding curve for mint ${mint.toBase58()} is complete — use AMM instead.`,+ );+ this.name = "CoinGraduatedError";+ }+}++/** No bonding curve account exists for the mint. */+export class CoinNotFoundError extends Error {+ constructor(mint: PublicKey) {+ super(`Bonding curve account not found for mint ${mint.toBase58()}.`);+ this.name = "CoinNotFoundError";+ }+}++/** Requested amount exceeds available reserves. */+export class InsufficientLiquidityError extends Error {+ constructor(message: string) {+ super(message);+ this.name = "InsufficientLiquidityError";+ }+}++/** Quote mint is not in the pump.fun whitelist. */+export class UnsupportedQuoteMintError extends Error {+ constructor(quoteMint: PublicKey) {+ super(+ `Quote mint ${quoteMint.toBase58()} is not owned by TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID.`,+ );+ this.name = "UnsupportedQuoteMintError";+ }+}++// ─── Internal helpers ─────────────────────────────────────────────────────────++const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");++const KNOWN_TOKEN_PROGRAMS = new Set([+ TOKEN_PROGRAM_ID.toBase58(),+ TOKEN_2022_PROGRAM_ID.toBase58(),+]);++function resolveQuoteMintFromCurve(quoteMintOnChain: PublicKey): PublicKey {+ if (!quoteMintOnChain || quoteMintOnChain.equals(PublicKey.default)) {+ return NATIVE_MINT;+ }+ return quoteMintOnChain;+}++function clamp(value: number, min: number, max: number): number {+ return Math.min(max, Math.max(min, value));+}++function computePriceImpactPct(quoteAmount: BN, marketCap: BN): number {+ if (marketCap.isZero()) return 0;+ return clamp((quoteAmount.toNumber() / marketCap.toNumber()) * 100, 0, 100);+}++// ─── PumpTradeClient ──────────────────────────────────────────────────────────++export class PumpTradeClient {+ /** quoteMint never changes once a coin is created — safe to cache forever. */+ private readonly quoteMintCache = new Map<string, PublicKey>();+ /** Token program for a quote mint (also stable after mint creation). */+ private readonly tokenProgramCache = new Map<string, PublicKey>();++ constructor(private readonly connection: Connection) {}++ // ── resolveQuoteMint ────────────────────────────────────────────────────────++ /** Read bondingCurve.quoteMint from chain, normalize default → NATIVE_MINT. Caches. */+ async resolveQuoteMint(mint: PublicKey): Promise<PublicKey> {+ const key = mint.toBase58();+ const cached = this.quoteMintCache.get(key);+ if (cached) return cached;++ const info = await this.connection.getAccountInfo(bondingCurvePda(mint));+ if (!info) throw new CoinNotFoundError(mint);++ const curve = PUMP_SDK.decodeBondingCurve(info);+ const resolved = resolveQuoteMintFromCurve(curve.quoteMint);+ this.quoteMintCache.set(key, resolved);+ return resolved;+ }++ // ── quoteForBuy ─────────────────────────────────────────────────────────────++ async quoteForBuy(params: {+ mint: PublicKey;+ quoteAmount: BN;+ slippagePct?: number;+ }): Promise<BuyQuote> {+ const { mint, quoteAmount } = params;+ const slippage = params.slippagePct ?? 5;++ const {+ global,+ feeConfig,+ bondingCurve,+ quoteMint,+ quoteTokenProgram,+ } = await this._fetchAndDecode(mint);++ const mintSupply = bondingCurve.tokenTotalSupply;++ const expectedBaseTokens = getBuyTokenAmountFromSolAmount({+ global, feeConfig, mintSupply, bondingCurve, amount: quoteAmount,+ });++ const preciseQuoteAmount = getBuySolAmountFromTokenAmount({+ global, feeConfig, mintSupply, bondingCurve, amount: expectedBaseTokens,+ });++ const maxQuoteCost = new BN(+ Math.ceil(preciseQuoteAmount.toNumber() * (1 + slippage / 100)),+ );++ const marketCap = bondingCurveMarketCap({+ mintSupply,+ virtualQuoteReserves: bondingCurve.virtualQuoteReserves,+ virtualTokenReserves: bondingCurve.virtualTokenReserves,+ });++ return {+ quoteMint,+ quoteTokenProgram,+ quoteAmount,+ expectedBaseTokens,+ preciseQuoteAmount,+ maxQuoteCost,+ slippagePct: slippage,+ priceImpactPct: computePriceImpactPct(quoteAmount, marketCap),+ };+ }++ // ── quoteForSell ────────────────────────────────────────────────────────────++ async quoteForSell(params: {+ mint: PublicKey;+ baseAmount: BN;+ slippagePct?: number;+ }): Promise<SellQuote> {+ const { mint, baseAmount } = params;+ const slippage = params.slippagePct ?? 5;++ const {+ global,+ feeConfig,+ bondingCurve,+ quoteMint,+ quoteTokenProgram,+ } = await this._fetchAndDecode(mint);++ const mintSupply = bondingCurve.tokenTotalSupply;++ const expectedQuoteOut = getSellSolAmountFromTokenAmount({+ global, feeConfig, mintSupply, bondingCurve, amount: baseAmount,+ });++ const minQuoteOut = new BN(+ Math.max(0, Math.floor(expectedQuoteOut.toNumber() * (1 - slippage / 100))),+ );++ const marketCap = bondingCurveMarketCap({+ mintSupply,+ virtualQuoteReserves: bondingCurve.virtualQuoteReserves,+ virtualTokenReserves: bondingCurve.virtualTokenReserves,+ });++ return {+ quoteMint,+ quoteTokenProgram,+ baseAmount,+ expectedQuoteOut,+ minQuoteOut,+ slippagePct: slippage,+ priceImpactPct: computePriceImpactPct(expectedQuoteOut, marketCap),+ };+ }++ // ── buildBuyInstructions ────────────────────────────────────────────────────++ async buildBuyInstructions(params: {+ mint: PublicKey;+ user: PublicKey;+ quoteAmount: BN;+ slippagePct?: number;+ }): Promise<BuyResult> {+ const { mint, user, quoteAmount } = params;+ const slippage = params.slippagePct ?? 5;++ const baseTokenProgram = await this._baseTokenProgram(mint);+ const userAta = getAssociatedTokenAddressSync(mint, user, true, baseTokenProgram);++ // Single batch RPC: Global + FeeConfig + bondingCurve + userAta+ const bcAddr = bondingCurvePda(mint);+ const [globalInfo, feeConfigInfo, bcInfo, userAtaInfo] =+ await this.connection.getMultipleAccountsInfo([+ GLOBAL_PDA, PUMP_FEE_CONFIG_PDA, bcAddr, userAta,+ ]);++ if (!globalInfo) throw new Error("Global account not found — wrong network?");+ if (!bcInfo) throw new CoinNotFoundError(mint);++ const global = PUMP_SDK.decodeGlobal(globalInfo);+ const feeConfig = feeConfigInfo ? PUMP_SDK.decodeFeeConfig(feeConfigInfo) : null;+ const bondingCurve = PUMP_SDK.decodeBondingCurve(bcInfo);++ if (bondingCurve.complete) throw new CoinGraduatedError(mint);++ const quoteMint = resolveQuoteMintFromCurve(bondingCurve.quoteMint);+ this.quoteMintCache.set(mint.toBase58(), quoteMint);+ const quoteTokenProgram = await this._quoteTokenProgram(quoteMint);++ const mintSupply = bondingCurve.tokenTotalSupply;++ const expectedBaseTokens = getBuyTokenAmountFromSolAmount({+ global, feeConfig, mintSupply, bondingCurve, amount: quoteAmount,+ });++ if (expectedBaseTokens.lte(new BN(0))) {+ throw new InsufficientLiquidityError(+ "Computed token amount is zero — amount too small or reserves exhausted.",+ );+ }++ const preciseQuoteAmount = getBuySolAmountFromTokenAmount({+ global, feeConfig, mintSupply, bondingCurve, amount: expectedBaseTokens,+ });++ const mayhemMode = bondingCurve.isMayhemMode ?? false;+ const feeRecipient = pickFeeRecipient(global, mayhemMode);+ const buybackFeeRecipient = pickBuybackFeeRecipient();++ const instructions = await PUMP_SDK.buyV2Instructions({+ global,+ bondingCurveAccountInfo: bcInfo,+ bondingCurve,+ associatedUserAccountInfo: userAtaInfo ?? null,+ mint,+ user,+ amount: expectedBaseTokens,+ quoteAmount: preciseQuoteAmount,+ slippage,+ tokenProgram: baseTokenProgram,+ quoteTokenProgram,+ });++ return {+ instructions,+ quoteMint,+ quoteTokenProgram,+ expectedBaseTokens,+ preciseQuoteAmount,+ feeRecipient,+ buybackFeeRecipient,+ };+ }++ // ── buildSellInstructions ───────────────────────────────────────────────────++ async buildSellInstructions(params: {+ mint: PublicKey;+ user: PublicKey;+ baseAmount: BN;+ slippagePct?: number;+ }): Promise<SellResult> {+ const { mint, user, baseAmount } = params;+ const slippage = params.slippagePct ?? 5;++ const baseTokenProgram = await this._baseTokenProgram(mint);++ // Single batch RPC: Global + FeeConfig + bondingCurve+ const bcAddr = bondingCurvePda(mint);+ const [globalInfo, feeConfigInfo, bcInfo] =+ await this.connection.getMultipleAccountsInfo([+ GLOBAL_PDA, PUMP_FEE_CONFIG_PDA, bcAddr,+ ]);++ if (!globalInfo) throw new Error("Global account not found — wrong network?");+ if (!bcInfo) throw new CoinNotFoundError(mint);++ const global = PUMP_SDK.decodeGlobal(globalInfo);+ const feeConfig = feeConfigInfo ? PUMP_SDK.decodeFeeConfig(feeConfigInfo) : null;+ const bondingCurve = PUMP_SDK.decodeBondingCurve(bcInfo);++ if (bondingCurve.complete) throw new CoinGraduatedError(mint);++ const quoteMint = resolveQuoteMintFromCurve(bondingCurve.quoteMint);+ this.quoteMintCache.set(mint.toBase58(), quoteMint);+ const quoteTokenProgram = await this._quoteTokenProgram(quoteMint);++ const mintSupply = bondingCurve.tokenTotalSupply;++ const expectedQuoteOut = getSellSolAmountFromTokenAmount({+ global, feeConfig, mintSupply, bondingCurve, amount: baseAmount,+ });++ const instructions = await PUMP_SDK.sellV2Instructions({+ global,+ bondingCurveAccountInfo: bcInfo,+ bondingCurve,+ mint,+ user,+ amount: baseAmount,+ quoteAmount: expectedQuoteOut,+ slippage,+ tokenProgram: baseTokenProgram,+ quoteTokenProgram,+ });++ return { instructions, quoteMint, quoteTokenProgram, expectedQuoteOut };+ }++ // ── buildBuyExactQuoteInInstructions ────────────────────────────────────────++ /**+ * Build buy_exact_quote_in_v2. Drives the Anchor program directly because+ * the SDK has no JS helper for this instruction. Mirrors+ * swap/scripts/build-buy-exact-quote-in-v2-tx.mjs exactly.+ */+ async buildBuyExactQuoteInInstructions(params: {+ mint: PublicKey;+ user: PublicKey;+ spendableQuoteIn: BN;+ minBaseOut: BN;+ }): Promise<ExactQuoteResult> {+ const { mint, user, spendableQuoteIn, minBaseOut } = params;++ const baseTokenProgram = await this._baseTokenProgram(mint);++ // Single batch RPC: Global + FeeConfig + bondingCurve+ const bcAddr = bondingCurvePda(mint);+ const [globalInfo, feeConfigInfo, bcInfo] =+ await this.connection.getMultipleAccountsInfo([+ GLOBAL_PDA, PUMP_FEE_CONFIG_PDA, bcAddr,+ ]);++ if (!globalInfo) throw new Error("Global account not found — wrong network?");+ if (!bcInfo) throw new CoinNotFoundError(mint);++ const global = PUMP_SDK.decodeGlobal(globalInfo);+ const bondingCurve = PUMP_SDK.decodeBondingCurve(bcInfo);++ if (bondingCurve.complete) throw new CoinGraduatedError(mint);++ const quoteMint = resolveQuoteMintFromCurve(bondingCurve.quoteMint);+ this.quoteMintCache.set(mint.toBase58(), quoteMint);+ const quoteTokenProgram = await this._quoteTokenProgram(quoteMint);++ const creator = bondingCurve.creator;+ const mayhemMode = bondingCurve.isMayhemMode ?? false;++ const feeRecipient = pickFeeRecipient(global, mayhemMode);+ const buybackFeeRecipient = pickBuybackFeeRecipient();++ const ata = (owner: PublicKey, tkProg: PublicKey) =>+ getAssociatedTokenAddressSync(quoteMint, owner, true, tkProg);++ const associatedQuoteFeeRecipient = ata(feeRecipient, quoteTokenProgram);+ const associatedQuoteBuybackFeeRecipient = ata(buybackFeeRecipient, quoteTokenProgram);+ const associatedBaseBondingCurve = getAssociatedTokenAddressSync(+ mint, bcAddr, true, baseTokenProgram,+ );+ const associatedQuoteBondingCurve = ata(bcAddr, quoteTokenProgram);+ const associatedBaseUser = getAssociatedTokenAddressSync(+ mint, user, true, baseTokenProgram,+ );+ const associatedQuoteUser = ata(user, quoteTokenProgram);+ const creatorVault = creatorVaultPda(creator);+ const associatedCreatorVault = ata(creatorVault, quoteTokenProgram);+ const userVolAcc = userVolumeAccumulatorPda(user);+ const associatedUserVolumeAccumulator = ata(userVolAcc, quoteTokenProgram);++ const program = getPumpProgram(this.connection);+ const buyExactIx = await program.methods+ .buyExactQuoteInV2(spendableQuoteIn, minBaseOut)+ .accountsPartial({+ global: GLOBAL_PDA,+ baseMint: mint,+ quoteMint,+ baseTokenProgram,+ quoteTokenProgram,+ associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,+ feeRecipient,+ associatedQuoteFeeRecipient,+ buybackFeeRecipient,+ associatedQuoteBuybackFeeRecipient,+ bondingCurve: bcAddr,+ associatedBaseBondingCurve,+ associatedQuoteBondingCurve,+ user,+ associatedBaseUser,+ associatedQuoteUser,+ creatorVault,+ associatedCreatorVault,+ sharingConfig: feeSharingConfigPda(mint),+ globalVolumeAccumulator: GLOBAL_VOLUME_ACCUMULATOR_PDA,+ userVolumeAccumulator: userVolAcc,+ associatedUserVolumeAccumulator,+ feeConfig: PUMP_FEE_CONFIG_PDA,+ feeProgram: PUMP_FEE_PROGRAM_ID,+ systemProgram: SystemProgram.programId,+ eventAuthority: PUMP_EVENT_AUTHORITY_PDA,+ program: PUMP_PROGRAM_ID,+ })+ .instruction();++ const isNative = quoteMint.equals(NATIVE_MINT);+ const ataIxs: TransactionInstruction[] = [+ createAssociatedTokenAccountIdempotentInstruction(+ user, associatedBaseUser, user, mint, baseTokenProgram,+ ),+ ...(isNative+ ? []+ : [+ createAssociatedTokenAccountIdempotentInstruction(+ user, associatedQuoteUser, user, quoteMint, quoteTokenProgram,+ ),+ ]),+ ];++ return {+ instructions: [...ataIxs, buyExactIx],+ quoteMint,+ quoteTokenProgram,+ };+ }++ // ── buildClaimCashbackInstructions ──────────────────────────────────────────++ /**+ * Auto-discovers claimable quote mints by calling getTokenAccountsByOwner on+ * the UserVolumeAccumulator PDA. Any non-zero ATA → claimable cashback.+ * Pass quoteMints to skip discovery.+ */+ async buildClaimCashbackInstructions(params: {+ user: PublicKey;+ quoteMints?: PublicKey[];+ }): Promise<TransactionInstruction[]> {+ const { user } = params;+ let quoteMints = params.quoteMints;++ if (!quoteMints) {+ quoteMints = await this._discoverCashbackMints(user);+ }++ const ixs: TransactionInstruction[] = [];+ for (const quoteMint of quoteMints) {+ const quoteTokenProgram = await this._quoteTokenProgram(quoteMint);+ ixs.push(+ await PUMP_SDK.claimCashbackV2Instruction({+ user,+ quoteMint,+ quoteTokenProgram,+ }),+ );+ }+ return ixs;+ }++ // ── Private helpers ─────────────────────────────────────────────────────────++ private async _discoverCashbackMints(user: PublicKey): Promise<PublicKey[]> {+ const userVolAcc = userVolumeAccumulatorPda(user);+ const [splResult, t22Result] = await Promise.all([+ this.connection.getTokenAccountsByOwner(userVolAcc, {+ programId: TOKEN_PROGRAM_ID,+ }),+ this.connection.getTokenAccountsByOwner(userVolAcc, {+ programId: TOKEN_2022_PROGRAM_ID,+ }),+ ]);++ const mints: PublicKey[] = [];+ for (const { account } of [...splResult.value, ...t22Result.value]) {+ // SPL token account layout: mint = bytes 0–31, amount = bytes 64–71 (LE u64)+ const mintPk = new PublicKey(account.data.slice(0, 32));+ const amount = account.data.readBigUInt64LE(64);+ if (amount > 0n) mints.push(mintPk);+ }+ return mints;+ }++ private async _baseTokenProgram(mint: PublicKey): Promise<PublicKey> {+ const cacheKey = `base:${mint.toBase58()}`;+ const cached = this.tokenProgramCache.get(cacheKey);+ if (cached) return cached;+ const info = await this.connection.getAccountInfo(mint);+ if (!info) throw new Error(`Mint account not found: ${mint.toBase58()}`);+ const program = KNOWN_TOKEN_PROGRAMS.has(info.owner.toBase58())+ ? info.owner+ : TOKEN_PROGRAM_ID;+ this.tokenProgramCache.set(cacheKey, program);+ return program;+ }++ private async _quoteTokenProgram(quoteMint: PublicKey): Promise<PublicKey> {+ if (quoteMint.equals(NATIVE_MINT)) return TOKEN_PROGRAM_ID;+ const key = quoteMint.toBase58();+ const cached = this.tokenProgramCache.get(key);+ if (cached) return cached;+ const info = await this.connection.getAccountInfo(quoteMint, "confirmed");+ if (!info) throw new Error(`Quote mint not found: ${quoteMint.toBase58()}`);+ if (!KNOWN_TOKEN_PROGRAMS.has(info.owner.toBase58())) {+ throw new UnsupportedQuoteMintError(quoteMint);+ }+ this.tokenProgramCache.set(key, info.owner);+ return info.owner;+ }++ /**+ * Convenience: fetch + decode + throw in one call for quote methods.+ * Does NOT batch with userAta (quote methods don't need it).+ */+ private async _fetchAndDecode(mint: PublicKey) {+ const bcAddr = bondingCurvePda(mint);+ const [globalInfo, feeConfigInfo, bcInfo] =+ await this.connection.getMultipleAccountsInfo([+ GLOBAL_PDA, PUMP_FEE_CONFIG_PDA, bcAddr,+ ]);++ if (!globalInfo) throw new Error("Global account not found — wrong network?");+ if (!bcInfo) throw new CoinNotFoundError(mint);++ const global = PUMP_SDK.decodeGlobal(globalInfo);+ const feeConfig = feeConfigInfo ? PUMP_SDK.decodeFeeConfig(feeConfigInfo) : null;+ const bondingCurve = PUMP_SDK.decodeBondingCurve(bcInfo);++ if (bondingCurve.complete) throw new CoinGraduatedError(mint);++ const quoteMint = resolveQuoteMintFromCurve(bondingCurve.quoteMint);+ this.quoteMintCache.set(mint.toBase58(), quoteMint);+ const quoteTokenProgram = await this._quoteTokenProgram(quoteMint);++ return { global, feeConfig, bondingCurve, quoteMint, quoteTokenProgram };+ }++ /** Exported for convenience; USDC mainnet address. */+ static readonly USDC_MINT = USDC_MINT;+}diff --git a/agent-payments-sdk/src/solana/constants.ts b/agent-payments-sdk/src/solana/constants.tsnew file mode 100644index 000000000..32538f3ac--- /dev/null+++ b/agent-payments-sdk/src/solana/constants.ts@@ -0,0 +1,49 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { PublicKey } from "@solana/web3.js";++/**+ * Static buyback fee recipients pool. Mirrors+ * `CURRENT_FEE_RECIPIENTS_FOR_BUYBACK` in @pump-fun/pump-sdk 1.35.0+ * (the constant is embedded but not exported by the SDK).+ *+ * Source: pump-public-docs/docs/FEE_RECIPIENTS.md.+ */+export const BUYBACK_FEE_RECIPIENTS: ReadonlyArray<PublicKey> = [+ "5YxQFdt3Tr9zJLvkFccqXVUwhdTWJQc1fFg2YPbxvxeD",+ "9M4giFFMxmFGXtc3feFzRai56WbBqehoSeRE5GK7gf7",+ "GXPFM2caqTtQYC2cJ5yJRi9VDkpsYZXzYdwYpGnLmtDL",+ "3BpXnfJaUTiwXnJNe7Ej1rcbzqTTQUvLShZaWazebsVR",+ "5cjcW9wExnJJiqgLjq7DEG75Pm6JBgE1hNv4B2vHXUW6",+ "EHAAiTxcdDwQ3U4bU6YcMsQGaekdzLS3B5SmYo46kJtL",+ "5eHhjP8JaYkz83CWwvGU2uMUXefd3AazWGx4gpcuEEYD",+ "A7hAgCzFw14fejgCp387JUJRMNyz4j89JKnhtKU8piqW",+].map((s) => new PublicKey(s));++/** Pick a random buyback fee recipient from the static v1.35 list. */+export function pickBuybackFeeRecipient(): PublicKey {+ return BUYBACK_FEE_RECIPIENTS[+ Math.floor(Math.random() * BUYBACK_FEE_RECIPIENTS.length)+ ]!;+}++/**+ * Pick a regular or reserved (mayhem) fee recipient at random from the+ * Global config pool. Mirrors `getFeeRecipient` in @pump-fun/pump-sdk.+ */+export function pickFeeRecipient(+ global: {+ feeRecipient: PublicKey;+ feeRecipients: PublicKey[];+ reservedFeeRecipient: PublicKey;+ reservedFeeRecipients: PublicKey[];+ },+ mayhemMode: boolean,+): PublicKey {+ const pool = mayhemMode+ ? [global.reservedFeeRecipient, ...global.reservedFeeRecipients]+ : [global.feeRecipient, ...global.feeRecipients];+ return pool[Math.floor(Math.random() * pool.length)]!;+}diff --git a/agent-payments-sdk/src/decoders.ts b/agent-payments-sdk/src/solana/decoders.tssimilarity index 86%rename from agent-payments-sdk/src/decoders.tsrename to agent-payments-sdk/src/solana/decoders.tsindex 922507469..d155e34b7 100644--- a/agent-payments-sdk/src/decoders.ts+++ b/agent-payments-sdk/src/solana/decoders.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+import { OFFLINE_PUMP_PROGRAM } from "./program";import type {GlobalConfig,diff --git a/agent-payments-sdk/src/solana/errors.ts b/agent-payments-sdk/src/solana/errors.tsnew file mode 100644index 000000000..d1f8cdd8e--- /dev/null+++ b/agent-payments-sdk/src/solana/errors.ts@@ -0,0 +1,58 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * SDK error types for multi-currency / USDC-aware PumpAgent flows.+ */++/**+ * Thrown when a Jupiter v6 API call fails (network error, non-2xx status,+ * or malformed response). Callers should surface this so operators can+ * either retry, swap providers, or feed in their own pre-built swap data.+ */+export class JupiterUnavailableError extends Error {+ readonly status?: number;+ readonly endpoint: string;++ constructor(message: string, endpoint: string, status?: number) {+ super(message);+ this.name = "JupiterUnavailableError";+ this.endpoint = endpoint;+ this.status = status;+ }+}++/**+ * Thrown when a pump-fun coin's quote mint is not present in the+ * agent-payments program's `GlobalConfig.supportedCurrenciesMint` list.+ *+ * Actionable resolution: ask a protocol authority to add the currency+ * via `globalAddNewCurrency`, or pick a different coin whose quote mint+ * is already supported.+ */+export class CurrencyNotSupportedError extends Error {+ readonly baseMint: string;+ readonly quoteMint: string;+ readonly supportedMints: string[];++ constructor(params: {+ baseMint: string;+ quoteMint: string;+ supportedMints: string[];+ }) {+ super(+ `Coin ${params.baseMint} uses quote mint ${params.quoteMint}, ` ++ `which is not in GlobalConfig.supportedCurrenciesMint ` ++ `(supported: ${+ params.supportedMints.length === 0+ ? "<none>"+ : params.supportedMints.join(", ")+ }). Add the currency to GlobalConfig before accepting payments.`,+ );+ this.name = "CurrencyNotSupportedError";+ this.baseMint = params.baseMint;+ this.quoteMint = params.quoteMint;+ this.supportedMints = params.supportedMints;+ }+}diff --git a/agent-payments-sdk/src/events.ts b/agent-payments-sdk/src/solana/events.tssimilarity index 98%rename from agent-payments-sdk/src/events.tsrename to agent-payments-sdk/src/solana/events.tsindex 2aa47876a..9eb85978b 100644--- a/agent-payments-sdk/src/events.ts+++ b/agent-payments-sdk/src/solana/events.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+import { PublicKey, type Connection } from "@solana/web3.js";import { BN, EventParser, type Program } from "@coral-xyz/anchor";import type { PumpAgentPayments as PumpAgentPaymentsIDL } from "./idl/pump_agent_payments";diff --git a/agent-payments-sdk/src/solana/examples/listen-pump-events.ts b/agent-payments-sdk/src/solana/examples/listen-pump-events.tsnew file mode 100644index 000000000..6e6cf589b--- /dev/null+++ b/agent-payments-sdk/src/solana/examples/listen-pump-events.ts@@ -0,0 +1,105 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * listen-pump-events.ts+ *+ * Subscribes to the pump.fun bonding-curve program and pretty-prints each+ * event for 60 seconds, then exits 0.+ *+ * Usage:+ * SOLANA_RPC_URL=https://... npx tsx src/solana/examples/listen-pump-events.ts+ * SOLANA_RPC_URL=https://... MINT=<base58> npx tsx src/solana/examples/listen-pump-events.ts+ */+import { Connection, PublicKey } from "@solana/web3.js";+import { BN } from "@coral-xyz/anchor";+import {+ subscribeToPumpEvents,+ type ParsedPumpEvent,+ type PumpEventName,+} from "../pump-events.js";++const RPC = process.env.SOLANA_RPC_URL ?? "https://api.mainnet-beta.solana.com";+const MINT_STR = process.env.MINT;+const DURATION_MS = 60_000;++function formatValue(v: unknown): string {+ if (v instanceof BN) return (v as BN).toString();+ if (v instanceof PublicKey) return (v as PublicKey).toBase58();+ if (Array.isArray(v)) return `[${(v as unknown[]).map(formatValue).join(", ")}]`;+ if (v !== null && typeof v === "object" && !ArrayBuffer.isView(v)) {+ return `{${Object.entries(v as Record<string, unknown>)+ .map(([k, val]) => `${k}: ${formatValue(val)}`)+ .join(", ")}}`;+ }+ return String(v);+}++function printEvent(ev: ParsedPumpEvent): void {+ const sig = ev.signature ?? "unknown";+ const slot = ev.slot ?? 0;+ const solscan = `https://solscan.io/tx/${sig}`;++ // Pull out the most interesting fields per event type+ const data = ev.data as unknown as Record<string, unknown>;+ const keyFields: Record<PumpEventName, string[]> = {+ TradeEvent: ["mint", "sol_amount", "token_amount", "is_buy", "user"],+ CreateEvent: ["mint", "name", "symbol", "user"],+ ClaimCashbackEvent: ["mint", "user", "amount"],+ CompleteEvent: ["mint", "user"],+ CompletePumpAmmMigrationEvent: ["mint", "sol_amount", "pool"],+ AdminSetCreatorEvent: ["mint", "new_creator"],+ AdminSetIdlAuthorityEvent: ["idl_authority"],+ AdminUpdateTokenIncentivesEvent: ["mint", "day_number", "token_supply_per_day"],+ ClaimTokenIncentivesEvent: ["mint", "user", "amount"],+ CloseUserVolumeAccumulatorEvent: ["user"],+ CollectCreatorFeeEvent: ["creator", "creator_fee"],+ DistributeCreatorFeesEvent: ["creator", "total_amount"],+ ExtendAccountEvent: ["account", "current_size", "new_size"],+ InitUserVolumeAccumulatorEvent: ["user"],+ MigrateBondingCurveCreatorEvent: ["mint", "user"],+ MinimumDistributableFeeEvent: ["new_minimum_distributable_fee"],+ ReservedFeeRecipientsEvent: ["new_reserved_fee_recipients"],+ SetCreatorEvent: ["mint", "new_creator"],+ SetMetaplexCreatorEvent: ["mint", "creator"],+ SetParamsEvent: ["fee_basis_points", "withdraw_authority"],+ SyncUserVolumeAccumulatorEvent: ["user"],+ UpdateGlobalAuthorityEvent: ["authority"],+ UpdateMayhemVirtualParamsEvent: ["initial_virtual_sol_reserves"],+ };++ const fields = keyFields[ev.name] ?? Object.keys(data).slice(0, 4);+ const summary = fields+ .filter((f) => f in data)+ .map((f) => `${f}=${formatValue(data[f])}`)+ .join(" | ");++ console.log(`\n[slot ${slot}] ${ev.name}`);+ console.log(` ${summary}`);+ console.log(` sig: ${sig}`);+ console.log(` ${solscan}`);+}++async function main() {+ const connection = new Connection(RPC, "confirmed");+ const mint = MINT_STR ? new PublicKey(MINT_STR) : undefined;++ console.log(`Listening to pump events${mint ? ` for mint ${mint.toBase58()}` : ""}…`);+ console.log(`RPC: ${RPC}`);+ console.log(`Duration: ${DURATION_MS / 1000}s\n`);++ const sub = subscribeToPumpEvents(connection, { mint }, printEvent);++ await new Promise((r) => setTimeout(r, DURATION_MS));+ await sub.unsubscribe();+ console.log("\nDone. Exiting.");+}++main().then(+ () => process.exit(0),+ (err) => {+ console.error(err);+ process.exit(1);+ },+);diff --git a/agent-payments-sdk/src/solana/fixtures/pump-events/create.json b/agent-payments-sdk/src/solana/fixtures/pump-events/create.jsonnew file mode 100644index 000000000..c82052e6a--- /dev/null+++ b/agent-payments-sdk/src/solana/fixtures/pump-events/create.json@@ -0,0 +1,163 @@+{+ "signature": "3fXpU7cbTdMRJxFxD9Q1ySs8oSzUSBYA2dpBas9r7oz4WpgadDMYGJEfSNoXmdpDV1V3vQHoc1frDyqXyqkj9aMM",+ "slot": 418302440,+ "logMessages": [+ "Program ComputeBudget111111111111111111111111111111 invoke [1]",+ "Program ComputeBudget111111111111111111111111111111 success",+ "Program ComputeBudget111111111111111111111111111111 invoke [1]",+ "Program ComputeBudget111111111111111111111111111111 success",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [1]",+ "Program log: Instruction: CreateV2",+ "Program 11111111111111111111111111111111 invoke [2]",+ "Program 11111111111111111111111111111111 success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: MetadataPointerInstruction::Initialize",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 879 of 252515 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: Instruction: InitializeMint2",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 1693 of 249816 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program 11111111111111111111111111111111 invoke [2]",+ "Program 11111111111111111111111111111111 success",+ "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [2]",+ "Program log: Create",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [3]",+ "Program log: Instruction: GetAccountDataSize",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 1380 of 227484 compute units",+ "Program return: TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb qgAAAAAAAAA=",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program 11111111111111111111111111111111 invoke [3]",+ "Program 11111111111111111111111111111111 success",+ "Program log: Initialize the associated token account",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [3]",+ "Program log: Instruction: InitializeImmutableOwner",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 674 of 221282 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [3]",+ "Program log: Instruction: InitializeAccount3",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 1855 of 218272 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 16704 of 232817 compute units",+ "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",+ "Program 11111111111111111111111111111111 invoke [2]",+ "Program 11111111111111111111111111111111 success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: TokenMetadataInstruction: Initialize",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 3533 of 191586 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: TokenMetadataInstruction: UpdateAuthority",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 3846 of 185643 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e invoke [2]",+ "Program log: Instruction: InitializeMayhemState",+ "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [3]",+ "Program log: Create",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [4]",+ "Program log: Instruction: GetAccountDataSize",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 1444 of 160936 compute units",+ "Program return: TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb qgAAAAAAAAA=",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program 11111111111111111111111111111111 invoke [4]",+ "Program 11111111111111111111111111111111 success",+ "Program log: Initialize the associated token account",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [4]",+ "Program log: Instruction: InitializeImmutableOwner",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 674 of 154670 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [4]",+ "Program log: Instruction: InitializeAccount3",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 2027 of 151659 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 16942 of 166270 compute units",+ "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",+ "Program 11111111111111111111111111111111 invoke [3]",+ "Program 11111111111111111111111111111111 success",+ "Program MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e consumed 48302 of 175546 compute units",+ "Program MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: Instruction: MintTo",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 1642 of 124602 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: Instruction: MintTo",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 1642 of 120548 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: Instruction: SetAuthority",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 958 of 116724 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program data: G3KpTd7rY3YJAAAAT25seUZyZW5zCQAAAE9OTFlGUkVOU1AAAABodHRwczovL2lwZnMuaW8vaXBmcy9iYWZrcmVpYnB3MnozZ2I2aWlkZWlmZHBleDZucHRlcnJ6azI0c3Q0bWx2ZDR4c3hmY3dla2ZzNXJxNFmXBwdqzOHT/qKt/nTlJHlVU5uvfcj/MDPbmc30jguvBKdowvekdf4keTNdXfxc92Sc9l7FpU7t5h66x0oxbh4lPcM611JHuuH0dAQIH8lrpAKxr0FgLhkZi8UywigtESU9wzrXUke64fR0BAgfyWukArGvQWAuGRmLxTLCKC0R/UL9aQAAAAAAENhH488DAACsI/wGAAAAAHjF+1HRAgAAgMakfo0DAAbd9uHudY/eGEJdvORszdq2GvxNg7kNJ/69+SjYoYv8AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsI/wGAAAA",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2087 of 108968 compute units",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 159753 of 265578 compute units",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success",+ "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",+ "Program log: CreateIdempotent",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: Instruction: GetAccountDataSize",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 1444 of 97565 compute units",+ "Program return: TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb qgAAAAAAAAA=",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program 11111111111111111111111111111111 invoke [2]",+ "Program 11111111111111111111111111111111 success",+ "Program log: Initialize the associated token account",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: Instruction: InitializeImmutableOwner",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 674 of 91299 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: Instruction: InitializeAccount3",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 2027 of 88292 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 19843 of 105825 compute units",+ "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [1]",+ "Program log: Instruction: Buy",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ invoke [2]",+ "Program log: Instruction: GetFees",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ consumed 3136 of 40929 compute units",+ "Program return: pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ AAAAAAAAAABfAAAAAAAAAB4AAAAAAAAA",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [2]",+ "Program log: Instruction: TransferChecked",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 2475 of 34051 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program 11111111111111111111111111111111 invoke [2]",+ "Program 11111111111111111111111111111111 success",+ "Program 11111111111111111111111111111111 invoke [2]",+ "Program 11111111111111111111111111111111 success",+ "Program 11111111111111111111111111111111 invoke [2]",+ "Program 11111111111111111111111111111111 success",+ "Program data: vdt/007mYe5ZlwcHaszh0/6irf505SR5VVObr33I/zAz25nN9I4Lr7kFLJMAAAAAfj+0RTZKAAABJT3DOtdSR7rh9HQECB/Ja6QCsa9BYC4ZGYvFMsIoLRH9Qv1pAAAAALmxT48HAAAAgtAjAq2FAwC5BSyTAAAAAII4EbYbhwIA2kw4zW23Q49ZtAi7nsO0yp6K0fHyRlPEmbV5bCDb+bNfAAAAAAAAABfsZQEAAAAAJT3DOtdSR7rh9HQECB/Ja6QCsa9BYC4ZGYvFMsIoLREeAAAAAAAAADAHcQAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAGJ1eQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALkFLJMAAAAAubFPjwcAAAC5BSyTAAAAAA==",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2087 of 16423 compute units",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 73322 of 85982 compute units",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success"+ ],+ "expected": {+ "name": "CreateEvent",+ "data": {+ "name": "OnlyFrens",+ "symbol": "ONLYFRENS",+ "uri": "https://ipfs.io/ipfs/bafkreibpw2z3gb6iideifdpex6npterrzk24st4mlvd4xsxfcwekfs5rq4",+ "mint": "72irZhpS2nhxbP3h4xh5cCZq7BNtnUJPho6ZRamspump",+ "bonding_curve": "KAgvdxZTMXj8EfaQvk2LCUzcH98iqxsN37tbT5gMZJu",+ "user": "3WNi4g2ftVvRyYW68xyDxCBVrfXHbHjJUpdwHs7WsXcC",+ "creator": "3WNi4g2ftVvRyYW68xyDxCBVrfXHbHjJUpdwHs7WsXcC",+ "timestamp": "69fd42fd",+ "virtual_token_reserves": "03cfe347d81000",+ "virtual_sol_reserves": "06fc23ac00",+ "real_token_reserves": "02d151fbc57800",+ "token_total_supply": "038d7ea4c68000",+ "token_program": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",+ "is_mayhem_mode": true,+ "is_cashback_enabled": false,+ "quote_mint": "11111111111111111111111111111111",+ "virtual_quote_reserves": "06fc23ac00"+ }+ }+}\ No newline at end of filediff --git a/agent-payments-sdk/src/solana/fixtures/pump-events/trade-buy.json b/agent-payments-sdk/src/solana/fixtures/pump-events/trade-buy.jsonnew file mode 100644index 000000000..781c65565--- /dev/null+++ b/agent-payments-sdk/src/solana/fixtures/pump-events/trade-buy.json@@ -0,0 +1,82 @@+{+ "signature": "2Uz74rkFVbWpCGzeV9pim1ovJ9QHySNoK2nVD5r88irEe4A1ZWFVygR5sK6ygrevSrUn84vnWSDRkf18XR9NSeCT",+ "slot": 418302795,+ "logMessages": [+ "Program ComputeBudget111111111111111111111111111111 invoke [1]",+ "Program ComputeBudget111111111111111111111111111111 success",+ "Program ComputeBudget111111111111111111111111111111 invoke [1]",+ "Program ComputeBudget111111111111111111111111111111 success",+ "Program FLASHX8DrLbgeR8FcfNV1F5krxYcYMUdBkrP1EPBtxB9 invoke [1]",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ invoke [2]",+ "Program log: Instruction: GetFees",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ consumed 3136 of 146286 compute units",+ "Program return: pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ AAAAAAAAAABfAAAAAAAAAB4AAAAAAAAA",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ success",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]",+ "Program log: Instruction: Buy",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ invoke [3]",+ "Program log: Instruction: GetFees",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ consumed 3136 of 96077 compute units",+ "Program return: pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ AAAAAAAAAABfAAAAAAAAAB4AAAAAAAAA",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [3]",+ "Program log: Instruction: TransferChecked",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 2475 of 89199 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program 11111111111111111111111111111111 invoke [3]",+ "Program 11111111111111111111111111111111 success",+ "Program 11111111111111111111111111111111 invoke [3]",+ "Program 11111111111111111111111111111111 success",+ "Program 11111111111111111111111111111111 invoke [3]",+ "Program 11111111111111111111111111111111 success",+ "Program data: vdt/007mYe4O/24x5VzPqWJDr96Qfc25ntzvUc4NhKo2lKFmUH90Lzj86QIAAAAAtFOElGIFAAABFi7j8TdlMfQtKZWC0pqayPRhDoJIixsy8cIzj/C+vYKKQ/1pAAAAABKn068BAAAA708fZqEYAwDMfXNhAAAAAO+3DBoQGgIAM5h6nrsTZ5mrWZJbE+XcizCB3wBdtCfBR4+kb/jDR6BfAAAAAAAAAD0WBwAAAAAAAr4R1SMYHf5qg1RUUJi6QDAYiY+u7UY/KWc136eLLMgeAAAAAAAAAOs8AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAGJ1eQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADj86QIAAAAAEqfTrwEAAADMfXNhAAAAAA==",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [3]",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2087 of 71571 compute units",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 71729 of 139537 compute units",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success",+ "Program 11111111111111111111111111111111 invoke [2]",+ "Program 11111111111111111111111111111111 success",+ "Program FLASHX8DrLbgeR8FcfNV1F5krxYcYMUdBkrP1EPBtxB9 consumed 84177 of 149700 compute units",+ "Program FLASHX8DrLbgeR8FcfNV1F5krxYcYMUdBkrP1EPBtxB9 success",+ "Program 11111111111111111111111111111111 invoke [1]",+ "Program 11111111111111111111111111111111 success"+ ],+ "expected": {+ "name": "TradeEvent",+ "data": {+ "mint": "21YcUwFg3XiuscSCvqMhKETd6jqfAZQTD5U2RkeRpump",+ "sol_amount": "02e9fc38",+ "token_amount": "0562948453b4",+ "is_buy": true,+ "user": "2VbSVLUJUUQtoEFGnBaJJQAfAegpep75sLMJMBPeP7p5",+ "timestamp": "69fd438a",+ "virtual_sol_reserves": "01afd3a712",+ "virtual_token_reserves": "0318a1661f4fef",+ "real_sol_reserves": "61737dcc",+ "real_token_reserves": "021a101a0cb7ef",+ "fee_recipient": "4UQeTP1T39KZ9Sfxzo3WR5skgsaP6NZa87BAkuazLEKH",+ "fee_basis_points": "5f",+ "fee": "07163d",+ "creator": "Bhv1aYJamD2a8ACiGWFiqskFebZqCgapwhtKvm8XvR5",+ "creator_fee_basis_points": "1e",+ "creator_fee": "023ceb",+ "track_volume": false,+ "total_unclaimed_tokens": "00",+ "total_claimed_tokens": "00",+ "current_sol_volume": "00",+ "last_update_timestamp": "00",+ "ix_name": "buy",+ "mayhem_mode": true,+ "cashback_fee_basis_points": "00",+ "cashback": "00",+ "buyback_fee_basis_points": "00",+ "buyback_fee": "00",+ "shareholders": [],+ "quote_mint": "11111111111111111111111111111111",+ "quote_amount": "02e9fc38",+ "virtual_quote_reserves": "01afd3a712",+ "real_quote_reserves": "61737dcc"+ }+ }+}\ No newline at end of filediff --git a/agent-payments-sdk/src/solana/fixtures/pump-events/trade-sell.json b/agent-payments-sdk/src/solana/fixtures/pump-events/trade-sell.jsonnew file mode 100644index 000000000..277dc6fad--- /dev/null+++ b/agent-payments-sdk/src/solana/fixtures/pump-events/trade-sell.json@@ -0,0 +1,76 @@+{+ "signature": "5o4eDi1zBLjXbnpa13xy9Ayj2NuwtHCHhKensm9d2tcdYBpyLZMhKTuzUJqjzVSbhaAmeAKBVFyTsBx5Npcw6nVP",+ "slot": 418302435,+ "logMessages": [+ "Program ComputeBudget111111111111111111111111111111 invoke [1]",+ "Program ComputeBudget111111111111111111111111111111 success",+ "Program ComputeBudget111111111111111111111111111111 invoke [1]",+ "Program ComputeBudget111111111111111111111111111111 success",+ "Program term9YPb9mzAsABaqN71A4xdbxHmpBNZavpBiQKZzN3 invoke [1]",+ "Program log: Instruction: ValidateNonce",+ "Program term9YPb9mzAsABaqN71A4xdbxHmpBNZavpBiQKZzN3 consumed 13839 of 239700 compute units",+ "Program term9YPb9mzAsABaqN71A4xdbxHmpBNZavpBiQKZzN3 success",+ "Program term9YPb9mzAsABaqN71A4xdbxHmpBNZavpBiQKZzN3 invoke [1]",+ "Program log: Instruction: SellExactInPumpFunV3",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [2]",+ "Program log: Instruction: Sell",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ invoke [3]",+ "Program log: Instruction: GetFees",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ consumed 3136 of 178127 compute units",+ "Program return: pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ AAAAAAAAAABfAAAAAAAAAB4AAAAAAAAA",+ "Program pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ success",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb invoke [3]",+ "Program log: Instruction: TransferChecked",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb consumed 2475 of 171296 compute units",+ "Program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb success",+ "Program data: vdt/007mYe67uUTvQHS72c4nwlqYTUV9Gw6zLsVmzgdbahRPxuM8/2aS4wcAAAAAQMM7gVcBAAAAEoj8QYBHdCDJ5KSRsagIiFyfr82VJjsxIiQmYPzsliT7Qv1pAAAAAN7sG38MAAAAuVJUwHghAgDeQPiCBQAAALm6QXTnIgEASsL40N1cvJfjKJwZfLUGKlTz2Va5zm5RFfllZ6pcs+ZfAAAAAAAAAJovEwAAAAAALL5V50Ot0DGE811Uepyn0zXOV93nkKBC89spkgkeXj0eAAAAAAAAAAgPBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAHNlbGwAAAAAAAAAAAAAAAAAAAAAAIgTAAAAAAAAzZcJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmkuMHAAAAAN7sG38MAAAA3kD4ggUAAAA=",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P invoke [3]",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 2087 of 157631 compute units",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P consumed 60110 of 214599 compute units",+ "Program 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P success",+ "Program term9YPb9mzAsABaqN71A4xdbxHmpBNZavpBiQKZzN3 consumed 72144 of 225861 compute units",+ "Program term9YPb9mzAsABaqN71A4xdbxHmpBNZavpBiQKZzN3 success",+ "Program 11111111111111111111111111111111 invoke [1]",+ "Program 11111111111111111111111111111111 success",+ "Program 11111111111111111111111111111111 invoke [1]",+ "Program 11111111111111111111111111111111 success"+ ],+ "expected": {+ "name": "TradeEvent",+ "data": {+ "mint": "Ddo6NQ88fHTVq9jgMm7RQGCvv7QziAtwZX1Psnvnpump",+ "sol_amount": "07e39266",+ "token_amount": "0157813bc340",+ "is_buy": false,+ "user": "2FMVNQ3jy21d38YTmvJvfUz9FuGRvbtFNDagpdemKHWb",+ "timestamp": "69fd42fb",+ "virtual_sol_reserves": "0c7f1becde",+ "virtual_token_reserves": "022178c05452b9",+ "real_sol_reserves": "0582f840de",+ "real_token_reserves": "0122e77441bab9",+ "fee_recipient": "62qc2CNXwrYqQScmEdiZFFAnJR262PxWEuNQtxfafNgV",+ "fee_basis_points": "5f",+ "fee": "132f9a",+ "creator": "41fGoUUVtUS7YrU5befMz8HDuBix6YN5w4Ckq9Pz8f3A",+ "creator_fee_basis_points": "1e",+ "creator_fee": "060f08",+ "track_volume": false,+ "total_unclaimed_tokens": "00",+ "total_claimed_tokens": "00",+ "current_sol_volume": "00",+ "last_update_timestamp": "00",+ "ix_name": "sell",+ "mayhem_mode": false,+ "cashback_fee_basis_points": "00",+ "cashback": "00",+ "buyback_fee_basis_points": "1388",+ "buyback_fee": "0997cd",+ "shareholders": [],+ "quote_mint": "11111111111111111111111111111111",+ "quote_amount": "07e39266",+ "virtual_quote_reserves": "0c7f1becde",+ "real_quote_reserves": "0582f840de"+ }+ }+}\ No newline at end of filediff --git a/agent-payments-sdk/src/solana/idl/pump.json b/agent-payments-sdk/src/solana/idl/pump.jsonnew file mode 100644index 000000000..8b0eba12b--- /dev/null+++ b/agent-payments-sdk/src/solana/idl/pump.json@@ -0,0 +1,10537 @@+{+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",+ "metadata": {+ "name": "pump",+ "version": "0.1.0",+ "spec": "0.1.0",+ "description": "Created with Anchor"+ },+ "instructions": [+ {+ "name": "add_quote_mint",+ "discriminator": [+ 111,+ 121,+ 21,+ 56,+ 40,+ 24,+ 94,+ 209+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "writable": true,+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "quote_mint",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "admin_set_creator",+ "docs": [+ "Allows Global::admin_set_creator_authority to override the bonding curve creator"+ ],+ "discriminator": [+ 69,+ 25,+ 171,+ 142,+ 57,+ 239,+ 13,+ 4+ ],+ "accounts": [+ {+ "name": "admin_set_creator_authority",+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "mint"+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "creator",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "admin_set_idl_authority",+ "discriminator": [+ 8,+ 217,+ 96,+ 231,+ 144,+ 104,+ 192,+ 5+ ],+ "accounts": [+ {+ "name": "authority",+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "idl_account",+ "writable": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "program_signer",+ "pda": {+ "seeds": []+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "idl_authority",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "admin_update_token_incentives",+ "discriminator": [+ 209,+ 11,+ 115,+ 87,+ 213,+ 23,+ 124,+ 204+ ],+ "accounts": [+ {+ "name": "authority",+ "writable": true,+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "global_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ }+ ]+ }+ },+ {+ "name": "mint"+ },+ {+ "name": "global_incentive_token_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "global_volume_accumulator"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "token_program"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "start_time",+ "type": "i64"+ },+ {+ "name": "end_time",+ "type": "i64"+ },+ {+ "name": "seconds_in_a_day",+ "type": "i64"+ },+ {+ "name": "day_number",+ "type": "u64"+ },+ {+ "name": "pump_token_supply_per_day",+ "type": "u64"+ }+ ]+ },+ {+ "name": "buy",+ "docs": [+ "Buys tokens from a bonding curve."+ ],+ "discriminator": [+ 102,+ 6,+ 61,+ 18,+ 1,+ 218,+ 235,+ 234+ ],+ "accounts": [+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "fee_recipient",+ "writable": true+ },+ {+ "name": "mint"+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "associated_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "associated_user",+ "writable": true+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "token_program"+ },+ {+ "name": "creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 99,+ 114,+ 101,+ 97,+ 116,+ 111,+ 114,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "bonding_curve.creator",+ "account": "BondingCurve"+ }+ ]+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ },+ {+ "name": "global_volume_accumulator",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ }+ ]+ }+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "fee_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 102,+ 101,+ 101,+ 95,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "const",+ "value": [+ 1,+ 86,+ 224,+ 246,+ 147,+ 102,+ 90,+ 207,+ 68,+ 219,+ 21,+ 104,+ 191,+ 23,+ 91,+ 170,+ 81,+ 137,+ 203,+ 151,+ 245,+ 210,+ 255,+ 59,+ 101,+ 93,+ 43,+ 182,+ 253,+ 109,+ 24,+ 176+ ]+ }+ ],+ "program": {+ "kind": "account",+ "path": "fee_program"+ }+ }+ },+ {+ "name": "fee_program",+ "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"+ }+ ],+ "args": [+ {+ "name": "amount",+ "type": "u64"+ },+ {+ "name": "max_sol_cost",+ "type": "u64"+ },+ {+ "name": "track_volume",+ "type": {+ "defined": {+ "name": "OptionBool"+ }+ }+ }+ ]+ },+ {+ "name": "buy_exact_quote_in_v2",+ "discriminator": [+ 194,+ 171,+ 28,+ 70,+ 104,+ 77,+ 91,+ 47+ ],+ "accounts": [+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "base_mint"+ },+ {+ "name": "quote_mint"+ },+ {+ "name": "base_token_program"+ },+ {+ "name": "quote_token_program"+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "fee_recipient",+ "writable": true+ },+ {+ "name": "associated_quote_fee_recipient",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "fee_recipient"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "buyback_fee_recipient",+ "writable": true+ },+ {+ "name": "associated_quote_buyback_fee_recipient",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "buyback_fee_recipient"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ]+ }+ },+ {+ "name": "associated_base_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "base_token_program"+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "associated_quote_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "associated_base_user",+ "writable": true+ },+ {+ "name": "associated_quote_user",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "user"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 99,+ 114,+ 101,+ 97,+ 116,+ 111,+ 114,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "bonding_curve.creator",+ "account": "BondingCurve"+ }+ ]+ }+ },+ {+ "name": "associated_creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "creator_vault"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "sharing_config",+ "docs": [+ "seeds; the account is intentionally not deserialized here because it may be uninitialized",+ "for mints that have not created a fee sharing config. Handlers must check",+ "`data_is_empty()` / owner before reading."+ ],+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 115,+ 104,+ 97,+ 114,+ 105,+ 110,+ 103,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 12,+ 53,+ 255,+ 169,+ 5,+ 90,+ 142,+ 86,+ 141,+ 168,+ 247,+ 188,+ 7,+ 86,+ 21,+ 39,+ 76,+ 241,+ 201,+ 44,+ 164,+ 31,+ 64,+ 0,+ 156,+ 81,+ 106,+ 164,+ 20,+ 194,+ 124,+ 112+ ]+ }+ }+ },+ {+ "name": "global_volume_accumulator",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ }+ ]+ }+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "associated_user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "user_volume_accumulator"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "fee_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 102,+ 101,+ 101,+ 95,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "const",+ "value": [+ 1,+ 86,+ 224,+ 246,+ 147,+ 102,+ 90,+ 207,+ 68,+ 219,+ 21,+ 104,+ 191,+ 23,+ 91,+ 170,+ 81,+ 137,+ 203,+ 151,+ 245,+ 210,+ 255,+ 59,+ 101,+ 93,+ 43,+ 182,+ 253,+ 109,+ 24,+ 176+ ]+ }+ ],+ "program": {+ "kind": "account",+ "path": "fee_program"+ }+ }+ },+ {+ "name": "fee_program",+ "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ }+ ],+ "args": [+ {+ "name": "spendable_quote_in",+ "type": "u64"+ },+ {+ "name": "min_tokens_out",+ "type": "u64"+ }+ ]+ },+ {+ "name": "buy_exact_sol_in",+ "docs": [+ "Given a budget of spendable SOL, buy at least min_tokens_out tokens.",+ "Fees are deducted from spendable_sol_in.",+ "",+ "# Quote formulas",+ "Where:",+ "- total_fee_bps = protocol_fee_bps + creator_fee_bps (creator_fee_bps is 0 if no creator)",+ "- floor(a/b) = a / b (integer division)",+ "- ceil(a/b) = (a + b - 1) / b",+ "",+ "SOL → tokens quote",+ "To calculate tokens_out for a given spendable_sol_in:",+ "1. net_sol = floor(spendable_sol_in * 10_000 / (10_000 + total_fee_bps))",+ "2. fees = ceil(net_sol * protocol_fee_bps / 10_000) + ceil(net_sol * creator_fee_bps / 10_000) (creator_fee_bps is 0 if no creator)",+ "3. if net_sol + fees > spendable_sol_in: net_sol = net_sol - (net_sol + fees - spendable_sol_in)",+ "4. tokens_out = floor((net_sol - 1) * virtual_token_reserves / (virtual_sol_reserves + net_sol - 1))",+ "",+ "Reverse quote (tokens → SOL)",+ "To calculate spendable_sol_in for a desired number of tokens:",+ "1. net_sol = ceil(tokens * virtual_sol_reserves / (virtual_token_reserves - tokens)) + 1",+ "2. spendable_sol_in = ceil(net_sol * (10_000 + total_fee_bps) / 10_000)",+ "",+ "Rent",+ "Separately make sure the instruction's payer has enough SOL to cover rent for:",+ "- creator_vault: rent.minimum_balance(0)",+ "- user_volume_accumulator: rent.minimum_balance(UserVolumeAccumulator::LEN)"+ ],+ "discriminator": [+ 56,+ 252,+ 116,+ 8,+ 158,+ 223,+ 205,+ 95+ ],+ "accounts": [+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "fee_recipient",+ "writable": true+ },+ {+ "name": "mint"+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "associated_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "associated_user",+ "writable": true+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "token_program"+ },+ {+ "name": "creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 99,+ 114,+ 101,+ 97,+ 116,+ 111,+ 114,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "bonding_curve.creator",+ "account": "BondingCurve"+ }+ ]+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ },+ {+ "name": "global_volume_accumulator",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ }+ ]+ }+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "fee_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 102,+ 101,+ 101,+ 95,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "const",+ "value": [+ 1,+ 86,+ 224,+ 246,+ 147,+ 102,+ 90,+ 207,+ 68,+ 219,+ 21,+ 104,+ 191,+ 23,+ 91,+ 170,+ 81,+ 137,+ 203,+ 151,+ 245,+ 210,+ 255,+ 59,+ 101,+ 93,+ 43,+ 182,+ 253,+ 109,+ 24,+ 176+ ]+ }+ ],+ "program": {+ "kind": "account",+ "path": "fee_program"+ }+ }+ },+ {+ "name": "fee_program",+ "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"+ }+ ],+ "args": [+ {+ "name": "spendable_sol_in",+ "type": "u64"+ },+ {+ "name": "min_tokens_out",+ "type": "u64"+ },+ {+ "name": "track_volume",+ "type": {+ "defined": {+ "name": "OptionBool"+ }+ }+ }+ ]+ },+ {+ "name": "buy_v2",+ "discriminator": [+ 184,+ 23,+ 238,+ 97,+ 103,+ 197,+ 211,+ 61+ ],+ "accounts": [+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "base_mint"+ },+ {+ "name": "quote_mint"+ },+ {+ "name": "base_token_program"+ },+ {+ "name": "quote_token_program"+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "fee_recipient",+ "writable": true+ },+ {+ "name": "associated_quote_fee_recipient",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "fee_recipient"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "buyback_fee_recipient",+ "writable": true+ },+ {+ "name": "associated_quote_buyback_fee_recipient",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "buyback_fee_recipient"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ]+ }+ },+ {+ "name": "associated_base_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "base_token_program"+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "associated_quote_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "associated_base_user",+ "writable": true+ },+ {+ "name": "associated_quote_user",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "user"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 99,+ 114,+ 101,+ 97,+ 116,+ 111,+ 114,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "bonding_curve.creator",+ "account": "BondingCurve"+ }+ ]+ }+ },+ {+ "name": "associated_creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "creator_vault"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "sharing_config",+ "docs": [+ "seeds; the account is intentionally not deserialized here because it may be uninitialized",+ "for mints that have not created a fee sharing config. Handlers must check",+ "`data_is_empty()` / owner before reading."+ ],+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 115,+ 104,+ 97,+ 114,+ 105,+ 110,+ 103,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 12,+ 53,+ 255,+ 169,+ 5,+ 90,+ 142,+ 86,+ 141,+ 168,+ 247,+ 188,+ 7,+ 86,+ 21,+ 39,+ 76,+ 241,+ 201,+ 44,+ 164,+ 31,+ 64,+ 0,+ 156,+ 81,+ 106,+ 164,+ 20,+ 194,+ 124,+ 112+ ]+ }+ }+ },+ {+ "name": "global_volume_accumulator",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ }+ ]+ }+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "associated_user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "user_volume_accumulator"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "fee_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 102,+ 101,+ 101,+ 95,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "const",+ "value": [+ 1,+ 86,+ 224,+ 246,+ 147,+ 102,+ 90,+ 207,+ 68,+ 219,+ 21,+ 104,+ 191,+ 23,+ 91,+ 170,+ 81,+ 137,+ 203,+ 151,+ 245,+ 210,+ 255,+ 59,+ 101,+ 93,+ 43,+ 182,+ 253,+ 109,+ 24,+ 176+ ]+ }+ ],+ "program": {+ "kind": "account",+ "path": "fee_program"+ }+ }+ },+ {+ "name": "fee_program",+ "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ }+ ],+ "args": [+ {+ "name": "amount",+ "type": "u64"+ },+ {+ "name": "max_sol_cost",+ "type": "u64"+ }+ ]+ },+ {+ "name": "claim_cashback",+ "discriminator": [+ 37,+ 58,+ 35,+ 126,+ 190,+ 53,+ 228,+ 197+ ],+ "accounts": [+ {+ "name": "user",+ "writable": true+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ }+ ],+ "args": []+ },+ {+ "name": "claim_cashback_v2",+ "discriminator": [+ 122,+ 243,+ 204,+ 65,+ 94,+ 116,+ 29,+ 55+ ],+ "accounts": [+ {+ "name": "user",+ "writable": true+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "quote_mint"+ },+ {+ "name": "quote_token_program"+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "associated_user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "user_volume_accumulator"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "associated_quote_user",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "user"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ }+ ],+ "args": []+ },+ {+ "name": "claim_token_incentives",+ "discriminator": [+ 16,+ 4,+ 71,+ 28,+ 204,+ 1,+ 40,+ 27+ ],+ "accounts": [+ {+ "name": "user"+ },+ {+ "name": "user_ata",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "user"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "global_volume_accumulator",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ }+ ]+ }+ },+ {+ "name": "global_incentive_token_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "global_volume_accumulator"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "mint",+ "relations": [+ "global_volume_accumulator"+ ]+ },+ {+ "name": "token_program"+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ },+ {+ "name": "payer",+ "writable": true,+ "signer": true+ }+ ],+ "args": []+ },+ {+ "name": "close_user_volume_accumulator",+ "discriminator": [+ 249,+ 69,+ 164,+ 218,+ 150,+ 103,+ 84,+ 138+ ],+ "accounts": [+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "collect_creator_fee",+ "docs": [+ "Collects creator_fee from creator_vault to the coin creator account"+ ],+ "discriminator": [+ 20,+ 22,+ 86,+ 123,+ 198,+ 28,+ 219,+ 132+ ],+ "accounts": [+ {+ "name": "creator",+ "writable": true+ },+ {+ "name": "creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 99,+ 114,+ 101,+ 97,+ 116,+ 111,+ 114,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "creator"+ }+ ]+ }+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "create",+ "docs": [+ "Creates a new coin and bonding curve."+ ],+ "discriminator": [+ 24,+ 30,+ 200,+ 40,+ 5,+ 28,+ 7,+ 119+ ],+ "accounts": [+ {+ "name": "mint",+ "writable": true,+ "signer": true+ },+ {+ "name": "mint_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 109,+ 105,+ 110,+ 116,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "associated_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "const",+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "mpl_token_metadata",+ "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"+ },+ {+ "name": "metadata",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 109,+ 101,+ 116,+ 97,+ 100,+ 97,+ 116,+ 97+ ]+ },+ {+ "kind": "const",+ "value": [+ 11,+ 112,+ 101,+ 177,+ 227,+ 209,+ 124,+ 69,+ 56,+ 157,+ 82,+ 127,+ 107,+ 4,+ 195,+ 205,+ 88,+ 184,+ 108,+ 115,+ 26,+ 160,+ 253,+ 181,+ 73,+ 182,+ 209,+ 188,+ 3,+ 248,+ 41,+ 70+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "mpl_token_metadata"+ }+ }+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "token_program",+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "rent",+ "address": "SysvarRent111111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "name",+ "type": "string"+ },+ {+ "name": "symbol",+ "type": "string"+ },+ {+ "name": "uri",+ "type": "string"+ },+ {+ "name": "creator",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "create_v2",+ "docs": [+ "Creates a new spl-22 coin and bonding curve."+ ],+ "discriminator": [+ 214,+ 144,+ 76,+ 236,+ 95,+ 139,+ 49,+ 180+ ],+ "accounts": [+ {+ "name": "mint",+ "writable": true,+ "signer": true+ },+ {+ "name": "mint_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 109,+ 105,+ 110,+ 116,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "associated_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "token_program",+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "mayhem_program_id",+ "writable": true,+ "address": "MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e"+ },+ {+ "name": "global_params",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 112,+ 97,+ 114,+ 97,+ 109,+ 115+ ]+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 5,+ 42,+ 229,+ 215,+ 167,+ 218,+ 167,+ 36,+ 166,+ 234,+ 176,+ 167,+ 41,+ 84,+ 145,+ 133,+ 90,+ 212,+ 160,+ 103,+ 22,+ 96,+ 103,+ 76,+ 78,+ 3,+ 69,+ 89,+ 128,+ 61,+ 101,+ 163+ ]+ }+ }+ },+ {+ "name": "sol_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 115,+ 111,+ 108,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 5,+ 42,+ 229,+ 215,+ 167,+ 218,+ 167,+ 36,+ 166,+ 234,+ 176,+ 167,+ 41,+ 84,+ 145,+ 133,+ 90,+ 212,+ 160,+ 103,+ 22,+ 96,+ 103,+ 76,+ 78,+ 3,+ 69,+ 89,+ 128,+ 61,+ 101,+ 163+ ]+ }+ }+ },+ {+ "name": "mayhem_state",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 109,+ 97,+ 121,+ 104,+ 101,+ 109,+ 45,+ 115,+ 116,+ 97,+ 116,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 5,+ 42,+ 229,+ 215,+ 167,+ 218,+ 167,+ 36,+ 166,+ 234,+ 176,+ 167,+ 41,+ 84,+ 145,+ 133,+ 90,+ 212,+ 160,+ 103,+ 22,+ 96,+ 103,+ 76,+ 78,+ 3,+ 69,+ 89,+ 128,+ 61,+ 101,+ 163+ ]+ }+ }+ },+ {+ "name": "mayhem_token_vault",+ "writable": true+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "name",+ "type": "string"+ },+ {+ "name": "symbol",+ "type": "string"+ },+ {+ "name": "uri",+ "type": "string"+ },+ {+ "name": "creator",+ "type": "pubkey"+ },+ {+ "name": "is_mayhem_mode",+ "type": "bool"+ },+ {+ "name": "is_cashback_enabled",+ "type": {+ "defined": {+ "name": "OptionBool"+ }+ }+ }+ ]+ },+ {+ "name": "distribute_creator_fees",+ "docs": [+ "Distributes creator fees to shareholders based on their share percentages",+ "The creator vault needs to have at least the minimum distributable amount to distribute fees",+ "This can be checked with the get_minimum_distributable_fee instruction"+ ],+ "discriminator": [+ 165,+ 114,+ 103,+ 0,+ 121,+ 206,+ 247,+ 81+ ],+ "accounts": [+ {+ "name": "mint",+ "relations": [+ "sharing_config"+ ]+ },+ {+ "name": "bonding_curve",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "sharing_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 115,+ 104,+ 97,+ 114,+ 105,+ 110,+ 103,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 12,+ 53,+ 255,+ 169,+ 5,+ 90,+ 142,+ 86,+ 141,+ 168,+ 247,+ 188,+ 7,+ 86,+ 21,+ 39,+ 76,+ 241,+ 201,+ 44,+ 164,+ 31,+ 64,+ 0,+ 156,+ 81,+ 106,+ 164,+ 20,+ 194,+ 124,+ 112+ ]+ }+ }+ },+ {+ "name": "creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 99,+ 114,+ 101,+ 97,+ 116,+ 111,+ 114,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "bonding_curve.creator",+ "account": "BondingCurve"+ }+ ]+ }+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ }+ ],+ "args": [],+ "returns": {+ "defined": {+ "name": "DistributeCreatorFeesEvent"+ }+ }+ },+ {+ "name": "extend_account",+ "docs": [+ "Extends the size of program-owned accounts"+ ],+ "discriminator": [+ 234,+ 102,+ 194,+ 203,+ 150,+ 72,+ 62,+ 229+ ],+ "accounts": [+ {+ "name": "account",+ "writable": true+ },+ {+ "name": "user",+ "signer": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "get_minimum_distributable_fee",+ "docs": [+ "Permissionless instruction to check the minimum required fees for distribution",+ "Returns the minimum required balance from the creator_vault and whether distribution can proceed"+ ],+ "discriminator": [+ 117,+ 225,+ 127,+ 202,+ 134,+ 95,+ 68,+ 35+ ],+ "accounts": [+ {+ "name": "mint",+ "relations": [+ "sharing_config"+ ]+ },+ {+ "name": "bonding_curve",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "sharing_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 115,+ 104,+ 97,+ 114,+ 105,+ 110,+ 103,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 12,+ 53,+ 255,+ 169,+ 5,+ 90,+ 142,+ 86,+ 141,+ 168,+ 247,+ 188,+ 7,+ 86,+ 21,+ 39,+ 76,+ 241,+ 201,+ 44,+ 164,+ 31,+ 64,+ 0,+ 156,+ 81,+ 106,+ 164,+ 20,+ 194,+ 124,+ 112+ ]+ }+ }+ },+ {+ "name": "creator_vault",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 99,+ 114,+ 101,+ 97,+ 116,+ 111,+ 114,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "bonding_curve.creator",+ "account": "BondingCurve"+ }+ ]+ }+ }+ ],+ "args": [],+ "returns": {+ "defined": {+ "name": "MinimumDistributableFeeEvent"+ }+ }+ },+ {+ "name": "init_user_volume_accumulator",+ "discriminator": [+ 94,+ 6,+ 202,+ 115,+ 255,+ 96,+ 232,+ 183+ ],+ "accounts": [+ {+ "name": "payer",+ "writable": true,+ "signer": true+ },+ {+ "name": "user"+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "initialize",+ "docs": [+ "Creates the global state."+ ],+ "discriminator": [+ 175,+ 175,+ 109,+ 31,+ 13,+ 152,+ 155,+ 237+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ }+ ],+ "args": []+ },+ {+ "name": "migrate",+ "docs": [+ "Migrates liquidity to pump_amm if the bonding curve is complete"+ ],+ "discriminator": [+ 155,+ 234,+ 231,+ 146,+ 236,+ 158,+ 162,+ 30+ ],+ "accounts": [+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "withdraw_authority",+ "writable": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "mint"+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "associated_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "mint"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "user",+ "signer": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "token_program",+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"+ },+ {+ "name": "pump_amm",+ "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"+ },+ {+ "name": "pool",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 112,+ 111,+ 111,+ 108+ ]+ },+ {+ "kind": "const",+ "value": [+ 0,+ 0+ ]+ },+ {+ "kind": "account",+ "path": "pool_authority"+ },+ {+ "kind": "account",+ "path": "mint"+ },+ {+ "kind": "account",+ "path": "wsol_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "pump_amm"+ }+ }+ },+ {+ "name": "pool_authority",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 112,+ 111,+ 111,+ 108,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "pool_authority_mint_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool_authority"+ },+ {+ "kind": "account",+ "path": "mint"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "pool_authority_wsol_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool_authority"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "wsol_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "amm_global_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 95,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ],+ "program": {+ "kind": "account",+ "path": "pump_amm"+ }+ }+ },+ {+ "name": "wsol_mint",+ "address": "So11111111111111111111111111111111111111112"+ },+ {+ "name": "lp_mint",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 112,+ 111,+ 111,+ 108,+ 95,+ 108,+ 112,+ 95,+ 109,+ 105,+ 110,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "pool"+ }+ ],+ "program": {+ "kind": "account",+ "path": "pump_amm"+ }+ }+ },+ {+ "name": "user_pool_token_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool_authority"+ },+ {+ "kind": "account",+ "path": "token_2022_program"+ },+ {+ "kind": "account",+ "path": "lp_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "pool_base_token_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool"+ },+ {+ "kind": "account",+ "path": "mint"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "pool_quote_token_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "wsol_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "token_2022_program",+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "pump_amm_event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ],+ "program": {+ "kind": "account",+ "path": "pump_amm"+ }+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ },+ {+ "name": "rent",+ "address": "SysvarRent111111111111111111111111111111111"+ }+ ],+ "args": []+ },+ {+ "name": "migrate_bonding_curve_creator",+ "discriminator": [+ 87,+ 124,+ 52,+ 191,+ 52,+ 38,+ 214,+ 232+ ],+ "accounts": [+ {+ "name": "mint",+ "relations": [+ "sharing_config"+ ]+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "sharing_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 115,+ 104,+ 97,+ 114,+ 105,+ 110,+ 103,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 12,+ 53,+ 255,+ 169,+ 5,+ 90,+ 142,+ 86,+ 141,+ 168,+ 247,+ 188,+ 7,+ 86,+ 21,+ 39,+ 76,+ 241,+ 201,+ 44,+ 164,+ 31,+ 64,+ 0,+ 156,+ 81,+ 106,+ 164,+ 20,+ 194,+ 124,+ 112+ ]+ }+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "migrate_v2",+ "docs": [+ "Migrates liquidity to pump_amm if the bonding curve is complete"+ ],+ "discriminator": [+ 187,+ 203,+ 18,+ 31,+ 206,+ 237,+ 254,+ 41+ ],+ "accounts": [+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "withdraw_authority",+ "writable": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "base_mint"+ },+ {+ "name": "quote_mint"+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ]+ }+ },+ {+ "name": "associated_base_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "base_token_program"+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "associated_quote_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "user",+ "signer": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "pump_amm",+ "address": "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"+ },+ {+ "name": "pool",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 112,+ 111,+ 111,+ 108+ ]+ },+ {+ "kind": "const",+ "value": [+ 0,+ 0+ ]+ },+ {+ "kind": "account",+ "path": "pool_authority"+ },+ {+ "kind": "account",+ "path": "base_mint"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "pump_amm"+ }+ }+ },+ {+ "name": "pool_authority",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 112,+ 111,+ 111,+ 108,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ]+ }+ },+ {+ "name": "pool_authority_mint_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool_authority"+ },+ {+ "kind": "account",+ "path": "base_token_program"+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "pool_authority_quote_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool_authority"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "amm_global_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 95,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ],+ "program": {+ "kind": "account",+ "path": "pump_amm"+ }+ }+ },+ {+ "name": "lp_mint",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 112,+ 111,+ 111,+ 108,+ 95,+ 108,+ 112,+ 95,+ 109,+ 105,+ 110,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "pool"+ }+ ],+ "program": {+ "kind": "account",+ "path": "pump_amm"+ }+ }+ },+ {+ "name": "user_pool_token_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool_authority"+ },+ {+ "kind": "account",+ "path": "token_2022_program"+ },+ {+ "kind": "account",+ "path": "lp_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "pool_base_token_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool"+ },+ {+ "kind": "account",+ "path": "base_token_program"+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "pool_quote_token_account",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "pool"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "account",+ "path": "associated_token_program"+ }+ }+ },+ {+ "name": "base_token_program"+ },+ {+ "name": "quote_token_program"+ },+ {+ "name": "token_2022_program",+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "pump_amm_event_authority"+ },+ {+ "name": "rent",+ "address": "SysvarRent111111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "remove_quote_mint",+ "discriminator": [+ 177,+ 65,+ 223,+ 38,+ 88,+ 209,+ 158,+ 155+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "writable": true,+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "quote_mint",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "sell",+ "docs": [+ "Sells tokens into a bonding curve.",+ "For cashback coins, pass as remaining_accounts: [0] user_volume_accumulator,",+ "[1] bonding_curve_v2. If provided and valid, creator_fee goes to user_volume_accumulator.",+ "Otherwise, falls back to transferring creator_fee to creator_vault."+ ],+ "discriminator": [+ 51,+ 230,+ 133,+ 164,+ 1,+ 127,+ 131,+ 173+ ],+ "accounts": [+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "fee_recipient",+ "writable": true+ },+ {+ "name": "mint"+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "associated_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "associated_user",+ "writable": true+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 99,+ 114,+ 101,+ 97,+ 116,+ 111,+ 114,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "bonding_curve.creator",+ "account": "BondingCurve"+ }+ ]+ }+ },+ {+ "name": "token_program"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ },+ {+ "name": "fee_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 102,+ 101,+ 101,+ 95,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "const",+ "value": [+ 1,+ 86,+ 224,+ 246,+ 147,+ 102,+ 90,+ 207,+ 68,+ 219,+ 21,+ 104,+ 191,+ 23,+ 91,+ 170,+ 81,+ 137,+ 203,+ 151,+ 245,+ 210,+ 255,+ 59,+ 101,+ 93,+ 43,+ 182,+ 253,+ 109,+ 24,+ 176+ ]+ }+ ],+ "program": {+ "kind": "account",+ "path": "fee_program"+ }+ }+ },+ {+ "name": "fee_program",+ "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"+ }+ ],+ "args": [+ {+ "name": "amount",+ "type": "u64"+ },+ {+ "name": "min_sol_output",+ "type": "u64"+ }+ ]+ },+ {+ "name": "sell_v2",+ "discriminator": [+ 93,+ 246,+ 130,+ 60,+ 231,+ 233,+ 64,+ 178+ ],+ "accounts": [+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "base_mint"+ },+ {+ "name": "quote_mint"+ },+ {+ "name": "base_token_program"+ },+ {+ "name": "quote_token_program"+ },+ {+ "name": "associated_token_program",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "fee_recipient",+ "writable": true+ },+ {+ "name": "associated_quote_fee_recipient",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "fee_recipient"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "buyback_fee_recipient",+ "writable": true+ },+ {+ "name": "associated_quote_buyback_fee_recipient",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "buyback_fee_recipient"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ]+ }+ },+ {+ "name": "associated_base_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "base_token_program"+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "associated_quote_bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "bonding_curve"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "associated_base_user",+ "writable": true+ },+ {+ "name": "associated_quote_user",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "user"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 99,+ 114,+ 101,+ 97,+ 116,+ 111,+ 114,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ },+ {+ "kind": "account",+ "path": "bonding_curve.creator",+ "account": "BondingCurve"+ }+ ]+ }+ },+ {+ "name": "associated_creator_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "creator_vault"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "sharing_config",+ "docs": [+ "seeds; the account is intentionally not deserialized here because it may be uninitialized",+ "for mints that have not created a fee sharing config. Handlers must check",+ "`data_is_empty()` / owner before reading."+ ],+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 115,+ 104,+ 97,+ 114,+ 105,+ 110,+ 103,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "account",+ "path": "base_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 12,+ 53,+ 255,+ 169,+ 5,+ 90,+ 142,+ 86,+ 141,+ 168,+ 247,+ 188,+ 7,+ 86,+ 21,+ 39,+ 76,+ 241,+ 201,+ 44,+ 164,+ 31,+ 64,+ 0,+ 156,+ 81,+ 106,+ 164,+ 20,+ 194,+ 124,+ 112+ ]+ }+ }+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "associated_user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "user_volume_accumulator"+ },+ {+ "kind": "account",+ "path": "quote_token_program"+ },+ {+ "kind": "account",+ "path": "quote_mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "fee_config",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 102,+ 101,+ 101,+ 95,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ },+ {+ "kind": "const",+ "value": [+ 1,+ 86,+ 224,+ 246,+ 147,+ 102,+ 90,+ 207,+ 68,+ 219,+ 21,+ 104,+ 191,+ 23,+ 91,+ 170,+ 81,+ 137,+ 203,+ 151,+ 245,+ 210,+ 255,+ 59,+ 101,+ 93,+ 43,+ 182,+ 253,+ 109,+ 24,+ 176+ ]+ }+ ],+ "program": {+ "kind": "account",+ "path": "fee_program"+ }+ }+ },+ {+ "name": "fee_program",+ "address": "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"+ },+ {+ "name": "system_program",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program",+ "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"+ }+ ],+ "args": [+ {+ "name": "amount",+ "type": "u64"+ },+ {+ "name": "min_sol_output",+ "type": "u64"+ }+ ]+ },+ {+ "name": "set_creator",+ "docs": [+ "Allows Global::set_creator_authority to set the bonding curve creator from Metaplex metadata or input argument"+ ],+ "discriminator": [+ 254,+ 148,+ 255,+ 112,+ 207,+ 142,+ 170,+ 165+ ],+ "accounts": [+ {+ "name": "set_creator_authority",+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "mint"+ },+ {+ "name": "metadata",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 109,+ 101,+ 116,+ 97,+ 100,+ 97,+ 116,+ 97+ ]+ },+ {+ "kind": "const",+ "value": [+ 11,+ 112,+ 101,+ 177,+ 227,+ 209,+ 124,+ 69,+ 56,+ 157,+ 82,+ 127,+ 107,+ 4,+ 195,+ 205,+ 88,+ 184,+ 108,+ 115,+ 26,+ 160,+ 253,+ 181,+ 73,+ 182,+ 209,+ 188,+ 3,+ 248,+ 41,+ 70+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 11,+ 112,+ 101,+ 177,+ 227,+ 209,+ 124,+ 69,+ 56,+ 157,+ 82,+ 127,+ 107,+ 4,+ 195,+ 205,+ 88,+ 184,+ 108,+ 115,+ 26,+ 160,+ 253,+ 181,+ 73,+ 182,+ 209,+ 188,+ 3,+ 248,+ 41,+ 70+ ]+ }+ }+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "creator",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "set_mayhem_virtual_params",+ "discriminator": [+ 61,+ 169,+ 188,+ 191,+ 153,+ 149,+ 42,+ 97+ ],+ "accounts": [+ {+ "name": "sol_vault_authority",+ "writable": true,+ "signer": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 115,+ 111,+ 108,+ 45,+ 118,+ 97,+ 117,+ 108,+ 116+ ]+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 5,+ 42,+ 229,+ 215,+ 167,+ 218,+ 167,+ 36,+ 166,+ 234,+ 176,+ 167,+ 41,+ 84,+ 145,+ 133,+ 90,+ 212,+ 160,+ 103,+ 22,+ 96,+ 103,+ 76,+ 78,+ 3,+ 69,+ 89,+ 128,+ 61,+ 101,+ 163+ ]+ }+ }+ },+ {+ "name": "mayhem_token_vault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "sol_vault_authority"+ },+ {+ "kind": "account",+ "path": "token_program"+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "mint"+ },+ {+ "name": "global",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "token_program",+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "set_metaplex_creator",+ "docs": [+ "Syncs the bonding curve creator with the Metaplex metadata creator if it exists"+ ],+ "discriminator": [+ 138,+ 96,+ 174,+ 217,+ 48,+ 85,+ 197,+ 246+ ],+ "accounts": [+ {+ "name": "mint"+ },+ {+ "name": "metadata",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 109,+ 101,+ 116,+ 97,+ 100,+ 97,+ 116,+ 97+ ]+ },+ {+ "kind": "const",+ "value": [+ 11,+ 112,+ 101,+ 177,+ 227,+ 209,+ 124,+ 69,+ 56,+ 157,+ 82,+ 127,+ 107,+ 4,+ 195,+ 205,+ 88,+ 184,+ 108,+ 115,+ 26,+ 160,+ 253,+ 181,+ 73,+ 182,+ 209,+ 188,+ 3,+ 248,+ 41,+ 70+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 11,+ 112,+ 101,+ 177,+ 227,+ 209,+ 124,+ 69,+ 56,+ 157,+ 82,+ 127,+ 107,+ 4,+ 195,+ 205,+ 88,+ 184,+ 108,+ 115,+ 26,+ 160,+ 253,+ 181,+ 73,+ 182,+ 209,+ 188,+ 3,+ 248,+ 41,+ 70+ ]+ }+ }+ },+ {+ "name": "bonding_curve",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "set_params",+ "docs": [+ "Sets the global state parameters."+ ],+ "discriminator": [+ 27,+ 234,+ 178,+ 52,+ 147,+ 2,+ 187,+ 141+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "writable": true,+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "initial_virtual_token_reserves",+ "type": "u64"+ },+ {+ "name": "initial_virtual_sol_reserves",+ "type": "u64"+ },+ {+ "name": "initial_real_token_reserves",+ "type": "u64"+ },+ {+ "name": "token_total_supply",+ "type": "u64"+ },+ {+ "name": "fee_basis_points",+ "type": "u64"+ },+ {+ "name": "withdraw_authority",+ "type": "pubkey"+ },+ {+ "name": "enable_migrate",+ "type": "bool"+ },+ {+ "name": "pool_migration_fee",+ "type": "u64"+ },+ {+ "name": "creator_fee_basis_points",+ "type": "u64"+ },+ {+ "name": "set_creator_authority",+ "type": "pubkey"+ },+ {+ "name": "admin_set_creator_authority",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "set_reserved_fee_recipients",+ "discriminator": [+ 111,+ 172,+ 162,+ 232,+ 114,+ 89,+ 213,+ 142+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "whitelist_pda",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "set_virtual_quote_reserves",+ "discriminator": [+ 101,+ 135,+ 191,+ 104,+ 9,+ 88,+ 20,+ 96+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "writable": true,+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "initial_virtual_quote_reserves",+ "type": "u64"+ }+ ]+ },+ {+ "name": "sync_user_volume_accumulator",+ "discriminator": [+ 86,+ 31,+ 192,+ 87,+ 163,+ 87,+ 79,+ 238+ ],+ "accounts": [+ {+ "name": "user"+ },+ {+ "name": "global_volume_accumulator",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ }+ ]+ }+ },+ {+ "name": "user_volume_accumulator",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 117,+ 115,+ 101,+ 114,+ 95,+ 118,+ 111,+ 108,+ 117,+ 109,+ 101,+ 95,+ 97,+ 99,+ 99,+ 117,+ 109,+ 117,+ 108,+ 97,+ 116,+ 111,+ 114+ ]+ },+ {+ "kind": "account",+ "path": "user"+ }+ ]+ }+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "toggle_cashback_enabled",+ "discriminator": [+ 115,+ 103,+ 224,+ 255,+ 189,+ 89,+ 86,+ 195+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "writable": true,+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "enabled",+ "type": "bool"+ }+ ]+ },+ {+ "name": "toggle_create_v2",+ "discriminator": [+ 28,+ 255,+ 230,+ 240,+ 172,+ 107,+ 203,+ 171+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "writable": true,+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "enabled",+ "type": "bool"+ }+ ]+ },+ {+ "name": "toggle_mayhem_mode",+ "discriminator": [+ 1,+ 9,+ 111,+ 208,+ 100,+ 31,+ 255,+ 163+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "writable": true,+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "enabled",+ "type": "bool"+ }+ ]+ },+ {+ "name": "update_buyback_config",+ "discriminator": [+ 251,+ 224,+ 171,+ 146,+ 160,+ 26,+ 113,+ 233+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "writable": true,+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "buyback_basis_points",+ "type": {+ "option": "u64"+ }+ }+ ]+ },+ {+ "name": "update_global_authority",+ "discriminator": [+ 227,+ 181,+ 74,+ 196,+ 208,+ 21,+ 97,+ 213+ ],+ "accounts": [+ {+ "name": "global",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108+ ]+ }+ ]+ }+ },+ {+ "name": "authority",+ "signer": true,+ "relations": [+ "global"+ ]+ },+ {+ "name": "new_authority"+ },+ {+ "name": "event_authority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ }+ ],+ "accounts": [+ {+ "name": "BondingCurve",+ "discriminator": [+ 23,+ 183,+ 248,+ 55,+ 96,+ 216,+ 172,+ 96+ ]+ },+ {+ "name": "FeeConfig",+ "discriminator": [+ 143,+ 52,+ 146,+ 187,+ 219,+ 123,+ 76,+ 155+ ]+ },+ {+ "name": "Global",+ "discriminator": [+ 167,+ 232,+ 232,+ 177,+ 200,+ 108,+ 114,+ 127+ ]+ },+ {+ "name": "GlobalVolumeAccumulator",+ "discriminator": [+ 202,+ 42,+ 246,+ 43,+ 142,+ 190,+ 30,+ 255+ ]+ },+ {+ "name": "SharingConfig",+ "discriminator": [+ 216,+ 74,+ 9,+ 0,+ 56,+ 140,+ 93,+ 75+ ]+ },+ {+ "name": "UserVolumeAccumulator",+ "discriminator": [+ 86,+ 255,+ 112,+ 14,+ 102,+ 53,+ 154,+ 250+ ]+ }+ ],+ "events": [+ {+ "name": "AdminSetCreatorEvent",+ "discriminator": [+ 64,+ 69,+ 192,+ 104,+ 29,+ 30,+ 25,+ 107+ ]+ },+ {+ "name": "AdminSetIdlAuthorityEvent",+ "discriminator": [+ 245,+ 59,+ 70,+ 34,+ 75,+ 185,+ 109,+ 92+ ]+ },+ {+ "name": "AdminUpdateTokenIncentivesEvent",+ "discriminator": [+ 147,+ 250,+ 108,+ 120,+ 247,+ 29,+ 67,+ 222+ ]+ },+ {+ "name": "ClaimCashbackEvent",+ "discriminator": [+ 226,+ 214,+ 246,+ 33,+ 7,+ 242,+ 147,+ 229+ ]+ },+ {+ "name": "ClaimTokenIncentivesEvent",+ "discriminator": [+ 79,+ 172,+ 246,+ 49,+ 205,+ 91,+ 206,+ 232+ ]+ },+ {+ "name": "CloseUserVolumeAccumulatorEvent",+ "discriminator": [+ 146,+ 159,+ 189,+ 172,+ 146,+ 88,+ 56,+ 244+ ]+ },+ {+ "name": "CollectCreatorFeeEvent",+ "discriminator": [+ 122,+ 2,+ 127,+ 1,+ 14,+ 191,+ 12,+ 175+ ]+ },+ {+ "name": "CompleteEvent",+ "discriminator": [+ 95,+ 114,+ 97,+ 156,+ 212,+ 46,+ 152,+ 8+ ]+ },+ {+ "name": "CompletePumpAmmMigrationEvent",+ "discriminator": [+ 189,+ 233,+ 93,+ 185,+ 92,+ 148,+ 234,+ 148+ ]+ },+ {+ "name": "CreateEvent",+ "discriminator": [+ 27,+ 114,+ 169,+ 77,+ 222,+ 235,+ 99,+ 118+ ]+ },+ {+ "name": "DistributeCreatorFeesEvent",+ "discriminator": [+ 165,+ 55,+ 129,+ 112,+ 4,+ 179,+ 202,+ 40+ ]+ },+ {+ "name": "ExtendAccountEvent",+ "discriminator": [+ 97,+ 97,+ 215,+ 144,+ 93,+ 146,+ 22,+ 124+ ]+ },+ {+ "name": "InitUserVolumeAccumulatorEvent",+ "discriminator": [+ 134,+ 36,+ 13,+ 72,+ 232,+ 101,+ 130,+ 216+ ]+ },+ {+ "name": "MigrateBondingCurveCreatorEvent",+ "discriminator": [+ 155,+ 167,+ 104,+ 220,+ 213,+ 108,+ 243,+ 3+ ]+ },+ {+ "name": "MinimumDistributableFeeEvent",+ "discriminator": [+ 168,+ 216,+ 132,+ 239,+ 235,+ 182,+ 49,+ 52+ ]+ },+ {+ "name": "ReservedFeeRecipientsEvent",+ "discriminator": [+ 43,+ 188,+ 250,+ 18,+ 221,+ 75,+ 187,+ 95+ ]+ },+ {+ "name": "SetCreatorEvent",+ "discriminator": [+ 237,+ 52,+ 123,+ 37,+ 245,+ 251,+ 72,+ 210+ ]+ },+ {+ "name": "SetMetaplexCreatorEvent",+ "discriminator": [+ 142,+ 203,+ 6,+ 32,+ 127,+ 105,+ 191,+ 162+ ]+ },+ {+ "name": "SetParamsEvent",+ "discriminator": [+ 223,+ 195,+ 159,+ 246,+ 62,+ 48,+ 143,+ 131+ ]+ },+ {+ "name": "SyncUserVolumeAccumulatorEvent",+ "discriminator": [+ 197,+ 122,+ 167,+ 124,+ 116,+ 81,+ 91,+ 255+ ]+ },+ {+ "name": "TradeEvent",+ "discriminator": [+ 189,+ 219,+ 127,+ 211,+ 78,+ 230,+ 97,+ 238+ ]+ },+ {+ "name": "UpdateGlobalAuthorityEvent",+ "discriminator": [+ 182,+ 195,+ 137,+ 42,+ 35,+ 206,+ 207,+ 247+ ]+ },+ {+ "name": "UpdateMayhemVirtualParamsEvent",+ "discriminator": [+ 117,+ 123,+ 228,+ 182,+ 161,+ 168,+ 220,+ 214+ ]+ }+ ],+ "errors": [+ {+ "code": 6000,+ "name": "NotAuthorized",+ "msg": "The given account is not authorized to execute this instruction."+ },+ {+ "code": 6001,+ "name": "AlreadyInitialized",+ "msg": "The program is already initialized."+ },+ {+ "code": 6002,+ "name": "TooMuchSolRequired",+ "msg": "slippage: Too much SOL required to buy the given amount of tokens."+ },+ {+ "code": 6003,+ "name": "TooLittleSolReceived",+ "msg": "slippage: Too little SOL received to sell the given amount of tokens."+ },+ {+ "code": 6004,+ "name": "MintDoesNotMatchBondingCurve",+ "msg": "The mint does not match the bonding curve."+ },+ {+ "code": 6005,+ "name": "BondingCurveComplete",+ "msg": "The bonding curve has completed and liquidity migrated to raydium."+ },+ {+ "code": 6006,+ "name": "BondingCurveNotComplete",+ "msg": "The bonding curve has not completed."+ },+ {+ "code": 6007,+ "name": "NotInitialized",+ "msg": "The program is not initialized."+ },+ {+ "code": 6008,+ "name": "WithdrawTooFrequent",+ "msg": "Withdraw too frequent"+ },+ {+ "code": 6009,+ "name": "NewSizeShouldBeGreaterThanCurrentSize",+ "msg": "new_size should be > current_size"+ },+ {+ "code": 6010,+ "name": "AccountTypeNotSupported",+ "msg": "Account type not supported"+ },+ {+ "code": 6011,+ "name": "InitialRealTokenReservesShouldBeLessThanTokenTotalSupply",+ "msg": "initial_real_token_reserves should be less than token_total_supply"+ },+ {+ "code": 6012,+ "name": "InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves",+ "msg": "initial_virtual_token_reserves should be greater than initial_real_token_reserves"+ },+ {+ "code": 6013,+ "name": "FeeBasisPointsGreaterThanMaximum",+ "msg": "fee_basis_points greater than maximum"+ },+ {+ "code": 6014,+ "name": "AllZerosWithdrawAuthority",+ "msg": "Withdraw authority cannot be set to System Program ID"+ },+ {+ "code": 6015,+ "name": "PoolMigrationFeeShouldBeLessThanFinalRealSolReserves",+ "msg": "pool_migration_fee should be less than final_real_sol_reserves"+ },+ {+ "code": 6016,+ "name": "PoolMigrationFeeShouldBeGreaterThanCreatorFeePlusMaxMigrateFees",+ "msg": "pool_migration_fee should be greater than creator_fee + MAX_MIGRATE_FEES"+ },+ {+ "code": 6017,+ "name": "DisabledWithdraw",+ "msg": "Migrate instruction is disabled"+ },+ {+ "code": 6018,+ "name": "DisabledMigrate",+ "msg": "Migrate instruction is disabled"+ },+ {+ "code": 6019,+ "name": "InvalidCreator",+ "msg": "Invalid creator pubkey"+ },+ {+ "code": 6020,+ "name": "BuyZeroAmount",+ "msg": "Buy zero amount"+ },+ {+ "code": 6021,+ "name": "NotEnoughTokensToBuy",+ "msg": "Not enough tokens to buy"+ },+ {+ "code": 6022,+ "name": "SellZeroAmount",+ "msg": "Sell zero amount"+ },+ {+ "code": 6023,+ "name": "NotEnoughTokensToSell",+ "msg": "Not enough tokens to sell"+ },+ {+ "code": 6024,+ "name": "Overflow",+ "msg": "Overflow"+ },+ {+ "code": 6025,+ "name": "Truncation",+ "msg": "Truncation"+ },+ {+ "code": 6026,+ "name": "DivisionByZero",+ "msg": "Division by zero"+ },+ {+ "code": 6027,+ "name": "NotEnoughRemainingAccounts",+ "msg": "Not enough remaining accounts"+ },+ {+ "code": 6028,+ "name": "AllFeeRecipientsShouldBeNonZero",+ "msg": "All fee recipients should be non-zero"+ },+ {+ "code": 6029,+ "name": "UnsortedNotUniqueFeeRecipients",+ "msg": "Unsorted or not unique fee recipients"+ },+ {+ "code": 6030,+ "name": "CreatorShouldNotBeZero",+ "msg": "Creator should not be zero"+ },+ {+ "code": 6031,+ "name": "StartTimeInThePast"+ },+ {+ "code": 6032,+ "name": "EndTimeInThePast"+ },+ {+ "code": 6033,+ "name": "EndTimeBeforeStartTime"+ },+ {+ "code": 6034,+ "name": "TimeRangeTooLarge"+ },+ {+ "code": 6035,+ "name": "EndTimeBeforeCurrentDay"+ },+ {+ "code": 6036,+ "name": "SupplyUpdateForFinishedRange"+ },+ {+ "code": 6037,+ "name": "DayIndexAfterEndIndex"+ },+ {+ "code": 6038,+ "name": "DayInActiveRange"+ },+ {+ "code": 6039,+ "name": "InvalidIncentiveMint"+ },+ {+ "code": 6040,+ "name": "BuyNotEnoughSolToCoverRent",+ "msg": "Buy: Not enough SOL to cover for rent exemption."+ },+ {+ "code": 6041,+ "name": "BuyNotEnoughSolToCoverFees",+ "msg": "Buy: Not enough SOL to cover for fees."+ },+ {+ "code": 6042,+ "name": "BuySlippageBelowMinTokensOut",+ "msg": "Slippage: Would buy less tokens than expected min_tokens_out"+ },+ {+ "code": 6043,+ "name": "NameTooLong"+ },+ {+ "code": 6044,+ "name": "SymbolTooLong"+ },+ {+ "code": 6045,+ "name": "UriTooLong"+ },+ {+ "code": 6046,+ "name": "CreateV2Disabled"+ },+ {+ "code": 6047,+ "name": "CpitializeMayhemFailed"+ },+ {+ "code": 6048,+ "name": "MayhemModeDisabled"+ },+ {+ "code": 6049,+ "name": "CreatorMigratedToSharingConfig",+ "msg": "creator has been migrated to sharing config, use pump_fees::reset_fee_sharing_config instead"+ },+ {+ "code": 6050,+ "name": "UnableToDistributeCreatorVaultMigratedToSharingConfig",+ "msg": "creator_vault has been migrated to sharing config, use pump:distribute_creator_fees instead"+ },+ {+ "code": 6051,+ "name": "SharingConfigNotActive",+ "msg": "Sharing config is not active"+ },+ {+ "code": 6052,+ "name": "UnableToDistributeCreatorFeesToExecutableRecipient",+ "msg": "The recipient account is executable, so it cannot receive lamports, remove it from the team first"+ },+ {+ "code": 6053,+ "name": "BondingCurveAndSharingConfigCreatorMismatch",+ "msg": "Bonding curve creator does not match sharing config"+ },+ {+ "code": 6054,+ "name": "ShareholdersAndRemainingAccountsMismatch",+ "msg": "Remaining accounts do not match shareholders, make sure to pass exactly the same pubkeys in the same order"+ },+ {+ "code": 6055,+ "name": "InvalidShareBps",+ "msg": "Share bps must be greater than 0"+ },+ {+ "code": 6056,+ "name": "CashbackNotEnabled",+ "msg": "Cashback is not enabled"+ },+ {+ "code": 6057,+ "name": "BuybackFeeRecipientNotAuthorized",+ "msg": "Buyback fee recipient not authorized"+ },+ {+ "code": 6058,+ "name": "AllBuybackFeeRecipientsShouldBeNonZero"+ },+ {+ "code": 6059,+ "name": "NotUniqueBuybackFeeRecipients"+ },+ {+ "code": 6060,+ "name": "BuybackBasisPointsOutOfRange",+ "msg": "buyback_basis_points must be <= 10_000"+ },+ {+ "code": 6061,+ "name": "WrongBuybackFeeRecipientsCount",+ "msg": "buyback fee recipients require exactly 8 remaining accounts (or none)"+ },+ {+ "code": 6062,+ "name": "BuybackFeeRecipientMissing"+ },+ {+ "code": 6063,+ "name": "UnsupportedQuoteMint",+ "msg": "Unsupported quote mint"+ },+ {+ "code": 6064,+ "name": "InvalidQuoteTokenProgram",+ "msg": "Create v2: quote token program must be legacy SPL Token"+ },+ {+ "code": 6065,+ "name": "InvalidAssociatedQuoteBondingCurve",+ "msg": "Create v2: associated quote bonding curve address does not match derivation"+ },+ {+ "code": 6066,+ "name": "QuoteMintWhitelistFull",+ "msg": "Quote mint whitelist is full"+ },+ {+ "code": 6067,+ "name": "QuoteMintAlreadyWhitelisted",+ "msg": "Quote mint is already whitelisted"+ },+ {+ "code": 6068,+ "name": "QuoteMintNotWhitelisted",+ "msg": "Quote mint is not in the whitelist"+ },+ {+ "code": 6069,+ "name": "QuoteMintNotEligibleForWhitelist",+ "msg": "Quote mint cannot be added or removed via whitelist (default or native SOL mint)"+ }+ ],+ "types": [+ {+ "name": "AdminSetCreatorEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "admin_set_creator_authority",+ "type": "pubkey"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "bonding_curve",+ "type": "pubkey"+ },+ {+ "name": "old_creator",+ "type": "pubkey"+ },+ {+ "name": "new_creator",+ "type": "pubkey"+ }+ ]+ }+ },+ {+ "name": "AdminSetIdlAuthorityEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "idl_authority",+ "type": "pubkey"+ }+ ]+ }+ },+ {+ "name": "AdminUpdateTokenIncentivesEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "start_time",+ "type": "i64"+ },+ {+ "name": "end_time",+ "type": "i64"+ },+ {+ "name": "day_number",+ "type": "u64"+ },+ {+ "name": "token_supply_per_day",+ "type": "u64"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "seconds_in_a_day",+ "type": "i64"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "BondingCurve",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "virtual_token_reserves",+ "type": "u64"+ },+ {+ "name": "virtual_quote_reserves",+ "type": "u64"+ },+ {+ "name": "real_token_reserves",+ "type": "u64"+ },+ {+ "name": "real_quote_reserves",+ "type": "u64"+ },+ {+ "name": "token_total_supply",+ "type": "u64"+ },+ {+ "name": "complete",+ "type": "bool"+ },+ {+ "name": "creator",+ "type": "pubkey"+ },+ {+ "name": "is_mayhem_mode",+ "type": "bool"+ },+ {+ "name": "is_cashback_coin",+ "type": "bool"+ },+ {+ "name": "quote_mint",+ "type": "pubkey"+ }+ ]+ }+ },+ {+ "name": "ClaimCashbackEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "amount",+ "type": "u64"+ },+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "total_claimed",+ "type": "u64"+ },+ {+ "name": "total_cashback_earned",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "ClaimTokenIncentivesEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "amount",+ "type": "u64"+ },+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "total_claimed_tokens",+ "type": "u64"+ },+ {+ "name": "current_sol_volume",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "CloseUserVolumeAccumulatorEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "total_unclaimed_tokens",+ "type": "u64"+ },+ {+ "name": "total_claimed_tokens",+ "type": "u64"+ },+ {+ "name": "current_sol_volume",+ "type": "u64"+ },+ {+ "name": "last_update_timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "CollectCreatorFeeEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "creator",+ "type": "pubkey"+ },+ {+ "name": "creator_fee",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "CompleteEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "bonding_curve",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "quote_mint",+ "type": "pubkey"+ }+ ]+ }+ },+ {+ "name": "CompletePumpAmmMigrationEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "mint_amount",+ "type": "u64"+ },+ {+ "name": "sol_amount",+ "type": "u64"+ },+ {+ "name": "pool_migration_fee",+ "type": "u64"+ },+ {+ "name": "bonding_curve",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "pool",+ "type": "pubkey"+ }+ ]+ }+ },+ {+ "name": "ConfigStatus",+ "type": {+ "kind": "enum",+ "variants": [+ {+ "name": "Paused"+ },+ {+ "name": "Active"+ }+ ]+ }+ },+ {+ "name": "CreateEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "name",+ "type": "string"+ },+ {+ "name": "symbol",+ "type": "string"+ },+ {+ "name": "uri",+ "type": "string"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "bonding_curve",+ "type": "pubkey"+ },+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "creator",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "virtual_token_reserves",+ "type": "u64"+ },+ {+ "name": "virtual_sol_reserves",+ "type": "u64"+ },+ {+ "name": "real_token_reserves",+ "type": "u64"+ },+ {+ "name": "token_total_supply",+ "type": "u64"+ },+ {+ "name": "token_program",+ "type": "pubkey"+ },+ {+ "name": "is_mayhem_mode",+ "type": "bool"+ },+ {+ "name": "is_cashback_enabled",+ "type": "bool"+ },+ {+ "name": "quote_mint",+ "type": "pubkey"+ },+ {+ "name": "virtual_quote_reserves",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "DistributeCreatorFeesEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "bonding_curve",+ "type": "pubkey"+ },+ {+ "name": "sharing_config",+ "type": "pubkey"+ },+ {+ "name": "admin",+ "type": "pubkey"+ },+ {+ "name": "shareholders",+ "type": {+ "vec": {+ "defined": {+ "name": "Shareholder"+ }+ }+ }+ },+ {+ "name": "distributed",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "ExtendAccountEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "account",+ "type": "pubkey"+ },+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "current_size",+ "type": "u64"+ },+ {+ "name": "new_size",+ "type": "u64"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "FeeConfig",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "bump",+ "type": "u8"+ },+ {+ "name": "admin",+ "type": "pubkey"+ },+ {+ "name": "flat_fees",+ "type": {+ "defined": {+ "name": "Fees"+ }+ }+ },+ {+ "name": "fee_tiers",+ "type": {+ "vec": {+ "defined": {+ "name": "FeeTier"+ }+ }+ }+ },+ {+ "name": "stable_fee_tiers",+ "type": {+ "vec": {+ "defined": {+ "name": "FeeTier"+ }+ }+ }+ }+ ]+ }+ },+ {+ "name": "FeeTier",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "market_cap_lamports_threshold",+ "type": "u128"+ },+ {+ "name": "fees",+ "type": {+ "defined": {+ "name": "Fees"+ }+ }+ }+ ]+ }+ },+ {+ "name": "Fees",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "lp_fee_bps",+ "type": "u64"+ },+ {+ "name": "protocol_fee_bps",+ "type": "u64"+ },+ {+ "name": "creator_fee_bps",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "Global",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "initialized",+ "docs": [+ "Unused"+ ],+ "type": "bool"+ },+ {+ "name": "authority",+ "type": "pubkey"+ },+ {+ "name": "fee_recipient",+ "type": "pubkey"+ },+ {+ "name": "initial_virtual_token_reserves",+ "type": "u64"+ },+ {+ "name": "initial_virtual_sol_reserves",+ "type": "u64"+ },+ {+ "name": "initial_real_token_reserves",+ "type": "u64"+ },+ {+ "name": "token_total_supply",+ "type": "u64"+ },+ {+ "name": "fee_basis_points",+ "type": "u64"+ },+ {+ "name": "withdraw_authority",+ "type": "pubkey"+ },+ {+ "name": "enable_migrate",+ "docs": [+ "Unused"+ ],+ "type": "bool"+ },+ {+ "name": "pool_migration_fee",+ "type": "u64"+ },+ {+ "name": "creator_fee_basis_points",+ "type": "u64"+ },+ {+ "name": "fee_recipients",+ "type": {+ "array": [+ "pubkey",+ 7+ ]+ }+ },+ {+ "name": "set_creator_authority",+ "type": "pubkey"+ },+ {+ "name": "admin_set_creator_authority",+ "type": "pubkey"+ },+ {+ "name": "create_v2_enabled",+ "type": "bool"+ },+ {+ "name": "whitelist_pda",+ "type": "pubkey"+ },+ {+ "name": "reserved_fee_recipient",+ "type": "pubkey"+ },+ {+ "name": "mayhem_mode_enabled",+ "type": "bool"+ },+ {+ "name": "reserved_fee_recipients",+ "type": {+ "array": [+ "pubkey",+ 7+ ]+ }+ },+ {+ "name": "is_cashback_enabled",+ "type": "bool"+ },+ {+ "name": "buyback_fee_recipients",+ "type": {+ "array": [+ "pubkey",+ 8+ ]+ }+ },+ {+ "name": "buyback_basis_points",+ "type": "u64"+ },+ {+ "name": "initial_virtual_quote_reserves",+ "type": "u64"+ },+ {+ "name": "whitelisted_quote_mints",+ "type": {+ "array": [+ "pubkey",+ 1+ ]+ }+ }+ ]+ }+ },+ {+ "name": "GlobalVolumeAccumulator",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "start_time",+ "type": "i64"+ },+ {+ "name": "end_time",+ "type": "i64"+ },+ {+ "name": "seconds_in_a_day",+ "type": "i64"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "total_token_supply",+ "type": {+ "array": [+ "u64",+ 30+ ]+ }+ },+ {+ "name": "sol_volumes",+ "type": {+ "array": [+ "u64",+ 30+ ]+ }+ }+ ]+ }+ },+ {+ "name": "InitUserVolumeAccumulatorEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "payer",+ "type": "pubkey"+ },+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "MigrateBondingCurveCreatorEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "bonding_curve",+ "type": "pubkey"+ },+ {+ "name": "sharing_config",+ "type": "pubkey"+ },+ {+ "name": "old_creator",+ "type": "pubkey"+ },+ {+ "name": "new_creator",+ "type": "pubkey"+ }+ ]+ }+ },+ {+ "name": "MinimumDistributableFeeEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "minimum_required",+ "type": "u64"+ },+ {+ "name": "distributable_fees",+ "type": "u64"+ },+ {+ "name": "can_distribute",+ "type": "bool"+ }+ ]+ }+ },+ {+ "name": "OptionBool",+ "type": {+ "kind": "struct",+ "fields": [+ "bool"+ ]+ }+ },+ {+ "name": "ReservedFeeRecipientsEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "reserved_fee_recipient",+ "type": "pubkey"+ },+ {+ "name": "reserved_fee_recipients",+ "type": {+ "array": [+ "pubkey",+ 7+ ]+ }+ }+ ]+ }+ },+ {+ "name": "SetCreatorEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "bonding_curve",+ "type": "pubkey"+ },+ {+ "name": "creator",+ "type": "pubkey"+ }+ ]+ }+ },+ {+ "name": "SetMetaplexCreatorEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "bonding_curve",+ "type": "pubkey"+ },+ {+ "name": "metadata",+ "type": "pubkey"+ },+ {+ "name": "creator",+ "type": "pubkey"+ }+ ]+ }+ },+ {+ "name": "SetParamsEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "initial_virtual_token_reserves",+ "type": "u64"+ },+ {+ "name": "initial_virtual_sol_reserves",+ "type": "u64"+ },+ {+ "name": "initial_real_token_reserves",+ "type": "u64"+ },+ {+ "name": "final_real_sol_reserves",+ "type": "u64"+ },+ {+ "name": "token_total_supply",+ "type": "u64"+ },+ {+ "name": "fee_basis_points",+ "type": "u64"+ },+ {+ "name": "withdraw_authority",+ "type": "pubkey"+ },+ {+ "name": "enable_migrate",+ "type": "bool"+ },+ {+ "name": "pool_migration_fee",+ "type": "u64"+ },+ {+ "name": "creator_fee_basis_points",+ "type": "u64"+ },+ {+ "name": "fee_recipients",+ "type": {+ "array": [+ "pubkey",+ 8+ ]+ }+ },+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "set_creator_authority",+ "type": "pubkey"+ },+ {+ "name": "admin_set_creator_authority",+ "type": "pubkey"+ }+ ]+ }+ },+ {+ "name": "Shareholder",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "address",+ "type": "pubkey"+ },+ {+ "name": "share_bps",+ "type": "u16"+ }+ ]+ }+ },+ {+ "name": "SharingConfig",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "bump",+ "type": "u8"+ },+ {+ "name": "version",+ "type": "u8"+ },+ {+ "name": "status",+ "type": {+ "defined": {+ "name": "ConfigStatus"+ }+ }+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "admin",+ "type": "pubkey"+ },+ {+ "name": "admin_revoked",+ "type": "bool"+ },+ {+ "name": "shareholders",+ "type": {+ "vec": {+ "defined": {+ "name": "Shareholder"+ }+ }+ }+ }+ ]+ }+ },+ {+ "name": "SyncUserVolumeAccumulatorEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "total_claimed_tokens_before",+ "type": "u64"+ },+ {+ "name": "total_claimed_tokens_after",+ "type": "u64"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "TradeEvent",+ "docs": [+ "ix_name: \"buy\" | \"sell\" | \"buy_exact_sol_in\""+ ],+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "sol_amount",+ "type": "u64"+ },+ {+ "name": "token_amount",+ "type": "u64"+ },+ {+ "name": "is_buy",+ "type": "bool"+ },+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "virtual_sol_reserves",+ "type": "u64"+ },+ {+ "name": "virtual_token_reserves",+ "type": "u64"+ },+ {+ "name": "real_sol_reserves",+ "type": "u64"+ },+ {+ "name": "real_token_reserves",+ "type": "u64"+ },+ {+ "name": "fee_recipient",+ "type": "pubkey"+ },+ {+ "name": "fee_basis_points",+ "type": "u64"+ },+ {+ "name": "fee",+ "type": "u64"+ },+ {+ "name": "creator",+ "type": "pubkey"+ },+ {+ "name": "creator_fee_basis_points",+ "type": "u64"+ },+ {+ "name": "creator_fee",+ "type": "u64"+ },+ {+ "name": "track_volume",+ "type": "bool"+ },+ {+ "name": "total_unclaimed_tokens",+ "type": "u64"+ },+ {+ "name": "total_claimed_tokens",+ "type": "u64"+ },+ {+ "name": "current_sol_volume",+ "type": "u64"+ },+ {+ "name": "last_update_timestamp",+ "type": "i64"+ },+ {+ "name": "ix_name",+ "type": "string"+ },+ {+ "name": "mayhem_mode",+ "type": "bool"+ },+ {+ "name": "cashback_fee_basis_points",+ "type": "u64"+ },+ {+ "name": "cashback",+ "type": "u64"+ },+ {+ "name": "buyback_fee_basis_points",+ "type": "u64"+ },+ {+ "name": "buyback_fee",+ "type": "u64"+ },+ {+ "name": "shareholders",+ "type": {+ "vec": {+ "defined": {+ "name": "Shareholder"+ }+ }+ }+ },+ {+ "name": "quote_mint",+ "type": "pubkey"+ },+ {+ "name": "quote_amount",+ "type": "u64"+ },+ {+ "name": "virtual_quote_reserves",+ "type": "u64"+ },+ {+ "name": "real_quote_reserves",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "UpdateGlobalAuthorityEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "global",+ "type": "pubkey"+ },+ {+ "name": "authority",+ "type": "pubkey"+ },+ {+ "name": "new_authority",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "UpdateMayhemVirtualParamsEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "virtual_token_reserves",+ "type": "u64"+ },+ {+ "name": "virtual_sol_reserves",+ "type": "u64"+ },+ {+ "name": "new_virtual_token_reserves",+ "type": "u64"+ },+ {+ "name": "new_virtual_sol_reserves",+ "type": "u64"+ },+ {+ "name": "real_token_reserves",+ "type": "u64"+ },+ {+ "name": "real_sol_reserves",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "UserVolumeAccumulator",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "needs_claim",+ "type": "bool"+ },+ {+ "name": "total_unclaimed_tokens",+ "type": "u64"+ },+ {+ "name": "total_claimed_tokens",+ "type": "u64"+ },+ {+ "name": "current_sol_volume",+ "type": "u64"+ },+ {+ "name": "last_update_timestamp",+ "type": "i64"+ },+ {+ "name": "has_total_claimed_tokens",+ "type": "bool"+ },+ {+ "name": "cashback_earned",+ "type": "u64"+ },+ {+ "name": "total_cashback_claimed",+ "type": "u64"+ }+ ]+ }+ }+ ]+}\ No newline at end of filediff --git a/agent-payments-sdk/src/idl/pump_agent_payments.json b/agent-payments-sdk/src/solana/idl/pump_agent_payments.jsonsimilarity index 100%rename from agent-payments-sdk/src/idl/pump_agent_payments.jsonrename to agent-payments-sdk/src/solana/idl/pump_agent_payments.jsondiff --git a/agent-payments-sdk/src/idl/pump_agent_payments.ts b/agent-payments-sdk/src/solana/idl/pump_agent_payments.tssimilarity index 99%rename from agent-payments-sdk/src/idl/pump_agent_payments.tsrename to agent-payments-sdk/src/solana/idl/pump_agent_payments.tsindex 1fcca0cbb..861c4ffa7 100644--- a/agent-payments-sdk/src/idl/pump_agent_payments.ts+++ b/agent-payments-sdk/src/solana/idl/pump_agent_payments.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+/*** Program IDL in camelCase format in order to be used in JS/TS.*diff --git a/agent-payments-sdk/src/solana/index.ts b/agent-payments-sdk/src/solana/index.tsnew file mode 100644index 000000000..bbbe98552--- /dev/null+++ b/agent-payments-sdk/src/solana/index.ts@@ -0,0 +1,159 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * @pump-fun/agent-payments-sdk+ * TypeScript SDK for Pump Agent Payments+ */++// IDL type+export type { PumpAgentPayments } from "./idl/pump_agent_payments";++// Program helpers+export {+ getPumpProgram,+ OFFLINE_PUMP_PROGRAM,+ getPumpProgramWithFallback,+ getOfflineProgram,+} from "./program";++// PDA derivation+export {+ PROGRAM_ID,+ PUMP_PROGRAM_ID,+ GLOBAL_CONFIG_SEED,+ TOKEN_AGENT_PAYMENTS_SEED,+ PAYMENT_IN_CURRENCY_SEED,+ INVOICE_ID_SEED,+ BUYBACK_AUTHORITY_SEED,+ WITHDRAW_AUTHORITY_SEED,+ BONDING_CURVE_SEED,+ TOKEN_AGENT_PAYMENTS_MIN_RENT_EXEMPT_LAMPORTS,+ getGlobalConfigPDA,+ getTokenAgentPaymentsPDA,+ getPaymentInCurrencyPDA,+ getInvoiceIdPDA,+ getBuybackAuthorityPDA,+ getWithdrawAuthorityPDA,+ getBondingCurvePDA,+ PUMP_FEES_PROGRAM_ID,+ SHARING_CONFIG_SEED,+ getSharingConfigPDA,+} from "./pdas";++// Classes+export {+ PumpAgentOffline,+ USDC_MINT,+ decodeBondingCurveQuoteMint,+ resolveTokenProgramForMint,+} from "./PumpAgentOffline";+export { PumpAgent } from "./PumpAgent";++// Error types+export {+ CurrencyNotSupportedError,+ JupiterUnavailableError,+} from "./errors";++// Decoders+export {+ decodeGlobalConfig,+ decodeTokenAgentPaymentInCurrency,+ decodeTokenAgentPayments,+} from "./decoders";++// Types+export type {+ PumpEnvironment,+ VaultBalance,+ AgentBalances,+ CreateParams,+ WithdrawParams,+ UpdateBuybackBpsParams,+ UpdateBuybackBpsOptions,+ AcceptPaymentParams,+ AcceptPaymentSimpleParams,+ BuildAcceptPaymentParams,+ DistributePaymentsParams,+ BuybackTriggerParams,+ ExtendAccountParams,+ UpdateAuthorityParams,+ CloseAccountParams,+ GlobalConfig,+ TokenAgentPaymentInCurrency,+ TokenAgentPayments,+} from "./types";++// Convenience re-export+import { PublicKey, type Connection } from "@solana/web3.js";+import type { Program } from "@coral-xyz/anchor";+import type { PumpAgentPayments } from "./idl/pump_agent_payments";+import IDL from "./idl/pump_agent_payments.json";+import { getPumpProgram } from "./program";++export const PUMP_AGENT_PAYMENTS_PROGRAM_ID = new PublicKey(IDL.address);++export function getProgram(+ connection: Connection,+): Program<PumpAgentPayments> {+ return getPumpProgram(connection);+}++// Events+export {+ createEventParser,+ parseAgentEvents,+ subscribeToAgentEvents,+} from "./events";+export type {+ AgentAcceptPaymentEvent,+ AgentBuybackTriggerEvent,+ AgentDistributePaymentsEvent,+ AgentInitializeEvent,+ AgentUpdateAuthorityEvent,+ AgentUpdateBuybackBpsEvent,+ AgentWithdrawEvent,+ ExtendAccountEvent,+ GlobalAddNewCurrencyEvent,+ GlobalConfigInitializeEvent,+ GlobalUpdateAuthoritiesEvent,+ AgentEventName,+ AgentEventData,+ ParsedAgentEvent,+ EventSubscriptionOptions,+ EventSubscription,+} from "./events";++// solana-agent-kit plugin+export { PumpAgentPaymentsPlugin } from "./solana-agent-kit";++// x402 protocol+export * as x402 from "./x402";++// Pump bonding-curve program (`6EF8rrec...`) event parser & subscriber.+// Distinct from agent-payments events above.+export * as pumpEvents from "./pump-events.js";++// Legacy 1.0.7 program (`pUmPFn9...`) — coexists with the modern 3.0.x+// program above. Use these classes when interacting with coins whose+// tokenized agent was registered via @pump-fun/pump-sdk's+// `isTokenizedAgent: true` flag (which targets the legacy program).+export * as legacyAgentPayments from "./legacy-agent-payments/index.js";++// v2 bonding-curve trade client+export { PumpTradeClient } from "./PumpTradeClient.js";+export type {+ BuyResult,+ SellResult,+ ExactQuoteResult,+ BuyQuote,+ SellQuote,+} from "./types.js";+export {+ CoinGraduatedError,+ CoinNotFoundError,+ InsufficientLiquidityError,+ UnsupportedQuoteMintError,+} from "./PumpTradeClient.js";diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/PumpAgent.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/PumpAgent.tsnew file mode 100644index 000000000..711f3f5e9--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/PumpAgent.ts@@ -0,0 +1,101 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { getAssociatedTokenAddressSync } from "@solana/spl-token";+import {+ PublicKey,+ type Connection,+ type TransactionInstruction,+} from "@solana/web3.js";+import {+ getBuybackAuthorityPDA,+ getGlobalConfigPDA,+ getTokenAgentPaymentsPDA,+ getWithdrawAuthorityPDA,+} from "./pdas.js";+import { LegacyPumpAgentOffline } from "./PumpAgentOffline.js";+import { getLegacyPumpProgramWithFallback } from "./program.js";+import type {+ LegacyAgentBalances,+ LegacyUpdateBuybackBpsOptions,+ LegacyUpdateBuybackBpsParams,+} from "./types.js";++/**+ * Connection-bound client for the legacy 1.0.7 program. Adds methods that+ * need RPC: balance fetches, automatic supported-currencies discovery for+ * `updateBuybackBps`. Inherits all instruction-only methods from+ * `LegacyPumpAgentOffline`.+ */+export class LegacyPumpAgent extends LegacyPumpAgentOffline {+ readonly connection: Connection;++ constructor(mint: PublicKey, connection: Connection) {+ super(mint, getLegacyPumpProgramWithFallback(connection));+ this.connection = connection;+ }++ async getBalances(currencyMint: PublicKey): Promise<LegacyAgentBalances> {+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(this.mint);+ const [buybackAuthority] = getBuybackAuthorityPDA(this.mint);+ const [withdrawAuthority] = getWithdrawAuthorityPDA(this.mint);++ const paymentAta = getAssociatedTokenAddressSync(+ currencyMint,+ tokenAgentPayments,+ true,+ );+ const buybackAta = getAssociatedTokenAddressSync(+ currencyMint,+ buybackAuthority,+ true,+ );+ const withdrawAta = getAssociatedTokenAddressSync(+ currencyMint,+ withdrawAuthority,+ true,+ );++ const fetchBalance = async (ata: PublicKey): Promise<bigint> => {+ try {+ const res = await this.connection.getTokenAccountBalance(ata);+ return BigInt(res.value.amount);+ } catch {+ return 0n;+ }+ };++ const [paymentBal, buybackBal, withdrawBal] = await Promise.all([+ fetchBalance(paymentAta),+ fetchBalance(buybackAta),+ fetchBalance(withdrawAta),+ ]);++ return {+ paymentVault: { address: paymentAta, balance: paymentBal },+ buybackVault: { address: buybackAta, balance: buybackBal },+ withdrawVault: { address: withdrawAta, balance: withdrawBal },+ };+ }++ /**+ * Override of `LegacyPumpAgentOffline.updateBuybackBps` that auto-fetches+ * the supported currencies list from the on-chain `globalConfig` when not+ * provided. Mirrors the 1.0.7 SDK's connection-bound behavior.+ */+ override async updateBuybackBps(+ params: LegacyUpdateBuybackBpsParams,+ options?: LegacyUpdateBuybackBpsOptions,+ ): Promise<TransactionInstruction> {+ let supportedCurrenciesMint = options?.supportedCurrenciesMint;+ if (!supportedCurrenciesMint) {+ const [globalConfigPda] = getGlobalConfigPDA();+ const account = await (this.program as unknown as {+ account: { globalConfig: { fetch: (k: PublicKey) => Promise<{ supportedCurrenciesMint: PublicKey[] }> } };+ }).account.globalConfig.fetch(globalConfigPda);+ supportedCurrenciesMint = account.supportedCurrenciesMint;+ }+ return super.updateBuybackBps(params, { supportedCurrenciesMint });+ }+}diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/PumpAgentOffline.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/PumpAgentOffline.tsnew file mode 100644index 000000000..018e6e352--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/PumpAgentOffline.ts@@ -0,0 +1,321 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { BN, Program } from "@coral-xyz/anchor";+import {+ getAssociatedTokenAddressSync,+ TOKEN_PROGRAM_ID,+} from "@solana/spl-token";+import {+ PublicKey,+ type Connection,+ type TransactionInstruction,+} from "@solana/web3.js";+import {+ getBuybackAuthorityPDA,+ getGlobalConfigPDA,+ getInvoiceIdPDA,+ getPaymentInCurrencyPDA,+ getTokenAgentPaymentsPDA,+ getWithdrawAuthorityPDA,+ getBondingCurvePDA,+} from "./pdas.js";+import {+ getLegacyPumpProgramWithFallback,+} from "./program.js";+import type { LegacyPumpAgentPayments } from "./idl.js";+import type {+ LegacyAcceptPaymentParams,+ LegacyAcceptPaymentSimpleParams,+ LegacyBuybackTriggerParams,+ LegacyCreateParams,+ LegacyDistributePaymentsParams,+ LegacyExtendAccountParams,+ LegacyUpdateAuthorityParams,+ LegacyUpdateBuybackBpsOptions,+ LegacyUpdateBuybackBpsParams,+ LegacyWithdrawParams,+} from "./types.js";++const toBn = (v: number | bigint | BN): BN =>+ BN.isBN(v as BN) ? (v as BN) : new BN(v.toString());++/**+ * Offline-capable client for the legacy 1.0.7 `pump_agent_payments` program+ * (`pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4`). All methods return raw+ * `TransactionInstruction`s — the caller is responsible for transaction+ * assembly and signing. Mirrors the surface of the original npm package+ * exactly so coins registered via @pump-fun/pump-sdk's+ * `isTokenizedAgent: true` path remain operable.+ */+export class LegacyPumpAgentOffline {+ readonly mint: PublicKey;+ protected readonly program: Program<LegacyPumpAgentPayments>;++ constructor(mint: PublicKey, program?: Program<LegacyPumpAgentPayments>) {+ this.mint = mint;+ this.program = program ?? getLegacyPumpProgramWithFallback();+ }++ static load(+ mint: PublicKey,+ connection?: Connection,+ ): LegacyPumpAgentOffline {+ return new LegacyPumpAgentOffline(+ mint,+ getLegacyPumpProgramWithFallback(connection),+ );+ }++ async create(params: LegacyCreateParams): Promise<TransactionInstruction> {+ const { authority, mint, agentAuthority, buybackBps } = params;+ const [bondingCurve] = getBondingCurvePDA(mint);+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(mint);++ return this.program.methods+ .agentInitialize(agentAuthority, buybackBps)+ .accountsPartial({+ authority,+ bondingCurve,+ mint,+ tokenAgentPayments,+ })+ .instruction();+ }++ async withdraw(params: LegacyWithdrawParams): Promise<TransactionInstruction> {+ const { authority, currencyMint, receiverAta, tokenProgram } = params;+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(this.mint);+ const [withdrawAuthority] = getWithdrawAuthorityPDA(this.mint);+ const withdrawVault = getAssociatedTokenAddressSync(+ currencyMint,+ withdrawAuthority,+ true,+ );++ return this.program.methods+ .agentWithdraw()+ .accountsPartial({+ authority,+ tokenAgentPayments,+ currencyMint,+ withdrawAuthority,+ withdrawVault,+ receiverAta,+ tokenProgram: tokenProgram ?? TOKEN_PROGRAM_ID,+ })+ .instruction();+ }++ /**+ * `agent_update_buyback_bps` — when the global config has supported+ * currencies, each currency's payment-vault ATA must be passed as a+ * remaining account. The 1.0.7 SDK fetched `globalConfig` from chain when+ * called via the connection-bound `LegacyPumpAgent`; for the offline+ * flow you must supply `supportedCurrenciesMint` yourself.+ */+ async updateBuybackBps(+ params: LegacyUpdateBuybackBpsParams,+ options?: LegacyUpdateBuybackBpsOptions,+ ): Promise<TransactionInstruction> {+ const { authority, buybackBps } = params;+ const supportedCurrenciesMint = options?.supportedCurrenciesMint;+ if (!supportedCurrenciesMint) {+ throw new Error(+ "LegacyPumpAgentOffline.updateBuybackBps requires options.supportedCurrenciesMint.",+ );+ }+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(this.mint);+ const [globalConfig] = getGlobalConfigPDA();++ const remainingAccounts = supportedCurrenciesMint+ .filter((m) => !m.equals(PublicKey.default))+ .map((mint) => ({+ pubkey: getAssociatedTokenAddressSync(mint, tokenAgentPayments, true),+ isWritable: false,+ isSigner: false,+ }));++ return this.program.methods+ .agentUpdateBuybackBps(buybackBps)+ .accountsPartial({+ authority,+ tokenAgentPayments,+ globalConfig,+ })+ .remainingAccounts(remainingAccounts)+ .instruction();+ }++ async acceptPayment(+ params: LegacyAcceptPaymentParams,+ ): Promise<TransactionInstruction> {+ const {+ user,+ userTokenAccount,+ currencyMint,+ amount,+ memo,+ startTime,+ endTime,+ tokenProgram,+ } = params;+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(this.mint);+ const [globalConfig] = getGlobalConfigPDA();+ const [tokenAgentPaymentInCurrency] = getPaymentInCurrencyPDA(+ this.mint,+ currencyMint,+ );+ const [invoiceId] = getInvoiceIdPDA(+ this.mint,+ currencyMint,+ amount,+ memo,+ startTime,+ endTime,+ );+ const tokenAgentAssociatedAccount = getAssociatedTokenAddressSync(+ currencyMint,+ tokenAgentPayments,+ true,+ );++ return this.program.methods+ .agentAcceptPayment(amount, memo, startTime, endTime)+ .accountsPartial({+ user,+ userTokenAccount,+ tokenAgentPayments,+ tokenAgentAssociatedAccount,+ tokenAgentPaymentInCurrency,+ globalConfig,+ invoiceId,+ currencyMint,+ tokenProgram: tokenProgram ?? TOKEN_PROGRAM_ID,+ })+ .instruction();+ }++ async acceptPaymentSimple(+ params: LegacyAcceptPaymentSimpleParams,+ ): Promise<TransactionInstruction> {+ const { amount, memo, startTime, endTime, ...rest } = params;+ return this.acceptPayment({+ ...rest,+ amount: toBn(amount),+ memo: toBn(memo),+ startTime: toBn(startTime),+ endTime: toBn(endTime),+ });+ }++ async distributePayments(+ params: LegacyDistributePaymentsParams,+ ): Promise<TransactionInstruction> {+ const { user, currencyMint, tokenProgram } = params;+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(this.mint);+ const [globalConfig] = getGlobalConfigPDA();+ const [tokenAgentPaymentInCurrency] = getPaymentInCurrencyPDA(+ this.mint,+ currencyMint,+ );+ const [buybackAuthority] = getBuybackAuthorityPDA(this.mint);+ const [withdrawAuthority] = getWithdrawAuthorityPDA(this.mint);+ const tokenAgentAssociatedAccount = getAssociatedTokenAddressSync(+ currencyMint,+ tokenAgentPayments,+ true,+ );+ const buybackVault = getAssociatedTokenAddressSync(+ currencyMint,+ buybackAuthority,+ true,+ );+ const withdrawVault = getAssociatedTokenAddressSync(+ currencyMint,+ withdrawAuthority,+ true,+ );++ return this.program.methods+ .agentDistributePayments()+ .accountsPartial({+ user,+ globalConfig,+ currencyMint,+ tokenAgentPayments,+ tokenAgentPaymentInCurrency,+ tokenAgentAssociatedAccount,+ buybackAuthority,+ withdrawAuthority,+ buybackVault,+ withdrawVault,+ tokenProgram: tokenProgram ?? TOKEN_PROGRAM_ID,+ })+ .instruction();+ }++ async buybackTrigger(+ params: LegacyBuybackTriggerParams,+ ): Promise<TransactionInstruction> {+ const {+ globalBuybackAuthority,+ currencyMint,+ swapProgramToInvoke,+ swapInstructionData,+ remainingAccounts,+ tokenProgram,+ } = params;+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(this.mint);+ const [globalConfig] = getGlobalConfigPDA();+ const [burnAuthority] = getBuybackAuthorityPDA(this.mint);+ const [tokenAgentPaymentInCurrency] = getPaymentInCurrencyPDA(+ this.mint,+ currencyMint,+ );+ const burnMintVault = getAssociatedTokenAddressSync(+ this.mint,+ burnAuthority,+ true,+ );++ return this.program.methods+ .agentBuybackTrigger(swapInstructionData)+ .accountsPartial({+ globalBuybackAuthority,+ mint: this.mint,+ tokenAgentPayments,+ tokenAgentPaymentInCurrency,+ currencyMint,+ globalConfig,+ swapProgramToInvoke,+ burnAuthority,+ burnMintVault,+ tokenProgram: tokenProgram ?? TOKEN_PROGRAM_ID,+ })+ .remainingAccounts(remainingAccounts)+ .instruction();+ }++ async extendAccount(+ params: LegacyExtendAccountParams,+ ): Promise<TransactionInstruction> {+ const { account, user } = params;+ return this.program.methods+ .extendAccount()+ .accountsPartial({ account, user })+ .instruction();+ }++ async updateAuthority(+ params: LegacyUpdateAuthorityParams,+ ): Promise<TransactionInstruction> {+ const { authority, newAuthority } = params;+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(this.mint);+ return this.program.methods+ .agentUpdateAuthority(newAuthority)+ .accountsPartial({ authority, tokenAgentPayments })+ .instruction();+ }+}diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/PumpAgentOffline.test.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/PumpAgentOffline.test.tsnew file mode 100644index 000000000..d657181c9--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/PumpAgentOffline.test.ts@@ -0,0 +1,302 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { describe, expect, it } from "vitest";+import { BN } from "@coral-xyz/anchor";+import { PublicKey, SystemProgram } from "@solana/web3.js";+import {+ TOKEN_PROGRAM_ID,+ TOKEN_2022_PROGRAM_ID,+} from "@solana/spl-token";++import { LegacyPumpAgentOffline } from "../PumpAgentOffline.js";+import {+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ getBondingCurvePDA,+ getBuybackAuthorityPDA,+ getGlobalConfigPDA,+ getInvoiceIdPDA,+ getPaymentInCurrencyPDA,+ getTokenAgentPaymentsPDA,+ getWithdrawAuthorityPDA,+} from "../pdas.js";+import idlJson from "../idl.json" with { type: "json" };++interface IdlInstructionAccount {+ name: string;+ writable?: boolean;+ signer?: boolean;+}+interface IdlInstruction {+ name: string;+ discriminator: number[];+ accounts: IdlInstructionAccount[];+}+const IDL_INSTRUCTIONS = (idlJson as { instructions: IdlInstruction[] })+ .instructions;+const idlIxByName = (name: string): IdlInstruction => {+ const ix = IDL_INSTRUCTIONS.find((i) => i.name === name);+ if (!ix) throw new Error(`IDL is missing instruction ${name}`);+ return ix;+};++// Deterministic test inputs.+const MINT = new PublicKey("11111111111111111111111111111112");+const AUTHORITY = new PublicKey("11111111111111111111111111111113");+const NEW_AUTHORITY = new PublicKey("11111111111111111111111111111114");+const AGENT_AUTHORITY = new PublicKey("11111111111111111111111111111115");+const USER = new PublicKey("11111111111111111111111111111116");+const USER_TOKEN_ACCOUNT = new PublicKey(+ "11111111111111111111111111111117",+);+const RECEIVER_ATA = new PublicKey("11111111111111111111111111111118");+const CURRENCY_MINT = new PublicKey(+ "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",+);+const GLOBAL_BUYBACK_AUTHORITY = new PublicKey(+ "11111111111111111111111111111119",+);+const SWAP_PROGRAM = new PublicKey("1nc1nerator11111111111111111111111111111111");+const ACCOUNT_FOR_EXTEND = new PublicKey(+ "1111111111111111111111111111111A",+);++const agent = new LegacyPumpAgentOffline(MINT);++/** Match (length + writable/signer flags) of `keys` against IDL declaration. */+function expectIdlAccountFlagsMatch(+ ixName: string,+ keys: { isWritable: boolean; isSigner: boolean }[],+) {+ const idl = idlIxByName(ixName);+ expect(keys).toHaveLength(idl.accounts.length);+ idl.accounts.forEach((a, i) => {+ expect(+ keys[i].isWritable,+ `${ixName} account[${i}] (${a.name}).isWritable`,+ ).toBe(!!a.writable);+ expect(+ keys[i].isSigner,+ `${ixName} account[${i}] (${a.name}).isSigner`,+ ).toBe(!!a.signer);+ });+}++function expectDiscriminator(data: Buffer, ixName: string) {+ const idl = idlIxByName(ixName);+ const disc = Buffer.from(idl.discriminator);+ expect(data.slice(0, 8).equals(disc)).toBe(true);+}++describe("LegacyPumpAgentOffline / programId & discriminators & flags", () => {+ it("create -> agentInitialize", async () => {+ const ix = await agent.create({+ authority: AUTHORITY,+ mint: MINT,+ agentAuthority: AGENT_AUTHORITY,+ buybackBps: 1000,+ });+ expect(ix.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(true);+ expectDiscriminator(ix.data, "agentInitialize");+ expectIdlAccountFlagsMatch("agentInitialize", ix.keys);+ // Check bondingCurve & tokenAgentPayments derivations match IDL seeds.+ const [bondingCurve] = getBondingCurvePDA(MINT);+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(MINT);+ expect(ix.keys[1].pubkey.equals(bondingCurve)).toBe(true);+ expect(ix.keys[4].pubkey.equals(tokenAgentPayments)).toBe(true);+ expect(ix.keys[3].pubkey.equals(MINT)).toBe(true);+ });++ it("withdraw -> agentWithdraw", async () => {+ const ix = await agent.withdraw({+ authority: AUTHORITY,+ currencyMint: CURRENCY_MINT,+ receiverAta: RECEIVER_ATA,+ });+ expect(ix.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(true);+ expectDiscriminator(ix.data, "agentWithdraw");+ expectIdlAccountFlagsMatch("agentWithdraw", ix.keys);+ // tokenProgram default+ const tokenProgramAcct = ix.keys[6];+ expect(tokenProgramAcct.pubkey.equals(TOKEN_PROGRAM_ID)).toBe(true);+ });++ it("withdraw with custom tokenProgram is forwarded", async () => {+ const ix = await agent.withdraw({+ authority: AUTHORITY,+ currencyMint: CURRENCY_MINT,+ receiverAta: RECEIVER_ATA,+ tokenProgram: TOKEN_2022_PROGRAM_ID,+ });+ const tokenProgramAcct = ix.keys[6];+ expect(tokenProgramAcct.pubkey.equals(TOKEN_2022_PROGRAM_ID)).toBe(true);+ });++ it("acceptPayment -> agentAcceptPayment", async () => {+ const ix = await agent.acceptPayment({+ user: USER,+ userTokenAccount: USER_TOKEN_ACCOUNT,+ currencyMint: CURRENCY_MINT,+ amount: new BN(100),+ memo: new BN(200),+ startTime: new BN(0),+ endTime: new BN(9999),+ });+ expect(ix.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(true);+ expectDiscriminator(ix.data, "agentAcceptPayment");+ expectIdlAccountFlagsMatch("agentAcceptPayment", ix.keys);+ const [tokenAgentPayments] = getTokenAgentPaymentsPDA(MINT);+ const [paymentInCurrency] = getPaymentInCurrencyPDA(MINT, CURRENCY_MINT);+ const [globalConfig] = getGlobalConfigPDA();+ const [invoiceId] = getInvoiceIdPDA(+ MINT,+ CURRENCY_MINT,+ new BN(100),+ new BN(200),+ new BN(0),+ new BN(9999),+ );+ expect(ix.keys[2].pubkey.equals(tokenAgentPayments)).toBe(true);+ expect(ix.keys[4].pubkey.equals(paymentInCurrency)).toBe(true);+ expect(ix.keys[5].pubkey.equals(globalConfig)).toBe(true);+ expect(ix.keys[6].pubkey.equals(invoiceId)).toBe(true);+ expect(ix.keys[7].pubkey.equals(CURRENCY_MINT)).toBe(true);+ });++ it("acceptPaymentSimple BN coercion: number, bigint, BN produce identical data", async () => {+ const base = {+ user: USER,+ userTokenAccount: USER_TOKEN_ACCOUNT,+ currencyMint: CURRENCY_MINT,+ };+ const ixNumber = await agent.acceptPaymentSimple({+ ...base,+ amount: 100,+ memo: 200,+ startTime: 0,+ endTime: 9999,+ });+ const ixBigint = await agent.acceptPaymentSimple({+ ...base,+ amount: 100n,+ memo: 200n,+ startTime: 0n,+ endTime: 9999n,+ });+ const ixBN = await agent.acceptPayment({+ ...base,+ amount: new BN(100),+ memo: new BN(200),+ startTime: new BN(0),+ endTime: new BN(9999),+ });+ expect(ixNumber.data.equals(ixBigint.data)).toBe(true);+ expect(ixNumber.data.equals(ixBN.data)).toBe(true);+ // Also account ordering identical.+ expect(ixNumber.keys.length).toBe(ixBN.keys.length);+ for (let i = 0; i < ixNumber.keys.length; i++) {+ expect(ixNumber.keys[i].pubkey.toBase58()).toBe(+ ixBN.keys[i].pubkey.toBase58(),+ );+ }+ });++ it("distributePayments -> agentDistributePayments", async () => {+ const ix = await agent.distributePayments({+ user: USER,+ currencyMint: CURRENCY_MINT,+ });+ expect(ix.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(true);+ expectDiscriminator(ix.data, "agentDistributePayments");+ expectIdlAccountFlagsMatch("agentDistributePayments", ix.keys);+ const [buybackAuthority] = getBuybackAuthorityPDA(MINT);+ const [withdrawAuthority] = getWithdrawAuthorityPDA(MINT);+ expect(ix.keys[6].pubkey.equals(buybackAuthority)).toBe(true);+ expect(ix.keys[7].pubkey.equals(withdrawAuthority)).toBe(true);+ });++ it("buybackTrigger -> agentBuybackTrigger (with remaining accounts)", async () => {+ const remaining = [+ {+ pubkey: SystemProgram.programId,+ isWritable: false,+ isSigner: false,+ },+ ];+ const ix = await agent.buybackTrigger({+ globalBuybackAuthority: GLOBAL_BUYBACK_AUTHORITY,+ currencyMint: CURRENCY_MINT,+ swapProgramToInvoke: SWAP_PROGRAM,+ swapInstructionData: Buffer.from([1, 2, 3, 4]),+ remainingAccounts: remaining,+ });+ expect(ix.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(true);+ expectDiscriminator(ix.data, "agentBuybackTrigger");+ // Remaining accounts are appended after fixed accounts.+ const idl = idlIxByName("agentBuybackTrigger");+ expect(ix.keys.length).toBe(idl.accounts.length + 1);+ // Check the fixed prefix matches IDL flags.+ idl.accounts.forEach((a, i) => {+ expect(ix.keys[i].isWritable).toBe(!!a.writable);+ expect(ix.keys[i].isSigner).toBe(!!a.signer);+ });+ // Remaining account at the end.+ expect(+ ix.keys[ix.keys.length - 1].pubkey.equals(SystemProgram.programId),+ ).toBe(true);+ });++ it("extendAccount -> extendAccount", async () => {+ const ix = await agent.extendAccount({+ account: ACCOUNT_FOR_EXTEND,+ user: USER,+ });+ expect(ix.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(true);+ expectDiscriminator(ix.data, "extendAccount");+ expectIdlAccountFlagsMatch("extendAccount", ix.keys);+ expect(ix.keys[0].pubkey.equals(ACCOUNT_FOR_EXTEND)).toBe(true);+ expect(ix.keys[1].pubkey.equals(USER)).toBe(true);+ });++ it("updateAuthority -> agentUpdateAuthority", async () => {+ const ix = await agent.updateAuthority({+ authority: AUTHORITY,+ newAuthority: NEW_AUTHORITY,+ });+ expect(ix.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(true);+ expectDiscriminator(ix.data, "agentUpdateAuthority");+ expectIdlAccountFlagsMatch("agentUpdateAuthority", ix.keys);+ });++ it("updateBuybackBps -> agentUpdateBuybackBps (with explicit supportedCurrenciesMint)", async () => {+ const ix = await agent.updateBuybackBps(+ { authority: AUTHORITY, buybackBps: 5000 },+ { supportedCurrenciesMint: [CURRENCY_MINT, PublicKey.default] },+ );+ expect(ix.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(true);+ expectDiscriminator(ix.data, "agentUpdateBuybackBps");+ const idl = idlIxByName("agentUpdateBuybackBps");+ // Fixed accounts + 1 non-default supported currency remaining account.+ expect(ix.keys.length).toBe(idl.accounts.length + 1);+ // The fixed accounts portion still respects IDL flags.+ idl.accounts.forEach((a, i) => {+ expect(ix.keys[i].isWritable).toBe(!!a.writable);+ expect(ix.keys[i].isSigner).toBe(!!a.signer);+ });+ });++ it("updateBuybackBps offline rejects without supportedCurrenciesMint", async () => {+ await expect(+ agent.updateBuybackBps({ authority: AUTHORITY, buybackBps: 5000 }),+ ).rejects.toThrow(/supportedCurrenciesMint/);+ });+});++describe("LegacyPumpAgentOffline / static load", () => {+ it("load() returns an instance with correct mint", () => {+ const a = LegacyPumpAgentOffline.load(MINT);+ expect(a).toBeInstanceOf(LegacyPumpAgentOffline);+ expect(a.mint.equals(MINT)).toBe(true);+ });+});diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/cross-version.test.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/cross-version.test.tsnew file mode 100644index 000000000..244dd0254--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/cross-version.test.ts@@ -0,0 +1,123 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { describe, expect, it } from "vitest";+import { PublicKey } from "@solana/web3.js";++import {+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ getTokenAgentPaymentsPDA as legacyTokenAgentPaymentsPDA,+} from "../pdas.js";+import { LegacyPumpAgentOffline } from "../PumpAgentOffline.js";+import legacyIdl from "../idl.json" with { type: "json" };++import {+ PROGRAM_ID,+ getTokenAgentPaymentsPDA as modernTokenAgentPaymentsPDA,+} from "../../pdas.js";+import { PumpAgentOffline } from "../../PumpAgentOffline.js";+import modernIdl from "../../idl/pump_agent_payments.json" with {+ type: "json",+};++const MINT = new PublicKey("11111111111111111111111111111112");+const AUTHORITY = new PublicKey("11111111111111111111111111111113");+const AGENT_AUTHORITY = new PublicKey("11111111111111111111111111111114");++interface IdlIx {+ name: string;+ discriminator: number[];+}++describe("cross-version disjointness (1.0.7 legacy vs 3.0.x modern)", () => {+ it("program IDs differ", () => {+ expect(LEGACY_AGENT_PAYMENTS_PROGRAM_ID.equals(PROGRAM_ID)).toBe(false);+ expect(LEGACY_AGENT_PAYMENTS_PROGRAM_ID.toBase58()).toBe(+ "pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4",+ );+ expect(PROGRAM_ID.toBase58()).toBe(+ "AgenTMiC2hvxGebTsgmsD4HHBa8WEcqGFf87iwRRxLo7",+ );+ });++ it("tokenAgentPayments PDAs differ for the same mint", () => {+ const [legacyPda] = legacyTokenAgentPaymentsPDA(MINT);+ const [modernPda] = modernTokenAgentPaymentsPDA(MINT);+ expect(legacyPda.equals(modernPda)).toBe(false);+ });++ it("create() instructions target different programIds", async () => {+ const legacy = new LegacyPumpAgentOffline(MINT);+ const modern = new PumpAgentOffline(MINT);+ const legacyIx = await legacy.create({+ authority: AUTHORITY,+ mint: MINT,+ agentAuthority: AGENT_AUTHORITY,+ buybackBps: 1000,+ });+ const modernIx = await modern.create({+ authority: AUTHORITY,+ mint: MINT,+ agentAuthority: AGENT_AUTHORITY,+ buybackBps: 1000,+ });+ expect(legacyIx.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(+ true,+ );+ expect(modernIx.programId.equals(PROGRAM_ID)).toBe(true);+ expect(legacyIx.programId.equals(modernIx.programId)).toBe(false);+ });++ it("create() instructions reference the disjoint tokenAgentPayments PDAs", async () => {+ const legacy = new LegacyPumpAgentOffline(MINT);+ const modern = new PumpAgentOffline(MINT);+ const legacyIx = await legacy.create({+ authority: AUTHORITY,+ mint: MINT,+ agentAuthority: AGENT_AUTHORITY,+ buybackBps: 1000,+ });+ const modernIx = await modern.create({+ authority: AUTHORITY,+ mint: MINT,+ agentAuthority: AGENT_AUTHORITY,+ buybackBps: 1000,+ });+ const [legacyTap] = legacyTokenAgentPaymentsPDA(MINT);+ const [modernTap] = modernTokenAgentPaymentsPDA(MINT);+ // tokenAgentPayments is a known account in both IDLs; find it among keys.+ const legacyHasLegacyTap = legacyIx.keys.some((k) =>+ k.pubkey.equals(legacyTap),+ );+ const modernHasModernTap = modernIx.keys.some((k) =>+ k.pubkey.equals(modernTap),+ );+ expect(legacyHasLegacyTap).toBe(true);+ expect(modernHasModernTap).toBe(true);+ // Cross-mismatch: legacy ix should not contain the modern PDA.+ const legacyHasModernTap = legacyIx.keys.some((k) =>+ k.pubkey.equals(modernTap),+ );+ expect(legacyHasModernTap).toBe(false);+ });++ it("IDL addresses (declared programId) are disjoint", () => {+ const legacyAddr = (legacyIdl as { address: string }).address;+ const modernAddr = (modernIdl as { address: string }).address;+ expect(legacyAddr).toBe("pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4");+ expect(modernAddr).not.toBe(legacyAddr);+ });++ it("IDL instruction sets are not identical (modern has extra ix names)", () => {+ const legacyNames = (+ legacyIdl as { instructions: IdlIx[] }+ ).instructions.map((i) => i.name);+ const modernNames = (+ modernIdl as { instructions: IdlIx[] }+ ).instructions.map((i) => i.name);+ // Modern has agent_transfer_extra_lamports + global_remove_currency that+ // legacy does not. Just verify the sets are not equal.+ expect(modernNames.sort()).not.toEqual(legacyNames.sort());+ });+});diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/pdas.test.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/pdas.test.tsnew file mode 100644index 000000000..299246bcd--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/pdas.test.ts@@ -0,0 +1,180 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { describe, expect, it } from "vitest";+import { PublicKey } from "@solana/web3.js";+import { BN } from "@coral-xyz/anchor";++import {+ BONDING_CURVE_SEED,+ BUYBACK_AUTHORITY_SEED,+ GLOBAL_CONFIG_SEED,+ INVOICE_ID_SEED,+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ PAYMENT_IN_CURRENCY_SEED,+ PUMP_PROGRAM_ID,+ TOKEN_AGENT_PAYMENTS_SEED,+ WITHDRAW_AUTHORITY_SEED,+ getBondingCurvePDA,+ getBuybackAuthorityPDA,+ getGlobalConfigPDA,+ getInvoiceIdPDA,+ getPaymentInCurrencyPDA,+ getTokenAgentPaymentsPDA,+ getWithdrawAuthorityPDA,+} from "../pdas.js";++// 1.0.7 reference bundle (CommonJS).+// eslint-disable-next-line @typescript-eslint/no-require-imports+import * as ref from "@pump-fun/agent-payments-sdk";++const TEST_MINT = new PublicKey("11111111111111111111111111111112");+const TEST_CURRENCY = new PublicKey(+ "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",+);++describe("legacy-agent-payments / pdas / constants", () => {+ it("LEGACY_AGENT_PAYMENTS_PROGRAM_ID matches the 1.0.7 deployed address", () => {+ expect(LEGACY_AGENT_PAYMENTS_PROGRAM_ID.toBase58()).toBe(+ "pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4",+ );+ // Reference bundle exposes it as PUMP_AGENT_PAYMENTS_PROGRAM_ID and PROGRAM_ID.+ expect(LEGACY_AGENT_PAYMENTS_PROGRAM_ID.toBase58()).toBe(+ ref.PUMP_AGENT_PAYMENTS_PROGRAM_ID.toBase58(),+ );+ expect(LEGACY_AGENT_PAYMENTS_PROGRAM_ID.toBase58()).toBe(+ ref.PROGRAM_ID.toBase58(),+ );+ });++ it("PUMP_PROGRAM_ID matches the canonical pump bonding curve program", () => {+ expect(PUMP_PROGRAM_ID.toBase58()).toBe(+ "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",+ );+ expect(PUMP_PROGRAM_ID.toBase58()).toBe(ref.PUMP_PROGRAM_ID.toBase58());+ });++ it.each([+ ["GLOBAL_CONFIG_SEED", GLOBAL_CONFIG_SEED, "global-config"],+ [+ "TOKEN_AGENT_PAYMENTS_SEED",+ TOKEN_AGENT_PAYMENTS_SEED,+ "token-agent-payments",+ ],+ [+ "PAYMENT_IN_CURRENCY_SEED",+ PAYMENT_IN_CURRENCY_SEED,+ "payment-in-currency",+ ],+ ["INVOICE_ID_SEED", INVOICE_ID_SEED, "invoice-id"],+ ["BUYBACK_AUTHORITY_SEED", BUYBACK_AUTHORITY_SEED, "buyback-authority"],+ ["WITHDRAW_AUTHORITY_SEED", WITHDRAW_AUTHORITY_SEED, "withdraw-authority"],+ ["BONDING_CURVE_SEED", BONDING_CURVE_SEED, "bonding-curve"],+ ])("%s matches expected utf-8 bytes", (_name, seed, utf8) => {+ expect(Buffer.from(seed).equals(Buffer.from(utf8))).toBe(true);+ });++ it.each([+ ["GLOBAL_CONFIG_SEED", GLOBAL_CONFIG_SEED, ref.GLOBAL_CONFIG_SEED],+ [+ "TOKEN_AGENT_PAYMENTS_SEED",+ TOKEN_AGENT_PAYMENTS_SEED,+ ref.TOKEN_AGENT_PAYMENTS_SEED,+ ],+ [+ "PAYMENT_IN_CURRENCY_SEED",+ PAYMENT_IN_CURRENCY_SEED,+ ref.PAYMENT_IN_CURRENCY_SEED,+ ],+ ["INVOICE_ID_SEED", INVOICE_ID_SEED, ref.INVOICE_ID_SEED],+ [+ "BUYBACK_AUTHORITY_SEED",+ BUYBACK_AUTHORITY_SEED,+ ref.BUYBACK_AUTHORITY_SEED,+ ],+ [+ "WITHDRAW_AUTHORITY_SEED",+ WITHDRAW_AUTHORITY_SEED,+ ref.WITHDRAW_AUTHORITY_SEED,+ ],+ ["BONDING_CURVE_SEED", BONDING_CURVE_SEED, ref.BONDING_CURVE_SEED],+ ])("%s byte-identical to 1.0.7 reference bundle", (_n, ours, theirs) => {+ expect(Buffer.from(ours).equals(Buffer.from(theirs))).toBe(true);+ });+});++describe("legacy-agent-payments / pdas / derivation parity with 1.0.7", () => {+ it("getGlobalConfigPDA matches reference bundle", () => {+ const [oursPk, oursBump] = getGlobalConfigPDA();+ const [refPk, refBump] = ref.getGlobalConfigPDA();+ expect(oursPk.toBase58()).toBe(refPk.toBase58());+ expect(oursBump).toBe(refBump);+ });++ it("getTokenAgentPaymentsPDA matches reference bundle", () => {+ const [oursPk, oursBump] = getTokenAgentPaymentsPDA(TEST_MINT);+ const [refPk, refBump] = ref.getTokenAgentPaymentsPDA(TEST_MINT);+ expect(oursPk.toBase58()).toBe(refPk.toBase58());+ expect(oursBump).toBe(refBump);+ });++ it("getPaymentInCurrencyPDA matches reference bundle", () => {+ const [oursPk, oursBump] = getPaymentInCurrencyPDA(+ TEST_MINT,+ TEST_CURRENCY,+ );+ const [refPk, refBump] = ref.getPaymentInCurrencyPDA(+ TEST_MINT,+ TEST_CURRENCY,+ );+ expect(oursPk.toBase58()).toBe(refPk.toBase58());+ expect(oursBump).toBe(refBump);+ });++ it("getInvoiceIdPDA matches reference bundle for fixed BNs", () => {+ const amount = new BN(100);+ const memo = new BN(200);+ const startTime = new BN(0);+ const endTime = new BN(9999);+ const [oursPk, oursBump] = getInvoiceIdPDA(+ TEST_MINT,+ TEST_CURRENCY,+ amount,+ memo,+ startTime,+ endTime,+ );+ const [refPk, refBump] = ref.getInvoiceIdPDA(+ TEST_MINT,+ TEST_CURRENCY,+ amount,+ memo,+ startTime,+ endTime,+ );+ expect(oursPk.toBase58()).toBe(refPk.toBase58());+ expect(oursBump).toBe(refBump);+ });++ it("getBuybackAuthorityPDA matches reference bundle", () => {+ const [oursPk, oursBump] = getBuybackAuthorityPDA(TEST_MINT);+ const [refPk, refBump] = ref.getBuybackAuthorityPDA(TEST_MINT);+ expect(oursPk.toBase58()).toBe(refPk.toBase58());+ expect(oursBump).toBe(refBump);+ });++ it("getWithdrawAuthorityPDA matches reference bundle", () => {+ const [oursPk, oursBump] = getWithdrawAuthorityPDA(TEST_MINT);+ const [refPk, refBump] = ref.getWithdrawAuthorityPDA(TEST_MINT);+ expect(oursPk.toBase58()).toBe(refPk.toBase58());+ expect(oursBump).toBe(refBump);+ });++ it("getBondingCurvePDA matches reference bundle (pump program)", () => {+ const [oursPk, oursBump] = getBondingCurvePDA(TEST_MINT);+ const [refPk, refBump] = ref.getBondingCurvePDA(TEST_MINT);+ expect(oursPk.toBase58()).toBe(refPk.toBase58());+ expect(oursBump).toBe(refBump);+ });+});diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/program.test.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/program.test.tsnew file mode 100644index 000000000..537e710cc--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/__tests__/program.test.ts@@ -0,0 +1,148 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { describe, expect, it } from "vitest";+import { Connection, PublicKey } from "@solana/web3.js";+import { BN } from "@coral-xyz/anchor";++import {+ OFFLINE_PUMP_PROGRAM,+ decodeLegacyGlobalConfig,+ decodeLegacyTokenAgentPaymentInCurrency,+ decodeLegacyTokenAgentPayments,+ getLegacyOfflineProgram,+ getLegacyPumpProgram,+ getLegacyPumpProgramWithFallback,+} from "../program.js";+import { LEGACY_AGENT_PAYMENTS_PROGRAM_ID } from "../pdas.js";++// Construct a Connection without doing IO. The constructor accepts a URL+// but doesn't actually connect until a method is invoked.+const FAKE_CONNECTION = new Connection("http://127.0.0.1:8899", "processed");++describe("legacy-agent-payments / program", () => {+ it("getLegacyPumpProgram returns a Program with the correct programId", () => {+ const program = getLegacyPumpProgram(FAKE_CONNECTION);+ expect(program.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(+ true,+ );+ });++ it("getLegacyOfflineProgram returns a Program without throwing", () => {+ const program = getLegacyOfflineProgram();+ expect(program.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(+ true,+ );+ });++ it("getLegacyPumpProgramWithFallback returns offline when no connection", () => {+ const program = getLegacyPumpProgramWithFallback();+ expect(program.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(+ true,+ );+ });++ it("getLegacyPumpProgramWithFallback uses connection when supplied", () => {+ const program = getLegacyPumpProgramWithFallback(FAKE_CONNECTION);+ expect(program.programId.equals(LEGACY_AGENT_PAYMENTS_PROGRAM_ID)).toBe(+ true,+ );+ expect(program.provider.connection).toBeDefined();+ });++ it("OFFLINE_PUMP_PROGRAM singleton is reused across calls", () => {+ expect(OFFLINE_PUMP_PROGRAM).toBe(getLegacyPumpProgramWithFallback());+ });+});++describe("legacy-agent-payments / decoders (offline encode then decode)", () => {+ const coder = OFFLINE_PUMP_PROGRAM.coder.accounts;++ it("decodeLegacyTokenAgentPayments round-trips fields", async () => {+ const sample = {+ bump: 254,+ mint: new PublicKey("11111111111111111111111111111112"),+ authority: new PublicKey("11111111111111111111111111111113"),+ buybackBps: 1234,+ };+ const encoded = await coder.encode("tokenAgentPayments", sample);+ const decoded = decodeLegacyTokenAgentPayments(encoded);+ expect(decoded.bump).toBe(sample.bump);+ expect(decoded.mint.toBase58()).toBe(sample.mint.toBase58());+ expect(decoded.authority.toBase58()).toBe(sample.authority.toBase58());+ expect(decoded.buybackBps).toBe(sample.buybackBps);+ });++ it("decodeLegacyTokenAgentPaymentInCurrency round-trips fields", async () => {+ const sample = {+ mint: new PublicKey("11111111111111111111111111111112"),+ currencyMint: new PublicKey(+ "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",+ ),+ totalInvoicePaymentsMade: new BN(1234567890),+ totalBuyback: new BN(42),+ totalWithdrawals: new BN(7),+ tokensBoughtBackAndBurned: new BN(99),+ };+ const encoded = await coder.encode(+ "tokenAgentPaymentInCurrency",+ sample,+ );+ const decoded = decodeLegacyTokenAgentPaymentInCurrency(encoded);+ expect(decoded.mint.toBase58()).toBe(sample.mint.toBase58());+ expect(decoded.currencyMint.toBase58()).toBe(+ sample.currencyMint.toBase58(),+ );+ expect(decoded.totalInvoicePaymentsMade.toString()).toBe(+ sample.totalInvoicePaymentsMade.toString(),+ );+ expect(decoded.totalBuyback.toString()).toBe(+ sample.totalBuyback.toString(),+ );+ expect(decoded.totalWithdrawals.toString()).toBe(+ sample.totalWithdrawals.toString(),+ );+ expect(decoded.tokensBoughtBackAndBurned.toString()).toBe(+ sample.tokensBoughtBackAndBurned.toString(),+ );+ });++ it("decodeLegacyGlobalConfig round-trips fields", async () => {+ const supported = Array.from({ length: 10 }, (_, i) =>+ i === 0+ ? new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")+ : PublicKey.default,+ );+ const sample = {+ bump: 250,+ protocolAuthority: new PublicKey(+ "11111111111111111111111111111112",+ ),+ buybackAuthority: new PublicKey(+ "11111111111111111111111111111113",+ ),+ supportedCurrenciesMint: supported,+ tokenizedAgentSequence: new BN(7),+ };+ const encoded = await coder.encode("globalConfig", sample);+ const decoded = decodeLegacyGlobalConfig(encoded);+ expect(decoded.bump).toBe(sample.bump);+ expect(decoded.protocolAuthority.toBase58()).toBe(+ sample.protocolAuthority.toBase58(),+ );+ expect(decoded.buybackAuthority.toBase58()).toBe(+ sample.buybackAuthority.toBase58(),+ );+ expect(decoded.tokenizedAgentSequence.toString()).toBe(+ sample.tokenizedAgentSequence.toString(),+ );+ expect(decoded.supportedCurrenciesMint).toHaveLength(10);+ expect(decoded.supportedCurrenciesMint[0].toBase58()).toBe(+ supported[0].toBase58(),+ );+ expect(decoded.supportedCurrenciesMint[1].toBase58()).toBe(+ PublicKey.default.toBase58(),+ );+ });+});diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/idl.json b/agent-payments-sdk/src/solana/legacy-agent-payments/idl.jsonnew file mode 100644index 000000000..52504da82--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/idl.json@@ -0,0 +1,2726 @@+{+ "address": "pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4",+ "metadata": {+ "name": "pumpAgentPayments",+ "version": "0.1.0",+ "spec": "0.1.0",+ "description": "Created with Anchor"+ },+ "instructions": [+ {+ "name": "agentAcceptPayment",+ "discriminator": [+ 34,+ 157,+ 64,+ 220,+ 74,+ 32,+ 48,+ 225+ ],+ "accounts": [+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "userTokenAccount",+ "writable": true+ },+ {+ "name": "tokenAgentPayments"+ },+ {+ "name": "tokenAgentAssociatedAccount",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "tokenAgentPayments"+ },+ {+ "kind": "const",+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ]+ },+ {+ "kind": "account",+ "path": "currencyMint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "tokenAgentPaymentInCurrency",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 45,+ 105,+ 110,+ 45,+ 99,+ 117,+ 114,+ 114,+ 101,+ 110,+ 99,+ 121+ ]+ },+ {+ "kind": "account",+ "path": "tokenAgentPayments.mint",+ "account": "tokenAgentPayments"+ },+ {+ "kind": "account",+ "path": "currencyMint"+ }+ ]+ }+ },+ {+ "name": "globalConfig",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "invoiceId"+ },+ {+ "name": "currencyMint"+ },+ {+ "name": "tokenProgram"+ },+ {+ "name": "associatedTokenProgram",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "systemProgram",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "amount",+ "type": "u64"+ },+ {+ "name": "memo",+ "type": "u64"+ },+ {+ "name": "startTime",+ "type": "i64"+ },+ {+ "name": "endTime",+ "type": "i64"+ }+ ]+ },+ {+ "name": "agentBuybackTrigger",+ "discriminator": [+ 95,+ 231,+ 193,+ 2,+ 245,+ 75,+ 125,+ 155+ ],+ "accounts": [+ {+ "name": "globalBuybackAuthority",+ "writable": true,+ "signer": true+ },+ {+ "name": "mint",+ "writable": true+ },+ {+ "name": "tokenAgentPayments",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 116,+ 111,+ 107,+ 101,+ 110,+ 45,+ 97,+ 103,+ 101,+ 110,+ 116,+ 45,+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 115+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "tokenAgentPaymentInCurrency",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 45,+ 105,+ 110,+ 45,+ 99,+ 117,+ 114,+ 114,+ 101,+ 110,+ 99,+ 121+ ]+ },+ {+ "kind": "account",+ "path": "tokenAgentPayments.mint",+ "account": "tokenAgentPayments"+ },+ {+ "kind": "account",+ "path": "currencyMint"+ }+ ]+ }+ },+ {+ "name": "currencyMint"+ },+ {+ "name": "globalConfig",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "swapProgramToInvoke"+ },+ {+ "name": "burnAuthority",+ "docs": [+ "Intentionally called burn_authority",+ "TO avoid any confusion with the global buyback authority."+ ],+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 117,+ 121,+ 98,+ 97,+ 99,+ 107,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ },+ {+ "kind": "account",+ "path": "tokenAgentPayments.mint",+ "account": "tokenAgentPayments"+ }+ ]+ }+ },+ {+ "name": "burnMintVault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "burnAuthority"+ },+ {+ "kind": "const",+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "tokenProgram"+ },+ {+ "name": "associatedTokenProgram",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "systemProgram",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "swapInstructionData",+ "type": "bytes"+ }+ ]+ },+ {+ "name": "agentDistributePayments",+ "discriminator": [+ 145,+ 44,+ 246,+ 47,+ 192,+ 204,+ 95,+ 32+ ],+ "accounts": [+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "globalConfig",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "currencyMint"+ },+ {+ "name": "tokenAgentPayments"+ },+ {+ "name": "tokenAgentPaymentInCurrency",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 45,+ 105,+ 110,+ 45,+ 99,+ 117,+ 114,+ 114,+ 101,+ 110,+ 99,+ 121+ ]+ },+ {+ "kind": "account",+ "path": "tokenAgentPayments.mint",+ "account": "tokenAgentPayments"+ },+ {+ "kind": "account",+ "path": "currencyMint"+ }+ ]+ }+ },+ {+ "name": "tokenAgentAssociatedAccount",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "tokenAgentPayments"+ },+ {+ "kind": "const",+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ]+ },+ {+ "kind": "account",+ "path": "currencyMint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "buybackAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 117,+ 121,+ 98,+ 97,+ 99,+ 107,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ },+ {+ "kind": "account",+ "path": "tokenAgentPayments.mint",+ "account": "tokenAgentPayments"+ }+ ]+ }+ },+ {+ "name": "withdrawAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 119,+ 105,+ 116,+ 104,+ 100,+ 114,+ 97,+ 119,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ },+ {+ "kind": "account",+ "path": "tokenAgentPayments.mint",+ "account": "tokenAgentPayments"+ }+ ]+ }+ },+ {+ "name": "buybackVault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "buybackAuthority"+ },+ {+ "kind": "const",+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ]+ },+ {+ "kind": "account",+ "path": "currencyMint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "withdrawVault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "withdrawAuthority"+ },+ {+ "kind": "const",+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ]+ },+ {+ "kind": "account",+ "path": "currencyMint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "tokenProgram"+ },+ {+ "name": "associatedTokenProgram",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "systemProgram",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "agentInitialize",+ "discriminator": [+ 180,+ 248,+ 163,+ 8,+ 49,+ 94,+ 126,+ 96+ ],+ "accounts": [+ {+ "name": "authority",+ "writable": true,+ "signer": true+ },+ {+ "name": "bondingCurve",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 1,+ 86,+ 224,+ 246,+ 147,+ 102,+ 90,+ 207,+ 68,+ 219,+ 21,+ 104,+ 191,+ 23,+ 91,+ 170,+ 81,+ 137,+ 203,+ 151,+ 245,+ 210,+ 255,+ 59,+ 101,+ 93,+ 43,+ 182,+ 253,+ 109,+ 24,+ 176+ ]+ }+ }+ },+ {+ "name": "globalConfig",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "mint"+ },+ {+ "name": "tokenAgentPayments",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 116,+ 111,+ 107,+ 101,+ 110,+ 45,+ 97,+ 103,+ 101,+ 110,+ 116,+ 45,+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 115+ ]+ },+ {+ "kind": "account",+ "path": "mint"+ }+ ]+ }+ },+ {+ "name": "systemProgram",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "authority",+ "type": "pubkey"+ },+ {+ "name": "buybackBps",+ "type": "u16"+ }+ ]+ },+ {+ "name": "agentUpdateAuthority",+ "discriminator": [+ 237,+ 228,+ 227,+ 224,+ 226,+ 198,+ 167,+ 83+ ],+ "accounts": [+ {+ "name": "authority",+ "writable": true,+ "signer": true+ },+ {+ "name": "globalConfig",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "tokenAgentPayments",+ "writable": true+ },+ {+ "name": "systemProgram",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "newAuthority",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "agentUpdateBuybackBps",+ "discriminator": [+ 41,+ 28,+ 118,+ 90,+ 53,+ 24,+ 63,+ 160+ ],+ "accounts": [+ {+ "name": "authority",+ "writable": true,+ "signer": true+ },+ {+ "name": "tokenAgentPayments",+ "writable": true+ },+ {+ "name": "globalConfig",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "buybackBps",+ "type": "u16"+ }+ ]+ },+ {+ "name": "agentWithdraw",+ "discriminator": [+ 13,+ 149,+ 99,+ 245,+ 171,+ 171,+ 185,+ 53+ ],+ "accounts": [+ {+ "name": "authority",+ "writable": true,+ "signer": true+ },+ {+ "name": "tokenAgentPayments"+ },+ {+ "name": "currencyMint"+ },+ {+ "name": "withdrawAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 119,+ 105,+ 116,+ 104,+ 100,+ 114,+ 97,+ 119,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ },+ {+ "kind": "account",+ "path": "tokenAgentPayments.mint",+ "account": "tokenAgentPayments"+ }+ ]+ }+ },+ {+ "name": "withdrawVault",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "account",+ "path": "withdrawAuthority"+ },+ {+ "kind": "const",+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ]+ },+ {+ "kind": "account",+ "path": "currencyMint"+ }+ ],+ "program": {+ "kind": "const",+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ]+ }+ }+ },+ {+ "name": "receiverAta",+ "writable": true+ },+ {+ "name": "tokenProgram"+ },+ {+ "name": "associatedTokenProgram",+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"+ },+ {+ "name": "systemProgram",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "closeAccount",+ "discriminator": [+ 125,+ 255,+ 149,+ 14,+ 110,+ 34,+ 72,+ 24+ ],+ "accounts": [+ {+ "name": "account",+ "writable": true+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "globalConfig",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "systemProgram",+ "address": "11111111111111111111111111111111"+ }+ ],+ "args": []+ },+ {+ "name": "extendAccount",+ "discriminator": [+ 234,+ 102,+ 194,+ 203,+ 150,+ 72,+ 62,+ 229+ ],+ "accounts": [+ {+ "name": "account",+ "writable": true+ },+ {+ "name": "user",+ "writable": true,+ "signer": true+ },+ {+ "name": "systemProgram",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "globalAddNewCurrency",+ "discriminator": [+ 46,+ 135,+ 47,+ 120,+ 118,+ 204,+ 177,+ 224+ ],+ "accounts": [+ {+ "name": "authority",+ "writable": true,+ "signer": true+ },+ {+ "name": "globalConfig",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "mint"+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": []+ },+ {+ "name": "globalConfigInitialize",+ "discriminator": [+ 61,+ 23,+ 208,+ 192,+ 232,+ 52,+ 8,+ 66+ ],+ "accounts": [+ {+ "name": "authority",+ "writable": true,+ "signer": true+ },+ {+ "name": "globalConfig",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "systemProgram",+ "address": "11111111111111111111111111111111"+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "protocolAuthority",+ "type": "pubkey"+ },+ {+ "name": "buybackAuthority",+ "type": "pubkey"+ }+ ]+ },+ {+ "name": "globalUpdateAuthorities",+ "discriminator": [+ 91,+ 137,+ 72,+ 77,+ 183,+ 184,+ 168,+ 125+ ],+ "accounts": [+ {+ "name": "authority",+ "writable": true,+ "signer": true+ },+ {+ "name": "globalConfig",+ "writable": true,+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ]+ }+ ]+ }+ },+ {+ "name": "eventAuthority",+ "pda": {+ "seeds": [+ {+ "kind": "const",+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ]+ }+ ]+ }+ },+ {+ "name": "program"+ }+ ],+ "args": [+ {+ "name": "protocolAuthority",+ "type": {+ "option": "pubkey"+ }+ },+ {+ "name": "buybackAuthority",+ "type": {+ "option": "pubkey"+ }+ }+ ]+ }+ ],+ "accounts": [+ {+ "name": "bondingCurve",+ "discriminator": [+ 23,+ 183,+ 248,+ 55,+ 96,+ 216,+ 172,+ 96+ ]+ },+ {+ "name": "globalConfig",+ "discriminator": [+ 149,+ 8,+ 156,+ 202,+ 160,+ 252,+ 176,+ 217+ ]+ },+ {+ "name": "tokenAgentPaymentInCurrency",+ "discriminator": [+ 225,+ 195,+ 81,+ 227,+ 115,+ 43,+ 25,+ 177+ ]+ },+ {+ "name": "tokenAgentPayments",+ "discriminator": [+ 136,+ 241,+ 242,+ 217,+ 173,+ 77,+ 112,+ 186+ ]+ }+ ],+ "events": [+ {+ "name": "agentAcceptPaymentEvent",+ "discriminator": [+ 114,+ 190,+ 188,+ 192,+ 105,+ 79,+ 41,+ 147+ ]+ },+ {+ "name": "agentBuybackTriggerEvent",+ "discriminator": [+ 139,+ 240,+ 9,+ 225,+ 214,+ 63,+ 232,+ 165+ ]+ },+ {+ "name": "agentDistributePaymentsEvent",+ "discriminator": [+ 137,+ 116,+ 114,+ 140,+ 54,+ 111,+ 230,+ 26+ ]+ },+ {+ "name": "agentInitializeEvent",+ "discriminator": [+ 192,+ 5,+ 183,+ 151,+ 0,+ 64,+ 100,+ 207+ ]+ },+ {+ "name": "agentUpdateAuthorityEvent",+ "discriminator": [+ 36,+ 212,+ 117,+ 235,+ 74,+ 166,+ 60,+ 16+ ]+ },+ {+ "name": "agentUpdateBuybackBpsEvent",+ "discriminator": [+ 165,+ 251,+ 40,+ 19,+ 114,+ 26,+ 128,+ 232+ ]+ },+ {+ "name": "agentWithdrawEvent",+ "discriminator": [+ 174,+ 231,+ 201,+ 69,+ 254,+ 183,+ 49,+ 85+ ]+ },+ {+ "name": "extendAccountEvent",+ "discriminator": [+ 97,+ 97,+ 215,+ 144,+ 93,+ 146,+ 22,+ 124+ ]+ },+ {+ "name": "globalAddNewCurrencyEvent",+ "discriminator": [+ 130,+ 202,+ 37,+ 248,+ 241,+ 182,+ 233,+ 35+ ]+ },+ {+ "name": "globalConfigInitializeEvent",+ "discriminator": [+ 241,+ 51,+ 222,+ 190,+ 142,+ 245,+ 176,+ 53+ ]+ },+ {+ "name": "globalUpdateAuthoritiesEvent",+ "discriminator": [+ 82,+ 27,+ 22,+ 232,+ 53,+ 66,+ 35,+ 207+ ]+ }+ ],+ "errors": [+ {+ "code": 6000,+ "name": "unauthorizedSigner",+ "msg": "The given account is not authorized to execute this instruction."+ },+ {+ "code": 6001,+ "name": "currencyAlreadySupported",+ "msg": "The given currency is already supported."+ },+ {+ "code": 6002,+ "name": "maxCurrenciesReached",+ "msg": "The maximum number of currencies has been reached."+ },+ {+ "code": 6003,+ "name": "invalidBuybackBps",+ "msg": "The buyback basis points is greater than 10000."+ },+ {+ "code": 6004,+ "name": "currencyNotSupported",+ "msg": "The given currency is not supported."+ },+ {+ "code": 6005,+ "name": "mathOverflow",+ "msg": "Math overflow."+ },+ {+ "code": 6006,+ "name": "invalidRemainingAccountAddress",+ "msg": "The given remaining account address is invalid."+ },+ {+ "code": 6007,+ "name": "paymentVaultNotEmpty",+ "msg": "The payment vault is not empty. Distribute the payments first."+ },+ {+ "code": 6008,+ "name": "invalidInvoiceAccount",+ "msg": "The invoice account does not match the expected PDA seeds"+ },+ {+ "code": 6009,+ "name": "invalidProgramToInvoke",+ "msg": "The program to invoke is not allowed."+ },+ {+ "code": 6010,+ "name": "invalidCallbackProgram",+ "msg": "The callback program is invalid."+ },+ {+ "code": 6011,+ "name": "swapFailedAmountDidNotIncrease",+ "msg": "The swap failed and the amount did not increase."+ },+ {+ "code": 6012,+ "name": "accountTypeNotSupported",+ "msg": "The account type is not supported for extension."+ }+ ],+ "types": [+ {+ "name": "agentAcceptPaymentEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "tokenizedAgentMint",+ "type": "pubkey"+ },+ {+ "name": "tokenAgentPayments",+ "type": "pubkey"+ },+ {+ "name": "currencyMint",+ "type": "pubkey"+ },+ {+ "name": "amount",+ "type": "u64"+ },+ {+ "name": "memo",+ "type": "u64"+ },+ {+ "name": "startTime",+ "type": "i64"+ },+ {+ "name": "endTime",+ "type": "i64"+ },+ {+ "name": "invoiceId",+ "type": "pubkey"+ },+ {+ "name": "agentPostBalance",+ "type": "u64"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "agentBuybackTriggerEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "tokenAgentPayments",+ "type": "pubkey"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "amountBurned",+ "type": "u64"+ },+ {+ "name": "swapProgram",+ "type": "pubkey"+ },+ {+ "name": "newTokensBoughtAndBurnedForCurrency",+ "type": "u64"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "agentDistributePaymentsEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "tokenAgentPayments",+ "type": "pubkey"+ },+ {+ "name": "currencyMint",+ "type": "pubkey"+ },+ {+ "name": "buybackBps",+ "type": "u16"+ },+ {+ "name": "buybackAmount",+ "type": "u64"+ },+ {+ "name": "withdrawAmount",+ "type": "u64"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "agentInitializeEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "tokenAgentPayments",+ "type": "pubkey"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "authority",+ "type": "pubkey"+ },+ {+ "name": "buybackBps",+ "type": "u16"+ },+ {+ "name": "timestamp",+ "type": "i64"+ },+ {+ "name": "tokenizedAgentSequence",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "agentUpdateAuthorityEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "tokenAgentPayments",+ "type": "pubkey"+ },+ {+ "name": "oldAuthority",+ "type": "pubkey"+ },+ {+ "name": "newAuthority",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "agentUpdateBuybackBpsEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "tokenAgentPayments",+ "type": "pubkey"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "oldBuybackBps",+ "type": "u16"+ },+ {+ "name": "newBuybackBps",+ "type": "u16"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "agentWithdrawEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "tokenAgentPayments",+ "type": "pubkey"+ },+ {+ "name": "currencyMint",+ "type": "pubkey"+ },+ {+ "name": "amount",+ "type": "u64"+ },+ {+ "name": "receiver",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "bondingCurve",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "virtualTokenReserves",+ "type": "u64"+ },+ {+ "name": "virtualSolReserves",+ "type": "u64"+ },+ {+ "name": "realTokenReserves",+ "type": "u64"+ },+ {+ "name": "realSolReserves",+ "type": "u64"+ },+ {+ "name": "tokenTotalSupply",+ "type": "u64"+ },+ {+ "name": "complete",+ "type": "bool"+ },+ {+ "name": "creator",+ "type": "pubkey"+ },+ {+ "name": "isMayhemMode",+ "type": "bool"+ }+ ]+ }+ },+ {+ "name": "extendAccountEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "account",+ "type": "pubkey"+ },+ {+ "name": "user",+ "type": "pubkey"+ },+ {+ "name": "currentSize",+ "type": "u64"+ },+ {+ "name": "newSize",+ "type": "u64"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "globalAddNewCurrencyEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "globalConfig",+ "type": "pubkey"+ },+ {+ "name": "currencyMint",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "globalConfig",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "bump",+ "type": "u8"+ },+ {+ "name": "protocolAuthority",+ "type": "pubkey"+ },+ {+ "name": "buybackAuthority",+ "type": "pubkey"+ },+ {+ "name": "supportedCurrenciesMint",+ "type": {+ "array": [+ "pubkey",+ 10+ ]+ }+ },+ {+ "name": "tokenizedAgentSequence",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "globalConfigInitializeEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "globalConfig",+ "type": "pubkey"+ },+ {+ "name": "protocolAuthority",+ "type": "pubkey"+ },+ {+ "name": "buybackAuthority",+ "type": "pubkey"+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "globalUpdateAuthoritiesEvent",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "globalConfig",+ "type": "pubkey"+ },+ {+ "name": "protocolAuthority",+ "type": {+ "option": "pubkey"+ }+ },+ {+ "name": "buybackAuthority",+ "type": {+ "option": "pubkey"+ }+ },+ {+ "name": "timestamp",+ "type": "i64"+ }+ ]+ }+ },+ {+ "name": "tokenAgentPaymentInCurrency",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "currencyMint",+ "type": "pubkey"+ },+ {+ "name": "totalInvoicePaymentsMade",+ "type": "u64"+ },+ {+ "name": "totalBuyback",+ "type": "u64"+ },+ {+ "name": "totalWithdrawals",+ "type": "u64"+ },+ {+ "name": "tokensBoughtBackAndBurned",+ "type": "u64"+ }+ ]+ }+ },+ {+ "name": "tokenAgentPayments",+ "type": {+ "kind": "struct",+ "fields": [+ {+ "name": "bump",+ "type": "u8"+ },+ {+ "name": "mint",+ "type": "pubkey"+ },+ {+ "name": "authority",+ "type": "pubkey"+ },+ {+ "name": "buybackBps",+ "type": "u16"+ }+ ]+ }+ }+ ]+}diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/idl.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/idl.tsnew file mode 100644index 000000000..090a51466--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/idl.ts@@ -0,0 +1,2734 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * Program IDL for the legacy 1.0.7 release of @pump-fun/agent-payments-sdk.+ * Address: pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4+ */+export type LegacyPumpAgentPayments = {+ "address": "pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4";+ "metadata": {+ "name": "pumpAgentPayments";+ "version": "0.1.0";+ "spec": "0.1.0";+ "description": "Created with Anchor";+ };+ "instructions": [+ {+ "name": "agentAcceptPayment";+ "discriminator": [+ 34,+ 157,+ 64,+ 220,+ 74,+ 32,+ 48,+ 225+ ];+ "accounts": [+ {+ "name": "user";+ "writable": true;+ "signer": true;+ },+ {+ "name": "userTokenAccount";+ "writable": true;+ },+ {+ "name": "tokenAgentPayments";+ },+ {+ "name": "tokenAgentAssociatedAccount";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "account";+ "path": "tokenAgentPayments";+ },+ {+ "kind": "const";+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ];+ },+ {+ "kind": "account";+ "path": "currencyMint";+ }+ ];+ "program": {+ "kind": "const";+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ];+ };+ };+ },+ {+ "name": "tokenAgentPaymentInCurrency";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 45,+ 105,+ 110,+ 45,+ 99,+ 117,+ 114,+ 114,+ 101,+ 110,+ 99,+ 121+ ];+ },+ {+ "kind": "account";+ "path": "token_agent_payments.mint";+ "account": "tokenAgentPayments";+ },+ {+ "kind": "account";+ "path": "currencyMint";+ }+ ];+ };+ },+ {+ "name": "globalConfig";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "invoiceId";+ },+ {+ "name": "currencyMint";+ },+ {+ "name": "tokenProgram";+ },+ {+ "name": "associatedTokenProgram";+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";+ },+ {+ "name": "systemProgram";+ "address": "11111111111111111111111111111111";+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [+ {+ "name": "amount";+ "type": "u64";+ },+ {+ "name": "memo";+ "type": "u64";+ },+ {+ "name": "startTime";+ "type": "i64";+ },+ {+ "name": "endTime";+ "type": "i64";+ }+ ];+ },+ {+ "name": "agentBuybackTrigger";+ "discriminator": [+ 95,+ 231,+ 193,+ 2,+ 245,+ 75,+ 125,+ 155+ ];+ "accounts": [+ {+ "name": "globalBuybackAuthority";+ "writable": true;+ "signer": true;+ },+ {+ "name": "mint";+ "writable": true;+ },+ {+ "name": "tokenAgentPayments";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 116,+ 111,+ 107,+ 101,+ 110,+ 45,+ 97,+ 103,+ 101,+ 110,+ 116,+ 45,+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 115+ ];+ },+ {+ "kind": "account";+ "path": "mint";+ }+ ];+ };+ },+ {+ "name": "tokenAgentPaymentInCurrency";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 45,+ 105,+ 110,+ 45,+ 99,+ 117,+ 114,+ 114,+ 101,+ 110,+ 99,+ 121+ ];+ },+ {+ "kind": "account";+ "path": "token_agent_payments.mint";+ "account": "tokenAgentPayments";+ },+ {+ "kind": "account";+ "path": "currencyMint";+ }+ ];+ };+ },+ {+ "name": "currencyMint";+ },+ {+ "name": "globalConfig";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "swapProgramToInvoke";+ },+ {+ "name": "burnAuthority";+ "docs": [+ "Intentionally called burn_authority",+ "TO avoid any confusion with the global buyback authority."+ ];+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 98,+ 117,+ 121,+ 98,+ 97,+ 99,+ 107,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ },+ {+ "kind": "account";+ "path": "token_agent_payments.mint";+ "account": "tokenAgentPayments";+ }+ ];+ };+ },+ {+ "name": "burnMintVault";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "account";+ "path": "burnAuthority";+ },+ {+ "kind": "const";+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ];+ },+ {+ "kind": "account";+ "path": "mint";+ }+ ];+ "program": {+ "kind": "const";+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ];+ };+ };+ },+ {+ "name": "tokenProgram";+ },+ {+ "name": "associatedTokenProgram";+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";+ },+ {+ "name": "systemProgram";+ "address": "11111111111111111111111111111111";+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [+ {+ "name": "swapInstructionData";+ "type": "bytes";+ }+ ];+ },+ {+ "name": "agentDistributePayments";+ "discriminator": [+ 145,+ 44,+ 246,+ 47,+ 192,+ 204,+ 95,+ 32+ ];+ "accounts": [+ {+ "name": "user";+ "writable": true;+ "signer": true;+ },+ {+ "name": "globalConfig";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "currencyMint";+ },+ {+ "name": "tokenAgentPayments";+ },+ {+ "name": "tokenAgentPaymentInCurrency";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 45,+ 105,+ 110,+ 45,+ 99,+ 117,+ 114,+ 114,+ 101,+ 110,+ 99,+ 121+ ];+ },+ {+ "kind": "account";+ "path": "token_agent_payments.mint";+ "account": "tokenAgentPayments";+ },+ {+ "kind": "account";+ "path": "currencyMint";+ }+ ];+ };+ },+ {+ "name": "tokenAgentAssociatedAccount";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "account";+ "path": "tokenAgentPayments";+ },+ {+ "kind": "const";+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ];+ },+ {+ "kind": "account";+ "path": "currencyMint";+ }+ ];+ "program": {+ "kind": "const";+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ];+ };+ };+ },+ {+ "name": "buybackAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 98,+ 117,+ 121,+ 98,+ 97,+ 99,+ 107,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ },+ {+ "kind": "account";+ "path": "token_agent_payments.mint";+ "account": "tokenAgentPayments";+ }+ ];+ };+ },+ {+ "name": "withdrawAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 119,+ 105,+ 116,+ 104,+ 100,+ 114,+ 97,+ 119,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ },+ {+ "kind": "account";+ "path": "token_agent_payments.mint";+ "account": "tokenAgentPayments";+ }+ ];+ };+ },+ {+ "name": "buybackVault";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "account";+ "path": "buybackAuthority";+ },+ {+ "kind": "const";+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ];+ },+ {+ "kind": "account";+ "path": "currencyMint";+ }+ ];+ "program": {+ "kind": "const";+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ];+ };+ };+ },+ {+ "name": "withdrawVault";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "account";+ "path": "withdrawAuthority";+ },+ {+ "kind": "const";+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ];+ },+ {+ "kind": "account";+ "path": "currencyMint";+ }+ ];+ "program": {+ "kind": "const";+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ];+ };+ };+ },+ {+ "name": "tokenProgram";+ },+ {+ "name": "associatedTokenProgram";+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";+ },+ {+ "name": "systemProgram";+ "address": "11111111111111111111111111111111";+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [];+ },+ {+ "name": "agentInitialize";+ "discriminator": [+ 180,+ 248,+ 163,+ 8,+ 49,+ 94,+ 126,+ 96+ ];+ "accounts": [+ {+ "name": "authority";+ "writable": true;+ "signer": true;+ },+ {+ "name": "bondingCurve";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 98,+ 111,+ 110,+ 100,+ 105,+ 110,+ 103,+ 45,+ 99,+ 117,+ 114,+ 118,+ 101+ ];+ },+ {+ "kind": "account";+ "path": "mint";+ }+ ];+ "program": {+ "kind": "const";+ "value": [+ 1,+ 86,+ 224,+ 246,+ 147,+ 102,+ 90,+ 207,+ 68,+ 219,+ 21,+ 104,+ 191,+ 23,+ 91,+ 170,+ 81,+ 137,+ 203,+ 151,+ 245,+ 210,+ 255,+ 59,+ 101,+ 93,+ 43,+ 182,+ 253,+ 109,+ 24,+ 176+ ];+ };+ };+ },+ {+ "name": "globalConfig";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "mint";+ },+ {+ "name": "tokenAgentPayments";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 116,+ 111,+ 107,+ 101,+ 110,+ 45,+ 97,+ 103,+ 101,+ 110,+ 116,+ 45,+ 112,+ 97,+ 121,+ 109,+ 101,+ 110,+ 116,+ 115+ ];+ },+ {+ "kind": "account";+ "path": "mint";+ }+ ];+ };+ },+ {+ "name": "systemProgram";+ "address": "11111111111111111111111111111111";+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [+ {+ "name": "authority";+ "type": "pubkey";+ },+ {+ "name": "buybackBps";+ "type": "u16";+ }+ ];+ },+ {+ "name": "agentUpdateAuthority";+ "discriminator": [+ 237,+ 228,+ 227,+ 224,+ 226,+ 198,+ 167,+ 83+ ];+ "accounts": [+ {+ "name": "authority";+ "writable": true;+ "signer": true;+ },+ {+ "name": "globalConfig";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "tokenAgentPayments";+ "writable": true;+ },+ {+ "name": "systemProgram";+ "address": "11111111111111111111111111111111";+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [+ {+ "name": "newAuthority";+ "type": "pubkey";+ }+ ];+ },+ {+ "name": "agentUpdateBuybackBps";+ "discriminator": [+ 41,+ 28,+ 118,+ 90,+ 53,+ 24,+ 63,+ 160+ ];+ "accounts": [+ {+ "name": "authority";+ "writable": true;+ "signer": true;+ },+ {+ "name": "tokenAgentPayments";+ "writable": true;+ },+ {+ "name": "globalConfig";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [+ {+ "name": "buybackBps";+ "type": "u16";+ }+ ];+ },+ {+ "name": "agentWithdraw";+ "discriminator": [+ 13,+ 149,+ 99,+ 245,+ 171,+ 171,+ 185,+ 53+ ];+ "accounts": [+ {+ "name": "authority";+ "writable": true;+ "signer": true;+ },+ {+ "name": "tokenAgentPayments";+ },+ {+ "name": "currencyMint";+ },+ {+ "name": "withdrawAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 119,+ 105,+ 116,+ 104,+ 100,+ 114,+ 97,+ 119,+ 45,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ },+ {+ "kind": "account";+ "path": "token_agent_payments.mint";+ "account": "tokenAgentPayments";+ }+ ];+ };+ },+ {+ "name": "withdrawVault";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "account";+ "path": "withdrawAuthority";+ },+ {+ "kind": "const";+ "value": [+ 6,+ 221,+ 246,+ 225,+ 215,+ 101,+ 161,+ 147,+ 217,+ 203,+ 225,+ 70,+ 206,+ 235,+ 121,+ 172,+ 28,+ 180,+ 133,+ 237,+ 95,+ 91,+ 55,+ 145,+ 58,+ 140,+ 245,+ 133,+ 126,+ 255,+ 0,+ 169+ ];+ },+ {+ "kind": "account";+ "path": "currencyMint";+ }+ ];+ "program": {+ "kind": "const";+ "value": [+ 140,+ 151,+ 37,+ 143,+ 78,+ 36,+ 137,+ 241,+ 187,+ 61,+ 16,+ 41,+ 20,+ 142,+ 13,+ 131,+ 11,+ 90,+ 19,+ 153,+ 218,+ 255,+ 16,+ 132,+ 4,+ 142,+ 123,+ 216,+ 219,+ 233,+ 248,+ 89+ ];+ };+ };+ },+ {+ "name": "receiverAta";+ "writable": true;+ },+ {+ "name": "tokenProgram";+ },+ {+ "name": "associatedTokenProgram";+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";+ },+ {+ "name": "systemProgram";+ "address": "11111111111111111111111111111111";+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [];+ },+ {+ "name": "closeAccount";+ "discriminator": [+ 125,+ 255,+ 149,+ 14,+ 110,+ 34,+ 72,+ 24+ ];+ "accounts": [+ {+ "name": "account";+ "writable": true;+ },+ {+ "name": "user";+ "writable": true;+ "signer": true;+ },+ {+ "name": "globalConfig";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "systemProgram";+ "address": "11111111111111111111111111111111";+ }+ ];+ "args": [];+ },+ {+ "name": "extendAccount";+ "discriminator": [+ 234,+ 102,+ 194,+ 203,+ 150,+ 72,+ 62,+ 229+ ];+ "accounts": [+ {+ "name": "account";+ "writable": true;+ },+ {+ "name": "user";+ "writable": true;+ "signer": true;+ },+ {+ "name": "systemProgram";+ "address": "11111111111111111111111111111111";+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [];+ },+ {+ "name": "globalAddNewCurrency";+ "discriminator": [+ 46,+ 135,+ 47,+ 120,+ 118,+ 204,+ 177,+ 224+ ];+ "accounts": [+ {+ "name": "authority";+ "writable": true;+ "signer": true;+ },+ {+ "name": "globalConfig";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "mint";+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [];+ },+ {+ "name": "globalConfigInitialize";+ "discriminator": [+ 61,+ 23,+ 208,+ 192,+ 232,+ 52,+ 8,+ 66+ ];+ "accounts": [+ {+ "name": "authority";+ "writable": true;+ "signer": true;+ },+ {+ "name": "globalConfig";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "systemProgram";+ "address": "11111111111111111111111111111111";+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [+ {+ "name": "protocolAuthority";+ "type": "pubkey";+ },+ {+ "name": "buybackAuthority";+ "type": "pubkey";+ }+ ];+ },+ {+ "name": "globalUpdateAuthorities";+ "discriminator": [+ 91,+ 137,+ 72,+ 77,+ 183,+ 184,+ 168,+ 125+ ];+ "accounts": [+ {+ "name": "authority";+ "writable": true;+ "signer": true;+ },+ {+ "name": "globalConfig";+ "writable": true;+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 103,+ 108,+ 111,+ 98,+ 97,+ 108,+ 45,+ 99,+ 111,+ 110,+ 102,+ 105,+ 103+ ];+ }+ ];+ };+ },+ {+ "name": "eventAuthority";+ "pda": {+ "seeds": [+ {+ "kind": "const";+ "value": [+ 95,+ 95,+ 101,+ 118,+ 101,+ 110,+ 116,+ 95,+ 97,+ 117,+ 116,+ 104,+ 111,+ 114,+ 105,+ 116,+ 121+ ];+ }+ ];+ };+ },+ {+ "name": "program";+ }+ ];+ "args": [+ {+ "name": "protocolAuthority";+ "type": {+ "option": "pubkey";+ };+ },+ {+ "name": "buybackAuthority";+ "type": {+ "option": "pubkey";+ };+ }+ ];+ }+ ];+ "accounts": [+ {+ "name": "bondingCurve";+ "discriminator": [+ 23,+ 183,+ 248,+ 55,+ 96,+ 216,+ 172,+ 96+ ];+ },+ {+ "name": "globalConfig";+ "discriminator": [+ 149,+ 8,+ 156,+ 202,+ 160,+ 252,+ 176,+ 217+ ];+ },+ {+ "name": "tokenAgentPaymentInCurrency";+ "discriminator": [+ 225,+ 195,+ 81,+ 227,+ 115,+ 43,+ 25,+ 177+ ];+ },+ {+ "name": "tokenAgentPayments";+ "discriminator": [+ 136,+ 241,+ 242,+ 217,+ 173,+ 77,+ 112,+ 186+ ];+ }+ ];+ "events": [+ {+ "name": "agentAcceptPaymentEvent";+ "discriminator": [+ 114,+ 190,+ 188,+ 192,+ 105,+ 79,+ 41,+ 147+ ];+ },+ {+ "name": "agentBuybackTriggerEvent";+ "discriminator": [+ 139,+ 240,+ 9,+ 225,+ 214,+ 63,+ 232,+ 165+ ];+ },+ {+ "name": "agentDistributePaymentsEvent";+ "discriminator": [+ 137,+ 116,+ 114,+ 140,+ 54,+ 111,+ 230,+ 26+ ];+ },+ {+ "name": "agentInitializeEvent";+ "discriminator": [+ 192,+ 5,+ 183,+ 151,+ 0,+ 64,+ 100,+ 207+ ];+ },+ {+ "name": "agentUpdateAuthorityEvent";+ "discriminator": [+ 36,+ 212,+ 117,+ 235,+ 74,+ 166,+ 60,+ 16+ ];+ },+ {+ "name": "agentUpdateBuybackBpsEvent";+ "discriminator": [+ 165,+ 251,+ 40,+ 19,+ 114,+ 26,+ 128,+ 232+ ];+ },+ {+ "name": "agentWithdrawEvent";+ "discriminator": [+ 174,+ 231,+ 201,+ 69,+ 254,+ 183,+ 49,+ 85+ ];+ },+ {+ "name": "extendAccountEvent";+ "discriminator": [+ 97,+ 97,+ 215,+ 144,+ 93,+ 146,+ 22,+ 124+ ];+ },+ {+ "name": "globalAddNewCurrencyEvent";+ "discriminator": [+ 130,+ 202,+ 37,+ 248,+ 241,+ 182,+ 233,+ 35+ ];+ },+ {+ "name": "globalConfigInitializeEvent";+ "discriminator": [+ 241,+ 51,+ 222,+ 190,+ 142,+ 245,+ 176,+ 53+ ];+ },+ {+ "name": "globalUpdateAuthoritiesEvent";+ "discriminator": [+ 82,+ 27,+ 22,+ 232,+ 53,+ 66,+ 35,+ 207+ ];+ }+ ];+ "errors": [+ {+ "code": 6000;+ "name": "unauthorizedSigner";+ "msg": "The given account is not authorized to execute this instruction.";+ },+ {+ "code": 6001;+ "name": "currencyAlreadySupported";+ "msg": "The given currency is already supported.";+ },+ {+ "code": 6002;+ "name": "maxCurrenciesReached";+ "msg": "The maximum number of currencies has been reached.";+ },+ {+ "code": 6003;+ "name": "invalidBuybackBps";+ "msg": "The buyback basis points is greater than 10000.";+ },+ {+ "code": 6004;+ "name": "currencyNotSupported";+ "msg": "The given currency is not supported.";+ },+ {+ "code": 6005;+ "name": "mathOverflow";+ "msg": "Math overflow.";+ },+ {+ "code": 6006;+ "name": "invalidRemainingAccountAddress";+ "msg": "The given remaining account address is invalid.";+ },+ {+ "code": 6007;+ "name": "paymentVaultNotEmpty";+ "msg": "The payment vault is not empty. Distribute the payments first.";+ },+ {+ "code": 6008;+ "name": "invalidInvoiceAccount";+ "msg": "The invoice account does not match the expected PDA seeds";+ },+ {+ "code": 6009;+ "name": "invalidProgramToInvoke";+ "msg": "The program to invoke is not allowed.";+ },+ {+ "code": 6010;+ "name": "invalidCallbackProgram";+ "msg": "The callback program is invalid.";+ },+ {+ "code": 6011;+ "name": "swapFailedAmountDidNotIncrease";+ "msg": "The swap failed and the amount did not increase.";+ },+ {+ "code": 6012;+ "name": "accountTypeNotSupported";+ "msg": "The account type is not supported for extension.";+ }+ ];+ "types": [+ {+ "name": "agentAcceptPaymentEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "user";+ "type": "pubkey";+ },+ {+ "name": "tokenizedAgentMint";+ "type": "pubkey";+ },+ {+ "name": "tokenAgentPayments";+ "type": "pubkey";+ },+ {+ "name": "currencyMint";+ "type": "pubkey";+ },+ {+ "name": "amount";+ "type": "u64";+ },+ {+ "name": "memo";+ "type": "u64";+ },+ {+ "name": "startTime";+ "type": "i64";+ },+ {+ "name": "endTime";+ "type": "i64";+ },+ {+ "name": "invoiceId";+ "type": "pubkey";+ },+ {+ "name": "agentPostBalance";+ "type": "u64";+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "agentBuybackTriggerEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "tokenAgentPayments";+ "type": "pubkey";+ },+ {+ "name": "mint";+ "type": "pubkey";+ },+ {+ "name": "amountBurned";+ "type": "u64";+ },+ {+ "name": "swapProgram";+ "type": "pubkey";+ },+ {+ "name": "newTokensBoughtAndBurnedForCurrency";+ "type": "u64";+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "agentDistributePaymentsEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "tokenAgentPayments";+ "type": "pubkey";+ },+ {+ "name": "currencyMint";+ "type": "pubkey";+ },+ {+ "name": "buybackBps";+ "type": "u16";+ },+ {+ "name": "buybackAmount";+ "type": "u64";+ },+ {+ "name": "withdrawAmount";+ "type": "u64";+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "agentInitializeEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "tokenAgentPayments";+ "type": "pubkey";+ },+ {+ "name": "mint";+ "type": "pubkey";+ },+ {+ "name": "authority";+ "type": "pubkey";+ },+ {+ "name": "buybackBps";+ "type": "u16";+ },+ {+ "name": "timestamp";+ "type": "i64";+ },+ {+ "name": "tokenizedAgentSequence";+ "type": "u64";+ }+ ];+ };+ },+ {+ "name": "agentUpdateAuthorityEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "tokenAgentPayments";+ "type": "pubkey";+ },+ {+ "name": "oldAuthority";+ "type": "pubkey";+ },+ {+ "name": "newAuthority";+ "type": "pubkey";+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "agentUpdateBuybackBpsEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "tokenAgentPayments";+ "type": "pubkey";+ },+ {+ "name": "mint";+ "type": "pubkey";+ },+ {+ "name": "oldBuybackBps";+ "type": "u16";+ },+ {+ "name": "newBuybackBps";+ "type": "u16";+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "agentWithdrawEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "tokenAgentPayments";+ "type": "pubkey";+ },+ {+ "name": "currencyMint";+ "type": "pubkey";+ },+ {+ "name": "amount";+ "type": "u64";+ },+ {+ "name": "receiver";+ "type": "pubkey";+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "bondingCurve";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "virtualTokenReserves";+ "type": "u64";+ },+ {+ "name": "virtualSolReserves";+ "type": "u64";+ },+ {+ "name": "realTokenReserves";+ "type": "u64";+ },+ {+ "name": "realSolReserves";+ "type": "u64";+ },+ {+ "name": "tokenTotalSupply";+ "type": "u64";+ },+ {+ "name": "complete";+ "type": "bool";+ },+ {+ "name": "creator";+ "type": "pubkey";+ },+ {+ "name": "isMayhemMode";+ "type": "bool";+ }+ ];+ };+ },+ {+ "name": "extendAccountEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "account";+ "type": "pubkey";+ },+ {+ "name": "user";+ "type": "pubkey";+ },+ {+ "name": "currentSize";+ "type": "u64";+ },+ {+ "name": "newSize";+ "type": "u64";+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "globalAddNewCurrencyEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "globalConfig";+ "type": "pubkey";+ },+ {+ "name": "currencyMint";+ "type": "pubkey";+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "globalConfig";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "bump";+ "type": "u8";+ },+ {+ "name": "protocolAuthority";+ "type": "pubkey";+ },+ {+ "name": "buybackAuthority";+ "type": "pubkey";+ },+ {+ "name": "supportedCurrenciesMint";+ "type": {+ "array": [+ "pubkey",+ 10+ ];+ };+ },+ {+ "name": "tokenizedAgentSequence";+ "type": "u64";+ }+ ];+ };+ },+ {+ "name": "globalConfigInitializeEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "globalConfig";+ "type": "pubkey";+ },+ {+ "name": "protocolAuthority";+ "type": "pubkey";+ },+ {+ "name": "buybackAuthority";+ "type": "pubkey";+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "globalUpdateAuthoritiesEvent";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "globalConfig";+ "type": "pubkey";+ },+ {+ "name": "protocolAuthority";+ "type": {+ "option": "pubkey";+ };+ },+ {+ "name": "buybackAuthority";+ "type": {+ "option": "pubkey";+ };+ },+ {+ "name": "timestamp";+ "type": "i64";+ }+ ];+ };+ },+ {+ "name": "tokenAgentPaymentInCurrency";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "mint";+ "type": "pubkey";+ },+ {+ "name": "currencyMint";+ "type": "pubkey";+ },+ {+ "name": "totalInvoicePaymentsMade";+ "type": "u64";+ },+ {+ "name": "totalBuyback";+ "type": "u64";+ },+ {+ "name": "totalWithdrawals";+ "type": "u64";+ },+ {+ "name": "tokensBoughtBackAndBurned";+ "type": "u64";+ }+ ];+ };+ },+ {+ "name": "tokenAgentPayments";+ "type": {+ "kind": "struct";+ "fields": [+ {+ "name": "bump";+ "type": "u8";+ },+ {+ "name": "mint";+ "type": "pubkey";+ },+ {+ "name": "authority";+ "type": "pubkey";+ },+ {+ "name": "buybackBps";+ "type": "u16";+ }+ ];+ };+ }+ ];+};diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/index.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/index.tsnew file mode 100644index 000000000..f3db40e60--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/index.ts@@ -0,0 +1,65 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * Vendored 1.0.7 source of `@pump-fun/agent-payments-sdk` reconstructed from+ * the published npm bundle. The 1.0.7 deployment lives at program ID+ * `pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4` and is what+ * `@pump-fun/[email protected]`'s `isTokenizedAgent: true` path targets.+ *+ * Coexists with the modern 3.0.x program (`AgenTMiC...`) implemented in+ * `../PumpAgent.ts` / `../PumpAgentOffline.ts`. Both can be imported and+ * used in the same process; PDAs and program IDs are disjoint.+ */+export {+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ PUMP_PROGRAM_ID,+ GLOBAL_CONFIG_SEED,+ TOKEN_AGENT_PAYMENTS_SEED,+ PAYMENT_IN_CURRENCY_SEED,+ INVOICE_ID_SEED,+ BUYBACK_AUTHORITY_SEED,+ WITHDRAW_AUTHORITY_SEED,+ BONDING_CURVE_SEED,+ getGlobalConfigPDA,+ getTokenAgentPaymentsPDA,+ getPaymentInCurrencyPDA,+ getInvoiceIdPDA,+ getBuybackAuthorityPDA,+ getWithdrawAuthorityPDA,+ getBondingCurvePDA,+} from "./pdas.js";++export {+ getLegacyPumpProgram,+ getLegacyOfflineProgram,+ getLegacyPumpProgramWithFallback,+ decodeLegacyGlobalConfig,+ decodeLegacyTokenAgentPaymentInCurrency,+ decodeLegacyTokenAgentPayments,+ OFFLINE_PUMP_PROGRAM,+} from "./program.js";++export type { LegacyPumpAgentPayments } from "./idl.js";++export { LegacyPumpAgentOffline } from "./PumpAgentOffline.js";+export { LegacyPumpAgent } from "./PumpAgent.js";++export type {+ LegacyAcceptPaymentParams,+ LegacyAcceptPaymentSimpleParams,+ LegacyAgentBalances,+ LegacyBuybackTriggerParams,+ LegacyCreateParams,+ LegacyDistributePaymentsParams,+ LegacyExtendAccountParams,+ LegacyGlobalConfig,+ LegacyTokenAgentPaymentInCurrency,+ LegacyTokenAgentPayments,+ LegacyUpdateAuthorityParams,+ LegacyUpdateBuybackBpsOptions,+ LegacyUpdateBuybackBpsParams,+ LegacyVaultBalance,+ LegacyWithdrawParams,+} from "./types.js";diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/pdas.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/pdas.tsnew file mode 100644index 000000000..097dd78ac--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/pdas.ts@@ -0,0 +1,94 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { PublicKey } from "@solana/web3.js";+import { BN } from "@coral-xyz/anchor";++export const LEGACY_AGENT_PAYMENTS_PROGRAM_ID = new PublicKey(+ "pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4",+);++export const PUMP_PROGRAM_ID = new PublicKey(+ "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",+);++export const GLOBAL_CONFIG_SEED = Buffer.from("global-config");+export const TOKEN_AGENT_PAYMENTS_SEED = Buffer.from("token-agent-payments");+export const PAYMENT_IN_CURRENCY_SEED = Buffer.from("payment-in-currency");+export const INVOICE_ID_SEED = Buffer.from("invoice-id");+export const BUYBACK_AUTHORITY_SEED = Buffer.from("buyback-authority");+export const WITHDRAW_AUTHORITY_SEED = Buffer.from("withdraw-authority");+export const BONDING_CURVE_SEED = Buffer.from("bonding-curve");++export function getGlobalConfigPDA(): [PublicKey, number] {+ return PublicKey.findProgramAddressSync(+ [GLOBAL_CONFIG_SEED],+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ );+}++export function getTokenAgentPaymentsPDA(mint: PublicKey): [PublicKey, number] {+ return PublicKey.findProgramAddressSync(+ [TOKEN_AGENT_PAYMENTS_SEED, mint.toBuffer()],+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ );+}++export function getPaymentInCurrencyPDA(+ tokenMint: PublicKey,+ currencyMint: PublicKey,+): [PublicKey, number] {+ return PublicKey.findProgramAddressSync(+ [PAYMENT_IN_CURRENCY_SEED, tokenMint.toBuffer(), currencyMint.toBuffer()],+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ );+}++export function getInvoiceIdPDA(+ tokenMint: PublicKey,+ currencyMint: PublicKey,+ amount: BN,+ memo: BN,+ startTime: BN,+ endTime: BN,+): [PublicKey, number] {+ return PublicKey.findProgramAddressSync(+ [+ INVOICE_ID_SEED,+ tokenMint.toBuffer(),+ currencyMint.toBuffer(),+ amount.toArrayLike(Buffer, "le", 8),+ memo.toArrayLike(Buffer, "le", 8),+ startTime.toArrayLike(Buffer, "le", 8),+ endTime.toArrayLike(Buffer, "le", 8),+ ],+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ );+}++export function getBuybackAuthorityPDA(tokenMint: PublicKey): [PublicKey, number] {+ return PublicKey.findProgramAddressSync(+ [BUYBACK_AUTHORITY_SEED, tokenMint.toBuffer()],+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ );+}++export function getWithdrawAuthorityPDA(tokenMint: PublicKey): [PublicKey, number] {+ return PublicKey.findProgramAddressSync(+ [WITHDRAW_AUTHORITY_SEED, tokenMint.toBuffer()],+ LEGACY_AGENT_PAYMENTS_PROGRAM_ID,+ );+}++/**+ * Note: BondingCurve PDA is owned by the pump program, not the legacy+ * agent-payments program — it lives on the *pump* program ID. The legacy+ * SDK uses the same seed scheme as the modern bonding curve.+ */+export function getBondingCurvePDA(mint: PublicKey): [PublicKey, number] {+ return PublicKey.findProgramAddressSync(+ [BONDING_CURVE_SEED, mint.toBuffer()],+ PUMP_PROGRAM_ID,+ );+}diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/program.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/program.tsnew file mode 100644index 000000000..909662ada--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/program.ts@@ -0,0 +1,76 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import { AnchorProvider, Program } from "@coral-xyz/anchor";+import type { Connection } from "@solana/web3.js";+import { PublicKey } from "@solana/web3.js";+import idlJson from "./idl.json" with { type: "json" };+import type { LegacyPumpAgentPayments } from "./idl.js";++const IDL = idlJson as unknown as LegacyPumpAgentPayments;++const NOOP_WALLET = {+ publicKey: PublicKey.default,+ signTransaction: () => Promise.reject(new Error("read-only wallet")),+ signAllTransactions: () => Promise.reject(new Error("read-only wallet")),+};++/**+ * Anchor program client for the **1.0.7** pump_agent_payments deployment+ * (`pUmPFn9WvfaN2WTVGnCEtJTd2ATTpvpsKRz6jVzu6u4`). Use this when you need+ * to interact with coins whose tokenized-agent record lives on the legacy+ * program — most commonly when @pump-fun/pump-sdk's `isTokenizedAgent: true`+ * created the agent.+ */+export function getLegacyPumpProgram(+ connection: Connection,+): Program<LegacyPumpAgentPayments> {+ return new Program<LegacyPumpAgentPayments>(+ IDL,+ new AnchorProvider(connection, NOOP_WALLET, {}),+ );+}++/**+ * Offline program client (no `Connection`) for instruction-only flows. The+ * underlying provider uses `PublicKey.default` as its identity and refuses+ * to sign — every method must end with `.instruction()`, not `.rpc()`.+ */+export function getLegacyOfflineProgram(): Program<LegacyPumpAgentPayments> {+ return new Program<LegacyPumpAgentPayments>(+ IDL,+ new AnchorProvider(+ { commitment: "processed" } as unknown as Connection,+ NOOP_WALLET,+ {},+ ),+ );+}++const OFFLINE_PUMP_PROGRAM = getLegacyOfflineProgram();++/** Pick `online` when a connection is available, fall back to offline. */+export function getLegacyPumpProgramWithFallback(+ connection?: Connection,+): Program<LegacyPumpAgentPayments> {+ return connection ? getLegacyPumpProgram(connection) : OFFLINE_PUMP_PROGRAM;+}++/** Decode helpers using the offline coder (no chain calls). */+export function decodeLegacyGlobalConfig(data: Buffer) {+ return OFFLINE_PUMP_PROGRAM.coder.accounts.decode("globalConfig", data);+}++export function decodeLegacyTokenAgentPaymentInCurrency(data: Buffer) {+ return OFFLINE_PUMP_PROGRAM.coder.accounts.decode(+ "tokenAgentPaymentInCurrency",+ data,+ );+}++export function decodeLegacyTokenAgentPayments(data: Buffer) {+ return OFFLINE_PUMP_PROGRAM.coder.accounts.decode("tokenAgentPayments", data);+}++export { OFFLINE_PUMP_PROGRAM };diff --git a/agent-payments-sdk/src/solana/legacy-agent-payments/types.ts b/agent-payments-sdk/src/solana/legacy-agent-payments/types.tsnew file mode 100644index 000000000..9f6467b8d--- /dev/null+++ b/agent-payments-sdk/src/solana/legacy-agent-payments/types.ts@@ -0,0 +1,117 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { PublicKey, AccountMeta } from "@solana/web3.js";+import type { BN } from "@coral-xyz/anchor";++/** Args for `agentInitialize` — registers a tokenized agent for a coin. */+export interface LegacyCreateParams {+ authority: PublicKey;+ mint: PublicKey;+ agentAuthority: PublicKey;+ buybackBps: number;+}++export interface LegacyWithdrawParams {+ authority: PublicKey;+ currencyMint: PublicKey;+ receiverAta: PublicKey;+ tokenProgram?: PublicKey;+}++export interface LegacyUpdateBuybackBpsParams {+ authority: PublicKey;+ buybackBps: number;+}++/** Optional override fed in lieu of an on-chain fetch of `globalConfig`. */+export interface LegacyUpdateBuybackBpsOptions {+ supportedCurrenciesMint: PublicKey[];+}++export interface LegacyAcceptPaymentParams {+ user: PublicKey;+ userTokenAccount: PublicKey;+ currencyMint: PublicKey;+ amount: BN;+ memo: BN;+ startTime: BN;+ endTime: BN;+ tokenProgram?: PublicKey;+}++export interface LegacyAcceptPaymentSimpleParams {+ user: PublicKey;+ userTokenAccount: PublicKey;+ currencyMint: PublicKey;+ amount: number | bigint;+ memo: number | bigint;+ startTime: number | bigint;+ endTime: number | bigint;+ tokenProgram?: PublicKey;+}++export interface LegacyDistributePaymentsParams {+ user: PublicKey;+ currencyMint: PublicKey;+ tokenProgram?: PublicKey;+}++export interface LegacyBuybackTriggerParams {+ globalBuybackAuthority: PublicKey;+ currencyMint: PublicKey;+ swapProgramToInvoke: PublicKey;+ swapInstructionData: Buffer;+ remainingAccounts: AccountMeta[];+ tokenProgram?: PublicKey;+}++export interface LegacyExtendAccountParams {+ account: PublicKey;+ user: PublicKey;+}++export interface LegacyUpdateAuthorityParams {+ authority: PublicKey;+ newAuthority: PublicKey;+}++export interface LegacyVaultBalance {+ address: PublicKey;+ balance: bigint;+}++export interface LegacyAgentBalances {+ paymentVault: LegacyVaultBalance;+ buybackVault: LegacyVaultBalance;+ withdrawVault: LegacyVaultBalance;+}++/** Decoded `tokenAgentPayments` account. Mirrors the 1.0.7 IDL exactly. */+export interface LegacyTokenAgentPayments {+ bump: number;+ mint: PublicKey;+ authority: PublicKey;+ buybackBps: number;+}++/** Decoded `tokenAgentPaymentInCurrency` account. */+export interface LegacyTokenAgentPaymentInCurrency {+ mint: PublicKey;+ currencyMint: PublicKey;+ totalInvoicePaymentsMade: BN;+ totalBuyback: BN;+ totalWithdrawals: BN;+ tokensBoughtBackAndBurned: BN;+}++/** Decoded `globalConfig` account. */+export interface LegacyGlobalConfig {+ bump: number;+ protocolAuthority: PublicKey;+ buybackAuthority: PublicKey;+ /** Fixed-length `[Pubkey; 10]`. Empty slots are `Pubkey::default()`. */+ supportedCurrenciesMint: PublicKey[];+ tokenizedAgentSequence: BN;+}diff --git a/agent-payments-sdk/src/pdas.ts b/agent-payments-sdk/src/solana/pdas.tssimilarity index 84%rename from agent-payments-sdk/src/pdas.tsrename to agent-payments-sdk/src/solana/pdas.tsindex e98ceff00..2ea1cca3d 100644--- a/agent-payments-sdk/src/pdas.ts+++ b/agent-payments-sdk/src/solana/pdas.ts@@ -1,5 +1,9 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+import { PublicKey } from "@solana/web3.js";-import type BN from "bn.js";+import type { BN } from "@coral-xyz/anchor";/** Pump Agent Payments program ID */export const PROGRAM_ID = new PublicKey(@@ -11,6 +15,11 @@ export const PUMP_PROGRAM_ID = new PublicKey("6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",);+/** Pump fees program ID */+export const PUMP_FEES_PROGRAM_ID = new PublicKey(+ "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ",+);+// PDA seedsexport const GLOBAL_CONFIG_SEED = Buffer.from("global-config");export const TOKEN_AGENT_PAYMENTS_SEED = Buffer.from("token-agent-payments");@@ -19,6 +28,7 @@ export const INVOICE_ID_SEED = Buffer.from("invoice-id");export const BUYBACK_AUTHORITY_SEED = Buffer.from("buyback-authority");export const WITHDRAW_AUTHORITY_SEED = Buffer.from("withdraw-authority");export const BONDING_CURVE_SEED = Buffer.from("bonding-curve");+export const SHARING_CONFIG_SEED = Buffer.from("sharing-config");/*** Minimum rent-exempt lamports for TokenAgentPayments account.@@ -125,3 +135,16 @@ export function getBondingCurvePDA(PUMP_PROGRAM_ID,);}++/**+ * Derives the SharingConfig PDA for a given mint.+ * Seeds: ["sharing-config", mint]+ */+export function getSharingConfigPDA(+ mint: PublicKey,+): [PublicKey, number] {+ return PublicKey.findProgramAddressSync(+ [SHARING_CONFIG_SEED, mint.toBuffer()],+ PROGRAM_ID,+ );+}diff --git a/agent-payments-sdk/src/program.ts b/agent-payments-sdk/src/solana/program.tssimilarity index 93%rename from agent-payments-sdk/src/program.tsrename to agent-payments-sdk/src/solana/program.tsindex e04dbfa7e..94b7e263b 100644--- a/agent-payments-sdk/src/program.ts+++ b/agent-payments-sdk/src/solana/program.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+import { AnchorProvider, Program } from "@coral-xyz/anchor";import { Connection, PublicKey } from "@solana/web3.js";import type { PumpAgentPayments } from "./idl/pump_agent_payments";diff --git a/agent-payments-sdk/src/solana/pump-events.test.ts b/agent-payments-sdk/src/solana/pump-events.test.tsnew file mode 100644index 000000000..94c64bba4--- /dev/null+++ b/agent-payments-sdk/src/solana/pump-events.test.ts@@ -0,0 +1,280 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * Fixture-based tests for the pump bonding-curve event parser.+ * Fixtures were captured from mainnet websocket logs — they are real bytes,+ * not synthesized ones, so the BorshEventCoder is the source of truth.+ */+import { describe, it, expect, vi } from "vitest";+import { PublicKey } from "@solana/web3.js";+import { readFileSync } from "node:fs";+import { join } from "node:path";+import {+ createPumpEventParser,+ subscribeToPumpEvents,+ eventDiscriminatorMap,+ type PumpEventName,+ type ParsedPumpEvent,+ PUMP_BONDING_CURVE_PROGRAM_ID,+} from "./pump-events.js";++// ─── Fixture helpers ─────────────────────────────────────────────────────────++interface Fixture {+ signature: string;+ slot: number;+ logMessages: string[];+ expected: { name: string; data: Record<string, unknown> };+}++function loadFixture(name: string): Fixture {+ const p = join(+ new URL(".", import.meta.url).pathname,+ "fixtures/pump-events",+ `${name}.json`,+ );+ return JSON.parse(readFileSync(p, "utf8")) as Fixture;+}++/**+ * BN values come out of JSON as hex strings (BN.toJSON() returns hex).+ * Normalise both sides to string before comparing.+ */+function normalise(v: unknown): unknown {+ if (v === null || v === undefined) return v;+ if (v instanceof PublicKey) return v.toBase58();+ if (typeof v === "object" && !Array.isArray(v)) {+ // BN: { words, negative, length, red } or just a hex string in fixture+ if ("words" in (v as object)) {+ // It's a BN — toJSON() gives hex; call toJSON via toString(16)+ const bn = v as { toString: (r?: number) => string };+ return bn.toString(16);+ }+ return Object.fromEntries(+ Object.entries(v as Record<string, unknown>).map(([k, val]) => [+ k,+ normalise(val),+ ]),+ );+ }+ if (Array.isArray(v)) return (v as unknown[]).map(normalise);+ return v;+}++// ─── Discriminator coverage ───────────────────────────────────────────────────++describe("eventDiscriminatorMap", () => {+ it("covers every event in the IDL", async () => {+ const { default: IDL_JSON } = await import("./idl/pump.json", {+ with: { type: "json" },+ });+ expect(eventDiscriminatorMap.size).toBe(IDL_JSON.events.length);+ });+});++// ─── Parser — fixture round-trips ─────────────────────────────────────────────++describe("createPumpEventParser", () => {+ const parser = createPumpEventParser();++ it("decodes create fixture: event name is CreateEvent", () => {+ const { logMessages } = loadFixture("create");+ const events = parser.parseLogs(logMessages);+ const ev = events.find((e) => e.name === "CreateEvent");+ expect(ev).toBeDefined();+ expect(ev!.name).toBe("CreateEvent");+ });++ it("decodes create fixture: mint is valid base58 pubkey", () => {+ const { logMessages } = loadFixture("create");+ const events = parser.parseLogs(logMessages);+ const ev = events.find((e) => e.name === "CreateEvent")!;+ const data = ev.data as { mint: unknown };+ expect(data.mint).toBeInstanceOf(PublicKey);+ expect(() => (data.mint as PublicKey).toBase58()).not.toThrow();+ });++ it("decodes create fixture: name/symbol are non-empty strings", () => {+ const { logMessages, expected } = loadFixture("create");+ const events = parser.parseLogs(logMessages);+ const ev = events.find((e) => e.name === "CreateEvent")!;+ const data = ev.data as { name: string; symbol: string };+ expect(typeof data.name).toBe("string");+ expect(data.name.length).toBeGreaterThan(0);+ expect(data.name).toBe(expected.data.name);+ expect(data.symbol).toBe(expected.data.symbol);+ });++ it("decodes trade-buy fixture: event name is TradeEvent", () => {+ const { logMessages } = loadFixture("trade-buy");+ const events = parser.parseLogs(logMessages);+ const ev = events.find((e) => e.name === "TradeEvent");+ expect(ev).toBeDefined();+ });++ it("decodes trade-buy fixture: is_buy is true", () => {+ const { logMessages } = loadFixture("trade-buy");+ const events = parser.parseLogs(logMessages);+ const ev = events.find(+ (e) => e.name === "TradeEvent" && (e.data as { is_buy: boolean }).is_buy,+ );+ expect(ev).toBeDefined();+ expect((ev!.data as { is_buy: boolean }).is_buy).toBe(true);+ });++ it("decodes trade-sell fixture: is_buy is false", () => {+ const { logMessages } = loadFixture("trade-sell");+ const events = parser.parseLogs(logMessages);+ const ev = events.find(+ (e) => e.name === "TradeEvent" && !(e.data as { is_buy: boolean }).is_buy,+ );+ expect(ev).toBeDefined();+ expect((ev!.data as { is_buy: boolean }).is_buy).toBe(false);+ });++ it("decoded trade-buy mint matches fixture expected", () => {+ const { logMessages, expected } = loadFixture("trade-buy");+ const events = parser.parseLogs(logMessages);+ const ev = events.find((e) => e.name === "TradeEvent") as+ | ParsedPumpEvent<"TradeEvent">+ | undefined;+ expect(ev).toBeDefined();+ expect((ev!.data.mint as PublicKey).toBase58()).toBe(expected.data.mint);+ });++ it("decoded trade-buy sol_amount is a non-zero BN", () => {+ const { logMessages } = loadFixture("trade-buy");+ const events = parser.parseLogs(logMessages);+ const ev = events.find(+ (e) => e.name === "TradeEvent" && (e.data as { is_buy: boolean }).is_buy,+ ) as ParsedPumpEvent<"TradeEvent"> | undefined;+ expect(ev).toBeDefined();+ // BN is an object with a `words` array; verify it converts to a positive int+ const solAmt = ev!.data.sol_amount;+ expect(solAmt).toBeTruthy();+ expect(Number(solAmt.toString()) > 0).toBe(true);+ });++ it("ignores log lines without Program data: prefix", () => {+ const events = parser.parseLogs([+ "Program log: something",+ "Program invoke [1]",+ "Program 6EF8rrec... success",+ ]);+ expect(events).toHaveLength(0);+ });++ it("ignores base64 with unknown discriminator", () => {+ // 8 zero bytes + empty payload — won't match any event+ const unknown = Buffer.alloc(8).toString("base64");+ const events = parser.parseLogs([`Program data: ${unknown}`]);+ expect(events).toHaveLength(0);+ });++ it("empty logs array returns empty array", () => {+ expect(parser.parseLogs([])).toHaveLength(0);+ });+});++// ─── subscribeToPumpEvents ────────────────────────────────────────────────────++describe("subscribeToPumpEvents", () => {+ it("calls onEvent with parsed events from stubbed connection", async () => {+ const { logMessages, expected } = loadFixture("trade-sell");++ let capturedCallback: ((logs: unknown, ctx: unknown) => void) | null = null;+ const mockConn = {+ onLogs: vi.fn((_id: unknown, cb: (logs: unknown, ctx: unknown) => void) => {+ capturedCallback = cb;+ return 42; // subscription id+ }),+ removeOnLogsListener: vi.fn(() => Promise.resolve()),+ };++ const received: ParsedPumpEvent[] = [];+ const sub = subscribeToPumpEvents(+ mockConn,+ { programId: PUMP_BONDING_CURVE_PROGRAM_ID },+ (ev) => received.push(ev),+ );++ // Fire the stub callback with the real fixture logs+ capturedCallback!({ logs: logMessages, err: null, signature: expected.name }, { slot: 12345 });++ expect(received.length).toBeGreaterThan(0);+ expect(received.some((e) => e.name === "TradeEvent")).toBe(true);+ });++ it("unsubscribe is idempotent: calling twice does not throw", async () => {+ const mockConn = {+ onLogs: vi.fn(() => 99),+ removeOnLogsListener: vi.fn(() => Promise.resolve()),+ };+ const sub = subscribeToPumpEvents(mockConn, {}, vi.fn());+ await sub.unsubscribe();+ await sub.unsubscribe(); // second call — must not throw+ expect(mockConn.removeOnLogsListener).toHaveBeenCalledTimes(1);+ });++ it("mint filter: only emits events whose mint field matches", () => {+ const { logMessages, expected } = loadFixture("trade-sell");+ const targetMint = new PublicKey(expected.data.mint as string);+ const differentMint = new PublicKey(+ "So11111111111111111111111111111111111111112",+ );++ let capturedCallback: ((logs: unknown, ctx: unknown) => void) | null = null;+ const mockConn = {+ onLogs: vi.fn((_: unknown, cb: (logs: unknown, ctx: unknown) => void) => {+ capturedCallback = cb;+ return 1;+ }),+ removeOnLogsListener: vi.fn(() => Promise.resolve()),+ };++ const matchingEvents: ParsedPumpEvent[] = [];+ const sub = subscribeToPumpEvents(+ mockConn,+ { mint: targetMint },+ (ev) => matchingEvents.push(ev),+ );+ capturedCallback!(+ { logs: logMessages, err: null, signature: "sig1" },+ { slot: 1 },+ );+ expect(matchingEvents.length).toBeGreaterThan(0);++ const filteredEvents: ParsedPumpEvent[] = [];+ const sub2 = subscribeToPumpEvents(+ mockConn,+ { mint: differentMint },+ (ev) => filteredEvents.push(ev),+ );+ capturedCallback!(+ { logs: logMessages, err: null, signature: "sig2" },+ { slot: 2 },+ );+ expect(filteredEvents).toHaveLength(0);+ });++ it("skips errored log callbacks", () => {+ const { logMessages } = loadFixture("create");+ let capturedCallback: ((logs: unknown, ctx: unknown) => void) | null = null;+ const mockConn = {+ onLogs: vi.fn((_: unknown, cb: (logs: unknown, ctx: unknown) => void) => {+ capturedCallback = cb;+ return 1;+ }),+ removeOnLogsListener: vi.fn(() => Promise.resolve()),+ };++ const received: ParsedPumpEvent[] = [];+ subscribeToPumpEvents(mockConn, {}, (ev) => received.push(ev));++ // err != null → should be ignored+ capturedCallback!({ logs: logMessages, err: new Error("oops"), signature: "" }, { slot: 1 });+ expect(received).toHaveLength(0);+ });+});diff --git a/agent-payments-sdk/src/solana/pump-events.ts b/agent-payments-sdk/src/solana/pump-events.tsnew file mode 100644index 000000000..d572dbf49--- /dev/null+++ b/agent-payments-sdk/src/solana/pump-events.ts@@ -0,0 +1,432 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * Typed event parser and live subscriber for the pump.fun bonding-curve+ * program (`6EF8rrec...`).+ *+ * Intentionally separate from `./events.ts` which targets the+ * `agent-payments` program. Both programs emit Anchor `emit_cpi!` events+ * but their IDLs are completely different.+ *+ * NOTE: BorshEventCoder returns field names in the snake_case form that+ * appears in the IDL (e.g. `is_buy`, `sol_amount`). Interfaces here mirror+ * that casing so TypeScript types match the runtime values exactly.+ *+ * IDL source: swap/node_modules/@pump-fun/pump-sdk/src/idl/pump.json+ * (the runtime IDL has more fields than pump-public-docs/idl/pump.json).+ */++import {+ PublicKey,+ type Commitment,+ type Connection,+ type Logs,+} from "@solana/web3.js";+import { BN } from "@coral-xyz/anchor";+import { BorshEventCoder } from "@coral-xyz/anchor/dist/cjs/coder/borsh/event.js";+import type { Idl } from "@coral-xyz/anchor";++import IDL_JSON from "./idl/pump.json";++// ─── Program constant ────────────────────────────────────────────────────────++/** The pump.fun bonding-curve program id. */+export const PUMP_BONDING_CURVE_PROGRAM_ID = new PublicKey(IDL_JSON.address);++// ─── Typed event data interfaces ─────────────────────────────────────────────+// Field names and types are derived from the runtime IDL (pump.json).+// Pubkey fields: PublicKey; u64/i64: BN; bool: boolean; string: string.++export interface Shareholder {+ address: PublicKey;+ share_bps: number;+}++export interface AdminSetCreatorEventData {+ timestamp: BN;+ admin_set_creator_authority: PublicKey;+ mint: PublicKey;+ bonding_curve: PublicKey;+ old_creator: PublicKey;+ new_creator: PublicKey;+}++export interface AdminSetIdlAuthorityEventData {+ idl_authority: PublicKey;+}++export interface AdminUpdateTokenIncentivesEventData {+ start_time: BN;+ end_time: BN;+ day_number: BN;+ token_supply_per_day: BN;+ mint: PublicKey;+ seconds_in_a_day: BN;+ timestamp: BN;+}++export interface ClaimCashbackEventData {+ user: PublicKey;+ amount: BN;+ timestamp: BN;+ total_claimed: BN;+ total_cashback_earned: BN;+}++export interface ClaimTokenIncentivesEventData {+ user: PublicKey;+ mint: PublicKey;+ amount: BN;+ timestamp: BN;+ total_claimed_tokens: BN;+ current_sol_volume: BN;+}++export interface CloseUserVolumeAccumulatorEventData {+ user: PublicKey;+ timestamp: BN;+ total_unclaimed_tokens: BN;+ total_claimed_tokens: BN;+ current_sol_volume: BN;+ last_update_timestamp: BN;+}++export interface CollectCreatorFeeEventData {+ timestamp: BN;+ creator: PublicKey;+ creator_fee: BN;+}++export interface CompleteEventData {+ user: PublicKey;+ mint: PublicKey;+ bonding_curve: PublicKey;+ timestamp: BN;+ quote_mint: PublicKey;+}++export interface CompletePumpAmmMigrationEventData {+ user: PublicKey;+ mint: PublicKey;+ mint_amount: BN;+ sol_amount: BN;+ pool_migration_fee: BN;+ bonding_curve: PublicKey;+ timestamp: BN;+ pool: PublicKey;+}++export interface CreateEventData {+ name: string;+ symbol: string;+ uri: string;+ mint: PublicKey;+ bonding_curve: PublicKey;+ user: PublicKey;+ creator: PublicKey;+ timestamp: BN;+ virtual_token_reserves: BN;+ virtual_sol_reserves: BN;+ real_token_reserves: BN;+ token_total_supply: BN;+ token_program: PublicKey;+ is_mayhem_mode: boolean;+ is_cashback_enabled: boolean;+ quote_mint: PublicKey;+ virtual_quote_reserves: BN;+}++export interface DistributeCreatorFeesEventData {+ timestamp: BN;+ mint: PublicKey;+ bonding_curve: PublicKey;+ sharing_config: PublicKey;+ admin: PublicKey;+ shareholders: Shareholder[];+ distributed: BN;+}++export interface ExtendAccountEventData {+ account: PublicKey;+ user: PublicKey;+ current_size: BN;+ new_size: BN;+ timestamp: BN;+}++export interface InitUserVolumeAccumulatorEventData {+ payer: PublicKey;+ user: PublicKey;+ timestamp: BN;+}++export interface MigrateBondingCurveCreatorEventData {+ timestamp: BN;+ mint: PublicKey;+ bonding_curve: PublicKey;+ sharing_config: PublicKey;+ old_creator: PublicKey;+ new_creator: PublicKey;+}++export interface MinimumDistributableFeeEventData {+ minimum_required: BN;+ distributable_fees: BN;+ can_distribute: boolean;+}++export interface ReservedFeeRecipientsEventData {+ timestamp: BN;+ reserved_fee_recipient: PublicKey;+ reserved_fee_recipients: PublicKey[];+}++export interface SetCreatorEventData {+ timestamp: BN;+ mint: PublicKey;+ bonding_curve: PublicKey;+ creator: PublicKey;+}++export interface SetMetaplexCreatorEventData {+ timestamp: BN;+ mint: PublicKey;+ bonding_curve: PublicKey;+ metadata: PublicKey;+ creator: PublicKey;+}++export interface SetParamsEventData {+ initial_virtual_token_reserves: BN;+ initial_virtual_sol_reserves: BN;+ initial_real_token_reserves: BN;+ final_real_sol_reserves: BN;+ token_total_supply: BN;+ fee_basis_points: BN;+ withdraw_authority: PublicKey;+ enable_migrate: boolean;+ pool_migration_fee: BN;+ creator_fee_basis_points: BN;+ fee_recipients: PublicKey[];+ timestamp: BN;+ set_creator_authority: PublicKey;+ admin_set_creator_authority: PublicKey;+}++export interface SyncUserVolumeAccumulatorEventData {+ user: PublicKey;+ total_claimed_tokens_before: BN;+ total_claimed_tokens_after: BN;+ timestamp: BN;+}++export interface TradeEventData {+ mint: PublicKey;+ sol_amount: BN;+ token_amount: BN;+ is_buy: boolean;+ user: PublicKey;+ timestamp: BN;+ virtual_sol_reserves: BN;+ virtual_token_reserves: BN;+ real_sol_reserves: BN;+ real_token_reserves: BN;+ fee_recipient: PublicKey;+ fee_basis_points: BN;+ fee: BN;+ creator: PublicKey;+ creator_fee_basis_points: BN;+ creator_fee: BN;+ track_volume: boolean;+ total_unclaimed_tokens: BN;+ total_claimed_tokens: BN;+ current_sol_volume: BN;+ last_update_timestamp: BN;+ ix_name: string;+ mayhem_mode: boolean;+ cashback_fee_basis_points: BN;+ cashback: BN;+ buyback_fee_basis_points: BN;+ buyback_fee: BN;+ shareholders: Shareholder[];+ quote_mint: PublicKey;+ quote_amount: BN;+ virtual_quote_reserves: BN;+ real_quote_reserves: BN;+}++export interface UpdateGlobalAuthorityEventData {+ global: PublicKey;+ authority: PublicKey;+ new_authority: PublicKey;+ timestamp: BN;+}++export interface UpdateMayhemVirtualParamsEventData {+ timestamp: BN;+ mint: PublicKey;+ virtual_token_reserves: BN;+ virtual_sol_reserves: BN;+ new_virtual_token_reserves: BN;+ new_virtual_sol_reserves: BN;+ real_token_reserves: BN;+ real_sol_reserves: BN;+}++// ─── Discriminated map ───────────────────────────────────────────────────────++export interface PumpEventDataMap {+ AdminSetCreatorEvent: AdminSetCreatorEventData;+ AdminSetIdlAuthorityEvent: AdminSetIdlAuthorityEventData;+ AdminUpdateTokenIncentivesEvent: AdminUpdateTokenIncentivesEventData;+ ClaimCashbackEvent: ClaimCashbackEventData;+ ClaimTokenIncentivesEvent: ClaimTokenIncentivesEventData;+ CloseUserVolumeAccumulatorEvent: CloseUserVolumeAccumulatorEventData;+ CollectCreatorFeeEvent: CollectCreatorFeeEventData;+ CompleteEvent: CompleteEventData;+ CompletePumpAmmMigrationEvent: CompletePumpAmmMigrationEventData;+ CreateEvent: CreateEventData;+ DistributeCreatorFeesEvent: DistributeCreatorFeesEventData;+ ExtendAccountEvent: ExtendAccountEventData;+ InitUserVolumeAccumulatorEvent: InitUserVolumeAccumulatorEventData;+ MigrateBondingCurveCreatorEvent: MigrateBondingCurveCreatorEventData;+ MinimumDistributableFeeEvent: MinimumDistributableFeeEventData;+ ReservedFeeRecipientsEvent: ReservedFeeRecipientsEventData;+ SetCreatorEvent: SetCreatorEventData;+ SetMetaplexCreatorEvent: SetMetaplexCreatorEventData;+ SetParamsEvent: SetParamsEventData;+ SyncUserVolumeAccumulatorEvent: SyncUserVolumeAccumulatorEventData;+ TradeEvent: TradeEventData;+ UpdateGlobalAuthorityEvent: UpdateGlobalAuthorityEventData;+ UpdateMayhemVirtualParamsEvent: UpdateMayhemVirtualParamsEventData;+}++export type PumpEventName = keyof PumpEventDataMap;++export interface ParsedPumpEvent<E extends PumpEventName = PumpEventName> {+ name: E;+ data: PumpEventDataMap[E];+ signature?: string;+ slot?: number;+}++// ─── Discriminator map ───────────────────────────────────────────────────────++/** Maps each IDL event name to its 8-byte discriminator Buffer. */+export const eventDiscriminatorMap: Map<PumpEventName, Buffer> = new Map(+ IDL_JSON.events.map((ev) => [+ ev.name as PumpEventName,+ Buffer.from(ev.discriminator),+ ]),+);++// Invariant: every IDL event must be in the map — fires at module load.+if (eventDiscriminatorMap.size !== IDL_JSON.events.length) {+ throw new Error(+ `pump-events: discriminator map size (${eventDiscriminatorMap.size}) ` ++ `!= IDL events length (${IDL_JSON.events.length})`,+ );+}++// ─── Parser ──────────────────────────────────────────────────────────────────++const PROGRAM_DATA_PREFIX = "Program data: ";++export interface PumpEventParser {+ /**+ * Decode transaction log messages into typed pump events.+ * Lines not starting with `Program data: `, or with an unknown+ * discriminator, are silently ignored.+ */+ parseLogs(logs: string[]): ParsedPumpEvent[];+}++export function createPumpEventParser(): PumpEventParser {+ const coder = new BorshEventCoder(IDL_JSON as unknown as Idl);++ return {+ parseLogs(logs: string[]): ParsedPumpEvent[] {+ const out: ParsedPumpEvent[] = [];+ for (const line of logs) {+ if (!line.startsWith(PROGRAM_DATA_PREFIX)) continue;+ const b64 = line.slice(PROGRAM_DATA_PREFIX.length);+ const decoded = coder.decode(b64);+ if (!decoded) continue;+ out.push({+ name: decoded.name as PumpEventName,+ data: decoded.data as PumpEventDataMap[PumpEventName],+ });+ }+ return out;+ },+ };+}++// ─── Subscription ────────────────────────────────────────────────────────────++export interface SubscribePumpEventsOptions {+ /** Filter events that carry a `mint` field matching this key. */+ mint?: PublicKey;+ /** Override the bonding-curve program id. */+ programId?: PublicKey;+ /** Commitment level (default: `confirmed`). */+ commitment?: Commitment;+}++export interface PumpEventSubscription {+ /** Stop listening. Idempotent — safe to call multiple times. */+ unsubscribe: () => Promise<void>;+}++/** Narrow subset of `Connection` used here; makes unit-testing easy. */+export type LogsSubscriber = Pick<Connection, "onLogs" | "removeOnLogsListener">;++/**+ * Subscribe to real-time pump bonding-curve program events via WebSocket.+ *+ * @example+ * ```ts+ * const sub = subscribeToPumpEvents(connection, { mint }, (ev) => {+ * if (ev.name === "TradeEvent") console.log(ev.data.sol_amount.toString());+ * });+ * await sub.unsubscribe();+ * ```+ */+export function subscribeToPumpEvents(+ connection: LogsSubscriber,+ options: SubscribePumpEventsOptions,+ onEvent: (event: ParsedPumpEvent) => void,+): PumpEventSubscription {+ const programId = options.programId ?? PUMP_BONDING_CURVE_PROGRAM_ID;+ const commitment = options.commitment ?? "confirmed";+ const parser = createPumpEventParser();++ const subId = connection.onLogs(+ programId,+ (logsCb: Logs, ctx: { slot: number }) => {+ if (logsCb.err) return;+ for (const ev of parser.parseLogs(logsCb.logs)) {+ if (options.mint) {+ const m = (ev.data as { mint?: PublicKey }).mint;+ if (!(m instanceof PublicKey) || !m.equals(options.mint)) continue;+ }+ ev.signature = logsCb.signature;+ ev.slot = ctx.slot;+ onEvent(ev);+ }+ },+ commitment,+ );++ let unsubscribed = false;+ return {+ async unsubscribe() {+ if (unsubscribed) return;+ unsubscribed = true;+ const id = await Promise.resolve(subId);+ await connection.removeOnLogsListener(id);+ },+ };+}diff --git a/agent-payments-sdk/src/solana-agent-kit/actions.ts b/agent-payments-sdk/src/solana/solana-agent-kit/actions.tssimilarity index 99%rename from agent-payments-sdk/src/solana-agent-kit/actions.tsrename to agent-payments-sdk/src/solana/solana-agent-kit/actions.tsindex a9d579e33..8b4c5791b 100644--- a/agent-payments-sdk/src/solana-agent-kit/actions.ts+++ b/agent-payments-sdk/src/solana/solana-agent-kit/actions.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+import { z } from "zod";import {PublicKey,diff --git a/agent-payments-sdk/src/solana-agent-kit/index.ts b/agent-payments-sdk/src/solana/solana-agent-kit/index.tssimilarity index 97%rename from agent-payments-sdk/src/solana-agent-kit/index.tsrename to agent-payments-sdk/src/solana/solana-agent-kit/index.tsindex 13945ee23..d0ec5ab18 100644--- a/agent-payments-sdk/src/solana-agent-kit/index.ts+++ b/agent-payments-sdk/src/solana/solana-agent-kit/index.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+/*** solana-agent-kit plugin for @pump-fun/agent-payments-sdk*diff --git a/agent-payments-sdk/src/solana-agent-kit/types.ts b/agent-payments-sdk/src/solana/solana-agent-kit/types.tssimilarity index 88%rename from agent-payments-sdk/src/solana-agent-kit/types.tsrename to agent-payments-sdk/src/solana/solana-agent-kit/types.tsindex c81ffd36b..cced153b7 100644--- a/agent-payments-sdk/src/solana-agent-kit/types.ts+++ b/agent-payments-sdk/src/solana/solana-agent-kit/types.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+import type { Connection, Keypair, PublicKey } from "@solana/web3.js";import type { z } from "zod";diff --git a/agent-payments-sdk/src/solana/types.ts b/agent-payments-sdk/src/solana/types.tsnew file mode 100644index 000000000..ab5982053--- /dev/null+++ b/agent-payments-sdk/src/solana/types.ts@@ -0,0 +1,253 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { AccountMeta, PublicKey } from "@solana/web3.js";+import type { BN } from "@coral-xyz/anchor";++// ─── Environment ────────────────────────────────────────────────────────────++export type PumpEnvironment = "devnet" | "mainnet";++// ─── Vault / Balance types ──────────────────────────────────────────────────++export interface VaultBalance {+ address: PublicKey;+ balance: bigint;+}++export interface AgentBalances {+ /** Currency mint these vaults hold (NATIVE_MINT for SOL, or any SPL mint). */+ quoteMint: PublicKey;+ /** ATA of the TokenAgentPayments PDA (incoming payments land here) */+ paymentVault: VaultBalance;+ /** ATA of the Buyback Authority PDA */+ buybackVault: VaultBalance;+ /** ATA of the Withdraw Authority PDA */+ withdrawVault: VaultBalance;+}++// ─── Instruction parameter interfaces ───────────────────────────────────────++export interface CreateParams {+ /** Signer – must be the bonding-curve creator for this mint */+ authority: PublicKey;+ /** The token mint this agent manages */+ mint: PublicKey;+ /** The pubkey that will act as the agent authority (for withdraw / update) */+ agentAuthority: PublicKey;+ /** Basis points allocated to buyback (0–10 000) */+ buybackBps: number;+}++export interface WithdrawParams {+ /** Agent authority signer */+ authority: PublicKey;+ /** Currency mint to withdraw */+ currencyMint: PublicKey;+ /** Receiver's token account for the currency */+ receiverAta: PublicKey;+ /** Token program for the currency mint (defaults to TOKEN_PROGRAM_ID) */+ tokenProgram?: PublicKey;+}++export interface UpdateBuybackBpsParams {+ /** Agent authority signer */+ authority: PublicKey;+ /** New buyback basis points (0–10 000) */+ buybackBps: number;+}++export interface UpdateBuybackBpsOptions {+ /** Supported currencies and their token programs */+ supportedCurrencies: {+ mint: PublicKey;+ tokenProgram: PublicKey;+ }[];+}++export interface AcceptPaymentParams {+ /** Payer / user signer */+ user: PublicKey;+ /** User's token account holding the currency */+ userTokenAccount: PublicKey;+ /** The currency mint being paid */+ currencyMint: PublicKey;+ amount: BN;+ memo: BN;+ startTime: BN;+ endTime: BN;+ /** Token program for the currency mint (defaults to TOKEN_PROGRAM_ID) */+ tokenProgram?: PublicKey;+}++export interface AcceptPaymentSimpleParams {+ user: PublicKey;+ userTokenAccount: PublicKey;+ currencyMint: PublicKey;+ amount: bigint | number | string;+ memo: bigint | number | string;+ startTime: bigint | number | string;+ endTime: bigint | number | string;+ tokenProgram?: PublicKey;+ /** Compute unit limit (defaults to 130_000) */+ computeUnitLimit?: number;+ /** Priority fee in micro lamports per compute unit (defaults to 1_000) */+ computeUnitPrice?: number;+}++export interface BuildAcceptPaymentParams {+ user: PublicKey;+ currencyMint: PublicKey;+ amount: bigint | number | string;+ memo: bigint | number | string;+ startTime: bigint | number | string;+ endTime: bigint | number | string;+ tokenProgram?: PublicKey;+ /** Compute unit limit for the transaction (defaults to 100_000) */+ computeUnitLimit?: number;+ /** Priority fee in microlamports per compute unit. If provided, a SetComputeUnitPrice instruction is prepended. */+ computeUnitPrice?: number;+}++export interface DistributePaymentsParams {+ /** Any signer (permissionless) */+ user: PublicKey;+ /** Currency mint to distribute */+ currencyMint: PublicKey;+ /** Token program for the currency mint (defaults to TOKEN_PROGRAM_ID) */+ tokenProgram?: PublicKey;+ /**+ * For native SOL only: prepend `agentTransferExtraLamports` before distribute.+ * Default is false.+ */+ includeTransferExtraLamportsForNative?: boolean;+}++export interface BuybackTriggerParams {+ /** Must match globalConfig.buybackAuthority */+ globalBuybackAuthority: PublicKey;+ /** The currency mint used for the swap (tracks per-currency buyback accounting) */+ currencyMint: PublicKey;+ /** Swap program to CPI into (must be in the allowed list) */+ swapProgramToInvoke: PublicKey;+ /** Serialised swap instruction data (pass empty Buffer to skip swap & just burn) */+ swapInstructionData: Buffer;+ /** All accounts the swap instruction requires */+ remainingAccounts: AccountMeta[];+ /** Token program for the currency mint (defaults to TOKEN_PROGRAM_ID) */+ tokenProgramCurrency?: PublicKey;+ /** Token program for the agent token mint (defaults to TOKEN_PROGRAM_ID) */+ tokenProgram?: PublicKey;+}++export interface ExtendAccountParams {+ /** Account to extend (must be a supported account type on-chain) */+ account: PublicKey;+ /** Signer paying rent for extension */+ user: PublicKey;+}++export interface UpdateAuthorityParams {+ /** Current agent authority signer (or protocol authority for recovery) */+ authority: PublicKey;+ /** The new authority pubkey to set */+ newAuthority: PublicKey;+}++export interface CloseAccountParams {+ /** The account to close (TokenAgentPayments, PaymentInCurrency, etc.) */+ account: PublicKey;+ /** Signer who receives the reclaimed rent lamports */+ user: PublicKey;+}++// ─── Decoded account types (derived from the Anchor program) ────────────────++import { OFFLINE_PUMP_PROGRAM } from "./program";++export type GlobalConfig = Awaited<+ ReturnType<typeof OFFLINE_PUMP_PROGRAM.account.GlobalConfig.fetch>+>;++export type TokenAgentPaymentInCurrency = Awaited<+ ReturnType<typeof OFFLINE_PUMP_PROGRAM.account.TokenAgentPaymentInCurrency.fetch>+>;++export type TokenAgentPayments = Awaited<+ ReturnType<typeof OFFLINE_PUMP_PROGRAM.account.TokenAgentPayments.fetch>+>;++// ─── PumpTradeClient (v2 bonding-curve trading) ─────────────────────────────++import type { TransactionInstruction } from "@solana/web3.js";++/** Result of `buildBuyInstructions` (buy_v2). */+export interface BuyResult {+ instructions: TransactionInstruction[];+ /** Resolved quote mint (NATIVE_MINT for legacy SOL coins, USDC for USDC coins). */+ quoteMint: PublicKey;+ /** SPL token program owning `quoteMint`. */+ quoteTokenProgram: PublicKey;+ /** Expected base tokens received before slippage protection. */+ expectedBaseTokens: BN;+ /**+ * Quote required for `expectedBaseTokens` after the on-curve fee bump.+ * Matches the `quoteAmount` value passed to the program.+ */+ preciseQuoteAmount: BN;+ /** Fee recipient picked for this transaction. */+ feeRecipient: PublicKey;+ /** Buyback fee recipient picked for this transaction. */+ buybackFeeRecipient: PublicKey;+}++/** Result of `buildSellInstructions` (sell_v2). */+export interface SellResult {+ instructions: TransactionInstruction[];+ quoteMint: PublicKey;+ quoteTokenProgram: PublicKey;+ /** Expected quote received before slippage protection. */+ expectedQuoteOut: BN;+}++/** Result of `buildBuyExactQuoteInInstructions` (buy_exact_quote_in_v2). */+export interface ExactQuoteResult {+ instructions: TransactionInstruction[];+ quoteMint: PublicKey;+ quoteTokenProgram: PublicKey;+}++/** Preview of a buy without sending. */+export interface BuyQuote {+ quoteMint: PublicKey;+ quoteTokenProgram: PublicKey;+ /** Quote requested by the caller. */+ quoteAmount: BN;+ /** Expected base tokens at current curve state. */+ expectedBaseTokens: BN;+ /** Quote required for `expectedBaseTokens` (round-tripped through the curve). */+ preciseQuoteAmount: BN;+ /** Maximum quote the user will spend including the slippage cap. */+ maxQuoteCost: BN;+ /** Slippage cap as a percent (e.g. 5 = 5%). */+ slippagePct: number;+ /** Price impact in percent, clamped to [0, 100]. */+ priceImpactPct: number;+}++/** Preview of a sell without sending. */+export interface SellQuote {+ quoteMint: PublicKey;+ quoteTokenProgram: PublicKey;+ /** Base tokens to be sold. */+ baseAmount: BN;+ /** Expected quote out at current curve state. */+ expectedQuoteOut: BN;+ /** Minimum quote the user will accept including the slippage cap. */+ minQuoteOut: BN;+ /** Slippage cap as a percent (e.g. 5 = 5%). */+ slippagePct: number;+ /** Price impact in percent, clamped to [0, 100]. */+ priceImpactPct: number;+}diff --git a/agent-payments-sdk/src/x402/client.ts b/agent-payments-sdk/src/solana/x402/client.tssimilarity index 98%rename from agent-payments-sdk/src/x402/client.tsrename to agent-payments-sdk/src/solana/x402/client.tsindex 39237fe00..1b8c3b955 100644--- a/agent-payments-sdk/src/x402/client.ts+++ b/agent-payments-sdk/src/solana/x402/client.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+/*** x402 v2 Client – automatic 402 handling*diff --git a/agent-payments-sdk/src/x402/facilitator.ts b/agent-payments-sdk/src/solana/x402/facilitator.tssimilarity index 99%rename from agent-payments-sdk/src/x402/facilitator.tsrename to agent-payments-sdk/src/solana/x402/facilitator.tsindex a390210fc..2e5d1462f 100644--- a/agent-payments-sdk/src/x402/facilitator.ts+++ b/agent-payments-sdk/src/solana/x402/facilitator.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+/*** x402 v2 Facilitator & Resource Server*diff --git a/agent-payments-sdk/src/x402/headers.ts b/agent-payments-sdk/src/solana/x402/headers.tssimilarity index 95%rename from agent-payments-sdk/src/x402/headers.tsrename to agent-payments-sdk/src/solana/x402/headers.tsindex b3e5ae005..980376741 100644--- a/agent-payments-sdk/src/x402/headers.ts+++ b/agent-payments-sdk/src/solana/x402/headers.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+/*** x402 v2 Header encoding / decoding*diff --git a/agent-payments-sdk/src/solana/x402/index.ts b/agent-payments-sdk/src/solana/x402/index.tsnew file mode 100644index 000000000..457ec1e45--- /dev/null+++ b/agent-payments-sdk/src/solana/x402/index.ts@@ -0,0 +1,72 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++/**+ * x402 v2 – HTTP 402 Payment Required protocol for Pump Agent Payments+ *+ * Aligned with the coinbase/x402 v2 specification.+ * @see https://github.com/coinbase/x402+ *+ * Server-side: PumpAgentFacilitator, createResourceServer, buildPumpAgentRequirements+ * Client-side: createX402Fetch+ * Helpers: encode/decode headers, constants+ */++// Types+export type {+ PaymentScheme,+ ExactScheme,+ PumpAgentScheme,+ ResourceInfo,+ PaymentRequirementsBase,+ ExactPaymentRequirements,+ PumpAgentPaymentRequirements,+ PaymentRequirements,+ PaymentRequired,+ PaymentPayload,+ VerifyResponse,+ SettleResponse,+ SupportedKind,+ SupportedResponse,+ FacilitatorClient,+ PaymentResponse,+ ResourceServerConfig,+ X402ClientConfig,+ TransactionSigner,+ TransactionSender,+} from "./types";+export {+ X402_VERSION,+ X402_HEADER_PAYMENT_REQUIRED,+ X402_HEADER_PAYMENT_SIGNATURE,+ X402_HEADER_PAYMENT_RESPONSE,+ SOLANA_MAINNET,+ SOLANA_DEVNET,+ USDC_MAINNET,+ USDC_DEVNET,+} from "./types";++// Headers+export {+ encodePaymentRequired,+ decodePaymentRequired,+ encodePaymentPayload,+ decodePaymentPayload,+ encodePaymentResponse,+ decodePaymentResponse,+ getPaymentRequiredFromResponse,+ getPaymentPayloadFromRequest,+ getPaymentResponseFromResponse,+} from "./headers";++// Facilitator+export type { PumpAgentFacilitatorConfig, PumpAgentRequirementsConfig } from "./facilitator";+export {+ PumpAgentFacilitator,+ buildPumpAgentRequirements,+ createResourceServer,+} from "./facilitator";++// Client+export { createX402Fetch } from "./client";diff --git a/agent-payments-sdk/src/x402/types.ts b/agent-payments-sdk/src/solana/x402/types.tssimilarity index 98%rename from agent-payments-sdk/src/x402/types.tsrename to agent-payments-sdk/src/solana/x402/types.tsindex a523745c5..8d622bdab 100644--- a/agent-payments-sdk/src/x402/types.ts+++ b/agent-payments-sdk/src/solana/x402/types.ts@@ -1,3 +1,7 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+/*** x402 v2 Protocol Types*diff --git a/agent-payments-sdk/src/types.ts b/agent-payments-sdk/src/types.tsindex 9146788ae..d83edc62a 100644--- a/agent-payments-sdk/src/types.ts+++ b/agent-payments-sdk/src/types.ts@@ -1,173 +1,102 @@-import type { AccountMeta, PublicKey } from "@solana/web3.js";-import type { BN } from "@coral-xyz/anchor";--// ─── Environment ────────────────────────────────────────────────────────────--export type PumpEnvironment = "devnet" | "mainnet";--// ─── Vault / Balance types ──────────────────────────────────────────────────--export interface VaultBalance {- address: PublicKey;- balance: bigint;-}--export interface AgentBalances {- /** ATA of the TokenAgentPayments PDA (incoming payments land here) */- paymentVault: VaultBalance;- /** ATA of the Buyback Authority PDA */- buybackVault: VaultBalance;- /** ATA of the Withdraw Authority PDA */- withdrawVault: VaultBalance;-}--// ─── Instruction parameter interfaces ───────────────────────────────────────--export interface CreateParams {- /** Signer – must be the bonding-curve creator for this mint */- authority: PublicKey;- /** The token mint this agent manages */- mint: PublicKey;- /** The pubkey that will act as the agent authority (for withdraw / update) */- agentAuthority: PublicKey;- /** Basis points allocated to buyback (0–10 000) */- buybackBps: number;-}--export interface WithdrawParams {- /** Agent authority signer */- authority: PublicKey;- /** Currency mint to withdraw */- currencyMint: PublicKey;- /** Receiver's token account for the currency */- receiverAta: PublicKey;- /** Token program for the currency mint (defaults to TOKEN_PROGRAM_ID) */- tokenProgram?: PublicKey;-}--export interface UpdateBuybackBpsParams {- /** Agent authority signer */- authority: PublicKey;- /** New buyback basis points (0–10 000) */- buybackBps: number;+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { Address, Hash, Hex } from "viem";++export type SupportedEvmChainId =+ | 1 // Ethereum+ | 8453 // Base+ | 42161 // Arbitrum One+ | 137 // Polygon+ | 56 // BNB Smart Chain+ | 43114; // Avalanche++export interface EvmChainConfig {+ id: SupportedEvmChainId;+ name: string;+ rpcUrl: string;+ blockExplorer: string;+ nativeCurrency: { name: string; symbol: string; decimals: number };+ usdc: Address;+ /** MoonPay network identifier for deposit routing */+ moonpayNetwork: string;}-export interface UpdateBuybackBpsOptions {- /** Supported currencies and their token programs */- supportedCurrencies: {- mint: PublicKey;- tokenProgram: PublicKey;- }[];+/** A cross-chain payment quote returned before the user signs anything. */+export interface CrossChainQuote {+ /** Chain the user is paying from */+ fromChainId: SupportedEvmChainId;+ /** Token the user is paying with (address or "native") */+ fromToken: Address | "native";+ /** Amount the user sends, in the fromToken's smallest unit */+ fromAmount: bigint;+ /** Amount the agent vault receives in USDC on Solana (6 decimals) */+ toAmountUsdc: bigint;+ /** Estimated USD value of the payment */+ estimatedUsd: number;+ /** Bridge/routing fee in USD */+ bridgeFeeUsd: number;+ /** Estimated seconds for funds to arrive on Solana */+ estimatedTimeSeconds: number;+ /** Opaque ID used to track this quote through to settlement */+ quoteId: string;+ /** Unix timestamp after which this quote expires */+ expiresAt: number;}-export interface AcceptPaymentParams {- /** Payer / user signer */- user: PublicKey;- /** User's token account holding the currency */- userTokenAccount: PublicKey;- /** The currency mint being paid */- currencyMint: PublicKey;- amount: BN;- memo: BN;- startTime: BN;- endTime: BN;- /** Token program for the currency mint (defaults to TOKEN_PROGRAM_ID) */- tokenProgram?: PublicKey;+/** Parameters for building the EVM-side payment transaction. */+export interface EvmPaymentParams {+ quote: CrossChainQuote;+ /** Solana agent token mint address (base58) */+ agentMint: string;+ /** Solana wallet address that will be credited (base58) */+ destinationSolanaWallet: string;+ /** Arbitrary memo / invoice identifier (u64 as string) */+ memo: string;+ /** EVM payer address */+ sender: Address;}-export interface AcceptPaymentSimpleParams {- user: PublicKey;- userTokenAccount: PublicKey;- currencyMint: PublicKey;- amount: bigint | number | string;- memo: bigint | number | string;- startTime: bigint | number | string;- endTime: bigint | number | string;- tokenProgram?: PublicKey;- /** Compute unit limit (defaults to 130_000) */- computeUnitLimit?: number;- /** Priority fee in micro lamports per compute unit (defaults to 1_000) */- computeUnitPrice?: number;+/** The built EVM transaction(s) ready for the user to sign. */+export interface EvmPaymentTransaction {+ /** ERC-20 approval tx — undefined when paying with native ETH */+ approval?: {+ to: Address;+ data: Hex;+ value: bigint;+ };+ /** The bridge / swap transaction */+ bridge: {+ to: Address;+ data: Hex;+ value: bigint;+ chainId: SupportedEvmChainId;+ };}-export interface BuildAcceptPaymentParams {- user: PublicKey;- currencyMint: PublicKey;- amount: bigint | number | string;- memo: bigint | number | string;- startTime: bigint | number | string;- endTime: bigint | number | string;- tokenProgram?: PublicKey;- /** Compute unit limit for the transaction (defaults to 100_000) */- computeUnitLimit?: number;- /** Priority fee in microlamports per compute unit. If provided, a SetComputeUnitPrice instruction is prepended. */- computeUnitPrice?: number;+/** Result returned after the EVM transaction is confirmed. */+export interface EvmPaymentReceipt {+ txHash: Hash;+ chainId: SupportedEvmChainId;+ fromAmount: bigint;+ fromToken: Address | "native";+ /** MoonPay deposit/order ID for status polling */+ depositId: string;+ /** Estimated Solana arrival time as unix timestamp */+ estimatedArrivalAt: number;}-export interface DistributePaymentsParams {- /** Any signer (permissionless) */- user: PublicKey;- /** Currency mint to distribute */- currencyMint: PublicKey;- /** Token program for the currency mint (defaults to TOKEN_PROGRAM_ID) */- tokenProgram?: PublicKey;- /**- * For native SOL only: prepend `agentTransferExtraLamports` before distribute.- * Default is false.- */- includeTransferExtraLamportsForNative?: boolean;+/** Status of an in-flight cross-chain payment. */+export type CrossChainPaymentStatus =+ | "pending_evm_confirmation"+ | "bridging"+ | "arrived_on_solana"+ | "failed";++export interface CrossChainPaymentStatusResult {+ status: CrossChainPaymentStatus;+ depositId: string;+ solanaSignature?: string;+ error?: string;}--export interface BuybackTriggerParams {- /** Must match globalConfig.buybackAuthority */- globalBuybackAuthority: PublicKey;- /** The currency mint used for the swap (tracks per-currency buyback accounting) */- currencyMint: PublicKey;- /** Swap program to CPI into (must be in the allowed list) */- swapProgramToInvoke: PublicKey;- /** Serialised swap instruction data (pass empty Buffer to skip swap & just burn) */- swapInstructionData: Buffer;- /** All accounts the swap instruction requires */- remainingAccounts: AccountMeta[];- /** Token program for the currency mint (defaults to TOKEN_PROGRAM_ID) */- tokenProgramCurrency?: PublicKey;- /** Token program for the agent token mint (defaults to TOKEN_PROGRAM_ID) */- tokenProgram?: PublicKey;-}--export interface ExtendAccountParams {- /** Account to extend (must be a supported account type on-chain) */- account: PublicKey;- /** Signer paying rent for extension */- user: PublicKey;-}--export interface UpdateAuthorityParams {- /** Current agent authority signer (or protocol authority for recovery) */- authority: PublicKey;- /** The new authority pubkey to set */- newAuthority: PublicKey;-}--export interface CloseAccountParams {- /** The account to close (TokenAgentPayments, PaymentInCurrency, etc.) */- account: PublicKey;- /** Signer who receives the reclaimed rent lamports */- user: PublicKey;-}--// ─── Decoded account types (derived from the Anchor program) ────────────────--import { OFFLINE_PUMP_PROGRAM } from "./program";--export type GlobalConfig = Awaited<- ReturnType<typeof OFFLINE_PUMP_PROGRAM.account.GlobalConfig.fetch>->;--export type TokenAgentPaymentInCurrency = Awaited<- ReturnType<typeof OFFLINE_PUMP_PROGRAM.account.TokenAgentPaymentInCurrency.fetch>->;--export type TokenAgentPayments = Awaited<- ReturnType<typeof OFFLINE_PUMP_PROGRAM.account.TokenAgentPayments.fetch>->;diff --git a/agent-payments-sdk/src/x402/evm-client.ts b/agent-payments-sdk/src/x402/evm-client.tsnew file mode 100644index 000000000..acf0cdf33--- /dev/null+++ b/agent-payments-sdk/src/x402/evm-client.ts@@ -0,0 +1,144 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { Address } from "viem";+import type { SupportedEvmChainId } from "../types.js";+import { getChain } from "../chains.js";++/**+ * x402 payment header encoding for EVM-originated payments.+ *+ * When an agent API returns HTTP 402 with an X-Payment-Required header,+ * this client handles quoting and attaches the payment proof header+ * (X-Payment) to the retry request.+ *+ * Usage:+ * const fetcher = createEvmX402Fetch({ chainId: 8453, walletClient })+ * const res = await fetcher("https://agent.example/api/chat", { method: "POST", ... })+ */++export interface EvmX402PaymentRequirements {+ scheme: "pump-agent-evm";+ network: string;+ agentMint: string;+ maxAmountRequired: string;+ resource: string;+ description: string;+ mimeType: string;+ payTo: Address;+ memo: string;+ quoteId?: string;+}++export interface EvmWalletClient {+ chainId: SupportedEvmChainId;+ address: Address;+ sendTransaction: (tx: {+ to: Address;+ data: `0x${string}`;+ value: bigint;+ chainId: number;+ }) => Promise<`0x${string}`>;+}++export interface EvmX402FetchOptions {+ walletClient: EvmWalletClient;+ /** Called before signing so the UI can show "paying $X..." */+ onPaymentRequired?: (requirements: EvmX402PaymentRequirements) => Promise<boolean>;+ /** Called after the bridge tx is submitted with the tx hash */+ onPaymentSubmitted?: (txHash: `0x${string}`, depositId: string) => void;+}++/**+ * Returns a fetch-compatible function that automatically handles HTTP 402+ * responses by paying via EVM cross-chain and retrying the request.+ */+export function createEvmX402Fetch(opts: EvmX402FetchOptions) {+ return async function x402Fetch(+ input: RequestInfo | URL,+ init?: RequestInit+ ): Promise<Response> {+ const firstRes = await fetch(input, init);++ if (firstRes.status !== 402) return firstRes;++ const requirementsHeader = firstRes.headers.get("X-Payment-Required");+ if (!requirementsHeader) return firstRes;++ let requirements: EvmX402PaymentRequirements;+ try {+ requirements = JSON.parse(atob(requirementsHeader));+ } catch {+ return firstRes;+ }++ if (requirements.scheme !== "pump-agent-evm") return firstRes;++ // Let the UI confirm before signing+ if (opts.onPaymentRequired) {+ const confirmed = await opts.onPaymentRequired(requirements);+ if (!confirmed) return firstRes;+ }++ const chain = getChain(opts.walletClient.chainId);++ // Build and send the bridge payment+ const { getQuote } = await import("../evm/quote.js");+ const { buildEvmPaymentTransaction } = await import("../evm/transaction.js");++ const quote = await getQuote({+ fromChainId: opts.walletClient.chainId,+ fromToken: chain.usdc,+ fromAmount: BigInt(requirements.maxAmountRequired),+ agentMint: requirements.agentMint,+ });++ const txs = await buildEvmPaymentTransaction({+ quote,+ agentMint: requirements.agentMint,+ destinationSolanaWallet: requirements.payTo,+ memo: requirements.memo,+ sender: opts.walletClient.address,+ });++ // Send approval if needed+ if (txs.approval) {+ await opts.walletClient.sendTransaction({+ to: txs.approval.to,+ data: txs.approval.data,+ value: txs.approval.value,+ chainId: opts.walletClient.chainId,+ });+ }++ // Send bridge tx+ const bridgeTxHash = await opts.walletClient.sendTransaction({+ to: txs.bridge.to,+ data: txs.bridge.data,+ value: txs.bridge.value,+ chainId: txs.bridge.chainId,+ });++ // Build payment proof header+ const paymentProof = btoa(+ JSON.stringify({+ scheme: "pump-agent-evm",+ chainId: opts.walletClient.chainId,+ txHash: bridgeTxHash,+ quoteId: quote.quoteId,+ memo: requirements.memo,+ })+ );++ if (opts.onPaymentSubmitted) {+ opts.onPaymentSubmitted(bridgeTxHash, quote.quoteId);+ }++ // Retry the original request with payment proof+ const retryHeaders = new Headers(init?.headers);+ retryHeaders.set("X-Payment", paymentProof);++ return fetch(input, { ...init, headers: retryHeaders });+ };+}diff --git a/agent-payments-sdk/src/x402/evm-facilitator.ts b/agent-payments-sdk/src/x402/evm-facilitator.tsnew file mode 100644index 000000000..166dfdd56--- /dev/null+++ b/agent-payments-sdk/src/x402/evm-facilitator.ts@@ -0,0 +1,178 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.++import type { Address } from "viem";+import type { CrossChainPaymentStatusResult, SupportedEvmChainId } from "../types.js";+import { getPaymentStatus } from "../evm/validate.js";+import { PUMP_CROSSCHAIN_API } from "../constants.js";++export interface EvmPaymentProof {+ scheme: "pump-agent-evm";+ chainId: SupportedEvmChainId;+ txHash: `0x${string}`;+ quoteId: string;+ memo: string;+}++export interface VerifyEvmPaymentParams {+ /** Decoded proof from the X-Payment header */+ proof: EvmPaymentProof;+ /** Expected memo / invoice ID */+ expectedMemo: string;+ /** Minimum USDC amount that must arrive on Solana (6 decimals) */+ minAmountUsdc: bigint;+ /** Solana agent mint for this agent */+ agentMint: string;+ /**+ * Whether to wait for Solana arrival before returning.+ * Set to false if you want to verify the EVM tx only and handle+ * Solana arrival asynchronously (webhook / queue).+ */+ waitForSolana?: boolean;+}++export interface EvmPaymentVerificationResult {+ valid: boolean;+ /** Deposit ID for status polling */+ depositId?: string;+ /** Solana tx signature (only when waitForSolana: true and arrived) */+ solanaSignature?: string;+ /** Amount confirmed on Solana (6-decimal USDC) */+ confirmedAmountUsdc?: bigint;+ error?: string;+}++/**+ * Server-side facilitator: verify an EVM payment proof from the X-Payment header.+ *+ * Call this from your API route after decoding the X-Payment header:+ *+ * const proof = JSON.parse(atob(req.headers["x-payment"]))+ * const result = await verifyEvmPayment({ proof, expectedMemo, minAmountUsdc, agentMint })+ * if (!result.valid) return res.status(402).json({ error: result.error })+ */+export async function verifyEvmPayment(+ params: VerifyEvmPaymentParams+): Promise<EvmPaymentVerificationResult> {+ const { proof, expectedMemo, minAmountUsdc, agentMint } = params;++ if (proof.scheme !== "pump-agent-evm") {+ return { valid: false, error: "Unknown payment scheme" };+ }++ if (proof.memo !== expectedMemo) {+ return { valid: false, error: "Memo mismatch" };+ }++ // Fetch the deposit record from Pump.fun API using the quoteId / txHash+ let depositId: string;+ try {+ const res = await fetch(+ `${PUMP_CROSSCHAIN_API}/deposit?txHash=${proof.txHash}&chainId=${proof.chainId}`+ );+ if (!res.ok) throw new Error(`Deposit lookup failed (${res.status})`);+ const data: { depositId: string; amountUsdc: string } = await res.json();+ depositId = data.depositId;++ const confirmedAmount = BigInt(data.amountUsdc);+ if (confirmedAmount < minAmountUsdc) {+ return {+ valid: false,+ depositId,+ error: `Insufficient amount: got ${confirmedAmount}, need ${minAmountUsdc}`,+ };+ }+ } catch (err) {+ return {+ valid: false,+ error: `EVM tx verification failed: ${(err as Error).message}`,+ };+ }++ if (!params.waitForSolana) {+ return { valid: true, depositId };+ }++ // Wait for Solana arrival+ try {+ const status: CrossChainPaymentStatusResult = await waitWithTimeout(depositId);++ if (status.status === "arrived_on_solana") {+ return {+ valid: true,+ depositId,+ solanaSignature: status.solanaSignature,+ };+ }++ return {+ valid: false,+ depositId,+ error: `Payment failed in transit: ${status.error ?? status.status}`,+ };+ } catch (err) {+ return {+ valid: false,+ depositId,+ error: `Solana arrival timeout: ${(err as Error).message}`,+ };+ }+}++async function waitWithTimeout(+ depositId: string,+ maxMs = 60_000+): Promise<CrossChainPaymentStatusResult> {+ const deadline = Date.now() + maxMs;+ while (Date.now() < deadline) {+ const status = await getPaymentStatus(depositId);+ if (status.status === "arrived_on_solana" || status.status === "failed") {+ return status;+ }+ await new Promise((r) => setTimeout(r, 3_000));+ }+ throw new Error(`Timed out waiting for Solana arrival (${maxMs}ms)`);+}++/**+ * Decode and validate the X-Payment header from an incoming request.+ * Returns null if the header is missing or malformed.+ */+export function decodePaymentHeader(+ headerValue: string | null | undefined+): EvmPaymentProof | null {+ if (!headerValue) return null;+ try {+ const decoded = JSON.parse(atob(headerValue));+ if (decoded.scheme !== "pump-agent-evm") return null;+ return decoded as EvmPaymentProof;+ } catch {+ return null;+ }+}++/**+ * Build the X-Payment-Required header value for an agent API endpoint.+ * Include this in HTTP 402 responses so EVM clients know how to pay.+ */+export function buildPaymentRequiredHeader(opts: {+ agentMint: string;+ maxAmountUsdc: bigint;+ resource: string;+ description: string;+ payTo: Address;+ memo: string;+}): string {+ return btoa(+ JSON.stringify({+ scheme: "pump-agent-evm",+ agentMint: opts.agentMint,+ maxAmountRequired: opts.maxAmountUsdc.toString(),+ resource: opts.resource,+ description: opts.description,+ payTo: opts.payTo,+ memo: opts.memo,+ })+ );+}diff --git a/agent-payments-sdk/src/x402/index.ts b/agent-payments-sdk/src/x402/index.tsindex f6bfd7117..3390d0aa7 100644--- a/agent-payments-sdk/src/x402/index.ts+++ b/agent-payments-sdk/src/x402/index.ts@@ -1,68 +1,6 @@-/**- * x402 v2 – HTTP 402 Payment Required protocol for Pump Agent Payments- *- * Aligned with the coinbase/x402 v2 specification.- * @see https://github.com/coinbase/x402- *- * Server-side: PumpAgentFacilitator, createResourceServer, buildPumpAgentRequirements- * Client-side: createX402Fetch- * Helpers: encode/decode headers, constants- */+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.-// Types-export type {- PaymentScheme,- ExactScheme,- PumpAgentScheme,- ResourceInfo,- PaymentRequirementsBase,- ExactPaymentRequirements,- PumpAgentPaymentRequirements,- PaymentRequirements,- PaymentRequired,- PaymentPayload,- VerifyResponse,- SettleResponse,- SupportedKind,- SupportedResponse,- FacilitatorClient,- PaymentResponse,- ResourceServerConfig,- X402ClientConfig,- TransactionSigner,- TransactionSender,-} from "./types";-export {- X402_VERSION,- X402_HEADER_PAYMENT_REQUIRED,- X402_HEADER_PAYMENT_SIGNATURE,- X402_HEADER_PAYMENT_RESPONSE,- SOLANA_MAINNET,- SOLANA_DEVNET,- USDC_MAINNET,- USDC_DEVNET,-} from "./types";--// Headers-export {- encodePaymentRequired,- decodePaymentRequired,- encodePaymentPayload,- decodePaymentPayload,- encodePaymentResponse,- decodePaymentResponse,- getPaymentRequiredFromResponse,- getPaymentPayloadFromRequest,- getPaymentResponseFromResponse,-} from "./headers";--// Facilitator-export type { PumpAgentFacilitatorConfig, PumpAgentRequirementsConfig } from "./facilitator";-export {- PumpAgentFacilitator,- buildPumpAgentRequirements,- createResourceServer,-} from "./facilitator";--// Client-export { createX402Fetch } from "./client";+export * from "./evm-client.js";+export * from "./evm-facilitator.js";diff --git a/agent-payments-sdk/tsup.config.ts b/agent-payments-sdk/tsup.config.tsindex 13ac7d4a9..6634dee2d 100644--- a/agent-payments-sdk/tsup.config.ts+++ b/agent-payments-sdk/tsup.config.ts@@ -1,10 +1,22 @@+// agent-payments-sdk+// Copyright (c) 2026 nirholas | x.com/nichxbt | github.com/nirholas+// All rights reserved.+import { defineConfig } from "tsup";export default defineConfig({- entry: ["src/index.ts", "src/x402/index.ts", "src/solana-agent-kit/index.ts"],- format: ["cjs", "esm"],+ entry: {+ index: "src/index.ts",+ "evm/index": "src/evm/index.ts",+ "solana/index": "src/solana/index.ts",+ "solana/legacy-agent-payments/index": "src/solana/legacy-agent-payments/index.ts",+ "solana/solana-agent-kit/index": "src/solana/solana-agent-kit/index.ts",+ "x402/index": "src/x402/index.ts",+ },+ format: ["esm", "cjs"],dts: true,- clean: true,sourcemap: true,+ clean: true,splitting: false,+ treeshake: true,});diff --git a/api/_lib/pump.js b/api/_lib/pump.jsindex 9de3556ec..0507f870d 100644--- a/api/_lib/pump.js+++ b/api/_lib/pump.js@@ -2,13 +2,15 @@// Lazy-loaded — Vercel cold starts pay only for what an endpoint touches.//// Public surface:-// getConnection({ network }) → @solana/web3.js Connection-// getPumpSdk({ network }) → { sdk: PumpSdk|OnlinePumpSdk, BN, web3 }-// getPumpSwapSdk({ network }) → { sdk: PumpAmmSdk, BN, web3 }-// getPumpAgent({ network, mint }) → { agent: PumpAgent, BN, web3, agentPda }-// getPumpAgentOffline({ network, mint }) → instruction-only PumpAgentOffline-// verifySignature(network, sig) → confirmed parsed tx, throws on missing/failed-// solanaPubkey(s) → PublicKey or null+// getConnection({ network }) → @solana/web3.js Connection+// getPumpSdk({ network }) → { sdk, PUMP_SDK, BN, web3 }+// getPumpSdkV2({ network }) → { PUMP_SDK, onlineSdk, bondingCurvePda, isLegacyQuoteMint, BN, web3 }+// getPumpSwapSdk({ network }) → { sdk: PumpAmmSdk, BN, web3 }+// getPumpAgent({ network, mint }) → { agent: PumpAgent, BN, web3, agentPda }+// getPumpAgentOffline({ network, mint }) → instruction-only PumpAgentOffline+// getPumpTradeClient({ network }) → { client: PumpTradeClient, BN, web3 }+// verifySignature(network, sig) → confirmed parsed tx, throws on missing/failed+// solanaPubkey(s) → PublicKey or null//// Network selection: 'mainnet' | 'devnet'. Endpoint URLs come from env so// production can pin Helius / Triton / etc. RPC providers. Setting@@ -53,6 +55,51 @@ export async function getPumpSdk({ network = 'mainnet' } = {}) {return { sdk, connection, BN, web3, PumpSdk, OnlinePumpSdk };}+// v2 bonding curve helpers — buy_v2, sell_v2, create_v2, USDC quote support+export async function getPumpSdkV2({ network = 'mainnet' } = {}) {+ const [pumpPkg, web3, BN] = await Promise.all([+ import('@pump-fun/pump-sdk'),+ import('@solana/web3.js'),+ import('bn.js').then((m) => m.default || m),+ ]);+ const {+ PUMP_SDK,+ OnlinePumpSdk,+ bondingCurvePda,+ isLegacyQuoteMint,+ getBuyTokenAmountFromSolAmount,+ getBuySolAmountFromTokenAmount,+ getSellSolAmountFromTokenAmount,+ newBondingCurve,+ } = pumpPkg;+ const connection = getConnection({ network });+ const onlineSdk = new OnlinePumpSdk(connection);+ return {+ PUMP_SDK,+ onlineSdk,+ connection,+ bondingCurvePda,+ isLegacyQuoteMint,+ getBuyTokenAmountFromSolAmount,+ getBuySolAmountFromTokenAmount,+ getSellSolAmountFromTokenAmount,+ newBondingCurve,+ BN,+ web3,+ };+}++export async function getPumpTradeClient({ network = 'mainnet' } = {}) {+ const [{ PumpTradeClient }, web3, BN] = await Promise.all([+ import('@pump-fun/agent-payments-sdk'),+ import('@solana/web3.js'),+ import('bn.js').then((m) => m.default || m),+ ]);+ const connection = getConnection({ network });+ const client = new PumpTradeClient(connection);+ return { client, connection, BN, web3 };+}+export async function getPumpSwapSdk({ network = 'mainnet' } = {}) {const [{ PumpAmmSdk, PumpAmmInternalSdk }, web3, BN] = await Promise.all([import('@pump-fun/pump-swap-sdk'),diff --git a/package.json b/package.jsonindex 16abc28f2..436f988be 100644--- a/package.json+++ b/package.json@@ -94,8 +94,8 @@"node-fetch": "^3.3.2","@nirholas/pump-sdk": "^1.0.0","@noble/curves": "^2.2.0",- "@pump-fun/agent-payments-sdk": "^3.0.3",- "@pump-fun/pump-sdk": "^1.33.0",+ "@pump-fun/agent-payments-sdk": "^3.1.0",+ "@pump-fun/pump-sdk": "^1.35.0","@pump-fun/pump-swap-sdk": "^1.15.0","@pythnetwork/hermes-client": "^3.1.0","@solana/wallet-adapter-base": "^0.9.23",