sol-parser-sdk-nodejs 0.3.0
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/LICENSE +21 -0
- package/README.md +449 -0
- package/README_CN.md +343 -0
- package/dist/accounts/mod.d.ts +11 -0
- package/dist/accounts/mod.js +53 -0
- package/dist/accounts/nonce.d.ts +5 -0
- package/dist/accounts/nonce.js +32 -0
- package/dist/accounts/pumpswap.d.ts +8 -0
- package/dist/accounts/pumpswap.js +192 -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/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 +14 -0
- package/dist/core/account_fill_meteora.js +26 -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 +75 -0
- package/dist/core/account_fill_pumpswap.d.ts +10 -0
- package/dist/core/account_fill_pumpswap.js +78 -0
- package/dist/core/account_fill_raydium.d.ts +20 -0
- package/dist/core/account_fill_raydium.js +104 -0
- package/dist/core/clock.d.ts +2 -0
- package/dist/core/clock.js +7 -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 +1009 -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 +10 -0
- package/dist/core/metadata.js +13 -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 +48 -0
- package/dist/grpc/client.d.ts +52 -0
- package/dist/grpc/client.js +309 -0
- package/dist/grpc/client_stub.d.ts +5 -0
- package/dist/grpc/client_stub.js +5 -0
- package/dist/grpc/types.d.ts +132 -0
- package/dist/grpc/types.js +304 -0
- package/dist/grpc/yellowstone_parse.d.ts +9 -0
- package/dist/grpc/yellowstone_parse.js +46 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +99 -0
- package/dist/instr/bonk_ix.d.ts +5 -0
- package/dist/instr/bonk_ix.js +52 -0
- package/dist/instr/meteora_damm_ix.d.ts +6 -0
- package/dist/instr/meteora_damm_ix.js +349 -0
- package/dist/instr/mod.d.ts +15 -0
- package/dist/instr/mod.js +95 -0
- package/dist/instr/orca_whirlpool_ix.d.ts +5 -0
- package/dist/instr/orca_whirlpool_ix.js +73 -0
- package/dist/instr/program_ids.d.ts +14 -0
- package/dist/instr/program_ids.js +18 -0
- package/dist/instr/pumpfun_ix.d.ts +5 -0
- package/dist/instr/pumpfun_ix.js +167 -0
- package/dist/instr/pumpswap_ix.d.ts +5 -0
- package/dist/instr/pumpswap_ix.js +215 -0
- package/dist/instr/raydium_amm_v4_ix.d.ts +6 -0
- package/dist/instr/raydium_amm_v4_ix.js +46 -0
- package/dist/instr/raydium_clmm_ix.d.ts +5 -0
- package/dist/instr/raydium_clmm_ix.js +85 -0
- package/dist/instr/raydium_cpmm_ix.d.ts +5 -0
- package/dist/instr/raydium_cpmm_ix.js +63 -0
- package/dist/instr/utils.d.ts +10 -0
- package/dist/instr/utils.js +33 -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 +6 -0
- package/dist/logs/meteora_damm.js +509 -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 +5 -0
- package/dist/logs/optimized_matcher.js +194 -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 +22 -0
- package/dist/logs/program_log_discriminators.d.ts +59 -0
- package/dist/logs/program_log_discriminators.js +67 -0
- package/dist/logs/pump.d.ts +12 -0
- package/dist/logs/pump.js +251 -0
- package/dist/logs/pump_amm.d.ts +9 -0
- package/dist/logs/pump_amm.js +418 -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 +8 -0
- package/dist/logs/raydium_clmm.js +141 -0
- package/dist/logs/raydium_cpmm.d.ts +7 -0
- package/dist/logs/raydium_cpmm.js +121 -0
- package/dist/logs/raydium_launchpad.d.ts +12 -0
- package/dist/logs/raydium_launchpad.js +92 -0
- package/dist/parser_alias.d.ts +3 -0
- package/dist/parser_alias.js +2 -0
- package/dist/rpc_parser.d.ts +16 -0
- package/dist/rpc_parser.js +36 -0
- package/dist/rpc_transaction.d.ts +25 -0
- package/dist/rpc_transaction.js +111 -0
- package/dist/util/binary.d.ts +14 -0
- package/dist/util/binary.js +82 -0
- package/dist/warmup.d.ts +3 -0
- package/dist/warmup.js +23 -0
- package/package.json +44 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PUMPSWAP_DISC = void 0;
|
|
4
|
+
exports.parseBuyFromData = parseBuyFromData;
|
|
5
|
+
exports.parseSellFromData = parseSellFromData;
|
|
6
|
+
exports.parseCreatePoolFromData = parseCreatePoolFromData;
|
|
7
|
+
exports.parseAddLiquidityFromData = parseAddLiquidityFromData;
|
|
8
|
+
exports.parseRemoveLiquidityFromData = parseRemoveLiquidityFromData;
|
|
9
|
+
const dex_event_js_1 = require("../core/dex_event.js");
|
|
10
|
+
const binary_js_1 = require("../util/binary.js");
|
|
11
|
+
const program_log_discriminators_js_1 = require("./program_log_discriminators.js");
|
|
12
|
+
Object.defineProperty(exports, "PUMPSWAP_DISC", { enumerable: true, get: function () { return program_log_discriminators_js_1.PUMPSWAP_DISC; } });
|
|
13
|
+
function bn64(v) {
|
|
14
|
+
return v ?? 0n;
|
|
15
|
+
}
|
|
16
|
+
function bnI64(v) {
|
|
17
|
+
return v ?? 0n;
|
|
18
|
+
}
|
|
19
|
+
const ZP = (0, dex_event_js_1.defaultPubkey)();
|
|
20
|
+
function parseBuyFromData(data, metadata) {
|
|
21
|
+
const MIN = 14 * 8 + 7 * 32 + 1 + 5 * 8 + 4;
|
|
22
|
+
if (data.length < MIN)
|
|
23
|
+
return null;
|
|
24
|
+
let o = 0;
|
|
25
|
+
const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
|
|
26
|
+
o += 8;
|
|
27
|
+
const base_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
28
|
+
o += 8;
|
|
29
|
+
const max_quote_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
30
|
+
o += 8;
|
|
31
|
+
const user_base_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
32
|
+
o += 8;
|
|
33
|
+
const user_quote_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
34
|
+
o += 8;
|
|
35
|
+
const pool_base_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
36
|
+
o += 8;
|
|
37
|
+
const pool_quote_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
38
|
+
o += 8;
|
|
39
|
+
const quote_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
40
|
+
o += 8;
|
|
41
|
+
const lp_fee_basis_points = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
42
|
+
o += 8;
|
|
43
|
+
const lp_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
44
|
+
o += 8;
|
|
45
|
+
const protocol_fee_basis_points = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
46
|
+
o += 8;
|
|
47
|
+
const protocol_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
48
|
+
o += 8;
|
|
49
|
+
const quote_amount_in_with_lp_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
50
|
+
o += 8;
|
|
51
|
+
const user_quote_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
52
|
+
o += 8;
|
|
53
|
+
const pool = (0, binary_js_1.readPubkey)(data, o);
|
|
54
|
+
o += 32;
|
|
55
|
+
const user = (0, binary_js_1.readPubkey)(data, o);
|
|
56
|
+
o += 32;
|
|
57
|
+
const user_base_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
58
|
+
o += 32;
|
|
59
|
+
const user_quote_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
60
|
+
o += 32;
|
|
61
|
+
const protocol_fee_recipient = (0, binary_js_1.readPubkey)(data, o);
|
|
62
|
+
o += 32;
|
|
63
|
+
const protocol_fee_recipient_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
64
|
+
o += 32;
|
|
65
|
+
const coin_creator = (0, binary_js_1.readPubkey)(data, o);
|
|
66
|
+
o += 32;
|
|
67
|
+
const coin_creator_fee_basis_points = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
68
|
+
o += 8;
|
|
69
|
+
const coin_creator_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
70
|
+
o += 8;
|
|
71
|
+
const track_volume = (0, binary_js_1.readBool)(data, o);
|
|
72
|
+
o += 1;
|
|
73
|
+
const total_unclaimed_tokens = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
74
|
+
o += 8;
|
|
75
|
+
const total_claimed_tokens = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
76
|
+
o += 8;
|
|
77
|
+
const current_sol_volume = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
78
|
+
o += 8;
|
|
79
|
+
const last_update_timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
|
|
80
|
+
o += 8;
|
|
81
|
+
const min_base_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
82
|
+
o += 8;
|
|
83
|
+
let ix_name = "";
|
|
84
|
+
if (o + 4 <= data.length) {
|
|
85
|
+
const len = (0, binary_js_1.readU32LE)(data, o);
|
|
86
|
+
o += 4;
|
|
87
|
+
if (o + len <= data.length) {
|
|
88
|
+
ix_name = new TextDecoder().decode(data.subarray(o, o + len));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const ev = {
|
|
92
|
+
metadata,
|
|
93
|
+
timestamp,
|
|
94
|
+
base_amount_out,
|
|
95
|
+
max_quote_amount_in,
|
|
96
|
+
user_base_token_reserves,
|
|
97
|
+
user_quote_token_reserves,
|
|
98
|
+
pool_base_token_reserves,
|
|
99
|
+
pool_quote_token_reserves,
|
|
100
|
+
quote_amount_in,
|
|
101
|
+
lp_fee_basis_points,
|
|
102
|
+
lp_fee,
|
|
103
|
+
protocol_fee_basis_points,
|
|
104
|
+
protocol_fee,
|
|
105
|
+
quote_amount_in_with_lp_fee,
|
|
106
|
+
user_quote_amount_in,
|
|
107
|
+
pool,
|
|
108
|
+
user,
|
|
109
|
+
user_base_token_account,
|
|
110
|
+
user_quote_token_account,
|
|
111
|
+
protocol_fee_recipient,
|
|
112
|
+
protocol_fee_recipient_token_account,
|
|
113
|
+
coin_creator,
|
|
114
|
+
coin_creator_fee_basis_points,
|
|
115
|
+
coin_creator_fee,
|
|
116
|
+
track_volume,
|
|
117
|
+
total_unclaimed_tokens,
|
|
118
|
+
total_claimed_tokens,
|
|
119
|
+
current_sol_volume,
|
|
120
|
+
last_update_timestamp,
|
|
121
|
+
min_base_amount_out,
|
|
122
|
+
ix_name,
|
|
123
|
+
cashback_fee_basis_points: 0n,
|
|
124
|
+
cashback: 0n,
|
|
125
|
+
is_pump_pool: false,
|
|
126
|
+
base_mint: ZP,
|
|
127
|
+
quote_mint: ZP,
|
|
128
|
+
pool_base_token_account: ZP,
|
|
129
|
+
pool_quote_token_account: ZP,
|
|
130
|
+
coin_creator_vault_ata: ZP,
|
|
131
|
+
coin_creator_vault_authority: ZP,
|
|
132
|
+
base_token_program: ZP,
|
|
133
|
+
quote_token_program: ZP,
|
|
134
|
+
};
|
|
135
|
+
return { PumpSwapBuy: ev };
|
|
136
|
+
}
|
|
137
|
+
function parseSellFromData(data, metadata) {
|
|
138
|
+
const REQUIRED = 13 * 8 + 7 * 32;
|
|
139
|
+
if (data.length < REQUIRED)
|
|
140
|
+
return null;
|
|
141
|
+
let o = 0;
|
|
142
|
+
const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
|
|
143
|
+
o += 8;
|
|
144
|
+
const base_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
145
|
+
o += 8;
|
|
146
|
+
const min_quote_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
147
|
+
o += 8;
|
|
148
|
+
const user_base_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
149
|
+
o += 8;
|
|
150
|
+
const user_quote_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
151
|
+
o += 8;
|
|
152
|
+
const pool_base_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
153
|
+
o += 8;
|
|
154
|
+
const pool_quote_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
155
|
+
o += 8;
|
|
156
|
+
const quote_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
157
|
+
o += 8;
|
|
158
|
+
const lp_fee_basis_points = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
159
|
+
o += 8;
|
|
160
|
+
const lp_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
161
|
+
o += 8;
|
|
162
|
+
const protocol_fee_basis_points = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
163
|
+
o += 8;
|
|
164
|
+
const protocol_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
165
|
+
o += 8;
|
|
166
|
+
const quote_amount_out_without_lp_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
167
|
+
o += 8;
|
|
168
|
+
const user_quote_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
169
|
+
o += 8;
|
|
170
|
+
const pool = (0, binary_js_1.readPubkey)(data, o);
|
|
171
|
+
o += 32;
|
|
172
|
+
const user = (0, binary_js_1.readPubkey)(data, o);
|
|
173
|
+
o += 32;
|
|
174
|
+
const user_base_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
175
|
+
o += 32;
|
|
176
|
+
const user_quote_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
177
|
+
o += 32;
|
|
178
|
+
const protocol_fee_recipient = (0, binary_js_1.readPubkey)(data, o);
|
|
179
|
+
o += 32;
|
|
180
|
+
const protocol_fee_recipient_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
181
|
+
o += 32;
|
|
182
|
+
const coin_creator = (0, binary_js_1.readPubkey)(data, o);
|
|
183
|
+
o += 32;
|
|
184
|
+
const coin_creator_fee_basis_points = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
185
|
+
o += 8;
|
|
186
|
+
const coin_creator_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
187
|
+
o += 8;
|
|
188
|
+
let cashback_fee_basis_points = 0n;
|
|
189
|
+
let cashback = 0n;
|
|
190
|
+
if (data.length >= 368) {
|
|
191
|
+
cashback_fee_basis_points = bn64((0, binary_js_1.readU64LE)(data, 352));
|
|
192
|
+
cashback = bn64((0, binary_js_1.readU64LE)(data, 360));
|
|
193
|
+
}
|
|
194
|
+
const ev = {
|
|
195
|
+
metadata,
|
|
196
|
+
timestamp,
|
|
197
|
+
base_amount_in,
|
|
198
|
+
min_quote_amount_out,
|
|
199
|
+
user_base_token_reserves,
|
|
200
|
+
user_quote_token_reserves,
|
|
201
|
+
pool_base_token_reserves,
|
|
202
|
+
pool_quote_token_reserves,
|
|
203
|
+
quote_amount_out,
|
|
204
|
+
lp_fee_basis_points,
|
|
205
|
+
lp_fee,
|
|
206
|
+
protocol_fee_basis_points,
|
|
207
|
+
protocol_fee,
|
|
208
|
+
quote_amount_out_without_lp_fee,
|
|
209
|
+
user_quote_amount_out,
|
|
210
|
+
pool,
|
|
211
|
+
user,
|
|
212
|
+
user_base_token_account,
|
|
213
|
+
user_quote_token_account,
|
|
214
|
+
protocol_fee_recipient,
|
|
215
|
+
protocol_fee_recipient_token_account,
|
|
216
|
+
coin_creator,
|
|
217
|
+
coin_creator_fee_basis_points,
|
|
218
|
+
coin_creator_fee,
|
|
219
|
+
cashback_fee_basis_points,
|
|
220
|
+
cashback,
|
|
221
|
+
is_pump_pool: false,
|
|
222
|
+
base_mint: ZP,
|
|
223
|
+
quote_mint: ZP,
|
|
224
|
+
pool_base_token_account: ZP,
|
|
225
|
+
pool_quote_token_account: ZP,
|
|
226
|
+
coin_creator_vault_ata: ZP,
|
|
227
|
+
coin_creator_vault_authority: ZP,
|
|
228
|
+
base_token_program: ZP,
|
|
229
|
+
quote_token_program: ZP,
|
|
230
|
+
};
|
|
231
|
+
return { PumpSwapSell: ev };
|
|
232
|
+
}
|
|
233
|
+
function parseCreatePoolFromData(data, metadata) {
|
|
234
|
+
const REQUIRED = 8 + 2 + 32 * 6 + 2 + 8 * 7 + 1;
|
|
235
|
+
if (data.length < REQUIRED)
|
|
236
|
+
return null;
|
|
237
|
+
let o = 0;
|
|
238
|
+
const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
|
|
239
|
+
o += 8;
|
|
240
|
+
const index = (0, binary_js_1.readU16LE)(data, o);
|
|
241
|
+
o += 2;
|
|
242
|
+
const creator = (0, binary_js_1.readPubkey)(data, o);
|
|
243
|
+
o += 32;
|
|
244
|
+
const base_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
245
|
+
o += 32;
|
|
246
|
+
const quote_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
247
|
+
o += 32;
|
|
248
|
+
const base_mint_decimals = (0, binary_js_1.readU8)(data, o);
|
|
249
|
+
o += 1;
|
|
250
|
+
const quote_mint_decimals = (0, binary_js_1.readU8)(data, o);
|
|
251
|
+
o += 1;
|
|
252
|
+
const base_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
253
|
+
o += 8;
|
|
254
|
+
const quote_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
255
|
+
o += 8;
|
|
256
|
+
const pool_base_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
257
|
+
o += 8;
|
|
258
|
+
const pool_quote_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
259
|
+
o += 8;
|
|
260
|
+
const minimum_liquidity = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
261
|
+
o += 8;
|
|
262
|
+
const initial_liquidity = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
263
|
+
o += 8;
|
|
264
|
+
const lp_token_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
265
|
+
o += 8;
|
|
266
|
+
const pool_bump = (0, binary_js_1.readU8)(data, o);
|
|
267
|
+
o += 1;
|
|
268
|
+
const pool = (0, binary_js_1.readPubkey)(data, o);
|
|
269
|
+
o += 32;
|
|
270
|
+
const lp_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
271
|
+
o += 32;
|
|
272
|
+
const user_base_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
273
|
+
o += 32;
|
|
274
|
+
const user_quote_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
275
|
+
o += 32;
|
|
276
|
+
const coin_creator = (0, binary_js_1.readPubkey)(data, o);
|
|
277
|
+
o += 32;
|
|
278
|
+
const is_mayhem_mode = data.length > 325 && (0, binary_js_1.readBool)(data, 325) === true;
|
|
279
|
+
const ev = {
|
|
280
|
+
metadata,
|
|
281
|
+
timestamp,
|
|
282
|
+
index,
|
|
283
|
+
creator,
|
|
284
|
+
base_mint,
|
|
285
|
+
quote_mint,
|
|
286
|
+
base_mint_decimals,
|
|
287
|
+
quote_mint_decimals,
|
|
288
|
+
base_amount_in,
|
|
289
|
+
quote_amount_in,
|
|
290
|
+
pool_base_amount,
|
|
291
|
+
pool_quote_amount,
|
|
292
|
+
minimum_liquidity,
|
|
293
|
+
initial_liquidity,
|
|
294
|
+
lp_token_amount_out,
|
|
295
|
+
pool_bump,
|
|
296
|
+
pool,
|
|
297
|
+
lp_mint,
|
|
298
|
+
user_base_token_account,
|
|
299
|
+
user_quote_token_account,
|
|
300
|
+
coin_creator,
|
|
301
|
+
is_mayhem_mode,
|
|
302
|
+
};
|
|
303
|
+
return { PumpSwapCreatePool: ev };
|
|
304
|
+
}
|
|
305
|
+
function parseAddLiquidityFromData(data, metadata) {
|
|
306
|
+
const REQUIRED = 10 * 8 + 5 * 32;
|
|
307
|
+
if (data.length < REQUIRED)
|
|
308
|
+
return null;
|
|
309
|
+
let o = 0;
|
|
310
|
+
const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
|
|
311
|
+
o += 8;
|
|
312
|
+
const lp_token_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
313
|
+
o += 8;
|
|
314
|
+
const max_base_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
315
|
+
o += 8;
|
|
316
|
+
const max_quote_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
317
|
+
o += 8;
|
|
318
|
+
const user_base_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
319
|
+
o += 8;
|
|
320
|
+
const user_quote_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
321
|
+
o += 8;
|
|
322
|
+
const pool_base_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
323
|
+
o += 8;
|
|
324
|
+
const pool_quote_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
325
|
+
o += 8;
|
|
326
|
+
const base_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
327
|
+
o += 8;
|
|
328
|
+
const quote_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
329
|
+
o += 8;
|
|
330
|
+
const lp_mint_supply = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
331
|
+
o += 8;
|
|
332
|
+
const pool = (0, binary_js_1.readPubkey)(data, o);
|
|
333
|
+
o += 32;
|
|
334
|
+
const user = (0, binary_js_1.readPubkey)(data, o);
|
|
335
|
+
o += 32;
|
|
336
|
+
const user_base_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
337
|
+
o += 32;
|
|
338
|
+
const user_quote_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
339
|
+
o += 32;
|
|
340
|
+
const user_pool_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
341
|
+
const ev = {
|
|
342
|
+
metadata,
|
|
343
|
+
timestamp,
|
|
344
|
+
lp_token_amount_out,
|
|
345
|
+
max_base_amount_in,
|
|
346
|
+
max_quote_amount_in,
|
|
347
|
+
user_base_token_reserves,
|
|
348
|
+
user_quote_token_reserves,
|
|
349
|
+
pool_base_token_reserves,
|
|
350
|
+
pool_quote_token_reserves,
|
|
351
|
+
base_amount_in,
|
|
352
|
+
quote_amount_in,
|
|
353
|
+
lp_mint_supply,
|
|
354
|
+
pool,
|
|
355
|
+
user,
|
|
356
|
+
user_base_token_account,
|
|
357
|
+
user_quote_token_account,
|
|
358
|
+
user_pool_token_account,
|
|
359
|
+
};
|
|
360
|
+
return { PumpSwapLiquidityAdded: ev };
|
|
361
|
+
}
|
|
362
|
+
function parseRemoveLiquidityFromData(data, metadata) {
|
|
363
|
+
const REQUIRED = 10 * 8 + 5 * 32;
|
|
364
|
+
if (data.length < REQUIRED)
|
|
365
|
+
return null;
|
|
366
|
+
let o = 0;
|
|
367
|
+
const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
|
|
368
|
+
o += 8;
|
|
369
|
+
const lp_token_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
370
|
+
o += 8;
|
|
371
|
+
const min_base_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
372
|
+
o += 8;
|
|
373
|
+
const min_quote_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
374
|
+
o += 8;
|
|
375
|
+
const user_base_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
376
|
+
o += 8;
|
|
377
|
+
const user_quote_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
378
|
+
o += 8;
|
|
379
|
+
const pool_base_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
380
|
+
o += 8;
|
|
381
|
+
const pool_quote_token_reserves = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
382
|
+
o += 8;
|
|
383
|
+
const base_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
384
|
+
o += 8;
|
|
385
|
+
const quote_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
386
|
+
o += 8;
|
|
387
|
+
const lp_mint_supply = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
388
|
+
o += 8;
|
|
389
|
+
const pool = (0, binary_js_1.readPubkey)(data, o);
|
|
390
|
+
o += 32;
|
|
391
|
+
const user = (0, binary_js_1.readPubkey)(data, o);
|
|
392
|
+
o += 32;
|
|
393
|
+
const user_base_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
394
|
+
o += 32;
|
|
395
|
+
const user_quote_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
396
|
+
o += 32;
|
|
397
|
+
const user_pool_token_account = (0, binary_js_1.readPubkey)(data, o);
|
|
398
|
+
const ev = {
|
|
399
|
+
metadata,
|
|
400
|
+
timestamp,
|
|
401
|
+
lp_token_amount_in,
|
|
402
|
+
min_base_amount_out,
|
|
403
|
+
min_quote_amount_out,
|
|
404
|
+
user_base_token_reserves,
|
|
405
|
+
user_quote_token_reserves,
|
|
406
|
+
pool_base_token_reserves,
|
|
407
|
+
pool_quote_token_reserves,
|
|
408
|
+
base_amount_out,
|
|
409
|
+
quote_amount_out,
|
|
410
|
+
lp_mint_supply,
|
|
411
|
+
pool,
|
|
412
|
+
user,
|
|
413
|
+
user_base_token_account,
|
|
414
|
+
user_quote_token_account,
|
|
415
|
+
user_pool_token_account,
|
|
416
|
+
};
|
|
417
|
+
return { PumpSwapLiquidityRemoved: ev };
|
|
418
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EventMetadata } from "../core/metadata.js";
|
|
2
|
+
import type { DexEvent } from "../core/dex_event.js";
|
|
3
|
+
export declare function parseSwapBaseInFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
4
|
+
export declare function parseSwapBaseOutFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
5
|
+
export declare function parseDepositFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
6
|
+
export declare function parseWithdrawFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
7
|
+
/** Withdraw PnL 事件;discriminator `[0,0,0,0,0,0,0,7]` */
|
|
8
|
+
export declare function parseWithdrawPnlFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
9
|
+
export declare function parseInitialize2FromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSwapBaseInFromData = parseSwapBaseInFromData;
|
|
4
|
+
exports.parseSwapBaseOutFromData = parseSwapBaseOutFromData;
|
|
5
|
+
exports.parseDepositFromData = parseDepositFromData;
|
|
6
|
+
exports.parseWithdrawFromData = parseWithdrawFromData;
|
|
7
|
+
exports.parseWithdrawPnlFromData = parseWithdrawPnlFromData;
|
|
8
|
+
exports.parseInitialize2FromData = parseInitialize2FromData;
|
|
9
|
+
const dex_event_js_1 = require("../core/dex_event.js");
|
|
10
|
+
const binary_js_1 = require("../util/binary.js");
|
|
11
|
+
function bn64(v) {
|
|
12
|
+
return v ?? 0n;
|
|
13
|
+
}
|
|
14
|
+
function emptySwap(metadata, amm, user) {
|
|
15
|
+
return {
|
|
16
|
+
metadata,
|
|
17
|
+
amount_in: 0n,
|
|
18
|
+
minimum_amount_out: 0n,
|
|
19
|
+
max_amount_in: 0n,
|
|
20
|
+
amount_out: 0n,
|
|
21
|
+
token_program: (0, dex_event_js_1.defaultPubkey)(),
|
|
22
|
+
amm,
|
|
23
|
+
amm_authority: (0, dex_event_js_1.defaultPubkey)(),
|
|
24
|
+
amm_open_orders: (0, dex_event_js_1.defaultPubkey)(),
|
|
25
|
+
pool_coin_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
26
|
+
pool_pc_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
27
|
+
serum_program: (0, dex_event_js_1.defaultPubkey)(),
|
|
28
|
+
serum_market: (0, dex_event_js_1.defaultPubkey)(),
|
|
29
|
+
serum_bids: (0, dex_event_js_1.defaultPubkey)(),
|
|
30
|
+
serum_asks: (0, dex_event_js_1.defaultPubkey)(),
|
|
31
|
+
serum_event_queue: (0, dex_event_js_1.defaultPubkey)(),
|
|
32
|
+
serum_coin_vault_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
33
|
+
serum_pc_vault_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
34
|
+
serum_vault_signer: (0, dex_event_js_1.defaultPubkey)(),
|
|
35
|
+
user_source_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
36
|
+
user_destination_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
37
|
+
user_source_owner: user,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function parseSwapBaseInFromData(data, metadata) {
|
|
41
|
+
let o = 0;
|
|
42
|
+
const amm = (0, binary_js_1.readPubkey)(data, o);
|
|
43
|
+
if (!amm)
|
|
44
|
+
return null;
|
|
45
|
+
o += 32;
|
|
46
|
+
const user = (0, binary_js_1.readPubkey)(data, o);
|
|
47
|
+
if (!user)
|
|
48
|
+
return null;
|
|
49
|
+
o += 32;
|
|
50
|
+
const amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
51
|
+
o += 8;
|
|
52
|
+
const minimum_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
53
|
+
const ev = emptySwap(metadata, amm, user);
|
|
54
|
+
ev.amount_in = amount_in;
|
|
55
|
+
ev.minimum_amount_out = minimum_amount_out;
|
|
56
|
+
return { RaydiumAmmV4Swap: ev };
|
|
57
|
+
}
|
|
58
|
+
function parseSwapBaseOutFromData(data, metadata) {
|
|
59
|
+
let o = 0;
|
|
60
|
+
const amm = (0, binary_js_1.readPubkey)(data, o);
|
|
61
|
+
if (!amm)
|
|
62
|
+
return null;
|
|
63
|
+
o += 32;
|
|
64
|
+
const user = (0, binary_js_1.readPubkey)(data, o);
|
|
65
|
+
if (!user)
|
|
66
|
+
return null;
|
|
67
|
+
o += 32;
|
|
68
|
+
const max_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
69
|
+
o += 8;
|
|
70
|
+
const amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
71
|
+
const ev = emptySwap(metadata, amm, user);
|
|
72
|
+
ev.max_amount_in = max_amount_in;
|
|
73
|
+
ev.amount_out = amount_out;
|
|
74
|
+
return { RaydiumAmmV4Swap: ev };
|
|
75
|
+
}
|
|
76
|
+
function parseDepositFromData(data, metadata) {
|
|
77
|
+
let o = 0;
|
|
78
|
+
const amm = (0, binary_js_1.readPubkey)(data, o);
|
|
79
|
+
o += 32;
|
|
80
|
+
const user = (0, binary_js_1.readPubkey)(data, o);
|
|
81
|
+
o += 32;
|
|
82
|
+
const max_coin_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
83
|
+
o += 8;
|
|
84
|
+
const max_pc_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
85
|
+
o += 8;
|
|
86
|
+
const base_side = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
87
|
+
const ev = {
|
|
88
|
+
metadata,
|
|
89
|
+
max_coin_amount,
|
|
90
|
+
max_pc_amount,
|
|
91
|
+
base_side,
|
|
92
|
+
token_program: (0, dex_event_js_1.defaultPubkey)(),
|
|
93
|
+
amm,
|
|
94
|
+
amm_authority: (0, dex_event_js_1.defaultPubkey)(),
|
|
95
|
+
amm_open_orders: (0, dex_event_js_1.defaultPubkey)(),
|
|
96
|
+
amm_target_orders: (0, dex_event_js_1.defaultPubkey)(),
|
|
97
|
+
lp_mint_address: (0, dex_event_js_1.defaultPubkey)(),
|
|
98
|
+
pool_coin_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
99
|
+
pool_pc_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
100
|
+
serum_market: (0, dex_event_js_1.defaultPubkey)(),
|
|
101
|
+
user_coin_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
102
|
+
user_pc_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
103
|
+
user_lp_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
104
|
+
user_owner: user,
|
|
105
|
+
serum_event_queue: (0, dex_event_js_1.defaultPubkey)(),
|
|
106
|
+
};
|
|
107
|
+
return { RaydiumAmmV4Deposit: ev };
|
|
108
|
+
}
|
|
109
|
+
function parseWithdrawFromData(data, metadata) {
|
|
110
|
+
let o = 0;
|
|
111
|
+
const amm = (0, binary_js_1.readPubkey)(data, o);
|
|
112
|
+
o += 32;
|
|
113
|
+
const user = (0, binary_js_1.readPubkey)(data, o);
|
|
114
|
+
o += 32;
|
|
115
|
+
const amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
116
|
+
const ev = {
|
|
117
|
+
metadata,
|
|
118
|
+
amount,
|
|
119
|
+
token_program: (0, dex_event_js_1.defaultPubkey)(),
|
|
120
|
+
amm,
|
|
121
|
+
amm_authority: (0, dex_event_js_1.defaultPubkey)(),
|
|
122
|
+
amm_open_orders: (0, dex_event_js_1.defaultPubkey)(),
|
|
123
|
+
amm_target_orders: (0, dex_event_js_1.defaultPubkey)(),
|
|
124
|
+
lp_mint_address: (0, dex_event_js_1.defaultPubkey)(),
|
|
125
|
+
pool_coin_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
126
|
+
pool_pc_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
127
|
+
pool_withdraw_queue: (0, dex_event_js_1.defaultPubkey)(),
|
|
128
|
+
pool_temp_lp_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
129
|
+
serum_program: (0, dex_event_js_1.defaultPubkey)(),
|
|
130
|
+
serum_market: (0, dex_event_js_1.defaultPubkey)(),
|
|
131
|
+
serum_coin_vault_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
132
|
+
serum_pc_vault_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
133
|
+
serum_vault_signer: (0, dex_event_js_1.defaultPubkey)(),
|
|
134
|
+
user_lp_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
135
|
+
user_coin_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
136
|
+
user_pc_token_account: (0, dex_event_js_1.defaultPubkey)(),
|
|
137
|
+
user_owner: user,
|
|
138
|
+
serum_event_queue: (0, dex_event_js_1.defaultPubkey)(),
|
|
139
|
+
serum_bids: (0, dex_event_js_1.defaultPubkey)(),
|
|
140
|
+
serum_asks: (0, dex_event_js_1.defaultPubkey)(),
|
|
141
|
+
};
|
|
142
|
+
return { RaydiumAmmV4Withdraw: ev };
|
|
143
|
+
}
|
|
144
|
+
/** Withdraw PnL 事件;discriminator `[0,0,0,0,0,0,0,7]` */
|
|
145
|
+
function parseWithdrawPnlFromData(data, metadata) {
|
|
146
|
+
let o = 0;
|
|
147
|
+
const amm = (0, binary_js_1.readPubkey)(data, o);
|
|
148
|
+
if (!amm)
|
|
149
|
+
return null;
|
|
150
|
+
o += 32;
|
|
151
|
+
const pnl_owner = (0, binary_js_1.readPubkey)(data, o);
|
|
152
|
+
if (!pnl_owner)
|
|
153
|
+
return null;
|
|
154
|
+
const z = (0, dex_event_js_1.defaultPubkey)();
|
|
155
|
+
const ev = {
|
|
156
|
+
metadata,
|
|
157
|
+
token_program: z,
|
|
158
|
+
amm,
|
|
159
|
+
amm_config: z,
|
|
160
|
+
amm_authority: z,
|
|
161
|
+
amm_open_orders: z,
|
|
162
|
+
pool_coin_token_account: z,
|
|
163
|
+
pool_pc_token_account: z,
|
|
164
|
+
coin_pnl_token_account: z,
|
|
165
|
+
pc_pnl_token_account: z,
|
|
166
|
+
pnl_owner,
|
|
167
|
+
amm_target_orders: z,
|
|
168
|
+
serum_program: z,
|
|
169
|
+
serum_market: z,
|
|
170
|
+
serum_event_queue: z,
|
|
171
|
+
serum_coin_vault_account: z,
|
|
172
|
+
serum_pc_vault_account: z,
|
|
173
|
+
serum_vault_signer: z,
|
|
174
|
+
};
|
|
175
|
+
return { RaydiumAmmV4WithdrawPnl: ev };
|
|
176
|
+
}
|
|
177
|
+
function parseInitialize2FromData(data, metadata) {
|
|
178
|
+
let o = 0;
|
|
179
|
+
const amm = (0, binary_js_1.readPubkey)(data, o);
|
|
180
|
+
if (!amm)
|
|
181
|
+
return null;
|
|
182
|
+
o += 32;
|
|
183
|
+
const user = (0, binary_js_1.readPubkey)(data, o);
|
|
184
|
+
if (!user)
|
|
185
|
+
return null;
|
|
186
|
+
o += 32;
|
|
187
|
+
const nonce = (0, binary_js_1.readU8)(data, o);
|
|
188
|
+
o += 1;
|
|
189
|
+
const open_time = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
190
|
+
o += 8;
|
|
191
|
+
const init_pc_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
192
|
+
o += 8;
|
|
193
|
+
const init_coin_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
194
|
+
const z = (0, dex_event_js_1.defaultPubkey)();
|
|
195
|
+
const ev = {
|
|
196
|
+
metadata,
|
|
197
|
+
nonce,
|
|
198
|
+
open_time,
|
|
199
|
+
init_pc_amount,
|
|
200
|
+
init_coin_amount,
|
|
201
|
+
token_program: z,
|
|
202
|
+
spl_associated_token_account: z,
|
|
203
|
+
system_program: z,
|
|
204
|
+
rent: z,
|
|
205
|
+
amm,
|
|
206
|
+
amm_authority: z,
|
|
207
|
+
amm_open_orders: z,
|
|
208
|
+
lp_mint: z,
|
|
209
|
+
coin_mint: z,
|
|
210
|
+
pc_mint: z,
|
|
211
|
+
pool_coin_token_account: z,
|
|
212
|
+
pool_pc_token_account: z,
|
|
213
|
+
pool_withdraw_queue: z,
|
|
214
|
+
amm_target_orders: z,
|
|
215
|
+
pool_temp_lp: z,
|
|
216
|
+
serum_program: z,
|
|
217
|
+
serum_market: z,
|
|
218
|
+
user_wallet: user,
|
|
219
|
+
user_token_coin: z,
|
|
220
|
+
user_token_pc: z,
|
|
221
|
+
user_lp_token_account: z,
|
|
222
|
+
};
|
|
223
|
+
return { RaydiumAmmV4Initialize2: ev };
|
|
224
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EventMetadata } from "../core/metadata.js";
|
|
2
|
+
import type { DexEvent } from "../core/dex_event.js";
|
|
3
|
+
/** Swap 日志载荷中 16 字节 u128 为 sqrt price limit,映射到 `RaydiumClmmSwapEvent.sqrt_price_x64`(与 Go/Python 字段名一致)。 */
|
|
4
|
+
export declare function parseSwapFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
5
|
+
export declare function parseIncreaseLiquidityFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
6
|
+
export declare function parseDecreaseLiquidityFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
7
|
+
export declare function parseCreatePoolFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
8
|
+
export declare function parseCollectFeeFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|