sol-parser-sdk 0.5.17 → 0.5.19
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/README.md +46 -31
- package/README_CN.md +45 -30
- package/dist/accounts/pumpfun.js +15 -0
- package/dist/accounts/pumpswap.js +2 -0
- package/dist/core/account_dispatcher_rpc.d.ts +2 -1
- package/dist/core/account_dispatcher_rpc.js +94 -9
- package/dist/core/account_fill_pumpfun.js +20 -0
- package/dist/core/account_fill_pumpswap.d.ts +2 -0
- package/dist/core/account_fill_pumpswap.js +55 -6
- package/dist/core/account_fill_raydium.js +4 -0
- package/dist/core/dex_event.d.ts +149 -0
- package/dist/grpc/client.js +2 -0
- package/dist/grpc/log_instr_dedup.js +75 -7
- package/dist/grpc/order_buffer.d.ts +5 -0
- package/dist/grpc/order_buffer.js +53 -17
- package/dist/grpc/types.d.ts +4 -1
- package/dist/grpc/types.js +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/instr/inner.js +28 -1
- package/dist/instr/meteora_damm_ix.js +26 -0
- package/dist/instr/meteora_pools_ix.js +17 -9
- package/dist/instr/orca_whirlpool_ix.js +13 -9
- package/dist/instr/pumpfun_ix.js +84 -0
- package/dist/instr/pumpswap_ix.js +85 -10
- package/dist/instr/raydium_clmm_ix.js +5 -3
- package/dist/instr/raydium_cpmm_ix.js +11 -8
- package/dist/logs/meteora_damm.d.ts +7 -0
- package/dist/logs/meteora_damm.js +211 -0
- package/dist/logs/meteora_dbc.d.ts +3 -0
- package/dist/logs/meteora_dbc.js +23 -0
- package/dist/logs/meteora_dlmm.js +16 -4
- package/dist/logs/optimized_matcher.js +93 -10
- package/dist/logs/program_log_discriminators.d.ts +11 -0
- package/dist/logs/program_log_discriminators.js +11 -0
- package/dist/logs/pump.js +6 -3
- package/dist/logs/pump_amm.js +8 -2
- package/dist/logs/pump_upgrade.d.ts +68 -0
- package/dist/logs/pump_upgrade.js +128 -0
- package/dist/logs/raydium_cpmm.js +7 -3
- package/dist/rpc_transaction.js +84 -7
- package/dist/shredstream/alt_cache.d.ts +26 -0
- package/dist/shredstream/alt_cache.js +138 -0
- package/dist/shredstream/client.d.ts +11 -3
- package/dist/shredstream/client.js +76 -72
- package/dist/shredstream/config.d.ts +7 -3
- package/dist/shredstream/index.d.ts +3 -2
- package/dist/shredstream/index.js +5 -3
- package/dist/shredstream/instruction_parse.d.ts +1 -1
- package/dist/shredstream/instruction_parse.js +1 -0
- package/dist/simulation_route.d.ts +1 -1
- package/dist/simulation_route.js +17 -4
- package/dist/transaction_route.js +20 -1
- package/dist/wire_transaction.js +9 -10
- package/docs/USAGE.md +161 -0
- package/package.json +2 -5
- package/NATIVE_ALIGNMENT.md +0 -312
- package/NATIVE_DAMM_FACTORY_ALIGNMENT_20261004.md +0 -16
- package/NATIVE_DAMM_FACTORY_EVIDENCE_20261004.json +0 -55
- package/NATIVE_MIGRATION.md +0 -38
- package/NATIVE_PUMPFUN_NATIVE_DEBIT_ALIGNMENT_20261004.md +0 -18
- package/NATIVE_PUMPFUN_NATIVE_DEBIT_EVIDENCE_20261004.json +0 -57
- package/NATIVE_PUMPFUN_SETTLEMENT_ALIGNMENT_20261004.md +0 -11
- package/NATIVE_PUMPFUN_SETTLEMENT_EVIDENCE_20261004.json +0 -70
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderDispatcher = void 0;
|
|
4
|
+
const node_perf_hooks_1 = require("node:perf_hooks");
|
|
4
5
|
const metadata_js_1 = require("../core/metadata.js");
|
|
5
6
|
const dex_event_js_1 = require("../core/dex_event.js");
|
|
6
7
|
function eventSlotAndIndex(events, fallbackSlot, fallbackTxIndex) {
|
|
@@ -16,11 +17,16 @@ class OrderDispatcher {
|
|
|
16
17
|
microBatchUs;
|
|
17
18
|
slots = new Map();
|
|
18
19
|
streamingWatermarks = new Map();
|
|
20
|
+
streamingPending = new Set();
|
|
19
21
|
microBatch = [];
|
|
20
22
|
microBatchStartUs = 0;
|
|
21
|
-
lastFlushMs =
|
|
23
|
+
lastFlushMs = node_perf_hooks_1.performance.now();
|
|
22
24
|
currentSlot = 0n;
|
|
23
25
|
seq = 0;
|
|
26
|
+
orderedWatermark = null;
|
|
27
|
+
orderedLateDrops = 0;
|
|
28
|
+
/** Each rejected late transaction marks an Ordered continuity break. */
|
|
29
|
+
get orderedLateTransactions() { return this.orderedLateDrops; }
|
|
24
30
|
constructor(config) {
|
|
25
31
|
this.mode = config.order_mode;
|
|
26
32
|
this.timeoutMs = Math.max(1, config.order_timeout_ms || 100);
|
|
@@ -50,12 +56,12 @@ class OrderDispatcher {
|
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
flushDue(emit) {
|
|
53
|
-
const nowMs =
|
|
59
|
+
const nowMs = node_perf_hooks_1.performance.now();
|
|
54
60
|
if ((this.mode === "Ordered" || this.mode === "StreamingOrdered") && nowMs - this.lastFlushMs > this.timeoutMs) {
|
|
55
61
|
this.flushAllSlots(emit);
|
|
56
62
|
}
|
|
57
63
|
if (this.mode === "MicroBatch") {
|
|
58
|
-
const nowUs =
|
|
64
|
+
const nowUs = nowMs * 1000;
|
|
59
65
|
if (this.microBatch.length > 0 && nowUs - this.microBatchStartUs >= this.microBatchUs) {
|
|
60
66
|
this.flushMicroBatch(emit);
|
|
61
67
|
}
|
|
@@ -66,6 +72,16 @@ class OrderDispatcher {
|
|
|
66
72
|
this.flushMicroBatch(emit);
|
|
67
73
|
}
|
|
68
74
|
pushOrdered(batch, emit) {
|
|
75
|
+
const last = this.orderedWatermark;
|
|
76
|
+
if (batch.slot < this.currentSlot || (last && (batch.slot < last.slot ||
|
|
77
|
+
(batch.slot === last.slot && batch.txIndex <= last.txIndex)))) {
|
|
78
|
+
this.orderedLateDrops++;
|
|
79
|
+
const dropped = this.orderedLateDrops;
|
|
80
|
+
if (dropped <= 10 || Number.isInteger(Math.log2(dropped))) {
|
|
81
|
+
console.warn(`Ordered continuity break: dropped late transaction (${batch.slot},${batch.txIndex}); total=${dropped}`);
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
69
85
|
if (batch.slot > this.currentSlot && this.currentSlot > 0) {
|
|
70
86
|
this.flushBefore(batch.slot, emit);
|
|
71
87
|
}
|
|
@@ -74,6 +90,8 @@ class OrderDispatcher {
|
|
|
74
90
|
this.pushSlotBatch(batch);
|
|
75
91
|
}
|
|
76
92
|
pushStreaming(batch, emit) {
|
|
93
|
+
if (batch.slot < this.currentSlot)
|
|
94
|
+
return;
|
|
77
95
|
if (batch.slot > this.currentSlot && this.currentSlot > 0) {
|
|
78
96
|
this.flushBefore(batch.slot, emit);
|
|
79
97
|
for (const slot of [...this.streamingWatermarks.keys()]) {
|
|
@@ -81,8 +99,10 @@ class OrderDispatcher {
|
|
|
81
99
|
this.streamingWatermarks.delete(slot);
|
|
82
100
|
}
|
|
83
101
|
}
|
|
84
|
-
if (batch.slot > this.currentSlot)
|
|
102
|
+
if (batch.slot > this.currentSlot) {
|
|
85
103
|
this.currentSlot = batch.slot;
|
|
104
|
+
this.streamingPending.clear();
|
|
105
|
+
}
|
|
86
106
|
const expected = this.streamingWatermarks.get(batch.slot) ?? 0n;
|
|
87
107
|
if (batch.txIndex === expected) {
|
|
88
108
|
this.emitBatch(batch, emit);
|
|
@@ -90,24 +110,27 @@ class OrderDispatcher {
|
|
|
90
110
|
const buffered = this.slots.get(batch.slot);
|
|
91
111
|
if (buffered) {
|
|
92
112
|
buffered.sort(compareBatch);
|
|
93
|
-
let
|
|
94
|
-
while (
|
|
95
|
-
|
|
96
|
-
this.
|
|
97
|
-
|
|
98
|
-
|
|
113
|
+
let released = 0;
|
|
114
|
+
while (released < buffered.length && buffered[released].txIndex === watermark) {
|
|
115
|
+
this.emitBatch(buffered[released], emit);
|
|
116
|
+
this.streamingPending.delete(watermark);
|
|
117
|
+
released++;
|
|
118
|
+
watermark++;
|
|
99
119
|
}
|
|
100
|
-
if (buffered.length
|
|
120
|
+
if (released === buffered.length)
|
|
101
121
|
this.slots.delete(batch.slot);
|
|
122
|
+
else if (released)
|
|
123
|
+
buffered.splice(0, released);
|
|
102
124
|
}
|
|
103
125
|
this.streamingWatermarks.set(batch.slot, watermark);
|
|
104
126
|
}
|
|
105
|
-
else if (batch.txIndex > expected) {
|
|
127
|
+
else if (batch.txIndex > expected && !this.streamingPending.has(batch.txIndex)) {
|
|
128
|
+
this.streamingPending.add(batch.txIndex);
|
|
106
129
|
this.pushSlotBatch(batch);
|
|
107
130
|
}
|
|
108
131
|
}
|
|
109
132
|
pushMicroBatch(batch, emit) {
|
|
110
|
-
const nowUs =
|
|
133
|
+
const nowUs = node_perf_hooks_1.performance.now() * 1000;
|
|
111
134
|
if (this.microBatch.length === 0)
|
|
112
135
|
this.microBatchStartUs = nowUs;
|
|
113
136
|
this.microBatch.push(batch);
|
|
@@ -133,7 +156,7 @@ class OrderDispatcher {
|
|
|
133
156
|
this.slots.delete(s);
|
|
134
157
|
this.streamingWatermarks.delete(s);
|
|
135
158
|
}
|
|
136
|
-
this.lastFlushMs =
|
|
159
|
+
this.lastFlushMs = node_perf_hooks_1.performance.now();
|
|
137
160
|
}
|
|
138
161
|
flushAllSlots(emit) {
|
|
139
162
|
for (const s of [...this.slots.keys()].sort((a, b) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
@@ -142,9 +165,20 @@ class OrderDispatcher {
|
|
|
142
165
|
for (const batch of batches)
|
|
143
166
|
this.emitBatch(batch, emit);
|
|
144
167
|
this.slots.delete(s);
|
|
145
|
-
this.
|
|
168
|
+
if (this.mode === "StreamingOrdered" && batches.length) {
|
|
169
|
+
const next = batches[batches.length - 1].txIndex + 1n;
|
|
170
|
+
this.streamingWatermarks.set(s, next > (this.streamingWatermarks.get(s) ?? 0n)
|
|
171
|
+
? next : this.streamingWatermarks.get(s));
|
|
172
|
+
}
|
|
173
|
+
else
|
|
174
|
+
this.streamingWatermarks.delete(s);
|
|
175
|
+
}
|
|
176
|
+
this.streamingPending.clear();
|
|
177
|
+
for (const slot of this.streamingWatermarks.keys()) {
|
|
178
|
+
if (this.mode !== "StreamingOrdered" || slot !== this.currentSlot)
|
|
179
|
+
this.streamingWatermarks.delete(slot);
|
|
146
180
|
}
|
|
147
|
-
this.lastFlushMs =
|
|
181
|
+
this.lastFlushMs = node_perf_hooks_1.performance.now();
|
|
148
182
|
}
|
|
149
183
|
flushMicroBatch(emit) {
|
|
150
184
|
if (this.microBatch.length === 0)
|
|
@@ -154,9 +188,11 @@ class OrderDispatcher {
|
|
|
154
188
|
this.emitBatch(batch, emit);
|
|
155
189
|
this.microBatch = [];
|
|
156
190
|
this.microBatchStartUs = 0;
|
|
157
|
-
this.lastFlushMs =
|
|
191
|
+
this.lastFlushMs = node_perf_hooks_1.performance.now();
|
|
158
192
|
}
|
|
159
193
|
emitBatch(batch, emit) {
|
|
194
|
+
if (this.mode === "Ordered")
|
|
195
|
+
this.orderedWatermark = { slot: batch.slot, txIndex: batch.txIndex };
|
|
160
196
|
for (const event of batch.events)
|
|
161
197
|
emit(event);
|
|
162
198
|
}
|
package/dist/grpc/types.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { SubscribeRequestFilterAccountsFilter } from "./protocol/geyser.js";
|
|
2
2
|
import type { DexEvent } from "../core/dex_event.js";
|
|
3
3
|
/** gRPC 订阅顺序模式 */
|
|
4
|
+
/** Ordered sorts buffered transactions until a newer slot or timeout. Late data
|
|
5
|
+
* for a closed slot or at/before the emitted watermark is dropped with a
|
|
6
|
+
* continuity-break warning; upstream completeness cannot be guaranteed. */
|
|
4
7
|
export type OrderMode = "Unordered" | "Ordered" | "StreamingOrdered" | "MicroBatch";
|
|
5
8
|
/** 与 Rust `grpc::types::Protocol` 一致 */
|
|
6
9
|
export type Protocol = "PumpFun" | "PumpSwap" | "PumpFees" | "LaunchLab" | "StonkFun" | "RaydiumLaunchlab" | "RaydiumCpmm" | "RaydiumClmm" | "RaydiumAmmV4" | "OrcaWhirlpool" | "MeteoraPools" | "MeteoraDammV2" | "MeteoraDlmm" | "MeteoraDbc";
|
|
@@ -151,7 +154,7 @@ export declare function accountFilterFromProgramOwners(programIds: string[]): Ac
|
|
|
151
154
|
*/
|
|
152
155
|
export declare function accountFilterMemcmp(offset: number, bytes: Uint8Array): SubscribeRequestFilterAccountsFilter;
|
|
153
156
|
/** 事件类型过滤标签 */
|
|
154
|
-
export type EventType = "AccountRawSnapshot" | "AccountLiquiditySnapshot" | "BlockMeta" | "RaydiumLaunchlabTrade" | "RaydiumLaunchlabPoolCreate" | "RaydiumLaunchlabMigrateAmm" | "PumpFunTrade" | "PumpFunBuy" | "PumpFunSell" | "PumpFunBuyExactSolIn" | "PumpFunCreate" | "PumpFunCreateV2" | "PumpFunComplete" | "PumpFunMigrate" | "PumpFeesCreateFeeSharingConfig" | "PumpFeesInitializeFeeConfig" | "PumpFeesResetFeeSharingConfig" | "PumpFeesRevokeFeeSharingAuthority" | "PumpFeesTransferFeeSharingAuthority" | "PumpFeesUpdateAdmin" | "PumpFeesUpdateFeeConfig" | "PumpFeesUpdateFeeShares" | "PumpFeesUpsertFeeTiers" | "PumpFunMigrateBondingCurveCreator" | "PumpSwapTrade" | "PumpSwapBuy" | "PumpSwapSell" | "PumpSwapCreatePool" | "PumpSwapLiquidityAdded" | "PumpSwapLiquidityRemoved" | "RaydiumCpmmSwap" | "RaydiumCpmmDeposit" | "RaydiumCpmmWithdraw" | "RaydiumCpmmInitialize" | "RaydiumClmmSwap" | "RaydiumClmmCreatePool" | "RaydiumClmmOpenPosition" | "RaydiumClmmClosePosition" | "RaydiumClmmIncreaseLiquidity" | "RaydiumClmmDecreaseLiquidity" | "RaydiumClmmLiquidityChange" | "RaydiumClmmConfigChange" | "RaydiumClmmCreatePersonalPosition" | "RaydiumClmmLiquidityCalculate" | "RaydiumClmmOpenLimitOrder" | "RaydiumClmmIncreaseLimitOrder" | "RaydiumClmmDecreaseLimitOrder" | "RaydiumClmmSettleLimitOrder" | "RaydiumClmmUpdateRewardInfos" | "RaydiumClmmOpenPositionWithTokenExtNft" | "RaydiumClmmCollectFee" | "RaydiumAmmV4Swap" | "RaydiumAmmV4Deposit" | "RaydiumAmmV4Withdraw" | "RaydiumAmmV4Initialize2" | "RaydiumAmmV4WithdrawPnl" | "OrcaWhirlpoolSwap" | "OrcaWhirlpoolLiquidityIncreased" | "OrcaWhirlpoolLiquidityDecreased" | "OrcaWhirlpoolPoolInitialized" | "MeteoraPoolsSwap" | "MeteoraPoolsAddLiquidity" | "MeteoraPoolsRemoveLiquidity" | "MeteoraPoolsBootstrapLiquidity" | "MeteoraPoolsPoolCreated" | "MeteoraPoolsSetPoolFees" | "MeteoraDammV2Swap" | "MeteoraDammV2AddLiquidity" | "MeteoraDammV2RemoveLiquidity" | "MeteoraDammV2InitializePool" | "MeteoraDammV2CreatePosition" | "MeteoraDammV2ClosePosition" | "MeteoraDammV2UpdateDelegatePermission" | "MeteoraDammV2WithdrawDeadLiquidityReward" | "MeteoraDammV2CreateConfig" | "MeteoraDammV2CreateDynamicConfig" | "MeteoraDbcSwap" | "MeteoraDbcInitializePool" | "MeteoraDbcCurveComplete" | "MeteoraDlmmSwap" | "MeteoraDlmmAddLiquidity" | "MeteoraDlmmRemoveLiquidity" | "MeteoraDlmmInitializePool" | "MeteoraDlmmInitializeBinArray" | "MeteoraDlmmCreatePosition" | "MeteoraDlmmClosePosition" | "MeteoraDlmmClaimFee" | "TokenAccount" | "TokenInfo" | "NonceAccount" | "AccountPumpFunGlobal" | "AccountPumpFunBondingCurve" | "AccountPumpFunFeeConfig" | "AccountPumpFunSharingConfig" | "AccountPumpFunGlobalVolumeAccumulator" | "AccountPumpFunUserVolumeAccumulator" | "AccountPumpSwapGlobalConfig" | "AccountPumpSwapPool" | "AccountRaydiumClmmAmmConfig" | "AccountRaydiumClmmPoolState" | "AccountRaydiumClmmTickArrayState" | "AccountRaydiumCpmmAmmConfig" | "AccountRaydiumCpmmPoolState" | "AccountOrcaWhirlpool" | "AccountOrcaPosition" | "AccountOrcaTickArray" | "AccountOrcaFeeTier" | "AccountOrcaWhirlpoolsConfig";
|
|
157
|
+
export type EventType = "AccountRawSnapshot" | "AccountLiquiditySnapshot" | "BlockMeta" | "RaydiumLaunchlabTrade" | "RaydiumLaunchlabPoolCreate" | "RaydiumLaunchlabMigrateAmm" | "PumpFunTrade" | "PumpFunBuy" | "PumpFunSell" | "PumpFunBuyExactSolIn" | "PumpFunCreate" | "PumpFunCreateV2" | "PumpFunComplete" | "PumpFunMigrate" | "PumpFeesCreateFeeSharingConfig" | "PumpFeesInitializeFeeConfig" | "PumpFeesResetFeeSharingConfig" | "PumpFeesRevokeFeeSharingAuthority" | "PumpFeesTransferFeeSharingAuthority" | "PumpFeesUpdateAdmin" | "PumpFeesUpdateFeeConfig" | "PumpFeesUpdateFeeShares" | "PumpFeesUpsertFeeTiers" | "PumpFunPostCompleteBuy" | "PumpFunSweepBondingCurveFee" | "PumpSwapSweepPoolFee" | "PumpFunMigrateBondingCurveCreator" | "PumpSwapTrade" | "PumpSwapBuy" | "PumpSwapSell" | "PumpSwapCreatePool" | "PumpSwapLiquidityAdded" | "PumpSwapLiquidityRemoved" | "RaydiumCpmmSwap" | "RaydiumCpmmDeposit" | "RaydiumCpmmWithdraw" | "RaydiumCpmmInitialize" | "RaydiumClmmSwap" | "RaydiumClmmCreatePool" | "RaydiumClmmOpenPosition" | "RaydiumClmmClosePosition" | "RaydiumClmmIncreaseLiquidity" | "RaydiumClmmDecreaseLiquidity" | "RaydiumClmmLiquidityChange" | "RaydiumClmmConfigChange" | "RaydiumClmmCreatePersonalPosition" | "RaydiumClmmLiquidityCalculate" | "RaydiumClmmOpenLimitOrder" | "RaydiumClmmIncreaseLimitOrder" | "RaydiumClmmDecreaseLimitOrder" | "RaydiumClmmSettleLimitOrder" | "RaydiumClmmUpdateRewardInfos" | "RaydiumClmmOpenPositionWithTokenExtNft" | "RaydiumClmmCollectFee" | "RaydiumAmmV4Swap" | "RaydiumAmmV4Deposit" | "RaydiumAmmV4Withdraw" | "RaydiumAmmV4Initialize2" | "RaydiumAmmV4WithdrawPnl" | "OrcaWhirlpoolSwap" | "OrcaWhirlpoolLiquidityIncreased" | "OrcaWhirlpoolLiquidityDecreased" | "OrcaWhirlpoolPoolInitialized" | "MeteoraPoolsSwap" | "MeteoraPoolsAddLiquidity" | "MeteoraPoolsRemoveLiquidity" | "MeteoraPoolsBootstrapLiquidity" | "MeteoraPoolsPoolCreated" | "MeteoraPoolsSetPoolFees" | "MeteoraDammV2Swap" | "MeteoraDammV2AddLiquidity" | "MeteoraDammV2RemoveLiquidity" | "MeteoraDammV2InitializePool" | "MeteoraDammV2CreatePosition" | "MeteoraDammV2ClaimPositionFee" | "MeteoraDammV2ClaimReward" | "MeteoraDlmmClaimReward" | "MeteoraDammV2ClosePosition" | "MeteoraDammV2UpdateDelegatePermission" | "MeteoraDammV2WithdrawDeadLiquidityReward" | "MeteoraDammV2WithdrawIneligibleReward" | "MeteoraDammV2UpdateRewardFunder" | "MeteoraDammV2UpdateRewardDuration" | "MeteoraDammV2InitializeReward" | "MeteoraDammV2FundReward" | "MeteoraDammV2CreateConfig" | "MeteoraDammV2CreateDynamicConfig" | "MeteoraDbcSwap" | "MeteoraDbcInitializePool" | "MeteoraDbcCurveComplete" | "MeteoraDlmmSwap" | "MeteoraDlmmAddLiquidity" | "MeteoraDlmmRemoveLiquidity" | "MeteoraDlmmInitializePool" | "MeteoraDlmmInitializeBinArray" | "MeteoraDlmmCreatePosition" | "MeteoraDlmmClosePosition" | "MeteoraDlmmClaimFee" | "TokenAccount" | "TokenInfo" | "NonceAccount" | "AccountPumpFunGlobal" | "AccountPumpFunBondingCurve" | "AccountPumpFunFeeConfig" | "AccountPumpFunSharingConfig" | "AccountPumpFunGlobalVolumeAccumulator" | "AccountPumpFunUserVolumeAccumulator" | "AccountPumpSwapGlobalConfig" | "AccountPumpSwapPool" | "AccountRaydiumClmmAmmConfig" | "AccountRaydiumClmmPoolState" | "AccountRaydiumClmmTickArrayState" | "AccountRaydiumCpmmAmmConfig" | "AccountRaydiumCpmmPoolState" | "AccountOrcaWhirlpool" | "AccountOrcaPosition" | "AccountOrcaTickArray" | "AccountOrcaFeeTier" | "AccountOrcaWhirlpoolsConfig";
|
|
155
158
|
/** 与 Rust `grpc::EventType`(由 `StreamingEventType` 导出)一致 */
|
|
156
159
|
export type StreamingEventType = EventType;
|
|
157
160
|
/** 所有事件类型列表 */
|
package/dist/grpc/types.js
CHANGED
|
@@ -207,9 +207,17 @@ exports.ALL_EVENT_TYPES = [
|
|
|
207
207
|
"MeteoraDammV2RemoveLiquidity",
|
|
208
208
|
"MeteoraDammV2InitializePool",
|
|
209
209
|
"MeteoraDammV2CreatePosition",
|
|
210
|
+
"MeteoraDammV2ClaimPositionFee",
|
|
211
|
+
"MeteoraDammV2ClaimReward",
|
|
212
|
+
"MeteoraDlmmClaimReward",
|
|
210
213
|
"MeteoraDammV2ClosePosition",
|
|
211
214
|
"MeteoraDammV2UpdateDelegatePermission",
|
|
212
215
|
"MeteoraDammV2WithdrawDeadLiquidityReward",
|
|
216
|
+
"MeteoraDammV2WithdrawIneligibleReward",
|
|
217
|
+
"MeteoraDammV2UpdateRewardFunder",
|
|
218
|
+
"MeteoraDammV2UpdateRewardDuration",
|
|
219
|
+
"MeteoraDammV2InitializeReward",
|
|
220
|
+
"MeteoraDammV2FundReward",
|
|
213
221
|
"MeteoraDammV2CreateConfig",
|
|
214
222
|
"MeteoraDammV2CreateDynamicConfig",
|
|
215
223
|
// Meteora DBC
|
|
@@ -249,6 +257,9 @@ exports.ALL_EVENT_TYPES = [
|
|
|
249
257
|
"AccountOrcaWhirlpoolsConfig",
|
|
250
258
|
"AccountLiquiditySnapshot",
|
|
251
259
|
"AccountRawSnapshot",
|
|
260
|
+
"PumpFunPostCompleteBuy",
|
|
261
|
+
"PumpFunSweepBondingCurveFee",
|
|
262
|
+
"PumpSwapSweepPoolFee",
|
|
252
263
|
];
|
|
253
264
|
const ALL_EVENT_TYPE_SET = new Set(exports.ALL_EVENT_TYPES);
|
|
254
265
|
const PUMPFUN_BUY_FAMILY = ["PumpFunBuy", "PumpFunBuyExactSolIn"];
|
|
@@ -279,9 +290,12 @@ const PUMPFUN_FILTER_TYPES = [
|
|
|
279
290
|
"PumpFunCreateV2",
|
|
280
291
|
"PumpFunComplete",
|
|
281
292
|
"PumpFunMigrate",
|
|
293
|
+
"PumpFunPostCompleteBuy",
|
|
294
|
+
"PumpFunSweepBondingCurveFee",
|
|
282
295
|
"PumpFunMigrateBondingCurveCreator",
|
|
283
296
|
];
|
|
284
297
|
const PUMPSWAP_FILTER_TYPES = [
|
|
298
|
+
"PumpSwapSweepPoolFee",
|
|
285
299
|
"PumpSwapTrade",
|
|
286
300
|
"PumpSwapBuy",
|
|
287
301
|
"PumpSwapSell",
|
|
@@ -294,10 +308,17 @@ const METEORA_DAMM_V2_FILTER_TYPES = [
|
|
|
294
308
|
"MeteoraDammV2AddLiquidity",
|
|
295
309
|
"MeteoraDammV2RemoveLiquidity",
|
|
296
310
|
"MeteoraDammV2CreatePosition",
|
|
311
|
+
"MeteoraDammV2ClaimPositionFee",
|
|
312
|
+
"MeteoraDammV2ClaimReward",
|
|
297
313
|
"MeteoraDammV2InitializePool",
|
|
298
314
|
"MeteoraDammV2ClosePosition",
|
|
299
315
|
"MeteoraDammV2UpdateDelegatePermission",
|
|
300
316
|
"MeteoraDammV2WithdrawDeadLiquidityReward",
|
|
317
|
+
"MeteoraDammV2WithdrawIneligibleReward",
|
|
318
|
+
"MeteoraDammV2UpdateRewardFunder",
|
|
319
|
+
"MeteoraDammV2UpdateRewardDuration",
|
|
320
|
+
"MeteoraDammV2InitializeReward",
|
|
321
|
+
"MeteoraDammV2FundReward",
|
|
301
322
|
"MeteoraDammV2CreateConfig",
|
|
302
323
|
"MeteoraDammV2CreateDynamicConfig",
|
|
303
324
|
];
|
|
@@ -323,6 +344,7 @@ const METEORA_DLMM_FILTER_TYPES = [
|
|
|
323
344
|
"MeteoraDlmmCreatePosition",
|
|
324
345
|
"MeteoraDlmmClosePosition",
|
|
325
346
|
"MeteoraDlmmClaimFee",
|
|
347
|
+
"MeteoraDlmmClaimReward",
|
|
326
348
|
];
|
|
327
349
|
const RAYDIUM_CLMM_FILTER_TYPES = [
|
|
328
350
|
"RaydiumClmmSwap",
|
|
@@ -371,6 +393,7 @@ const INSTRUCTION_EVENT_TYPES = [
|
|
|
371
393
|
...PUMPFUN_FILTER_TYPES,
|
|
372
394
|
...PUMP_FEES_EVENT_TYPES,
|
|
373
395
|
...PUMPSWAP_FILTER_TYPES,
|
|
396
|
+
...METEORA_DBC_FILTER_TYPES,
|
|
374
397
|
...METEORA_DAMM_V2_FILTER_TYPES,
|
|
375
398
|
...METEORA_POOLS_FILTER_TYPES,
|
|
376
399
|
...METEORA_DLMM_FILTER_TYPES,
|
package/dist/index.d.ts
CHANGED
|
@@ -58,3 +58,4 @@ export { analyzeSimulationRoutes } from "./simulation_route.js";
|
|
|
58
58
|
export { parseBlockMetaUpdate } from "./grpc/block_meta.js";
|
|
59
59
|
export { buildSubscribeRequestWithEventFilter } from "./grpc/subscribe_builder.js";
|
|
60
60
|
export type { LaunchLabPoolCreateEvent, StonkFunPoolCreateEvent, LaunchLabTradeEvent, StonkFunTradeEvent, } from "./core/dex_event.js";
|
|
61
|
+
export * from "./logs/pump_upgrade.js";
|
package/dist/index.js
CHANGED
|
@@ -316,3 +316,4 @@ var block_meta_js_1 = require("./grpc/block_meta.js");
|
|
|
316
316
|
Object.defineProperty(exports, "parseBlockMetaUpdate", { enumerable: true, get: function () { return block_meta_js_1.parseBlockMetaUpdate; } });
|
|
317
317
|
var subscribe_builder_js_3 = require("./grpc/subscribe_builder.js");
|
|
318
318
|
Object.defineProperty(exports, "buildSubscribeRequestWithEventFilter", { enumerable: true, get: function () { return subscribe_builder_js_3.buildSubscribeRequestWithEventFilter; } });
|
|
319
|
+
__exportStar(require("./logs/pump_upgrade.js"), exports);
|
package/dist/instr/inner.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseInnerCompiledInstructionIfSupported = parseInnerCompiledInstructionIfSupported;
|
|
4
4
|
exports.parseInnerInstructionUnified = parseInnerInstructionUnified;
|
|
5
|
+
const meteora_dbc_js_1 = require("../logs/meteora_dbc.js");
|
|
6
|
+
const pump_upgrade_js_1 = require("../logs/pump_upgrade.js");
|
|
5
7
|
const metadata_js_1 = require("../core/metadata.js");
|
|
6
8
|
const types_js_1 = require("../grpc/types.js");
|
|
7
9
|
const program_ids_js_1 = require("../grpc/program_ids.js");
|
|
@@ -116,6 +118,8 @@ const LOG = {
|
|
|
116
118
|
METEORA_DAMM_INITIALIZE_POOL: [228, 50, 246, 85, 203, 66, 134, 37],
|
|
117
119
|
METEORA_DAMM_CREATE_POSITION: [156, 15, 119, 198, 29, 181, 221, 55],
|
|
118
120
|
METEORA_DAMM_CLOSE_POSITION: [20, 145, 144, 68, 143, 142, 214, 178],
|
|
121
|
+
METEORA_DAMM_CLAIM_POSITION_FEE: [198, 182, 183, 52, 97, 12, 49, 56],
|
|
122
|
+
METEORA_DAMM_CLAIM_REWARD: [218, 86, 147, 200, 235, 188, 215, 231],
|
|
119
123
|
METEORA_DLMM_SWAP: [81, 108, 227, 190, 205, 208, 10, 196],
|
|
120
124
|
METEORA_DLMM_SWAP2: [46, 116, 82, 215, 148, 27, 84, 77],
|
|
121
125
|
METEORA_DLMM_ADD_LIQUIDITY: [31, 94, 125, 90, 227, 52, 61, 186],
|
|
@@ -131,6 +135,9 @@ const LOG = {
|
|
|
131
135
|
};
|
|
132
136
|
const IX = {
|
|
133
137
|
PUMPFUN: [
|
|
138
|
+
[7, 5, 29, 196, 245, 23, 101, 80],
|
|
139
|
+
[225, 247, 80, 30, 213, 179, 132, 136],
|
|
140
|
+
[28, 146, 222, 119, 38, 196, 105, 213],
|
|
134
141
|
[24, 30, 200, 40, 5, 28, 7, 119],
|
|
135
142
|
[214, 144, 76, 236, 95, 139, 49, 180],
|
|
136
143
|
[102, 6, 61, 18, 1, 218, 235, 234],
|
|
@@ -141,6 +148,9 @@ const IX = {
|
|
|
141
148
|
[93, 246, 130, 60, 231, 233, 64, 178],
|
|
142
149
|
],
|
|
143
150
|
PUMPSWAP: [
|
|
151
|
+
[184, 23, 238, 97, 103, 197, 211, 61],
|
|
152
|
+
[194, 171, 28, 70, 104, 77, 91, 47],
|
|
153
|
+
[93, 246, 130, 60, 231, 233, 64, 178],
|
|
144
154
|
[102, 6, 61, 18, 1, 218, 235, 234],
|
|
145
155
|
[51, 230, 133, 164, 1, 127, 131, 173],
|
|
146
156
|
[233, 146, 209, 142, 207, 104, 64, 188],
|
|
@@ -171,6 +181,7 @@ const IX = {
|
|
|
171
181
|
[37, 190, 126, 222, 44, 154, 171, 17],
|
|
172
182
|
],
|
|
173
183
|
RAYDIUM_CPMM: [
|
|
184
|
+
[63, 55, 254, 65, 49, 178, 89, 121],
|
|
174
185
|
LOG.RAYDIUM_CPMM_SWAP_BASE_IN,
|
|
175
186
|
LOG.RAYDIUM_CPMM_SWAP_BASE_OUT,
|
|
176
187
|
[175, 175, 109, 31, 13, 152, 155, 237],
|
|
@@ -194,13 +205,16 @@ const IX = {
|
|
|
194
205
|
[43, 4, 237, 11, 26, 201, 30, 98],
|
|
195
206
|
[46, 156, 243, 118, 13, 205, 251, 178],
|
|
196
207
|
[160, 38, 208, 111, 104, 91, 44, 1],
|
|
208
|
+
[133, 29, 89, 223, 69, 238, 176, 10],
|
|
209
|
+
[58, 127, 188, 62, 79, 82, 196, 96],
|
|
197
210
|
[17, 43, 80, 74, 168, 202, 6, 113],
|
|
198
211
|
],
|
|
199
212
|
METEORA_POOLS: [
|
|
200
213
|
[248, 198, 158, 145, 225, 117, 135, 200],
|
|
201
214
|
[181, 157, 89, 67, 143, 182, 52, 72],
|
|
202
215
|
[80, 85, 209, 72, 24, 206, 177, 108],
|
|
203
|
-
[
|
|
216
|
+
[7, 166, 138, 171, 206, 171, 236, 244],
|
|
217
|
+
[48, 149, 220, 130, 61, 11, 9, 178],
|
|
204
218
|
],
|
|
205
219
|
METEORA_DLMM: [
|
|
206
220
|
[181, 157, 89, 67, 143, 182, 52, 72],
|
|
@@ -305,6 +319,10 @@ function parseInnerInstructionUnified(instructionData, accounts, signature, slot
|
|
|
305
319
|
const disc = instructionData.subarray(0, 16);
|
|
306
320
|
const data = instructionData.subarray(16);
|
|
307
321
|
const metadata = (0, metadata_js_1.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
322
|
+
const upgradeDisc = eventCpiDiscriminator(disc);
|
|
323
|
+
if (upgradeDisc !== null && (0, pump_upgrade_js_1.pumpUpgradeEventType)(upgradeDisc, programId)) {
|
|
324
|
+
return filterDexEvent((0, pump_upgrade_js_1.parsePumpUpgradeEvent)(upgradeDisc, data, metadata, programId), filter);
|
|
325
|
+
}
|
|
308
326
|
let ev = null;
|
|
309
327
|
if (programId === program_ids_js_1.PUMPFUN_PROGRAM_ID) {
|
|
310
328
|
if (filter && !(0, types_js_1.eventTypeFilterIncludesPumpfun)(filter))
|
|
@@ -452,6 +470,15 @@ function parseInnerInstructionUnified(instructionData, accounts, signature, slot
|
|
|
452
470
|
return null;
|
|
453
471
|
ev = (0, meteora_damm_ix_js_1.parseMeteoraDammInstruction)(instructionData, accounts, signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
454
472
|
}
|
|
473
|
+
else if (programId === program_ids_js_1.METEORA_DBC_PROGRAM_ID) {
|
|
474
|
+
if (filter && !(0, types_js_1.eventTypeFilterIncludesMeteoraDbc)(filter))
|
|
475
|
+
return null;
|
|
476
|
+
if (!discEq(disc, EVENT_CPI_PREFIX))
|
|
477
|
+
return null;
|
|
478
|
+
const dbcDisc = eventCpiDiscriminator(disc);
|
|
479
|
+
if (dbcDisc !== null)
|
|
480
|
+
ev = (0, meteora_dbc_js_1.parseMeteoraDbcFromDiscriminator)(dbcDisc, data, metadata);
|
|
481
|
+
}
|
|
455
482
|
else if (programId === program_ids_js_1.METEORA_DLMM_PROGRAM_ID) {
|
|
456
483
|
if (filter && !(0, types_js_1.eventTypeFilterIncludesMeteoraDlmm)(filter))
|
|
457
484
|
return null;
|
|
@@ -11,6 +11,8 @@ function disc8(a) {
|
|
|
11
11
|
const CPI = {
|
|
12
12
|
SWAP_LOG: disc8([27, 60, 21, 213, 138, 170, 187, 147]),
|
|
13
13
|
SWAP2_LOG: disc8([189, 66, 51, 168, 38, 80, 117, 153]),
|
|
14
|
+
CLAIM_POSITION_FEE_LOG: disc8([198, 182, 183, 52, 97, 12, 49, 56]),
|
|
15
|
+
CLAIM_REWARD_LOG: disc8([218, 86, 147, 200, 235, 188, 215, 231]),
|
|
14
16
|
CREATE_POSITION_LOG: disc8([156, 15, 119, 198, 29, 181, 221, 55]),
|
|
15
17
|
CLOSE_POSITION_LOG: disc8([20, 145, 144, 68, 143, 142, 214, 178]),
|
|
16
18
|
ADD_LIQUIDITY_LOG: disc8([175, 242, 8, 157, 30, 247, 185, 169]),
|
|
@@ -18,6 +20,11 @@ const CPI = {
|
|
|
18
20
|
LIQUIDITY_CHANGE_LOG: disc8([197, 171, 78, 127, 224, 211, 87, 13]),
|
|
19
21
|
UPDATE_DELEGATE_PERMISSION_LOG: disc8([66, 188, 75, 151, 150, 232, 87, 93]),
|
|
20
22
|
WITHDRAW_DEAD_LIQUIDITY_REWARD_LOG: disc8([228, 66, 150, 195, 42, 62, 163, 13]),
|
|
23
|
+
WITHDRAW_INELIGIBLE_REWARD_LOG: disc8([248, 215, 184, 78, 31, 180, 179, 168]),
|
|
24
|
+
UPDATE_REWARD_FUNDER_LOG: disc8([76, 154, 208, 13, 40, 115, 246, 146]),
|
|
25
|
+
UPDATE_REWARD_DURATION_LOG: disc8([149, 135, 65, 231, 129, 153, 65, 57]),
|
|
26
|
+
INITIALIZE_REWARD_LOG: disc8([129, 91, 188, 3, 246, 52, 185, 249]),
|
|
27
|
+
FUND_REWARD_LOG: disc8([104, 233, 237, 122, 199, 191, 121, 85]),
|
|
21
28
|
CREATE_CONFIG_LOG: disc8([131, 207, 180, 174, 180, 73, 165, 54]),
|
|
22
29
|
CREATE_DYNAMIC_CONFIG_LOG: disc8([231, 197, 13, 164, 248, 213, 133, 152]),
|
|
23
30
|
};
|
|
@@ -398,6 +405,10 @@ function parseMeteoraDammInstruction(instructionData, accounts, signature, slot,
|
|
|
398
405
|
return parseSwapCpi(cpiData, accounts, meta);
|
|
399
406
|
if (discEq(cpiHead, CPI.SWAP2_LOG))
|
|
400
407
|
return parseSwap2Cpi(cpiData, accounts, meta);
|
|
408
|
+
if (discEq(cpiHead, CPI.CLAIM_POSITION_FEE_LOG))
|
|
409
|
+
return (0, meteora_damm_js_1.parseClaimPositionFee)(cpiData, meta);
|
|
410
|
+
if (discEq(cpiHead, CPI.CLAIM_REWARD_LOG))
|
|
411
|
+
return (0, meteora_damm_js_1.parseClaimReward)(cpiData, meta);
|
|
401
412
|
if (discEq(cpiHead, CPI.CREATE_POSITION_LOG)) {
|
|
402
413
|
let o = 0;
|
|
403
414
|
const pool = (0, utils_js_1.readPubkeyIx)(cpiData, o);
|
|
@@ -553,6 +564,21 @@ function parseMeteoraDammInstruction(instructionData, accounts, signature, slot,
|
|
|
553
564
|
if (discEq(cpiHead, CPI.WITHDRAW_DEAD_LIQUIDITY_REWARD_LOG)) {
|
|
554
565
|
return (0, meteora_damm_js_1.parseWithdrawDeadLiquidityRewardFromData)(cpiData, meta);
|
|
555
566
|
}
|
|
567
|
+
if (discEq(cpiHead, CPI.WITHDRAW_INELIGIBLE_REWARD_LOG)) {
|
|
568
|
+
return (0, meteora_damm_js_1.parseWithdrawIneligibleRewardFromData)(cpiData, meta);
|
|
569
|
+
}
|
|
570
|
+
if (discEq(cpiHead, CPI.UPDATE_REWARD_FUNDER_LOG)) {
|
|
571
|
+
return (0, meteora_damm_js_1.parseUpdateRewardFunderFromData)(cpiData, meta);
|
|
572
|
+
}
|
|
573
|
+
if (discEq(cpiHead, CPI.UPDATE_REWARD_DURATION_LOG)) {
|
|
574
|
+
return (0, meteora_damm_js_1.parseUpdateRewardDurationFromData)(cpiData, meta);
|
|
575
|
+
}
|
|
576
|
+
if (discEq(cpiHead, CPI.INITIALIZE_REWARD_LOG)) {
|
|
577
|
+
return (0, meteora_damm_js_1.parseInitializeRewardFromData)(cpiData, meta);
|
|
578
|
+
}
|
|
579
|
+
if (discEq(cpiHead, CPI.FUND_REWARD_LOG)) {
|
|
580
|
+
return (0, meteora_damm_js_1.parseFundRewardFromData)(cpiData, meta);
|
|
581
|
+
}
|
|
556
582
|
if (discEq(cpiHead, CPI.CREATE_CONFIG_LOG)) {
|
|
557
583
|
return (0, meteora_damm_js_1.parseCreateConfigFromData)(cpiData, meta);
|
|
558
584
|
}
|
|
@@ -10,7 +10,8 @@ const DISC = {
|
|
|
10
10
|
SWAP: (0, program_log_discriminators_js_1.u64leDiscriminator)([248, 198, 158, 145, 225, 117, 135, 200]),
|
|
11
11
|
ADD_LIQUIDITY: (0, program_log_discriminators_js_1.u64leDiscriminator)([181, 157, 89, 67, 143, 182, 52, 72]),
|
|
12
12
|
REMOVE_LIQUIDITY: (0, program_log_discriminators_js_1.u64leDiscriminator)([80, 85, 209, 72, 24, 206, 177, 108]),
|
|
13
|
-
CREATE_POOL: (0, program_log_discriminators_js_1.u64leDiscriminator)([
|
|
13
|
+
CREATE_POOL: (0, program_log_discriminators_js_1.u64leDiscriminator)([7, 166, 138, 171, 206, 171, 236, 244]),
|
|
14
|
+
CREATE_POOL_CONFIG2: (0, program_log_discriminators_js_1.u64leDiscriminator)([48, 149, 220, 130, 61, 11, 9, 178]),
|
|
14
15
|
};
|
|
15
16
|
function discEq(data, disc) {
|
|
16
17
|
if (data.length < 8)
|
|
@@ -28,8 +29,10 @@ function parseMeteoraPoolsInstruction(instructionData, accounts, signature, slot
|
|
|
28
29
|
return {
|
|
29
30
|
MeteoraPoolsSwap: {
|
|
30
31
|
metadata,
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
amount_in: (0, binary_js_1.readU64LE)(instructionData, 8) ?? 0n,
|
|
33
|
+
minimum_out_amount: (0, binary_js_1.readU64LE)(instructionData, 16) ?? 0n,
|
|
34
|
+
in_amount: 0n,
|
|
35
|
+
out_amount: 0n,
|
|
33
36
|
trade_fee: 0n,
|
|
34
37
|
admin_fee: 0n,
|
|
35
38
|
host_fee: 0n,
|
|
@@ -60,16 +63,21 @@ function parseMeteoraPoolsInstruction(instructionData, accounts, signature, slot
|
|
|
60
63
|
},
|
|
61
64
|
};
|
|
62
65
|
}
|
|
63
|
-
if (discEq(instructionData, DISC.CREATE_POOL)) {
|
|
64
|
-
if (instructionData.length <
|
|
66
|
+
if (discEq(instructionData, DISC.CREATE_POOL) || discEq(instructionData, DISC.CREATE_POOL_CONFIG2)) {
|
|
67
|
+
if (instructionData.length < 24 || accounts.length < 5)
|
|
65
68
|
return null;
|
|
69
|
+
if (discEq(instructionData, DISC.CREATE_POOL_CONFIG2)) {
|
|
70
|
+
const tag = (0, binary_js_1.readU8)(instructionData, 24);
|
|
71
|
+
if (tag === null || (tag !== 0 && tag !== 1) || (tag === 1 && instructionData.length < 33))
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
66
74
|
return {
|
|
67
75
|
MeteoraPoolsPoolCreated: {
|
|
68
76
|
metadata,
|
|
69
|
-
lp_mint: (0, utils_js_1.getAccount)(accounts,
|
|
70
|
-
token_a_mint: (0, utils_js_1.getAccount)(accounts,
|
|
71
|
-
token_b_mint: (0, utils_js_1.getAccount)(accounts,
|
|
72
|
-
pool_type:
|
|
77
|
+
lp_mint: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
|
|
78
|
+
token_a_mint: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
|
|
79
|
+
token_b_mint: (0, utils_js_1.getAccount)(accounts, 4) ?? Z,
|
|
80
|
+
pool_type: 1, // PoolType::Permissionless, independent of CurveType.
|
|
73
81
|
pool: pool ?? Z,
|
|
74
82
|
},
|
|
75
83
|
};
|
|
@@ -9,6 +9,8 @@ const DISC = {
|
|
|
9
9
|
SWAP: (0, program_log_discriminators_js_1.u64leDiscriminator)([248, 198, 158, 145, 225, 117, 135, 200]),
|
|
10
10
|
SWAP_V2: (0, program_log_discriminators_js_1.u64leDiscriminator)([43, 4, 237, 11, 26, 201, 30, 98]),
|
|
11
11
|
INCREASE_LIQUIDITY: (0, program_log_discriminators_js_1.u64leDiscriminator)([46, 156, 243, 118, 13, 205, 251, 178]),
|
|
12
|
+
INCREASE_LIQUIDITY_V2: (0, program_log_discriminators_js_1.u64leDiscriminator)([133, 29, 89, 223, 69, 238, 176, 10]),
|
|
13
|
+
DECREASE_LIQUIDITY_V2: (0, program_log_discriminators_js_1.u64leDiscriminator)([58, 127, 188, 62, 79, 82, 196, 96]),
|
|
12
14
|
DECREASE_LIQUIDITY: (0, program_log_discriminators_js_1.u64leDiscriminator)([160, 38, 208, 111, 104, 91, 44, 1]),
|
|
13
15
|
INITIALIZE_POOL: (0, program_log_discriminators_js_1.u64leDiscriminator)([17, 43, 80, 74, 168, 202, 6, 113]),
|
|
14
16
|
};
|
|
@@ -51,9 +53,10 @@ function parseOrcaWhirlpoolInstruction(instructionData, accounts, signature, slo
|
|
|
51
53
|
},
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
if (discEq(instructionData, DISC.INCREASE_LIQUIDITY)) {
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
if (discEq(instructionData, DISC.INCREASE_LIQUIDITY) || discEq(instructionData, DISC.INCREASE_LIQUIDITY_V2)) {
|
|
57
|
+
const v2 = discEq(instructionData, DISC.INCREASE_LIQUIDITY_V2);
|
|
58
|
+
// increase_liquidity:liquidity_amount (u128), token_max_a, token_max_b
|
|
59
|
+
if (instructionData.length < 8 + 16 + 8 + 8 + Number(v2))
|
|
57
60
|
return null;
|
|
58
61
|
const liquidity = (0, utils_js_1.readU128LE)(instructionData, 8) ?? 0n;
|
|
59
62
|
const token_max_a = (0, utils_js_1.readU64LE)(instructionData, 24) ?? 0n;
|
|
@@ -61,8 +64,8 @@ function parseOrcaWhirlpoolInstruction(instructionData, accounts, signature, slo
|
|
|
61
64
|
return {
|
|
62
65
|
OrcaWhirlpoolLiquidityIncreased: {
|
|
63
66
|
metadata: meta,
|
|
64
|
-
whirlpool: (0, utils_js_1.getAccount)(accounts,
|
|
65
|
-
position: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
|
|
67
|
+
whirlpool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
|
|
68
|
+
position: (0, utils_js_1.getAccount)(accounts, v2 ? 5 : 3) ?? Z,
|
|
66
69
|
tick_lower_index: 0,
|
|
67
70
|
tick_upper_index: 0,
|
|
68
71
|
liquidity,
|
|
@@ -73,9 +76,10 @@ function parseOrcaWhirlpoolInstruction(instructionData, accounts, signature, slo
|
|
|
73
76
|
},
|
|
74
77
|
};
|
|
75
78
|
}
|
|
76
|
-
if (discEq(instructionData, DISC.DECREASE_LIQUIDITY)) {
|
|
79
|
+
if (discEq(instructionData, DISC.DECREASE_LIQUIDITY) || discEq(instructionData, DISC.DECREASE_LIQUIDITY_V2)) {
|
|
80
|
+
const v2 = discEq(instructionData, DISC.DECREASE_LIQUIDITY_V2);
|
|
77
81
|
// decrease_liquidity:liquidity_amount (u128), token_min_a, token_min_b
|
|
78
|
-
if (instructionData.length < 8 + 16 + 8 + 8)
|
|
82
|
+
if (instructionData.length < 8 + 16 + 8 + 8 + Number(v2))
|
|
79
83
|
return null;
|
|
80
84
|
const liquidity = (0, utils_js_1.readU128LE)(instructionData, 8) ?? 0n;
|
|
81
85
|
const token_min_a = (0, utils_js_1.readU64LE)(instructionData, 24) ?? 0n;
|
|
@@ -83,8 +87,8 @@ function parseOrcaWhirlpoolInstruction(instructionData, accounts, signature, slo
|
|
|
83
87
|
return {
|
|
84
88
|
OrcaWhirlpoolLiquidityDecreased: {
|
|
85
89
|
metadata: meta,
|
|
86
|
-
whirlpool: (0, utils_js_1.getAccount)(accounts,
|
|
87
|
-
position: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
|
|
90
|
+
whirlpool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
|
|
91
|
+
position: (0, utils_js_1.getAccount)(accounts, v2 ? 5 : 3) ?? Z,
|
|
88
92
|
tick_lower_index: 0,
|
|
89
93
|
tick_upper_index: 0,
|
|
90
94
|
liquidity,
|
package/dist/instr/pumpfun_ix.js
CHANGED
|
@@ -288,6 +288,90 @@ function parsePumpfunInstruction(instructionData, accounts, signature, slot, txI
|
|
|
288
288
|
const outer = instructionData.subarray(0, 8);
|
|
289
289
|
const data = instructionData.subarray(8);
|
|
290
290
|
const meta = (0, utils_js_1.ixMeta)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
291
|
+
if (discEq(outer, Uint8Array.from([7, 5, 29, 196, 245, 23, 101, 80]))) {
|
|
292
|
+
if (accounts.length !== 17 || data.length < 16 || data.length > 17 || (data.length === 17 && data[16] > 1))
|
|
293
|
+
return null;
|
|
294
|
+
const mapped = Array(27).fill(Z);
|
|
295
|
+
mapped[0] = accounts[0];
|
|
296
|
+
mapped[1] = accounts[1];
|
|
297
|
+
mapped[2] = accounts[2];
|
|
298
|
+
mapped[3] = accounts[3];
|
|
299
|
+
mapped[4] = accounts[4];
|
|
300
|
+
mapped[8] = accounts[13];
|
|
301
|
+
mapped[10] = accounts[5];
|
|
302
|
+
mapped[11] = accounts[6];
|
|
303
|
+
mapped[12] = accounts[7];
|
|
304
|
+
mapped[13] = accounts[8];
|
|
305
|
+
mapped[14] = accounts[9];
|
|
306
|
+
mapped[15] = accounts[10];
|
|
307
|
+
mapped[20] = accounts[11];
|
|
308
|
+
mapped[22] = accounts[12];
|
|
309
|
+
mapped[24] = accounts[14];
|
|
310
|
+
mapped[25] = accounts[15];
|
|
311
|
+
mapped[26] = accounts[16];
|
|
312
|
+
const ev = parsePumpfunTradeV2Instruction("buy_v2", data, mapped, meta);
|
|
313
|
+
if (ev) {
|
|
314
|
+
const trade = Object.values(ev)[0];
|
|
315
|
+
trade.ix_name = "buy_v3";
|
|
316
|
+
}
|
|
317
|
+
return ev;
|
|
318
|
+
}
|
|
319
|
+
if (discEq(outer, Uint8Array.from([225, 247, 80, 30, 213, 179, 132, 136]))) {
|
|
320
|
+
if (accounts.length !== 17 || data.length < 16 || data.length > 17 || (data.length === 17 && data[16] > 1))
|
|
321
|
+
return null;
|
|
322
|
+
const mapped = Array(27).fill(Z);
|
|
323
|
+
mapped[0] = accounts[0];
|
|
324
|
+
mapped[1] = accounts[1];
|
|
325
|
+
mapped[2] = accounts[2];
|
|
326
|
+
mapped[3] = accounts[3];
|
|
327
|
+
mapped[4] = accounts[4];
|
|
328
|
+
mapped[8] = accounts[13];
|
|
329
|
+
mapped[10] = accounts[5];
|
|
330
|
+
mapped[11] = accounts[6];
|
|
331
|
+
mapped[12] = accounts[7];
|
|
332
|
+
mapped[13] = accounts[8];
|
|
333
|
+
mapped[14] = accounts[9];
|
|
334
|
+
mapped[15] = accounts[10];
|
|
335
|
+
mapped[20] = accounts[11];
|
|
336
|
+
mapped[22] = accounts[12];
|
|
337
|
+
mapped[24] = accounts[14];
|
|
338
|
+
mapped[25] = accounts[15];
|
|
339
|
+
mapped[26] = accounts[16];
|
|
340
|
+
const ev = parsePumpfunTradeV2Instruction("buy_exact_quote_in_v2", data, mapped, meta);
|
|
341
|
+
if (ev) {
|
|
342
|
+
const trade = Object.values(ev)[0];
|
|
343
|
+
trade.ix_name = "buy_exact_quote_in_v3";
|
|
344
|
+
}
|
|
345
|
+
return ev;
|
|
346
|
+
}
|
|
347
|
+
if (discEq(outer, Uint8Array.from([28, 146, 222, 119, 38, 196, 105, 213]))) {
|
|
348
|
+
if (accounts.length !== 17 || data.length < 16 || data.length > 17 || data.length !== 16)
|
|
349
|
+
return null;
|
|
350
|
+
const mapped = Array(27).fill(Z);
|
|
351
|
+
mapped[0] = accounts[0];
|
|
352
|
+
mapped[1] = accounts[1];
|
|
353
|
+
mapped[2] = accounts[2];
|
|
354
|
+
mapped[3] = accounts[3];
|
|
355
|
+
mapped[4] = accounts[4];
|
|
356
|
+
mapped[8] = accounts[13];
|
|
357
|
+
mapped[10] = accounts[5];
|
|
358
|
+
mapped[11] = accounts[6];
|
|
359
|
+
mapped[12] = accounts[7];
|
|
360
|
+
mapped[13] = accounts[8];
|
|
361
|
+
mapped[14] = accounts[9];
|
|
362
|
+
mapped[15] = accounts[10];
|
|
363
|
+
mapped[19] = accounts[11];
|
|
364
|
+
mapped[21] = accounts[12];
|
|
365
|
+
mapped[23] = accounts[14];
|
|
366
|
+
mapped[24] = accounts[15];
|
|
367
|
+
mapped[25] = accounts[16];
|
|
368
|
+
const ev = parsePumpfunTradeV2Instruction("sell_v2", data, mapped, meta);
|
|
369
|
+
if (ev) {
|
|
370
|
+
const trade = Object.values(ev)[0];
|
|
371
|
+
trade.ix_name = "sell_v3";
|
|
372
|
+
}
|
|
373
|
+
return ev;
|
|
374
|
+
}
|
|
291
375
|
if (discEq(outer, DISC.CREATE_V2)) {
|
|
292
376
|
if (accounts.length < 16)
|
|
293
377
|
return null;
|