sol-parser-sdk 0.5.9
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/.env.example +24 -0
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/README_CN.md +236 -0
- package/dist/accounts/mod.d.ts +15 -0
- package/dist/accounts/mod.js +173 -0
- package/dist/accounts/nonce.d.ts +5 -0
- package/dist/accounts/nonce.js +32 -0
- package/dist/accounts/pumpfun.d.ts +16 -0
- package/dist/accounts/pumpfun.js +538 -0
- package/dist/accounts/pumpswap.d.ts +8 -0
- package/dist/accounts/pumpswap.js +192 -0
- package/dist/accounts/raydium_orca.d.ts +26 -0
- package/dist/accounts/raydium_orca.js +453 -0
- package/dist/accounts/rpc_wallet.d.ts +5 -0
- package/dist/accounts/rpc_wallet.js +18 -0
- package/dist/accounts/rust_aliases.d.ts +10 -0
- package/dist/accounts/rust_aliases.js +21 -0
- package/dist/accounts/token.d.ts +5 -0
- package/dist/accounts/token.js +98 -0
- package/dist/accounts/types.d.ts +9 -0
- package/dist/accounts/types.js +2 -0
- package/dist/accounts/utils.d.ts +1 -0
- package/dist/accounts/utils.js +12 -0
- package/dist/accounts/wallet_resolve.d.ts +1 -0
- package/dist/accounts/wallet_resolve.js +28 -0
- package/dist/common/constants.d.ts +10 -0
- package/dist/common/constants.js +13 -0
- package/dist/core/account_dispatcher_rpc.d.ts +11 -0
- package/dist/core/account_dispatcher_rpc.js +155 -0
- package/dist/core/account_fill_bonk.d.ts +4 -0
- package/dist/core/account_fill_bonk.js +20 -0
- package/dist/core/account_fill_meteora.d.ts +15 -0
- package/dist/core/account_fill_meteora.js +27 -0
- package/dist/core/account_fill_orca.d.ts +5 -0
- package/dist/core/account_fill_orca.js +18 -0
- package/dist/core/account_fill_pumpfun.d.ts +7 -0
- package/dist/core/account_fill_pumpfun.js +167 -0
- package/dist/core/account_fill_pumpswap.d.ts +10 -0
- package/dist/core/account_fill_pumpswap.js +128 -0
- package/dist/core/account_fill_raydium.d.ts +20 -0
- package/dist/core/account_fill_raydium.js +104 -0
- package/dist/core/account_fill_raydium_launchlab.d.ts +4 -0
- package/dist/core/account_fill_raydium_launchlab.js +20 -0
- package/dist/core/account_pubkey_cache.d.ts +12 -0
- package/dist/core/account_pubkey_cache.js +26 -0
- package/dist/core/clock.d.ts +8 -0
- package/dist/core/clock.js +20 -0
- package/dist/core/common_filler_rpc.d.ts +6 -0
- package/dist/core/common_filler_rpc.js +21 -0
- package/dist/core/dex_event.d.ts +1704 -0
- package/dist/core/dex_event.js +14 -0
- package/dist/core/error.d.ts +43 -0
- package/dist/core/error.js +16 -0
- package/dist/core/json_utils.d.ts +8 -0
- package/dist/core/json_utils.js +18 -0
- package/dist/core/metadata.d.ts +11 -0
- package/dist/core/metadata.js +13 -0
- package/dist/core/pumpfun_fee_enrich.d.ts +6 -0
- package/dist/core/pumpfun_fee_enrich.js +159 -0
- package/dist/core/rpc_invoke_map.d.ts +23 -0
- package/dist/core/rpc_invoke_map.js +157 -0
- package/dist/core/unified_parser.d.ts +19 -0
- package/dist/core/unified_parser.js +50 -0
- package/dist/grpc/client.d.ts +83 -0
- package/dist/grpc/client.js +645 -0
- package/dist/grpc/client_stub.d.ts +5 -0
- package/dist/grpc/client_stub.js +5 -0
- package/dist/grpc/event_parser.d.ts +6 -0
- package/dist/grpc/event_parser.js +15 -0
- package/dist/grpc/geyser_connect.d.ts +30 -0
- package/dist/grpc/geyser_connect.js +40 -0
- package/dist/grpc/log_instr_dedup.d.ts +2 -0
- package/dist/grpc/log_instr_dedup.js +402 -0
- package/dist/grpc/order_buffer.d.ts +27 -0
- package/dist/grpc/order_buffer.js +166 -0
- package/dist/grpc/program_ids.d.ts +27 -0
- package/dist/grpc/program_ids.js +61 -0
- package/dist/grpc/rpc_to_grpc.d.ts +18 -0
- package/dist/grpc/rpc_to_grpc.js +127 -0
- package/dist/grpc/subscribe_builder.d.ts +13 -0
- package/dist/grpc/subscribe_builder.js +66 -0
- package/dist/grpc/transaction_meta.d.ts +29 -0
- package/dist/grpc/transaction_meta.js +208 -0
- package/dist/grpc/types.d.ts +195 -0
- package/dist/grpc/types.js +551 -0
- package/dist/grpc/yellowstone_parse.d.ts +16 -0
- package/dist/grpc/yellowstone_parse.js +62 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +298 -0
- package/dist/instr/bonk_ix.d.ts +8 -0
- package/dist/instr/bonk_ix.js +131 -0
- package/dist/instr/inner.d.ts +4 -0
- package/dist/instr/inner.js +453 -0
- package/dist/instr/meteora_damm_ix.d.ts +8 -0
- package/dist/instr/meteora_damm_ix.js +601 -0
- package/dist/instr/meteora_dlmm_ix.d.ts +2 -0
- package/dist/instr/meteora_dlmm_ix.js +134 -0
- package/dist/instr/meteora_pools_ix.d.ts +2 -0
- package/dist/instr/meteora_pools_ix.js +78 -0
- package/dist/instr/mod.d.ts +18 -0
- package/dist/instr/mod.js +129 -0
- package/dist/instr/orca_whirlpool_ix.d.ts +8 -0
- package/dist/instr/orca_whirlpool_ix.js +119 -0
- package/dist/instr/program_ids.d.ts +4 -0
- package/dist/instr/program_ids.js +20 -0
- package/dist/instr/pump_fees_ix.d.ts +2 -0
- package/dist/instr/pump_fees_ix.js +168 -0
- package/dist/instr/pumpfun_ix.d.ts +6 -0
- package/dist/instr/pumpfun_ix.js +448 -0
- package/dist/instr/pumpswap_ix.d.ts +5 -0
- package/dist/instr/pumpswap_ix.js +270 -0
- package/dist/instr/raydium_amm_v4_ix.d.ts +6 -0
- package/dist/instr/raydium_amm_v4_ix.js +112 -0
- package/dist/instr/raydium_clmm_ix.d.ts +5 -0
- package/dist/instr/raydium_clmm_ix.js +184 -0
- package/dist/instr/raydium_cpmm_ix.d.ts +5 -0
- package/dist/instr/raydium_cpmm_ix.js +109 -0
- package/dist/instr/raydium_launchlab_ix.d.ts +8 -0
- package/dist/instr/raydium_launchlab_ix.js +125 -0
- package/dist/instr/rust_aliases.d.ts +10 -0
- package/dist/instr/rust_aliases.js +20 -0
- package/dist/instr/utils.d.ts +10 -0
- package/dist/instr/utils.js +35 -0
- package/dist/logs/discriminator_lut.d.ts +19 -0
- package/dist/logs/discriminator_lut.js +62 -0
- package/dist/logs/meteora_amm.d.ts +8 -0
- package/dist/logs/meteora_amm.js +113 -0
- package/dist/logs/meteora_damm.d.ts +5 -0
- package/dist/logs/meteora_damm.js +367 -0
- package/dist/logs/meteora_dbc.d.ts +11 -0
- package/dist/logs/meteora_dbc.js +142 -0
- package/dist/logs/meteora_dlmm.d.ts +6 -0
- package/dist/logs/meteora_dlmm.js +201 -0
- package/dist/logs/optimized_matcher.d.ts +11 -0
- package/dist/logs/optimized_matcher.js +941 -0
- package/dist/logs/orca.d.ts +6 -0
- package/dist/logs/orca.js +148 -0
- package/dist/logs/program_data.d.ts +2 -0
- package/dist/logs/program_data.js +20 -0
- package/dist/logs/program_log_discriminators.d.ts +80 -0
- package/dist/logs/program_log_discriminators.js +88 -0
- package/dist/logs/pump.d.ts +14 -0
- package/dist/logs/pump.js +378 -0
- package/dist/logs/pump_amm.d.ts +9 -0
- package/dist/logs/pump_amm.js +418 -0
- package/dist/logs/pump_fees.d.ts +23 -0
- package/dist/logs/pump_fees.js +364 -0
- package/dist/logs/raydium_amm.d.ts +9 -0
- package/dist/logs/raydium_amm.js +224 -0
- package/dist/logs/raydium_clmm.d.ts +17 -0
- package/dist/logs/raydium_clmm.js +624 -0
- package/dist/logs/raydium_cpmm.d.ts +7 -0
- package/dist/logs/raydium_cpmm.js +121 -0
- package/dist/logs/raydium_launchlab.d.ts +10 -0
- package/dist/logs/raydium_launchlab.js +84 -0
- package/dist/logs/raydium_launchpad.d.ts +12 -0
- package/dist/logs/raydium_launchpad.js +92 -0
- package/dist/logs/rust_aliases.d.ts +7 -0
- package/dist/logs/rust_aliases.js +16 -0
- package/dist/parser_alias.d.ts +3 -0
- package/dist/parser_alias.js +2 -0
- package/dist/rpc_parser.d.ts +17 -0
- package/dist/rpc_parser.js +39 -0
- package/dist/rpc_transaction.d.ts +27 -0
- package/dist/rpc_transaction.js +416 -0
- package/dist/shredstream/alt_lookup.d.ts +9 -0
- package/dist/shredstream/alt_lookup.js +70 -0
- package/dist/shredstream/client.d.ts +65 -0
- package/dist/shredstream/client.js +403 -0
- package/dist/shredstream/config.d.ts +30 -0
- package/dist/shredstream/config.js +34 -0
- package/dist/shredstream/entries_decode.d.ts +28 -0
- package/dist/shredstream/entries_decode.js +251 -0
- package/dist/shredstream/index.d.ts +17 -0
- package/dist/shredstream/index.js +33 -0
- package/dist/shredstream/instruction_parse.d.ts +34 -0
- package/dist/shredstream/instruction_parse.js +79 -0
- package/dist/shredstream/proto_types.d.ts +9 -0
- package/dist/shredstream/proto_types.js +2 -0
- package/dist/shredstream/shredstream.proto +15 -0
- package/dist/shredstream/wire_to_shred_tx.d.ts +2 -0
- package/dist/shredstream/wire_to_shred_tx.js +59 -0
- package/dist/util/binary.d.ts +14 -0
- package/dist/util/binary.js +82 -0
- package/dist/util/market.d.ts +18 -0
- package/dist/util/market.js +54 -0
- package/dist/warmup.d.ts +3 -0
- package/dist/warmup.js +23 -0
- package/package.json +61 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRaydiumCpmmInstruction = parseRaydiumCpmmInstruction;
|
|
4
|
+
const dex_event_js_1 = require("../core/dex_event.js");
|
|
5
|
+
const program_log_discriminators_js_1 = require("../logs/program_log_discriminators.js");
|
|
6
|
+
const utils_js_1 = require("./utils.js");
|
|
7
|
+
const Z = (0, dex_event_js_1.defaultPubkey)();
|
|
8
|
+
const DISC = {
|
|
9
|
+
SWAP_BASE_IN: program_log_discriminators_js_1.PROGRAM_LOG_DISC.RAYDIUM_CPMM_SWAP_BASE_IN,
|
|
10
|
+
SWAP_BASE_OUT: program_log_discriminators_js_1.PROGRAM_LOG_DISC.RAYDIUM_CPMM_SWAP_BASE_OUT,
|
|
11
|
+
INITIALIZE: (0, program_log_discriminators_js_1.u64leDiscriminator)([175, 175, 109, 31, 13, 152, 155, 237]),
|
|
12
|
+
DEPOSIT: program_log_discriminators_js_1.PROGRAM_LOG_DISC.RAYDIUM_CPMM_DEPOSIT,
|
|
13
|
+
WITHDRAW: program_log_discriminators_js_1.PROGRAM_LOG_DISC.RAYDIUM_CPMM_WITHDRAW,
|
|
14
|
+
};
|
|
15
|
+
function discEq(data, disc) {
|
|
16
|
+
if (data.length < 8)
|
|
17
|
+
return false;
|
|
18
|
+
const v = (0, utils_js_1.readU64LE)(data, 0);
|
|
19
|
+
return v === disc;
|
|
20
|
+
}
|
|
21
|
+
function parseRaydiumCpmmInstruction(instructionData, accounts, signature, slot, txIndex, blockTimeUs, grpcRecvUs) {
|
|
22
|
+
if (instructionData.length < 8)
|
|
23
|
+
return null;
|
|
24
|
+
const meta = (0, utils_js_1.ixMeta)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
25
|
+
if (discEq(instructionData, DISC.SWAP_BASE_IN)) {
|
|
26
|
+
if (instructionData.length < 8 + 8 + 8)
|
|
27
|
+
return null;
|
|
28
|
+
return {
|
|
29
|
+
RaydiumCpmmSwap: {
|
|
30
|
+
metadata: meta,
|
|
31
|
+
pool_id: Z,
|
|
32
|
+
input_amount: 0n,
|
|
33
|
+
output_amount: 0n,
|
|
34
|
+
input_vault_before: 0n,
|
|
35
|
+
output_vault_before: 0n,
|
|
36
|
+
input_transfer_fee: 0n,
|
|
37
|
+
output_transfer_fee: 0n,
|
|
38
|
+
base_input: true,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (discEq(instructionData, DISC.SWAP_BASE_OUT)) {
|
|
43
|
+
if (instructionData.length < 8 + 8 + 8)
|
|
44
|
+
return null;
|
|
45
|
+
return {
|
|
46
|
+
RaydiumCpmmSwap: {
|
|
47
|
+
metadata: meta,
|
|
48
|
+
pool_id: Z,
|
|
49
|
+
input_amount: 0n,
|
|
50
|
+
output_amount: 0n,
|
|
51
|
+
input_vault_before: 0n,
|
|
52
|
+
output_vault_before: 0n,
|
|
53
|
+
input_transfer_fee: 0n,
|
|
54
|
+
output_transfer_fee: 0n,
|
|
55
|
+
base_input: false,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (discEq(instructionData, DISC.INITIALIZE)) {
|
|
60
|
+
if (instructionData.length < 8 + 8 + 8 + 8)
|
|
61
|
+
return null;
|
|
62
|
+
const init_amount0 = (0, utils_js_1.readU64LE)(instructionData, 8) ?? 0n;
|
|
63
|
+
const init_amount1 = (0, utils_js_1.readU64LE)(instructionData, 16) ?? 0n;
|
|
64
|
+
return {
|
|
65
|
+
RaydiumCpmmInitialize: {
|
|
66
|
+
metadata: meta,
|
|
67
|
+
pool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
|
|
68
|
+
creator: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
|
|
69
|
+
init_amount0,
|
|
70
|
+
init_amount1,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (discEq(instructionData, DISC.DEPOSIT)) {
|
|
75
|
+
if (instructionData.length < 8 + 8 + 8 + 8)
|
|
76
|
+
return null;
|
|
77
|
+
const lp_token_amount = (0, utils_js_1.readU64LE)(instructionData, 8) ?? 0n;
|
|
78
|
+
const token0_amount = (0, utils_js_1.readU64LE)(instructionData, 16) ?? 0n;
|
|
79
|
+
const token1_amount = (0, utils_js_1.readU64LE)(instructionData, 24) ?? 0n;
|
|
80
|
+
return {
|
|
81
|
+
RaydiumCpmmDeposit: {
|
|
82
|
+
metadata: meta,
|
|
83
|
+
pool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
|
|
84
|
+
user: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
|
|
85
|
+
lp_token_amount,
|
|
86
|
+
token0_amount,
|
|
87
|
+
token1_amount,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (discEq(instructionData, DISC.WITHDRAW)) {
|
|
92
|
+
if (instructionData.length < 8 + 8 + 8 + 8)
|
|
93
|
+
return null;
|
|
94
|
+
const lp_token_amount = (0, utils_js_1.readU64LE)(instructionData, 8) ?? 0n;
|
|
95
|
+
const token0_amount = (0, utils_js_1.readU64LE)(instructionData, 16) ?? 0n;
|
|
96
|
+
const token1_amount = (0, utils_js_1.readU64LE)(instructionData, 24) ?? 0n;
|
|
97
|
+
return {
|
|
98
|
+
RaydiumCpmmWithdraw: {
|
|
99
|
+
metadata: meta,
|
|
100
|
+
pool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
|
|
101
|
+
user: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
|
|
102
|
+
lp_token_amount,
|
|
103
|
+
token0_amount,
|
|
104
|
+
token1_amount,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raydium LaunchLab 指令解析
|
|
3
|
+
*
|
|
4
|
+
* 1) **Program data 日志形载荷**(与 `logs/raydium_launchlab` 一致):前 8 字节为事件 disc,后跟 pool/user/金额…
|
|
5
|
+
* 2) **Anchor 外层指令**:`global:buy` / `sell` / `create_pool` / `migrate_to_amm` 等(sha256 前 8 字节),参数多为 Borsh u64。
|
|
6
|
+
*/
|
|
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;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRaydiumLaunchlabInstruction = parseRaydiumLaunchlabInstruction;
|
|
4
|
+
const dex_event_js_1 = require("../core/dex_event.js");
|
|
5
|
+
const raydium_launchlab_js_1 = require("../logs/raydium_launchlab.js");
|
|
6
|
+
const utils_js_1 = require("./utils.js");
|
|
7
|
+
const Z = (0, dex_event_js_1.defaultPubkey)();
|
|
8
|
+
/** Anchor `sha256("global:<name>")[0..8]`,与链上 LaunchLab / pAMM 系指令一致 */
|
|
9
|
+
const ANCHOR = {
|
|
10
|
+
BUY_EXACT_IN: [250, 234, 13, 123, 213, 156, 19, 236],
|
|
11
|
+
BUY_EXACT_OUT: [24, 211, 116, 40, 105, 3, 153, 56],
|
|
12
|
+
INITIALIZE: [175, 175, 109, 31, 13, 152, 155, 237],
|
|
13
|
+
INITIALIZE_V2: [67, 153, 175, 39, 218, 16, 38, 32],
|
|
14
|
+
INITIALIZE_WITH_TOKEN_2022: [37, 190, 126, 222, 44, 154, 171, 17],
|
|
15
|
+
SELL_EXACT_OUT: [95, 200, 71, 34, 8, 9, 11, 166],
|
|
16
|
+
SELL_EXACT_IN: [149, 39, 222, 155, 211, 124, 152, 26],
|
|
17
|
+
MIGRATE_TO_AMM: [207, 82, 192, 145, 254, 207, 145, 223],
|
|
18
|
+
MIGRATE_TO_CPSWAP: [136, 92, 200, 103, 28, 218, 144, 140],
|
|
19
|
+
};
|
|
20
|
+
function discEqU64(data, disc) {
|
|
21
|
+
if (data.length < 8)
|
|
22
|
+
return false;
|
|
23
|
+
const v = (0, utils_js_1.readU64LE)(data, 0);
|
|
24
|
+
return v === disc;
|
|
25
|
+
}
|
|
26
|
+
function headEq(data, bytes) {
|
|
27
|
+
if (data.length < 8)
|
|
28
|
+
return false;
|
|
29
|
+
for (let i = 0; i < 8; i++)
|
|
30
|
+
if (data[i] !== bytes[i])
|
|
31
|
+
return false;
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
/** 与 PumpSwap buy/sell 一致:两 u64(base / quote 侧限额) */
|
|
35
|
+
function parseMintParams(payload) {
|
|
36
|
+
const decimals = (0, utils_js_1.readU8)(payload, 0);
|
|
37
|
+
if (decimals === null)
|
|
38
|
+
return null;
|
|
39
|
+
let o = 1;
|
|
40
|
+
const name = (0, utils_js_1.readBorshStrAt)(payload, o);
|
|
41
|
+
if (!name)
|
|
42
|
+
return null;
|
|
43
|
+
o = name.next;
|
|
44
|
+
const symbol = (0, utils_js_1.readBorshStrAt)(payload, o);
|
|
45
|
+
if (!symbol)
|
|
46
|
+
return null;
|
|
47
|
+
o = symbol.next;
|
|
48
|
+
const uri = (0, utils_js_1.readBorshStrAt)(payload, o);
|
|
49
|
+
if (!uri)
|
|
50
|
+
return null;
|
|
51
|
+
return { symbol: symbol.s, name: name.s, uri: uri.s, decimals };
|
|
52
|
+
}
|
|
53
|
+
function tradeFromTwoU64(payload, accounts, meta, isBuy, exactIn) {
|
|
54
|
+
const first = (0, utils_js_1.readU64LE)(payload, 0) ?? 0n;
|
|
55
|
+
const second = (0, utils_js_1.readU64LE)(payload, 8) ?? 0n;
|
|
56
|
+
const amount_in = exactIn ? first : second;
|
|
57
|
+
const amount_out = exactIn ? second : first;
|
|
58
|
+
const pool = (0, utils_js_1.getAccount)(accounts, 4) ?? Z;
|
|
59
|
+
const user = (0, utils_js_1.getAccount)(accounts, 0) ?? Z;
|
|
60
|
+
return {
|
|
61
|
+
RaydiumLaunchlabTrade: {
|
|
62
|
+
metadata: meta,
|
|
63
|
+
pool_state: pool,
|
|
64
|
+
user,
|
|
65
|
+
amount_in,
|
|
66
|
+
amount_out,
|
|
67
|
+
is_buy: isBuy,
|
|
68
|
+
trade_direction: isBuy ? "Buy" : "Sell",
|
|
69
|
+
exact_in: exactIn,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function parseRaydiumLaunchlabInstruction(instructionData, accounts, signature, slot, txIndex, blockTimeUs, grpcRecvUs) {
|
|
74
|
+
if (instructionData.length < 8)
|
|
75
|
+
return null;
|
|
76
|
+
const meta = (0, utils_js_1.ixMeta)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
77
|
+
// --- Program data 事件形(与链上 emit 载荷一致,偶见于外层) ---
|
|
78
|
+
if (discEqU64(instructionData, raydium_launchlab_js_1.RAYDIUM_LAUNCHLAB_DISC.TRADE)) {
|
|
79
|
+
return (0, raydium_launchlab_js_1.parseRaydiumLaunchlabTradeFromData)(instructionData.subarray(8), meta);
|
|
80
|
+
}
|
|
81
|
+
if (discEqU64(instructionData, raydium_launchlab_js_1.RAYDIUM_LAUNCHLAB_DISC.POOL_CREATE)) {
|
|
82
|
+
return (0, raydium_launchlab_js_1.parseRaydiumLaunchlabPoolCreateFromData)(instructionData.subarray(8), meta);
|
|
83
|
+
}
|
|
84
|
+
const rest = instructionData.subarray(8);
|
|
85
|
+
// --- Anchor:买卖(两 u64) ---
|
|
86
|
+
if (headEq(instructionData, ANCHOR.BUY_EXACT_IN)) {
|
|
87
|
+
if (rest.length < 16)
|
|
88
|
+
return null;
|
|
89
|
+
return tradeFromTwoU64(rest, accounts, meta, true, true);
|
|
90
|
+
}
|
|
91
|
+
if (headEq(instructionData, ANCHOR.BUY_EXACT_OUT)) {
|
|
92
|
+
if (rest.length < 16)
|
|
93
|
+
return null;
|
|
94
|
+
return tradeFromTwoU64(rest, accounts, meta, true, false);
|
|
95
|
+
}
|
|
96
|
+
if (headEq(instructionData, ANCHOR.SELL_EXACT_IN)) {
|
|
97
|
+
if (rest.length < 16)
|
|
98
|
+
return null;
|
|
99
|
+
return tradeFromTwoU64(rest, accounts, meta, false, true);
|
|
100
|
+
}
|
|
101
|
+
if (headEq(instructionData, ANCHOR.SELL_EXACT_OUT)) {
|
|
102
|
+
if (rest.length < 16)
|
|
103
|
+
return null;
|
|
104
|
+
return tradeFromTwoU64(rest, accounts, meta, false, false);
|
|
105
|
+
}
|
|
106
|
+
if (headEq(instructionData, ANCHOR.INITIALIZE) ||
|
|
107
|
+
headEq(instructionData, ANCHOR.INITIALIZE_V2) ||
|
|
108
|
+
headEq(instructionData, ANCHOR.INITIALIZE_WITH_TOKEN_2022)) {
|
|
109
|
+
const base_mint_param = parseMintParams(rest);
|
|
110
|
+
if (!base_mint_param)
|
|
111
|
+
return null;
|
|
112
|
+
return {
|
|
113
|
+
RaydiumLaunchlabPoolCreate: {
|
|
114
|
+
metadata: meta,
|
|
115
|
+
base_mint_param,
|
|
116
|
+
pool_state: (0, utils_js_1.getAccount)(accounts, 5) ?? Z,
|
|
117
|
+
creator: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (headEq(instructionData, ANCHOR.MIGRATE_TO_AMM) || headEq(instructionData, ANCHOR.MIGRATE_TO_CPSWAP)) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rust `instr` 根模块 re-export 的蛇形命名(与 `parse_pumpfun_instruction` 等对应)。
|
|
3
|
+
*/
|
|
4
|
+
export { parseInstructionUnified as parse_instruction_unified } from "./mod.js";
|
|
5
|
+
export { parsePumpfunInstruction as parse_pumpfun_instruction } from "./pumpfun_ix.js";
|
|
6
|
+
export { parsePumpswapInstruction as parse_pumpswap_instruction } from "./pumpswap_ix.js";
|
|
7
|
+
export { parseMeteoraDammInstruction as parse_meteora_damm_instruction } from "./meteora_damm_ix.js";
|
|
8
|
+
export { parseMeteoraDlmmInstruction as parse_meteora_dlmm_instruction } from "./meteora_dlmm_ix.js";
|
|
9
|
+
export { parseMeteoraPoolsInstruction as parse_meteora_pools_instruction } from "./meteora_pools_ix.js";
|
|
10
|
+
export { parsePumpFeesInstruction as parse_pump_fees_instruction } from "./pump_fees_ix.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parse_pump_fees_instruction = exports.parse_meteora_pools_instruction = exports.parse_meteora_dlmm_instruction = exports.parse_meteora_damm_instruction = exports.parse_pumpswap_instruction = exports.parse_pumpfun_instruction = exports.parse_instruction_unified = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Rust `instr` 根模块 re-export 的蛇形命名(与 `parse_pumpfun_instruction` 等对应)。
|
|
6
|
+
*/
|
|
7
|
+
var mod_js_1 = require("./mod.js");
|
|
8
|
+
Object.defineProperty(exports, "parse_instruction_unified", { enumerable: true, get: function () { return mod_js_1.parseInstructionUnified; } });
|
|
9
|
+
var pumpfun_ix_js_1 = require("./pumpfun_ix.js");
|
|
10
|
+
Object.defineProperty(exports, "parse_pumpfun_instruction", { enumerable: true, get: function () { return pumpfun_ix_js_1.parsePumpfunInstruction; } });
|
|
11
|
+
var pumpswap_ix_js_1 = require("./pumpswap_ix.js");
|
|
12
|
+
Object.defineProperty(exports, "parse_pumpswap_instruction", { enumerable: true, get: function () { return pumpswap_ix_js_1.parsePumpswapInstruction; } });
|
|
13
|
+
var meteora_damm_ix_js_1 = require("./meteora_damm_ix.js");
|
|
14
|
+
Object.defineProperty(exports, "parse_meteora_damm_instruction", { enumerable: true, get: function () { return meteora_damm_ix_js_1.parseMeteoraDammInstruction; } });
|
|
15
|
+
var meteora_dlmm_ix_js_1 = require("./meteora_dlmm_ix.js");
|
|
16
|
+
Object.defineProperty(exports, "parse_meteora_dlmm_instruction", { enumerable: true, get: function () { return meteora_dlmm_ix_js_1.parseMeteoraDlmmInstruction; } });
|
|
17
|
+
var meteora_pools_ix_js_1 = require("./meteora_pools_ix.js");
|
|
18
|
+
Object.defineProperty(exports, "parse_meteora_pools_instruction", { enumerable: true, get: function () { return meteora_pools_ix_js_1.parseMeteoraPoolsInstruction; } });
|
|
19
|
+
var pump_fees_ix_js_1 = require("./pump_fees_ix.js");
|
|
20
|
+
Object.defineProperty(exports, "parse_pump_fees_instruction", { enumerable: true, get: function () { return pump_fees_ix_js_1.parsePumpFeesInstruction; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EventMetadata } from "../core/metadata.js";
|
|
2
|
+
export declare function ixMeta(signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): EventMetadata;
|
|
3
|
+
export declare function getAccount(accounts: string[], i: number): string | undefined;
|
|
4
|
+
/** Borsh 前缀字符串,返回 (utf8, 下一个 offset);失败返回 null */
|
|
5
|
+
export declare function readBorshStrAt(data: Uint8Array, offset: number): {
|
|
6
|
+
s: string;
|
|
7
|
+
next: number;
|
|
8
|
+
} | null;
|
|
9
|
+
export declare function readPubkeyIx(data: Uint8Array, o: number): string | null;
|
|
10
|
+
export { readU64LE, readU128LE, readU16LE, readU8, readBool, readI64LE, readI32LE, } from "../util/binary.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readI32LE = exports.readI64LE = exports.readBool = exports.readU8 = exports.readU16LE = exports.readU128LE = exports.readU64LE = void 0;
|
|
4
|
+
exports.ixMeta = ixMeta;
|
|
5
|
+
exports.getAccount = getAccount;
|
|
6
|
+
exports.readBorshStrAt = readBorshStrAt;
|
|
7
|
+
exports.readPubkeyIx = readPubkeyIx;
|
|
8
|
+
const binary_js_1 = require("../util/binary.js");
|
|
9
|
+
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
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function getAccount(accounts, i) {
|
|
19
|
+
return accounts[i];
|
|
20
|
+
}
|
|
21
|
+
/** Borsh 前缀字符串,返回 (utf8, 下一个 offset);失败返回 null */
|
|
22
|
+
function readBorshStrAt(data, offset) {
|
|
23
|
+
return (0, binary_js_1.readBorshString)(data, offset);
|
|
24
|
+
}
|
|
25
|
+
function readPubkeyIx(data, o) {
|
|
26
|
+
return (0, binary_js_1.readPubkey)(data, o);
|
|
27
|
+
}
|
|
28
|
+
var binary_js_2 = require("../util/binary.js");
|
|
29
|
+
Object.defineProperty(exports, "readU64LE", { enumerable: true, get: function () { return binary_js_2.readU64LE; } });
|
|
30
|
+
Object.defineProperty(exports, "readU128LE", { enumerable: true, get: function () { return binary_js_2.readU128LE; } });
|
|
31
|
+
Object.defineProperty(exports, "readU16LE", { enumerable: true, get: function () { return binary_js_2.readU16LE; } });
|
|
32
|
+
Object.defineProperty(exports, "readU8", { enumerable: true, get: function () { return binary_js_2.readU8; } });
|
|
33
|
+
Object.defineProperty(exports, "readBool", { enumerable: true, get: function () { return binary_js_2.readBool; } });
|
|
34
|
+
Object.defineProperty(exports, "readI64LE", { enumerable: true, get: function () { return binary_js_2.readI64LE; } });
|
|
35
|
+
Object.defineProperty(exports, "readI32LE", { enumerable: true, get: function () { return binary_js_2.readI32LE; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** 与 Rust `discriminator_lut::Protocol` 变体名一致(字符串联合,便于 JSON / 日志)。 */
|
|
2
|
+
export type LogProtocol = "PumpFun" | "PumpFees" | "PumpSwap" | "RaydiumClmm" | "RaydiumCpmm" | "RaydiumAmm" | "OrcaWhirlpool" | "MeteoraAmm" | "MeteoraDamm";
|
|
3
|
+
/** Rust `discriminator_to_name` */
|
|
4
|
+
export declare function discriminatorToName(discriminator: bigint): string | undefined;
|
|
5
|
+
/** Rust `discriminator_to_protocol` */
|
|
6
|
+
export declare function discriminatorToProtocol(discriminator: bigint): LogProtocol | undefined;
|
|
7
|
+
export type LutDiscriminatorInfo = {
|
|
8
|
+
discriminator: bigint;
|
|
9
|
+
name: string;
|
|
10
|
+
protocol: LogProtocol;
|
|
11
|
+
};
|
|
12
|
+
/** Rust `lookup_discriminator`(无 parser 函数指针;含 `protocol`) */
|
|
13
|
+
export declare function lookupDiscriminator(discriminator: bigint): LutDiscriminatorInfo | undefined;
|
|
14
|
+
/** Rust `discriminator_to_name` */
|
|
15
|
+
export declare const discriminator_to_name: typeof discriminatorToName;
|
|
16
|
+
/** Rust `discriminator_to_protocol` */
|
|
17
|
+
export declare const discriminator_to_protocol: typeof discriminatorToProtocol;
|
|
18
|
+
/** Rust `lookup_discriminator` */
|
|
19
|
+
export declare const lookup_discriminator: typeof lookupDiscriminator;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lookup_discriminator = exports.discriminator_to_protocol = exports.discriminator_to_name = void 0;
|
|
4
|
+
exports.discriminatorToName = discriminatorToName;
|
|
5
|
+
exports.discriminatorToProtocol = discriminatorToProtocol;
|
|
6
|
+
exports.lookupDiscriminator = lookupDiscriminator;
|
|
7
|
+
/**
|
|
8
|
+
* 与 Rust `logs::discriminator_lut` 中的名称 / 协议查询对齐(基于 `PROGRAM_LOG_DISC`,含 PumpSwap 子表)。
|
|
9
|
+
* 不含 `parse_with_discriminator`:完整数据路径请用 `parseLogOptimized` / `parse_log_optimized`。
|
|
10
|
+
*/
|
|
11
|
+
const program_log_discriminators_js_1 = require("./program_log_discriminators.js");
|
|
12
|
+
function protocolForProgramLogKey(key) {
|
|
13
|
+
if (key.startsWith("PUMPFUN_"))
|
|
14
|
+
return "PumpFun";
|
|
15
|
+
if (key.startsWith("PUMP_FEES_"))
|
|
16
|
+
return "PumpFees";
|
|
17
|
+
if (key.startsWith("PUMPSWAP_"))
|
|
18
|
+
return "PumpSwap";
|
|
19
|
+
if (key.startsWith("RAYDIUM_CLMM_"))
|
|
20
|
+
return "RaydiumClmm";
|
|
21
|
+
if (key.startsWith("RAYDIUM_CPMM_"))
|
|
22
|
+
return "RaydiumCpmm";
|
|
23
|
+
if (key.startsWith("RAYDIUM_AMM_"))
|
|
24
|
+
return "RaydiumAmm";
|
|
25
|
+
if (key.startsWith("ORCA_"))
|
|
26
|
+
return "OrcaWhirlpool";
|
|
27
|
+
if (key.startsWith("METEORA_AMM_"))
|
|
28
|
+
return "MeteoraAmm";
|
|
29
|
+
if (key.startsWith("METEORA_DAMM_"))
|
|
30
|
+
return "MeteoraDamm";
|
|
31
|
+
throw new Error(`discriminator_lut: 无法从键推断协议: ${key}`);
|
|
32
|
+
}
|
|
33
|
+
const NAME_BY_DISC = new Map();
|
|
34
|
+
const PROTOCOL_BY_DISC = new Map();
|
|
35
|
+
for (const [name, disc] of Object.entries(program_log_discriminators_js_1.PROGRAM_LOG_DISC)) {
|
|
36
|
+
NAME_BY_DISC.set(disc, name);
|
|
37
|
+
PROTOCOL_BY_DISC.set(disc, protocolForProgramLogKey(name));
|
|
38
|
+
}
|
|
39
|
+
/** Rust `discriminator_to_name` */
|
|
40
|
+
function discriminatorToName(discriminator) {
|
|
41
|
+
return NAME_BY_DISC.get(discriminator);
|
|
42
|
+
}
|
|
43
|
+
/** Rust `discriminator_to_protocol` */
|
|
44
|
+
function discriminatorToProtocol(discriminator) {
|
|
45
|
+
return PROTOCOL_BY_DISC.get(discriminator);
|
|
46
|
+
}
|
|
47
|
+
/** Rust `lookup_discriminator`(无 parser 函数指针;含 `protocol`) */
|
|
48
|
+
function lookupDiscriminator(discriminator) {
|
|
49
|
+
const name = NAME_BY_DISC.get(discriminator);
|
|
50
|
+
if (name === undefined)
|
|
51
|
+
return undefined;
|
|
52
|
+
const protocol = PROTOCOL_BY_DISC.get(discriminator);
|
|
53
|
+
if (protocol === undefined)
|
|
54
|
+
return undefined;
|
|
55
|
+
return { discriminator, name, protocol };
|
|
56
|
+
}
|
|
57
|
+
/** Rust `discriminator_to_name` */
|
|
58
|
+
exports.discriminator_to_name = discriminatorToName;
|
|
59
|
+
/** Rust `discriminator_to_protocol` */
|
|
60
|
+
exports.discriminator_to_protocol = discriminatorToProtocol;
|
|
61
|
+
/** Rust `lookup_discriminator` */
|
|
62
|
+
exports.lookup_discriminator = lookupDiscriminator;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EventMetadata } from "../core/metadata.js";
|
|
2
|
+
import type { DexEvent } from "../core/dex_event.js";
|
|
3
|
+
export declare function parseSwapFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
4
|
+
export declare function parseAddLiquidityFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
5
|
+
export declare function parseRemoveLiquidityFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
6
|
+
export declare function parseBootstrapLiquidityFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
7
|
+
export declare function parseSetPoolFeesFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
8
|
+
export declare function parsePoolCreatedFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSwapFromData = parseSwapFromData;
|
|
4
|
+
exports.parseAddLiquidityFromData = parseAddLiquidityFromData;
|
|
5
|
+
exports.parseRemoveLiquidityFromData = parseRemoveLiquidityFromData;
|
|
6
|
+
exports.parseBootstrapLiquidityFromData = parseBootstrapLiquidityFromData;
|
|
7
|
+
exports.parseSetPoolFeesFromData = parseSetPoolFeesFromData;
|
|
8
|
+
exports.parsePoolCreatedFromData = parsePoolCreatedFromData;
|
|
9
|
+
const binary_js_1 = require("../util/binary.js");
|
|
10
|
+
function bn64(v) {
|
|
11
|
+
return v ?? 0n;
|
|
12
|
+
}
|
|
13
|
+
function parseSwapFromData(data, metadata) {
|
|
14
|
+
let o = 0;
|
|
15
|
+
const in_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
16
|
+
o += 8;
|
|
17
|
+
const out_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
18
|
+
o += 8;
|
|
19
|
+
const trade_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
20
|
+
o += 8;
|
|
21
|
+
const admin_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
22
|
+
o += 8;
|
|
23
|
+
const host_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
24
|
+
const ev = { metadata, in_amount, out_amount, trade_fee, admin_fee, host_fee };
|
|
25
|
+
return { MeteoraPoolsSwap: ev };
|
|
26
|
+
}
|
|
27
|
+
function parseAddLiquidityFromData(data, metadata) {
|
|
28
|
+
let o = 0;
|
|
29
|
+
const lp_mint_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
30
|
+
o += 8;
|
|
31
|
+
const token_a_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
32
|
+
o += 8;
|
|
33
|
+
const token_b_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
34
|
+
const ev = { metadata, lp_mint_amount, token_a_amount, token_b_amount };
|
|
35
|
+
return { MeteoraPoolsAddLiquidity: ev };
|
|
36
|
+
}
|
|
37
|
+
function parseRemoveLiquidityFromData(data, metadata) {
|
|
38
|
+
let o = 0;
|
|
39
|
+
const lp_unmint_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
40
|
+
o += 8;
|
|
41
|
+
const token_a_out_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
42
|
+
o += 8;
|
|
43
|
+
const token_b_out_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
44
|
+
const ev = {
|
|
45
|
+
metadata,
|
|
46
|
+
lp_unmint_amount,
|
|
47
|
+
token_a_out_amount,
|
|
48
|
+
token_b_out_amount,
|
|
49
|
+
};
|
|
50
|
+
return { MeteoraPoolsRemoveLiquidity: ev };
|
|
51
|
+
}
|
|
52
|
+
function parseBootstrapLiquidityFromData(data, metadata) {
|
|
53
|
+
let o = 0;
|
|
54
|
+
const lp_mint_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
55
|
+
o += 8;
|
|
56
|
+
const token_a_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
57
|
+
o += 8;
|
|
58
|
+
const token_b_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
59
|
+
o += 8;
|
|
60
|
+
const pool = (0, binary_js_1.readPubkey)(data, o);
|
|
61
|
+
const ev = {
|
|
62
|
+
metadata,
|
|
63
|
+
lp_mint_amount,
|
|
64
|
+
token_a_amount,
|
|
65
|
+
token_b_amount,
|
|
66
|
+
pool,
|
|
67
|
+
};
|
|
68
|
+
return { MeteoraPoolsBootstrapLiquidity: ev };
|
|
69
|
+
}
|
|
70
|
+
function parseSetPoolFeesFromData(data, metadata) {
|
|
71
|
+
if (data.length < 8 + 8 + 8 + 8 + 32)
|
|
72
|
+
return null;
|
|
73
|
+
let o = 0;
|
|
74
|
+
const trade_fee_numerator = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
75
|
+
o += 8;
|
|
76
|
+
const trade_fee_denominator = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
77
|
+
o += 8;
|
|
78
|
+
const owner_trade_fee_numerator = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
79
|
+
o += 8;
|
|
80
|
+
const owner_trade_fee_denominator = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
81
|
+
o += 8;
|
|
82
|
+
const pool = (0, binary_js_1.readPubkey)(data, o);
|
|
83
|
+
const ev = {
|
|
84
|
+
metadata,
|
|
85
|
+
trade_fee_numerator,
|
|
86
|
+
trade_fee_denominator,
|
|
87
|
+
owner_trade_fee_numerator,
|
|
88
|
+
owner_trade_fee_denominator,
|
|
89
|
+
pool,
|
|
90
|
+
};
|
|
91
|
+
return { MeteoraPoolsSetPoolFees: ev };
|
|
92
|
+
}
|
|
93
|
+
function parsePoolCreatedFromData(data, metadata) {
|
|
94
|
+
let o = 0;
|
|
95
|
+
const lp_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
96
|
+
o += 32;
|
|
97
|
+
const token_a_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
98
|
+
o += 32;
|
|
99
|
+
const token_b_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
100
|
+
o += 32;
|
|
101
|
+
const pool_type = (0, binary_js_1.readU8)(data, o);
|
|
102
|
+
o += 1;
|
|
103
|
+
const pool = (0, binary_js_1.readPubkey)(data, o);
|
|
104
|
+
const ev = {
|
|
105
|
+
metadata,
|
|
106
|
+
lp_mint,
|
|
107
|
+
token_a_mint,
|
|
108
|
+
token_b_mint,
|
|
109
|
+
pool_type,
|
|
110
|
+
pool,
|
|
111
|
+
};
|
|
112
|
+
return { MeteoraPoolsPoolCreated: ev };
|
|
113
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DexEvent } from "../core/dex_event.js";
|
|
2
|
+
/**
|
|
3
|
+
* Meteora DAMM Program data 入口;与 Rust `logs/meteora_damm.rs` 一致。
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseMeteoraDammLog(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|