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.
Files changed (190) hide show
  1. package/.env.example +24 -0
  2. package/LICENSE +21 -0
  3. package/README.md +236 -0
  4. package/README_CN.md +236 -0
  5. package/dist/accounts/mod.d.ts +15 -0
  6. package/dist/accounts/mod.js +173 -0
  7. package/dist/accounts/nonce.d.ts +5 -0
  8. package/dist/accounts/nonce.js +32 -0
  9. package/dist/accounts/pumpfun.d.ts +16 -0
  10. package/dist/accounts/pumpfun.js +538 -0
  11. package/dist/accounts/pumpswap.d.ts +8 -0
  12. package/dist/accounts/pumpswap.js +192 -0
  13. package/dist/accounts/raydium_orca.d.ts +26 -0
  14. package/dist/accounts/raydium_orca.js +453 -0
  15. package/dist/accounts/rpc_wallet.d.ts +5 -0
  16. package/dist/accounts/rpc_wallet.js +18 -0
  17. package/dist/accounts/rust_aliases.d.ts +10 -0
  18. package/dist/accounts/rust_aliases.js +21 -0
  19. package/dist/accounts/token.d.ts +5 -0
  20. package/dist/accounts/token.js +98 -0
  21. package/dist/accounts/types.d.ts +9 -0
  22. package/dist/accounts/types.js +2 -0
  23. package/dist/accounts/utils.d.ts +1 -0
  24. package/dist/accounts/utils.js +12 -0
  25. package/dist/accounts/wallet_resolve.d.ts +1 -0
  26. package/dist/accounts/wallet_resolve.js +28 -0
  27. package/dist/common/constants.d.ts +10 -0
  28. package/dist/common/constants.js +13 -0
  29. package/dist/core/account_dispatcher_rpc.d.ts +11 -0
  30. package/dist/core/account_dispatcher_rpc.js +155 -0
  31. package/dist/core/account_fill_bonk.d.ts +4 -0
  32. package/dist/core/account_fill_bonk.js +20 -0
  33. package/dist/core/account_fill_meteora.d.ts +15 -0
  34. package/dist/core/account_fill_meteora.js +27 -0
  35. package/dist/core/account_fill_orca.d.ts +5 -0
  36. package/dist/core/account_fill_orca.js +18 -0
  37. package/dist/core/account_fill_pumpfun.d.ts +7 -0
  38. package/dist/core/account_fill_pumpfun.js +167 -0
  39. package/dist/core/account_fill_pumpswap.d.ts +10 -0
  40. package/dist/core/account_fill_pumpswap.js +128 -0
  41. package/dist/core/account_fill_raydium.d.ts +20 -0
  42. package/dist/core/account_fill_raydium.js +104 -0
  43. package/dist/core/account_fill_raydium_launchlab.d.ts +4 -0
  44. package/dist/core/account_fill_raydium_launchlab.js +20 -0
  45. package/dist/core/account_pubkey_cache.d.ts +12 -0
  46. package/dist/core/account_pubkey_cache.js +26 -0
  47. package/dist/core/clock.d.ts +8 -0
  48. package/dist/core/clock.js +20 -0
  49. package/dist/core/common_filler_rpc.d.ts +6 -0
  50. package/dist/core/common_filler_rpc.js +21 -0
  51. package/dist/core/dex_event.d.ts +1704 -0
  52. package/dist/core/dex_event.js +14 -0
  53. package/dist/core/error.d.ts +43 -0
  54. package/dist/core/error.js +16 -0
  55. package/dist/core/json_utils.d.ts +8 -0
  56. package/dist/core/json_utils.js +18 -0
  57. package/dist/core/metadata.d.ts +11 -0
  58. package/dist/core/metadata.js +13 -0
  59. package/dist/core/pumpfun_fee_enrich.d.ts +6 -0
  60. package/dist/core/pumpfun_fee_enrich.js +159 -0
  61. package/dist/core/rpc_invoke_map.d.ts +23 -0
  62. package/dist/core/rpc_invoke_map.js +157 -0
  63. package/dist/core/unified_parser.d.ts +19 -0
  64. package/dist/core/unified_parser.js +50 -0
  65. package/dist/grpc/client.d.ts +83 -0
  66. package/dist/grpc/client.js +645 -0
  67. package/dist/grpc/client_stub.d.ts +5 -0
  68. package/dist/grpc/client_stub.js +5 -0
  69. package/dist/grpc/event_parser.d.ts +6 -0
  70. package/dist/grpc/event_parser.js +15 -0
  71. package/dist/grpc/geyser_connect.d.ts +30 -0
  72. package/dist/grpc/geyser_connect.js +40 -0
  73. package/dist/grpc/log_instr_dedup.d.ts +2 -0
  74. package/dist/grpc/log_instr_dedup.js +402 -0
  75. package/dist/grpc/order_buffer.d.ts +27 -0
  76. package/dist/grpc/order_buffer.js +166 -0
  77. package/dist/grpc/program_ids.d.ts +27 -0
  78. package/dist/grpc/program_ids.js +61 -0
  79. package/dist/grpc/rpc_to_grpc.d.ts +18 -0
  80. package/dist/grpc/rpc_to_grpc.js +127 -0
  81. package/dist/grpc/subscribe_builder.d.ts +13 -0
  82. package/dist/grpc/subscribe_builder.js +66 -0
  83. package/dist/grpc/transaction_meta.d.ts +29 -0
  84. package/dist/grpc/transaction_meta.js +208 -0
  85. package/dist/grpc/types.d.ts +195 -0
  86. package/dist/grpc/types.js +551 -0
  87. package/dist/grpc/yellowstone_parse.d.ts +16 -0
  88. package/dist/grpc/yellowstone_parse.js +62 -0
  89. package/dist/index.d.ts +50 -0
  90. package/dist/index.js +298 -0
  91. package/dist/instr/bonk_ix.d.ts +8 -0
  92. package/dist/instr/bonk_ix.js +131 -0
  93. package/dist/instr/inner.d.ts +4 -0
  94. package/dist/instr/inner.js +453 -0
  95. package/dist/instr/meteora_damm_ix.d.ts +8 -0
  96. package/dist/instr/meteora_damm_ix.js +601 -0
  97. package/dist/instr/meteora_dlmm_ix.d.ts +2 -0
  98. package/dist/instr/meteora_dlmm_ix.js +134 -0
  99. package/dist/instr/meteora_pools_ix.d.ts +2 -0
  100. package/dist/instr/meteora_pools_ix.js +78 -0
  101. package/dist/instr/mod.d.ts +18 -0
  102. package/dist/instr/mod.js +129 -0
  103. package/dist/instr/orca_whirlpool_ix.d.ts +8 -0
  104. package/dist/instr/orca_whirlpool_ix.js +119 -0
  105. package/dist/instr/program_ids.d.ts +4 -0
  106. package/dist/instr/program_ids.js +20 -0
  107. package/dist/instr/pump_fees_ix.d.ts +2 -0
  108. package/dist/instr/pump_fees_ix.js +168 -0
  109. package/dist/instr/pumpfun_ix.d.ts +6 -0
  110. package/dist/instr/pumpfun_ix.js +448 -0
  111. package/dist/instr/pumpswap_ix.d.ts +5 -0
  112. package/dist/instr/pumpswap_ix.js +270 -0
  113. package/dist/instr/raydium_amm_v4_ix.d.ts +6 -0
  114. package/dist/instr/raydium_amm_v4_ix.js +112 -0
  115. package/dist/instr/raydium_clmm_ix.d.ts +5 -0
  116. package/dist/instr/raydium_clmm_ix.js +184 -0
  117. package/dist/instr/raydium_cpmm_ix.d.ts +5 -0
  118. package/dist/instr/raydium_cpmm_ix.js +109 -0
  119. package/dist/instr/raydium_launchlab_ix.d.ts +8 -0
  120. package/dist/instr/raydium_launchlab_ix.js +125 -0
  121. package/dist/instr/rust_aliases.d.ts +10 -0
  122. package/dist/instr/rust_aliases.js +20 -0
  123. package/dist/instr/utils.d.ts +10 -0
  124. package/dist/instr/utils.js +35 -0
  125. package/dist/logs/discriminator_lut.d.ts +19 -0
  126. package/dist/logs/discriminator_lut.js +62 -0
  127. package/dist/logs/meteora_amm.d.ts +8 -0
  128. package/dist/logs/meteora_amm.js +113 -0
  129. package/dist/logs/meteora_damm.d.ts +5 -0
  130. package/dist/logs/meteora_damm.js +367 -0
  131. package/dist/logs/meteora_dbc.d.ts +11 -0
  132. package/dist/logs/meteora_dbc.js +142 -0
  133. package/dist/logs/meteora_dlmm.d.ts +6 -0
  134. package/dist/logs/meteora_dlmm.js +201 -0
  135. package/dist/logs/optimized_matcher.d.ts +11 -0
  136. package/dist/logs/optimized_matcher.js +941 -0
  137. package/dist/logs/orca.d.ts +6 -0
  138. package/dist/logs/orca.js +148 -0
  139. package/dist/logs/program_data.d.ts +2 -0
  140. package/dist/logs/program_data.js +20 -0
  141. package/dist/logs/program_log_discriminators.d.ts +80 -0
  142. package/dist/logs/program_log_discriminators.js +88 -0
  143. package/dist/logs/pump.d.ts +14 -0
  144. package/dist/logs/pump.js +378 -0
  145. package/dist/logs/pump_amm.d.ts +9 -0
  146. package/dist/logs/pump_amm.js +418 -0
  147. package/dist/logs/pump_fees.d.ts +23 -0
  148. package/dist/logs/pump_fees.js +364 -0
  149. package/dist/logs/raydium_amm.d.ts +9 -0
  150. package/dist/logs/raydium_amm.js +224 -0
  151. package/dist/logs/raydium_clmm.d.ts +17 -0
  152. package/dist/logs/raydium_clmm.js +624 -0
  153. package/dist/logs/raydium_cpmm.d.ts +7 -0
  154. package/dist/logs/raydium_cpmm.js +121 -0
  155. package/dist/logs/raydium_launchlab.d.ts +10 -0
  156. package/dist/logs/raydium_launchlab.js +84 -0
  157. package/dist/logs/raydium_launchpad.d.ts +12 -0
  158. package/dist/logs/raydium_launchpad.js +92 -0
  159. package/dist/logs/rust_aliases.d.ts +7 -0
  160. package/dist/logs/rust_aliases.js +16 -0
  161. package/dist/parser_alias.d.ts +3 -0
  162. package/dist/parser_alias.js +2 -0
  163. package/dist/rpc_parser.d.ts +17 -0
  164. package/dist/rpc_parser.js +39 -0
  165. package/dist/rpc_transaction.d.ts +27 -0
  166. package/dist/rpc_transaction.js +416 -0
  167. package/dist/shredstream/alt_lookup.d.ts +9 -0
  168. package/dist/shredstream/alt_lookup.js +70 -0
  169. package/dist/shredstream/client.d.ts +65 -0
  170. package/dist/shredstream/client.js +403 -0
  171. package/dist/shredstream/config.d.ts +30 -0
  172. package/dist/shredstream/config.js +34 -0
  173. package/dist/shredstream/entries_decode.d.ts +28 -0
  174. package/dist/shredstream/entries_decode.js +251 -0
  175. package/dist/shredstream/index.d.ts +17 -0
  176. package/dist/shredstream/index.js +33 -0
  177. package/dist/shredstream/instruction_parse.d.ts +34 -0
  178. package/dist/shredstream/instruction_parse.js +79 -0
  179. package/dist/shredstream/proto_types.d.ts +9 -0
  180. package/dist/shredstream/proto_types.js +2 -0
  181. package/dist/shredstream/shredstream.proto +15 -0
  182. package/dist/shredstream/wire_to_shred_tx.d.ts +2 -0
  183. package/dist/shredstream/wire_to_shred_tx.js +59 -0
  184. package/dist/util/binary.d.ts +14 -0
  185. package/dist/util/binary.js +82 -0
  186. package/dist/util/market.d.ts +18 -0
  187. package/dist/util/market.js +54 -0
  188. package/dist/warmup.d.ts +3 -0
  189. package/dist/warmup.js +23 -0
  190. package/package.json +61 -0
@@ -0,0 +1,378 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parsePumpFunLogDecoded = parsePumpFunLogDecoded;
4
+ exports.parseTradeFromData = parseTradeFromData;
5
+ exports.parseCreateFromData = parseCreateFromData;
6
+ exports.parseMigrateFromData = parseMigrateFromData;
7
+ exports.parseMigrateBondingCurveCreatorFromData = parseMigrateBondingCurveCreatorFromData;
8
+ exports.pumpDiscriminators = pumpDiscriminators;
9
+ const dex_event_js_1 = require("../core/dex_event.js");
10
+ const binary_js_1 = require("../util/binary.js");
11
+ function disc(bytes) {
12
+ const u8 = new Uint8Array(bytes.length);
13
+ for (let i = 0; i < bytes.length; i++)
14
+ u8[i] = bytes[i];
15
+ return (0, binary_js_1.readDiscriminatorU64)(u8);
16
+ }
17
+ const DISC_CREATE = disc([27, 114, 169, 77, 222, 235, 99, 118]);
18
+ const DISC_TRADE = disc([189, 219, 127, 211, 78, 230, 97, 238]);
19
+ const DISC_MIGRATE = disc([189, 233, 93, 185, 92, 148, 234, 148]);
20
+ const DISC_MIGRATE_BONDING_CURVE_CREATOR = disc([155, 167, 104, 220, 213, 108, 243, 3]);
21
+ const PUMPFUN_SOL_QUOTE_MINT = "So11111111111111111111111111111111111111111";
22
+ function normalizePumpfunIxName(ixName) {
23
+ if (ixName === "buy_v2")
24
+ return "buy";
25
+ if (ixName === "sell_v2")
26
+ return "sell";
27
+ if (ixName === "buy_exact_quote_in_v2")
28
+ return "buy_exact_quote_in";
29
+ return ixName;
30
+ }
31
+ function bnU64(v) {
32
+ return v ?? 0n;
33
+ }
34
+ function bnI64(v) {
35
+ return v ?? 0n;
36
+ }
37
+ function readOptionalU64(data, offset) {
38
+ if (offset.value + 8 > data.length)
39
+ return 0n;
40
+ const value = bnU64((0, binary_js_1.readU64LE)(data, offset.value));
41
+ offset.value += 8;
42
+ return value;
43
+ }
44
+ function readOptionalPubkey(data, offset) {
45
+ if (offset.value + 32 > data.length)
46
+ return (0, dex_event_js_1.defaultPubkey)();
47
+ const value = (0, binary_js_1.readPubkey)(data, offset.value) ?? (0, dex_event_js_1.defaultPubkey)();
48
+ offset.value += 32;
49
+ return value;
50
+ }
51
+ function normalizePumpfunQuoteMint(quoteMint) {
52
+ return quoteMint === (0, dex_event_js_1.defaultPubkey)() ? PUMPFUN_SOL_QUOTE_MINT : quoteMint;
53
+ }
54
+ function readTradeShareholders(data, offset) {
55
+ if (offset.value + 4 > data.length)
56
+ return [];
57
+ const n = (0, binary_js_1.readU32LE)(data, offset.value);
58
+ if (n === null || n > 64)
59
+ return null;
60
+ offset.value += 4;
61
+ if (offset.value + n * 34 > data.length)
62
+ return null;
63
+ const out = [];
64
+ for (let i = 0; i < n; i++) {
65
+ const address = (0, binary_js_1.readPubkey)(data, offset.value);
66
+ if (!address)
67
+ return null;
68
+ offset.value += 32;
69
+ const share_bps = (0, binary_js_1.readU16LE)(data, offset.value);
70
+ if (share_bps === null)
71
+ return null;
72
+ offset.value += 2;
73
+ out.push({ address, share_bps });
74
+ }
75
+ return out;
76
+ }
77
+ function parsePumpFunLogDecoded(programData, metadata) {
78
+ const disc = (0, binary_js_1.readDiscriminatorU64)(programData);
79
+ if (disc === null)
80
+ return null;
81
+ const data = programData.subarray(8);
82
+ if (disc === DISC_CREATE)
83
+ return parseCreateFromData(data, metadata);
84
+ if (disc === DISC_TRADE)
85
+ return parseTradeFromData(data, metadata, false);
86
+ if (disc === DISC_MIGRATE)
87
+ return parseMigrateFromData(data, metadata);
88
+ if (disc === DISC_MIGRATE_BONDING_CURVE_CREATOR) {
89
+ return parseMigrateBondingCurveCreatorFromData(data, metadata);
90
+ }
91
+ return null;
92
+ }
93
+ function parseTradeFromData(data, metadata, isCreatedBuy) {
94
+ if (data.length < 32 + 8 + 8 + 1 + 32 + 8 * 5 + 32 + 8 + 8 + 32 + 8 + 8)
95
+ return null;
96
+ let o = 0;
97
+ const mint = (0, binary_js_1.readPubkey)(data, o);
98
+ if (!mint)
99
+ return null;
100
+ o += 32;
101
+ const sol_amount = bnU64((0, binary_js_1.readU64LE)(data, o));
102
+ o += 8;
103
+ const token_amount = bnU64((0, binary_js_1.readU64LE)(data, o));
104
+ o += 8;
105
+ const is_buy = (0, binary_js_1.readBool)(data, o);
106
+ if (is_buy === null)
107
+ return null;
108
+ o += 1;
109
+ const user = (0, binary_js_1.readPubkey)(data, o);
110
+ if (!user)
111
+ return null;
112
+ o += 32;
113
+ const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
114
+ o += 8;
115
+ const virtual_sol_reserves = bnU64((0, binary_js_1.readU64LE)(data, o));
116
+ o += 8;
117
+ const virtual_token_reserves = bnU64((0, binary_js_1.readU64LE)(data, o));
118
+ o += 8;
119
+ const real_sol_reserves = bnU64((0, binary_js_1.readU64LE)(data, o));
120
+ o += 8;
121
+ const real_token_reserves = bnU64((0, binary_js_1.readU64LE)(data, o));
122
+ o += 8;
123
+ const fee_recipient = (0, binary_js_1.readPubkey)(data, o);
124
+ if (!fee_recipient)
125
+ return null;
126
+ o += 32;
127
+ const fee_basis_points = bnU64((0, binary_js_1.readU64LE)(data, o));
128
+ o += 8;
129
+ const fee = bnU64((0, binary_js_1.readU64LE)(data, o));
130
+ o += 8;
131
+ const creator = (0, binary_js_1.readPubkey)(data, o);
132
+ if (!creator)
133
+ return null;
134
+ o += 32;
135
+ const creator_fee_basis_points = bnU64((0, binary_js_1.readU64LE)(data, o));
136
+ o += 8;
137
+ const creator_fee = bnU64((0, binary_js_1.readU64LE)(data, o));
138
+ o += 8;
139
+ const track_volume = (0, binary_js_1.readBool)(data, o) ?? false;
140
+ o += 1;
141
+ const total_unclaimed_tokens = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
142
+ o += 8;
143
+ const total_claimed_tokens = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
144
+ o += 8;
145
+ const current_sol_volume = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
146
+ o += 8;
147
+ const last_update_timestamp = o + 8 <= data.length ? bnI64((0, binary_js_1.readI64LE)(data, o)) : 0n;
148
+ o += 8;
149
+ let ix_name = "";
150
+ if (o + 4 <= data.length) {
151
+ const rs = (0, binary_js_1.readBorshString)(data, o);
152
+ if (rs) {
153
+ ix_name = rs.s;
154
+ o = rs.next;
155
+ }
156
+ }
157
+ ix_name = normalizePumpfunIxName(ix_name);
158
+ const mayhem_mode = (0, binary_js_1.readBool)(data, o) ?? false;
159
+ o += 1;
160
+ const cashback_fee_basis_points = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
161
+ o += 8;
162
+ const cashback = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
163
+ o += 8;
164
+ const tail = { value: o };
165
+ const buyback_fee_basis_points = readOptionalU64(data, tail);
166
+ const buyback_fee = readOptionalU64(data, tail);
167
+ const shareholders = readTradeShareholders(data, tail);
168
+ if (shareholders === null)
169
+ return null;
170
+ const quote_mint = normalizePumpfunQuoteMint(readOptionalPubkey(data, tail));
171
+ const quote_amount = readOptionalU64(data, tail);
172
+ const virtual_quote_reserves = readOptionalU64(data, tail);
173
+ const real_quote_reserves = readOptionalU64(data, tail);
174
+ const trade = {
175
+ metadata,
176
+ mint,
177
+ sol_amount,
178
+ token_amount,
179
+ is_buy,
180
+ is_created_buy: isCreatedBuy,
181
+ user,
182
+ timestamp,
183
+ virtual_sol_reserves,
184
+ virtual_token_reserves,
185
+ real_sol_reserves,
186
+ real_token_reserves,
187
+ fee_recipient,
188
+ fee_basis_points,
189
+ fee,
190
+ creator,
191
+ creator_fee_basis_points,
192
+ creator_fee,
193
+ track_volume,
194
+ total_unclaimed_tokens,
195
+ total_claimed_tokens,
196
+ current_sol_volume,
197
+ last_update_timestamp,
198
+ ix_name,
199
+ mayhem_mode,
200
+ cashback_fee_basis_points,
201
+ cashback,
202
+ buyback_fee_basis_points,
203
+ buyback_fee,
204
+ shareholders,
205
+ quote_mint,
206
+ quote_amount,
207
+ virtual_quote_reserves,
208
+ real_quote_reserves,
209
+ is_cashback_coin: cashback_fee_basis_points > 0n,
210
+ bonding_curve: (0, dex_event_js_1.defaultPubkey)(),
211
+ associated_bonding_curve: (0, dex_event_js_1.defaultPubkey)(),
212
+ token_program: (0, dex_event_js_1.defaultPubkey)(),
213
+ creator_vault: (0, dex_event_js_1.defaultPubkey)(),
214
+ };
215
+ if (ix_name === "buy")
216
+ return { PumpFunBuy: trade };
217
+ if (ix_name === "sell")
218
+ return { PumpFunSell: trade };
219
+ if (ix_name === "buy_exact_sol_in") {
220
+ return { PumpFunBuyExactSolIn: trade };
221
+ }
222
+ if (ix_name === "buy_exact_quote_in")
223
+ return { PumpFunBuy: trade };
224
+ return { PumpFunTrade: trade };
225
+ }
226
+ function parseCreateFromData(data, metadata) {
227
+ let o = 0;
228
+ const n1 = (0, binary_js_1.readBorshString)(data, o);
229
+ if (!n1)
230
+ return null;
231
+ o = n1.next;
232
+ const n2 = (0, binary_js_1.readBorshString)(data, o);
233
+ if (!n2)
234
+ return null;
235
+ o = n2.next;
236
+ const n3 = (0, binary_js_1.readBorshString)(data, o);
237
+ if (!n3)
238
+ return null;
239
+ o = n3.next;
240
+ if (data.length < o + 32 * 4 + 8 * 5 + 32 + 1)
241
+ return null;
242
+ const mint = (0, binary_js_1.readPubkey)(data, o);
243
+ if (!mint)
244
+ return null;
245
+ o += 32;
246
+ const bonding_curve = (0, binary_js_1.readPubkey)(data, o);
247
+ if (!bonding_curve)
248
+ return null;
249
+ o += 32;
250
+ const user = (0, binary_js_1.readPubkey)(data, o);
251
+ if (!user)
252
+ return null;
253
+ o += 32;
254
+ const creator = (0, binary_js_1.readPubkey)(data, o);
255
+ if (!creator)
256
+ return null;
257
+ o += 32;
258
+ const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
259
+ o += 8;
260
+ const virtual_token_reserves = bnU64((0, binary_js_1.readU64LE)(data, o));
261
+ o += 8;
262
+ const virtual_sol_reserves = bnU64((0, binary_js_1.readU64LE)(data, o));
263
+ o += 8;
264
+ const real_token_reserves = bnU64((0, binary_js_1.readU64LE)(data, o));
265
+ o += 8;
266
+ const token_total_supply = bnU64((0, binary_js_1.readU64LE)(data, o));
267
+ o += 8;
268
+ const token_program = o + 32 <= data.length ? (0, binary_js_1.readPubkey)(data, o) : (0, dex_event_js_1.defaultPubkey)();
269
+ o += 32;
270
+ const is_mayhem_mode = (0, binary_js_1.readBool)(data, o) ?? false;
271
+ o += 1;
272
+ const is_cashback_enabled = (0, binary_js_1.readBool)(data, o) ?? false;
273
+ o += 1;
274
+ const quote_mint = normalizePumpfunQuoteMint(o + 32 <= data.length ? (0, binary_js_1.readPubkey)(data, o) : (0, dex_event_js_1.defaultPubkey)());
275
+ o += 32;
276
+ const virtual_quote_reserves = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
277
+ const ev = {
278
+ metadata,
279
+ name: n1.s,
280
+ symbol: n2.s,
281
+ uri: n3.s,
282
+ mint,
283
+ bonding_curve,
284
+ user,
285
+ creator,
286
+ timestamp,
287
+ virtual_token_reserves,
288
+ virtual_sol_reserves,
289
+ real_token_reserves,
290
+ token_total_supply,
291
+ token_program,
292
+ is_mayhem_mode,
293
+ is_cashback_enabled,
294
+ quote_mint,
295
+ quote_vault: (0, dex_event_js_1.defaultPubkey)(),
296
+ quote_token_program: (0, dex_event_js_1.defaultPubkey)(),
297
+ virtual_quote_reserves,
298
+ ix_name: "create",
299
+ };
300
+ return { PumpFunCreate: ev };
301
+ }
302
+ function parseMigrateFromData(data, metadata) {
303
+ if (data.length < 32 + 32 + 8 + 8 + 8 + 32 + 8 + 32)
304
+ return null;
305
+ let o = 0;
306
+ const user = (0, binary_js_1.readPubkey)(data, o);
307
+ o += 32;
308
+ const mint = (0, binary_js_1.readPubkey)(data, o);
309
+ o += 32;
310
+ const mint_amount = bnU64((0, binary_js_1.readU64LE)(data, o));
311
+ o += 8;
312
+ const sol_amount = bnU64((0, binary_js_1.readU64LE)(data, o));
313
+ o += 8;
314
+ const pool_migration_fee = bnU64((0, binary_js_1.readU64LE)(data, o));
315
+ o += 8;
316
+ const bonding_curve = (0, binary_js_1.readPubkey)(data, o);
317
+ o += 32;
318
+ const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
319
+ o += 8;
320
+ const pool = (0, binary_js_1.readPubkey)(data, o);
321
+ const ev = {
322
+ metadata,
323
+ user,
324
+ mint,
325
+ mint_amount,
326
+ sol_amount,
327
+ pool_migration_fee,
328
+ bonding_curve,
329
+ timestamp,
330
+ pool,
331
+ };
332
+ return { PumpFunMigrate: ev };
333
+ }
334
+ function parseMigrateBondingCurveCreatorFromData(data, metadata) {
335
+ if (data.length < 8 + 32 * 5)
336
+ return null;
337
+ let o = 0;
338
+ const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
339
+ o += 8;
340
+ const mint = (0, binary_js_1.readPubkey)(data, o);
341
+ if (!mint)
342
+ return null;
343
+ o += 32;
344
+ const bonding_curve = (0, binary_js_1.readPubkey)(data, o);
345
+ if (!bonding_curve)
346
+ return null;
347
+ o += 32;
348
+ const sharing_config = (0, binary_js_1.readPubkey)(data, o);
349
+ if (!sharing_config)
350
+ return null;
351
+ o += 32;
352
+ const old_creator = (0, binary_js_1.readPubkey)(data, o);
353
+ if (!old_creator)
354
+ return null;
355
+ o += 32;
356
+ const new_creator = (0, binary_js_1.readPubkey)(data, o);
357
+ if (!new_creator)
358
+ return null;
359
+ const ev = {
360
+ metadata,
361
+ timestamp,
362
+ mint,
363
+ bonding_curve,
364
+ sharing_config,
365
+ old_creator,
366
+ new_creator,
367
+ };
368
+ return { PumpFunMigrateBondingCurveCreator: ev };
369
+ }
370
+ /** u64 discriminator little-endian */
371
+ function pumpDiscriminators() {
372
+ return {
373
+ CREATE: DISC_CREATE,
374
+ TRADE: DISC_TRADE,
375
+ MIGRATE: DISC_MIGRATE,
376
+ MIGRATE_BONDING_CURVE_CREATOR: DISC_MIGRATE_BONDING_CURVE_CREATOR,
377
+ };
378
+ }
@@ -0,0 +1,9 @@
1
+ import type { EventMetadata } from "../core/metadata.js";
2
+ import type { DexEvent } from "../core/dex_event.js";
3
+ import { PUMPSWAP_DISC } from "./program_log_discriminators.js";
4
+ export { PUMPSWAP_DISC };
5
+ export declare function parseBuyFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
6
+ export declare function parseSellFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
7
+ export declare function parseCreatePoolFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
8
+ export declare function parseAddLiquidityFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
9
+ export declare function parseRemoveLiquidityFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;