sol-parser-sdk 0.5.14 → 0.5.16
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/NATIVE_ALIGNMENT.md +312 -0
- package/NATIVE_DAMM_FACTORY_ALIGNMENT_20261004.md +16 -0
- package/NATIVE_DAMM_FACTORY_EVIDENCE_20261004.json +55 -0
- package/NATIVE_MIGRATION.md +38 -0
- package/NATIVE_PUMPFUN_NATIVE_DEBIT_ALIGNMENT_20261004.md +18 -0
- package/NATIVE_PUMPFUN_NATIVE_DEBIT_EVIDENCE_20261004.json +57 -0
- package/NATIVE_PUMPFUN_SETTLEMENT_ALIGNMENT_20261004.md +11 -0
- package/NATIVE_PUMPFUN_SETTLEMENT_EVIDENCE_20261004.json +70 -0
- package/README.md +24 -1
- package/README_CN.md +21 -1
- package/dist/accounts/mod.js +7 -0
- package/dist/accounts/pumpfun.js +17 -0
- package/dist/accounts/pumpswap.js +18 -3
- package/dist/core/account_dispatcher_rpc.js +24 -4
- 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.js +12 -2
- package/dist/core/account_fill_raydium_launchlab.js +54 -0
- package/dist/core/clock.js +1 -1
- 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 +157 -0
- package/dist/core/metadata.d.ts +9 -5
- package/dist/core/metadata.js +28 -4
- package/dist/core/unified_parser.d.ts +7 -7
- package/dist/grpc/block_meta.d.ts +9 -0
- package/dist/grpc/block_meta.js +26 -0
- package/dist/grpc/client.d.ts +24 -9
- package/dist/grpc/client.js +129 -67
- package/dist/grpc/geyser_connect.d.ts +3 -3
- package/dist/grpc/geyser_connect.js +13 -15
- package/dist/grpc/log_instr_dedup.js +6 -0
- package/dist/grpc/native_client.d.ts +26 -0
- package/dist/grpc/native_client.js +101 -0
- package/dist/grpc/order_buffer.d.ts +1 -1
- package/dist/grpc/order_buffer.js +10 -9
- package/dist/grpc/program_ids.js +2 -0
- package/dist/grpc/protocol/LICENSE +202 -0
- package/dist/grpc/protocol/NOTICE +4 -0
- package/dist/grpc/protocol/geyser.d.ts +342 -0
- package/dist/grpc/protocol/geyser.js +37 -0
- package/dist/grpc/protocol/geyser.proto +326 -0
- package/dist/grpc/protocol/solana-storage.d.ts +139 -0
- package/dist/grpc/protocol/solana-storage.js +14 -0
- package/dist/grpc/protocol/solana-storage.proto +151 -0
- package/dist/grpc/rpc_to_grpc.d.ts +1 -1
- package/dist/grpc/subscribe_builder.d.ts +5 -3
- package/dist/grpc/subscribe_builder.js +11 -3
- package/dist/grpc/transaction_meta.d.ts +1 -1
- package/dist/grpc/types.d.ts +8 -8
- package/dist/grpc/types.js +15 -2
- package/dist/grpc/yellowstone_parse.d.ts +3 -3
- package/dist/grpc/yellowstone_parse.js +6 -8
- package/dist/grpc/yellowstone_transaction_adapter.d.ts +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +23 -5
- package/dist/instr/inner.d.ts +2 -2
- package/dist/instr/inner.js +1 -1
- package/dist/instr/meteora_damm_ix.d.ts +1 -1
- package/dist/instr/meteora_damm_ix.js +41 -79
- package/dist/instr/meteora_dlmm_ix.d.ts +1 -1
- package/dist/instr/meteora_dlmm_ix.js +10 -0
- package/dist/instr/meteora_pools_ix.d.ts +1 -1
- package/dist/instr/mod.d.ts +1 -1
- package/dist/instr/orca_whirlpool_ix.d.ts +1 -1
- package/dist/instr/pump_fees_ix.d.ts +1 -1
- package/dist/instr/pumpfun_ix.d.ts +1 -1
- package/dist/instr/pumpfun_ix.js +16 -0
- package/dist/instr/pumpswap_ix.d.ts +1 -1
- package/dist/instr/pumpswap_ix.js +13 -5
- package/dist/instr/raydium_amm_v4_ix.d.ts +1 -1
- package/dist/instr/raydium_amm_v4_ix.js +9 -5
- package/dist/instr/raydium_clmm_ix.d.ts +1 -1
- package/dist/instr/raydium_cpmm_ix.d.ts +1 -1
- package/dist/instr/raydium_launchlab_ix.d.ts +1 -1
- package/dist/instr/raydium_launchlab_ix.js +62 -2
- package/dist/instr/utils.d.ts +2 -2
- package/dist/instr/utils.js +2 -7
- package/dist/liquidity_snapshot.d.ts +54 -0
- package/dist/liquidity_snapshot.js +85 -0
- package/dist/logs/meteora_damm.d.ts +17 -1
- package/dist/logs/meteora_damm.js +386 -12
- package/dist/logs/meteora_dlmm.d.ts +1 -1
- package/dist/logs/meteora_dlmm.js +10 -0
- package/dist/logs/optimized_matcher.d.ts +3 -3
- 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/dist/logs/raydium_launchlab.js +19 -1
- package/dist/rpc_transaction.d.ts +4 -3
- package/dist/rpc_transaction.js +3 -2
- package/dist/shredstream/client.js +3 -7
- package/dist/shredstream/entries_decode.js +9 -85
- package/dist/shredstream/instruction_parse.d.ts +3 -3
- package/dist/shredstream/proto_types.d.ts +1 -1
- package/dist/shredstream/wire_to_shred_tx.d.ts +1 -1
- package/dist/shredstream/wire_to_shred_tx.js +9 -44
- package/dist/simulation_route.d.ts +6 -0
- package/dist/simulation_route.js +242 -0
- package/dist/stonkfun_registry.d.ts +30 -0
- package/dist/stonkfun_registry.js +137 -0
- package/dist/transaction_route.d.ts +84 -0
- package/dist/transaction_route.js +477 -0
- package/dist/wire_transaction.d.ts +35 -0
- package/dist/wire_transaction.js +191 -0
- package/package.json +7 -4
package/dist/core/dex_event.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import type { RawAccountSnapshotEvent, LiquidityAccountSnapshotEvent } from '../liquidity_snapshot.js';
|
|
1
2
|
import type { EventMetadata } from "./metadata.js";
|
|
2
3
|
/** 统一 DEX 事件:外部标签 JSON(单键对象);键名清单见 `scripts/dex-event-variant-names.json` */
|
|
3
4
|
export type DexEvent = {
|
|
5
|
+
RawAccountSnapshot: RawAccountSnapshotEvent;
|
|
6
|
+
} | {
|
|
7
|
+
LiquidityAccountSnapshot: LiquidityAccountSnapshotEvent;
|
|
8
|
+
} | {
|
|
4
9
|
PumpFunCreate: PumpFunCreateTokenEvent;
|
|
5
10
|
} | {
|
|
6
11
|
PumpFunCreateV2: PumpFunCreateV2TokenEvent;
|
|
@@ -130,6 +135,14 @@ export type DexEvent = {
|
|
|
130
135
|
MeteoraDammV2InitializePool: MeteoraDammV2InitializePoolEvent;
|
|
131
136
|
} | {
|
|
132
137
|
MeteoraDammV2ClosePosition: MeteoraDammV2ClosePositionEvent;
|
|
138
|
+
} | {
|
|
139
|
+
MeteoraDammV2UpdateDelegatePermission: MeteoraDammV2UpdateDelegatePermissionEvent;
|
|
140
|
+
} | {
|
|
141
|
+
MeteoraDammV2WithdrawDeadLiquidityReward: MeteoraDammV2WithdrawDeadLiquidityRewardEvent;
|
|
142
|
+
} | {
|
|
143
|
+
MeteoraDammV2CreateConfig: MeteoraDammV2CreateConfigEvent;
|
|
144
|
+
} | {
|
|
145
|
+
MeteoraDammV2CreateDynamicConfig: MeteoraDammV2CreateDynamicConfigEvent;
|
|
133
146
|
} | {
|
|
134
147
|
MeteoraDbcSwap: MeteoraDbcSwapEvent;
|
|
135
148
|
} | {
|
|
@@ -226,6 +239,8 @@ export interface PumpFunCreateTokenEvent {
|
|
|
226
239
|
quote_vault: string;
|
|
227
240
|
quote_token_program: string;
|
|
228
241
|
virtual_quote_reserves: bigint;
|
|
242
|
+
creator_fee_bps: bigint;
|
|
243
|
+
is_holder_reward: boolean;
|
|
229
244
|
ix_name: string;
|
|
230
245
|
}
|
|
231
246
|
export interface PumpFunCreateV2TokenEvent extends PumpFunCreateTokenEvent {
|
|
@@ -278,6 +293,8 @@ export interface PumpFunTradeEvent {
|
|
|
278
293
|
quote_amount?: bigint;
|
|
279
294
|
virtual_quote_reserves?: bigint;
|
|
280
295
|
real_quote_reserves?: bigint;
|
|
296
|
+
holder_rewards_bps: bigint;
|
|
297
|
+
holder_rewards: bigint;
|
|
281
298
|
is_cashback_coin: boolean;
|
|
282
299
|
amount?: bigint;
|
|
283
300
|
max_sol_cost?: bigint;
|
|
@@ -285,6 +302,12 @@ export interface PumpFunTradeEvent {
|
|
|
285
302
|
spendable_sol_in?: bigint;
|
|
286
303
|
spendable_quote_in?: bigint;
|
|
287
304
|
min_tokens_out?: bigint;
|
|
305
|
+
/** User base-mint token balance before tx; absent when meta unavailable (e.g. ShredStream). */
|
|
306
|
+
pre_token_balance?: bigint | null;
|
|
307
|
+
post_token_balance?: bigint | null;
|
|
308
|
+
/** User native SOL lamports before/after tx. */
|
|
309
|
+
pre_sol_balance?: bigint | null;
|
|
310
|
+
post_sol_balance?: bigint | null;
|
|
288
311
|
global?: string;
|
|
289
312
|
bonding_curve: string;
|
|
290
313
|
bonding_curve_v2?: string;
|
|
@@ -485,6 +508,8 @@ export interface PumpSwapBuyEvent {
|
|
|
485
508
|
virtual_quote_reserves: bigint;
|
|
486
509
|
can_boost: boolean;
|
|
487
510
|
base_supply: bigint;
|
|
511
|
+
holder_rewards_bps: bigint;
|
|
512
|
+
holder_rewards: bigint;
|
|
488
513
|
/** 由 fees 指令数据填充(见 `fillDataRpc`) */
|
|
489
514
|
is_pump_pool: boolean;
|
|
490
515
|
/** 自指令账户填充(account_fillers/pumpswap) */
|
|
@@ -532,6 +557,8 @@ export interface PumpSwapSellEvent {
|
|
|
532
557
|
virtual_quote_reserves: bigint;
|
|
533
558
|
can_boost: boolean;
|
|
534
559
|
base_supply: bigint;
|
|
560
|
+
holder_rewards_bps: bigint;
|
|
561
|
+
holder_rewards: bigint;
|
|
535
562
|
is_pump_pool: boolean;
|
|
536
563
|
base_mint: string;
|
|
537
564
|
quote_mint: string;
|
|
@@ -568,6 +595,10 @@ export interface PumpSwapCreatePoolEvent {
|
|
|
568
595
|
user_quote_token_account: string;
|
|
569
596
|
coin_creator: string;
|
|
570
597
|
is_mayhem_mode: boolean;
|
|
598
|
+
is_cashback_coin: boolean;
|
|
599
|
+
creator_fee_bps: bigint;
|
|
600
|
+
can_edit_creator_fee: boolean;
|
|
601
|
+
is_holder_reward: boolean;
|
|
571
602
|
}
|
|
572
603
|
export interface PumpSwapLiquidityAdded {
|
|
573
604
|
metadata: EventMetadata;
|
|
@@ -1060,6 +1091,19 @@ export interface MeteoraDammV2SwapEvent {
|
|
|
1060
1091
|
referral_fee: bigint;
|
|
1061
1092
|
actual_amount_in: bigint;
|
|
1062
1093
|
current_timestamp: bigint;
|
|
1094
|
+
collect_fee_mode?: number;
|
|
1095
|
+
amount_0?: bigint;
|
|
1096
|
+
amount_1?: bigint;
|
|
1097
|
+
swap_mode?: number;
|
|
1098
|
+
excluded_fee_input_amount?: bigint;
|
|
1099
|
+
amount_left?: bigint;
|
|
1100
|
+
claiming_fee?: bigint;
|
|
1101
|
+
compounding_fee?: bigint;
|
|
1102
|
+
included_transfer_fee_amount_in?: bigint;
|
|
1103
|
+
included_transfer_fee_amount_out?: bigint;
|
|
1104
|
+
excluded_transfer_fee_amount_out?: bigint;
|
|
1105
|
+
reserve_a_amount?: bigint;
|
|
1106
|
+
reserve_b_amount?: bigint;
|
|
1063
1107
|
token_a_vault: string;
|
|
1064
1108
|
token_b_vault: string;
|
|
1065
1109
|
token_a_mint: string;
|
|
@@ -1080,6 +1124,8 @@ export interface MeteoraDammV2AddLiquidityEvent {
|
|
|
1080
1124
|
token_b_amount_threshold: bigint;
|
|
1081
1125
|
total_amount_a: bigint;
|
|
1082
1126
|
total_amount_b: bigint;
|
|
1127
|
+
reserve_a_amount?: bigint;
|
|
1128
|
+
reserve_b_amount?: bigint;
|
|
1083
1129
|
}
|
|
1084
1130
|
/** 与 `MeteoraDammV2RemoveLiquidityEvent` 对齐;Go/Python 中 `liquidity_delta` 为十进制字符串。 */
|
|
1085
1131
|
export interface MeteoraDammV2RemoveLiquidityEvent {
|
|
@@ -1092,6 +1138,10 @@ export interface MeteoraDammV2RemoveLiquidityEvent {
|
|
|
1092
1138
|
liquidity_delta: bigint;
|
|
1093
1139
|
token_a_amount_threshold: bigint;
|
|
1094
1140
|
token_b_amount_threshold: bigint;
|
|
1141
|
+
total_amount_a?: bigint;
|
|
1142
|
+
total_amount_b?: bigint;
|
|
1143
|
+
reserve_a_amount?: bigint;
|
|
1144
|
+
reserve_b_amount?: bigint;
|
|
1095
1145
|
}
|
|
1096
1146
|
/** 与 `MeteoraDammV2CreatePositionEvent` 对齐 */
|
|
1097
1147
|
export interface MeteoraDammV2CreatePositionEvent {
|
|
@@ -1135,6 +1185,56 @@ export interface MeteoraDammV2ClosePositionEvent {
|
|
|
1135
1185
|
position: string;
|
|
1136
1186
|
position_nft_mint: string;
|
|
1137
1187
|
}
|
|
1188
|
+
/** Nested dynamic fee parameters from DAMM v2 `PoolFeeParameters`. */
|
|
1189
|
+
export interface MeteoraDammV2DynamicFeeParameters {
|
|
1190
|
+
bin_step: number;
|
|
1191
|
+
bin_step_u128: bigint;
|
|
1192
|
+
filter_period: number;
|
|
1193
|
+
decay_period: number;
|
|
1194
|
+
reduction_factor: number;
|
|
1195
|
+
max_volatility_accumulator: number;
|
|
1196
|
+
variable_fee_control: number;
|
|
1197
|
+
}
|
|
1198
|
+
/** IDL `EvtUpdateDelegatePermission` */
|
|
1199
|
+
export interface MeteoraDammV2UpdateDelegatePermissionEvent {
|
|
1200
|
+
metadata: EventMetadata;
|
|
1201
|
+
position: string;
|
|
1202
|
+
owner: string;
|
|
1203
|
+
permission: number;
|
|
1204
|
+
delegate: string | null;
|
|
1205
|
+
}
|
|
1206
|
+
/** IDL `EvtWithdrawDeadLiquidityReward` */
|
|
1207
|
+
export interface MeteoraDammV2WithdrawDeadLiquidityRewardEvent {
|
|
1208
|
+
metadata: EventMetadata;
|
|
1209
|
+
pool: string;
|
|
1210
|
+
reward_mint: string;
|
|
1211
|
+
amount: bigint;
|
|
1212
|
+
}
|
|
1213
|
+
/** IDL `EvtCreateConfig` (includes DAMM v2 0.2.4 `permission`) */
|
|
1214
|
+
export interface MeteoraDammV2CreateConfigEvent {
|
|
1215
|
+
metadata: EventMetadata;
|
|
1216
|
+
base_fee_data: Uint8Array | number[];
|
|
1217
|
+
compounding_fee_bps: number;
|
|
1218
|
+
padding: number;
|
|
1219
|
+
dynamic_fee: MeteoraDammV2DynamicFeeParameters | null;
|
|
1220
|
+
vault_config_key: string;
|
|
1221
|
+
pool_creator_authority: string;
|
|
1222
|
+
activation_type: number;
|
|
1223
|
+
sqrt_min_price: bigint;
|
|
1224
|
+
sqrt_max_price: bigint;
|
|
1225
|
+
collect_fee_mode: number;
|
|
1226
|
+
index: bigint;
|
|
1227
|
+
config: string;
|
|
1228
|
+
permission: bigint;
|
|
1229
|
+
}
|
|
1230
|
+
/** IDL `EvtCreateDynamicConfig` */
|
|
1231
|
+
export interface MeteoraDammV2CreateDynamicConfigEvent {
|
|
1232
|
+
metadata: EventMetadata;
|
|
1233
|
+
config: string;
|
|
1234
|
+
pool_creator_authority: string;
|
|
1235
|
+
index: bigint;
|
|
1236
|
+
permission: bigint;
|
|
1237
|
+
}
|
|
1138
1238
|
export interface MeteoraDbcSwapEvent {
|
|
1139
1239
|
metadata: EventMetadata;
|
|
1140
1240
|
pool: string;
|
|
@@ -1170,6 +1270,13 @@ export interface MeteoraDbcCurveCompleteEvent {
|
|
|
1170
1270
|
/** Meteora DLMM Swap:`fee_bps` 在 Go/Python 为十进制字符串。 */
|
|
1171
1271
|
export interface MeteoraDlmmSwapEvent {
|
|
1172
1272
|
metadata: EventMetadata;
|
|
1273
|
+
/** Account-fill / instruction context; empty string default when absent. */
|
|
1274
|
+
token_x_mint?: string;
|
|
1275
|
+
token_y_mint?: string;
|
|
1276
|
+
user_token_in?: string;
|
|
1277
|
+
user_token_out?: string;
|
|
1278
|
+
/** Exact-in min out; 0 when instruction context absent. */
|
|
1279
|
+
min_amount_out?: bigint;
|
|
1173
1280
|
pool: string;
|
|
1174
1281
|
from: string;
|
|
1175
1282
|
start_bin_id: number;
|
|
@@ -1251,6 +1358,31 @@ export interface RaydiumLaunchlabTradeEvent {
|
|
|
1251
1358
|
is_buy: boolean;
|
|
1252
1359
|
trade_direction: TradeDirection;
|
|
1253
1360
|
exact_in: boolean;
|
|
1361
|
+
total_base_sell?: bigint;
|
|
1362
|
+
virtual_base?: bigint;
|
|
1363
|
+
virtual_quote?: bigint;
|
|
1364
|
+
real_base_before?: bigint;
|
|
1365
|
+
real_quote_before?: bigint;
|
|
1366
|
+
real_base_after?: bigint;
|
|
1367
|
+
real_quote_after?: bigint;
|
|
1368
|
+
protocol_fee?: bigint;
|
|
1369
|
+
platform_fee?: bigint;
|
|
1370
|
+
creator_fee?: bigint;
|
|
1371
|
+
share_fee?: bigint;
|
|
1372
|
+
pool_status?: "Fund" | "Migrate" | "Trade";
|
|
1373
|
+
system_program?: string;
|
|
1374
|
+
platform_associated_account?: string;
|
|
1375
|
+
creator_associated_account?: string;
|
|
1376
|
+
global_config?: string;
|
|
1377
|
+
platform_config?: string;
|
|
1378
|
+
user_base_token?: string;
|
|
1379
|
+
user_quote_token?: string;
|
|
1380
|
+
base_vault?: string;
|
|
1381
|
+
quote_vault?: string;
|
|
1382
|
+
base_mint?: string;
|
|
1383
|
+
quote_mint?: string;
|
|
1384
|
+
base_token_program?: string;
|
|
1385
|
+
quote_token_program?: string;
|
|
1254
1386
|
}
|
|
1255
1387
|
export interface BaseMintParam {
|
|
1256
1388
|
symbol: string;
|
|
@@ -1263,6 +1395,15 @@ export interface RaydiumLaunchlabPoolCreateEvent {
|
|
|
1263
1395
|
base_mint_param: BaseMintParam;
|
|
1264
1396
|
pool_state: string;
|
|
1265
1397
|
creator: string;
|
|
1398
|
+
payer?: string;
|
|
1399
|
+
global_config?: string;
|
|
1400
|
+
platform_config?: string;
|
|
1401
|
+
base_mint?: string;
|
|
1402
|
+
quote_mint?: string;
|
|
1403
|
+
base_vault?: string;
|
|
1404
|
+
quote_vault?: string;
|
|
1405
|
+
base_token_program?: string;
|
|
1406
|
+
quote_token_program?: string;
|
|
1266
1407
|
}
|
|
1267
1408
|
export interface RaydiumLaunchlabMigrateAmmEvent {
|
|
1268
1409
|
metadata: EventMetadata;
|
|
@@ -1270,6 +1411,11 @@ export interface RaydiumLaunchlabMigrateAmmEvent {
|
|
|
1270
1411
|
new_pool: string;
|
|
1271
1412
|
user: string;
|
|
1272
1413
|
liquidity_amount: bigint;
|
|
1414
|
+
liquidity_amount_known?: boolean;
|
|
1415
|
+
base_mint?: string;
|
|
1416
|
+
quote_mint?: string;
|
|
1417
|
+
platform_config?: string;
|
|
1418
|
+
destination_program?: string;
|
|
1273
1419
|
}
|
|
1274
1420
|
export interface TokenInfoEvent {
|
|
1275
1421
|
metadata: EventMetadata;
|
|
@@ -1344,6 +1490,9 @@ export interface PumpFunBondingCurve {
|
|
|
1344
1490
|
is_mayhem_mode: boolean;
|
|
1345
1491
|
is_cashback_coin: boolean;
|
|
1346
1492
|
quote_mint: string;
|
|
1493
|
+
creator_fee_bps: bigint;
|
|
1494
|
+
can_edit_creator_fee: boolean;
|
|
1495
|
+
is_holder_reward: boolean;
|
|
1347
1496
|
}
|
|
1348
1497
|
export interface PumpFunBondingCurveAccountEvent {
|
|
1349
1498
|
metadata: EventMetadata;
|
|
@@ -1443,6 +1592,9 @@ export interface PumpSwapPool {
|
|
|
1443
1592
|
is_mayhem_mode: boolean;
|
|
1444
1593
|
is_cashback_coin: boolean;
|
|
1445
1594
|
virtual_quote_reserves: bigint;
|
|
1595
|
+
creator_fee_bps: bigint;
|
|
1596
|
+
can_edit_creator_fee: boolean;
|
|
1597
|
+
is_holder_reward: boolean;
|
|
1446
1598
|
}
|
|
1447
1599
|
export interface PumpSwapPoolAccountEvent {
|
|
1448
1600
|
metadata: EventMetadata;
|
|
@@ -1713,3 +1865,8 @@ export interface BlockMetaEvent {
|
|
|
1713
1865
|
}
|
|
1714
1866
|
export declare function metadataForDexEvent(ev: DexEvent): EventMetadata | null;
|
|
1715
1867
|
export declare function defaultPubkey(): string;
|
|
1868
|
+
/** Rust platform aliases share the existing LaunchLab event shape. */
|
|
1869
|
+
export type LaunchLabPoolCreateEvent = RaydiumLaunchlabPoolCreateEvent;
|
|
1870
|
+
export type StonkFunPoolCreateEvent = RaydiumLaunchlabPoolCreateEvent;
|
|
1871
|
+
export type LaunchLabTradeEvent = RaydiumLaunchlabTradeEvent;
|
|
1872
|
+
export type StonkFunTradeEvent = RaydiumLaunchlabTradeEvent;
|
package/dist/core/metadata.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** 事件元数据(signature 为 Base58 字符串) */
|
|
2
2
|
export interface EventMetadata {
|
|
3
3
|
signature: string;
|
|
4
|
-
slot:
|
|
4
|
+
slot: bigint;
|
|
5
5
|
/** gRPC:与 Yellowstone `SubscribeUpdateTransactionInfo.index` 一致(Rust `info.index`)。Shred 等其它路径含义见各实现说明。 */
|
|
6
|
-
tx_index:
|
|
7
|
-
block_time_us:
|
|
8
|
-
grpc_recv_us:
|
|
6
|
+
tx_index: bigint;
|
|
7
|
+
block_time_us: bigint;
|
|
8
|
+
grpc_recv_us: bigint;
|
|
9
9
|
/** Time waiting in the local pre-parser queue, measured with a monotonic clock. */
|
|
10
10
|
local_queue_latency_us?: number;
|
|
11
11
|
/** Pure local adapter + parser duration. No network or RPC calls are included. */
|
|
@@ -16,4 +16,8 @@ export interface EventMetadata {
|
|
|
16
16
|
source_to_grpc_latency_us?: number;
|
|
17
17
|
recent_blockhash?: string;
|
|
18
18
|
}
|
|
19
|
-
export declare function makeMetadata(signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, recentBlockhash?: string): EventMetadata;
|
|
19
|
+
export declare function makeMetadata(signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, recentBlockhash?: string): EventMetadata;
|
|
20
|
+
export type ExactIntegerInput = bigint | string | number;
|
|
21
|
+
export declare function exactInteger(value: ExactIntegerInput, label?: string): bigint;
|
|
22
|
+
export declare function exactU64(value: ExactIntegerInput, label?: string): bigint;
|
|
23
|
+
export declare function exactI64(value: ExactIntegerInput, label?: string): bigint;
|
package/dist/core/metadata.js
CHANGED
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeMetadata = makeMetadata;
|
|
4
|
+
exports.exactInteger = exactInteger;
|
|
5
|
+
exports.exactU64 = exactU64;
|
|
6
|
+
exports.exactI64 = exactI64;
|
|
4
7
|
function makeMetadata(signature, slot, txIndex, blockTimeUs, grpcRecvUs, recentBlockhash) {
|
|
5
8
|
return {
|
|
6
9
|
signature,
|
|
7
|
-
slot,
|
|
8
|
-
tx_index: txIndex,
|
|
9
|
-
block_time_us: blockTimeUs ?? 0,
|
|
10
|
-
grpc_recv_us: grpcRecvUs,
|
|
10
|
+
slot: exactU64(slot, "slot"),
|
|
11
|
+
tx_index: exactU64(txIndex, "tx_index"),
|
|
12
|
+
block_time_us: exactI64(blockTimeUs ?? 0, "block_time_us"),
|
|
13
|
+
grpc_recv_us: exactI64(grpcRecvUs, "grpc_recv_us"),
|
|
11
14
|
recent_blockhash: recentBlockhash,
|
|
12
15
|
};
|
|
13
16
|
}
|
|
17
|
+
function exactInteger(value, label = "integer") {
|
|
18
|
+
if (typeof value === "number" && !Number.isSafeInteger(value))
|
|
19
|
+
throw new RangeError(`Unsafe ${label} integer`);
|
|
20
|
+
if (typeof value === "string" && !/^-?\d+$/.test(value))
|
|
21
|
+
throw new TypeError(`Invalid ${label} integer`);
|
|
22
|
+
if (!["bigint", "number", "string"].includes(typeof value))
|
|
23
|
+
throw new TypeError(`Invalid ${label} type`);
|
|
24
|
+
return BigInt(value);
|
|
25
|
+
}
|
|
26
|
+
function exactU64(value, label = "u64") {
|
|
27
|
+
const n = exactInteger(value, label);
|
|
28
|
+
if (n < 0n || n > (1n << 64n) - 1n)
|
|
29
|
+
throw new RangeError(`${label} outside u64`);
|
|
30
|
+
return n;
|
|
31
|
+
}
|
|
32
|
+
function exactI64(value, label = "i64") {
|
|
33
|
+
const n = exactInteger(value, label);
|
|
34
|
+
if (n < -(1n << 63n) || n > (1n << 63n) - 1n)
|
|
35
|
+
throw new RangeError(`${label} outside i64`);
|
|
36
|
+
return n;
|
|
37
|
+
}
|
|
@@ -8,12 +8,12 @@ export type StreamingEventListener = {
|
|
|
8
8
|
onDexEventStreaming: (event: DexEvent) => void;
|
|
9
9
|
};
|
|
10
10
|
/** 从交易解析事件;当前主路径为日志解析 */
|
|
11
|
-
export declare function parseTransactionEvents(_instructionData: Uint8Array, _accounts: string[], logs: string[], signature: string, slot: number, _txIndex: number, blockTimeUs: number | undefined, _programId: string): DexEvent[];
|
|
12
|
-
export declare function parseLogsOnly(logs: string[], signature: string, slot: number, blockTimeUs: number | undefined, txIndex?: number): DexEvent[];
|
|
13
|
-
export declare function parseTransactionWithListener(instructionData: Uint8Array, accounts: string[], logs: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, programId: string, listener: EventListener): void;
|
|
14
|
-
export declare function parseTransactionEventsStreaming(_instructionData: Uint8Array, _accounts: string[], logs: string[], signature: string, slot: number, _txIndex: number, blockTimeUs: number | undefined, _programId: string, callback: (event: DexEvent) => void): void;
|
|
15
|
-
export declare function parseLogsStreaming(logs: string[], signature: string, slot: number, blockTimeUs: number | undefined, callback: (event: DexEvent) => void, txIndex?: number): void;
|
|
16
|
-
export declare function parseTransactionWithStreamingListener(instructionData: Uint8Array, accounts: string[], logs: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, programId: string, listener: StreamingEventListener): void;
|
|
11
|
+
export declare function parseTransactionEvents(_instructionData: Uint8Array, _accounts: string[], logs: string[], signature: string, slot: number | bigint | string, _txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, _programId: string): DexEvent[];
|
|
12
|
+
export declare function parseLogsOnly(logs: string[], signature: string, slot: number | bigint | string, blockTimeUs: number | bigint | string | undefined, txIndex?: number | bigint | string): DexEvent[];
|
|
13
|
+
export declare function parseTransactionWithListener(instructionData: Uint8Array, accounts: string[], logs: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, programId: string, listener: EventListener): void;
|
|
14
|
+
export declare function parseTransactionEventsStreaming(_instructionData: Uint8Array, _accounts: string[], logs: string[], signature: string, slot: number | bigint | string, _txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, _programId: string, callback: (event: DexEvent) => void): void;
|
|
15
|
+
export declare function parseLogsStreaming(logs: string[], signature: string, slot: number | bigint | string, blockTimeUs: number | bigint | string | undefined, callback: (event: DexEvent) => void, txIndex?: number | bigint | string): void;
|
|
16
|
+
export declare function parseTransactionWithStreamingListener(instructionData: Uint8Array, accounts: string[], logs: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, programId: string, listener: StreamingEventListener): void;
|
|
17
17
|
/** 带完整 gRPC 元数据字段的日志解析 */
|
|
18
|
-
export declare function parseLog(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, eventTypeFilter: EventTypeFilter | undefined, isCreatedBuy: boolean, recentBlockhash?: Uint8Array): DexEvent | null;
|
|
18
|
+
export declare function parseLog(log: string, signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, eventTypeFilter: EventTypeFilter | undefined, isCreatedBuy: boolean, recentBlockhash?: Uint8Array): DexEvent | null;
|
|
19
19
|
export { nowUs };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Local BlockMeta adapter; never fetches a block or blockhash. */
|
|
2
|
+
import type { DexEvent } from "../core/dex_event.js";
|
|
3
|
+
export declare function parseBlockMetaUpdate(meta: {
|
|
4
|
+
slot: string | number | bigint;
|
|
5
|
+
blockhash: string;
|
|
6
|
+
blockTime?: {
|
|
7
|
+
timestamp: string | number | bigint;
|
|
8
|
+
};
|
|
9
|
+
}, grpcRecvUs: number | bigint | string, fallbackBlockUs?: number | bigint | string): DexEvent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseBlockMetaUpdate = parseBlockMetaUpdate;
|
|
4
|
+
const metadata_js_1 = require("../core/metadata.js");
|
|
5
|
+
function parseBlockMetaUpdate(meta, grpcRecvUs, fallbackBlockUs) {
|
|
6
|
+
const slot = (0, metadata_js_1.exactInteger)(meta.slot, "slot");
|
|
7
|
+
(0, metadata_js_1.exactU64)(slot, "slot");
|
|
8
|
+
const seconds = meta.blockTime?.timestamp;
|
|
9
|
+
let blockUs = (0, metadata_js_1.exactI64)(fallbackBlockUs ?? 0);
|
|
10
|
+
if (seconds !== undefined) {
|
|
11
|
+
const v = (0, metadata_js_1.exactInteger)(seconds, "timestamp") * 1000000n, lo = -(1n << 63n), hi = (1n << 63n) - 1n;
|
|
12
|
+
blockUs = v < lo ? lo : v > hi ? hi : v;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
BlockMeta: {
|
|
16
|
+
metadata: {
|
|
17
|
+
signature: "1".repeat(64),
|
|
18
|
+
slot,
|
|
19
|
+
tx_index: 0n,
|
|
20
|
+
block_time_us: blockUs,
|
|
21
|
+
grpc_recv_us: (0, metadata_js_1.exactI64)(grpcRecvUs),
|
|
22
|
+
recent_blockhash: meta.blockhash || undefined,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
package/dist/grpc/client.d.ts
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
* Yellowstone gRPC 客户端实现 - 基于 @triton-one/yellowstone-grpc
|
|
3
|
-
*/
|
|
4
|
-
import { CommitmentLevel } from "@triton-one/yellowstone-grpc";
|
|
1
|
+
import { CommitmentLevel } from "./protocol/geyser.js";
|
|
5
2
|
import { type DexEvent } from "../core/dex_event.js";
|
|
6
3
|
import { type EventQueueOverflowStrategy } from "./async_event_queue.js";
|
|
7
4
|
import { type AccountFilter, type ClientConfig, type EventTypeFilter, type TransactionFilter, type SubscribeCallbacks } from "./types.js";
|
|
8
5
|
export { SubscribeCallbacks };
|
|
9
6
|
export type { EventQueueOverflowStrategy } from "./async_event_queue.js";
|
|
7
|
+
export interface GrpcStreamStatus {
|
|
8
|
+
readonly state: "connecting" | "connected" | "reconnecting" | "stopped";
|
|
9
|
+
readonly continuityBroken: boolean;
|
|
10
|
+
readonly reconnects: number;
|
|
11
|
+
readonly dropped: number;
|
|
12
|
+
}
|
|
10
13
|
export interface DexEventSubscription extends AsyncIterable<DexEvent> {
|
|
11
14
|
id: string;
|
|
12
15
|
errors: AsyncIterable<Error>;
|
|
16
|
+
/** Bounded transition stream; inspect status() even if notifications were dropped. */
|
|
17
|
+
states: AsyncIterable<GrpcStreamStatus>;
|
|
18
|
+
status(): GrpcStreamStatus;
|
|
13
19
|
cancel(): void;
|
|
20
|
+
/** Wait until the stream and associated workers exit. */
|
|
21
|
+
join(): Promise<void>;
|
|
14
22
|
next(): Promise<IteratorResult<DexEvent>>;
|
|
15
23
|
len(): number;
|
|
16
24
|
/** Total drops across ingress and the public event queue. */
|
|
@@ -49,6 +57,11 @@ export declare class YellowstoneGrpc {
|
|
|
49
57
|
private connectPromise?;
|
|
50
58
|
private subscribers;
|
|
51
59
|
private dexSubscribers;
|
|
60
|
+
private dexLifecycle;
|
|
61
|
+
private activeDex?;
|
|
62
|
+
private withDexLifecycle;
|
|
63
|
+
private stopDexUnlocked;
|
|
64
|
+
stop(): Promise<void>;
|
|
52
65
|
constructor(endpoint: string, xToken: string, config?: ClientConfig);
|
|
53
66
|
/** 连接到 gRPC 服务器 */
|
|
54
67
|
connect(): Promise<void>;
|
|
@@ -86,26 +99,28 @@ export declare class YellowstoneGrpc {
|
|
|
86
99
|
* 事件队列满时按配置丢弃事件,避免回调阻塞 gRPC 读循环并让丢弃可观测。
|
|
87
100
|
*/
|
|
88
101
|
subscribeDexEvents(transactionFilters?: TransactionFilter[], accountFilters?: AccountFilter[], eventTypeFilter?: EventTypeFilter, options?: SubscribeDexEventsOptions): Promise<DexEventSubscription>;
|
|
102
|
+
private startDexEvents;
|
|
89
103
|
/** 取消订阅 */
|
|
90
104
|
unsubscribe(subId: string): void;
|
|
91
105
|
/** 动态更新当前 DEX 订阅过滤器(与 Rust update_subscription 语义对齐)。 */
|
|
92
106
|
updateSubscription(transactionFilters: TransactionFilter[], accountFilters: AccountFilter[]): Promise<void>;
|
|
107
|
+
private updateDexUnlocked;
|
|
93
108
|
update_subscription(transactionFilters: TransactionFilter[], accountFilters: AccountFilter[]): Promise<void>;
|
|
94
109
|
/** 获取最新区块哈希 */
|
|
95
110
|
getLatestBlockhash(commitment?: CommitmentLevel): Promise<{
|
|
96
|
-
slot:
|
|
111
|
+
slot: bigint;
|
|
97
112
|
blockhash: string;
|
|
98
|
-
lastValidBlockHeight:
|
|
113
|
+
lastValidBlockHeight: bigint;
|
|
99
114
|
}>;
|
|
100
115
|
/** 获取区块高度 */
|
|
101
|
-
getBlockHeight(commitment?: CommitmentLevel): Promise<
|
|
116
|
+
getBlockHeight(commitment?: CommitmentLevel): Promise<bigint>;
|
|
102
117
|
/** 获取当前 Slot */
|
|
103
|
-
getSlot(commitment?: CommitmentLevel): Promise<
|
|
118
|
+
getSlot(commitment?: CommitmentLevel): Promise<bigint>;
|
|
104
119
|
/** 获取服务器版本 */
|
|
105
120
|
getVersion(): Promise<string>;
|
|
106
121
|
/** 验证区块哈希是否有效 */
|
|
107
122
|
isBlockhashValid(blockhash: string, commitment?: CommitmentLevel): Promise<{
|
|
108
|
-
slot:
|
|
123
|
+
slot: bigint;
|
|
109
124
|
valid: boolean;
|
|
110
125
|
}>;
|
|
111
126
|
/** 发送 Ping 请求 */
|