Overview
Tracking buy and sell events on Pump.fun is crucial for trading bots and market analysis. This guide details how to utilize Solana’s Yellowstone gRPC stream to efficiently capture and parse real-time transaction data, enabling instant detection of token swaps.What you’ll learn:
- Stream Pump.fun transactions in real-time
- Parse transactions with IDL-based parsing
- Identify buy vs sell transactions
- Extract trade amounts, prices, and participants
Architecture
This implementation consists of three key components:- Stream Transactions - Subscribe to Pump.fun transactions via gRPC
- Parse Transactions - Decode instructions and events using IDL
- Identify Buy/Sell - Detect transaction type based on events
Installation
Install the required dependencies:Copy
Ask AI
npm install @triton-one/yellowstone-grpc @coral-xyz/anchor
Complete Working Example
Here’s a production-ready Pump.fun trading bot that detects all buy/sell events:Copy
Ask AI
const Client = require("@triton-one/yellowstone-grpc").default;
const { CommitmentLevel } = require("@triton-one/yellowstone-grpc");
const { BorshInstructionCoder, BorshEventCoder } = require("@coral-xyz/anchor");
const fs = require('fs');
const PUMP_PROGRAM_ID = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";
// Load Pump.fun IDL for parsing
const pumpFunIdl = JSON.parse(
fs.readFileSync('./idl/pump_0.1.0.json', 'utf8')
);
const instructionCoder = new BorshInstructionCoder(pumpFunIdl);
const eventCoder = new BorshEventCoder(pumpFunIdl);
// Initialize and connect to Yellowstone gRPC
const getClient = async () => {
let client = false;
try {
client = new Client(
process.env.GRPC_ENDPOINT || "https://grpc.solanatracker.io",
process.env.GRPC_API_KEY,
{
"grpc.max_receive_message_length": 100 * 1024 * 1024,
}
);
const version = await client.getVersion();
if (version) {
console.log("Connected to Yellowstone gRPC! Version:", version);
return client;
}
} catch (e) {
console.error("Failed to connect:", e);
}
if (!client) {
throw new Error("Failed to connect!");
}
};
// Parse Pump.fun transaction
function parsePumpTransaction(tx) {
if (!tx || tx.meta?.err) return null;
try {
const events = [];
// Parse events from logs
if (tx.meta?.logMessages) {
for (const log of tx.meta.logMessages) {
if (log.startsWith('Program data: ')) {
const eventData = log.slice('Program data: '.length);
try {
const decoded = eventCoder.decode(eventData);
if (decoded) {
events.push(decoded);
}
} catch (e) {
// Skip non-event logs
}
}
}
}
return { events };
} catch (err) {
console.error("Parse error:", err);
return null;
}
}
// Identify if transaction is buy or sell
function identifyTradeType(parsedTx, rawTx) {
if (!parsedTx?.events || parsedTx.events.length === 0) return null;
// Look for TradeEvent in parsed events
const tradeEvent = parsedTx.events.find(e => e.name === 'TradeEvent');
if (!tradeEvent) return null;
const { mint, isBuy, solAmount, tokenAmount, user } = tradeEvent.data;
return {
type: isBuy ? 'buy' : 'sell',
mint: mint.toString(),
signer: user.toString(),
tokenAmount: Number(tokenAmount) / 1e6, // Assuming 6 decimals
solAmount: Number(solAmount) / 1e9, // SOL has 9 decimals
signature: rawTx.signature,
slot: rawTx.slot
};
}
// Trading statistics
const stats = {
totalTrades: 0,
buys: 0,
sells: 0,
totalVolume: 0,
lastReportTime: Date.now()
};
(async () => {
const client = await getClient();
const stream = await client.subscribe();
// Handle stream lifecycle
const streamClosed = new Promise((resolve, reject) => {
stream.on("error", (error) => {
console.error("Stream error:", error);
});
stream.on("end", () => {
console.log("Stream ended");
resolve();
});
stream.on("close", () => {
console.log("Stream closed");
resolve();
});
});
// Handle incoming transactions
stream.on("data", (data) => {
if (data?.transaction) {
const tx = data.transaction.transaction;
const slot = data.transaction.slot;
// Parse the transaction
const parsedTx = parsePumpTransaction(tx);
if (!parsedTx) return;
// Identify trade type
const trade = identifyTradeType(parsedTx, {
signature: tx.signature,
slot
});
if (!trade) return;
// Log the trade
stats.totalTrades++;
if (trade.type === 'buy') {
stats.buys++;
} else {
stats.sells++;
}
stats.totalVolume += trade.solAmount;
console.log(`\nTrade #${stats.totalTrades}`);
console.log(` Type: ${trade.type.toUpperCase()}`);
console.log(` Mint: ${trade.mint}`);
console.log(` Trader: ${trade.signer.slice(0, 8)}...`);
console.log(` Token Amount: ${trade.tokenAmount.toFixed(6)}`);
console.log(` SOL Amount: ${trade.solAmount.toFixed(4)} SOL`);
console.log(` Price: ${(trade.solAmount / trade.tokenAmount).toFixed(9)} SOL/token`);
}
});
// Subscribe to Pump.fun transactions
const request = {
accounts: {},
slots: {},
transactions: {
pump: {
vote: false,
failed: false,
signature: undefined,
accountInclude: [PUMP_PROGRAM_ID],
accountExclude: [],
accountRequired: [],
},
},
transactionsStatus: {},
entry: {},
blocks: {},
blocksMeta: {},
accountsDataSlice: [],
ping: undefined,
commitment: CommitmentLevel.CONFIRMED,
};
// Send subscribe request
await new Promise((resolve, reject) => {
stream.write(request, (err) => {
if (err === null || err === undefined) {
console.log("Monitoring Pump.fun buy/sell events...\n");
resolve();
} else {
reject(err);
}
});
}).catch((reason) => {
console.error("Subscribe failed:", reason);
throw reason;
});
await streamClosed;
})();
// Graceful shutdown
process.on('SIGINT', () => {
console.log('\n\nShutting down gracefully...');
console.log(`Final Stats - Trades: ${stats.totalTrades}, Buys: ${stats.buys}, Sells: ${stats.sells}`);
process.exit(0);
});
Environment Setup
Create a.env
file:
Copy
Ask AI
GRPC_ENDPOINT=https://grpc.solanatracker.io
GRPC_API_KEY=your-api-key-here
IDL File
Download the Pump.fun IDL and save it asidl/pump_0.1.0.json
:
Copy
Ask AI
{{
"address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
"metadata": {
"name": "pump",
"version": "0.1.0",
"spec": "0.1.0",
"description": "Created with Anchor"
},
"instructions": [
{
"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": "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": "associated_user",
"writable": true
},
{
"name": "user",
"writable": true,
"signer": true
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
"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",
"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": "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": "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": "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": "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": "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": "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": "token_program"
},
{
"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": "token_program"
},
{
"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"
}
],
"args": []
},
{
"name": "sell",
"docs": [
"Sells tokens into a bonding curve."
],
"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": "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": "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",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
"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": "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_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": "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": "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": "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": "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": "ExtendAccountEvent",
"discriminator": [
97,
97,
215,
144,
93,
146,
22,
124
]
},
{
"name": "InitUserVolumeAccumulatorEvent",
"discriminator": [
134,
36,
13,
72,
232,
101,
130,
216
]
},
{
"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
]
}
],
"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"
}
],
"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_sol_reserves",
"type": "u64"
},
{
"name": "real_token_reserves",
"type": "u64"
},
{
"name": "real_sol_reserves",
"type": "u64"
},
{
"name": "token_total_supply",
"type": "u64"
},
{
"name": "complete",
"type": "bool"
},
{
"name": "creator",
"type": "pubkey"
}
]
}
},
{
"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": "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": "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": "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": "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": "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": "OptionBool",
"type": {
"kind": "struct",
"fields": [
"bool"
]
}
},
{
"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": "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",
"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": "UpdateGlobalAuthorityEvent",
"type": {
"kind": "struct",
"fields": [
{
"name": "global",
"type": "pubkey"
},
{
"name": "authority",
"type": "pubkey"
},
{
"name": "new_authority",
"type": "pubkey"
},
{
"name": "timestamp",
"type": "i64"
}
]
}
},
{
"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"
}
]
}
}
]
}
Advanced Features
Price Tracking
Track price movements across trades:Copy
Ask AI
const priceHistory = new Map(); // mint -> array of prices
function trackPrice(trade) {
const price = trade.solAmount / trade.tokenAmount;
if (!priceHistory.has(trade.mint)) {
priceHistory.set(trade.mint, []);
}
const prices = priceHistory.get(trade.mint);
prices.push({ price, timestamp: Date.now(), type: trade.type });
// Keep only last 100 prices
if (prices.length > 100) {
prices.shift();
}
// Calculate price change
if (prices.length > 1) {
const oldPrice = prices[0].price;
const priceChange = ((price - oldPrice) / oldPrice) * 100;
if (Math.abs(priceChange) > 10) {
console.log(`\n⚠️ PRICE ALERT`);
console.log(` Mint: ${trade.mint}`);
console.log(` Change: ${priceChange.toFixed(2)}%`);
console.log(` Current Price: ${price.toFixed(9)} SOL`);
}
}
}
// Call in data handler:
if (trade) {
trackPrice(trade);
}
Large Trade Alerts
Alert on significant trades:Copy
Ask AI
const LARGE_TRADE_THRESHOLD = 10.0; // 1 SOL
function checkLargeTrade(trade) {
if (trade.solAmount > LARGE_TRADE_THRESHOLD) {
console.log(` Amount: ${trade.solAmount.toFixed(4)} SOL`);
console.log(` Token: ${trade.mint}`);
console.log(` Trader: ${trade.signer}`);
// Send notification (implement your notification logic)
// sendTelegramAlert(trade);
}
}
Buy/Sell Pressure
Calculate market pressure:Copy
Ask AI
const pressureWindow = {
buys: [],
sells: [],
windowSize: 50 // Last 50 trades
};
function calculatePressure(trade) {
if (trade.type === 'buy') {
pressureWindow.buys.push(trade.solAmount);
} else {
pressureWindow.sells.push(trade.solAmount);
}
// Maintain window size
if (pressureWindow.buys.length > pressureWindow.windowSize) {
pressureWindow.buys.shift();
}
if (pressureWindow.sells.length > pressureWindow.windowSize) {
pressureWindow.sells.shift();
}
// Calculate pressure
const buyPressure = pressureWindow.buys.reduce((a, b) => a + b, 0);
const sellPressure = pressureWindow.sells.reduce((a, b) => a + b, 0);
const ratio = buyPressure / (sellPressure || 1);
if (stats.totalTrades % 50 === 0) {
console.log(`\n=== Market Pressure ===`);
console.log(` Buy Pressure: ${buyPressure.toFixed(2)} SOL`);
console.log(` Sell Pressure: ${sellPressure.toFixed(2)} SOL`);
console.log(` Ratio: ${ratio.toFixed(2)}`);
if (ratio > 2) {
console.log(` Status: 🟢 BULLISH`);
} else if (ratio < 0.5) {
console.log(` Status: 🔴 BEARISH`);
} else {
console.log(` Status: ⚪ NEUTRAL`);
}
}
}
Performance Optimization
Use CONFIRMED Commitment
Balance speed and finality with
CommitmentLevel.CONFIRMED
Async Processing
Process transactions asynchronously to avoid blocking the stream
Efficient Parsing
Only parse transactions that match your criteria
Memory Management
Implement data cleanup and garbage collection for long-running bots