sol-parser-sdk 0.5.15 → 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 +17 -1
- package/README_CN.md +14 -1
- package/dist/accounts/mod.js +7 -0
- package/dist/core/account_dispatcher_rpc.js +24 -4
- package/dist/core/account_fill_raydium.js +12 -2
- package/dist/core/account_fill_raydium_launchlab.js +6 -0
- package/dist/core/clock.js +1 -1
- package/dist/core/dex_event.d.ts +30 -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/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 +7 -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_dlmm_ix.d.ts +1 -1
- 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/pumpswap_ix.d.ts +1 -1
- 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 +1 -1
- package/dist/logs/meteora_damm.js +4 -2
- package/dist/logs/meteora_dlmm.d.ts +1 -1
- package/dist/logs/optimized_matcher.d.ts +3 -3
- 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/instr/inner.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
2
|
import type { EventTypeFilter } from "../grpc/types.js";
|
|
3
|
-
export declare function parseInnerCompiledInstructionIfSupported(data: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, filter: EventTypeFilter | undefined, programId: string): DexEvent | null;
|
|
4
|
-
export declare function parseInnerInstructionUnified(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, filter: EventTypeFilter | undefined, programId: string, isCreatedBuy?: boolean): DexEvent | null;
|
|
3
|
+
export declare function parseInnerCompiledInstructionIfSupported(data: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, filter: EventTypeFilter | undefined, programId: string): DexEvent | null;
|
|
4
|
+
export declare function parseInnerInstructionUnified(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, filter: EventTypeFilter | undefined, programId: string, isCreatedBuy?: boolean): DexEvent | null;
|
package/dist/instr/inner.js
CHANGED
|
@@ -235,7 +235,7 @@ function normalInstructionDataMayParse(programId, data) {
|
|
|
235
235
|
if (data.length === 0)
|
|
236
236
|
return false;
|
|
237
237
|
if (programId === program_ids_js_1.RAYDIUM_AMM_V4_PROGRAM_ID)
|
|
238
|
-
return firstByteIn(data, [1, 3, 4, 7, 9, 11]);
|
|
238
|
+
return firstByteIn(data, [1, 3, 4, 7, 9, 11, 16, 17]);
|
|
239
239
|
if (programId === program_ids_js_1.METEORA_DLMM_PROGRAM_ID)
|
|
240
240
|
return headIn(data, IX.METEORA_DLMM);
|
|
241
241
|
if (programId === program_ids_js_1.METEORA_DAMM_V2_PROGRAM_ID) {
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* 2) **CPI 事件形**:前 8 字节为外层 Anchor discriminator,8..16 为 `emit!` 事件 disc,16.. 为载荷。
|
|
6
6
|
*/
|
|
7
7
|
import type { DexEvent } from "../core/dex_event.js";
|
|
8
|
-
export declare function parseMeteoraDammInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
8
|
+
export declare function parseMeteoraDammInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
|
-
export declare function parseMeteoraDlmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
2
|
+
export declare function parseMeteoraDlmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
|
-
export declare function parseMeteoraPoolsInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
2
|
+
export declare function parseMeteoraPoolsInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
package/dist/instr/mod.d.ts
CHANGED
|
@@ -15,4 +15,4 @@ export { parseOrcaWhirlpoolInstruction } from "./orca_whirlpool_ix.js";
|
|
|
15
15
|
export { parseRaydiumLaunchlabInstruction } from "./raydium_launchlab_ix.js";
|
|
16
16
|
export { parsePumpFeesInstruction } from "./pump_fees_ix.js";
|
|
17
17
|
export * from "./program_ids.js";
|
|
18
|
-
export declare function parseInstructionUnified(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, eventTypeFilter: EventTypeFilter | undefined, programId: string): DexEvent | null;
|
|
18
|
+
export declare function parseInstructionUnified(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, eventTypeFilter: EventTypeFilter | undefined, programId: string): DexEvent | null;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Whirlpool 的 `swap` / `increase_liquidity_v2` / `decrease_liquidity` 与 Raydium CLMM 同源,复用同一组 Anchor 前 8 字节。
|
|
6
6
|
*/
|
|
7
7
|
import type { DexEvent } from "../core/dex_event.js";
|
|
8
|
-
export declare function parseOrcaWhirlpoolInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
8
|
+
export declare function parseOrcaWhirlpoolInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
|
-
export declare function parsePumpFeesInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
2
|
+
export declare function parsePumpFeesInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { DexEvent } from "../core/dex_event.js";
|
|
5
5
|
export declare const PUMPFUN_SOL_QUOTE_MINT = "So11111111111111111111111111111111111111111";
|
|
6
|
-
export declare function parsePumpfunInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
6
|
+
export declare function parsePumpfunInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* PumpSwap 指令解析
|
|
3
3
|
*/
|
|
4
4
|
import type { DexEvent } from "../core/dex_event.js";
|
|
5
|
-
export declare function parsePumpswapInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs?: number): DexEvent | null;
|
|
5
|
+
export declare function parsePumpswapInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs?: number | bigint | string): DexEvent | null;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* 单字节 discriminator;Swap 账户顺序与链上 `SwapBaseIn`/`SwapBaseOut` 一致(18 个账户)。
|
|
4
4
|
*/
|
|
5
5
|
import type { DexEvent } from "../core/dex_event.js";
|
|
6
|
-
export declare function parseRaydiumAmmV4Instruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
6
|
+
export declare function parseRaydiumAmmV4Instruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -29,7 +29,9 @@ const SWAP = {
|
|
|
29
29
|
USER_DEST_TOKEN: 16,
|
|
30
30
|
USER_OWNER: 17,
|
|
31
31
|
};
|
|
32
|
-
function swapAccountIndexes(accountCount) {
|
|
32
|
+
function swapAccountIndexes(accountCount, modern) {
|
|
33
|
+
if (modern)
|
|
34
|
+
return { ...SWAP, AMM_OPEN_ORDERS: -1, AMM_TARGET_ORDERS: -1, POOL_COIN_TOKEN: 3, POOL_PC_TOKEN: 4, SERUM_PROGRAM: -1, SERUM_MARKET: -1, SERUM_BIDS: -1, SERUM_ASKS: -1, SERUM_EVENT_QUEUE: -1, SERUM_COIN_VAULT: -1, SERUM_PC_VAULT: -1, SERUM_VAULT_SIGNER: -1, USER_SOURCE_TOKEN: 5, USER_DEST_TOKEN: 6, USER_OWNER: 7 };
|
|
33
35
|
if (accountCount !== 17)
|
|
34
36
|
return SWAP;
|
|
35
37
|
return {
|
|
@@ -56,7 +58,7 @@ function swapBaseInFromIx(instructionData, accounts, meta) {
|
|
|
56
58
|
const amount_in = (0, utils_js_1.readU64LE)(instructionData, 1) ?? 0n;
|
|
57
59
|
const minimum_amount_out = (0, utils_js_1.readU64LE)(instructionData, 9) ?? 0n;
|
|
58
60
|
const g = (i) => (0, utils_js_1.getAccount)(accounts, i) ?? Z;
|
|
59
|
-
const indexes = swapAccountIndexes(accounts.length);
|
|
61
|
+
const indexes = swapAccountIndexes(accounts.length, instructionData[0] === 16 || instructionData[0] === 17);
|
|
60
62
|
return {
|
|
61
63
|
RaydiumAmmV4Swap: {
|
|
62
64
|
metadata: meta,
|
|
@@ -91,7 +93,7 @@ function swapBaseOutFromIx(instructionData, accounts, meta) {
|
|
|
91
93
|
const max_amount_in = (0, utils_js_1.readU64LE)(instructionData, 1) ?? 0n;
|
|
92
94
|
const amount_out = (0, utils_js_1.readU64LE)(instructionData, 9) ?? 0n;
|
|
93
95
|
const g = (i) => (0, utils_js_1.getAccount)(accounts, i) ?? Z;
|
|
94
|
-
const indexes = swapAccountIndexes(accounts.length);
|
|
96
|
+
const indexes = swapAccountIndexes(accounts.length, instructionData[0] === 16 || instructionData[0] === 17);
|
|
95
97
|
return {
|
|
96
98
|
RaydiumAmmV4Swap: {
|
|
97
99
|
metadata: meta,
|
|
@@ -124,11 +126,13 @@ function parseRaydiumAmmV4Instruction(instructionData, accounts, signature, slot
|
|
|
124
126
|
if (instructionData.length < 1)
|
|
125
127
|
return null;
|
|
126
128
|
const instrType = instructionData[0];
|
|
129
|
+
if ((instrType === 16 || instrType === 17) && accounts.length < 8)
|
|
130
|
+
return null;
|
|
127
131
|
const meta = (0, utils_js_1.ixMeta)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
128
|
-
if (instrType === INSTR_TYPE.SWAP_BASE_IN) {
|
|
132
|
+
if (instrType === INSTR_TYPE.SWAP_BASE_IN || instrType === 16) {
|
|
129
133
|
return swapBaseInFromIx(instructionData, accounts, meta);
|
|
130
134
|
}
|
|
131
|
-
if (instrType === INSTR_TYPE.SWAP_BASE_OUT) {
|
|
135
|
+
if (instrType === INSTR_TYPE.SWAP_BASE_OUT || instrType === 17) {
|
|
132
136
|
return swapBaseOutFromIx(instructionData, accounts, meta);
|
|
133
137
|
}
|
|
134
138
|
return null;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Raydium CLMM 指令解析(与 Orca Whirlpool 同源 Anchor 布局:swap / 增减流动性)
|
|
3
3
|
*/
|
|
4
4
|
import type { DexEvent } from "../core/dex_event.js";
|
|
5
|
-
export declare function parseRaydiumClmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
5
|
+
export declare function parseRaydiumClmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Raydium CPMM 指令解析(Anchor:8 字节 discriminator + Borsh 参数)
|
|
3
3
|
*/
|
|
4
4
|
import type { DexEvent } from "../core/dex_event.js";
|
|
5
|
-
export declare function parseRaydiumCpmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
5
|
+
export declare function parseRaydiumCpmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* 2) **Anchor 外层指令**:`global:buy` / `sell` / `create_pool` / `migrate_to_amm` 等(sha256 前 8 字节),参数多为 Borsh u64。
|
|
6
6
|
*/
|
|
7
7
|
import type { DexEvent } from "../core/dex_event.js";
|
|
8
|
-
export declare function parseRaydiumLaunchlabInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
8
|
+
export declare function parseRaydiumLaunchlabInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -51,6 +51,8 @@ function parseMintParams(payload) {
|
|
|
51
51
|
return { symbol: symbol.s, name: name.s, uri: uri.s, decimals };
|
|
52
52
|
}
|
|
53
53
|
function tradeFromTwoU64(payload, accounts, meta, isBuy, exactIn) {
|
|
54
|
+
if (payload.length < 16 || accounts.length < 5)
|
|
55
|
+
return null;
|
|
54
56
|
const first = (0, utils_js_1.readU64LE)(payload, 0) ?? 0n;
|
|
55
57
|
const second = (0, utils_js_1.readU64LE)(payload, 8) ?? 0n;
|
|
56
58
|
const amount_in = exactIn ? first : second;
|
|
@@ -66,6 +68,31 @@ function tradeFromTwoU64(payload, accounts, meta, isBuy, exactIn) {
|
|
|
66
68
|
amount_out,
|
|
67
69
|
is_buy: isBuy,
|
|
68
70
|
trade_direction: isBuy ? "Buy" : "Sell",
|
|
71
|
+
total_base_sell: 0n,
|
|
72
|
+
virtual_base: 0n,
|
|
73
|
+
virtual_quote: 0n,
|
|
74
|
+
real_base_before: 0n,
|
|
75
|
+
real_quote_before: 0n,
|
|
76
|
+
real_base_after: 0n,
|
|
77
|
+
real_quote_after: 0n,
|
|
78
|
+
protocol_fee: 0n,
|
|
79
|
+
platform_fee: 0n,
|
|
80
|
+
creator_fee: 0n,
|
|
81
|
+
share_fee: 0n,
|
|
82
|
+
pool_status: "Fund",
|
|
83
|
+
global_config: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
|
|
84
|
+
platform_config: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
|
|
85
|
+
user_base_token: (0, utils_js_1.getAccount)(accounts, 5) ?? Z,
|
|
86
|
+
user_quote_token: (0, utils_js_1.getAccount)(accounts, 6) ?? Z,
|
|
87
|
+
base_vault: (0, utils_js_1.getAccount)(accounts, 7) ?? Z,
|
|
88
|
+
quote_vault: (0, utils_js_1.getAccount)(accounts, 8) ?? Z,
|
|
89
|
+
base_mint: (0, utils_js_1.getAccount)(accounts, 9) ?? Z,
|
|
90
|
+
quote_mint: (0, utils_js_1.getAccount)(accounts, 10) ?? Z,
|
|
91
|
+
base_token_program: (0, utils_js_1.getAccount)(accounts, 11) ?? Z,
|
|
92
|
+
quote_token_program: (0, utils_js_1.getAccount)(accounts, 12) ?? Z,
|
|
93
|
+
system_program: (0, utils_js_1.getAccount)(accounts, 15) ?? Z,
|
|
94
|
+
platform_associated_account: (0, utils_js_1.getAccount)(accounts, 16) ?? Z,
|
|
95
|
+
creator_associated_account: (0, utils_js_1.getAccount)(accounts, 17) ?? Z,
|
|
69
96
|
exact_in: exactIn,
|
|
70
97
|
},
|
|
71
98
|
};
|
|
@@ -106,6 +133,8 @@ function parseRaydiumLaunchlabInstruction(instructionData, accounts, signature,
|
|
|
106
133
|
if (headEq(instructionData, ANCHOR.INITIALIZE) ||
|
|
107
134
|
headEq(instructionData, ANCHOR.INITIALIZE_V2) ||
|
|
108
135
|
headEq(instructionData, ANCHOR.INITIALIZE_WITH_TOKEN_2022)) {
|
|
136
|
+
if (accounts.length < 6)
|
|
137
|
+
return null;
|
|
109
138
|
const base_mint_param = parseMintParams(rest);
|
|
110
139
|
if (!base_mint_param)
|
|
111
140
|
return null;
|
|
@@ -115,11 +144,42 @@ function parseRaydiumLaunchlabInstruction(instructionData, accounts, signature,
|
|
|
115
144
|
base_mint_param,
|
|
116
145
|
pool_state: (0, utils_js_1.getAccount)(accounts, 5) ?? Z,
|
|
117
146
|
creator: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
|
|
147
|
+
payer: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
|
|
148
|
+
global_config: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
|
|
149
|
+
platform_config: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
|
|
150
|
+
base_mint: (0, utils_js_1.getAccount)(accounts, 6) ?? Z,
|
|
151
|
+
quote_mint: (0, utils_js_1.getAccount)(accounts, 7) ?? Z,
|
|
152
|
+
base_vault: (0, utils_js_1.getAccount)(accounts, 8) ?? Z,
|
|
153
|
+
quote_vault: (0, utils_js_1.getAccount)(accounts, 9) ?? Z,
|
|
154
|
+
base_token_program: (0, utils_js_1.getAccount)(accounts, headEq(instructionData, ANCHOR.INITIALIZE_WITH_TOKEN_2022)
|
|
155
|
+
? 10
|
|
156
|
+
: 11) ?? Z,
|
|
157
|
+
quote_token_program: (0, utils_js_1.getAccount)(accounts, headEq(instructionData, ANCHOR.INITIALIZE_WITH_TOKEN_2022)
|
|
158
|
+
? 11
|
|
159
|
+
: 12) ?? Z,
|
|
118
160
|
},
|
|
119
161
|
};
|
|
120
162
|
}
|
|
121
|
-
if (headEq(instructionData, ANCHOR.MIGRATE_TO_AMM) ||
|
|
122
|
-
|
|
163
|
+
if (headEq(instructionData, ANCHOR.MIGRATE_TO_AMM) ||
|
|
164
|
+
headEq(instructionData, ANCHOR.MIGRATE_TO_CPSWAP)) {
|
|
165
|
+
const cp = headEq(instructionData, ANCHOR.MIGRATE_TO_CPSWAP);
|
|
166
|
+
if (accounts.length < (cp ? 28 : 32) ||
|
|
167
|
+
(!cp && instructionData.length < 17))
|
|
168
|
+
return null;
|
|
169
|
+
return {
|
|
170
|
+
RaydiumLaunchlabMigrateAmm: {
|
|
171
|
+
metadata: meta,
|
|
172
|
+
old_pool: accounts[cp ? 17 : 23],
|
|
173
|
+
new_pool: accounts[cp ? 5 : 13],
|
|
174
|
+
user: accounts[0],
|
|
175
|
+
liquidity_amount: 0n,
|
|
176
|
+
liquidity_amount_known: false,
|
|
177
|
+
base_mint: accounts[1],
|
|
178
|
+
quote_mint: accounts[2],
|
|
179
|
+
platform_config: cp ? accounts[3] : Z,
|
|
180
|
+
destination_program: accounts[cp ? 4 : 12],
|
|
181
|
+
},
|
|
182
|
+
};
|
|
123
183
|
}
|
|
124
184
|
return null;
|
|
125
185
|
}
|
package/dist/instr/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare function ixMeta(signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): EventMetadata;
|
|
1
|
+
import { type EventMetadata } from "../core/metadata.js";
|
|
2
|
+
export declare function ixMeta(signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): EventMetadata;
|
|
3
3
|
export declare function getAccount(accounts: string[], i: number): string | undefined;
|
|
4
4
|
/** Borsh 前缀字符串,返回 (utf8, 下一个 offset);失败返回 null */
|
|
5
5
|
export declare function readBorshStrAt(data: Uint8Array, offset: number): {
|
package/dist/instr/utils.js
CHANGED
|
@@ -5,15 +5,10 @@ exports.ixMeta = ixMeta;
|
|
|
5
5
|
exports.getAccount = getAccount;
|
|
6
6
|
exports.readBorshStrAt = readBorshStrAt;
|
|
7
7
|
exports.readPubkeyIx = readPubkeyIx;
|
|
8
|
+
const metadata_js_1 = require("../core/metadata.js");
|
|
8
9
|
const binary_js_1 = require("../util/binary.js");
|
|
9
10
|
function ixMeta(signature, slot, txIndex, blockTimeUs, grpcRecvUs) {
|
|
10
|
-
return
|
|
11
|
-
signature,
|
|
12
|
-
slot,
|
|
13
|
-
tx_index: txIndex,
|
|
14
|
-
block_time_us: blockTimeUs ?? 0,
|
|
15
|
-
grpc_recv_us: grpcRecvUs,
|
|
16
|
-
};
|
|
11
|
+
return (0, metadata_js_1.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
17
12
|
}
|
|
18
13
|
function getAccount(accounts, i) {
|
|
19
14
|
return accounts[i];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AccountData } from "./accounts/types.js";
|
|
2
|
+
import type { EventMetadata } from "./core/metadata.js";
|
|
3
|
+
export interface RawAccountSnapshotEvent {
|
|
4
|
+
metadata: EventMetadata;
|
|
5
|
+
account: AccountData;
|
|
6
|
+
write_version: bigint;
|
|
7
|
+
is_startup: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type LiquiditySnapshotKind = "LaunchLabGlobalConfig" | "LaunchLabPlatformConfig" | {
|
|
10
|
+
LaunchLabPool: {
|
|
11
|
+
base_mint: string;
|
|
12
|
+
quote_mint: string;
|
|
13
|
+
global_config: string;
|
|
14
|
+
platform_config: string;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
DlmmPool: {
|
|
18
|
+
token_x_mint: string;
|
|
19
|
+
token_y_mint: string;
|
|
20
|
+
active_id: number;
|
|
21
|
+
bin_step: number;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
DlmmBinArray: {
|
|
25
|
+
pool: string;
|
|
26
|
+
index: bigint;
|
|
27
|
+
};
|
|
28
|
+
} | {
|
|
29
|
+
DlmmBitmap: {
|
|
30
|
+
pool: string;
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
OrcaDynamicTickArray: {
|
|
34
|
+
pool: string;
|
|
35
|
+
start_tick_index: number;
|
|
36
|
+
tick_bitmap: bigint;
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
OrcaAdaptiveOracle: {
|
|
40
|
+
pool: string;
|
|
41
|
+
};
|
|
42
|
+
} | {
|
|
43
|
+
ClmmBitmap: {
|
|
44
|
+
pool: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export interface LiquidityAccountSnapshotEvent {
|
|
48
|
+
metadata: EventMetadata;
|
|
49
|
+
pubkey: string;
|
|
50
|
+
owner: string;
|
|
51
|
+
kind: LiquiditySnapshotKind;
|
|
52
|
+
data: Uint8Array;
|
|
53
|
+
}
|
|
54
|
+
export declare function parseLiquidityAccount(account: AccountData, metadata: EventMetadata): LiquidityAccountSnapshotEvent | null;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseLiquidityAccount = parseLiquidityAccount;
|
|
7
|
+
/** Full subscription bytes and validated liquidity identities, without RPC. */
|
|
8
|
+
const bs58_1 = __importDefault(require("bs58"));
|
|
9
|
+
const transaction_route_js_1 = require("./transaction_route.js");
|
|
10
|
+
function parseLiquidityAccount(account, metadata) {
|
|
11
|
+
if (account.lamports <= 0n || account.executable)
|
|
12
|
+
return null;
|
|
13
|
+
const d = Buffer.from(account.data), disc = d.subarray(0, 8).toString("hex"), owner = account.owner, key = (o) => bs58_1.default.encode(d.subarray(o, o + 32));
|
|
14
|
+
let kind;
|
|
15
|
+
if (owner === transaction_route_js_1.ROUTE_PROGRAMS.LaunchLab) {
|
|
16
|
+
if (disc === "f7ede3f5d7c3de46" && d.length >= 429)
|
|
17
|
+
kind = {
|
|
18
|
+
LaunchLabPool: {
|
|
19
|
+
base_mint: key(205),
|
|
20
|
+
quote_mint: key(237),
|
|
21
|
+
global_config: key(141),
|
|
22
|
+
platform_config: key(173),
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
else if (disc === "95089ccaa0fcb0d9" && d.length >= 35)
|
|
26
|
+
kind = "LaunchLabGlobalConfig";
|
|
27
|
+
else if (disc === "a04e8000f853e6a0" && d.length >= 728)
|
|
28
|
+
kind = "LaunchLabPlatformConfig";
|
|
29
|
+
}
|
|
30
|
+
else if (owner === transaction_route_js_1.ROUTE_PROGRAMS.MeteoraDlmm) {
|
|
31
|
+
if (disc === "210b3162b565b10d" && d.length >= 904)
|
|
32
|
+
kind = {
|
|
33
|
+
DlmmPool: {
|
|
34
|
+
token_x_mint: key(88),
|
|
35
|
+
token_y_mint: key(120),
|
|
36
|
+
active_id: d.readInt32LE(76),
|
|
37
|
+
bin_step: d.readUInt16LE(80),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
else if (disc === "5c8e5cdc059446b5" && d.length >= 10136)
|
|
41
|
+
kind = { DlmmBinArray: { pool: key(24), index: d.readBigInt64LE(8) } };
|
|
42
|
+
else if (disc === "506f7c7137ed1205" && d.length >= 1576)
|
|
43
|
+
kind = { DlmmBitmap: { pool: key(8) } };
|
|
44
|
+
}
|
|
45
|
+
else if (owner === transaction_route_js_1.ROUTE_PROGRAMS.OrcaWhirlpool) {
|
|
46
|
+
if (disc === "11d8f68ee1c7da38" && d.length >= 148) {
|
|
47
|
+
const bitmap = d.readBigUInt64LE(44) + (d.readBigUInt64LE(52) << 64n);
|
|
48
|
+
if (bitmap >> 88n)
|
|
49
|
+
return null;
|
|
50
|
+
let offset = 60;
|
|
51
|
+
for (let i = 0; i < 88; i++) {
|
|
52
|
+
const tag = d[offset];
|
|
53
|
+
if (offset >= d.length ||
|
|
54
|
+
(tag !== 0 && tag !== 1) ||
|
|
55
|
+
tag !== Number((bitmap >> BigInt(i)) & 1n))
|
|
56
|
+
return null;
|
|
57
|
+
offset += 1 + (tag ? 112 : 0);
|
|
58
|
+
if (offset > d.length)
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
kind = {
|
|
62
|
+
OrcaDynamicTickArray: {
|
|
63
|
+
pool: key(12),
|
|
64
|
+
start_tick_index: d.readInt32LE(8),
|
|
65
|
+
tick_bitmap: bitmap,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
else if (disc === "8bc283b38cb3e5f4" && d.length >= 254)
|
|
70
|
+
kind = { OrcaAdaptiveOracle: { pool: key(8) } };
|
|
71
|
+
}
|
|
72
|
+
else if (owner === transaction_route_js_1.ROUTE_PROGRAMS.RaydiumClmm &&
|
|
73
|
+
disc === "3c9624db61808b99" &&
|
|
74
|
+
d.length >= 1832)
|
|
75
|
+
kind = { ClmmBitmap: { pool: key(8) } };
|
|
76
|
+
return kind
|
|
77
|
+
? {
|
|
78
|
+
metadata,
|
|
79
|
+
pubkey: account.pubkey,
|
|
80
|
+
owner,
|
|
81
|
+
kind,
|
|
82
|
+
data: Uint8Array.from(d),
|
|
83
|
+
}
|
|
84
|
+
: null;
|
|
85
|
+
}
|
|
@@ -18,4 +18,4 @@ export declare function parseCreateDynamicConfigFromData(data: Uint8Array, meta:
|
|
|
18
18
|
/**
|
|
19
19
|
* Meteora DAMM Program data 入口;与 Rust `logs/meteora_damm.rs` 一致。
|
|
20
20
|
*/
|
|
21
|
-
export declare function parseMeteoraDammLog(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
21
|
+
export declare function parseMeteoraDammLog(log: string, signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -11,6 +11,7 @@ exports.parseCreateConfigFromData = parseCreateConfigFromData;
|
|
|
11
11
|
exports.parseCreateDynamicConfigFromData = parseCreateDynamicConfigFromData;
|
|
12
12
|
exports.parseMeteoraDammLog = parseMeteoraDammLog;
|
|
13
13
|
const metadata_js_1 = require("../core/metadata.js");
|
|
14
|
+
const metadata_js_2 = require("../core/metadata.js");
|
|
14
15
|
const dex_event_js_1 = require("../core/dex_event.js");
|
|
15
16
|
const program_data_js_1 = require("./program_data.js");
|
|
16
17
|
const binary_js_1 = require("../util/binary.js");
|
|
@@ -38,7 +39,8 @@ const CREATE_DYNAMIC_CONFIG = discOf([231, 197, 13, 164, 248, 213, 133, 152]);
|
|
|
38
39
|
*/
|
|
39
40
|
exports.COMPOUNDING_FEE_LAYOUT_ACTIVATION_SLOT = 406_048_752;
|
|
40
41
|
function usesCompoundingFeeLayout(slot) {
|
|
41
|
-
|
|
42
|
+
const n = (0, metadata_js_1.exactU64)(slot);
|
|
43
|
+
return n === 0n || n >= BigInt(exports.COMPOUNDING_FEE_LAYOUT_ACTIVATION_SLOT);
|
|
42
44
|
}
|
|
43
45
|
function bn64(v) {
|
|
44
46
|
return v ?? 0n;
|
|
@@ -709,7 +711,7 @@ function parseMeteoraDammLog(log, signature, slot, txIndex, blockTimeUs, grpcRec
|
|
|
709
711
|
return null;
|
|
710
712
|
const disc = new DataView(programData.buffer, programData.byteOffset, 8).getBigUint64(0, true);
|
|
711
713
|
const data = programData.subarray(8);
|
|
712
|
-
const meta = (0,
|
|
714
|
+
const meta = (0, metadata_js_2.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
713
715
|
if (disc === SWAP)
|
|
714
716
|
return parseSwapEvent(data, meta);
|
|
715
717
|
if (disc === SWAP2)
|
|
@@ -4,4 +4,4 @@ import type { DexEvent } from "../core/dex_event.js";
|
|
|
4
4
|
export declare function parseDlmmFromDecoded(programData: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
5
5
|
export declare function parseDlmmEventFromData(discriminator: bigint, data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
6
6
|
/** 从整行日志解析 */
|
|
7
|
-
export declare function parseMeteoraDlmmLog(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
7
|
+
export declare function parseMeteoraDlmmLog(log: string, signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
2
|
import type { EventTypeFilter } from "../grpc/types.js";
|
|
3
|
-
export declare function parseLogOptimized(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, eventTypeFilter: EventTypeFilter | undefined, isCreatedBuy: boolean, recentBlockhash?: Uint8Array, programId?: string): DexEvent | null;
|
|
3
|
+
export declare function parseLogOptimized(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, programId?: string): DexEvent | null;
|
|
4
4
|
/** 单行日志统一解析;`txIndex` 与 Rust gRPC `parse_logs(..., tx_idx, ...)` / `info.index` 对齐。 */
|
|
5
|
-
export declare function parseLogUnified(log: string, signature: string, slot: number, blockTimeUs: number | undefined, txIndex?: number): DexEvent | null;
|
|
6
|
-
export declare function parseLogOptimizedWithProgramId(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, eventTypeFilter: EventTypeFilter | undefined, isCreatedBuy: boolean, recentBlockhash: Uint8Array | undefined, programId: string | undefined): DexEvent | null;
|
|
5
|
+
export declare function parseLogUnified(log: string, signature: string, slot: number | bigint | string, blockTimeUs: number | bigint | string | undefined, txIndex?: number | bigint | string): DexEvent | null;
|
|
6
|
+
export declare function parseLogOptimizedWithProgramId(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 | undefined, programId: string | undefined): DexEvent | null;
|
|
7
7
|
export declare function parseInvokeInfo(log: string): {
|
|
8
8
|
programId: string;
|
|
9
9
|
depth: number;
|
|
@@ -19,12 +19,18 @@ function bn64(v) {
|
|
|
19
19
|
return v ?? 0n;
|
|
20
20
|
}
|
|
21
21
|
function parseRaydiumLaunchlabTradeFromData(data, metadata) {
|
|
22
|
+
if (data.length !== 139 || data[136] > 1 || data[137] > 2 || data[138] > 1)
|
|
23
|
+
return null;
|
|
22
24
|
const pool_state = (0, binary_js_1.readPubkey)(data, 0);
|
|
23
25
|
const amount_in = (0, binary_js_1.readU64LE)(data, 88);
|
|
24
26
|
const amount_out = (0, binary_js_1.readU64LE)(data, 96);
|
|
25
27
|
const trade_direction = (0, binary_js_1.readU8)(data, 136);
|
|
26
28
|
const exact_in = (0, binary_js_1.readBool)(data, 138);
|
|
27
|
-
if (!pool_state ||
|
|
29
|
+
if (!pool_state ||
|
|
30
|
+
amount_in === null ||
|
|
31
|
+
amount_out === null ||
|
|
32
|
+
trade_direction === null ||
|
|
33
|
+
exact_in === null) {
|
|
28
34
|
return null;
|
|
29
35
|
}
|
|
30
36
|
const is_buy = trade_direction === 0;
|
|
@@ -36,6 +42,18 @@ function parseRaydiumLaunchlabTradeFromData(data, metadata) {
|
|
|
36
42
|
amount_out: bn64(amount_out),
|
|
37
43
|
is_buy,
|
|
38
44
|
trade_direction: is_buy ? "Buy" : "Sell",
|
|
45
|
+
total_base_sell: (0, binary_js_1.readU64LE)(data, 32),
|
|
46
|
+
virtual_base: (0, binary_js_1.readU64LE)(data, 40),
|
|
47
|
+
virtual_quote: (0, binary_js_1.readU64LE)(data, 48),
|
|
48
|
+
real_base_before: (0, binary_js_1.readU64LE)(data, 56),
|
|
49
|
+
real_quote_before: (0, binary_js_1.readU64LE)(data, 64),
|
|
50
|
+
real_base_after: (0, binary_js_1.readU64LE)(data, 72),
|
|
51
|
+
real_quote_after: (0, binary_js_1.readU64LE)(data, 80),
|
|
52
|
+
protocol_fee: (0, binary_js_1.readU64LE)(data, 104),
|
|
53
|
+
platform_fee: (0, binary_js_1.readU64LE)(data, 112),
|
|
54
|
+
creator_fee: (0, binary_js_1.readU64LE)(data, 120),
|
|
55
|
+
share_fee: (0, binary_js_1.readU64LE)(data, 128),
|
|
56
|
+
pool_status: ["Fund", "Migrate", "Trade"][data[137]],
|
|
39
57
|
exact_in,
|
|
40
58
|
};
|
|
41
59
|
return { RaydiumLaunchlabTrade: ev };
|
|
@@ -13,9 +13,10 @@ export declare function applyAccountFillsToLogEvents(events: DexEvent[], msg: Me
|
|
|
13
13
|
* 解析已获取的 `VersionedTransactionResponse`(顺序:指令 → 日志 → 账户/数据填充)。
|
|
14
14
|
*/
|
|
15
15
|
export declare function parseRpcTransaction(tx: VersionedTransactionResponse, signature: string, filter?: EventTypeFilter, options?: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
slot?: bigint | string | number;
|
|
17
|
+
grpcRecvUs?: bigint | string | number;
|
|
18
|
+
txIndex?: bigint | string | number;
|
|
19
|
+
blockTimeUs?: bigint | string | number;
|
|
19
20
|
}): {
|
|
20
21
|
ok: true;
|
|
21
22
|
events: DexEvent[];
|
package/dist/rpc_transaction.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.fillDataRpc = exports.fillAccountsFromTransactionDataRpc = void 0;
|
|
7
7
|
exports.applyAccountFillsToLogEvents = applyAccountFillsToLogEvents;
|
|
8
8
|
exports.parseRpcTransaction = parseRpcTransaction;
|
|
9
|
+
const metadata_js_1 = require("./core/metadata.js");
|
|
9
10
|
/**
|
|
10
11
|
* RPC 交易解析:外层 + 内层指令 → 日志 → `fillAccountsFromTransactionDataRpc` → `fillDataRpc`。
|
|
11
12
|
*/
|
|
@@ -483,8 +484,8 @@ function parseRpcTransaction(tx, signature, filter, options) {
|
|
|
483
484
|
};
|
|
484
485
|
}
|
|
485
486
|
const meta = tx.meta ?? null;
|
|
486
|
-
const slot = tx.slot;
|
|
487
|
-
const blockTimeUs = options?.blockTimeUs ?? (tx.blockTime != null ? tx.blockTime *
|
|
487
|
+
const slot = (0, metadata_js_1.exactU64)(options?.slot ?? tx.slot, "slot");
|
|
488
|
+
const blockTimeUs = options?.blockTimeUs ?? (tx.blockTime != null ? (0, metadata_js_1.exactI64)(tx.blockTime) * 1000000n : undefined);
|
|
488
489
|
const grpcRecvUs = options?.grpcRecvUs ?? Math.floor(Date.now() * 1000);
|
|
489
490
|
const txIndex = options?.txIndex ?? 0;
|
|
490
491
|
const rb = recentBlockhashBytes(msg.recentBlockhash);
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.ShredStreamClient = exports.ShredEventQueue = void 0;
|
|
37
|
+
const metadata_js_1 = require("../core/metadata.js");
|
|
37
38
|
/**
|
|
38
39
|
* ShredStream 客户端:与 Rust `shredstream/client.rs` 对齐(gRPC + bincode 解码 + `parseTransactionEvents`)。
|
|
39
40
|
*/
|
|
@@ -120,7 +121,7 @@ function setGrpcRecvUsMut(event, grpcRecvUs) {
|
|
|
120
121
|
return;
|
|
121
122
|
const inner = event[key];
|
|
122
123
|
if (inner?.metadata)
|
|
123
|
-
inner.metadata.grpc_recv_us = grpcRecvUs;
|
|
124
|
+
inner.metadata.grpc_recv_us = (0, metadata_js_1.exactI64)(grpcRecvUs);
|
|
124
125
|
}
|
|
125
126
|
class ShredStreamClient {
|
|
126
127
|
endpoint;
|
|
@@ -394,10 +395,5 @@ class ShredStreamClient {
|
|
|
394
395
|
}
|
|
395
396
|
exports.ShredStreamClient = ShredStreamClient;
|
|
396
397
|
function toSlotNumber(slot) {
|
|
397
|
-
|
|
398
|
-
return slot;
|
|
399
|
-
if (typeof slot === "bigint")
|
|
400
|
-
return Number(slot);
|
|
401
|
-
const n = Number(slot);
|
|
402
|
-
return Number.isFinite(n) ? Math.floor(n) : 0;
|
|
398
|
+
return (0, metadata_js_1.exactU64)(slot, "ShredStream slot");
|
|
403
399
|
}
|