sol-parser-sdk 0.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +24 -0
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/README_CN.md +236 -0
- package/dist/accounts/mod.d.ts +15 -0
- package/dist/accounts/mod.js +173 -0
- package/dist/accounts/nonce.d.ts +5 -0
- package/dist/accounts/nonce.js +32 -0
- package/dist/accounts/pumpfun.d.ts +16 -0
- package/dist/accounts/pumpfun.js +538 -0
- package/dist/accounts/pumpswap.d.ts +8 -0
- package/dist/accounts/pumpswap.js +192 -0
- package/dist/accounts/raydium_orca.d.ts +26 -0
- package/dist/accounts/raydium_orca.js +453 -0
- package/dist/accounts/rpc_wallet.d.ts +5 -0
- package/dist/accounts/rpc_wallet.js +18 -0
- package/dist/accounts/rust_aliases.d.ts +10 -0
- package/dist/accounts/rust_aliases.js +21 -0
- package/dist/accounts/token.d.ts +5 -0
- package/dist/accounts/token.js +98 -0
- package/dist/accounts/types.d.ts +9 -0
- package/dist/accounts/types.js +2 -0
- package/dist/accounts/utils.d.ts +1 -0
- package/dist/accounts/utils.js +12 -0
- package/dist/accounts/wallet_resolve.d.ts +1 -0
- package/dist/accounts/wallet_resolve.js +28 -0
- package/dist/common/constants.d.ts +10 -0
- package/dist/common/constants.js +13 -0
- package/dist/core/account_dispatcher_rpc.d.ts +11 -0
- package/dist/core/account_dispatcher_rpc.js +155 -0
- package/dist/core/account_fill_bonk.d.ts +4 -0
- package/dist/core/account_fill_bonk.js +20 -0
- package/dist/core/account_fill_meteora.d.ts +15 -0
- package/dist/core/account_fill_meteora.js +27 -0
- package/dist/core/account_fill_orca.d.ts +5 -0
- package/dist/core/account_fill_orca.js +18 -0
- package/dist/core/account_fill_pumpfun.d.ts +7 -0
- package/dist/core/account_fill_pumpfun.js +167 -0
- package/dist/core/account_fill_pumpswap.d.ts +10 -0
- package/dist/core/account_fill_pumpswap.js +128 -0
- package/dist/core/account_fill_raydium.d.ts +20 -0
- package/dist/core/account_fill_raydium.js +104 -0
- package/dist/core/account_fill_raydium_launchlab.d.ts +4 -0
- package/dist/core/account_fill_raydium_launchlab.js +20 -0
- package/dist/core/account_pubkey_cache.d.ts +12 -0
- package/dist/core/account_pubkey_cache.js +26 -0
- package/dist/core/clock.d.ts +8 -0
- package/dist/core/clock.js +20 -0
- package/dist/core/common_filler_rpc.d.ts +6 -0
- package/dist/core/common_filler_rpc.js +21 -0
- package/dist/core/dex_event.d.ts +1704 -0
- package/dist/core/dex_event.js +14 -0
- package/dist/core/error.d.ts +43 -0
- package/dist/core/error.js +16 -0
- package/dist/core/json_utils.d.ts +8 -0
- package/dist/core/json_utils.js +18 -0
- package/dist/core/metadata.d.ts +11 -0
- package/dist/core/metadata.js +13 -0
- package/dist/core/pumpfun_fee_enrich.d.ts +6 -0
- package/dist/core/pumpfun_fee_enrich.js +159 -0
- package/dist/core/rpc_invoke_map.d.ts +23 -0
- package/dist/core/rpc_invoke_map.js +157 -0
- package/dist/core/unified_parser.d.ts +19 -0
- package/dist/core/unified_parser.js +50 -0
- package/dist/grpc/client.d.ts +83 -0
- package/dist/grpc/client.js +645 -0
- package/dist/grpc/client_stub.d.ts +5 -0
- package/dist/grpc/client_stub.js +5 -0
- package/dist/grpc/event_parser.d.ts +6 -0
- package/dist/grpc/event_parser.js +15 -0
- package/dist/grpc/geyser_connect.d.ts +30 -0
- package/dist/grpc/geyser_connect.js +40 -0
- package/dist/grpc/log_instr_dedup.d.ts +2 -0
- package/dist/grpc/log_instr_dedup.js +402 -0
- package/dist/grpc/order_buffer.d.ts +27 -0
- package/dist/grpc/order_buffer.js +166 -0
- package/dist/grpc/program_ids.d.ts +27 -0
- package/dist/grpc/program_ids.js +61 -0
- package/dist/grpc/rpc_to_grpc.d.ts +18 -0
- package/dist/grpc/rpc_to_grpc.js +127 -0
- package/dist/grpc/subscribe_builder.d.ts +13 -0
- package/dist/grpc/subscribe_builder.js +66 -0
- package/dist/grpc/transaction_meta.d.ts +29 -0
- package/dist/grpc/transaction_meta.js +208 -0
- package/dist/grpc/types.d.ts +195 -0
- package/dist/grpc/types.js +551 -0
- package/dist/grpc/yellowstone_parse.d.ts +16 -0
- package/dist/grpc/yellowstone_parse.js +62 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +298 -0
- package/dist/instr/bonk_ix.d.ts +8 -0
- package/dist/instr/bonk_ix.js +131 -0
- package/dist/instr/inner.d.ts +4 -0
- package/dist/instr/inner.js +453 -0
- package/dist/instr/meteora_damm_ix.d.ts +8 -0
- package/dist/instr/meteora_damm_ix.js +601 -0
- package/dist/instr/meteora_dlmm_ix.d.ts +2 -0
- package/dist/instr/meteora_dlmm_ix.js +134 -0
- package/dist/instr/meteora_pools_ix.d.ts +2 -0
- package/dist/instr/meteora_pools_ix.js +78 -0
- package/dist/instr/mod.d.ts +18 -0
- package/dist/instr/mod.js +129 -0
- package/dist/instr/orca_whirlpool_ix.d.ts +8 -0
- package/dist/instr/orca_whirlpool_ix.js +119 -0
- package/dist/instr/program_ids.d.ts +4 -0
- package/dist/instr/program_ids.js +20 -0
- package/dist/instr/pump_fees_ix.d.ts +2 -0
- package/dist/instr/pump_fees_ix.js +168 -0
- package/dist/instr/pumpfun_ix.d.ts +6 -0
- package/dist/instr/pumpfun_ix.js +448 -0
- package/dist/instr/pumpswap_ix.d.ts +5 -0
- package/dist/instr/pumpswap_ix.js +270 -0
- package/dist/instr/raydium_amm_v4_ix.d.ts +6 -0
- package/dist/instr/raydium_amm_v4_ix.js +112 -0
- package/dist/instr/raydium_clmm_ix.d.ts +5 -0
- package/dist/instr/raydium_clmm_ix.js +184 -0
- package/dist/instr/raydium_cpmm_ix.d.ts +5 -0
- package/dist/instr/raydium_cpmm_ix.js +109 -0
- package/dist/instr/raydium_launchlab_ix.d.ts +8 -0
- package/dist/instr/raydium_launchlab_ix.js +125 -0
- package/dist/instr/rust_aliases.d.ts +10 -0
- package/dist/instr/rust_aliases.js +20 -0
- package/dist/instr/utils.d.ts +10 -0
- package/dist/instr/utils.js +35 -0
- package/dist/logs/discriminator_lut.d.ts +19 -0
- package/dist/logs/discriminator_lut.js +62 -0
- package/dist/logs/meteora_amm.d.ts +8 -0
- package/dist/logs/meteora_amm.js +113 -0
- package/dist/logs/meteora_damm.d.ts +5 -0
- package/dist/logs/meteora_damm.js +367 -0
- package/dist/logs/meteora_dbc.d.ts +11 -0
- package/dist/logs/meteora_dbc.js +142 -0
- package/dist/logs/meteora_dlmm.d.ts +6 -0
- package/dist/logs/meteora_dlmm.js +201 -0
- package/dist/logs/optimized_matcher.d.ts +11 -0
- package/dist/logs/optimized_matcher.js +941 -0
- package/dist/logs/orca.d.ts +6 -0
- package/dist/logs/orca.js +148 -0
- package/dist/logs/program_data.d.ts +2 -0
- package/dist/logs/program_data.js +20 -0
- package/dist/logs/program_log_discriminators.d.ts +80 -0
- package/dist/logs/program_log_discriminators.js +88 -0
- package/dist/logs/pump.d.ts +14 -0
- package/dist/logs/pump.js +378 -0
- package/dist/logs/pump_amm.d.ts +9 -0
- package/dist/logs/pump_amm.js +418 -0
- package/dist/logs/pump_fees.d.ts +23 -0
- package/dist/logs/pump_fees.js +364 -0
- package/dist/logs/raydium_amm.d.ts +9 -0
- package/dist/logs/raydium_amm.js +224 -0
- package/dist/logs/raydium_clmm.d.ts +17 -0
- package/dist/logs/raydium_clmm.js +624 -0
- package/dist/logs/raydium_cpmm.d.ts +7 -0
- package/dist/logs/raydium_cpmm.js +121 -0
- package/dist/logs/raydium_launchlab.d.ts +10 -0
- package/dist/logs/raydium_launchlab.js +84 -0
- package/dist/logs/raydium_launchpad.d.ts +12 -0
- package/dist/logs/raydium_launchpad.js +92 -0
- package/dist/logs/rust_aliases.d.ts +7 -0
- package/dist/logs/rust_aliases.js +16 -0
- package/dist/parser_alias.d.ts +3 -0
- package/dist/parser_alias.js +2 -0
- package/dist/rpc_parser.d.ts +17 -0
- package/dist/rpc_parser.js +39 -0
- package/dist/rpc_transaction.d.ts +27 -0
- package/dist/rpc_transaction.js +416 -0
- package/dist/shredstream/alt_lookup.d.ts +9 -0
- package/dist/shredstream/alt_lookup.js +70 -0
- package/dist/shredstream/client.d.ts +65 -0
- package/dist/shredstream/client.js +403 -0
- package/dist/shredstream/config.d.ts +30 -0
- package/dist/shredstream/config.js +34 -0
- package/dist/shredstream/entries_decode.d.ts +28 -0
- package/dist/shredstream/entries_decode.js +251 -0
- package/dist/shredstream/index.d.ts +17 -0
- package/dist/shredstream/index.js +33 -0
- package/dist/shredstream/instruction_parse.d.ts +34 -0
- package/dist/shredstream/instruction_parse.js +79 -0
- package/dist/shredstream/proto_types.d.ts +9 -0
- package/dist/shredstream/proto_types.js +2 -0
- package/dist/shredstream/shredstream.proto +15 -0
- package/dist/shredstream/wire_to_shred_tx.d.ts +2 -0
- package/dist/shredstream/wire_to_shred_tx.js +59 -0
- package/dist/util/binary.d.ts +14 -0
- package/dist/util/binary.js +82 -0
- package/dist/util/market.d.ts +18 -0
- package/dist/util/market.js +54 -0
- package/dist/warmup.d.ts +3 -0
- package/dist/warmup.js +23 -0
- package/package.json +61 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parsePumpFeesInstruction = parsePumpFeesInstruction;
|
|
4
|
+
const metadata_js_1 = require("../core/metadata.js");
|
|
5
|
+
const dex_event_js_1 = require("../core/dex_event.js");
|
|
6
|
+
const binary_js_1 = require("../util/binary.js");
|
|
7
|
+
const pump_fees_js_1 = require("../logs/pump_fees.js");
|
|
8
|
+
const program_log_discriminators_js_1 = require("../logs/program_log_discriminators.js");
|
|
9
|
+
const CREATE_FEE_SHARING_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([195, 78, 86, 76, 111, 52, 251, 213]);
|
|
10
|
+
const INITIALIZE_FEE_CONFIG_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([62, 162, 20, 133, 121, 65, 145, 27]);
|
|
11
|
+
const RESET_FEE_SHARING_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([10, 2, 182, 95, 16, 127, 129, 186]);
|
|
12
|
+
const RESET_FEE_SHARING_V2_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([169, 245, 17, 209, 94, 91, 248, 128]);
|
|
13
|
+
const REVOKE_FEE_SHARING_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([18, 233, 158, 39, 185, 207, 58, 104]);
|
|
14
|
+
const TRANSFER_FEE_SHARING_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([202, 10, 75, 200, 164, 34, 210, 96]);
|
|
15
|
+
const UPDATE_ADMIN_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([161, 176, 40, 213, 60, 184, 179, 228]);
|
|
16
|
+
const UPDATE_FEE_CONFIG_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([104, 184, 103, 242, 88, 151, 107, 20]);
|
|
17
|
+
const UPDATE_FEE_SHARES_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([189, 13, 136, 99, 187, 164, 237, 35]);
|
|
18
|
+
const UPDATE_FEE_SHARES_V2_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([111, 251, 49, 6, 78, 78, 106, 18]);
|
|
19
|
+
const UPSERT_FEE_TIERS_IX = (0, program_log_discriminators_js_1.u64leDiscriminator)([227, 23, 150, 12, 77, 86, 94, 4]);
|
|
20
|
+
function account(accounts, index) {
|
|
21
|
+
return accounts[index] ?? null;
|
|
22
|
+
}
|
|
23
|
+
function accountOrDefault(accounts, index) {
|
|
24
|
+
return accounts[index] ?? (0, dex_event_js_1.defaultPubkey)();
|
|
25
|
+
}
|
|
26
|
+
function parsePumpFeesInstruction(instructionData, accounts, signature, slot, txIndex, blockTimeUs, grpcRecvUs) {
|
|
27
|
+
const disc = (0, binary_js_1.readDiscriminatorU64)(instructionData);
|
|
28
|
+
if (disc === null)
|
|
29
|
+
return null;
|
|
30
|
+
const metadata = (0, metadata_js_1.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
31
|
+
if (disc === CREATE_FEE_SHARING_IX) {
|
|
32
|
+
const admin = account(accounts, 2);
|
|
33
|
+
const mint = account(accounts, 4);
|
|
34
|
+
if (!admin || !mint)
|
|
35
|
+
return null;
|
|
36
|
+
return {
|
|
37
|
+
PumpFeesCreateFeeSharingConfig: {
|
|
38
|
+
metadata,
|
|
39
|
+
timestamp: 0n,
|
|
40
|
+
mint,
|
|
41
|
+
bonding_curve: accountOrDefault(accounts, 7),
|
|
42
|
+
pool: account(accounts, 10) ?? undefined,
|
|
43
|
+
sharing_config: accountOrDefault(accounts, 5),
|
|
44
|
+
admin,
|
|
45
|
+
initial_shareholders: [],
|
|
46
|
+
status: "Active",
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (disc === UPDATE_FEE_SHARES_IX || disc === UPDATE_FEE_SHARES_V2_IX) {
|
|
51
|
+
const admin = account(accounts, 2);
|
|
52
|
+
const mint = account(accounts, 4);
|
|
53
|
+
const sharing_config = account(accounts, 5);
|
|
54
|
+
if (!admin || !mint || !sharing_config)
|
|
55
|
+
return null;
|
|
56
|
+
const shareholders = (0, pump_fees_js_1.readShareholdersVec)(instructionData, 8);
|
|
57
|
+
if (!shareholders || shareholders.next !== instructionData.length)
|
|
58
|
+
return null;
|
|
59
|
+
return {
|
|
60
|
+
PumpFeesUpdateFeeShares: {
|
|
61
|
+
metadata,
|
|
62
|
+
timestamp: 0n,
|
|
63
|
+
mint,
|
|
64
|
+
sharing_config,
|
|
65
|
+
admin,
|
|
66
|
+
bonding_curve: accountOrDefault(accounts, 6),
|
|
67
|
+
pump_creator_vault: accountOrDefault(accounts, 7),
|
|
68
|
+
new_shareholders: shareholders.value,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (disc === INITIALIZE_FEE_CONFIG_IX) {
|
|
73
|
+
const admin = account(accounts, 0);
|
|
74
|
+
const fee_config = account(accounts, 1);
|
|
75
|
+
if (!admin || !fee_config)
|
|
76
|
+
return null;
|
|
77
|
+
return { PumpFeesInitializeFeeConfig: { metadata, timestamp: 0n, admin, fee_config } };
|
|
78
|
+
}
|
|
79
|
+
if (disc === RESET_FEE_SHARING_IX || disc === RESET_FEE_SHARING_V2_IX) {
|
|
80
|
+
const new_admin = account(accounts, 0);
|
|
81
|
+
const old_admin = account(accounts, 3);
|
|
82
|
+
const mint = account(accounts, 5);
|
|
83
|
+
const sharing_config = account(accounts, 6);
|
|
84
|
+
if (!old_admin || !new_admin || !mint || !sharing_config)
|
|
85
|
+
return null;
|
|
86
|
+
return {
|
|
87
|
+
PumpFeesResetFeeSharingConfig: {
|
|
88
|
+
metadata,
|
|
89
|
+
timestamp: 0n,
|
|
90
|
+
mint,
|
|
91
|
+
sharing_config,
|
|
92
|
+
old_admin,
|
|
93
|
+
old_shareholders: [],
|
|
94
|
+
new_admin,
|
|
95
|
+
new_shareholders: [],
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (disc === REVOKE_FEE_SHARING_IX) {
|
|
100
|
+
const admin = account(accounts, 0);
|
|
101
|
+
const mint = account(accounts, 2);
|
|
102
|
+
const sharing_config = account(accounts, 3);
|
|
103
|
+
if (!admin || !mint || !sharing_config)
|
|
104
|
+
return null;
|
|
105
|
+
return { PumpFeesRevokeFeeSharingAuthority: { metadata, timestamp: 0n, mint, sharing_config, admin } };
|
|
106
|
+
}
|
|
107
|
+
if (disc === TRANSFER_FEE_SHARING_IX) {
|
|
108
|
+
const old_admin = account(accounts, 0);
|
|
109
|
+
const mint = account(accounts, 2);
|
|
110
|
+
const sharing_config = account(accounts, 3);
|
|
111
|
+
const new_admin = account(accounts, 4);
|
|
112
|
+
if (!old_admin || !mint || !sharing_config || !new_admin)
|
|
113
|
+
return null;
|
|
114
|
+
return {
|
|
115
|
+
PumpFeesTransferFeeSharingAuthority: {
|
|
116
|
+
metadata,
|
|
117
|
+
timestamp: 0n,
|
|
118
|
+
mint,
|
|
119
|
+
sharing_config,
|
|
120
|
+
old_admin,
|
|
121
|
+
new_admin,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (disc === UPDATE_ADMIN_IX) {
|
|
126
|
+
const old_admin = account(accounts, 0);
|
|
127
|
+
const new_admin = account(accounts, 2);
|
|
128
|
+
if (!old_admin || !new_admin)
|
|
129
|
+
return null;
|
|
130
|
+
return { PumpFeesUpdateAdmin: { metadata, timestamp: 0n, old_admin, new_admin } };
|
|
131
|
+
}
|
|
132
|
+
if (disc === UPDATE_FEE_CONFIG_IX) {
|
|
133
|
+
const fee_config = account(accounts, 0);
|
|
134
|
+
const admin = account(accounts, 1);
|
|
135
|
+
if (!fee_config || !admin)
|
|
136
|
+
return null;
|
|
137
|
+
const fee_tiers = (0, pump_fees_js_1.readFeeTiersVec)(instructionData, 8);
|
|
138
|
+
if (!fee_tiers)
|
|
139
|
+
return null;
|
|
140
|
+
const flat_fees = (0, pump_fees_js_1.readFeesAt)(instructionData, fee_tiers.next);
|
|
141
|
+
if (!flat_fees || flat_fees.next !== instructionData.length)
|
|
142
|
+
return null;
|
|
143
|
+
return {
|
|
144
|
+
PumpFeesUpdateFeeConfig: {
|
|
145
|
+
metadata,
|
|
146
|
+
timestamp: 0n,
|
|
147
|
+
admin,
|
|
148
|
+
fee_config,
|
|
149
|
+
fee_tiers: fee_tiers.value,
|
|
150
|
+
flat_fees: flat_fees.value,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (disc === UPSERT_FEE_TIERS_IX) {
|
|
155
|
+
const fee_config = account(accounts, 0);
|
|
156
|
+
const admin = account(accounts, 1);
|
|
157
|
+
if (!fee_config || !admin)
|
|
158
|
+
return null;
|
|
159
|
+
const fee_tiers = (0, pump_fees_js_1.readFeeTiersVec)(instructionData, 8);
|
|
160
|
+
if (!fee_tiers)
|
|
161
|
+
return null;
|
|
162
|
+
const offset = (0, binary_js_1.readU8)(instructionData, fee_tiers.next);
|
|
163
|
+
if (offset === null || fee_tiers.next + 1 !== instructionData.length)
|
|
164
|
+
return null;
|
|
165
|
+
return { PumpFeesUpsertFeeTiers: { metadata, timestamp: 0n, admin, fee_config, fee_tiers: fee_tiers.value, offset } };
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PumpFun 指令解析
|
|
3
|
+
*/
|
|
4
|
+
import type { DexEvent } from "../core/dex_event.js";
|
|
5
|
+
export declare const PUMPFUN_SOL_QUOTE_MINT = "So11111111111111111111111111111111111111111";
|
|
6
|
+
export declare function parsePumpfunInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PUMPFUN_SOL_QUOTE_MINT = void 0;
|
|
4
|
+
exports.parsePumpfunInstruction = parsePumpfunInstruction;
|
|
5
|
+
const dex_event_js_1 = require("../core/dex_event.js");
|
|
6
|
+
const utils_js_1 = require("./utils.js");
|
|
7
|
+
const binary_js_1 = require("../util/binary.js");
|
|
8
|
+
const Z = (0, dex_event_js_1.defaultPubkey)();
|
|
9
|
+
exports.PUMPFUN_SOL_QUOTE_MINT = "So11111111111111111111111111111111111111111";
|
|
10
|
+
const DISC = {
|
|
11
|
+
BUY: Uint8Array.from([102, 6, 61, 18, 1, 218, 235, 234]),
|
|
12
|
+
SELL: Uint8Array.from([51, 230, 133, 164, 1, 127, 131, 173]),
|
|
13
|
+
CREATE: Uint8Array.from([24, 30, 200, 40, 5, 28, 7, 119]),
|
|
14
|
+
CREATE_V2: Uint8Array.from([214, 144, 76, 236, 95, 139, 49, 180]),
|
|
15
|
+
BUY_EXACT_SOL_IN: Uint8Array.from([56, 252, 116, 8, 158, 223, 205, 95]),
|
|
16
|
+
BUY_V2: Uint8Array.from([184, 23, 238, 97, 103, 197, 211, 61]),
|
|
17
|
+
SELL_V2: Uint8Array.from([93, 246, 130, 60, 231, 233, 64, 178]),
|
|
18
|
+
BUY_EXACT_QUOTE_IN_V2: Uint8Array.from([194, 171, 28, 70, 104, 77, 91, 47]),
|
|
19
|
+
MIGRATE_EVENT_LOG: Uint8Array.from([189, 233, 93, 185, 92, 148, 234, 148]),
|
|
20
|
+
};
|
|
21
|
+
function discEq(data, disc) {
|
|
22
|
+
if (data.length < 8)
|
|
23
|
+
return false;
|
|
24
|
+
for (let i = 0; i < 8; i++)
|
|
25
|
+
if (data[i] !== disc[i])
|
|
26
|
+
return false;
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
function createNumericDefaults() {
|
|
30
|
+
return {
|
|
31
|
+
timestamp: 0n,
|
|
32
|
+
virtual_token_reserves: 0n,
|
|
33
|
+
virtual_sol_reserves: 0n,
|
|
34
|
+
real_token_reserves: 0n,
|
|
35
|
+
token_total_supply: 0n,
|
|
36
|
+
is_mayhem_mode: false,
|
|
37
|
+
is_cashback_enabled: false,
|
|
38
|
+
quote_mint: exports.PUMPFUN_SOL_QUOTE_MINT,
|
|
39
|
+
quote_vault: Z,
|
|
40
|
+
quote_token_program: Z,
|
|
41
|
+
virtual_quote_reserves: 0n,
|
|
42
|
+
ix_name: "",
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function parsePumpfunTradeV2Instruction(ixName, data, accounts, metadata) {
|
|
46
|
+
if (!accounts[1])
|
|
47
|
+
return null;
|
|
48
|
+
const normalizedIxName = ixName === "buy_v2" ? "buy" : ixName === "sell_v2" ? "sell" : "buy_exact_quote_in";
|
|
49
|
+
const first = data.length >= 8 ? (0, utils_js_1.readU64LE)(data, 0) ?? 0n : 0n;
|
|
50
|
+
const second = data.length >= 16 ? (0, utils_js_1.readU64LE)(data, 8) ?? 0n : 0n;
|
|
51
|
+
const tokenAmount = ixName === "buy_exact_quote_in_v2" ? second : first;
|
|
52
|
+
const solAmount = ixName === "buy_exact_quote_in_v2" ? first : second;
|
|
53
|
+
const trade = {
|
|
54
|
+
metadata,
|
|
55
|
+
mint: accounts[1] ?? Z,
|
|
56
|
+
quote_mint: accounts[2] ?? Z,
|
|
57
|
+
global: accounts[0] ?? Z,
|
|
58
|
+
bonding_curve: accounts[10] ?? Z,
|
|
59
|
+
bonding_curve_v2: Z,
|
|
60
|
+
user: accounts[13] ?? Z,
|
|
61
|
+
sol_amount: solAmount,
|
|
62
|
+
token_amount: tokenAmount,
|
|
63
|
+
amount: ixName === "buy_exact_quote_in_v2" ? second : first,
|
|
64
|
+
max_sol_cost: ixName === "buy_exact_quote_in_v2" ? 0n : ixName === "sell_v2" ? 0n : second,
|
|
65
|
+
min_sol_output: ixName === "sell_v2" ? second : 0n,
|
|
66
|
+
spendable_sol_in: 0n,
|
|
67
|
+
spendable_quote_in: ixName === "buy_exact_quote_in_v2" ? first : 0n,
|
|
68
|
+
min_tokens_out: ixName === "buy_exact_quote_in_v2" ? second : 0n,
|
|
69
|
+
quote_amount: ixName === "buy_exact_quote_in_v2" ? first : 0n,
|
|
70
|
+
fee_recipient: accounts[6] ?? Z,
|
|
71
|
+
is_buy: ixName !== "sell_v2",
|
|
72
|
+
is_created_buy: false,
|
|
73
|
+
timestamp: 0n,
|
|
74
|
+
virtual_sol_reserves: 0n,
|
|
75
|
+
virtual_token_reserves: 0n,
|
|
76
|
+
real_sol_reserves: 0n,
|
|
77
|
+
real_token_reserves: 0n,
|
|
78
|
+
fee_basis_points: 0n,
|
|
79
|
+
fee: 0n,
|
|
80
|
+
creator: Z,
|
|
81
|
+
creator_fee_basis_points: 0n,
|
|
82
|
+
creator_fee: 0n,
|
|
83
|
+
track_volume: false,
|
|
84
|
+
total_unclaimed_tokens: 0n,
|
|
85
|
+
total_claimed_tokens: 0n,
|
|
86
|
+
current_sol_volume: 0n,
|
|
87
|
+
last_update_timestamp: 0n,
|
|
88
|
+
ix_name: normalizedIxName,
|
|
89
|
+
mayhem_mode: false,
|
|
90
|
+
cashback_fee_basis_points: 0n,
|
|
91
|
+
cashback: 0n,
|
|
92
|
+
is_cashback_coin: false,
|
|
93
|
+
associated_bonding_curve: accounts[11] ?? Z,
|
|
94
|
+
associated_user: accounts[14] ?? Z,
|
|
95
|
+
system_program: accounts[ixName === "sell_v2" ? 23 : 24] ?? Z,
|
|
96
|
+
token_program: accounts[3] ?? Z,
|
|
97
|
+
quote_token_program: accounts[4] ?? Z,
|
|
98
|
+
associated_token_program: accounts[5] ?? Z,
|
|
99
|
+
creator_vault: accounts[16] ?? Z,
|
|
100
|
+
associated_quote_fee_recipient: accounts[7] ?? Z,
|
|
101
|
+
buyback_fee_recipient: accounts[8] ?? Z,
|
|
102
|
+
associated_quote_buyback_fee_recipient: accounts[9] ?? Z,
|
|
103
|
+
associated_quote_bonding_curve: accounts[12] ?? Z,
|
|
104
|
+
associated_quote_user: accounts[15] ?? Z,
|
|
105
|
+
associated_creator_vault: accounts[17] ?? Z,
|
|
106
|
+
sharing_config: accounts[18] ?? Z,
|
|
107
|
+
event_authority: accounts[ixName === "sell_v2" ? 24 : 25] ?? Z,
|
|
108
|
+
program: accounts[ixName === "sell_v2" ? 25 : 26] ?? Z,
|
|
109
|
+
global_volume_accumulator: ixName === "sell_v2" ? Z : accounts[19] ?? Z,
|
|
110
|
+
user_volume_accumulator: accounts[ixName === "sell_v2" ? 19 : 20] ?? Z,
|
|
111
|
+
associated_user_volume_accumulator: accounts[ixName === "sell_v2" ? 20 : 21] ?? Z,
|
|
112
|
+
fee_config: accounts[ixName === "sell_v2" ? 21 : 22] ?? Z,
|
|
113
|
+
fee_program: accounts[ixName === "sell_v2" ? 22 : 23] ?? Z,
|
|
114
|
+
};
|
|
115
|
+
if (normalizedIxName === "buy")
|
|
116
|
+
return { PumpFunBuy: trade };
|
|
117
|
+
if (normalizedIxName === "sell")
|
|
118
|
+
return { PumpFunSell: trade };
|
|
119
|
+
return { PumpFunBuy: trade };
|
|
120
|
+
}
|
|
121
|
+
function parsePumpfunLegacyBuyInstruction(ixName, data, accounts, metadata) {
|
|
122
|
+
if (accounts.length < 16)
|
|
123
|
+
return null;
|
|
124
|
+
const first = data.length >= 8 ? (0, utils_js_1.readU64LE)(data, 0) ?? 0n : 0n;
|
|
125
|
+
const second = data.length >= 16 ? (0, utils_js_1.readU64LE)(data, 8) ?? 0n : 0n;
|
|
126
|
+
const exactSolIn = ixName === "buy_exact_sol_in";
|
|
127
|
+
const buybackFeeRecipient = accounts[17] ?? Z;
|
|
128
|
+
const trade = {
|
|
129
|
+
metadata,
|
|
130
|
+
mint: accounts[2] ?? Z,
|
|
131
|
+
global: accounts[0] ?? Z,
|
|
132
|
+
bonding_curve: accounts[3] ?? Z,
|
|
133
|
+
bonding_curve_v2: accounts[16] ?? Z,
|
|
134
|
+
associated_bonding_curve: accounts[4] ?? Z,
|
|
135
|
+
associated_user: accounts[5] ?? Z,
|
|
136
|
+
user: accounts[6] ?? Z,
|
|
137
|
+
system_program: accounts[7] ?? Z,
|
|
138
|
+
token_program: accounts[8] ?? Z,
|
|
139
|
+
creator_vault: accounts[9] ?? Z,
|
|
140
|
+
event_authority: accounts[10] ?? Z,
|
|
141
|
+
program: accounts[11] ?? Z,
|
|
142
|
+
global_volume_accumulator: accounts[12] ?? Z,
|
|
143
|
+
user_volume_accumulator: accounts[13] ?? Z,
|
|
144
|
+
fee_config: accounts[14] ?? Z,
|
|
145
|
+
fee_program: accounts[15] ?? Z,
|
|
146
|
+
buyback_fee_recipient: buybackFeeRecipient,
|
|
147
|
+
is_buy: true,
|
|
148
|
+
is_created_buy: false,
|
|
149
|
+
sol_amount: exactSolIn ? first : second,
|
|
150
|
+
token_amount: exactSolIn ? second : first,
|
|
151
|
+
amount: exactSolIn ? second : first,
|
|
152
|
+
max_sol_cost: exactSolIn ? first : second,
|
|
153
|
+
spendable_sol_in: exactSolIn ? first : 0n,
|
|
154
|
+
spendable_quote_in: 0n,
|
|
155
|
+
min_tokens_out: exactSolIn ? second : 0n,
|
|
156
|
+
min_sol_output: 0n,
|
|
157
|
+
quote_amount: 0n,
|
|
158
|
+
fee_recipient: accounts[1] ?? Z,
|
|
159
|
+
timestamp: 0n,
|
|
160
|
+
virtual_sol_reserves: 0n,
|
|
161
|
+
virtual_token_reserves: 0n,
|
|
162
|
+
real_sol_reserves: 0n,
|
|
163
|
+
real_token_reserves: 0n,
|
|
164
|
+
fee_basis_points: 0n,
|
|
165
|
+
fee: 0n,
|
|
166
|
+
creator: Z,
|
|
167
|
+
creator_fee_basis_points: 0n,
|
|
168
|
+
creator_fee: 0n,
|
|
169
|
+
track_volume: (data[16] ?? 0) !== 0,
|
|
170
|
+
total_unclaimed_tokens: 0n,
|
|
171
|
+
total_claimed_tokens: 0n,
|
|
172
|
+
current_sol_volume: 0n,
|
|
173
|
+
last_update_timestamp: 0n,
|
|
174
|
+
ix_name: ixName,
|
|
175
|
+
mayhem_mode: false,
|
|
176
|
+
cashback_fee_basis_points: 0n,
|
|
177
|
+
cashback: 0n,
|
|
178
|
+
is_cashback_coin: false,
|
|
179
|
+
quote_mint: exports.PUMPFUN_SOL_QUOTE_MINT,
|
|
180
|
+
quote_token_program: Z,
|
|
181
|
+
associated_token_program: Z,
|
|
182
|
+
associated_quote_fee_recipient: Z,
|
|
183
|
+
associated_quote_buyback_fee_recipient: Z,
|
|
184
|
+
associated_quote_bonding_curve: Z,
|
|
185
|
+
associated_quote_user: Z,
|
|
186
|
+
associated_creator_vault: Z,
|
|
187
|
+
sharing_config: Z,
|
|
188
|
+
associated_user_volume_accumulator: Z,
|
|
189
|
+
...(buybackFeeRecipient !== Z ? { account: buybackFeeRecipient } : {}),
|
|
190
|
+
};
|
|
191
|
+
if (exactSolIn)
|
|
192
|
+
return { PumpFunBuyExactSolIn: trade };
|
|
193
|
+
return { PumpFunBuy: trade };
|
|
194
|
+
}
|
|
195
|
+
function parsePumpfunLegacySellInstruction(data, accounts, metadata) {
|
|
196
|
+
if (accounts.length < 14)
|
|
197
|
+
return null;
|
|
198
|
+
const amount = data.length >= 8 ? (0, utils_js_1.readU64LE)(data, 0) ?? 0n : 0n;
|
|
199
|
+
const minSolOutput = data.length >= 16 ? (0, utils_js_1.readU64LE)(data, 8) ?? 0n : 0n;
|
|
200
|
+
let legacyUserVolumeAccumulator = Z;
|
|
201
|
+
let legacyBondingCurveV2 = accounts[14] ?? Z;
|
|
202
|
+
let legacyBuybackFeeRecipient = Z;
|
|
203
|
+
if (accounts.length >= 17) {
|
|
204
|
+
legacyUserVolumeAccumulator = accounts[14] ?? Z;
|
|
205
|
+
legacyBondingCurveV2 = accounts[15] ?? Z;
|
|
206
|
+
legacyBuybackFeeRecipient = accounts[16] ?? Z;
|
|
207
|
+
}
|
|
208
|
+
else if (accounts.length >= 16) {
|
|
209
|
+
legacyBondingCurveV2 = accounts[14] ?? Z;
|
|
210
|
+
legacyBuybackFeeRecipient = accounts[15] ?? Z;
|
|
211
|
+
}
|
|
212
|
+
const trade = {
|
|
213
|
+
metadata,
|
|
214
|
+
mint: accounts[2] ?? Z,
|
|
215
|
+
quote_mint: exports.PUMPFUN_SOL_QUOTE_MINT,
|
|
216
|
+
is_buy: false,
|
|
217
|
+
is_created_buy: false,
|
|
218
|
+
global: accounts[0] ?? Z,
|
|
219
|
+
bonding_curve: accounts[3] ?? Z,
|
|
220
|
+
bonding_curve_v2: legacyBondingCurveV2,
|
|
221
|
+
associated_bonding_curve: accounts[4] ?? Z,
|
|
222
|
+
associated_user: accounts[5] ?? Z,
|
|
223
|
+
user: accounts[6] ?? Z,
|
|
224
|
+
system_program: accounts[7] ?? Z,
|
|
225
|
+
fee_recipient: accounts[1] ?? Z,
|
|
226
|
+
token_program: accounts[9] ?? Z,
|
|
227
|
+
quote_token_program: Z,
|
|
228
|
+
associated_token_program: Z,
|
|
229
|
+
creator_vault: accounts[8] ?? Z,
|
|
230
|
+
associated_quote_fee_recipient: Z,
|
|
231
|
+
buyback_fee_recipient: legacyBuybackFeeRecipient,
|
|
232
|
+
associated_quote_buyback_fee_recipient: Z,
|
|
233
|
+
associated_quote_bonding_curve: Z,
|
|
234
|
+
associated_quote_user: Z,
|
|
235
|
+
associated_creator_vault: Z,
|
|
236
|
+
sharing_config: Z,
|
|
237
|
+
event_authority: accounts[10] ?? Z,
|
|
238
|
+
program: accounts[11] ?? Z,
|
|
239
|
+
global_volume_accumulator: Z,
|
|
240
|
+
user_volume_accumulator: legacyUserVolumeAccumulator,
|
|
241
|
+
associated_user_volume_accumulator: Z,
|
|
242
|
+
fee_config: accounts[12] ?? Z,
|
|
243
|
+
fee_program: accounts[13] ?? Z,
|
|
244
|
+
sol_amount: minSolOutput,
|
|
245
|
+
token_amount: amount,
|
|
246
|
+
amount,
|
|
247
|
+
max_sol_cost: 0n,
|
|
248
|
+
min_sol_output: minSolOutput,
|
|
249
|
+
spendable_sol_in: 0n,
|
|
250
|
+
spendable_quote_in: 0n,
|
|
251
|
+
min_tokens_out: 0n,
|
|
252
|
+
quote_amount: 0n,
|
|
253
|
+
timestamp: 0n,
|
|
254
|
+
virtual_sol_reserves: 0n,
|
|
255
|
+
virtual_token_reserves: 0n,
|
|
256
|
+
real_sol_reserves: 0n,
|
|
257
|
+
real_token_reserves: 0n,
|
|
258
|
+
fee_basis_points: 0n,
|
|
259
|
+
fee: 0n,
|
|
260
|
+
creator: Z,
|
|
261
|
+
creator_fee_basis_points: 0n,
|
|
262
|
+
creator_fee: 0n,
|
|
263
|
+
track_volume: false,
|
|
264
|
+
total_unclaimed_tokens: 0n,
|
|
265
|
+
total_claimed_tokens: 0n,
|
|
266
|
+
current_sol_volume: 0n,
|
|
267
|
+
last_update_timestamp: 0n,
|
|
268
|
+
ix_name: "sell",
|
|
269
|
+
mayhem_mode: false,
|
|
270
|
+
cashback_fee_basis_points: 0n,
|
|
271
|
+
cashback: 0n,
|
|
272
|
+
is_cashback_coin: false,
|
|
273
|
+
...(legacyBuybackFeeRecipient !== Z ? { account: legacyBuybackFeeRecipient } : {}),
|
|
274
|
+
};
|
|
275
|
+
return { PumpFunSell: trade };
|
|
276
|
+
}
|
|
277
|
+
function parsePumpfunInstruction(instructionData, accounts, signature, slot, txIndex, blockTimeUs, grpcRecvUs) {
|
|
278
|
+
if (instructionData.length < 8)
|
|
279
|
+
return null;
|
|
280
|
+
const outer = instructionData.subarray(0, 8);
|
|
281
|
+
const data = instructionData.subarray(8);
|
|
282
|
+
const meta = (0, utils_js_1.ixMeta)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
283
|
+
if (discEq(outer, DISC.CREATE_V2)) {
|
|
284
|
+
if (accounts.length < 16)
|
|
285
|
+
return null;
|
|
286
|
+
let o = 0;
|
|
287
|
+
const n1 = (0, utils_js_1.readBorshStrAt)(data, o);
|
|
288
|
+
if (!n1)
|
|
289
|
+
return null;
|
|
290
|
+
o = n1.next;
|
|
291
|
+
const n2 = (0, utils_js_1.readBorshStrAt)(data, o);
|
|
292
|
+
if (!n2)
|
|
293
|
+
return null;
|
|
294
|
+
o = n2.next;
|
|
295
|
+
const n3 = (0, utils_js_1.readBorshStrAt)(data, o);
|
|
296
|
+
if (!n3)
|
|
297
|
+
return null;
|
|
298
|
+
o = n3.next;
|
|
299
|
+
if (o + 33 > data.length)
|
|
300
|
+
return null;
|
|
301
|
+
const creator = (0, utils_js_1.readPubkeyIx)(data, o);
|
|
302
|
+
if (!creator)
|
|
303
|
+
return null;
|
|
304
|
+
o += 32;
|
|
305
|
+
const isMayhemMode = (0, utils_js_1.readBool)(data, o);
|
|
306
|
+
if (isMayhemMode === null)
|
|
307
|
+
return null;
|
|
308
|
+
o += 1;
|
|
309
|
+
const isCashbackEnabled = (0, utils_js_1.readBool)(data, o) ?? false;
|
|
310
|
+
const mint = accounts[0];
|
|
311
|
+
const ev = {
|
|
312
|
+
metadata: meta,
|
|
313
|
+
name: n1.s,
|
|
314
|
+
symbol: n2.s,
|
|
315
|
+
uri: n3.s,
|
|
316
|
+
mint,
|
|
317
|
+
bonding_curve: accounts[2] ?? Z,
|
|
318
|
+
user: accounts[5] ?? Z,
|
|
319
|
+
creator,
|
|
320
|
+
mint_authority: accounts[1] ?? Z,
|
|
321
|
+
associated_bonding_curve: accounts[3] ?? Z,
|
|
322
|
+
global: accounts[4] ?? Z,
|
|
323
|
+
system_program: accounts[6] ?? Z,
|
|
324
|
+
token_program: accounts[7] ?? Z,
|
|
325
|
+
associated_token_program: accounts[8] ?? Z,
|
|
326
|
+
mayhem_program_id: accounts[9] ?? Z,
|
|
327
|
+
global_params: accounts[10] ?? Z,
|
|
328
|
+
sol_vault: accounts[11] ?? Z,
|
|
329
|
+
mayhem_state: accounts[12] ?? Z,
|
|
330
|
+
mayhem_token_vault: accounts[13] ?? Z,
|
|
331
|
+
event_authority: accounts[14] ?? Z,
|
|
332
|
+
program: accounts[15] ?? Z,
|
|
333
|
+
observed_fee_recipient: Z,
|
|
334
|
+
...createNumericDefaults(),
|
|
335
|
+
quote_mint: accounts[16] ?? exports.PUMPFUN_SOL_QUOTE_MINT,
|
|
336
|
+
quote_vault: accounts[17] ?? Z,
|
|
337
|
+
quote_token_program: accounts[18] ?? Z,
|
|
338
|
+
ix_name: "create_v2",
|
|
339
|
+
is_mayhem_mode: isMayhemMode,
|
|
340
|
+
is_cashback_enabled: isCashbackEnabled,
|
|
341
|
+
};
|
|
342
|
+
return { PumpFunCreateV2: ev };
|
|
343
|
+
}
|
|
344
|
+
if (discEq(outer, DISC.BUY)) {
|
|
345
|
+
return parsePumpfunLegacyBuyInstruction("buy", data, accounts, meta);
|
|
346
|
+
}
|
|
347
|
+
if (discEq(outer, DISC.BUY_EXACT_SOL_IN)) {
|
|
348
|
+
return parsePumpfunLegacyBuyInstruction("buy_exact_sol_in", data, accounts, meta);
|
|
349
|
+
}
|
|
350
|
+
if (discEq(outer, DISC.SELL)) {
|
|
351
|
+
return parsePumpfunLegacySellInstruction(data, accounts, meta);
|
|
352
|
+
}
|
|
353
|
+
if (discEq(outer, DISC.BUY_V2)) {
|
|
354
|
+
return parsePumpfunTradeV2Instruction("buy_v2", data, accounts, meta);
|
|
355
|
+
}
|
|
356
|
+
if (discEq(outer, DISC.BUY_EXACT_QUOTE_IN_V2)) {
|
|
357
|
+
return parsePumpfunTradeV2Instruction("buy_exact_quote_in_v2", data, accounts, meta);
|
|
358
|
+
}
|
|
359
|
+
if (discEq(outer, DISC.SELL_V2)) {
|
|
360
|
+
return parsePumpfunTradeV2Instruction("sell_v2", data, accounts, meta);
|
|
361
|
+
}
|
|
362
|
+
if (discEq(outer, DISC.CREATE)) {
|
|
363
|
+
if (accounts.length < 8)
|
|
364
|
+
return null;
|
|
365
|
+
let o = 0;
|
|
366
|
+
const n1 = (0, utils_js_1.readBorshStrAt)(data, o);
|
|
367
|
+
if (!n1)
|
|
368
|
+
return null;
|
|
369
|
+
o = n1.next;
|
|
370
|
+
const n2 = (0, utils_js_1.readBorshStrAt)(data, o);
|
|
371
|
+
if (!n2)
|
|
372
|
+
return null;
|
|
373
|
+
o = n2.next;
|
|
374
|
+
const n3 = (0, utils_js_1.readBorshStrAt)(data, o);
|
|
375
|
+
if (!n3)
|
|
376
|
+
return null;
|
|
377
|
+
o = n3.next;
|
|
378
|
+
const creator = o + 32 <= data.length ? (0, utils_js_1.readPubkeyIx)(data, o) ?? Z : Z;
|
|
379
|
+
const mint = accounts[0];
|
|
380
|
+
return {
|
|
381
|
+
PumpFunCreate: {
|
|
382
|
+
metadata: meta,
|
|
383
|
+
name: n1.s,
|
|
384
|
+
symbol: n2.s,
|
|
385
|
+
uri: n3.s,
|
|
386
|
+
mint,
|
|
387
|
+
bonding_curve: accounts[2] ?? Z,
|
|
388
|
+
user: accounts[7] ?? Z,
|
|
389
|
+
creator,
|
|
390
|
+
token_program: Z,
|
|
391
|
+
...createNumericDefaults(),
|
|
392
|
+
ix_name: "create",
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
if (instructionData.length >= 16) {
|
|
397
|
+
const cpi = instructionData.subarray(8, 16);
|
|
398
|
+
if (discEq(cpi, DISC.MIGRATE_EVENT_LOG)) {
|
|
399
|
+
const payload = instructionData.subarray(16);
|
|
400
|
+
let o = 0;
|
|
401
|
+
const user = (0, utils_js_1.readPubkeyIx)(payload, o);
|
|
402
|
+
if (!user)
|
|
403
|
+
return null;
|
|
404
|
+
o += 32;
|
|
405
|
+
const mint = (0, utils_js_1.readPubkeyIx)(payload, o);
|
|
406
|
+
if (!mint)
|
|
407
|
+
return null;
|
|
408
|
+
o += 32;
|
|
409
|
+
const mint_amount = (0, utils_js_1.readU64LE)(payload, o);
|
|
410
|
+
if (mint_amount === null)
|
|
411
|
+
return null;
|
|
412
|
+
o += 8;
|
|
413
|
+
const sol_amount = (0, utils_js_1.readU64LE)(payload, o);
|
|
414
|
+
if (sol_amount === null)
|
|
415
|
+
return null;
|
|
416
|
+
o += 8;
|
|
417
|
+
const pool_migration_fee = (0, utils_js_1.readU64LE)(payload, o);
|
|
418
|
+
if (pool_migration_fee === null)
|
|
419
|
+
return null;
|
|
420
|
+
o += 8;
|
|
421
|
+
const bonding_curve = (0, utils_js_1.readPubkeyIx)(payload, o);
|
|
422
|
+
if (!bonding_curve)
|
|
423
|
+
return null;
|
|
424
|
+
o += 32;
|
|
425
|
+
const ts = (0, binary_js_1.readI64LE)(payload, o);
|
|
426
|
+
if (ts === null)
|
|
427
|
+
return null;
|
|
428
|
+
o += 8;
|
|
429
|
+
const pool = (0, utils_js_1.readPubkeyIx)(payload, o);
|
|
430
|
+
if (!pool)
|
|
431
|
+
return null;
|
|
432
|
+
return {
|
|
433
|
+
PumpFunMigrate: {
|
|
434
|
+
metadata: meta,
|
|
435
|
+
user,
|
|
436
|
+
mint,
|
|
437
|
+
mint_amount,
|
|
438
|
+
sol_amount,
|
|
439
|
+
pool_migration_fee,
|
|
440
|
+
bonding_curve,
|
|
441
|
+
timestamp: BigInt(ts),
|
|
442
|
+
pool,
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PumpSwap 指令解析
|
|
3
|
+
*/
|
|
4
|
+
import type { DexEvent } from "../core/dex_event.js";
|
|
5
|
+
export declare function parsePumpswapInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs?: number): DexEvent | null;
|