sol-parser-sdk 0.5.13 → 0.5.15
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/README.md +17 -2
- package/README_CN.md +17 -2
- package/dist/accounts/pumpfun.js +17 -0
- package/dist/accounts/pumpswap.js +18 -3
- package/dist/core/account_fill_meteora.d.ts +1 -1
- package/dist/core/account_fill_meteora.js +12 -1
- package/dist/core/account_fill_raydium_launchlab.js +48 -0
- package/dist/core/common_filler_rpc.d.ts +2 -2
- package/dist/core/common_filler_rpc.js +66 -0
- package/dist/core/dex_event.d.ts +127 -0
- package/dist/core/metadata.d.ts +2 -0
- package/dist/grpc/client.d.ts +1 -0
- package/dist/grpc/client.js +41 -13
- package/dist/grpc/geyser_connect.d.ts +1 -2
- package/dist/grpc/geyser_connect.js +20 -10
- package/dist/grpc/log_instr_dedup.js +6 -0
- package/dist/grpc/rpc_to_grpc.d.ts +4 -1
- package/dist/grpc/transaction_meta.d.ts +5 -1
- package/dist/grpc/types.d.ts +1 -1
- package/dist/grpc/types.js +8 -0
- package/dist/grpc/yellowstone_transaction_adapter.d.ts +4 -1
- package/dist/instr/meteora_damm_ix.js +41 -79
- package/dist/instr/meteora_dlmm_ix.js +10 -0
- package/dist/instr/pumpfun_ix.js +16 -0
- package/dist/instr/pumpswap_ix.js +13 -5
- package/dist/logs/meteora_damm.d.ts +16 -0
- package/dist/logs/meteora_damm.js +383 -11
- package/dist/logs/meteora_dlmm.js +10 -0
- package/dist/logs/optimized_matcher.js +35 -1
- package/dist/logs/program_log_discriminators.d.ts +5 -0
- package/dist/logs/program_log_discriminators.js +5 -0
- package/dist/logs/pump.js +10 -0
- package/dist/logs/pump_amm.js +22 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -38,12 +38,27 @@
|
|
|
38
38
|
| Parser inputs | Yellowstone gRPC, ShredStream, RPC transactions, encoded transactions, protocol account data |
|
|
39
39
|
| DEX protocols | PumpFun, PumpSwap, Pump Fees, Raydium LaunchLab, Raydium CPMM, Raydium CLMM, Raydium AMM V4, Meteora DAMM v2, Meteora DLMM, Meteora DBC, Orca Whirlpool |
|
|
40
40
|
| Use cases | Real-time DEX event parsing, token launch monitoring, copy trading, sniper bots, account filling, JSON event pipelines |
|
|
41
|
-
| Runtime | Node.js 18+, TypeScript, npm/yarn/pnpm projects |
|
|
41
|
+
| Runtime | Node.js 20.18+, TypeScript, npm/yarn/pnpm projects |
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
45
|
## Release notes
|
|
46
46
|
|
|
47
|
+
### v0.5.15
|
|
48
|
+
|
|
49
|
+
- Syncs with Rust `sol-parser-sdk` **0.7.3**, including the current PumpFun, PumpSwap, Pump Fees, and Meteora DAMM v2 protocol surfaces.
|
|
50
|
+
- Keeps existing optional DLMM mint/user-token fields and PumpFun balance snapshot fields aligned with the Rust 0.6.4–0.6.6 field model.
|
|
51
|
+
- Adds creator-fee and holder-reward fields across PumpFun/PumpSwap instruction, log, account, gRPC, and JSON event paths.
|
|
52
|
+
- Rejects truncated known PumpSwap trade and CreatePool tails, and prevents PumpSwap-only fields from leaking into PumpFun CreateV2 payloads.
|
|
53
|
+
|
|
54
|
+
### v0.5.14
|
|
55
|
+
|
|
56
|
+
- Upgrades the Yellowstone client to `@triton-one/yellowstone-grpc` 7.0.0 with its native Rust N-API transport.
|
|
57
|
+
- Adds `source_to_grpc_latency_us` to distinguish provider or transport backlog from exact local processing latency.
|
|
58
|
+
- Fixes Yellowstone `createdAt` timestamps represented as JavaScript `Date` objects.
|
|
59
|
+
- Updates native connection, keepalive, flow-control, stream lifecycle, and unary RPC compatibility.
|
|
60
|
+
- Requires Node.js 20.18 or newer.
|
|
61
|
+
|
|
47
62
|
### v0.5.8
|
|
48
63
|
|
|
49
64
|
- Syncs parser parity with the Rust SDK event model and program routing.
|
|
@@ -75,7 +90,7 @@
|
|
|
75
90
|
**From npm**
|
|
76
91
|
|
|
77
92
|
```bash
|
|
78
|
-
npm install sol-parser-sdk@0.5.
|
|
93
|
+
npm install sol-parser-sdk@0.5.15
|
|
79
94
|
```
|
|
80
95
|
|
|
81
96
|
**From source** (folder may be named `sol-parser-sdk-ts` in a monorepo)
|
package/README_CN.md
CHANGED
|
@@ -38,12 +38,27 @@
|
|
|
38
38
|
| 解析输入 | Yellowstone gRPC、ShredStream、RPC 交易、编码交易、协议账户数据 |
|
|
39
39
|
| DEX 协议 | PumpFun、PumpSwap、Pump Fees、Raydium LaunchLab、Raydium CPMM、Raydium CLMM、Raydium AMM V4、Meteora DAMM v2、Meteora DLMM、Meteora DBC、Orca Whirlpool |
|
|
40
40
|
| 使用场景 | 实时 DEX 事件解析、代币发射监控、跟单交易、狙击机器人、账户填充、JSON 事件管道 |
|
|
41
|
-
| 运行环境 | Node.js 18+、TypeScript、npm/yarn/pnpm 项目 |
|
|
41
|
+
| 运行环境 | Node.js 20.18+、TypeScript、npm/yarn/pnpm 项目 |
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
45
|
## 发布说明
|
|
46
46
|
|
|
47
|
+
### v0.5.15
|
|
48
|
+
|
|
49
|
+
- 对齐 Rust sol-parser-sdk **0.7.3**,覆盖当前 PumpFun、PumpSwap、Pump Fees 与 Meteora DAMM v2 协议字段。
|
|
50
|
+
- DLMM Swap 上下文字段(`token_x/y_mint`、`user_token_in/out`、`min_amount_out`)、PumpFun 可选 pre/post SOL/token 余额、Raydium LaunchLab quote/global/platform 账户上下文与 Rust 对齐。
|
|
51
|
+
- 在 PumpFun/PumpSwap instruction、log、account、gRPC 与 JSON 事件链路中补齐 creator fee 和 holder reward 字段。
|
|
52
|
+
- 拒绝 PumpSwap trade 与 CreatePool 已知字段的截断尾部,并避免 PumpSwap 专属字段进入 PumpFun CreateV2 payload。
|
|
53
|
+
|
|
54
|
+
### v0.5.14
|
|
55
|
+
|
|
56
|
+
- 将 Yellowstone 客户端升级到 `@triton-one/yellowstone-grpc` 7.0.0,使用其原生 Rust N-API 传输层。
|
|
57
|
+
- 新增 `source_to_grpc_latency_us`,用于区分服务商或传输层积压与精确的本地处理延迟。
|
|
58
|
+
- 修复 Yellowstone `createdAt` 使用 JavaScript `Date` 对象表示时的时间戳解析。
|
|
59
|
+
- 更新原生连接、keepalive、流量控制、流生命周期和 unary RPC 兼容处理。
|
|
60
|
+
- 要求 Node.js 20.18 或更高版本。
|
|
61
|
+
|
|
47
62
|
### v0.5.8
|
|
48
63
|
|
|
49
64
|
- 与 Rust SDK 的事件模型和 program 路由保持解析对齐。
|
|
@@ -75,7 +90,7 @@
|
|
|
75
90
|
**npm**
|
|
76
91
|
|
|
77
92
|
```bash
|
|
78
|
-
npm install sol-parser-sdk@0.5.
|
|
93
|
+
npm install sol-parser-sdk@0.5.15
|
|
79
94
|
```
|
|
80
95
|
|
|
81
96
|
**源码**(monorepo 里目录可能是 `sol-parser-sdk-ts`)
|
package/dist/accounts/pumpfun.js
CHANGED
|
@@ -20,6 +20,8 @@ const GLOBAL_DISC = Uint8Array.from([167, 232, 232, 177, 200, 108, 114, 127]);
|
|
|
20
20
|
const GLOBAL_BODY = 1037;
|
|
21
21
|
const BONDING_CURVE_DISC = Uint8Array.from([23, 183, 248, 55, 96, 216, 172, 96]);
|
|
22
22
|
const BONDING_CURVE_BODY = 107;
|
|
23
|
+
const BONDING_CURVE_CREATOR_FEE_BODY = 116;
|
|
24
|
+
const BONDING_CURVE_HOLDER_REWARD_BODY = 117;
|
|
23
25
|
const FEE_CONFIG_DISC = Uint8Array.from([143, 52, 146, 187, 219, 123, 76, 155]);
|
|
24
26
|
const GLOBAL_VOLUME_ACCUMULATOR_DISC = Uint8Array.from([202, 42, 246, 43, 142, 190, 30, 255]);
|
|
25
27
|
const SHARING_CONFIG_DISC = Uint8Array.from([216, 74, 9, 0, 56, 140, 93, 75]);
|
|
@@ -250,6 +252,12 @@ function parsePumpfunGlobal(account, metadata) {
|
|
|
250
252
|
function parsePumpfunBondingCurve(account, metadata) {
|
|
251
253
|
if (account.data.length < 8 + BONDING_CURVE_BODY)
|
|
252
254
|
return null;
|
|
255
|
+
const bodyLength = account.data.length - 8;
|
|
256
|
+
if (bodyLength !== BONDING_CURVE_BODY &&
|
|
257
|
+
bodyLength !== BONDING_CURVE_CREATOR_FEE_BODY &&
|
|
258
|
+
bodyLength < BONDING_CURVE_HOLDER_REWARD_BODY) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
253
261
|
if (!isPumpfunBondingCurveAccount(account.data))
|
|
254
262
|
return null;
|
|
255
263
|
const d = account.data.subarray(8);
|
|
@@ -296,6 +304,12 @@ function parsePumpfunBondingCurve(account, metadata) {
|
|
|
296
304
|
const quote_mint = (0, binary_js_1.readPubkey)(d, o);
|
|
297
305
|
if (quote_mint === null)
|
|
298
306
|
return null;
|
|
307
|
+
o += 32;
|
|
308
|
+
const creator_fee_bps = (0, binary_js_1.readU64LE)(d, o) ?? 0n;
|
|
309
|
+
o += 8;
|
|
310
|
+
const can_edit_creator_fee = ((0, binary_js_1.readU8)(d, o) ?? 0) !== 0;
|
|
311
|
+
o += 1;
|
|
312
|
+
const is_holder_reward = ((0, binary_js_1.readU8)(d, o) ?? 0) !== 0;
|
|
299
313
|
const bonding_curve = {
|
|
300
314
|
virtual_token_reserves,
|
|
301
315
|
virtual_quote_reserves,
|
|
@@ -307,6 +321,9 @@ function parsePumpfunBondingCurve(account, metadata) {
|
|
|
307
321
|
is_mayhem_mode,
|
|
308
322
|
is_cashback_coin,
|
|
309
323
|
quote_mint,
|
|
324
|
+
creator_fee_bps,
|
|
325
|
+
can_edit_creator_fee,
|
|
326
|
+
is_holder_reward,
|
|
310
327
|
};
|
|
311
328
|
const ev = {
|
|
312
329
|
metadata,
|
|
@@ -12,7 +12,9 @@ const GLOBAL_DISC = Uint8Array.from([149, 8, 156, 202, 160, 252, 176, 217]);
|
|
|
12
12
|
const POOL_DISC = Uint8Array.from([241, 154, 109, 4, 17, 177, 109, 188]);
|
|
13
13
|
const GLOBAL_BODY = 634;
|
|
14
14
|
const POOL_LEGACY_BODY = 244;
|
|
15
|
-
const
|
|
15
|
+
const POOL_BOOST_BODY = 253;
|
|
16
|
+
const POOL_CREATOR_FEE_BODY = 262;
|
|
17
|
+
const POOL_BODY = 263;
|
|
16
18
|
function isGlobalConfigAccount(data) {
|
|
17
19
|
return (0, utils_js_1.hasDiscriminator)(data, GLOBAL_DISC);
|
|
18
20
|
}
|
|
@@ -106,7 +108,11 @@ function parsePumpswapGlobalConfig(account, metadata) {
|
|
|
106
108
|
function parsePumpswapPool(account, metadata) {
|
|
107
109
|
if (account.data.length < 8 + POOL_LEGACY_BODY)
|
|
108
110
|
return null;
|
|
109
|
-
|
|
111
|
+
const bodyLength = account.data.length - 8;
|
|
112
|
+
if (bodyLength !== POOL_LEGACY_BODY &&
|
|
113
|
+
bodyLength !== POOL_BOOST_BODY &&
|
|
114
|
+
bodyLength !== POOL_CREATOR_FEE_BODY &&
|
|
115
|
+
bodyLength < POOL_BODY) {
|
|
110
116
|
return null;
|
|
111
117
|
}
|
|
112
118
|
if (!isPoolAccount(account.data))
|
|
@@ -162,12 +168,18 @@ function parsePumpswapPool(account, metadata) {
|
|
|
162
168
|
return null;
|
|
163
169
|
o += 1;
|
|
164
170
|
let virtual_quote_reserves = 0n;
|
|
165
|
-
if (d.length >=
|
|
171
|
+
if (d.length >= POOL_BOOST_BODY) {
|
|
166
172
|
const virtual = (0, binary_js_1.readU128LE)(d, o);
|
|
167
173
|
if (virtual === null)
|
|
168
174
|
return null;
|
|
169
175
|
virtual_quote_reserves = BigInt.asIntN(128, virtual);
|
|
170
176
|
}
|
|
177
|
+
o += 16;
|
|
178
|
+
const creator_fee_bps = (0, binary_js_1.readU64LE)(d, o) ?? 0n;
|
|
179
|
+
o += 8;
|
|
180
|
+
const can_edit_creator_fee = ((0, binary_js_1.readU8)(d, o) ?? 0) !== 0;
|
|
181
|
+
o += 1;
|
|
182
|
+
const is_holder_reward = ((0, binary_js_1.readU8)(d, o) ?? 0) !== 0;
|
|
171
183
|
const pool = {
|
|
172
184
|
pool_bump,
|
|
173
185
|
index,
|
|
@@ -182,6 +194,9 @@ function parsePumpswapPool(account, metadata) {
|
|
|
182
194
|
is_mayhem_mode: mayhem !== 0,
|
|
183
195
|
is_cashback_coin: cashback !== 0,
|
|
184
196
|
virtual_quote_reserves,
|
|
197
|
+
creator_fee_bps,
|
|
198
|
+
can_edit_creator_fee,
|
|
199
|
+
is_holder_reward,
|
|
185
200
|
};
|
|
186
201
|
const ev = {
|
|
187
202
|
metadata,
|
|
@@ -10,6 +10,6 @@ export declare function fillMeteoraDammV2RemoveLiquidityAccounts(_e: MeteoraDamm
|
|
|
10
10
|
export declare function fillMeteoraPoolsSwapAccounts(_e: MeteoraPoolsSwapEvent, _get: (i: number) => string): void;
|
|
11
11
|
export declare function fillMeteoraPoolsAddLiquidityAccounts(_e: MeteoraPoolsAddLiquidityEvent, _get: (i: number) => string): void;
|
|
12
12
|
export declare function fillMeteoraPoolsRemoveLiquidityAccounts(_e: MeteoraPoolsRemoveLiquidityEvent, _get: (i: number) => string): void;
|
|
13
|
-
export declare function fillMeteoraDlmmSwapAccounts(
|
|
13
|
+
export declare function fillMeteoraDlmmSwapAccounts(e: MeteoraDlmmSwapEvent, get: (i: number) => string): void;
|
|
14
14
|
export declare function fillMeteoraDlmmAddLiquidityAccounts(_e: MeteoraDlmmAddLiquidityEvent, _get: (i: number) => string): void;
|
|
15
15
|
export declare function fillMeteoraDlmmRemoveLiquidityAccounts(_e: MeteoraDlmmRemoveLiquidityEvent, _get: (i: number) => string): void;
|
|
@@ -12,6 +12,7 @@ exports.fillMeteoraPoolsRemoveLiquidityAccounts = fillMeteoraPoolsRemoveLiquidit
|
|
|
12
12
|
exports.fillMeteoraDlmmSwapAccounts = fillMeteoraDlmmSwapAccounts;
|
|
13
13
|
exports.fillMeteoraDlmmAddLiquidityAccounts = fillMeteoraDlmmAddLiquidityAccounts;
|
|
14
14
|
exports.fillMeteoraDlmmRemoveLiquidityAccounts = fillMeteoraDlmmRemoveLiquidityAccounts;
|
|
15
|
+
const dex_event_js_1 = require("./dex_event.js");
|
|
15
16
|
/** 预留:gRPC+meta 全量路径若需从 account_keys 补 vault,应对齐 cp_amm `swap` 账户顺序(IDL 中 vault/mint/token program 下标) */
|
|
16
17
|
function fillMeteoraDammV2SwapAccounts(_e, _get) { }
|
|
17
18
|
function fillMeteoraDammV2CreatePositionAccounts(_e, _get) { }
|
|
@@ -22,6 +23,16 @@ function fillMeteoraDammV2RemoveLiquidityAccounts(_e, _get) { }
|
|
|
22
23
|
function fillMeteoraPoolsSwapAccounts(_e, _get) { }
|
|
23
24
|
function fillMeteoraPoolsAddLiquidityAccounts(_e, _get) { }
|
|
24
25
|
function fillMeteoraPoolsRemoveLiquidityAccounts(_e, _get) { }
|
|
25
|
-
function fillMeteoraDlmmSwapAccounts(
|
|
26
|
+
function fillMeteoraDlmmSwapAccounts(e, get) {
|
|
27
|
+
const zero = (0, dex_event_js_1.defaultPubkey)();
|
|
28
|
+
if (!e.user_token_in || e.user_token_in === zero)
|
|
29
|
+
e.user_token_in = get(4);
|
|
30
|
+
if (!e.user_token_out || e.user_token_out === zero)
|
|
31
|
+
e.user_token_out = get(5);
|
|
32
|
+
if (!e.token_x_mint || e.token_x_mint === zero)
|
|
33
|
+
e.token_x_mint = get(6);
|
|
34
|
+
if (!e.token_y_mint || e.token_y_mint === zero)
|
|
35
|
+
e.token_y_mint = get(7);
|
|
36
|
+
}
|
|
26
37
|
function fillMeteoraDlmmAddLiquidityAccounts(_e, _get) { }
|
|
27
38
|
function fillMeteoraDlmmRemoveLiquidityAccounts(_e, _get) { }
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fillRaydiumLaunchlabTradeAccounts = fillRaydiumLaunchlabTradeAccounts;
|
|
4
4
|
exports.fillRaydiumLaunchlabPoolCreateAccounts = fillRaydiumLaunchlabPoolCreateAccounts;
|
|
5
5
|
const dex_event_js_1 = require("./dex_event.js");
|
|
6
|
+
const program_ids_js_1 = require("../instr/program_ids.js");
|
|
6
7
|
const Z = () => (0, dex_event_js_1.defaultPubkey)();
|
|
7
8
|
function fillRaydiumLaunchlabTradeAccounts(e, get) {
|
|
8
9
|
const zero = Z();
|
|
@@ -10,6 +11,26 @@ function fillRaydiumLaunchlabTradeAccounts(e, get) {
|
|
|
10
11
|
e.user = get(0);
|
|
11
12
|
if (!e.pool_state || e.pool_state === zero)
|
|
12
13
|
e.pool_state = get(4);
|
|
14
|
+
if (!e.global_config || e.global_config === zero)
|
|
15
|
+
e.global_config = get(2);
|
|
16
|
+
if (!e.platform_config || e.platform_config === zero)
|
|
17
|
+
e.platform_config = get(3);
|
|
18
|
+
if (!e.user_base_token || e.user_base_token === zero)
|
|
19
|
+
e.user_base_token = get(5);
|
|
20
|
+
if (!e.user_quote_token || e.user_quote_token === zero)
|
|
21
|
+
e.user_quote_token = get(6);
|
|
22
|
+
if (!e.base_vault || e.base_vault === zero)
|
|
23
|
+
e.base_vault = get(7);
|
|
24
|
+
if (!e.quote_vault || e.quote_vault === zero)
|
|
25
|
+
e.quote_vault = get(8);
|
|
26
|
+
if (!e.base_mint || e.base_mint === zero)
|
|
27
|
+
e.base_mint = get(9);
|
|
28
|
+
if (!e.quote_mint || e.quote_mint === zero)
|
|
29
|
+
e.quote_mint = get(10);
|
|
30
|
+
if (!e.base_token_program || e.base_token_program === zero)
|
|
31
|
+
e.base_token_program = get(11);
|
|
32
|
+
if (!e.quote_token_program || e.quote_token_program === zero)
|
|
33
|
+
e.quote_token_program = get(12);
|
|
13
34
|
}
|
|
14
35
|
function fillRaydiumLaunchlabPoolCreateAccounts(e, get) {
|
|
15
36
|
const zero = Z();
|
|
@@ -17,4 +38,31 @@ function fillRaydiumLaunchlabPoolCreateAccounts(e, get) {
|
|
|
17
38
|
e.pool_state = get(5);
|
|
18
39
|
if (!e.creator || e.creator === zero)
|
|
19
40
|
e.creator = get(1);
|
|
41
|
+
if (!e.payer || e.payer === zero)
|
|
42
|
+
e.payer = get(0);
|
|
43
|
+
if (!e.global_config || e.global_config === zero)
|
|
44
|
+
e.global_config = get(2);
|
|
45
|
+
if (!e.platform_config || e.platform_config === zero)
|
|
46
|
+
e.platform_config = get(3);
|
|
47
|
+
if (!e.base_mint || e.base_mint === zero)
|
|
48
|
+
e.base_mint = get(6);
|
|
49
|
+
if (!e.quote_mint || e.quote_mint === zero)
|
|
50
|
+
e.quote_mint = get(7);
|
|
51
|
+
if (!e.base_vault || e.base_vault === zero)
|
|
52
|
+
e.base_vault = get(8);
|
|
53
|
+
if (!e.quote_vault || e.quote_vault === zero)
|
|
54
|
+
e.quote_vault = get(9);
|
|
55
|
+
const tokenProgramIndices = get(17) === program_ids_js_1.RAYDIUM_LAUNCHLAB_PROGRAM_ID
|
|
56
|
+
? [11, 12]
|
|
57
|
+
: get(14) === program_ids_js_1.RAYDIUM_LAUNCHLAB_PROGRAM_ID
|
|
58
|
+
? [10, 11]
|
|
59
|
+
: null;
|
|
60
|
+
if (!tokenProgramIndices)
|
|
61
|
+
return;
|
|
62
|
+
if (!e.base_token_program || e.base_token_program === zero) {
|
|
63
|
+
e.base_token_program = get(tokenProgramIndices[0]);
|
|
64
|
+
}
|
|
65
|
+
if (!e.quote_token_program || e.quote_token_program === zero) {
|
|
66
|
+
e.quote_token_program = get(tokenProgramIndices[1]);
|
|
67
|
+
}
|
|
20
68
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** RPC / web3 路径补充字段(如 PumpSwap fees 指令 → `is_pump_pool
|
|
1
|
+
/** RPC / web3 路径补充字段(如 PumpSwap fees 指令 → `is_pump_pool`,PumpFun 余额) */
|
|
2
2
|
import type { DexEvent } from "./dex_event.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type InvokePair } from "./rpc_invoke_map.js";
|
|
4
4
|
import type { Message, MessageV0 } from "@solana/web3.js";
|
|
5
5
|
import type { ConfirmedTransactionMeta } from "@solana/web3.js";
|
|
6
6
|
export declare function fillDataRpc(ev: DexEvent, message: Message | MessageV0, meta: ConfirmedTransactionMeta | null, programInvokes: Map<string, InvokePair[]>): void;
|
|
@@ -1,9 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fillDataRpc = fillDataRpc;
|
|
4
|
+
const dex_event_js_1 = require("./dex_event.js");
|
|
4
5
|
const program_ids_js_1 = require("../instr/program_ids.js");
|
|
5
6
|
const rpc_invoke_map_js_1 = require("./rpc_invoke_map.js");
|
|
7
|
+
function findAccountIndex(resolver, account) {
|
|
8
|
+
const zero = (0, dex_event_js_1.defaultPubkey)();
|
|
9
|
+
if (!account || account === zero)
|
|
10
|
+
return null;
|
|
11
|
+
for (let i = 0; i < resolver.length; i++) {
|
|
12
|
+
if (resolver.get(i)?.toBase58() === account)
|
|
13
|
+
return i;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
function tokenBalanceRawAmount(amount) {
|
|
18
|
+
if (amount == null || amount === "")
|
|
19
|
+
return null;
|
|
20
|
+
try {
|
|
21
|
+
return BigInt(amount);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function fillPumpfunTradeBalances(trade, message, meta) {
|
|
28
|
+
if (!meta)
|
|
29
|
+
return;
|
|
30
|
+
const resolver = (0, rpc_invoke_map_js_1.getAccountKeyResolver)(message, meta);
|
|
31
|
+
const userIndex = findAccountIndex(resolver, trade.user);
|
|
32
|
+
if (userIndex !== null) {
|
|
33
|
+
trade.pre_sol_balance =
|
|
34
|
+
meta.preBalances[userIndex] !== undefined ? BigInt(meta.preBalances[userIndex]) : undefined;
|
|
35
|
+
trade.post_sol_balance =
|
|
36
|
+
meta.postBalances[userIndex] !== undefined ? BigInt(meta.postBalances[userIndex]) : undefined;
|
|
37
|
+
}
|
|
38
|
+
const associated = trade.associated_user;
|
|
39
|
+
if (!associated || associated === (0, dex_event_js_1.defaultPubkey)())
|
|
40
|
+
return;
|
|
41
|
+
const preBalances = meta.preTokenBalances ?? [];
|
|
42
|
+
const postBalances = meta.postTokenBalances ?? [];
|
|
43
|
+
const matchIndex = [...preBalances, ...postBalances].find((b) => {
|
|
44
|
+
const key = resolver.get(b.accountIndex);
|
|
45
|
+
return key?.toBase58() === associated;
|
|
46
|
+
})?.accountIndex;
|
|
47
|
+
if (matchIndex === undefined)
|
|
48
|
+
return;
|
|
49
|
+
const pre = preBalances.find((b) => b.accountIndex === matchIndex);
|
|
50
|
+
const post = postBalances.find((b) => b.accountIndex === matchIndex);
|
|
51
|
+
const preAmt = tokenBalanceRawAmount(pre?.uiTokenAmount?.amount);
|
|
52
|
+
const postAmt = tokenBalanceRawAmount(post?.uiTokenAmount?.amount);
|
|
53
|
+
if (preAmt !== null || postAmt !== null) {
|
|
54
|
+
trade.pre_token_balance = preAmt ?? 0n;
|
|
55
|
+
trade.post_token_balance = postAmt ?? 0n;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function pumpfunTradeFromEvent(ev) {
|
|
59
|
+
if ("PumpFunTrade" in ev)
|
|
60
|
+
return ev.PumpFunTrade;
|
|
61
|
+
if ("PumpFunBuy" in ev)
|
|
62
|
+
return ev.PumpFunBuy;
|
|
63
|
+
if ("PumpFunSell" in ev)
|
|
64
|
+
return ev.PumpFunSell;
|
|
65
|
+
if ("PumpFunBuyExactSolIn" in ev)
|
|
66
|
+
return ev.PumpFunBuyExactSolIn;
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
6
69
|
function fillDataRpc(ev, message, meta, programInvokes) {
|
|
70
|
+
const trade = pumpfunTradeFromEvent(ev);
|
|
71
|
+
if (trade)
|
|
72
|
+
fillPumpfunTradeBalances(trade, message, meta);
|
|
7
73
|
const list = programInvokes.get(program_ids_js_1.PUMPSWAP_FEES_PROGRAM_ID);
|
|
8
74
|
const last = list?.[list.length - 1];
|
|
9
75
|
if (!last)
|
package/dist/core/dex_event.d.ts
CHANGED
|
@@ -130,6 +130,14 @@ export type DexEvent = {
|
|
|
130
130
|
MeteoraDammV2InitializePool: MeteoraDammV2InitializePoolEvent;
|
|
131
131
|
} | {
|
|
132
132
|
MeteoraDammV2ClosePosition: MeteoraDammV2ClosePositionEvent;
|
|
133
|
+
} | {
|
|
134
|
+
MeteoraDammV2UpdateDelegatePermission: MeteoraDammV2UpdateDelegatePermissionEvent;
|
|
135
|
+
} | {
|
|
136
|
+
MeteoraDammV2WithdrawDeadLiquidityReward: MeteoraDammV2WithdrawDeadLiquidityRewardEvent;
|
|
137
|
+
} | {
|
|
138
|
+
MeteoraDammV2CreateConfig: MeteoraDammV2CreateConfigEvent;
|
|
139
|
+
} | {
|
|
140
|
+
MeteoraDammV2CreateDynamicConfig: MeteoraDammV2CreateDynamicConfigEvent;
|
|
133
141
|
} | {
|
|
134
142
|
MeteoraDbcSwap: MeteoraDbcSwapEvent;
|
|
135
143
|
} | {
|
|
@@ -226,6 +234,8 @@ export interface PumpFunCreateTokenEvent {
|
|
|
226
234
|
quote_vault: string;
|
|
227
235
|
quote_token_program: string;
|
|
228
236
|
virtual_quote_reserves: bigint;
|
|
237
|
+
creator_fee_bps: bigint;
|
|
238
|
+
is_holder_reward: boolean;
|
|
229
239
|
ix_name: string;
|
|
230
240
|
}
|
|
231
241
|
export interface PumpFunCreateV2TokenEvent extends PumpFunCreateTokenEvent {
|
|
@@ -278,6 +288,8 @@ export interface PumpFunTradeEvent {
|
|
|
278
288
|
quote_amount?: bigint;
|
|
279
289
|
virtual_quote_reserves?: bigint;
|
|
280
290
|
real_quote_reserves?: bigint;
|
|
291
|
+
holder_rewards_bps: bigint;
|
|
292
|
+
holder_rewards: bigint;
|
|
281
293
|
is_cashback_coin: boolean;
|
|
282
294
|
amount?: bigint;
|
|
283
295
|
max_sol_cost?: bigint;
|
|
@@ -285,6 +297,12 @@ export interface PumpFunTradeEvent {
|
|
|
285
297
|
spendable_sol_in?: bigint;
|
|
286
298
|
spendable_quote_in?: bigint;
|
|
287
299
|
min_tokens_out?: bigint;
|
|
300
|
+
/** User base-mint token balance before tx; absent when meta unavailable (e.g. ShredStream). */
|
|
301
|
+
pre_token_balance?: bigint | null;
|
|
302
|
+
post_token_balance?: bigint | null;
|
|
303
|
+
/** User native SOL lamports before/after tx. */
|
|
304
|
+
pre_sol_balance?: bigint | null;
|
|
305
|
+
post_sol_balance?: bigint | null;
|
|
288
306
|
global?: string;
|
|
289
307
|
bonding_curve: string;
|
|
290
308
|
bonding_curve_v2?: string;
|
|
@@ -485,6 +503,8 @@ export interface PumpSwapBuyEvent {
|
|
|
485
503
|
virtual_quote_reserves: bigint;
|
|
486
504
|
can_boost: boolean;
|
|
487
505
|
base_supply: bigint;
|
|
506
|
+
holder_rewards_bps: bigint;
|
|
507
|
+
holder_rewards: bigint;
|
|
488
508
|
/** 由 fees 指令数据填充(见 `fillDataRpc`) */
|
|
489
509
|
is_pump_pool: boolean;
|
|
490
510
|
/** 自指令账户填充(account_fillers/pumpswap) */
|
|
@@ -532,6 +552,8 @@ export interface PumpSwapSellEvent {
|
|
|
532
552
|
virtual_quote_reserves: bigint;
|
|
533
553
|
can_boost: boolean;
|
|
534
554
|
base_supply: bigint;
|
|
555
|
+
holder_rewards_bps: bigint;
|
|
556
|
+
holder_rewards: bigint;
|
|
535
557
|
is_pump_pool: boolean;
|
|
536
558
|
base_mint: string;
|
|
537
559
|
quote_mint: string;
|
|
@@ -568,6 +590,10 @@ export interface PumpSwapCreatePoolEvent {
|
|
|
568
590
|
user_quote_token_account: string;
|
|
569
591
|
coin_creator: string;
|
|
570
592
|
is_mayhem_mode: boolean;
|
|
593
|
+
is_cashback_coin: boolean;
|
|
594
|
+
creator_fee_bps: bigint;
|
|
595
|
+
can_edit_creator_fee: boolean;
|
|
596
|
+
is_holder_reward: boolean;
|
|
571
597
|
}
|
|
572
598
|
export interface PumpSwapLiquidityAdded {
|
|
573
599
|
metadata: EventMetadata;
|
|
@@ -1060,6 +1086,19 @@ export interface MeteoraDammV2SwapEvent {
|
|
|
1060
1086
|
referral_fee: bigint;
|
|
1061
1087
|
actual_amount_in: bigint;
|
|
1062
1088
|
current_timestamp: bigint;
|
|
1089
|
+
collect_fee_mode?: number;
|
|
1090
|
+
amount_0?: bigint;
|
|
1091
|
+
amount_1?: bigint;
|
|
1092
|
+
swap_mode?: number;
|
|
1093
|
+
excluded_fee_input_amount?: bigint;
|
|
1094
|
+
amount_left?: bigint;
|
|
1095
|
+
claiming_fee?: bigint;
|
|
1096
|
+
compounding_fee?: bigint;
|
|
1097
|
+
included_transfer_fee_amount_in?: bigint;
|
|
1098
|
+
included_transfer_fee_amount_out?: bigint;
|
|
1099
|
+
excluded_transfer_fee_amount_out?: bigint;
|
|
1100
|
+
reserve_a_amount?: bigint;
|
|
1101
|
+
reserve_b_amount?: bigint;
|
|
1063
1102
|
token_a_vault: string;
|
|
1064
1103
|
token_b_vault: string;
|
|
1065
1104
|
token_a_mint: string;
|
|
@@ -1080,6 +1119,8 @@ export interface MeteoraDammV2AddLiquidityEvent {
|
|
|
1080
1119
|
token_b_amount_threshold: bigint;
|
|
1081
1120
|
total_amount_a: bigint;
|
|
1082
1121
|
total_amount_b: bigint;
|
|
1122
|
+
reserve_a_amount?: bigint;
|
|
1123
|
+
reserve_b_amount?: bigint;
|
|
1083
1124
|
}
|
|
1084
1125
|
/** 与 `MeteoraDammV2RemoveLiquidityEvent` 对齐;Go/Python 中 `liquidity_delta` 为十进制字符串。 */
|
|
1085
1126
|
export interface MeteoraDammV2RemoveLiquidityEvent {
|
|
@@ -1092,6 +1133,10 @@ export interface MeteoraDammV2RemoveLiquidityEvent {
|
|
|
1092
1133
|
liquidity_delta: bigint;
|
|
1093
1134
|
token_a_amount_threshold: bigint;
|
|
1094
1135
|
token_b_amount_threshold: bigint;
|
|
1136
|
+
total_amount_a?: bigint;
|
|
1137
|
+
total_amount_b?: bigint;
|
|
1138
|
+
reserve_a_amount?: bigint;
|
|
1139
|
+
reserve_b_amount?: bigint;
|
|
1095
1140
|
}
|
|
1096
1141
|
/** 与 `MeteoraDammV2CreatePositionEvent` 对齐 */
|
|
1097
1142
|
export interface MeteoraDammV2CreatePositionEvent {
|
|
@@ -1135,6 +1180,56 @@ export interface MeteoraDammV2ClosePositionEvent {
|
|
|
1135
1180
|
position: string;
|
|
1136
1181
|
position_nft_mint: string;
|
|
1137
1182
|
}
|
|
1183
|
+
/** Nested dynamic fee parameters from DAMM v2 `PoolFeeParameters`. */
|
|
1184
|
+
export interface MeteoraDammV2DynamicFeeParameters {
|
|
1185
|
+
bin_step: number;
|
|
1186
|
+
bin_step_u128: bigint;
|
|
1187
|
+
filter_period: number;
|
|
1188
|
+
decay_period: number;
|
|
1189
|
+
reduction_factor: number;
|
|
1190
|
+
max_volatility_accumulator: number;
|
|
1191
|
+
variable_fee_control: number;
|
|
1192
|
+
}
|
|
1193
|
+
/** IDL `EvtUpdateDelegatePermission` */
|
|
1194
|
+
export interface MeteoraDammV2UpdateDelegatePermissionEvent {
|
|
1195
|
+
metadata: EventMetadata;
|
|
1196
|
+
position: string;
|
|
1197
|
+
owner: string;
|
|
1198
|
+
permission: number;
|
|
1199
|
+
delegate: string | null;
|
|
1200
|
+
}
|
|
1201
|
+
/** IDL `EvtWithdrawDeadLiquidityReward` */
|
|
1202
|
+
export interface MeteoraDammV2WithdrawDeadLiquidityRewardEvent {
|
|
1203
|
+
metadata: EventMetadata;
|
|
1204
|
+
pool: string;
|
|
1205
|
+
reward_mint: string;
|
|
1206
|
+
amount: bigint;
|
|
1207
|
+
}
|
|
1208
|
+
/** IDL `EvtCreateConfig` (includes DAMM v2 0.2.4 `permission`) */
|
|
1209
|
+
export interface MeteoraDammV2CreateConfigEvent {
|
|
1210
|
+
metadata: EventMetadata;
|
|
1211
|
+
base_fee_data: Uint8Array | number[];
|
|
1212
|
+
compounding_fee_bps: number;
|
|
1213
|
+
padding: number;
|
|
1214
|
+
dynamic_fee: MeteoraDammV2DynamicFeeParameters | null;
|
|
1215
|
+
vault_config_key: string;
|
|
1216
|
+
pool_creator_authority: string;
|
|
1217
|
+
activation_type: number;
|
|
1218
|
+
sqrt_min_price: bigint;
|
|
1219
|
+
sqrt_max_price: bigint;
|
|
1220
|
+
collect_fee_mode: number;
|
|
1221
|
+
index: bigint;
|
|
1222
|
+
config: string;
|
|
1223
|
+
permission: bigint;
|
|
1224
|
+
}
|
|
1225
|
+
/** IDL `EvtCreateDynamicConfig` */
|
|
1226
|
+
export interface MeteoraDammV2CreateDynamicConfigEvent {
|
|
1227
|
+
metadata: EventMetadata;
|
|
1228
|
+
config: string;
|
|
1229
|
+
pool_creator_authority: string;
|
|
1230
|
+
index: bigint;
|
|
1231
|
+
permission: bigint;
|
|
1232
|
+
}
|
|
1138
1233
|
export interface MeteoraDbcSwapEvent {
|
|
1139
1234
|
metadata: EventMetadata;
|
|
1140
1235
|
pool: string;
|
|
@@ -1170,6 +1265,13 @@ export interface MeteoraDbcCurveCompleteEvent {
|
|
|
1170
1265
|
/** Meteora DLMM Swap:`fee_bps` 在 Go/Python 为十进制字符串。 */
|
|
1171
1266
|
export interface MeteoraDlmmSwapEvent {
|
|
1172
1267
|
metadata: EventMetadata;
|
|
1268
|
+
/** Account-fill / instruction context; empty string default when absent. */
|
|
1269
|
+
token_x_mint?: string;
|
|
1270
|
+
token_y_mint?: string;
|
|
1271
|
+
user_token_in?: string;
|
|
1272
|
+
user_token_out?: string;
|
|
1273
|
+
/** Exact-in min out; 0 when instruction context absent. */
|
|
1274
|
+
min_amount_out?: bigint;
|
|
1173
1275
|
pool: string;
|
|
1174
1276
|
from: string;
|
|
1175
1277
|
start_bin_id: number;
|
|
@@ -1251,6 +1353,16 @@ export interface RaydiumLaunchlabTradeEvent {
|
|
|
1251
1353
|
is_buy: boolean;
|
|
1252
1354
|
trade_direction: TradeDirection;
|
|
1253
1355
|
exact_in: boolean;
|
|
1356
|
+
global_config?: string;
|
|
1357
|
+
platform_config?: string;
|
|
1358
|
+
user_base_token?: string;
|
|
1359
|
+
user_quote_token?: string;
|
|
1360
|
+
base_vault?: string;
|
|
1361
|
+
quote_vault?: string;
|
|
1362
|
+
base_mint?: string;
|
|
1363
|
+
quote_mint?: string;
|
|
1364
|
+
base_token_program?: string;
|
|
1365
|
+
quote_token_program?: string;
|
|
1254
1366
|
}
|
|
1255
1367
|
export interface BaseMintParam {
|
|
1256
1368
|
symbol: string;
|
|
@@ -1263,6 +1375,15 @@ export interface RaydiumLaunchlabPoolCreateEvent {
|
|
|
1263
1375
|
base_mint_param: BaseMintParam;
|
|
1264
1376
|
pool_state: string;
|
|
1265
1377
|
creator: string;
|
|
1378
|
+
payer?: string;
|
|
1379
|
+
global_config?: string;
|
|
1380
|
+
platform_config?: string;
|
|
1381
|
+
base_mint?: string;
|
|
1382
|
+
quote_mint?: string;
|
|
1383
|
+
base_vault?: string;
|
|
1384
|
+
quote_vault?: string;
|
|
1385
|
+
base_token_program?: string;
|
|
1386
|
+
quote_token_program?: string;
|
|
1266
1387
|
}
|
|
1267
1388
|
export interface RaydiumLaunchlabMigrateAmmEvent {
|
|
1268
1389
|
metadata: EventMetadata;
|
|
@@ -1344,6 +1465,9 @@ export interface PumpFunBondingCurve {
|
|
|
1344
1465
|
is_mayhem_mode: boolean;
|
|
1345
1466
|
is_cashback_coin: boolean;
|
|
1346
1467
|
quote_mint: string;
|
|
1468
|
+
creator_fee_bps: bigint;
|
|
1469
|
+
can_edit_creator_fee: boolean;
|
|
1470
|
+
is_holder_reward: boolean;
|
|
1347
1471
|
}
|
|
1348
1472
|
export interface PumpFunBondingCurveAccountEvent {
|
|
1349
1473
|
metadata: EventMetadata;
|
|
@@ -1443,6 +1567,9 @@ export interface PumpSwapPool {
|
|
|
1443
1567
|
is_mayhem_mode: boolean;
|
|
1444
1568
|
is_cashback_coin: boolean;
|
|
1445
1569
|
virtual_quote_reserves: bigint;
|
|
1570
|
+
creator_fee_bps: bigint;
|
|
1571
|
+
can_edit_creator_fee: boolean;
|
|
1572
|
+
is_holder_reward: boolean;
|
|
1446
1573
|
}
|
|
1447
1574
|
export interface PumpSwapPoolAccountEvent {
|
|
1448
1575
|
metadata: EventMetadata;
|
package/dist/core/metadata.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface EventMetadata {
|
|
|
12
12
|
parse_duration_us?: number;
|
|
13
13
|
/** Start of the local gRPC data callback through parser completion. No RPC calls are included. */
|
|
14
14
|
local_processing_latency_us?: number;
|
|
15
|
+
/** Yellowstone update creation through the local gRPC data callback; includes provider and transport delay. */
|
|
16
|
+
source_to_grpc_latency_us?: number;
|
|
15
17
|
recent_blockhash?: string;
|
|
16
18
|
}
|
|
17
19
|
export declare function makeMetadata(signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, recentBlockhash?: string): EventMetadata;
|
package/dist/grpc/client.d.ts
CHANGED