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,624 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSwapFromData = parseSwapFromData;
|
|
4
|
+
exports.parseIncreaseLiquidityFromData = parseIncreaseLiquidityFromData;
|
|
5
|
+
exports.parseDecreaseLiquidityFromData = parseDecreaseLiquidityFromData;
|
|
6
|
+
exports.parseCreatePoolFromData = parseCreatePoolFromData;
|
|
7
|
+
exports.parseCollectPersonalFeeFromData = parseCollectPersonalFeeFromData;
|
|
8
|
+
exports.parseCollectProtocolFeeFromData = parseCollectProtocolFeeFromData;
|
|
9
|
+
exports.parseLiquidityChangeFromData = parseLiquidityChangeFromData;
|
|
10
|
+
exports.parseConfigChangeFromData = parseConfigChangeFromData;
|
|
11
|
+
exports.parseCreatePersonalPositionFromData = parseCreatePersonalPositionFromData;
|
|
12
|
+
exports.parseLiquidityCalculateFromData = parseLiquidityCalculateFromData;
|
|
13
|
+
exports.parseOpenLimitOrderFromData = parseOpenLimitOrderFromData;
|
|
14
|
+
exports.parseIncreaseLimitOrderFromData = parseIncreaseLimitOrderFromData;
|
|
15
|
+
exports.parseDecreaseLimitOrderFromData = parseDecreaseLimitOrderFromData;
|
|
16
|
+
exports.parseSettleLimitOrderFromData = parseSettleLimitOrderFromData;
|
|
17
|
+
exports.parseUpdateRewardInfosFromData = parseUpdateRewardInfosFromData;
|
|
18
|
+
const dex_event_js_1 = require("../core/dex_event.js");
|
|
19
|
+
const binary_js_1 = require("../util/binary.js");
|
|
20
|
+
function bn64(v) {
|
|
21
|
+
return v ?? 0n;
|
|
22
|
+
}
|
|
23
|
+
function parseSwapFromData(data, metadata) {
|
|
24
|
+
let o = 0;
|
|
25
|
+
const pool_state = (0, binary_js_1.readPubkey)(data, o);
|
|
26
|
+
if (!pool_state)
|
|
27
|
+
return null;
|
|
28
|
+
o += 32;
|
|
29
|
+
const sender = (0, binary_js_1.readPubkey)(data, o);
|
|
30
|
+
if (!sender)
|
|
31
|
+
return null;
|
|
32
|
+
o += 32;
|
|
33
|
+
const token_account_0 = (0, binary_js_1.readPubkey)(data, o);
|
|
34
|
+
if (!token_account_0)
|
|
35
|
+
return null;
|
|
36
|
+
o += 32;
|
|
37
|
+
const token_account_1 = (0, binary_js_1.readPubkey)(data, o);
|
|
38
|
+
if (!token_account_1)
|
|
39
|
+
return null;
|
|
40
|
+
o += 32;
|
|
41
|
+
const amount_0 = (0, binary_js_1.readU64LE)(data, o);
|
|
42
|
+
if (amount_0 === null)
|
|
43
|
+
return null;
|
|
44
|
+
o += 8;
|
|
45
|
+
const transfer_fee_0 = (0, binary_js_1.readU64LE)(data, o);
|
|
46
|
+
if (transfer_fee_0 === null)
|
|
47
|
+
return null;
|
|
48
|
+
o += 8;
|
|
49
|
+
const amount_1 = (0, binary_js_1.readU64LE)(data, o);
|
|
50
|
+
if (amount_1 === null)
|
|
51
|
+
return null;
|
|
52
|
+
o += 8;
|
|
53
|
+
const transfer_fee_1 = (0, binary_js_1.readU64LE)(data, o);
|
|
54
|
+
if (transfer_fee_1 === null)
|
|
55
|
+
return null;
|
|
56
|
+
o += 8;
|
|
57
|
+
const zero_for_one = (0, binary_js_1.readBool)(data, o);
|
|
58
|
+
if (zero_for_one === null)
|
|
59
|
+
return null;
|
|
60
|
+
o += 1;
|
|
61
|
+
const sqrt_price_x64 = (0, binary_js_1.readU128LE)(data, o);
|
|
62
|
+
if (sqrt_price_x64 === null)
|
|
63
|
+
return null;
|
|
64
|
+
o += 16;
|
|
65
|
+
const liquidity = (0, binary_js_1.readU128LE)(data, o);
|
|
66
|
+
if (liquidity === null)
|
|
67
|
+
return null;
|
|
68
|
+
o += 16;
|
|
69
|
+
const tick = (0, binary_js_1.readI32LE)(data, o);
|
|
70
|
+
if (tick === null)
|
|
71
|
+
return null;
|
|
72
|
+
const ev = {
|
|
73
|
+
metadata,
|
|
74
|
+
pool_state,
|
|
75
|
+
token_account_0,
|
|
76
|
+
token_account_1,
|
|
77
|
+
amount_0,
|
|
78
|
+
amount_1,
|
|
79
|
+
zero_for_one,
|
|
80
|
+
sqrt_price_x64,
|
|
81
|
+
liquidity,
|
|
82
|
+
sender,
|
|
83
|
+
transfer_fee_0,
|
|
84
|
+
transfer_fee_1,
|
|
85
|
+
tick,
|
|
86
|
+
};
|
|
87
|
+
return { RaydiumClmmSwap: ev };
|
|
88
|
+
}
|
|
89
|
+
function parseIncreaseLiquidityFromData(data, metadata) {
|
|
90
|
+
let o = 0;
|
|
91
|
+
const position_nft_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
92
|
+
if (!position_nft_mint)
|
|
93
|
+
return null;
|
|
94
|
+
o += 32;
|
|
95
|
+
const liquidity = (0, binary_js_1.readU128LE)(data, o);
|
|
96
|
+
if (liquidity === null)
|
|
97
|
+
return null;
|
|
98
|
+
o += 16;
|
|
99
|
+
const amount_0 = (0, binary_js_1.readU64LE)(data, o);
|
|
100
|
+
if (amount_0 === null)
|
|
101
|
+
return null;
|
|
102
|
+
o += 8;
|
|
103
|
+
const amount_1 = (0, binary_js_1.readU64LE)(data, o);
|
|
104
|
+
if (amount_1 === null)
|
|
105
|
+
return null;
|
|
106
|
+
o += 8;
|
|
107
|
+
const amount_0_transfer_fee = (0, binary_js_1.readU64LE)(data, o);
|
|
108
|
+
if (amount_0_transfer_fee === null)
|
|
109
|
+
return null;
|
|
110
|
+
o += 8;
|
|
111
|
+
const amount_1_transfer_fee = (0, binary_js_1.readU64LE)(data, o);
|
|
112
|
+
if (amount_1_transfer_fee === null)
|
|
113
|
+
return null;
|
|
114
|
+
const ev = {
|
|
115
|
+
metadata,
|
|
116
|
+
pool: (0, dex_event_js_1.defaultPubkey)(),
|
|
117
|
+
position_nft_mint,
|
|
118
|
+
user: (0, dex_event_js_1.defaultPubkey)(),
|
|
119
|
+
liquidity,
|
|
120
|
+
amount_0,
|
|
121
|
+
amount_1,
|
|
122
|
+
amount_0_transfer_fee,
|
|
123
|
+
amount_1_transfer_fee,
|
|
124
|
+
amount0_max: 0n,
|
|
125
|
+
amount1_max: 0n,
|
|
126
|
+
};
|
|
127
|
+
return { RaydiumClmmIncreaseLiquidity: ev };
|
|
128
|
+
}
|
|
129
|
+
function parseDecreaseLiquidityFromData(data, metadata) {
|
|
130
|
+
let o = 0;
|
|
131
|
+
const position_nft_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
132
|
+
if (!position_nft_mint)
|
|
133
|
+
return null;
|
|
134
|
+
o += 32;
|
|
135
|
+
const liquidity = (0, binary_js_1.readU128LE)(data, o);
|
|
136
|
+
if (liquidity === null)
|
|
137
|
+
return null;
|
|
138
|
+
o += 16;
|
|
139
|
+
const decrease_amount_0 = (0, binary_js_1.readU64LE)(data, o);
|
|
140
|
+
if (decrease_amount_0 === null)
|
|
141
|
+
return null;
|
|
142
|
+
o += 8;
|
|
143
|
+
const decrease_amount_1 = (0, binary_js_1.readU64LE)(data, o);
|
|
144
|
+
if (decrease_amount_1 === null)
|
|
145
|
+
return null;
|
|
146
|
+
o += 8;
|
|
147
|
+
const fee_amount_0 = (0, binary_js_1.readU64LE)(data, o);
|
|
148
|
+
if (fee_amount_0 === null)
|
|
149
|
+
return null;
|
|
150
|
+
o += 8;
|
|
151
|
+
const fee_amount_1 = (0, binary_js_1.readU64LE)(data, o);
|
|
152
|
+
if (fee_amount_1 === null)
|
|
153
|
+
return null;
|
|
154
|
+
o += 8;
|
|
155
|
+
const reward_amount_0 = (0, binary_js_1.readU64LE)(data, o);
|
|
156
|
+
if (reward_amount_0 === null)
|
|
157
|
+
return null;
|
|
158
|
+
o += 8;
|
|
159
|
+
const reward_amount_1 = (0, binary_js_1.readU64LE)(data, o);
|
|
160
|
+
if (reward_amount_1 === null)
|
|
161
|
+
return null;
|
|
162
|
+
o += 8;
|
|
163
|
+
const reward_amount_2 = (0, binary_js_1.readU64LE)(data, o);
|
|
164
|
+
if (reward_amount_2 === null)
|
|
165
|
+
return null;
|
|
166
|
+
o += 8;
|
|
167
|
+
const transfer_fee_0 = (0, binary_js_1.readU64LE)(data, o);
|
|
168
|
+
if (transfer_fee_0 === null)
|
|
169
|
+
return null;
|
|
170
|
+
o += 8;
|
|
171
|
+
const transfer_fee_1 = (0, binary_js_1.readU64LE)(data, o);
|
|
172
|
+
if (transfer_fee_1 === null)
|
|
173
|
+
return null;
|
|
174
|
+
const ev = {
|
|
175
|
+
metadata,
|
|
176
|
+
pool: (0, dex_event_js_1.defaultPubkey)(),
|
|
177
|
+
position_nft_mint,
|
|
178
|
+
user: (0, dex_event_js_1.defaultPubkey)(),
|
|
179
|
+
liquidity,
|
|
180
|
+
decrease_amount_0,
|
|
181
|
+
decrease_amount_1,
|
|
182
|
+
fee_amount_0,
|
|
183
|
+
fee_amount_1,
|
|
184
|
+
reward_amounts: [reward_amount_0, reward_amount_1, reward_amount_2],
|
|
185
|
+
transfer_fee_0,
|
|
186
|
+
transfer_fee_1,
|
|
187
|
+
amount0_min: 0n,
|
|
188
|
+
amount1_min: 0n,
|
|
189
|
+
};
|
|
190
|
+
return { RaydiumClmmDecreaseLiquidity: ev };
|
|
191
|
+
}
|
|
192
|
+
function parseCreatePoolFromData(data, metadata) {
|
|
193
|
+
let o = 0;
|
|
194
|
+
const token_0_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
195
|
+
if (!token_0_mint)
|
|
196
|
+
return null;
|
|
197
|
+
o += 32;
|
|
198
|
+
const token_1_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
199
|
+
if (!token_1_mint)
|
|
200
|
+
return null;
|
|
201
|
+
o += 32;
|
|
202
|
+
const tick_spacing = (0, binary_js_1.readU16LE)(data, o);
|
|
203
|
+
if (tick_spacing === null)
|
|
204
|
+
return null;
|
|
205
|
+
o += 2;
|
|
206
|
+
const pool = (0, binary_js_1.readPubkey)(data, o);
|
|
207
|
+
if (!pool)
|
|
208
|
+
return null;
|
|
209
|
+
o += 32;
|
|
210
|
+
const sqrt_price_x64 = (0, binary_js_1.readU128LE)(data, o);
|
|
211
|
+
if (sqrt_price_x64 === null)
|
|
212
|
+
return null;
|
|
213
|
+
o += 16;
|
|
214
|
+
const tick = (0, binary_js_1.readI32LE)(data, o);
|
|
215
|
+
if (tick === null)
|
|
216
|
+
return null;
|
|
217
|
+
o += 4;
|
|
218
|
+
const token_vault_0 = (0, binary_js_1.readPubkey)(data, o);
|
|
219
|
+
if (!token_vault_0)
|
|
220
|
+
return null;
|
|
221
|
+
o += 32;
|
|
222
|
+
const token_vault_1 = (0, binary_js_1.readPubkey)(data, o);
|
|
223
|
+
if (!token_vault_1)
|
|
224
|
+
return null;
|
|
225
|
+
const ev = {
|
|
226
|
+
metadata,
|
|
227
|
+
pool,
|
|
228
|
+
token_0_mint,
|
|
229
|
+
token_1_mint,
|
|
230
|
+
tick_spacing,
|
|
231
|
+
fee_rate: 0,
|
|
232
|
+
creator: (0, dex_event_js_1.defaultPubkey)(),
|
|
233
|
+
sqrt_price_x64,
|
|
234
|
+
tick,
|
|
235
|
+
token_vault_0,
|
|
236
|
+
token_vault_1,
|
|
237
|
+
open_time: 0n,
|
|
238
|
+
};
|
|
239
|
+
return { RaydiumClmmCreatePool: ev };
|
|
240
|
+
}
|
|
241
|
+
function parseCollectPersonalFeeFromData(data, metadata) {
|
|
242
|
+
let o = 0;
|
|
243
|
+
const position_nft_mint = (0, binary_js_1.readPubkey)(data, o);
|
|
244
|
+
if (!position_nft_mint)
|
|
245
|
+
return null;
|
|
246
|
+
o += 32;
|
|
247
|
+
const recipient_token_account_0 = (0, binary_js_1.readPubkey)(data, o);
|
|
248
|
+
if (!recipient_token_account_0)
|
|
249
|
+
return null;
|
|
250
|
+
o += 32;
|
|
251
|
+
const recipient_token_account_1 = (0, binary_js_1.readPubkey)(data, o);
|
|
252
|
+
if (!recipient_token_account_1)
|
|
253
|
+
return null;
|
|
254
|
+
o += 32;
|
|
255
|
+
const amount_0 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
256
|
+
o += 8;
|
|
257
|
+
const amount_1 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
258
|
+
const ev = {
|
|
259
|
+
metadata,
|
|
260
|
+
pool_state: (0, dex_event_js_1.defaultPubkey)(),
|
|
261
|
+
position_nft_mint,
|
|
262
|
+
recipient_token_account_0,
|
|
263
|
+
recipient_token_account_1,
|
|
264
|
+
amount_0,
|
|
265
|
+
amount_1,
|
|
266
|
+
};
|
|
267
|
+
return { RaydiumClmmCollectFee: ev };
|
|
268
|
+
}
|
|
269
|
+
function parseCollectProtocolFeeFromData(data, metadata) {
|
|
270
|
+
let o = 0;
|
|
271
|
+
const pool_state = (0, binary_js_1.readPubkey)(data, o);
|
|
272
|
+
if (!pool_state)
|
|
273
|
+
return null;
|
|
274
|
+
o += 32;
|
|
275
|
+
const recipient_token_account_0 = (0, binary_js_1.readPubkey)(data, o);
|
|
276
|
+
if (!recipient_token_account_0)
|
|
277
|
+
return null;
|
|
278
|
+
o += 32;
|
|
279
|
+
const recipient_token_account_1 = (0, binary_js_1.readPubkey)(data, o);
|
|
280
|
+
if (!recipient_token_account_1)
|
|
281
|
+
return null;
|
|
282
|
+
o += 32;
|
|
283
|
+
const amount_0 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
284
|
+
o += 8;
|
|
285
|
+
const amount_1 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
286
|
+
const ev = {
|
|
287
|
+
metadata,
|
|
288
|
+
pool_state,
|
|
289
|
+
position_nft_mint: (0, dex_event_js_1.defaultPubkey)(),
|
|
290
|
+
recipient_token_account_0,
|
|
291
|
+
recipient_token_account_1,
|
|
292
|
+
amount_0,
|
|
293
|
+
amount_1,
|
|
294
|
+
};
|
|
295
|
+
return { RaydiumClmmCollectFee: ev };
|
|
296
|
+
}
|
|
297
|
+
function parseLiquidityChangeFromData(data, metadata) {
|
|
298
|
+
let o = 0;
|
|
299
|
+
const pool_state = (0, binary_js_1.readPubkey)(data, o);
|
|
300
|
+
if (!pool_state)
|
|
301
|
+
return null;
|
|
302
|
+
o += 32;
|
|
303
|
+
const tick = (0, binary_js_1.readI32LE)(data, o);
|
|
304
|
+
if (tick === null)
|
|
305
|
+
return null;
|
|
306
|
+
o += 4;
|
|
307
|
+
const tick_lower = (0, binary_js_1.readI32LE)(data, o);
|
|
308
|
+
if (tick_lower === null)
|
|
309
|
+
return null;
|
|
310
|
+
o += 4;
|
|
311
|
+
const tick_upper = (0, binary_js_1.readI32LE)(data, o);
|
|
312
|
+
if (tick_upper === null)
|
|
313
|
+
return null;
|
|
314
|
+
o += 4;
|
|
315
|
+
const liquidity_before = (0, binary_js_1.readU128LE)(data, o);
|
|
316
|
+
if (liquidity_before === null)
|
|
317
|
+
return null;
|
|
318
|
+
o += 16;
|
|
319
|
+
const liquidity_after = (0, binary_js_1.readU128LE)(data, o);
|
|
320
|
+
if (liquidity_after === null)
|
|
321
|
+
return null;
|
|
322
|
+
const ev = {
|
|
323
|
+
metadata,
|
|
324
|
+
pool_state,
|
|
325
|
+
tick,
|
|
326
|
+
tick_lower,
|
|
327
|
+
tick_upper,
|
|
328
|
+
liquidity_before,
|
|
329
|
+
liquidity_after,
|
|
330
|
+
};
|
|
331
|
+
return { RaydiumClmmLiquidityChange: ev };
|
|
332
|
+
}
|
|
333
|
+
function parseConfigChangeFromData(data, metadata) {
|
|
334
|
+
let o = 0;
|
|
335
|
+
const index = (0, binary_js_1.readU16LE)(data, o);
|
|
336
|
+
if (index === null)
|
|
337
|
+
return null;
|
|
338
|
+
o += 2;
|
|
339
|
+
const owner = (0, binary_js_1.readPubkey)(data, o);
|
|
340
|
+
if (!owner)
|
|
341
|
+
return null;
|
|
342
|
+
o += 32;
|
|
343
|
+
const protocol_fee_rate = (0, binary_js_1.readU32LE)(data, o);
|
|
344
|
+
if (protocol_fee_rate === null)
|
|
345
|
+
return null;
|
|
346
|
+
o += 4;
|
|
347
|
+
const trade_fee_rate = (0, binary_js_1.readU32LE)(data, o);
|
|
348
|
+
if (trade_fee_rate === null)
|
|
349
|
+
return null;
|
|
350
|
+
o += 4;
|
|
351
|
+
const tick_spacing = (0, binary_js_1.readU16LE)(data, o);
|
|
352
|
+
if (tick_spacing === null)
|
|
353
|
+
return null;
|
|
354
|
+
o += 2;
|
|
355
|
+
const fund_fee_rate = (0, binary_js_1.readU32LE)(data, o);
|
|
356
|
+
if (fund_fee_rate === null)
|
|
357
|
+
return null;
|
|
358
|
+
o += 4;
|
|
359
|
+
const fund_owner = (0, binary_js_1.readPubkey)(data, o);
|
|
360
|
+
if (!fund_owner)
|
|
361
|
+
return null;
|
|
362
|
+
const ev = {
|
|
363
|
+
metadata,
|
|
364
|
+
index,
|
|
365
|
+
owner,
|
|
366
|
+
protocol_fee_rate,
|
|
367
|
+
trade_fee_rate,
|
|
368
|
+
tick_spacing,
|
|
369
|
+
fund_fee_rate,
|
|
370
|
+
fund_owner,
|
|
371
|
+
};
|
|
372
|
+
return { RaydiumClmmConfigChange: ev };
|
|
373
|
+
}
|
|
374
|
+
function parseCreatePersonalPositionFromData(data, metadata) {
|
|
375
|
+
let o = 0;
|
|
376
|
+
const pool_state = (0, binary_js_1.readPubkey)(data, o);
|
|
377
|
+
if (!pool_state)
|
|
378
|
+
return null;
|
|
379
|
+
o += 32;
|
|
380
|
+
const minter = (0, binary_js_1.readPubkey)(data, o);
|
|
381
|
+
if (!minter)
|
|
382
|
+
return null;
|
|
383
|
+
o += 32;
|
|
384
|
+
const nft_owner = (0, binary_js_1.readPubkey)(data, o);
|
|
385
|
+
if (!nft_owner)
|
|
386
|
+
return null;
|
|
387
|
+
o += 32;
|
|
388
|
+
const tick_lower_index = (0, binary_js_1.readI32LE)(data, o);
|
|
389
|
+
if (tick_lower_index === null)
|
|
390
|
+
return null;
|
|
391
|
+
o += 4;
|
|
392
|
+
const tick_upper_index = (0, binary_js_1.readI32LE)(data, o);
|
|
393
|
+
if (tick_upper_index === null)
|
|
394
|
+
return null;
|
|
395
|
+
o += 4;
|
|
396
|
+
const liquidity = (0, binary_js_1.readU128LE)(data, o);
|
|
397
|
+
if (liquidity === null)
|
|
398
|
+
return null;
|
|
399
|
+
o += 16;
|
|
400
|
+
const deposit_amount_0 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
401
|
+
o += 8;
|
|
402
|
+
const deposit_amount_1 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
403
|
+
o += 8;
|
|
404
|
+
const deposit_amount_0_transfer_fee = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
405
|
+
o += 8;
|
|
406
|
+
const deposit_amount_1_transfer_fee = (0, binary_js_1.readU64LE)(data, o);
|
|
407
|
+
if (deposit_amount_1_transfer_fee === null)
|
|
408
|
+
return null;
|
|
409
|
+
const ev = {
|
|
410
|
+
metadata,
|
|
411
|
+
pool_state,
|
|
412
|
+
minter,
|
|
413
|
+
nft_owner,
|
|
414
|
+
tick_lower_index,
|
|
415
|
+
tick_upper_index,
|
|
416
|
+
liquidity,
|
|
417
|
+
deposit_amount_0,
|
|
418
|
+
deposit_amount_1,
|
|
419
|
+
deposit_amount_0_transfer_fee,
|
|
420
|
+
deposit_amount_1_transfer_fee,
|
|
421
|
+
};
|
|
422
|
+
return { RaydiumClmmCreatePersonalPosition: ev };
|
|
423
|
+
}
|
|
424
|
+
function parseLiquidityCalculateFromData(data, metadata) {
|
|
425
|
+
let o = 0;
|
|
426
|
+
const pool_liquidity = (0, binary_js_1.readU128LE)(data, o);
|
|
427
|
+
if (pool_liquidity === null)
|
|
428
|
+
return null;
|
|
429
|
+
o += 16;
|
|
430
|
+
const pool_sqrt_price_x64 = (0, binary_js_1.readU128LE)(data, o);
|
|
431
|
+
if (pool_sqrt_price_x64 === null)
|
|
432
|
+
return null;
|
|
433
|
+
o += 16;
|
|
434
|
+
const pool_tick = (0, binary_js_1.readI32LE)(data, o);
|
|
435
|
+
if (pool_tick === null)
|
|
436
|
+
return null;
|
|
437
|
+
o += 4;
|
|
438
|
+
const calc_amount_0 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
439
|
+
o += 8;
|
|
440
|
+
const calc_amount_1 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
441
|
+
o += 8;
|
|
442
|
+
const trade_fee_owed_0 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
443
|
+
o += 8;
|
|
444
|
+
const trade_fee_owed_1 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
445
|
+
o += 8;
|
|
446
|
+
const transfer_fee_0 = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
447
|
+
o += 8;
|
|
448
|
+
const transfer_fee_1 = (0, binary_js_1.readU64LE)(data, o);
|
|
449
|
+
if (transfer_fee_1 === null)
|
|
450
|
+
return null;
|
|
451
|
+
const ev = {
|
|
452
|
+
metadata,
|
|
453
|
+
pool_liquidity,
|
|
454
|
+
pool_sqrt_price_x64,
|
|
455
|
+
pool_tick,
|
|
456
|
+
calc_amount_0,
|
|
457
|
+
calc_amount_1,
|
|
458
|
+
trade_fee_owed_0,
|
|
459
|
+
trade_fee_owed_1,
|
|
460
|
+
transfer_fee_0,
|
|
461
|
+
transfer_fee_1,
|
|
462
|
+
};
|
|
463
|
+
return { RaydiumClmmLiquidityCalculate: ev };
|
|
464
|
+
}
|
|
465
|
+
function parseOpenLimitOrderFromData(data, metadata) {
|
|
466
|
+
let o = 0;
|
|
467
|
+
const pool_id = (0, binary_js_1.readPubkey)(data, o);
|
|
468
|
+
if (!pool_id)
|
|
469
|
+
return null;
|
|
470
|
+
o += 32;
|
|
471
|
+
const limit_order = (0, binary_js_1.readPubkey)(data, o);
|
|
472
|
+
if (!limit_order)
|
|
473
|
+
return null;
|
|
474
|
+
o += 32;
|
|
475
|
+
const zero_for_one = (0, binary_js_1.readBool)(data, o);
|
|
476
|
+
if (zero_for_one === null)
|
|
477
|
+
return null;
|
|
478
|
+
o += 1;
|
|
479
|
+
const tick_index = (0, binary_js_1.readI32LE)(data, o);
|
|
480
|
+
if (tick_index === null)
|
|
481
|
+
return null;
|
|
482
|
+
o += 4;
|
|
483
|
+
const total_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
484
|
+
o += 8;
|
|
485
|
+
const transfer_fee = (0, binary_js_1.readU64LE)(data, o);
|
|
486
|
+
if (transfer_fee === null)
|
|
487
|
+
return null;
|
|
488
|
+
const ev = {
|
|
489
|
+
metadata,
|
|
490
|
+
pool_id,
|
|
491
|
+
limit_order,
|
|
492
|
+
zero_for_one,
|
|
493
|
+
tick_index,
|
|
494
|
+
total_amount,
|
|
495
|
+
transfer_fee,
|
|
496
|
+
};
|
|
497
|
+
return { RaydiumClmmOpenLimitOrder: ev };
|
|
498
|
+
}
|
|
499
|
+
function parseIncreaseLimitOrderFromData(data, metadata) {
|
|
500
|
+
let o = 0;
|
|
501
|
+
const pool_id = (0, binary_js_1.readPubkey)(data, o);
|
|
502
|
+
if (!pool_id)
|
|
503
|
+
return null;
|
|
504
|
+
o += 32;
|
|
505
|
+
const limit_order = (0, binary_js_1.readPubkey)(data, o);
|
|
506
|
+
if (!limit_order)
|
|
507
|
+
return null;
|
|
508
|
+
o += 32;
|
|
509
|
+
const zero_for_one = (0, binary_js_1.readBool)(data, o);
|
|
510
|
+
if (zero_for_one === null)
|
|
511
|
+
return null;
|
|
512
|
+
o += 1;
|
|
513
|
+
const tick_index = (0, binary_js_1.readI32LE)(data, o);
|
|
514
|
+
if (tick_index === null)
|
|
515
|
+
return null;
|
|
516
|
+
o += 4;
|
|
517
|
+
const total_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
518
|
+
o += 8;
|
|
519
|
+
const increased_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
520
|
+
o += 8;
|
|
521
|
+
const transfer_fee = (0, binary_js_1.readU64LE)(data, o);
|
|
522
|
+
if (transfer_fee === null)
|
|
523
|
+
return null;
|
|
524
|
+
const ev = {
|
|
525
|
+
metadata,
|
|
526
|
+
pool_id,
|
|
527
|
+
limit_order,
|
|
528
|
+
zero_for_one,
|
|
529
|
+
tick_index,
|
|
530
|
+
total_amount,
|
|
531
|
+
increased_amount,
|
|
532
|
+
transfer_fee,
|
|
533
|
+
};
|
|
534
|
+
return { RaydiumClmmIncreaseLimitOrder: ev };
|
|
535
|
+
}
|
|
536
|
+
function parseDecreaseLimitOrderFromData(data, metadata) {
|
|
537
|
+
let o = 0;
|
|
538
|
+
const pool_id = (0, binary_js_1.readPubkey)(data, o);
|
|
539
|
+
if (!pool_id)
|
|
540
|
+
return null;
|
|
541
|
+
o += 32;
|
|
542
|
+
const limit_order = (0, binary_js_1.readPubkey)(data, o);
|
|
543
|
+
if (!limit_order)
|
|
544
|
+
return null;
|
|
545
|
+
o += 32;
|
|
546
|
+
const zero_for_one = (0, binary_js_1.readBool)(data, o);
|
|
547
|
+
if (zero_for_one === null)
|
|
548
|
+
return null;
|
|
549
|
+
o += 1;
|
|
550
|
+
const tick_index = (0, binary_js_1.readI32LE)(data, o);
|
|
551
|
+
if (tick_index === null)
|
|
552
|
+
return null;
|
|
553
|
+
o += 4;
|
|
554
|
+
const total_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
555
|
+
o += 8;
|
|
556
|
+
const filled_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
557
|
+
o += 8;
|
|
558
|
+
const settled_output_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
559
|
+
o += 8;
|
|
560
|
+
const decreased_amount = (0, binary_js_1.readU64LE)(data, o);
|
|
561
|
+
if (decreased_amount === null)
|
|
562
|
+
return null;
|
|
563
|
+
const ev = {
|
|
564
|
+
metadata,
|
|
565
|
+
pool_id,
|
|
566
|
+
limit_order,
|
|
567
|
+
zero_for_one,
|
|
568
|
+
tick_index,
|
|
569
|
+
total_amount,
|
|
570
|
+
filled_amount,
|
|
571
|
+
settled_output_amount,
|
|
572
|
+
decreased_amount,
|
|
573
|
+
};
|
|
574
|
+
return { RaydiumClmmDecreaseLimitOrder: ev };
|
|
575
|
+
}
|
|
576
|
+
function parseSettleLimitOrderFromData(data, metadata) {
|
|
577
|
+
let o = 0;
|
|
578
|
+
const pool_id = (0, binary_js_1.readPubkey)(data, o);
|
|
579
|
+
if (!pool_id)
|
|
580
|
+
return null;
|
|
581
|
+
o += 32;
|
|
582
|
+
const limit_order = (0, binary_js_1.readPubkey)(data, o);
|
|
583
|
+
if (!limit_order)
|
|
584
|
+
return null;
|
|
585
|
+
o += 32;
|
|
586
|
+
const zero_for_one = (0, binary_js_1.readBool)(data, o);
|
|
587
|
+
if (zero_for_one === null)
|
|
588
|
+
return null;
|
|
589
|
+
o += 1;
|
|
590
|
+
const tick_index = (0, binary_js_1.readI32LE)(data, o);
|
|
591
|
+
if (tick_index === null)
|
|
592
|
+
return null;
|
|
593
|
+
o += 4;
|
|
594
|
+
const total_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
595
|
+
o += 8;
|
|
596
|
+
const filled_amount = bn64((0, binary_js_1.readU64LE)(data, o));
|
|
597
|
+
o += 8;
|
|
598
|
+
const settled_amount_out = (0, binary_js_1.readU64LE)(data, o);
|
|
599
|
+
if (settled_amount_out === null)
|
|
600
|
+
return null;
|
|
601
|
+
const ev = {
|
|
602
|
+
metadata,
|
|
603
|
+
pool_id,
|
|
604
|
+
limit_order,
|
|
605
|
+
zero_for_one,
|
|
606
|
+
tick_index,
|
|
607
|
+
total_amount,
|
|
608
|
+
filled_amount,
|
|
609
|
+
settled_amount_out,
|
|
610
|
+
};
|
|
611
|
+
return { RaydiumClmmSettleLimitOrder: ev };
|
|
612
|
+
}
|
|
613
|
+
function parseUpdateRewardInfosFromData(data, metadata) {
|
|
614
|
+
const r0 = (0, binary_js_1.readU128LE)(data, 0);
|
|
615
|
+
const r1 = (0, binary_js_1.readU128LE)(data, 16);
|
|
616
|
+
const r2 = (0, binary_js_1.readU128LE)(data, 32);
|
|
617
|
+
if (r0 === null || r1 === null || r2 === null)
|
|
618
|
+
return null;
|
|
619
|
+
const ev = {
|
|
620
|
+
metadata,
|
|
621
|
+
reward_growth_global_x64: [r0, r1, r2],
|
|
622
|
+
};
|
|
623
|
+
return { RaydiumClmmUpdateRewardInfos: ev };
|
|
624
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EventMetadata } from "../core/metadata.js";
|
|
2
|
+
import type { DexEvent } from "../core/dex_event.js";
|
|
3
|
+
export declare function parseSwapBaseInFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
4
|
+
export declare function parseSwapBaseOutFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
5
|
+
export declare function parseCreatePoolFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
6
|
+
export declare function parseDepositFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
7
|
+
export declare function parseWithdrawFromData(data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|