sol-parser-sdk-nodejs 0.4.4 → 0.5.5

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 (52) hide show
  1. package/README.md +16 -4
  2. package/README_CN.md +16 -4
  3. package/dist/accounts/mod.d.ts +1 -1
  4. package/dist/accounts/mod.js +43 -9
  5. package/dist/accounts/pumpfun.d.ts +10 -0
  6. package/dist/accounts/pumpfun.js +384 -3
  7. package/dist/core/account_dispatcher_rpc.js +5 -26
  8. package/dist/core/account_fill_meteora.d.ts +1 -2
  9. package/dist/core/account_fill_meteora.js +0 -2
  10. package/dist/core/account_fill_pumpfun.js +86 -24
  11. package/dist/core/account_fill_pumpswap.js +50 -0
  12. package/dist/core/account_fill_raydium_launchlab.d.ts +4 -0
  13. package/dist/core/account_fill_raydium_launchlab.js +20 -0
  14. package/dist/core/dex_event.d.ts +136 -17
  15. package/dist/core/pumpfun_fee_enrich.d.ts +1 -0
  16. package/dist/core/pumpfun_fee_enrich.js +51 -0
  17. package/dist/grpc/log_instr_dedup.js +62 -14
  18. package/dist/grpc/program_ids.d.ts +4 -3
  19. package/dist/grpc/program_ids.js +11 -5
  20. package/dist/grpc/types.d.ts +13 -6
  21. package/dist/grpc/types.js +250 -239
  22. package/dist/index.d.ts +6 -5
  23. package/dist/index.js +21 -7
  24. package/dist/instr/meteora_damm_ix.js +4 -1
  25. package/dist/instr/meteora_dlmm_ix.d.ts +2 -0
  26. package/dist/instr/meteora_dlmm_ix.js +134 -0
  27. package/dist/instr/meteora_pools_ix.d.ts +2 -0
  28. package/dist/instr/meteora_pools_ix.js +78 -0
  29. package/dist/instr/mod.d.ts +3 -1
  30. package/dist/instr/mod.js +38 -19
  31. package/dist/instr/program_ids.d.ts +1 -5
  32. package/dist/instr/program_ids.js +3 -6
  33. package/dist/instr/pumpfun_ix.js +219 -5
  34. package/dist/instr/pumpswap_ix.js +36 -2
  35. package/dist/instr/raydium_launchlab_ix.d.ts +8 -0
  36. package/dist/instr/raydium_launchlab_ix.js +125 -0
  37. package/dist/instr/rust_aliases.d.ts +2 -0
  38. package/dist/instr/rust_aliases.js +5 -1
  39. package/dist/logs/optimized_matcher.js +14 -9
  40. package/dist/logs/pump.js +76 -3
  41. package/dist/logs/pump_amm.js +1 -1
  42. package/dist/logs/raydium_launchlab.d.ts +10 -0
  43. package/dist/logs/raydium_launchlab.js +84 -0
  44. package/dist/shredstream/client.d.ts +4 -1
  45. package/dist/shredstream/client.js +18 -14
  46. package/dist/shredstream/index.d.ts +1 -1
  47. package/dist/shredstream/index.js +1 -1
  48. package/dist/shredstream/instruction_parse.d.ts +3 -3
  49. package/dist/shredstream/instruction_parse.js +36 -13
  50. package/dist/util/market.d.ts +18 -0
  51. package/dist/util/market.js +54 -0
  52. package/package.json +1 -1
package/README.md CHANGED
@@ -35,6 +35,18 @@
35
35
 
36
36
  ---
37
37
 
38
+ ## Release notes
39
+
40
+ ### v0.5.5
41
+
42
+ - Aligns ShredStream parsing with Rust/Python/Go for low-latency static-account paths.
43
+ - Uses default pubkey placeholders for V0 ALT-loaded instruction accounts instead of dropping the instruction.
44
+ - Adds discriminator fallback when the ShredStream outer program id is ALT-loaded.
45
+ - Improves Pump.fun v2 short-account parsing, create/create_v2 handling, and event-type filter parity.
46
+ - Refreshes multi-protocol routing for Pump.fun, PumpSwap, Pump Fees, Raydium, Orca, and Meteora paths.
47
+
48
+ ---
49
+
38
50
  ## How to use
39
51
 
40
52
  ### 1. Install
@@ -42,7 +54,7 @@
42
54
  **From npm**
43
55
 
44
56
  ```bash
45
- npm install sol-parser-sdk-nodejs
57
+ npm install sol-parser-sdk-nodejs@0.5.5
46
58
  ```
47
59
 
48
60
  **From source** (folder may be named `sol-parser-sdk-ts` in a monorepo)
@@ -126,7 +138,7 @@ The client decodes gRPC `entries` bytes in **TypeScript** (same layout as the Go
126
138
  npx tsx examples/shredstream_example.ts -- --url=http://127.0.0.1:10800
127
139
  ```
128
140
 
129
- `shredstream_pumpfun_json.ts` also needs a Solana **`RPC_URL`** (or `--rpc`) for ALTs.
141
+ Without RPC, V0 ALT-loaded account indexes are represented with default pubkey placeholders and parsed best-effort. `shredstream_pumpfun_json.ts` can also use Solana **`RPC_URL`** (or `--rpc`) to expand ALTs when exact loaded-account fields are required.
130
142
 
131
143
  ---
132
144
 
@@ -152,7 +164,7 @@ From the **package root** after `npm install`. Examples use `npx tsx` and load `
152
164
  | Meteora DAMM V2 events | `npx tsx examples/meteora_damm_grpc.ts` | [meteora_damm_grpc.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/meteora_damm_grpc.ts) |
153
165
  | **ShredStream** (HTTP, not Yellowstone gRPC; see **step 5** above) | | |
154
166
  | Ultra-low-latency subscribe + queue / latency stats. URL: `--url` / `SHREDSTREAM_URL` / `.env` (default `http://127.0.0.1:10800`). | `npx tsx examples/shredstream_example.ts` | [shredstream_example.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_example.ts) |
155
- | PumpFun `DexEvent` JSON from ShredStream; needs Solana **RPC** for ALTs (`RPC_URL` or `--rpc`). | `npx tsx examples/shredstream_pumpfun_json.ts` | [shredstream_pumpfun_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_pumpfun_json.ts) |
167
+ | PumpFun `DexEvent` JSON from ShredStream; static ALT fallback works without RPC, and Solana **RPC** (`RPC_URL` or `--rpc`) expands full ALT accounts when needed. | `npx tsx examples/shredstream_pumpfun_json.ts` | [shredstream_pumpfun_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_pumpfun_json.ts) |
156
168
  | **Multi-protocol** | | |
157
169
  | Subscribe to all DEX protocols | `npx tsx examples/multi_protocol_grpc.ts` | [multi_protocol_grpc.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/multi_protocol_grpc.ts) |
158
170
  | **Utility** | | |
@@ -171,7 +183,7 @@ From the **package root** after `npm install`. Examples use `npx tsx` and load `
171
183
 
172
184
  ## Protocols
173
185
 
174
- PumpFun, PumpSwap, Raydium AMM V4 / CLMM / CPMM, Orca Whirlpool, Meteora DAMM V2 / DLMM, Bonk Launchpad (see `src/instr/`).
186
+ PumpFun, PumpSwap, Raydium AMM V4 / CLMM / CPMM, Orca Whirlpool, Meteora DAMM V2 / DLMM, Raydium LaunchLab (see `src/instr/`).
175
187
 
176
188
  ---
177
189
 
package/README_CN.md CHANGED
@@ -35,6 +35,18 @@
35
35
 
36
36
  ---
37
37
 
38
+ ## 发布说明
39
+
40
+ ### v0.5.5
41
+
42
+ - ShredStream 低延迟静态账户路径与 Rust/Python/Go 对齐。
43
+ - V0 ALT-loaded 指令账户不再整条跳过,而是用默认 pubkey 占位继续 best-effort 解析。
44
+ - 当 ShredStream 外层 program id 来自 ALT 时,按 discriminator 做候选 program id fallback。
45
+ - 改进 Pump.fun v2 短账户解析、create/create_v2 处理和事件类型过滤一致性。
46
+ - 更新 Pump.fun、PumpSwap、Pump Fees、Raydium、Orca、Meteora 的多协议路由。
47
+
48
+ ---
49
+
38
50
  ## 怎么用
39
51
 
40
52
  ### 1. 安装
@@ -42,7 +54,7 @@
42
54
  **npm**
43
55
 
44
56
  ```bash
45
- npm install sol-parser-sdk-nodejs
57
+ npm install sol-parser-sdk-nodejs@0.5.5
46
58
  ```
47
59
 
48
60
  **源码**(monorepo 里目录可能是 `sol-parser-sdk-ts`)
@@ -126,7 +138,7 @@ console.log("subscribed", sub.id);
126
138
  npx tsx examples/shredstream_example.ts -- --url=http://127.0.0.1:10800
127
139
  ```
128
140
 
129
- `shredstream_pumpfun_json.ts` 另需 Solana **`RPC_URL`**(或 `--rpc`)解析 ALT。
141
+ 无 RPC 时,V0 ALT-loaded 账户索引用默认 pubkey 占位并继续 best-effort 解析。若需要精确的 ALT 加载账户字段,`shredstream_pumpfun_json.ts` 也可以使用 Solana **`RPC_URL`**(或 `--rpc`)展开 ALT。
130
142
 
131
143
  ---
132
144
 
@@ -152,7 +164,7 @@ npx tsx examples/shredstream_example.ts -- --url=http://127.0.0.1:10800
152
164
  | Meteora DAMM V2 事件 | `npx tsx examples/meteora_damm_grpc.ts` | [meteora_damm_grpc.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/meteora_damm_grpc.ts) |
153
165
  | **ShredStream**(HTTP,**非** Yellowstone gRPC;端点见上文步骤 5) | | |
154
166
  | 超低延迟订阅、队列与延迟统计。端点:`--url` / `SHREDSTREAM_URL` / `.env`(默认 `http://127.0.0.1:10800`)。 | `npx tsx examples/shredstream_example.ts` | [shredstream_example.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_example.ts) |
155
- | ShredStream → PumpFun `DexEvent` JSON;需 Solana **RPC** 解析 ALT(`RPC_URL` 或 `--rpc`)。 | `npx tsx examples/shredstream_pumpfun_json.ts` | [shredstream_pumpfun_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_pumpfun_json.ts) |
167
+ | ShredStream → PumpFun `DexEvent` JSON;无 RPC 时可静态 ALT fallback,配置 Solana **RPC**(`RPC_URL` 或 `--rpc`)时可展开完整 ALT 账户。 | `npx tsx examples/shredstream_pumpfun_json.ts` | [shredstream_pumpfun_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_pumpfun_json.ts) |
156
168
  | **多协议** | | |
157
169
  | 同时订阅所有 DEX 协议 | `npx tsx examples/multi_protocol_grpc.ts` | [multi_protocol_grpc.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/multi_protocol_grpc.ts) |
158
170
  | **工具** | | |
@@ -171,7 +183,7 @@ npx tsx examples/shredstream_example.ts -- --url=http://127.0.0.1:10800
171
183
 
172
184
  ## 协议
173
185
 
174
- PumpFun、PumpSwap、Raydium AMM V4 / CLMM / CPMM、Orca Whirlpool、Meteora DAMM V2 / DLMM、Bonk Launchpad(见 `src/instr/`)。
186
+ PumpFun、PumpSwap、Raydium AMM V4 / CLMM / CPMM、Orca Whirlpool、Meteora DAMM V2 / DLMM、Raydium LaunchLab(见 `src/instr/`)。
175
187
 
176
188
  ---
177
189
 
@@ -5,7 +5,7 @@ import type { EventTypeFilter } from "../grpc/types.js";
5
5
  export type { AccountData } from "./types.js";
6
6
  export { parseNonceAccount, isNonceAccount } from "./nonce.js";
7
7
  export { parseTokenAccount } from "./token.js";
8
- export { parsePumpfunGlobal, parsePumpfunAccount, isPumpfunGlobalAccount, } from "./pumpfun.js";
8
+ export { parsePumpfunGlobal, parsePumpfunBondingCurve, parsePumpfunFeeConfig, parsePumpfunSharingConfig, parsePumpfunGlobalVolumeAccumulator, parsePumpfunUserVolumeAccumulator, parsePumpfunAccount, isPumpfunGlobalAccount, isPumpfunBondingCurveAccount, isPumpfunFeeConfigAccount, isPumpfunSharingConfigAccount, isPumpfunGlobalVolumeAccumulatorAccount, isPumpfunUserVolumeAccumulatorAccount, } from "./pumpfun.js";
9
9
  export { parsePumpswapGlobalConfig, parsePumpswapPool, parsePumpswapAccount, isGlobalConfigAccount, isPoolAccount, } from "./pumpswap.js";
10
10
  export { hasDiscriminator } from "./utils.js";
11
11
  export { userWalletPubkeyForOnchainAccount } from "./wallet_resolve.js";
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rpcResolveUserWalletPubkey = exports.userWalletPubkeyForOnchainAccount = exports.hasDiscriminator = exports.isPoolAccount = exports.isGlobalConfigAccount = exports.parsePumpswapAccount = exports.parsePumpswapPool = exports.parsePumpswapGlobalConfig = exports.isPumpfunGlobalAccount = exports.parsePumpfunAccount = exports.parsePumpfunGlobal = exports.parseTokenAccount = exports.isNonceAccount = exports.parseNonceAccount = void 0;
3
+ exports.rpcResolveUserWalletPubkey = exports.userWalletPubkeyForOnchainAccount = exports.hasDiscriminator = exports.isPoolAccount = exports.isGlobalConfigAccount = exports.parsePumpswapAccount = exports.parsePumpswapPool = exports.parsePumpswapGlobalConfig = exports.isPumpfunUserVolumeAccumulatorAccount = exports.isPumpfunGlobalVolumeAccumulatorAccount = exports.isPumpfunSharingConfigAccount = exports.isPumpfunFeeConfigAccount = exports.isPumpfunBondingCurveAccount = exports.isPumpfunGlobalAccount = exports.parsePumpfunAccount = exports.parsePumpfunUserVolumeAccumulator = exports.parsePumpfunGlobalVolumeAccumulator = exports.parsePumpfunSharingConfig = exports.parsePumpfunFeeConfig = exports.parsePumpfunBondingCurve = exports.parsePumpfunGlobal = exports.parseTokenAccount = exports.isNonceAccount = exports.parseNonceAccount = void 0;
4
4
  exports.parseAccountUnified = parseAccountUnified;
5
+ const types_js_1 = require("../grpc/types.js");
5
6
  const program_ids_js_1 = require("../instr/program_ids.js");
6
7
  const nonce_js_1 = require("./nonce.js");
7
8
  const token_js_1 = require("./token.js");
@@ -14,8 +15,18 @@ var token_js_2 = require("./token.js");
14
15
  Object.defineProperty(exports, "parseTokenAccount", { enumerable: true, get: function () { return token_js_2.parseTokenAccount; } });
15
16
  var pumpfun_js_2 = require("./pumpfun.js");
16
17
  Object.defineProperty(exports, "parsePumpfunGlobal", { enumerable: true, get: function () { return pumpfun_js_2.parsePumpfunGlobal; } });
18
+ Object.defineProperty(exports, "parsePumpfunBondingCurve", { enumerable: true, get: function () { return pumpfun_js_2.parsePumpfunBondingCurve; } });
19
+ Object.defineProperty(exports, "parsePumpfunFeeConfig", { enumerable: true, get: function () { return pumpfun_js_2.parsePumpfunFeeConfig; } });
20
+ Object.defineProperty(exports, "parsePumpfunSharingConfig", { enumerable: true, get: function () { return pumpfun_js_2.parsePumpfunSharingConfig; } });
21
+ Object.defineProperty(exports, "parsePumpfunGlobalVolumeAccumulator", { enumerable: true, get: function () { return pumpfun_js_2.parsePumpfunGlobalVolumeAccumulator; } });
22
+ Object.defineProperty(exports, "parsePumpfunUserVolumeAccumulator", { enumerable: true, get: function () { return pumpfun_js_2.parsePumpfunUserVolumeAccumulator; } });
17
23
  Object.defineProperty(exports, "parsePumpfunAccount", { enumerable: true, get: function () { return pumpfun_js_2.parsePumpfunAccount; } });
18
24
  Object.defineProperty(exports, "isPumpfunGlobalAccount", { enumerable: true, get: function () { return pumpfun_js_2.isPumpfunGlobalAccount; } });
25
+ Object.defineProperty(exports, "isPumpfunBondingCurveAccount", { enumerable: true, get: function () { return pumpfun_js_2.isPumpfunBondingCurveAccount; } });
26
+ Object.defineProperty(exports, "isPumpfunFeeConfigAccount", { enumerable: true, get: function () { return pumpfun_js_2.isPumpfunFeeConfigAccount; } });
27
+ Object.defineProperty(exports, "isPumpfunSharingConfigAccount", { enumerable: true, get: function () { return pumpfun_js_2.isPumpfunSharingConfigAccount; } });
28
+ Object.defineProperty(exports, "isPumpfunGlobalVolumeAccumulatorAccount", { enumerable: true, get: function () { return pumpfun_js_2.isPumpfunGlobalVolumeAccumulatorAccount; } });
29
+ Object.defineProperty(exports, "isPumpfunUserVolumeAccumulatorAccount", { enumerable: true, get: function () { return pumpfun_js_2.isPumpfunUserVolumeAccumulatorAccount; } });
19
30
  var pumpswap_js_2 = require("./pumpswap.js");
20
31
  Object.defineProperty(exports, "parsePumpswapGlobalConfig", { enumerable: true, get: function () { return pumpswap_js_2.parsePumpswapGlobalConfig; } });
21
32
  Object.defineProperty(exports, "parsePumpswapPool", { enumerable: true, get: function () { return pumpswap_js_2.parsePumpswapPool; } });
@@ -30,11 +41,22 @@ var rpc_wallet_js_1 = require("./rpc_wallet.js");
30
41
  Object.defineProperty(exports, "rpcResolveUserWalletPubkey", { enumerable: true, get: function () { return rpc_wallet_js_1.rpcResolveUserWalletPubkey; } });
31
42
  const ACCOUNT_EVENT_TYPES = [
32
43
  "TokenAccount",
44
+ "TokenInfo",
33
45
  "NonceAccount",
34
46
  "AccountPumpFunGlobal",
47
+ "AccountPumpFunBondingCurve",
48
+ "AccountPumpFunFeeConfig",
49
+ "AccountPumpFunSharingConfig",
50
+ "AccountPumpFunGlobalVolumeAccumulator",
51
+ "AccountPumpFunUserVolumeAccumulator",
35
52
  "AccountPumpSwapGlobalConfig",
36
53
  "AccountPumpSwapPool",
37
54
  ];
55
+ function filterParsedEvent(ev, eventTypeFilter) {
56
+ if (!ev || !eventTypeFilter)
57
+ return ev;
58
+ return (0, types_js_1.eventTypeFilterShouldIncludeDexEvent)(eventTypeFilter, ev) ? ev : null;
59
+ }
38
60
  /** 账户数据统一解析入口 */
39
61
  function parseAccountUnified(account, metadata, eventTypeFilter) {
40
62
  if (account.data.length === 0)
@@ -44,27 +66,39 @@ function parseAccountUnified(account, metadata, eventTypeFilter) {
44
66
  if (!shouldParse)
45
67
  return null;
46
68
  }
47
- if (account.owner === program_ids_js_1.PUMPSWAP_PROGRAM_ID && eventTypeFilter) {
48
- if (eventTypeFilter.shouldInclude("AccountPumpSwapGlobalConfig") ||
69
+ if (account.owner === program_ids_js_1.PUMPSWAP_PROGRAM_ID) {
70
+ if (!eventTypeFilter ||
71
+ eventTypeFilter.shouldInclude("AccountPumpSwapGlobalConfig") ||
49
72
  eventTypeFilter.shouldInclude("AccountPumpSwapPool")) {
50
73
  const ev = (0, pumpswap_js_1.parsePumpswapAccount)(account, metadata);
51
74
  if (ev)
52
- return ev;
75
+ return filterParsedEvent(ev, eventTypeFilter);
53
76
  }
77
+ return null;
54
78
  }
55
- if (account.owner === program_ids_js_1.PUMPFUN_PROGRAM_ID && eventTypeFilter) {
56
- if (eventTypeFilter.shouldInclude("AccountPumpFunGlobal")) {
79
+ if (account.owner === program_ids_js_1.PUMPFUN_PROGRAM_ID || account.owner === program_ids_js_1.PUMP_FEES_PROGRAM_ID) {
80
+ if (!eventTypeFilter ||
81
+ eventTypeFilter.shouldInclude("AccountPumpFunGlobal") ||
82
+ eventTypeFilter.shouldInclude("AccountPumpFunBondingCurve") ||
83
+ eventTypeFilter.shouldInclude("AccountPumpFunFeeConfig") ||
84
+ eventTypeFilter.shouldInclude("AccountPumpFunSharingConfig") ||
85
+ eventTypeFilter.shouldInclude("AccountPumpFunGlobalVolumeAccumulator") ||
86
+ eventTypeFilter.shouldInclude("AccountPumpFunUserVolumeAccumulator")) {
57
87
  const ev = (0, pumpfun_js_1.parsePumpfunAccount)(account, metadata);
58
88
  if (ev)
59
- return ev;
89
+ return filterParsedEvent(ev, eventTypeFilter);
60
90
  }
91
+ return null;
61
92
  }
62
93
  if ((0, nonce_js_1.isNonceAccount)(account.data)) {
63
94
  if (eventTypeFilter && !eventTypeFilter.shouldInclude("NonceAccount"))
64
95
  return null;
65
96
  return (0, nonce_js_1.parseNonceAccount)(account, metadata);
66
97
  }
67
- if (eventTypeFilter && !eventTypeFilter.shouldInclude("TokenAccount"))
98
+ if (eventTypeFilter &&
99
+ !eventTypeFilter.shouldInclude("TokenAccount") &&
100
+ !eventTypeFilter.shouldInclude("TokenInfo")) {
68
101
  return null;
69
- return (0, token_js_1.parseTokenAccount)(account, metadata);
102
+ }
103
+ return filterParsedEvent((0, token_js_1.parseTokenAccount)(account, metadata), eventTypeFilter);
70
104
  }
@@ -2,5 +2,15 @@ import type { EventMetadata } from "../core/metadata.js";
2
2
  import type { DexEvent } from "../core/dex_event.js";
3
3
  import type { AccountData } from "./types.js";
4
4
  export declare function isPumpfunGlobalAccount(data: Uint8Array): boolean;
5
+ export declare function isPumpfunBondingCurveAccount(data: Uint8Array): boolean;
6
+ export declare function isPumpfunFeeConfigAccount(data: Uint8Array): boolean;
7
+ export declare function isPumpfunSharingConfigAccount(data: Uint8Array): boolean;
8
+ export declare function isPumpfunGlobalVolumeAccumulatorAccount(data: Uint8Array): boolean;
9
+ export declare function isPumpfunUserVolumeAccumulatorAccount(data: Uint8Array): boolean;
5
10
  export declare function parsePumpfunGlobal(account: AccountData, metadata: EventMetadata): DexEvent | null;
11
+ export declare function parsePumpfunBondingCurve(account: AccountData, metadata: EventMetadata): DexEvent | null;
12
+ export declare function parsePumpfunFeeConfig(account: AccountData, metadata: EventMetadata): DexEvent | null;
13
+ export declare function parsePumpfunSharingConfig(account: AccountData, metadata: EventMetadata): DexEvent | null;
14
+ export declare function parsePumpfunGlobalVolumeAccumulator(account: AccountData, metadata: EventMetadata): DexEvent | null;
15
+ export declare function parsePumpfunUserVolumeAccumulator(account: AccountData, metadata: EventMetadata): DexEvent | null;
6
16
  export declare function parsePumpfunAccount(account: AccountData, metadata: EventMetadata): DexEvent | null;
@@ -1,16 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPumpfunGlobalAccount = isPumpfunGlobalAccount;
4
+ exports.isPumpfunBondingCurveAccount = isPumpfunBondingCurveAccount;
5
+ exports.isPumpfunFeeConfigAccount = isPumpfunFeeConfigAccount;
6
+ exports.isPumpfunSharingConfigAccount = isPumpfunSharingConfigAccount;
7
+ exports.isPumpfunGlobalVolumeAccumulatorAccount = isPumpfunGlobalVolumeAccumulatorAccount;
8
+ exports.isPumpfunUserVolumeAccumulatorAccount = isPumpfunUserVolumeAccumulatorAccount;
4
9
  exports.parsePumpfunGlobal = parsePumpfunGlobal;
10
+ exports.parsePumpfunBondingCurve = parsePumpfunBondingCurve;
11
+ exports.parsePumpfunFeeConfig = parsePumpfunFeeConfig;
12
+ exports.parsePumpfunSharingConfig = parsePumpfunSharingConfig;
13
+ exports.parsePumpfunGlobalVolumeAccumulator = parsePumpfunGlobalVolumeAccumulator;
14
+ exports.parsePumpfunUserVolumeAccumulator = parsePumpfunUserVolumeAccumulator;
5
15
  exports.parsePumpfunAccount = parsePumpfunAccount;
6
16
  const utils_js_1 = require("./utils.js");
7
17
  const binary_js_1 = require("../util/binary.js");
8
18
  const program_ids_js_1 = require("../instr/program_ids.js");
9
19
  const GLOBAL_DISC = Uint8Array.from([167, 232, 232, 177, 200, 108, 114, 127]);
10
- const GLOBAL_BODY = 1021;
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;
11
29
  function isPumpfunGlobalAccount(data) {
12
30
  return (0, utils_js_1.hasDiscriminator)(data, GLOBAL_DISC);
13
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
+ }
14
47
  function readPubkeyArray(data, offset, len) {
15
48
  const value = [];
16
49
  let o = offset;
@@ -23,6 +56,52 @@ function readPubkeyArray(data, offset, len) {
23
56
  }
24
57
  return { value, next: o };
25
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
+ }
26
105
  function parsePumpfunGlobal(account, metadata) {
27
106
  if (account.data.length < 8 + GLOBAL_BODY)
28
107
  return null;
@@ -80,7 +159,7 @@ function parsePumpfunGlobal(account, metadata) {
80
159
  if (creator_fee_basis_points === null)
81
160
  return null;
82
161
  o += 8;
83
- const feeRecipients = readPubkeyArray(d, o, 8);
162
+ const feeRecipients = readPubkeyArray(d, o, 7);
84
163
  if (feeRecipients === null)
85
164
  return null;
86
165
  const fee_recipients = feeRecipients.value;
@@ -119,10 +198,25 @@ function parsePumpfunGlobal(account, metadata) {
119
198
  const cashbackEnabledByte = (0, binary_js_1.readU8)(d, o);
120
199
  if (cashbackEnabledByte === null)
121
200
  return null;
201
+ const is_cashback_enabled = cashbackEnabledByte !== 0;
122
202
  o += 1;
123
203
  const buybackFeeRecipients = readPubkeyArray(d, o, 8);
124
204
  if (buybackFeeRecipients === null)
125
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;
126
220
  const global = {
127
221
  initialized,
128
222
  authority,
@@ -144,13 +238,300 @@ function parsePumpfunGlobal(account, metadata) {
144
238
  reserved_fee_recipient,
145
239
  mayhem_mode_enabled,
146
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,
147
246
  };
148
247
  const ev = { metadata, pubkey: account.pubkey, global };
149
248
  return { PumpFunGlobalAccount: ev };
150
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
+ }
151
520
  function parsePumpfunAccount(account, metadata) {
152
- if (account.owner !== program_ids_js_1.PUMPFUN_PROGRAM_ID)
521
+ if (account.owner !== program_ids_js_1.PUMPFUN_PROGRAM_ID && account.owner !== program_ids_js_1.PUMP_FEES_PROGRAM_ID)
153
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);
154
535
  if (isPumpfunGlobalAccount(account.data))
155
536
  return parsePumpfunGlobal(account, metadata);
156
537
  return null;