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,538 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPumpfunGlobalAccount = isPumpfunGlobalAccount;
4
+ exports.isPumpfunBondingCurveAccount = isPumpfunBondingCurveAccount;
5
+ exports.isPumpfunFeeConfigAccount = isPumpfunFeeConfigAccount;
6
+ exports.isPumpfunSharingConfigAccount = isPumpfunSharingConfigAccount;
7
+ exports.isPumpfunGlobalVolumeAccumulatorAccount = isPumpfunGlobalVolumeAccumulatorAccount;
8
+ exports.isPumpfunUserVolumeAccumulatorAccount = isPumpfunUserVolumeAccumulatorAccount;
9
+ exports.parsePumpfunGlobal = parsePumpfunGlobal;
10
+ exports.parsePumpfunBondingCurve = parsePumpfunBondingCurve;
11
+ exports.parsePumpfunFeeConfig = parsePumpfunFeeConfig;
12
+ exports.parsePumpfunSharingConfig = parsePumpfunSharingConfig;
13
+ exports.parsePumpfunGlobalVolumeAccumulator = parsePumpfunGlobalVolumeAccumulator;
14
+ exports.parsePumpfunUserVolumeAccumulator = parsePumpfunUserVolumeAccumulator;
15
+ exports.parsePumpfunAccount = parsePumpfunAccount;
16
+ const utils_js_1 = require("./utils.js");
17
+ const binary_js_1 = require("../util/binary.js");
18
+ const program_ids_js_1 = require("../instr/program_ids.js");
19
+ const GLOBAL_DISC = Uint8Array.from([167, 232, 232, 177, 200, 108, 114, 127]);
20
+ const GLOBAL_BODY = 1037;
21
+ const BONDING_CURVE_DISC = Uint8Array.from([23, 183, 248, 55, 96, 216, 172, 96]);
22
+ const BONDING_CURVE_BODY = 107;
23
+ const FEE_CONFIG_DISC = Uint8Array.from([143, 52, 146, 187, 219, 123, 76, 155]);
24
+ const GLOBAL_VOLUME_ACCUMULATOR_DISC = Uint8Array.from([202, 42, 246, 43, 142, 190, 30, 255]);
25
+ const SHARING_CONFIG_DISC = Uint8Array.from([216, 74, 9, 0, 56, 140, 93, 75]);
26
+ const USER_VOLUME_ACCUMULATOR_DISC = Uint8Array.from([86, 255, 112, 14, 102, 53, 154, 250]);
27
+ const MAX_FEE_TIERS = 64;
28
+ const MAX_SHAREHOLDERS = 64;
29
+ function isPumpfunGlobalAccount(data) {
30
+ return (0, utils_js_1.hasDiscriminator)(data, GLOBAL_DISC);
31
+ }
32
+ function isPumpfunBondingCurveAccount(data) {
33
+ return (0, utils_js_1.hasDiscriminator)(data, BONDING_CURVE_DISC);
34
+ }
35
+ function isPumpfunFeeConfigAccount(data) {
36
+ return (0, utils_js_1.hasDiscriminator)(data, FEE_CONFIG_DISC);
37
+ }
38
+ function isPumpfunSharingConfigAccount(data) {
39
+ return (0, utils_js_1.hasDiscriminator)(data, SHARING_CONFIG_DISC);
40
+ }
41
+ function isPumpfunGlobalVolumeAccumulatorAccount(data) {
42
+ return (0, utils_js_1.hasDiscriminator)(data, GLOBAL_VOLUME_ACCUMULATOR_DISC);
43
+ }
44
+ function isPumpfunUserVolumeAccumulatorAccount(data) {
45
+ return (0, utils_js_1.hasDiscriminator)(data, USER_VOLUME_ACCUMULATOR_DISC);
46
+ }
47
+ function readPubkeyArray(data, offset, len) {
48
+ const value = [];
49
+ let o = offset;
50
+ for (let i = 0; i < len; i++) {
51
+ const pubkey = (0, binary_js_1.readPubkey)(data, o);
52
+ if (pubkey === null)
53
+ return null;
54
+ value.push(pubkey);
55
+ o += 32;
56
+ }
57
+ return { value, next: o };
58
+ }
59
+ function readFees(data, offset) {
60
+ const lp_fee_bps = (0, binary_js_1.readU64LE)(data, offset);
61
+ const protocol_fee_bps = (0, binary_js_1.readU64LE)(data, offset + 8);
62
+ const creator_fee_bps = (0, binary_js_1.readU64LE)(data, offset + 16);
63
+ if (lp_fee_bps === null || protocol_fee_bps === null || creator_fee_bps === null)
64
+ return null;
65
+ return { value: { lp_fee_bps, protocol_fee_bps, creator_fee_bps }, next: offset + 24 };
66
+ }
67
+ function readFeeTiers(data, offset) {
68
+ const len = (0, binary_js_1.readU32LE)(data, offset);
69
+ if (len === null || len > MAX_FEE_TIERS)
70
+ return null;
71
+ let o = offset + 4;
72
+ const value = [];
73
+ for (let i = 0; i < len; i++) {
74
+ const market_cap_lamports_threshold = (0, binary_js_1.readU128LE)(data, o);
75
+ if (market_cap_lamports_threshold === null)
76
+ return null;
77
+ o += 16;
78
+ const fees = readFees(data, o);
79
+ if (fees === null)
80
+ return null;
81
+ o = fees.next;
82
+ value.push({ market_cap_lamports_threshold, fees: fees.value });
83
+ }
84
+ return { value, next: o };
85
+ }
86
+ function readShareholders(data, offset) {
87
+ const len = (0, binary_js_1.readU32LE)(data, offset);
88
+ if (len === null || len > MAX_SHAREHOLDERS)
89
+ return null;
90
+ let o = offset + 4;
91
+ const value = [];
92
+ for (let i = 0; i < len; i++) {
93
+ const address = (0, binary_js_1.readPubkey)(data, o);
94
+ if (address === null)
95
+ return null;
96
+ o += 32;
97
+ const share_bps = (0, binary_js_1.readU16LE)(data, o);
98
+ if (share_bps === null)
99
+ return null;
100
+ o += 2;
101
+ value.push({ address, share_bps });
102
+ }
103
+ return { value, next: o };
104
+ }
105
+ function parsePumpfunGlobal(account, metadata) {
106
+ if (account.data.length < 8 + GLOBAL_BODY)
107
+ return null;
108
+ if (!isPumpfunGlobalAccount(account.data))
109
+ return null;
110
+ const d = account.data.subarray(8);
111
+ let o = 0;
112
+ const initializedByte = (0, binary_js_1.readU8)(d, o);
113
+ if (initializedByte === null)
114
+ return null;
115
+ const initialized = initializedByte !== 0;
116
+ o += 1;
117
+ const authority = (0, binary_js_1.readPubkey)(d, o);
118
+ if (authority === null)
119
+ return null;
120
+ o += 32;
121
+ const fee_recipient = (0, binary_js_1.readPubkey)(d, o);
122
+ if (fee_recipient === null)
123
+ return null;
124
+ o += 32;
125
+ const initial_virtual_token_reserves = (0, binary_js_1.readU64LE)(d, o);
126
+ if (initial_virtual_token_reserves === null)
127
+ return null;
128
+ o += 8;
129
+ const initial_virtual_sol_reserves = (0, binary_js_1.readU64LE)(d, o);
130
+ if (initial_virtual_sol_reserves === null)
131
+ return null;
132
+ o += 8;
133
+ const initial_real_token_reserves = (0, binary_js_1.readU64LE)(d, o);
134
+ if (initial_real_token_reserves === null)
135
+ return null;
136
+ o += 8;
137
+ const token_total_supply = (0, binary_js_1.readU64LE)(d, o);
138
+ if (token_total_supply === null)
139
+ return null;
140
+ o += 8;
141
+ const fee_basis_points = (0, binary_js_1.readU64LE)(d, o);
142
+ if (fee_basis_points === null)
143
+ return null;
144
+ o += 8;
145
+ const withdraw_authority = (0, binary_js_1.readPubkey)(d, o);
146
+ if (withdraw_authority === null)
147
+ return null;
148
+ o += 32;
149
+ const enableMigrateByte = (0, binary_js_1.readU8)(d, o);
150
+ if (enableMigrateByte === null)
151
+ return null;
152
+ const enable_migrate = enableMigrateByte !== 0;
153
+ o += 1;
154
+ const pool_migration_fee = (0, binary_js_1.readU64LE)(d, o);
155
+ if (pool_migration_fee === null)
156
+ return null;
157
+ o += 8;
158
+ const creator_fee_basis_points = (0, binary_js_1.readU64LE)(d, o);
159
+ if (creator_fee_basis_points === null)
160
+ return null;
161
+ o += 8;
162
+ const feeRecipients = readPubkeyArray(d, o, 7);
163
+ if (feeRecipients === null)
164
+ return null;
165
+ const fee_recipients = feeRecipients.value;
166
+ o = feeRecipients.next;
167
+ const set_creator_authority = (0, binary_js_1.readPubkey)(d, o);
168
+ if (set_creator_authority === null)
169
+ return null;
170
+ o += 32;
171
+ const admin_set_creator_authority = (0, binary_js_1.readPubkey)(d, o);
172
+ if (admin_set_creator_authority === null)
173
+ return null;
174
+ o += 32;
175
+ const createV2EnabledByte = (0, binary_js_1.readU8)(d, o);
176
+ if (createV2EnabledByte === null)
177
+ return null;
178
+ const create_v2_enabled = createV2EnabledByte !== 0;
179
+ o += 1;
180
+ const whitelist_pda = (0, binary_js_1.readPubkey)(d, o);
181
+ if (whitelist_pda === null)
182
+ return null;
183
+ o += 32;
184
+ const reserved_fee_recipient = (0, binary_js_1.readPubkey)(d, o);
185
+ if (reserved_fee_recipient === null)
186
+ return null;
187
+ o += 32;
188
+ const mayhemModeEnabledByte = (0, binary_js_1.readU8)(d, o);
189
+ if (mayhemModeEnabledByte === null)
190
+ return null;
191
+ const mayhem_mode_enabled = mayhemModeEnabledByte !== 0;
192
+ o += 1;
193
+ const reservedFeeRecipients = readPubkeyArray(d, o, 7);
194
+ if (reservedFeeRecipients === null)
195
+ return null;
196
+ const reserved_fee_recipients = reservedFeeRecipients.value;
197
+ o = reservedFeeRecipients.next;
198
+ const cashbackEnabledByte = (0, binary_js_1.readU8)(d, o);
199
+ if (cashbackEnabledByte === null)
200
+ return null;
201
+ const is_cashback_enabled = cashbackEnabledByte !== 0;
202
+ o += 1;
203
+ const buybackFeeRecipients = readPubkeyArray(d, o, 8);
204
+ if (buybackFeeRecipients === null)
205
+ return null;
206
+ const buyback_fee_recipients = buybackFeeRecipients.value;
207
+ o = buybackFeeRecipients.next;
208
+ const buyback_basis_points = (0, binary_js_1.readU64LE)(d, o);
209
+ if (buyback_basis_points === null)
210
+ return null;
211
+ o += 8;
212
+ const initial_virtual_quote_reserves = (0, binary_js_1.readU64LE)(d, o);
213
+ if (initial_virtual_quote_reserves === null)
214
+ return null;
215
+ o += 8;
216
+ const whitelistedQuoteMints = readPubkeyArray(d, o, 1);
217
+ if (whitelistedQuoteMints === null)
218
+ return null;
219
+ const whitelisted_quote_mints = whitelistedQuoteMints.value;
220
+ const global = {
221
+ initialized,
222
+ authority,
223
+ fee_recipient,
224
+ initial_virtual_token_reserves,
225
+ initial_virtual_sol_reserves,
226
+ initial_real_token_reserves,
227
+ token_total_supply,
228
+ fee_basis_points,
229
+ withdraw_authority,
230
+ enable_migrate,
231
+ pool_migration_fee,
232
+ creator_fee_basis_points,
233
+ fee_recipients,
234
+ set_creator_authority,
235
+ admin_set_creator_authority,
236
+ create_v2_enabled,
237
+ whitelist_pda,
238
+ reserved_fee_recipient,
239
+ mayhem_mode_enabled,
240
+ reserved_fee_recipients,
241
+ is_cashback_enabled,
242
+ buyback_fee_recipients,
243
+ buyback_basis_points,
244
+ initial_virtual_quote_reserves,
245
+ whitelisted_quote_mints,
246
+ };
247
+ const ev = { metadata, pubkey: account.pubkey, global };
248
+ return { PumpFunGlobalAccount: ev };
249
+ }
250
+ function parsePumpfunBondingCurve(account, metadata) {
251
+ if (account.data.length < 8 + BONDING_CURVE_BODY)
252
+ return null;
253
+ if (!isPumpfunBondingCurveAccount(account.data))
254
+ return null;
255
+ const d = account.data.subarray(8);
256
+ let o = 0;
257
+ const virtual_token_reserves = (0, binary_js_1.readU64LE)(d, o);
258
+ if (virtual_token_reserves === null)
259
+ return null;
260
+ o += 8;
261
+ const virtual_quote_reserves = (0, binary_js_1.readU64LE)(d, o);
262
+ if (virtual_quote_reserves === null)
263
+ return null;
264
+ o += 8;
265
+ const real_token_reserves = (0, binary_js_1.readU64LE)(d, o);
266
+ if (real_token_reserves === null)
267
+ return null;
268
+ o += 8;
269
+ const real_quote_reserves = (0, binary_js_1.readU64LE)(d, o);
270
+ if (real_quote_reserves === null)
271
+ return null;
272
+ o += 8;
273
+ const token_total_supply = (0, binary_js_1.readU64LE)(d, o);
274
+ if (token_total_supply === null)
275
+ return null;
276
+ o += 8;
277
+ const completeByte = (0, binary_js_1.readU8)(d, o);
278
+ if (completeByte === null)
279
+ return null;
280
+ const complete = completeByte !== 0;
281
+ o += 1;
282
+ const creator = (0, binary_js_1.readPubkey)(d, o);
283
+ if (creator === null)
284
+ return null;
285
+ o += 32;
286
+ const mayhemModeByte = (0, binary_js_1.readU8)(d, o);
287
+ if (mayhemModeByte === null)
288
+ return null;
289
+ const is_mayhem_mode = mayhemModeByte !== 0;
290
+ o += 1;
291
+ const cashbackCoinByte = (0, binary_js_1.readU8)(d, o);
292
+ if (cashbackCoinByte === null)
293
+ return null;
294
+ const is_cashback_coin = cashbackCoinByte !== 0;
295
+ o += 1;
296
+ const quote_mint = (0, binary_js_1.readPubkey)(d, o);
297
+ if (quote_mint === null)
298
+ return null;
299
+ const bonding_curve = {
300
+ virtual_token_reserves,
301
+ virtual_quote_reserves,
302
+ real_token_reserves,
303
+ real_quote_reserves,
304
+ token_total_supply,
305
+ complete,
306
+ creator,
307
+ is_mayhem_mode,
308
+ is_cashback_coin,
309
+ quote_mint,
310
+ };
311
+ const ev = {
312
+ metadata,
313
+ pubkey: account.pubkey,
314
+ bonding_curve,
315
+ };
316
+ return { PumpFunBondingCurveAccount: ev };
317
+ }
318
+ function parsePumpfunFeeConfig(account, metadata) {
319
+ if (!isPumpfunFeeConfigAccount(account.data))
320
+ return null;
321
+ const d = account.data.subarray(8);
322
+ let o = 0;
323
+ const bump = (0, binary_js_1.readU8)(d, o);
324
+ if (bump === null)
325
+ return null;
326
+ o += 1;
327
+ const admin = (0, binary_js_1.readPubkey)(d, o);
328
+ if (admin === null)
329
+ return null;
330
+ o += 32;
331
+ const flatFees = readFees(d, o);
332
+ if (flatFees === null)
333
+ return null;
334
+ o = flatFees.next;
335
+ const feeTiers = readFeeTiers(d, o);
336
+ if (feeTiers === null)
337
+ return null;
338
+ o = feeTiers.next;
339
+ const stableFeeTiers = readFeeTiers(d, o);
340
+ if (stableFeeTiers === null)
341
+ return null;
342
+ const fee_config = {
343
+ bump,
344
+ admin,
345
+ flat_fees: flatFees.value,
346
+ fee_tiers: feeTiers.value,
347
+ stable_fee_tiers: stableFeeTiers.value,
348
+ };
349
+ const ev = { metadata, pubkey: account.pubkey, fee_config };
350
+ return { PumpFunFeeConfigAccount: ev };
351
+ }
352
+ function parsePumpfunSharingConfig(account, metadata) {
353
+ if (!isPumpfunSharingConfigAccount(account.data))
354
+ return null;
355
+ const d = account.data.subarray(8);
356
+ let o = 0;
357
+ const bump = (0, binary_js_1.readU8)(d, o);
358
+ if (bump === null)
359
+ return null;
360
+ o += 1;
361
+ const version = (0, binary_js_1.readU8)(d, o);
362
+ if (version === null)
363
+ return null;
364
+ o += 1;
365
+ const statusByte = (0, binary_js_1.readU8)(d, o);
366
+ if (statusByte === null || statusByte > 1)
367
+ return null;
368
+ const status = statusByte === 0 ? "Paused" : "Active";
369
+ o += 1;
370
+ const mint = (0, binary_js_1.readPubkey)(d, o);
371
+ if (mint === null)
372
+ return null;
373
+ o += 32;
374
+ const admin = (0, binary_js_1.readPubkey)(d, o);
375
+ if (admin === null)
376
+ return null;
377
+ o += 32;
378
+ const adminRevokedByte = (0, binary_js_1.readU8)(d, o);
379
+ if (adminRevokedByte === null)
380
+ return null;
381
+ const admin_revoked = adminRevokedByte !== 0;
382
+ o += 1;
383
+ const shareholders = readShareholders(d, o);
384
+ if (shareholders === null)
385
+ return null;
386
+ const sharing_config = {
387
+ bump,
388
+ version,
389
+ status,
390
+ mint,
391
+ admin,
392
+ admin_revoked,
393
+ shareholders: shareholders.value,
394
+ };
395
+ const ev = { metadata, pubkey: account.pubkey, sharing_config };
396
+ return { PumpFunSharingConfigAccount: ev };
397
+ }
398
+ function parsePumpfunGlobalVolumeAccumulator(account, metadata) {
399
+ if (!isPumpfunGlobalVolumeAccumulatorAccount(account.data))
400
+ return null;
401
+ const d = account.data.subarray(8);
402
+ let o = 0;
403
+ const start_time = (0, binary_js_1.readI64LE)(d, o);
404
+ if (start_time === null)
405
+ return null;
406
+ o += 8;
407
+ const end_time = (0, binary_js_1.readI64LE)(d, o);
408
+ if (end_time === null)
409
+ return null;
410
+ o += 8;
411
+ const seconds_in_a_day = (0, binary_js_1.readI64LE)(d, o);
412
+ if (seconds_in_a_day === null)
413
+ return null;
414
+ o += 8;
415
+ const mint = (0, binary_js_1.readPubkey)(d, o);
416
+ if (mint === null)
417
+ return null;
418
+ o += 32;
419
+ const total_token_supply = [];
420
+ for (let i = 0; i < 30; i++) {
421
+ const value = (0, binary_js_1.readU64LE)(d, o);
422
+ if (value === null)
423
+ return null;
424
+ o += 8;
425
+ total_token_supply.push(value);
426
+ }
427
+ const sol_volumes = [];
428
+ for (let i = 0; i < 30; i++) {
429
+ const value = (0, binary_js_1.readU64LE)(d, o);
430
+ if (value === null)
431
+ return null;
432
+ o += 8;
433
+ sol_volumes.push(value);
434
+ }
435
+ const global_volume_accumulator = {
436
+ start_time,
437
+ end_time,
438
+ seconds_in_a_day,
439
+ mint,
440
+ total_token_supply,
441
+ sol_volumes,
442
+ };
443
+ const ev = {
444
+ metadata,
445
+ pubkey: account.pubkey,
446
+ global_volume_accumulator,
447
+ };
448
+ return { PumpFunGlobalVolumeAccumulatorAccount: ev };
449
+ }
450
+ function parsePumpfunUserVolumeAccumulator(account, metadata) {
451
+ if (!isPumpfunUserVolumeAccumulatorAccount(account.data))
452
+ return null;
453
+ const d = account.data.subarray(8);
454
+ let o = 0;
455
+ const user = (0, binary_js_1.readPubkey)(d, o);
456
+ if (user === null)
457
+ return null;
458
+ o += 32;
459
+ const needsClaimByte = (0, binary_js_1.readU8)(d, o);
460
+ if (needsClaimByte === null)
461
+ return null;
462
+ const needs_claim = needsClaimByte !== 0;
463
+ o += 1;
464
+ const total_unclaimed_tokens = (0, binary_js_1.readU64LE)(d, o);
465
+ if (total_unclaimed_tokens === null)
466
+ return null;
467
+ o += 8;
468
+ const total_claimed_tokens = (0, binary_js_1.readU64LE)(d, o);
469
+ if (total_claimed_tokens === null)
470
+ return null;
471
+ o += 8;
472
+ const current_sol_volume = (0, binary_js_1.readU64LE)(d, o);
473
+ if (current_sol_volume === null)
474
+ return null;
475
+ o += 8;
476
+ const last_update_timestamp = (0, binary_js_1.readI64LE)(d, o);
477
+ if (last_update_timestamp === null)
478
+ return null;
479
+ o += 8;
480
+ const hasTotalClaimedTokensByte = (0, binary_js_1.readU8)(d, o);
481
+ if (hasTotalClaimedTokensByte === null)
482
+ return null;
483
+ const has_total_claimed_tokens = hasTotalClaimedTokensByte !== 0;
484
+ o += 1;
485
+ const cashback_earned = (0, binary_js_1.readU64LE)(d, o);
486
+ if (cashback_earned === null)
487
+ return null;
488
+ o += 8;
489
+ const total_cashback_claimed = (0, binary_js_1.readU64LE)(d, o);
490
+ if (total_cashback_claimed === null)
491
+ return null;
492
+ o += 8;
493
+ const stable_cashback_earned = (0, binary_js_1.readU64LE)(d, o);
494
+ if (stable_cashback_earned === null)
495
+ return null;
496
+ o += 8;
497
+ const total_stable_cashback_claimed = (0, binary_js_1.readU64LE)(d, o);
498
+ if (total_stable_cashback_claimed === null)
499
+ return null;
500
+ const user_volume_accumulator = {
501
+ user,
502
+ needs_claim,
503
+ total_unclaimed_tokens,
504
+ total_claimed_tokens,
505
+ current_sol_volume,
506
+ last_update_timestamp,
507
+ has_total_claimed_tokens,
508
+ cashback_earned,
509
+ total_cashback_claimed,
510
+ stable_cashback_earned,
511
+ total_stable_cashback_claimed,
512
+ };
513
+ const ev = {
514
+ metadata,
515
+ pubkey: account.pubkey,
516
+ user_volume_accumulator,
517
+ };
518
+ return { PumpFunUserVolumeAccumulatorAccount: ev };
519
+ }
520
+ function parsePumpfunAccount(account, metadata) {
521
+ if (account.owner !== program_ids_js_1.PUMPFUN_PROGRAM_ID && account.owner !== program_ids_js_1.PUMP_FEES_PROGRAM_ID)
522
+ return null;
523
+ if (isPumpfunFeeConfigAccount(account.data))
524
+ return parsePumpfunFeeConfig(account, metadata);
525
+ if (isPumpfunSharingConfigAccount(account.data))
526
+ return parsePumpfunSharingConfig(account, metadata);
527
+ if (isPumpfunGlobalVolumeAccumulatorAccount(account.data)) {
528
+ return parsePumpfunGlobalVolumeAccumulator(account, metadata);
529
+ }
530
+ if (isPumpfunUserVolumeAccumulatorAccount(account.data)) {
531
+ return parsePumpfunUserVolumeAccumulator(account, metadata);
532
+ }
533
+ if (isPumpfunBondingCurveAccount(account.data))
534
+ return parsePumpfunBondingCurve(account, metadata);
535
+ if (isPumpfunGlobalAccount(account.data))
536
+ return parsePumpfunGlobal(account, metadata);
537
+ return null;
538
+ }
@@ -0,0 +1,8 @@
1
+ import type { EventMetadata } from "../core/metadata.js";
2
+ import type { DexEvent } from "../core/dex_event.js";
3
+ import type { AccountData } from "./types.js";
4
+ export declare function isGlobalConfigAccount(data: Uint8Array): boolean;
5
+ export declare function isPoolAccount(data: Uint8Array): boolean;
6
+ export declare function parsePumpswapGlobalConfig(account: AccountData, metadata: EventMetadata): DexEvent | null;
7
+ export declare function parsePumpswapPool(account: AccountData, metadata: EventMetadata): DexEvent | null;
8
+ export declare function parsePumpswapAccount(account: AccountData, metadata: EventMetadata): DexEvent | null;