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,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fillPumpfunTradeAccounts = fillPumpfunTradeAccounts;
|
|
4
|
+
exports.fillPumpfunCreateAccounts = fillPumpfunCreateAccounts;
|
|
5
|
+
exports.fillPumpfunCreateV2Accounts = fillPumpfunCreateV2Accounts;
|
|
6
|
+
exports.fillPumpfunMigrateAccounts = fillPumpfunMigrateAccounts;
|
|
7
|
+
const dex_event_js_1 = require("./dex_event.js");
|
|
8
|
+
const Z = () => (0, dex_event_js_1.defaultPubkey)();
|
|
9
|
+
function fillPumpfunTradeAccounts(e, get) {
|
|
10
|
+
const zero = Z();
|
|
11
|
+
const accountAtMatchesMint = (idx) => Boolean(e.mint && e.mint !== zero && get(idx) === e.mint);
|
|
12
|
+
const set = (key, idx) => {
|
|
13
|
+
const current = e[key];
|
|
14
|
+
if (!current || current === zero) {
|
|
15
|
+
e[key] = get(idx);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const isV2 = e.ix_name === "buy_v2" ||
|
|
19
|
+
e.ix_name === "sell_v2" ||
|
|
20
|
+
e.ix_name === "buy_exact_quote_in_v2" ||
|
|
21
|
+
accountAtMatchesMint(1);
|
|
22
|
+
if (isV2) {
|
|
23
|
+
set("global", 0);
|
|
24
|
+
set("quote_mint", 2);
|
|
25
|
+
set("fee_recipient", 6);
|
|
26
|
+
set("bonding_curve", 10);
|
|
27
|
+
set("associated_bonding_curve", 11);
|
|
28
|
+
set("associated_quote_bonding_curve", 12);
|
|
29
|
+
set("user", 13);
|
|
30
|
+
set("associated_user", 14);
|
|
31
|
+
set("associated_quote_user", 15);
|
|
32
|
+
set("token_program", 3);
|
|
33
|
+
set("quote_token_program", 4);
|
|
34
|
+
set("associated_token_program", 5);
|
|
35
|
+
set("creator_vault", 16);
|
|
36
|
+
set("associated_quote_fee_recipient", 7);
|
|
37
|
+
set("buyback_fee_recipient", 8);
|
|
38
|
+
set("associated_quote_buyback_fee_recipient", 9);
|
|
39
|
+
set("associated_creator_vault", 17);
|
|
40
|
+
set("sharing_config", 18);
|
|
41
|
+
if (e.ix_name === "sell_v2" || (!e.is_buy && e.ix_name === "sell")) {
|
|
42
|
+
set("user_volume_accumulator", 19);
|
|
43
|
+
set("associated_user_volume_accumulator", 20);
|
|
44
|
+
set("fee_config", 21);
|
|
45
|
+
set("fee_program", 22);
|
|
46
|
+
set("system_program", 23);
|
|
47
|
+
set("event_authority", 24);
|
|
48
|
+
set("program", 25);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
set("global_volume_accumulator", 19);
|
|
52
|
+
set("user_volume_accumulator", 20);
|
|
53
|
+
set("associated_user_volume_accumulator", 21);
|
|
54
|
+
set("fee_config", 22);
|
|
55
|
+
set("fee_program", 23);
|
|
56
|
+
set("system_program", 24);
|
|
57
|
+
set("event_authority", 25);
|
|
58
|
+
set("program", 26);
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
set("global", 0);
|
|
63
|
+
set("fee_recipient", 1);
|
|
64
|
+
set("bonding_curve", 3);
|
|
65
|
+
set("associated_bonding_curve", 4);
|
|
66
|
+
set("associated_user", 5);
|
|
67
|
+
set("user", 6);
|
|
68
|
+
set("system_program", 7);
|
|
69
|
+
set("creator_vault", e.is_buy ? 9 : 8);
|
|
70
|
+
set("token_program", e.is_buy ? 8 : 9);
|
|
71
|
+
set("event_authority", 10);
|
|
72
|
+
set("program", 11);
|
|
73
|
+
if (e.is_buy) {
|
|
74
|
+
set("global_volume_accumulator", 12);
|
|
75
|
+
set("user_volume_accumulator", 13);
|
|
76
|
+
set("fee_config", 14);
|
|
77
|
+
set("fee_program", 15);
|
|
78
|
+
set("bonding_curve_v2", 16);
|
|
79
|
+
set("buyback_fee_recipient", 17);
|
|
80
|
+
const a17 = get(17);
|
|
81
|
+
if (a17 && a17 !== zero && e.account == null)
|
|
82
|
+
e.account = a17;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
set("fee_config", 12);
|
|
86
|
+
set("fee_program", 13);
|
|
87
|
+
const a16 = get(16);
|
|
88
|
+
if (a16 && a16 !== zero) {
|
|
89
|
+
set("user_volume_accumulator", 14);
|
|
90
|
+
set("bonding_curve_v2", 15);
|
|
91
|
+
set("buyback_fee_recipient", 16);
|
|
92
|
+
if (e.account == null)
|
|
93
|
+
e.account = a16;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (e.is_cashback_coin) {
|
|
97
|
+
set("user_volume_accumulator", 14);
|
|
98
|
+
set("bonding_curve_v2", 15);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
set("bonding_curve_v2", 14);
|
|
102
|
+
set("buyback_fee_recipient", 15);
|
|
103
|
+
const a15 = get(15);
|
|
104
|
+
if (a15 && a15 !== zero && e.account == null)
|
|
105
|
+
e.account = a15;
|
|
106
|
+
}
|
|
107
|
+
function fillPumpfunCreateAccounts(e, get) {
|
|
108
|
+
const zero = Z();
|
|
109
|
+
if (get(15) === "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P") {
|
|
110
|
+
fillPumpfunCreateV2Accounts(e, get);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (!e.mint || e.mint === zero)
|
|
114
|
+
e.mint = get(0);
|
|
115
|
+
if (!e.bonding_curve || e.bonding_curve === zero)
|
|
116
|
+
e.bonding_curve = get(2);
|
|
117
|
+
if (!e.user || e.user === zero)
|
|
118
|
+
e.user = get(7);
|
|
119
|
+
}
|
|
120
|
+
function fillPumpfunCreateV2Accounts(e, get) {
|
|
121
|
+
const zero = Z();
|
|
122
|
+
if (!e.mint || e.mint === zero)
|
|
123
|
+
e.mint = get(0);
|
|
124
|
+
if (!e.bonding_curve || e.bonding_curve === zero)
|
|
125
|
+
e.bonding_curve = get(2);
|
|
126
|
+
if (!e.user || e.user === zero)
|
|
127
|
+
e.user = get(5);
|
|
128
|
+
if (!e.mint_authority || e.mint_authority === zero)
|
|
129
|
+
e.mint_authority = get(1);
|
|
130
|
+
if (!e.associated_bonding_curve || e.associated_bonding_curve === zero) {
|
|
131
|
+
e.associated_bonding_curve = get(3);
|
|
132
|
+
}
|
|
133
|
+
if (!e.global || e.global === zero)
|
|
134
|
+
e.global = get(4);
|
|
135
|
+
if (!e.system_program || e.system_program === zero)
|
|
136
|
+
e.system_program = get(6);
|
|
137
|
+
if (!e.token_program || e.token_program === zero)
|
|
138
|
+
e.token_program = get(7);
|
|
139
|
+
if (!e.associated_token_program || e.associated_token_program === zero) {
|
|
140
|
+
e.associated_token_program = get(8);
|
|
141
|
+
}
|
|
142
|
+
if (!e.mayhem_program_id || e.mayhem_program_id === zero)
|
|
143
|
+
e.mayhem_program_id = get(9);
|
|
144
|
+
if (!e.global_params || e.global_params === zero)
|
|
145
|
+
e.global_params = get(10);
|
|
146
|
+
if (!e.sol_vault || e.sol_vault === zero)
|
|
147
|
+
e.sol_vault = get(11);
|
|
148
|
+
if (!e.mayhem_state || e.mayhem_state === zero)
|
|
149
|
+
e.mayhem_state = get(12);
|
|
150
|
+
if (!e.mayhem_token_vault || e.mayhem_token_vault === zero)
|
|
151
|
+
e.mayhem_token_vault = get(13);
|
|
152
|
+
if (!e.event_authority || e.event_authority === zero)
|
|
153
|
+
e.event_authority = get(14);
|
|
154
|
+
if (!e.program || e.program === zero)
|
|
155
|
+
e.program = get(15);
|
|
156
|
+
if (!e.quote_mint || e.quote_mint === zero || e.quote_mint === "So11111111111111111111111111111111111111111") {
|
|
157
|
+
e.quote_mint = get(16);
|
|
158
|
+
}
|
|
159
|
+
if (!e.quote_vault || e.quote_vault === zero)
|
|
160
|
+
e.quote_vault = get(17);
|
|
161
|
+
if (!e.quote_token_program || e.quote_token_program === zero)
|
|
162
|
+
e.quote_token_program = get(18);
|
|
163
|
+
if (!e.ix_name || e.ix_name === "create")
|
|
164
|
+
e.ix_name = "create_v2";
|
|
165
|
+
}
|
|
166
|
+
/** Migrate:占位,待 IDL 账户映射 */
|
|
167
|
+
function fillPumpfunMigrateAccounts(_e, _get) { }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** PumpSwap 账户填充 */
|
|
2
|
+
import type { PumpSwapBuyEvent, PumpSwapCreatePoolEvent, PumpSwapLiquidityAdded, PumpSwapLiquidityRemoved, PumpSwapSellEvent, PumpSwapTradeEvent } from "./dex_event.js";
|
|
3
|
+
export declare function fillPumpswapBuyAccounts(e: PumpSwapBuyEvent, get: (i: number) => string): void;
|
|
4
|
+
export declare function fillPumpswapSellAccounts(e: PumpSwapSellEvent, get: (i: number) => string): void;
|
|
5
|
+
export declare function fillPumpswapCreatePoolAccounts(e: PumpSwapCreatePoolEvent, get: (i: number) => string): void;
|
|
6
|
+
/** PumpSwapTrade:字段已由事件数据解析,不从账户表补 */
|
|
7
|
+
export declare function fillPumpswapTradeAccounts(_e: PumpSwapTradeEvent, _get: (i: number) => string): void;
|
|
8
|
+
/** 加/减流动性:占位(字段来自事件数据) */
|
|
9
|
+
export declare function fillPumpswapLiquidityAddedAccounts(_e: PumpSwapLiquidityAdded, _get: (i: number) => string): void;
|
|
10
|
+
export declare function fillPumpswapLiquidityRemovedAccounts(_e: PumpSwapLiquidityRemoved, _get: (i: number) => string): void;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fillPumpswapBuyAccounts = fillPumpswapBuyAccounts;
|
|
4
|
+
exports.fillPumpswapSellAccounts = fillPumpswapSellAccounts;
|
|
5
|
+
exports.fillPumpswapCreatePoolAccounts = fillPumpswapCreatePoolAccounts;
|
|
6
|
+
exports.fillPumpswapTradeAccounts = fillPumpswapTradeAccounts;
|
|
7
|
+
exports.fillPumpswapLiquidityAddedAccounts = fillPumpswapLiquidityAddedAccounts;
|
|
8
|
+
exports.fillPumpswapLiquidityRemovedAccounts = fillPumpswapLiquidityRemovedAccounts;
|
|
9
|
+
const dex_event_js_1 = require("./dex_event.js");
|
|
10
|
+
const Z = () => (0, dex_event_js_1.defaultPubkey)();
|
|
11
|
+
function fillPumpswapTradeCommon(e, get) {
|
|
12
|
+
const zero = Z();
|
|
13
|
+
if (!e.pool || e.pool === zero)
|
|
14
|
+
e.pool = get(0);
|
|
15
|
+
if (!e.user || e.user === zero)
|
|
16
|
+
e.user = get(1);
|
|
17
|
+
if (!e.base_mint || e.base_mint === zero)
|
|
18
|
+
e.base_mint = get(3);
|
|
19
|
+
if (!e.quote_mint || e.quote_mint === zero)
|
|
20
|
+
e.quote_mint = get(4);
|
|
21
|
+
if (!e.user_base_token_account || e.user_base_token_account === zero) {
|
|
22
|
+
e.user_base_token_account = get(5);
|
|
23
|
+
}
|
|
24
|
+
if (!e.user_quote_token_account || e.user_quote_token_account === zero) {
|
|
25
|
+
e.user_quote_token_account = get(6);
|
|
26
|
+
}
|
|
27
|
+
if (!e.pool_base_token_account || e.pool_base_token_account === zero) {
|
|
28
|
+
e.pool_base_token_account = get(7);
|
|
29
|
+
}
|
|
30
|
+
if (!e.pool_quote_token_account || e.pool_quote_token_account === zero) {
|
|
31
|
+
e.pool_quote_token_account = get(8);
|
|
32
|
+
}
|
|
33
|
+
if (!e.protocol_fee_recipient || e.protocol_fee_recipient === zero) {
|
|
34
|
+
e.protocol_fee_recipient = get(9);
|
|
35
|
+
}
|
|
36
|
+
if (!e.protocol_fee_recipient_token_account || e.protocol_fee_recipient_token_account === zero) {
|
|
37
|
+
e.protocol_fee_recipient_token_account = get(10);
|
|
38
|
+
}
|
|
39
|
+
if (!e.base_token_program || e.base_token_program === zero)
|
|
40
|
+
e.base_token_program = get(11);
|
|
41
|
+
if (!e.quote_token_program || e.quote_token_program === zero)
|
|
42
|
+
e.quote_token_program = get(12);
|
|
43
|
+
if (!e.coin_creator_vault_ata || e.coin_creator_vault_ata === zero)
|
|
44
|
+
e.coin_creator_vault_ata = get(17);
|
|
45
|
+
if (!e.coin_creator_vault_authority || e.coin_creator_vault_authority === zero) {
|
|
46
|
+
e.coin_creator_vault_authority = get(18);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function fillPumpswapBuyAccounts(e, get) {
|
|
50
|
+
fillPumpswapTradeCommon(e, get);
|
|
51
|
+
const zero = Z();
|
|
52
|
+
const a26 = get(26);
|
|
53
|
+
if (a26 && a26 !== zero) {
|
|
54
|
+
if (!e.pool_v2 || e.pool_v2 === zero)
|
|
55
|
+
e.pool_v2 = get(24);
|
|
56
|
+
if (!e.fee_recipient || e.fee_recipient === zero)
|
|
57
|
+
e.fee_recipient = get(25);
|
|
58
|
+
if (!e.fee_recipient_quote_token_account || e.fee_recipient_quote_token_account === zero) {
|
|
59
|
+
e.fee_recipient_quote_token_account = a26;
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const a25 = get(25);
|
|
64
|
+
if (a25 && a25 !== zero) {
|
|
65
|
+
if (!e.pool_v2 || e.pool_v2 === zero)
|
|
66
|
+
e.pool_v2 = get(23);
|
|
67
|
+
if (!e.fee_recipient || e.fee_recipient === zero)
|
|
68
|
+
e.fee_recipient = get(24);
|
|
69
|
+
if (!e.fee_recipient_quote_token_account || e.fee_recipient_quote_token_account === zero) {
|
|
70
|
+
e.fee_recipient_quote_token_account = a25;
|
|
71
|
+
}
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!e.pool_v2 || e.pool_v2 === zero)
|
|
75
|
+
e.pool_v2 = get(23);
|
|
76
|
+
}
|
|
77
|
+
function fillPumpswapSellAccounts(e, get) {
|
|
78
|
+
fillPumpswapTradeCommon(e, get);
|
|
79
|
+
const zero = Z();
|
|
80
|
+
const a25 = get(25);
|
|
81
|
+
if (a25 && a25 !== zero) {
|
|
82
|
+
if (!e.pool_v2 || e.pool_v2 === zero)
|
|
83
|
+
e.pool_v2 = get(23);
|
|
84
|
+
if (!e.fee_recipient || e.fee_recipient === zero)
|
|
85
|
+
e.fee_recipient = get(24);
|
|
86
|
+
if (!e.fee_recipient_quote_token_account || e.fee_recipient_quote_token_account === zero) {
|
|
87
|
+
e.fee_recipient_quote_token_account = a25;
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const a23 = get(23);
|
|
92
|
+
if (a23 && a23 !== zero) {
|
|
93
|
+
if (!e.pool_v2 || e.pool_v2 === zero)
|
|
94
|
+
e.pool_v2 = get(21);
|
|
95
|
+
if (!e.fee_recipient || e.fee_recipient === zero)
|
|
96
|
+
e.fee_recipient = get(22);
|
|
97
|
+
if (!e.fee_recipient_quote_token_account || e.fee_recipient_quote_token_account === zero) {
|
|
98
|
+
e.fee_recipient_quote_token_account = a23;
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (!e.pool_v2 || e.pool_v2 === zero)
|
|
103
|
+
e.pool_v2 = get(21);
|
|
104
|
+
}
|
|
105
|
+
function fillPumpswapCreatePoolAccounts(e, get) {
|
|
106
|
+
const zero = Z();
|
|
107
|
+
if (!e.pool || e.pool === zero)
|
|
108
|
+
e.pool = get(0);
|
|
109
|
+
if (!e.creator || e.creator === zero)
|
|
110
|
+
e.creator = get(2);
|
|
111
|
+
if (!e.base_mint || e.base_mint === zero)
|
|
112
|
+
e.base_mint = get(3);
|
|
113
|
+
if (!e.quote_mint || e.quote_mint === zero)
|
|
114
|
+
e.quote_mint = get(4);
|
|
115
|
+
if (!e.lp_mint || e.lp_mint === zero)
|
|
116
|
+
e.lp_mint = get(5);
|
|
117
|
+
if (!e.user_base_token_account || e.user_base_token_account === zero) {
|
|
118
|
+
e.user_base_token_account = get(6);
|
|
119
|
+
}
|
|
120
|
+
if (!e.user_quote_token_account || e.user_quote_token_account === zero) {
|
|
121
|
+
e.user_quote_token_account = get(7);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** PumpSwapTrade:字段已由事件数据解析,不从账户表补 */
|
|
125
|
+
function fillPumpswapTradeAccounts(_e, _get) { }
|
|
126
|
+
/** 加/减流动性:占位(字段来自事件数据) */
|
|
127
|
+
function fillPumpswapLiquidityAddedAccounts(_e, _get) { }
|
|
128
|
+
function fillPumpswapLiquidityRemovedAccounts(_e, _get) { }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Raydium CLMM / CPMM / AMM V4 账户填充(字符串公钥) */
|
|
2
|
+
import type { RaydiumAmmV4DepositEvent, RaydiumAmmV4SwapEvent, RaydiumAmmV4WithdrawEvent, RaydiumClmmClosePositionEvent, RaydiumClmmCreatePoolEvent, RaydiumClmmDecreaseLiquidityEvent, RaydiumClmmIncreaseLiquidityEvent, RaydiumClmmOpenPositionEvent, RaydiumClmmOpenPositionWithTokenExtNftEvent, RaydiumClmmSwapEvent, RaydiumCpmmDepositEvent, RaydiumCpmmInitializeEvent, RaydiumCpmmSwapEvent, RaydiumCpmmWithdrawEvent } from "./dex_event.js";
|
|
3
|
+
export declare function fillRaydiumClmmSwapAccounts(e: RaydiumClmmSwapEvent, get: (i: number) => string): void;
|
|
4
|
+
export declare function fillRaydiumClmmCreatePoolAccounts(e: RaydiumClmmCreatePoolEvent, get: (i: number) => string): void;
|
|
5
|
+
export declare function fillRaydiumClmmOpenPositionAccounts(e: RaydiumClmmOpenPositionEvent, get: (i: number) => string): void;
|
|
6
|
+
/**
|
|
7
|
+
* `fill_clmm_open_position_accounts` 账户索引相同(openPosition / token-ext 变体共用 IDL 布局)。
|
|
8
|
+
* 参考实现未对该 `DexEvent` 变体做账户调度;本包在 RPC 路径补全。
|
|
9
|
+
*/
|
|
10
|
+
export declare function fillRaydiumClmmOpenPositionWithTokenExtNftAccounts(e: RaydiumClmmOpenPositionWithTokenExtNftEvent, get: (i: number) => string): void;
|
|
11
|
+
export declare function fillRaydiumClmmClosePositionAccounts(e: RaydiumClmmClosePositionEvent, get: (i: number) => string): void;
|
|
12
|
+
export declare function fillRaydiumClmmIncreaseLiquidityAccounts(e: RaydiumClmmIncreaseLiquidityEvent, get: (i: number) => string): void;
|
|
13
|
+
export declare function fillRaydiumClmmDecreaseLiquidityAccounts(e: RaydiumClmmDecreaseLiquidityEvent, get: (i: number) => string): void;
|
|
14
|
+
export declare function fillRaydiumCpmmSwapAccounts(_e: RaydiumCpmmSwapEvent, _get: (i: number) => string): void;
|
|
15
|
+
export declare function fillRaydiumCpmmDepositAccounts(e: RaydiumCpmmDepositEvent, get: (i: number) => string): void;
|
|
16
|
+
export declare function fillRaydiumCpmmWithdrawAccounts(e: RaydiumCpmmWithdrawEvent, get: (i: number) => string): void;
|
|
17
|
+
export declare function fillRaydiumCpmmInitializeAccounts(e: RaydiumCpmmInitializeEvent, get: (i: number) => string): void;
|
|
18
|
+
export declare function fillRaydiumAmmV4SwapAccounts(e: RaydiumAmmV4SwapEvent, get: (i: number) => string): void;
|
|
19
|
+
export declare function fillRaydiumAmmV4DepositAccounts(e: RaydiumAmmV4DepositEvent, get: (i: number) => string): void;
|
|
20
|
+
export declare function fillRaydiumAmmV4WithdrawAccounts(e: RaydiumAmmV4WithdrawEvent, get: (i: number) => string): void;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fillRaydiumClmmSwapAccounts = fillRaydiumClmmSwapAccounts;
|
|
4
|
+
exports.fillRaydiumClmmCreatePoolAccounts = fillRaydiumClmmCreatePoolAccounts;
|
|
5
|
+
exports.fillRaydiumClmmOpenPositionAccounts = fillRaydiumClmmOpenPositionAccounts;
|
|
6
|
+
exports.fillRaydiumClmmOpenPositionWithTokenExtNftAccounts = fillRaydiumClmmOpenPositionWithTokenExtNftAccounts;
|
|
7
|
+
exports.fillRaydiumClmmClosePositionAccounts = fillRaydiumClmmClosePositionAccounts;
|
|
8
|
+
exports.fillRaydiumClmmIncreaseLiquidityAccounts = fillRaydiumClmmIncreaseLiquidityAccounts;
|
|
9
|
+
exports.fillRaydiumClmmDecreaseLiquidityAccounts = fillRaydiumClmmDecreaseLiquidityAccounts;
|
|
10
|
+
exports.fillRaydiumCpmmSwapAccounts = fillRaydiumCpmmSwapAccounts;
|
|
11
|
+
exports.fillRaydiumCpmmDepositAccounts = fillRaydiumCpmmDepositAccounts;
|
|
12
|
+
exports.fillRaydiumCpmmWithdrawAccounts = fillRaydiumCpmmWithdrawAccounts;
|
|
13
|
+
exports.fillRaydiumCpmmInitializeAccounts = fillRaydiumCpmmInitializeAccounts;
|
|
14
|
+
exports.fillRaydiumAmmV4SwapAccounts = fillRaydiumAmmV4SwapAccounts;
|
|
15
|
+
exports.fillRaydiumAmmV4DepositAccounts = fillRaydiumAmmV4DepositAccounts;
|
|
16
|
+
exports.fillRaydiumAmmV4WithdrawAccounts = fillRaydiumAmmV4WithdrawAccounts;
|
|
17
|
+
const dex_event_js_1 = require("./dex_event.js");
|
|
18
|
+
const Z = () => (0, dex_event_js_1.defaultPubkey)();
|
|
19
|
+
function fillRaydiumClmmSwapAccounts(e, get) {
|
|
20
|
+
const zero = Z();
|
|
21
|
+
if (!e.pool_state || e.pool_state === zero)
|
|
22
|
+
e.pool_state = get(2);
|
|
23
|
+
if (!e.sender || e.sender === zero)
|
|
24
|
+
e.sender = get(0);
|
|
25
|
+
}
|
|
26
|
+
function fillRaydiumClmmCreatePoolAccounts(e, get) {
|
|
27
|
+
const zero = Z();
|
|
28
|
+
if (!e.creator || e.creator === zero)
|
|
29
|
+
e.creator = get(0);
|
|
30
|
+
}
|
|
31
|
+
function fillRaydiumClmmOpenPositionAccounts(e, get) {
|
|
32
|
+
const zero = Z();
|
|
33
|
+
if (!e.user || e.user === zero)
|
|
34
|
+
e.user = get(0);
|
|
35
|
+
if (!e.position_nft_mint || e.position_nft_mint === zero)
|
|
36
|
+
e.position_nft_mint = get(2);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* `fill_clmm_open_position_accounts` 账户索引相同(openPosition / token-ext 变体共用 IDL 布局)。
|
|
40
|
+
* 参考实现未对该 `DexEvent` 变体做账户调度;本包在 RPC 路径补全。
|
|
41
|
+
*/
|
|
42
|
+
function fillRaydiumClmmOpenPositionWithTokenExtNftAccounts(e, get) {
|
|
43
|
+
const zero = Z();
|
|
44
|
+
if (!e.user || e.user === zero)
|
|
45
|
+
e.user = get(0);
|
|
46
|
+
if (!e.position_nft_mint || e.position_nft_mint === zero)
|
|
47
|
+
e.position_nft_mint = get(2);
|
|
48
|
+
}
|
|
49
|
+
function fillRaydiumClmmClosePositionAccounts(e, get) {
|
|
50
|
+
const zero = Z();
|
|
51
|
+
if (!e.user || e.user === zero)
|
|
52
|
+
e.user = get(0);
|
|
53
|
+
if (!e.position_nft_mint || e.position_nft_mint === zero)
|
|
54
|
+
e.position_nft_mint = get(1);
|
|
55
|
+
}
|
|
56
|
+
function fillRaydiumClmmIncreaseLiquidityAccounts(e, get) {
|
|
57
|
+
const zero = Z();
|
|
58
|
+
if (!e.user || e.user === zero)
|
|
59
|
+
e.user = get(0);
|
|
60
|
+
}
|
|
61
|
+
function fillRaydiumClmmDecreaseLiquidityAccounts(e, get) {
|
|
62
|
+
const zero = Z();
|
|
63
|
+
if (!e.user || e.user === zero)
|
|
64
|
+
e.user = get(0);
|
|
65
|
+
}
|
|
66
|
+
function fillRaydiumCpmmSwapAccounts(_e, _get) { }
|
|
67
|
+
function fillRaydiumCpmmDepositAccounts(e, get) {
|
|
68
|
+
const zero = Z();
|
|
69
|
+
if (!e.user || e.user === zero)
|
|
70
|
+
e.user = get(0);
|
|
71
|
+
}
|
|
72
|
+
function fillRaydiumCpmmWithdrawAccounts(e, get) {
|
|
73
|
+
const zero = Z();
|
|
74
|
+
if (!e.user || e.user === zero)
|
|
75
|
+
e.user = get(0);
|
|
76
|
+
}
|
|
77
|
+
function fillRaydiumCpmmInitializeAccounts(e, get) {
|
|
78
|
+
const zero = Z();
|
|
79
|
+
if (!e.creator || e.creator === zero)
|
|
80
|
+
e.creator = get(0);
|
|
81
|
+
if (!e.pool || e.pool === zero)
|
|
82
|
+
e.pool = get(3);
|
|
83
|
+
}
|
|
84
|
+
function fillRaydiumAmmV4SwapAccounts(e, get) {
|
|
85
|
+
const zero = Z();
|
|
86
|
+
if (!e.amm || e.amm === zero)
|
|
87
|
+
e.amm = get(1);
|
|
88
|
+
}
|
|
89
|
+
function fillRaydiumAmmV4DepositAccounts(e, get) {
|
|
90
|
+
const zero = Z();
|
|
91
|
+
if (!e.token_program || e.token_program === zero)
|
|
92
|
+
e.token_program = get(0);
|
|
93
|
+
if (!e.amm_authority || e.amm_authority === zero)
|
|
94
|
+
e.amm_authority = get(2);
|
|
95
|
+
}
|
|
96
|
+
function fillRaydiumAmmV4WithdrawAccounts(e, get) {
|
|
97
|
+
const zero = Z();
|
|
98
|
+
if (!e.token_program || e.token_program === zero)
|
|
99
|
+
e.token_program = get(0);
|
|
100
|
+
if (!e.amm_authority || e.amm_authority === zero)
|
|
101
|
+
e.amm_authority = get(2);
|
|
102
|
+
if (!e.amm_open_orders || e.amm_open_orders === zero)
|
|
103
|
+
e.amm_open_orders = get(3);
|
|
104
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** RaydiumLaunchlab(LaunchLab)账户填充 */
|
|
2
|
+
import type { RaydiumLaunchlabPoolCreateEvent, RaydiumLaunchlabTradeEvent } from "./dex_event.js";
|
|
3
|
+
export declare function fillRaydiumLaunchlabTradeAccounts(e: RaydiumLaunchlabTradeEvent, get: (i: number) => string): void;
|
|
4
|
+
export declare function fillRaydiumLaunchlabPoolCreateAccounts(e: RaydiumLaunchlabPoolCreateEvent, get: (i: number) => string): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fillRaydiumLaunchlabTradeAccounts = fillRaydiumLaunchlabTradeAccounts;
|
|
4
|
+
exports.fillRaydiumLaunchlabPoolCreateAccounts = fillRaydiumLaunchlabPoolCreateAccounts;
|
|
5
|
+
const dex_event_js_1 = require("./dex_event.js");
|
|
6
|
+
const Z = () => (0, dex_event_js_1.defaultPubkey)();
|
|
7
|
+
function fillRaydiumLaunchlabTradeAccounts(e, get) {
|
|
8
|
+
const zero = Z();
|
|
9
|
+
if (!e.user || e.user === zero)
|
|
10
|
+
e.user = get(0);
|
|
11
|
+
if (!e.pool_state || e.pool_state === zero)
|
|
12
|
+
e.pool_state = get(4);
|
|
13
|
+
}
|
|
14
|
+
function fillRaydiumLaunchlabPoolCreateAccounts(e, get) {
|
|
15
|
+
const zero = Z();
|
|
16
|
+
if (!e.pool_state || e.pool_state === zero)
|
|
17
|
+
e.pool_state = get(5);
|
|
18
|
+
if (!e.creator || e.creator === zero)
|
|
19
|
+
e.creator = get(1);
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 与 Rust `sol-parser-sdk/src/core/cache.rs` 对齐:账户公钥索引解析缓存。
|
|
3
|
+
* JS 主线程单线程,使用模块级单例代替 Rust `thread_local`。
|
|
4
|
+
*/
|
|
5
|
+
import { PublicKey } from "@solana/web3.js";
|
|
6
|
+
export declare class AccountPubkeyCache {
|
|
7
|
+
private readonly cache;
|
|
8
|
+
/** 与 Rust `AccountPubkeyCache::build_account_pubkeys` 一致 */
|
|
9
|
+
buildAccountPubkeys(instructionAccounts: Uint8Array | readonly number[], allAccounts: readonly PublicKey[]): PublicKey[];
|
|
10
|
+
}
|
|
11
|
+
/** 与 Rust `build_account_pubkeys_with_cache` 一致(返回 `Vec` 拷贝,与 Rust `.to_vec()` 相同) */
|
|
12
|
+
export declare function buildAccountPubkeysWithCache(instructionAccounts: Uint8Array | readonly number[], allAccounts: readonly PublicKey[]): PublicKey[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountPubkeyCache = void 0;
|
|
4
|
+
exports.buildAccountPubkeysWithCache = buildAccountPubkeysWithCache;
|
|
5
|
+
class AccountPubkeyCache {
|
|
6
|
+
cache = [];
|
|
7
|
+
/** 与 Rust `AccountPubkeyCache::build_account_pubkeys` 一致 */
|
|
8
|
+
buildAccountPubkeys(instructionAccounts, allAccounts) {
|
|
9
|
+
this.cache.length = 0;
|
|
10
|
+
for (let i = 0; i < instructionAccounts.length; i++) {
|
|
11
|
+
const idx = instructionAccounts[i];
|
|
12
|
+
if (idx < allAccounts.length) {
|
|
13
|
+
this.cache.push(allAccounts[idx]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return this.cache;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.AccountPubkeyCache = AccountPubkeyCache;
|
|
20
|
+
let threadLocalLike;
|
|
21
|
+
/** 与 Rust `build_account_pubkeys_with_cache` 一致(返回 `Vec` 拷贝,与 Rust `.to_vec()` 相同) */
|
|
22
|
+
function buildAccountPubkeysWithCache(instructionAccounts, allAccounts) {
|
|
23
|
+
if (!threadLocalLike)
|
|
24
|
+
threadLocalLike = new AccountPubkeyCache();
|
|
25
|
+
return [...threadLocalLike.buildAccountPubkeys(instructionAccounts, allAccounts)];
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** 当前时间微秒戳(用于 `grpc_recv_us`) */
|
|
2
|
+
export declare function nowUs(): number;
|
|
3
|
+
/** 与 Rust `now_micros` 一致(别名) */
|
|
4
|
+
export declare const nowMicros: typeof nowUs;
|
|
5
|
+
/** 与 Rust `now_nanos` 同语义:墙钟纳秒(`Date` 精度为毫秒,纳秒位为推算值) */
|
|
6
|
+
export declare function nowNanos(): bigint;
|
|
7
|
+
/** 与 Rust `elapsed_micros_since` 一致 */
|
|
8
|
+
export declare function elapsedMicrosSince(startUs: number): number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nowMicros = void 0;
|
|
4
|
+
exports.nowUs = nowUs;
|
|
5
|
+
exports.nowNanos = nowNanos;
|
|
6
|
+
exports.elapsedMicrosSince = elapsedMicrosSince;
|
|
7
|
+
/** 当前时间微秒戳(用于 `grpc_recv_us`) */
|
|
8
|
+
function nowUs() {
|
|
9
|
+
return Math.floor(Date.now() * 1000);
|
|
10
|
+
}
|
|
11
|
+
/** 与 Rust `now_micros` 一致(别名) */
|
|
12
|
+
exports.nowMicros = nowUs;
|
|
13
|
+
/** 与 Rust `now_nanos` 同语义:墙钟纳秒(`Date` 精度为毫秒,纳秒位为推算值) */
|
|
14
|
+
function nowNanos() {
|
|
15
|
+
return BigInt(Math.floor(Date.now() * 1_000_000));
|
|
16
|
+
}
|
|
17
|
+
/** 与 Rust `elapsed_micros_since` 一致 */
|
|
18
|
+
function elapsedMicrosSince(startUs) {
|
|
19
|
+
return nowUs() - startUs;
|
|
20
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** RPC / web3 路径补充字段(如 PumpSwap fees 指令 → `is_pump_pool`) */
|
|
2
|
+
import type { DexEvent } from "./dex_event.js";
|
|
3
|
+
import type { InvokePair } from "./rpc_invoke_map.js";
|
|
4
|
+
import type { Message, MessageV0 } from "@solana/web3.js";
|
|
5
|
+
import type { ConfirmedTransactionMeta } from "@solana/web3.js";
|
|
6
|
+
export declare function fillDataRpc(ev: DexEvent, message: Message | MessageV0, meta: ConfirmedTransactionMeta | null, programInvokes: Map<string, InvokePair[]>): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fillDataRpc = fillDataRpc;
|
|
4
|
+
const program_ids_js_1 = require("../instr/program_ids.js");
|
|
5
|
+
const rpc_invoke_map_js_1 = require("./rpc_invoke_map.js");
|
|
6
|
+
function fillDataRpc(ev, message, meta, programInvokes) {
|
|
7
|
+
const list = programInvokes.get(program_ids_js_1.PUMPSWAP_FEES_PROGRAM_ID);
|
|
8
|
+
const last = list?.[list.length - 1];
|
|
9
|
+
if (!last)
|
|
10
|
+
return;
|
|
11
|
+
const data = (0, rpc_invoke_map_js_1.getInstructionDataBytes)(message, meta, last);
|
|
12
|
+
if (!data || data.length <= 9)
|
|
13
|
+
return;
|
|
14
|
+
const isPumpPool = data[9] !== 0;
|
|
15
|
+
if ("PumpSwapBuy" in ev) {
|
|
16
|
+
ev.PumpSwapBuy.is_pump_pool = isPumpPool;
|
|
17
|
+
}
|
|
18
|
+
else if ("PumpSwapSell" in ev) {
|
|
19
|
+
ev.PumpSwapSell.is_pump_pool = isPumpPool;
|
|
20
|
+
}
|
|
21
|
+
}
|