sol-parser-sdk 0.5.17 → 0.5.19
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 +46 -31
- package/README_CN.md +45 -30
- package/dist/accounts/pumpfun.js +15 -0
- package/dist/accounts/pumpswap.js +2 -0
- package/dist/core/account_dispatcher_rpc.d.ts +2 -1
- package/dist/core/account_dispatcher_rpc.js +94 -9
- package/dist/core/account_fill_pumpfun.js +20 -0
- package/dist/core/account_fill_pumpswap.d.ts +2 -0
- package/dist/core/account_fill_pumpswap.js +55 -6
- package/dist/core/account_fill_raydium.js +4 -0
- package/dist/core/dex_event.d.ts +149 -0
- package/dist/grpc/client.js +2 -0
- package/dist/grpc/log_instr_dedup.js +75 -7
- package/dist/grpc/order_buffer.d.ts +5 -0
- package/dist/grpc/order_buffer.js +53 -17
- package/dist/grpc/types.d.ts +4 -1
- package/dist/grpc/types.js +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/instr/inner.js +28 -1
- package/dist/instr/meteora_damm_ix.js +26 -0
- package/dist/instr/meteora_pools_ix.js +17 -9
- package/dist/instr/orca_whirlpool_ix.js +13 -9
- package/dist/instr/pumpfun_ix.js +84 -0
- package/dist/instr/pumpswap_ix.js +85 -10
- package/dist/instr/raydium_clmm_ix.js +5 -3
- package/dist/instr/raydium_cpmm_ix.js +11 -8
- package/dist/logs/meteora_damm.d.ts +7 -0
- package/dist/logs/meteora_damm.js +211 -0
- package/dist/logs/meteora_dbc.d.ts +3 -0
- package/dist/logs/meteora_dbc.js +23 -0
- package/dist/logs/meteora_dlmm.js +16 -4
- package/dist/logs/optimized_matcher.js +93 -10
- package/dist/logs/program_log_discriminators.d.ts +11 -0
- package/dist/logs/program_log_discriminators.js +11 -0
- package/dist/logs/pump.js +6 -3
- package/dist/logs/pump_amm.js +8 -2
- package/dist/logs/pump_upgrade.d.ts +68 -0
- package/dist/logs/pump_upgrade.js +128 -0
- package/dist/logs/raydium_cpmm.js +7 -3
- package/dist/rpc_transaction.js +84 -7
- package/dist/shredstream/alt_cache.d.ts +26 -0
- package/dist/shredstream/alt_cache.js +138 -0
- package/dist/shredstream/client.d.ts +11 -3
- package/dist/shredstream/client.js +76 -72
- package/dist/shredstream/config.d.ts +7 -3
- package/dist/shredstream/index.d.ts +3 -2
- package/dist/shredstream/index.js +5 -3
- package/dist/shredstream/instruction_parse.d.ts +1 -1
- package/dist/shredstream/instruction_parse.js +1 -0
- package/dist/simulation_route.d.ts +1 -1
- package/dist/simulation_route.js +17 -4
- package/dist/transaction_route.js +20 -1
- package/dist/wire_transaction.js +9 -10
- package/docs/USAGE.md +161 -0
- package/package.json +2 -5
- package/NATIVE_ALIGNMENT.md +0 -312
- package/NATIVE_DAMM_FACTORY_ALIGNMENT_20261004.md +0 -16
- package/NATIVE_DAMM_FACTORY_EVIDENCE_20261004.json +0 -55
- package/NATIVE_MIGRATION.md +0 -38
- package/NATIVE_PUMPFUN_NATIVE_DEBIT_ALIGNMENT_20261004.md +0 -18
- package/NATIVE_PUMPFUN_NATIVE_DEBIT_EVIDENCE_20261004.json +0 -57
- package/NATIVE_PUMPFUN_SETTLEMENT_ALIGNMENT_20261004.md +0 -11
- package/NATIVE_PUMPFUN_SETTLEMENT_EVIDENCE_20261004.json +0 -70
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fillPumpswapBoostBuyAccounts = fillPumpswapBoostBuyAccounts;
|
|
3
4
|
exports.fillPumpswapBuyAccounts = fillPumpswapBuyAccounts;
|
|
4
5
|
exports.fillPumpswapSellAccounts = fillPumpswapSellAccounts;
|
|
5
6
|
exports.fillPumpswapCreatePoolAccounts = fillPumpswapCreatePoolAccounts;
|
|
@@ -8,6 +9,16 @@ exports.fillPumpswapLiquidityAddedAccounts = fillPumpswapLiquidityAddedAccounts;
|
|
|
8
9
|
exports.fillPumpswapLiquidityRemovedAccounts = fillPumpswapLiquidityRemovedAccounts;
|
|
9
10
|
const dex_event_js_1 = require("./dex_event.js");
|
|
10
11
|
const Z = () => (0, dex_event_js_1.defaultPubkey)();
|
|
12
|
+
const TOKEN_PROGRAMS = new Set([
|
|
13
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
14
|
+
"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",
|
|
15
|
+
]);
|
|
16
|
+
function isCompactTrade(get) {
|
|
17
|
+
// Index 16 is the program in both legacy and compact layouts.
|
|
18
|
+
return (get(16) === "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" &&
|
|
19
|
+
TOKEN_PROGRAMS.has(get(9)) &&
|
|
20
|
+
TOKEN_PROGRAMS.has(get(10)));
|
|
21
|
+
}
|
|
11
22
|
function fillPumpswapTradeCommon(e, get) {
|
|
12
23
|
const zero = Z();
|
|
13
24
|
if (!e.pool || e.pool === zero)
|
|
@@ -30,10 +41,21 @@ function fillPumpswapTradeCommon(e, get) {
|
|
|
30
41
|
if (!e.pool_quote_token_account || e.pool_quote_token_account === zero) {
|
|
31
42
|
e.pool_quote_token_account = get(8);
|
|
32
43
|
}
|
|
44
|
+
if (isCompactTrade(get)) {
|
|
45
|
+
if (!e.base_token_program || e.base_token_program === zero)
|
|
46
|
+
e.base_token_program = get(9);
|
|
47
|
+
if (!e.quote_token_program || e.quote_token_program === zero)
|
|
48
|
+
e.quote_token_program = get(10);
|
|
49
|
+
if (!e.fee_recipient_quote_token_account ||
|
|
50
|
+
e.fee_recipient_quote_token_account === zero)
|
|
51
|
+
e.fee_recipient_quote_token_account = get(14);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
33
54
|
if (!e.protocol_fee_recipient || e.protocol_fee_recipient === zero) {
|
|
34
55
|
e.protocol_fee_recipient = get(9);
|
|
35
56
|
}
|
|
36
|
-
if (!e.protocol_fee_recipient_token_account ||
|
|
57
|
+
if (!e.protocol_fee_recipient_token_account ||
|
|
58
|
+
e.protocol_fee_recipient_token_account === zero) {
|
|
37
59
|
e.protocol_fee_recipient_token_account = get(10);
|
|
38
60
|
}
|
|
39
61
|
if (!e.base_token_program || e.base_token_program === zero)
|
|
@@ -42,12 +64,33 @@ function fillPumpswapTradeCommon(e, get) {
|
|
|
42
64
|
e.quote_token_program = get(12);
|
|
43
65
|
if (!e.coin_creator_vault_ata || e.coin_creator_vault_ata === zero)
|
|
44
66
|
e.coin_creator_vault_ata = get(17);
|
|
45
|
-
if (!e.coin_creator_vault_authority ||
|
|
67
|
+
if (!e.coin_creator_vault_authority ||
|
|
68
|
+
e.coin_creator_vault_authority === zero) {
|
|
46
69
|
e.coin_creator_vault_authority = get(18);
|
|
47
70
|
}
|
|
48
71
|
}
|
|
72
|
+
/** The boost layout has no user ATAs or fee accounts. Preserve decoded values. */
|
|
73
|
+
function fillPumpswapBoostBuyAccounts(e, get) {
|
|
74
|
+
const zero = Z();
|
|
75
|
+
const roles = {
|
|
76
|
+
pool: 0,
|
|
77
|
+
base_mint: 3,
|
|
78
|
+
quote_mint: 4,
|
|
79
|
+
pool_base_token_account: 5,
|
|
80
|
+
pool_quote_token_account: 6,
|
|
81
|
+
base_token_program: 9,
|
|
82
|
+
quote_token_program: 10,
|
|
83
|
+
};
|
|
84
|
+
for (const [field, index] of Object.entries(roles)) {
|
|
85
|
+
const key = field;
|
|
86
|
+
if (!e[key] || e[key] === zero)
|
|
87
|
+
e[key] = get(index);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
49
90
|
function fillPumpswapBuyAccounts(e, get) {
|
|
50
91
|
fillPumpswapTradeCommon(e, get);
|
|
92
|
+
if (isCompactTrade(get))
|
|
93
|
+
return;
|
|
51
94
|
const zero = Z();
|
|
52
95
|
const a26 = get(26);
|
|
53
96
|
if (a26 && a26 !== zero) {
|
|
@@ -55,7 +98,8 @@ function fillPumpswapBuyAccounts(e, get) {
|
|
|
55
98
|
e.pool_v2 = get(24);
|
|
56
99
|
if (!e.fee_recipient || e.fee_recipient === zero)
|
|
57
100
|
e.fee_recipient = get(25);
|
|
58
|
-
if (!e.fee_recipient_quote_token_account ||
|
|
101
|
+
if (!e.fee_recipient_quote_token_account ||
|
|
102
|
+
e.fee_recipient_quote_token_account === zero) {
|
|
59
103
|
e.fee_recipient_quote_token_account = a26;
|
|
60
104
|
}
|
|
61
105
|
return;
|
|
@@ -66,7 +110,8 @@ function fillPumpswapBuyAccounts(e, get) {
|
|
|
66
110
|
e.pool_v2 = get(23);
|
|
67
111
|
if (!e.fee_recipient || e.fee_recipient === zero)
|
|
68
112
|
e.fee_recipient = get(24);
|
|
69
|
-
if (!e.fee_recipient_quote_token_account ||
|
|
113
|
+
if (!e.fee_recipient_quote_token_account ||
|
|
114
|
+
e.fee_recipient_quote_token_account === zero) {
|
|
70
115
|
e.fee_recipient_quote_token_account = a25;
|
|
71
116
|
}
|
|
72
117
|
return;
|
|
@@ -76,6 +121,8 @@ function fillPumpswapBuyAccounts(e, get) {
|
|
|
76
121
|
}
|
|
77
122
|
function fillPumpswapSellAccounts(e, get) {
|
|
78
123
|
fillPumpswapTradeCommon(e, get);
|
|
124
|
+
if (isCompactTrade(get))
|
|
125
|
+
return;
|
|
79
126
|
const zero = Z();
|
|
80
127
|
const a25 = get(25);
|
|
81
128
|
if (a25 && a25 !== zero) {
|
|
@@ -83,7 +130,8 @@ function fillPumpswapSellAccounts(e, get) {
|
|
|
83
130
|
e.pool_v2 = get(23);
|
|
84
131
|
if (!e.fee_recipient || e.fee_recipient === zero)
|
|
85
132
|
e.fee_recipient = get(24);
|
|
86
|
-
if (!e.fee_recipient_quote_token_account ||
|
|
133
|
+
if (!e.fee_recipient_quote_token_account ||
|
|
134
|
+
e.fee_recipient_quote_token_account === zero) {
|
|
87
135
|
e.fee_recipient_quote_token_account = a25;
|
|
88
136
|
}
|
|
89
137
|
return;
|
|
@@ -94,7 +142,8 @@ function fillPumpswapSellAccounts(e, get) {
|
|
|
94
142
|
e.pool_v2 = get(21);
|
|
95
143
|
if (!e.fee_recipient || e.fee_recipient === zero)
|
|
96
144
|
e.fee_recipient = get(22);
|
|
97
|
-
if (!e.fee_recipient_quote_token_account ||
|
|
145
|
+
if (!e.fee_recipient_quote_token_account ||
|
|
146
|
+
e.fee_recipient_quote_token_account === zero) {
|
|
98
147
|
e.fee_recipient_quote_token_account = a23;
|
|
99
148
|
}
|
|
100
149
|
return;
|
|
@@ -57,11 +57,15 @@ function fillRaydiumClmmIncreaseLiquidityAccounts(e, get) {
|
|
|
57
57
|
const zero = Z();
|
|
58
58
|
if (!e.user || e.user === zero)
|
|
59
59
|
e.user = get(0);
|
|
60
|
+
if (!e.pool || e.pool === zero)
|
|
61
|
+
e.pool = get(2);
|
|
60
62
|
}
|
|
61
63
|
function fillRaydiumClmmDecreaseLiquidityAccounts(e, get) {
|
|
62
64
|
const zero = Z();
|
|
63
65
|
if (!e.user || e.user === zero)
|
|
64
66
|
e.user = get(0);
|
|
67
|
+
if (!e.pool || e.pool === zero)
|
|
68
|
+
e.pool = get(3);
|
|
65
69
|
}
|
|
66
70
|
function fillRaydiumCpmmSwapAccounts(e, get) {
|
|
67
71
|
const zero = Z();
|
package/dist/core/dex_event.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import type { PumpFunPostCompleteBuyEvent, PumpFunSweepBondingCurveFeeEvent, PumpFunCompleteEvent, PumpSwapSweepPoolFeeEvent } from "../logs/pump_upgrade.js";
|
|
1
2
|
import type { RawAccountSnapshotEvent, LiquidityAccountSnapshotEvent } from '../liquidity_snapshot.js';
|
|
2
3
|
import type { EventMetadata } from "./metadata.js";
|
|
3
4
|
/** 统一 DEX 事件:外部标签 JSON(单键对象);键名清单见 `scripts/dex-event-variant-names.json` */
|
|
4
5
|
export type DexEvent = {
|
|
6
|
+
PumpFunPostCompleteBuy: PumpFunPostCompleteBuyEvent;
|
|
7
|
+
} | {
|
|
8
|
+
PumpFunSweepBondingCurveFee: PumpFunSweepBondingCurveFeeEvent;
|
|
9
|
+
} | {
|
|
10
|
+
PumpFunComplete: PumpFunCompleteEvent;
|
|
11
|
+
} | {
|
|
12
|
+
PumpSwapSweepPoolFee: PumpSwapSweepPoolFeeEvent;
|
|
13
|
+
} | {
|
|
5
14
|
RawAccountSnapshot: RawAccountSnapshotEvent;
|
|
6
15
|
} | {
|
|
7
16
|
LiquidityAccountSnapshot: LiquidityAccountSnapshotEvent;
|
|
@@ -131,6 +140,12 @@ export type DexEvent = {
|
|
|
131
140
|
MeteoraDammV2RemoveLiquidity: MeteoraDammV2RemoveLiquidityEvent;
|
|
132
141
|
} | {
|
|
133
142
|
MeteoraDammV2CreatePosition: MeteoraDammV2CreatePositionEvent;
|
|
143
|
+
} | {
|
|
144
|
+
MeteoraDammV2ClaimPositionFee: MeteoraDammV2ClaimPositionFeeEvent;
|
|
145
|
+
} | {
|
|
146
|
+
MeteoraDammV2ClaimReward: MeteoraDammV2ClaimRewardEvent;
|
|
147
|
+
} | {
|
|
148
|
+
MeteoraDlmmClaimReward: MeteoraDlmmClaimRewardEvent;
|
|
134
149
|
} | {
|
|
135
150
|
MeteoraDammV2InitializePool: MeteoraDammV2InitializePoolEvent;
|
|
136
151
|
} | {
|
|
@@ -139,6 +154,16 @@ export type DexEvent = {
|
|
|
139
154
|
MeteoraDammV2UpdateDelegatePermission: MeteoraDammV2UpdateDelegatePermissionEvent;
|
|
140
155
|
} | {
|
|
141
156
|
MeteoraDammV2WithdrawDeadLiquidityReward: MeteoraDammV2WithdrawDeadLiquidityRewardEvent;
|
|
157
|
+
} | {
|
|
158
|
+
MeteoraDammV2WithdrawIneligibleReward: MeteoraDammV2WithdrawIneligibleRewardEvent;
|
|
159
|
+
} | {
|
|
160
|
+
MeteoraDammV2UpdateRewardFunder: MeteoraDammV2UpdateRewardFunderEvent;
|
|
161
|
+
} | {
|
|
162
|
+
MeteoraDammV2UpdateRewardDuration: MeteoraDammV2UpdateRewardDurationEvent;
|
|
163
|
+
} | {
|
|
164
|
+
MeteoraDammV2InitializeReward: MeteoraDammV2InitializeRewardEvent;
|
|
165
|
+
} | {
|
|
166
|
+
MeteoraDammV2FundReward: MeteoraDammV2FundRewardEvent;
|
|
142
167
|
} | {
|
|
143
168
|
MeteoraDammV2CreateConfig: MeteoraDammV2CreateConfigEvent;
|
|
144
169
|
} | {
|
|
@@ -219,6 +244,7 @@ export type DexEvent = {
|
|
|
219
244
|
Error: string;
|
|
220
245
|
};
|
|
221
246
|
export interface PumpFunCreateTokenEvent {
|
|
247
|
+
depth?: number;
|
|
222
248
|
metadata: EventMetadata;
|
|
223
249
|
name: string;
|
|
224
250
|
symbol: string;
|
|
@@ -259,6 +285,7 @@ export interface PumpFunCreateV2TokenEvent extends PumpFunCreateTokenEvent {
|
|
|
259
285
|
observed_fee_recipient: string;
|
|
260
286
|
}
|
|
261
287
|
export interface PumpFunTradeEvent {
|
|
288
|
+
creator_fee_unclaimed?: bigint;
|
|
262
289
|
metadata: EventMetadata;
|
|
263
290
|
mint: string;
|
|
264
291
|
sol_amount: bigint;
|
|
@@ -469,6 +496,7 @@ export interface PumpSwapTradeEvent {
|
|
|
469
496
|
ix_name: string;
|
|
470
497
|
}
|
|
471
498
|
export interface PumpSwapBuyEvent {
|
|
499
|
+
creator_fee_unclaimed?: bigint;
|
|
472
500
|
metadata: EventMetadata;
|
|
473
501
|
timestamp: bigint;
|
|
474
502
|
base_amount_out: bigint;
|
|
@@ -526,6 +554,7 @@ export interface PumpSwapBuyEvent {
|
|
|
526
554
|
fee_recipient_quote_token_account?: string;
|
|
527
555
|
}
|
|
528
556
|
export interface PumpSwapSellEvent {
|
|
557
|
+
creator_fee_unclaimed?: bigint;
|
|
529
558
|
metadata: EventMetadata;
|
|
530
559
|
timestamp: bigint;
|
|
531
560
|
base_amount_in: bigint;
|
|
@@ -662,6 +691,8 @@ export interface RaydiumClmmSwapEvent {
|
|
|
662
691
|
export interface RaydiumClmmIncreaseLiquidityEvent {
|
|
663
692
|
metadata: EventMetadata;
|
|
664
693
|
pool: string;
|
|
694
|
+
/** Personal position PDA; distinct from the NFT token account and mint. */
|
|
695
|
+
personal_position?: string;
|
|
665
696
|
position_nft_mint: string;
|
|
666
697
|
user: string;
|
|
667
698
|
liquidity: bigint;
|
|
@@ -676,6 +707,8 @@ export interface RaydiumClmmIncreaseLiquidityEvent {
|
|
|
676
707
|
export interface RaydiumClmmDecreaseLiquidityEvent {
|
|
677
708
|
metadata: EventMetadata;
|
|
678
709
|
pool: string;
|
|
710
|
+
/** Personal position PDA; distinct from the NFT token account and mint. */
|
|
711
|
+
personal_position?: string;
|
|
679
712
|
position_nft_mint: string;
|
|
680
713
|
user: string;
|
|
681
714
|
liquidity: bigint;
|
|
@@ -838,6 +871,11 @@ export interface RaydiumCpmmSwapEvent {
|
|
|
838
871
|
input_transfer_fee: bigint;
|
|
839
872
|
output_transfer_fee: bigint;
|
|
840
873
|
base_input: boolean;
|
|
874
|
+
input_mint?: string;
|
|
875
|
+
output_mint?: string;
|
|
876
|
+
trade_fee?: bigint;
|
|
877
|
+
creator_fee?: bigint;
|
|
878
|
+
creator_fee_on_input?: boolean;
|
|
841
879
|
}
|
|
842
880
|
export interface RaydiumCpmmDepositEvent {
|
|
843
881
|
metadata: EventMetadata;
|
|
@@ -1039,6 +1077,9 @@ export interface OrcaWhirlpoolPoolInitializedEvent {
|
|
|
1039
1077
|
}
|
|
1040
1078
|
export interface MeteoraPoolsSwapEvent {
|
|
1041
1079
|
metadata: EventMetadata;
|
|
1080
|
+
/** Instruction intent; executed amounts remain in in_amount/out_amount. */
|
|
1081
|
+
amount_in?: bigint;
|
|
1082
|
+
minimum_out_amount?: bigint;
|
|
1042
1083
|
in_amount: bigint;
|
|
1043
1084
|
out_amount: bigint;
|
|
1044
1085
|
trade_fee: bigint;
|
|
@@ -1210,6 +1251,53 @@ export interface MeteoraDammV2WithdrawDeadLiquidityRewardEvent {
|
|
|
1210
1251
|
reward_mint: string;
|
|
1211
1252
|
amount: bigint;
|
|
1212
1253
|
}
|
|
1254
|
+
/** IDL `EvtWithdrawIneligibleReward` */
|
|
1255
|
+
export interface MeteoraDammV2WithdrawIneligibleRewardEvent {
|
|
1256
|
+
metadata: EventMetadata;
|
|
1257
|
+
pool: string;
|
|
1258
|
+
reward_mint: string;
|
|
1259
|
+
amount: bigint;
|
|
1260
|
+
}
|
|
1261
|
+
/** Official IDL `EvtUpdateRewardFunder`. */
|
|
1262
|
+
export interface MeteoraDammV2UpdateRewardFunderEvent {
|
|
1263
|
+
metadata: EventMetadata;
|
|
1264
|
+
pool: string;
|
|
1265
|
+
reward_index: number;
|
|
1266
|
+
old_funder: string;
|
|
1267
|
+
new_funder: string;
|
|
1268
|
+
}
|
|
1269
|
+
/** Official IDL `EvtUpdateRewardDuration`. */
|
|
1270
|
+
export interface MeteoraDammV2UpdateRewardDurationEvent {
|
|
1271
|
+
metadata: EventMetadata;
|
|
1272
|
+
pool: string;
|
|
1273
|
+
reward_index: number;
|
|
1274
|
+
old_reward_duration: bigint;
|
|
1275
|
+
new_reward_duration: bigint;
|
|
1276
|
+
}
|
|
1277
|
+
/** Official IDL `EvtInitializeReward`. */
|
|
1278
|
+
export interface MeteoraDammV2InitializeRewardEvent {
|
|
1279
|
+
metadata: EventMetadata;
|
|
1280
|
+
pool: string;
|
|
1281
|
+
reward_mint: string;
|
|
1282
|
+
funder: string;
|
|
1283
|
+
creator: string;
|
|
1284
|
+
reward_index: number;
|
|
1285
|
+
reward_duration: bigint;
|
|
1286
|
+
}
|
|
1287
|
+
/** IDL `EvtFundReward`; amount is net new funding plus carried empty rewards.
|
|
1288
|
+
* The post rate also includes unexpired rewards from the previous period. */
|
|
1289
|
+
export interface MeteoraDammV2FundRewardEvent {
|
|
1290
|
+
metadata: EventMetadata;
|
|
1291
|
+
pool: string;
|
|
1292
|
+
funder: string;
|
|
1293
|
+
mint_reward: string;
|
|
1294
|
+
reward_index: number;
|
|
1295
|
+
amount: bigint;
|
|
1296
|
+
transfer_fee_excluded_amount_in: bigint;
|
|
1297
|
+
reward_duration_end: bigint;
|
|
1298
|
+
pre_reward_rate: bigint;
|
|
1299
|
+
post_reward_rate: bigint;
|
|
1300
|
+
}
|
|
1213
1301
|
/** IDL `EvtCreateConfig` (includes DAMM v2 0.2.4 `permission`) */
|
|
1214
1302
|
export interface MeteoraDammV2CreateConfigEvent {
|
|
1215
1303
|
metadata: EventMetadata;
|
|
@@ -1236,6 +1324,17 @@ export interface MeteoraDammV2CreateDynamicConfigEvent {
|
|
|
1236
1324
|
permission: bigint;
|
|
1237
1325
|
}
|
|
1238
1326
|
export interface MeteoraDbcSwapEvent {
|
|
1327
|
+
event_version?: number;
|
|
1328
|
+
swap_mode?: number;
|
|
1329
|
+
amount_0?: bigint;
|
|
1330
|
+
amount_1?: bigint;
|
|
1331
|
+
maximum_amount_in?: bigint;
|
|
1332
|
+
included_fee_input_amount?: bigint;
|
|
1333
|
+
/** Curve remainder uses fee-excluded units with input fees; not gross unspent wallet funding. */
|
|
1334
|
+
amount_left?: bigint;
|
|
1335
|
+
quote_reserve_amount?: bigint;
|
|
1336
|
+
migration_threshold?: bigint;
|
|
1337
|
+
has_transfer_hook?: boolean;
|
|
1239
1338
|
metadata: EventMetadata;
|
|
1240
1339
|
pool: string;
|
|
1241
1340
|
config: string;
|
|
@@ -1288,6 +1387,12 @@ export interface MeteoraDlmmSwapEvent {
|
|
|
1288
1387
|
protocol_fee: bigint;
|
|
1289
1388
|
fee_bps: bigint;
|
|
1290
1389
|
host_fee: bigint;
|
|
1390
|
+
event_version?: number;
|
|
1391
|
+
amount_left?: bigint;
|
|
1392
|
+
mm_fee?: bigint;
|
|
1393
|
+
limit_order_fee?: bigint;
|
|
1394
|
+
fees_on_input?: boolean;
|
|
1395
|
+
fees_on_token_x?: boolean;
|
|
1291
1396
|
}
|
|
1292
1397
|
export interface MeteoraPoolsSetPoolFeesEvent {
|
|
1293
1398
|
metadata: EventMetadata;
|
|
@@ -1448,6 +1553,11 @@ export interface NonceAccountEvent {
|
|
|
1448
1553
|
authority: string;
|
|
1449
1554
|
}
|
|
1450
1555
|
export interface PumpFunGlobal {
|
|
1556
|
+
creator_fee_configurable?: boolean;
|
|
1557
|
+
max_configurable_creator_fee_bps?: bigint;
|
|
1558
|
+
holder_reward_claim_authority?: string;
|
|
1559
|
+
is_holder_reward_enabled?: boolean;
|
|
1560
|
+
max_curve_depth?: number;
|
|
1451
1561
|
initialized: boolean;
|
|
1452
1562
|
authority: string;
|
|
1453
1563
|
fee_recipient: string;
|
|
@@ -1480,6 +1590,12 @@ export interface PumpFunGlobalAccountEvent {
|
|
|
1480
1590
|
global: PumpFunGlobal;
|
|
1481
1591
|
}
|
|
1482
1592
|
export interface PumpFunBondingCurve {
|
|
1593
|
+
creator_fee?: bigint;
|
|
1594
|
+
protocol_fees?: bigint;
|
|
1595
|
+
depth?: number;
|
|
1596
|
+
initial_virtual_quote_reserves?: bigint;
|
|
1597
|
+
post_complete_base_out?: bigint;
|
|
1598
|
+
post_complete_quote_in?: bigint;
|
|
1483
1599
|
virtual_token_reserves: bigint;
|
|
1484
1600
|
virtual_quote_reserves: bigint;
|
|
1485
1601
|
real_token_reserves: bigint;
|
|
@@ -1500,6 +1616,7 @@ export interface PumpFunBondingCurveAccountEvent {
|
|
|
1500
1616
|
bonding_curve: PumpFunBondingCurve;
|
|
1501
1617
|
}
|
|
1502
1618
|
export interface PumpFunFeeConfig {
|
|
1619
|
+
exotic_flat_fees?: PumpFeesFees;
|
|
1503
1620
|
bump: number;
|
|
1504
1621
|
admin: string;
|
|
1505
1622
|
flat_fees: PumpFeesFees;
|
|
@@ -1579,6 +1696,8 @@ export interface PumpSwapGlobalConfigAccountEvent {
|
|
|
1579
1696
|
global_config: PumpSwapGlobalConfig;
|
|
1580
1697
|
}
|
|
1581
1698
|
export interface PumpSwapPool {
|
|
1699
|
+
protocol_fees?: bigint;
|
|
1700
|
+
creator_fees?: bigint;
|
|
1582
1701
|
pool_bump: number;
|
|
1583
1702
|
index: number;
|
|
1584
1703
|
creator: string;
|
|
@@ -1870,3 +1989,33 @@ export type LaunchLabPoolCreateEvent = RaydiumLaunchlabPoolCreateEvent;
|
|
|
1870
1989
|
export type StonkFunPoolCreateEvent = RaydiumLaunchlabPoolCreateEvent;
|
|
1871
1990
|
export type LaunchLabTradeEvent = RaydiumLaunchlabTradeEvent;
|
|
1872
1991
|
export type StonkFunTradeEvent = RaydiumLaunchlabTradeEvent;
|
|
1992
|
+
/** Official gross claim amounts; transfer fees can reduce recipient credit. */
|
|
1993
|
+
export interface MeteoraDammV2ClaimPositionFeeEvent {
|
|
1994
|
+
metadata: EventMetadata;
|
|
1995
|
+
pool: string;
|
|
1996
|
+
position: string;
|
|
1997
|
+
owner: string;
|
|
1998
|
+
fee_a_claimed: bigint;
|
|
1999
|
+
fee_b_claimed: bigint;
|
|
2000
|
+
}
|
|
2001
|
+
/** Official accrued gross reward cleared from the position. A frozen-vault skip
|
|
2002
|
+
* can emit a nonzero total_reward without a transfer; use token transfers and
|
|
2003
|
+
* net balance changes to determine wallet credits. */
|
|
2004
|
+
export interface MeteoraDammV2ClaimRewardEvent {
|
|
2005
|
+
metadata: EventMetadata;
|
|
2006
|
+
pool: string;
|
|
2007
|
+
position: string;
|
|
2008
|
+
owner: string;
|
|
2009
|
+
mint_reward: string;
|
|
2010
|
+
reward_index: number;
|
|
2011
|
+
total_reward: bigint;
|
|
2012
|
+
}
|
|
2013
|
+
export interface MeteoraDlmmClaimRewardEvent {
|
|
2014
|
+
metadata: EventMetadata;
|
|
2015
|
+
pool: string;
|
|
2016
|
+
position: string;
|
|
2017
|
+
owner: string;
|
|
2018
|
+
reward_index: bigint;
|
|
2019
|
+
total_reward: bigint;
|
|
2020
|
+
active_bin_id: number;
|
|
2021
|
+
}
|
package/dist/grpc/client.js
CHANGED
|
@@ -536,6 +536,8 @@ class YellowstoneGrpc {
|
|
|
536
536
|
};
|
|
537
537
|
let flushTimer;
|
|
538
538
|
if (order.needsTimer) {
|
|
539
|
+
// Idle flushes are limited by Node timers (at least 1 ms); arrivals
|
|
540
|
+
// still check the monotonic microsecond window in OrderDispatcher.
|
|
539
541
|
const intervalMs = this.config.order_mode === "MicroBatch"
|
|
540
542
|
? Math.max(1, Math.ceil(this.config.micro_batch_us / 1000))
|
|
541
543
|
: Math.max(1, Math.floor(this.config.order_timeout_ms / 2));
|
|
@@ -48,10 +48,12 @@ function ixLane(ixName) {
|
|
|
48
48
|
switch (ixName) {
|
|
49
49
|
case "sell":
|
|
50
50
|
case "sell_v2":
|
|
51
|
+
case "sell_v3":
|
|
51
52
|
return 1;
|
|
52
53
|
case "buy_exact_sol_in":
|
|
53
54
|
case "buy_exact_quote_in":
|
|
54
55
|
case "buy_exact_quote_in_v2":
|
|
56
|
+
case "buy_exact_quote_in_v3":
|
|
55
57
|
return 2;
|
|
56
58
|
default:
|
|
57
59
|
return 0;
|
|
@@ -74,6 +76,10 @@ function dedupeKey(ev, occurrenceCounts) {
|
|
|
74
76
|
return `PumpFunTrade|${base}|${occurrence}`;
|
|
75
77
|
}
|
|
76
78
|
switch (name) {
|
|
79
|
+
case "PumpFunComplete":
|
|
80
|
+
return `PumpFunComplete|${data.mint}|${data.bonding_curve}|${data.user}`;
|
|
81
|
+
case "PumpFunPostCompleteBuy":
|
|
82
|
+
return `PumpFunPostCompleteBuy|${data.mint}|${data.bonding_curve}|${data.user}|${data.base_out}|${data.quote_in}`;
|
|
77
83
|
case "PumpFunCreate":
|
|
78
84
|
return `PumpFunCreate|${data.mint}`;
|
|
79
85
|
case "PumpFunCreateV2":
|
|
@@ -82,22 +88,35 @@ function dedupeKey(ev, occurrenceCounts) {
|
|
|
82
88
|
return `PumpFunMigrate|${data.mint}|${data.pool}|${data.user}`;
|
|
83
89
|
case "RaydiumLaunchlabTrade":
|
|
84
90
|
return `RaydiumLaunchlabTrade|${data.pool_state}|${data.user}|${Boolean(data.is_buy)}`;
|
|
91
|
+
case "MeteoraPoolsPoolCreated":
|
|
92
|
+
return isDefaultPubkey(data.pool) ? null : `MeteoraPoolsPoolCreated|${data.pool}`;
|
|
85
93
|
case "RaydiumLaunchlabPoolCreate":
|
|
86
94
|
return `RaydiumLaunchlabPoolCreate|${data.pool_state}`;
|
|
87
95
|
case "RaydiumLaunchlabMigrateAmm":
|
|
88
96
|
return `RaydiumLaunchlabMigrateAmm|${data.old_pool}|${data.new_pool}|${data.user}`;
|
|
89
97
|
case "PumpSwapTrade":
|
|
90
98
|
return `PumpSwapTrade|${data.mint}|${data.user}|${Boolean(data.is_buy)}|${ixLane(data.ix_name)}`;
|
|
91
|
-
case "PumpSwapBuy":
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
case "PumpSwapBuy": {
|
|
100
|
+
const base = `PumpSwapBuy|${data.pool}|${data.user}`;
|
|
101
|
+
return `${base}|${nextOccurrence(base, occurrenceCounts)}`;
|
|
102
|
+
}
|
|
103
|
+
case "PumpSwapSell": {
|
|
104
|
+
const base = `PumpSwapSell|${data.pool}|${data.user}`;
|
|
105
|
+
return `${base}|${nextOccurrence(base, occurrenceCounts)}`;
|
|
106
|
+
}
|
|
95
107
|
case "PumpSwapCreatePool":
|
|
96
108
|
return `PumpSwapCreatePool|${data.pool}|${data.base_mint}|${data.quote_mint}`;
|
|
97
109
|
case "PumpSwapLiquidityAdded":
|
|
98
110
|
return `PumpSwapLiquidityAdded|${data.pool}|${data.user}`;
|
|
99
111
|
case "PumpSwapLiquidityRemoved":
|
|
100
112
|
return `PumpSwapLiquidityRemoved|${data.pool}|${data.user}`;
|
|
113
|
+
case "RaydiumClmmIncreaseLiquidity":
|
|
114
|
+
case "RaydiumClmmDecreaseLiquidity": {
|
|
115
|
+
if (isDefaultPubkey(data.personal_position))
|
|
116
|
+
return null;
|
|
117
|
+
const base = `${name}|${data.personal_position}`;
|
|
118
|
+
return `${base}|${nextOccurrence(base, occurrenceCounts)}`;
|
|
119
|
+
}
|
|
101
120
|
case "RaydiumClmmSwap": {
|
|
102
121
|
const base = String(data.pool_state);
|
|
103
122
|
return `RaydiumClmmSwap|${base}|${nextOccurrence(`RaydiumClmm|${base}`, occurrenceCounts)}`;
|
|
@@ -112,6 +131,11 @@ function dedupeKey(ev, occurrenceCounts) {
|
|
|
112
131
|
: `in|${data.amount_in}`;
|
|
113
132
|
return `RaydiumAmmV4Swap|${base}|${nextOccurrence(`RaydiumAmmV4|${base}`, occurrenceCounts)}`;
|
|
114
133
|
}
|
|
134
|
+
case "OrcaWhirlpoolLiquidityIncreased":
|
|
135
|
+
case "OrcaWhirlpoolLiquidityDecreased": {
|
|
136
|
+
const base = `${name}|${data.whirlpool}|${data.position}|${data.liquidity}`;
|
|
137
|
+
return `${base}|${nextOccurrence(base, occurrenceCounts)}`;
|
|
138
|
+
}
|
|
115
139
|
case "OrcaWhirlpoolSwap": {
|
|
116
140
|
const base = String(data.whirlpool);
|
|
117
141
|
return `OrcaWhirlpoolSwap|${base}|${nextOccurrence(`OrcaWhirlpool|${base}`, occurrenceCounts)}`;
|
|
@@ -377,6 +401,13 @@ function mergeGrpcInstructionIntoLog(logEvent, ixEvent) {
|
|
|
377
401
|
if (ixName === "PumpSwapLiquidityRemoved")
|
|
378
402
|
mergePumpSwapLiquidity(log, ix);
|
|
379
403
|
break;
|
|
404
|
+
case "RaydiumClmmIncreaseLiquidity":
|
|
405
|
+
case "RaydiumClmmDecreaseLiquidity":
|
|
406
|
+
for (const key of ["pool", "user", "personal_position"])
|
|
407
|
+
fillString(log, key, ix);
|
|
408
|
+
for (const key of logName === "RaydiumClmmIncreaseLiquidity" ? ["amount0_max", "amount1_max"] : ["amount0_min", "amount1_min"])
|
|
409
|
+
log[key] = ix[key];
|
|
410
|
+
return;
|
|
380
411
|
case "RaydiumClmmSwap":
|
|
381
412
|
if (ixName === "RaydiumClmmSwap")
|
|
382
413
|
mergeRaydiumClmmSwap(log, ix);
|
|
@@ -385,6 +416,11 @@ function mergeGrpcInstructionIntoLog(logEvent, ixEvent) {
|
|
|
385
416
|
if (ixName === "RaydiumAmmV4Swap")
|
|
386
417
|
mergeRaydiumAmmV4Swap(log, ix);
|
|
387
418
|
break;
|
|
419
|
+
case "MeteoraPoolsPoolCreated":
|
|
420
|
+
if (ixName === "MeteoraPoolsPoolCreated")
|
|
421
|
+
for (const key of ["pool", "lp_mint", "token_a_mint", "token_b_mint"])
|
|
422
|
+
fillString(log, key, ix);
|
|
423
|
+
break;
|
|
388
424
|
case "RaydiumLaunchlabPoolCreate":
|
|
389
425
|
if (ixName === "RaydiumLaunchlabPoolCreate")
|
|
390
426
|
mergeRaydiumLaunchlabPoolCreate(log, ix);
|
|
@@ -408,8 +444,17 @@ function dedupeLogInstructionEvents(logEvents, instructionEvents) {
|
|
|
408
444
|
indexByKey.set(key, out.length);
|
|
409
445
|
out.push(ev);
|
|
410
446
|
}
|
|
411
|
-
|
|
412
|
-
|
|
447
|
+
// Ordinal pairing is ambiguous when one source has lost an invocation.
|
|
448
|
+
const instructionKeys = instructionEvents.map(ev => dedupeKey(ev, ixOccurrenceCounts));
|
|
449
|
+
for (const [base, count] of logOccurrenceCounts) {
|
|
450
|
+
if (!/^(PumpFun|PumpSwapBuy|PumpSwapSell|OrcaWhirlpoolLiquidityIncreased|OrcaWhirlpoolLiquidityDecreased|RaydiumClmmIncreaseLiquidity|RaydiumClmmDecreaseLiquidity)\|/.test(base) || count === ixOccurrenceCounts.get(base))
|
|
451
|
+
continue;
|
|
452
|
+
const prefix = `${base.replace(/^PumpFun\|/, 'PumpFunTrade|')}|`;
|
|
453
|
+
for (let occurrence = 0; occurrence < count; occurrence++)
|
|
454
|
+
indexByKey.delete(`${prefix}${occurrence}`);
|
|
455
|
+
}
|
|
456
|
+
for (const [i, ev] of instructionEvents.entries()) {
|
|
457
|
+
const key = instructionKeys[i];
|
|
413
458
|
if (!key) {
|
|
414
459
|
out.push(ev);
|
|
415
460
|
continue;
|
|
@@ -422,5 +467,28 @@ function dedupeLogInstructionEvents(logEvents, instructionEvents) {
|
|
|
422
467
|
}
|
|
423
468
|
mergeGrpcInstructionIntoLog(out[existing], ev);
|
|
424
469
|
}
|
|
425
|
-
return out;
|
|
470
|
+
return preferCurrentDbcEvents(out);
|
|
471
|
+
}
|
|
472
|
+
// Old and current DBC events can describe the same execution. Keep occurrence counts.
|
|
473
|
+
function preferCurrentDbcEvents(events) {
|
|
474
|
+
const groups = new Map();
|
|
475
|
+
for (const [i, event] of events.entries()) {
|
|
476
|
+
if (!('MeteoraDbcSwap' in event))
|
|
477
|
+
continue;
|
|
478
|
+
const e = event.MeteoraDbcSwap;
|
|
479
|
+
const key = [e.pool, e.config, e.trade_direction, e.amount_in, e.output_amount, e.next_sqrt_price, e.trading_fee, e.protocol_fee, e.referral_fee, e.current_timestamp].join('|');
|
|
480
|
+
let group = groups.get(key);
|
|
481
|
+
if (!group) {
|
|
482
|
+
group = [[], []];
|
|
483
|
+
groups.set(key, group);
|
|
484
|
+
}
|
|
485
|
+
group[e.event_version === 2 ? 1 : 0].push(i);
|
|
486
|
+
}
|
|
487
|
+
const removed = new Set();
|
|
488
|
+
for (const [old, current] of groups.values()) {
|
|
489
|
+
if (old.length !== current.length)
|
|
490
|
+
continue;
|
|
491
|
+
old.forEach((index, i) => { events[index] = events[current[i]]; removed.add(current[i]); });
|
|
492
|
+
}
|
|
493
|
+
return removed.size ? events.filter((_, i) => !removed.has(i)) : events;
|
|
426
494
|
}
|
|
@@ -6,11 +6,16 @@ export declare class OrderDispatcher {
|
|
|
6
6
|
private readonly microBatchUs;
|
|
7
7
|
private readonly slots;
|
|
8
8
|
private readonly streamingWatermarks;
|
|
9
|
+
private readonly streamingPending;
|
|
9
10
|
private microBatch;
|
|
10
11
|
private microBatchStartUs;
|
|
11
12
|
private lastFlushMs;
|
|
12
13
|
private currentSlot;
|
|
13
14
|
private seq;
|
|
15
|
+
private orderedWatermark;
|
|
16
|
+
private orderedLateDrops;
|
|
17
|
+
/** Each rejected late transaction marks an Ordered continuity break. */
|
|
18
|
+
get orderedLateTransactions(): number;
|
|
14
19
|
constructor(config: ClientConfig);
|
|
15
20
|
get needsTimer(): boolean;
|
|
16
21
|
pushTransactionEvents(events: DexEvent[], fallbackSlot: number | bigint | string, fallbackTxIndex: number | bigint | string, emit: (event: DexEvent) => void): void;
|