sol-parser-sdk 0.5.15 → 0.5.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NATIVE_ALIGNMENT.md +312 -0
- package/NATIVE_DAMM_FACTORY_ALIGNMENT_20261004.md +16 -0
- package/NATIVE_DAMM_FACTORY_EVIDENCE_20261004.json +55 -0
- package/NATIVE_MIGRATION.md +38 -0
- package/NATIVE_PUMPFUN_NATIVE_DEBIT_ALIGNMENT_20261004.md +18 -0
- package/NATIVE_PUMPFUN_NATIVE_DEBIT_EVIDENCE_20261004.json +57 -0
- package/NATIVE_PUMPFUN_SETTLEMENT_ALIGNMENT_20261004.md +11 -0
- package/NATIVE_PUMPFUN_SETTLEMENT_EVIDENCE_20261004.json +70 -0
- package/README.md +24 -1
- package/README_CN.md +21 -1
- package/dist/accounts/mod.js +7 -0
- package/dist/core/account_dispatcher_rpc.js +50 -6
- package/dist/core/account_fill_pumpfun.js +7 -16
- package/dist/core/account_fill_raydium.js +12 -2
- package/dist/core/account_fill_raydium_launchlab.js +6 -0
- package/dist/core/clock.js +1 -1
- package/dist/core/dex_event.d.ts +30 -0
- package/dist/core/metadata.d.ts +9 -5
- package/dist/core/metadata.js +28 -4
- package/dist/core/unified_parser.d.ts +7 -7
- package/dist/grpc/block_meta.d.ts +9 -0
- package/dist/grpc/block_meta.js +26 -0
- package/dist/grpc/client.d.ts +24 -9
- package/dist/grpc/client.js +129 -67
- package/dist/grpc/geyser_connect.d.ts +3 -3
- package/dist/grpc/geyser_connect.js +13 -15
- package/dist/grpc/native_client.d.ts +26 -0
- package/dist/grpc/native_client.js +101 -0
- package/dist/grpc/order_buffer.d.ts +1 -1
- package/dist/grpc/order_buffer.js +10 -9
- package/dist/grpc/program_ids.js +2 -0
- package/dist/grpc/protocol/LICENSE +202 -0
- package/dist/grpc/protocol/NOTICE +4 -0
- package/dist/grpc/protocol/geyser.d.ts +342 -0
- package/dist/grpc/protocol/geyser.js +37 -0
- package/dist/grpc/protocol/geyser.proto +326 -0
- package/dist/grpc/protocol/solana-storage.d.ts +139 -0
- package/dist/grpc/protocol/solana-storage.js +14 -0
- package/dist/grpc/protocol/solana-storage.proto +151 -0
- package/dist/grpc/rpc_to_grpc.d.ts +1 -1
- package/dist/grpc/rpc_to_grpc.js +3 -2
- package/dist/grpc/subscribe_builder.d.ts +5 -3
- package/dist/grpc/subscribe_builder.js +11 -3
- package/dist/grpc/transaction_meta.d.ts +1 -1
- package/dist/grpc/types.d.ts +8 -8
- package/dist/grpc/types.js +7 -2
- package/dist/grpc/yellowstone_parse.d.ts +3 -3
- package/dist/grpc/yellowstone_parse.js +6 -8
- package/dist/grpc/yellowstone_transaction_adapter.d.ts +1 -1
- package/dist/grpc/yellowstone_transaction_adapter.js +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +23 -5
- package/dist/instr/inner.d.ts +2 -2
- package/dist/instr/inner.js +1 -1
- package/dist/instr/meteora_damm_ix.d.ts +1 -1
- package/dist/instr/meteora_dlmm_ix.d.ts +1 -1
- package/dist/instr/meteora_pools_ix.d.ts +1 -1
- package/dist/instr/mod.d.ts +1 -1
- package/dist/instr/orca_whirlpool_ix.d.ts +1 -1
- package/dist/instr/pump_fees_ix.d.ts +1 -1
- package/dist/instr/pumpfun_ix.d.ts +1 -1
- package/dist/instr/pumpfun_ix.js +3 -3
- package/dist/instr/pumpswap_ix.d.ts +1 -1
- package/dist/instr/raydium_amm_v4_ix.d.ts +1 -1
- package/dist/instr/raydium_amm_v4_ix.js +9 -5
- package/dist/instr/raydium_clmm_ix.d.ts +1 -1
- package/dist/instr/raydium_cpmm_ix.d.ts +1 -1
- package/dist/instr/raydium_launchlab_ix.d.ts +1 -1
- package/dist/instr/raydium_launchlab_ix.js +62 -2
- package/dist/instr/utils.d.ts +2 -2
- package/dist/instr/utils.js +2 -7
- package/dist/liquidity_snapshot.d.ts +54 -0
- package/dist/liquidity_snapshot.js +85 -0
- package/dist/logs/meteora_damm.d.ts +1 -1
- package/dist/logs/meteora_damm.js +4 -2
- package/dist/logs/meteora_dlmm.d.ts +1 -1
- package/dist/logs/optimized_matcher.d.ts +3 -3
- package/dist/logs/pump.js +11 -0
- package/dist/logs/raydium_launchlab.js +19 -1
- package/dist/rpc_transaction.d.ts +4 -3
- package/dist/rpc_transaction.js +6 -2
- package/dist/shredstream/client.js +3 -7
- package/dist/shredstream/entries_decode.js +9 -85
- package/dist/shredstream/instruction_parse.d.ts +3 -3
- package/dist/shredstream/proto_types.d.ts +1 -1
- package/dist/shredstream/wire_to_shred_tx.d.ts +1 -1
- package/dist/shredstream/wire_to_shred_tx.js +9 -44
- package/dist/simulation_route.d.ts +6 -0
- package/dist/simulation_route.js +242 -0
- package/dist/stonkfun_registry.d.ts +30 -0
- package/dist/stonkfun_registry.js +137 -0
- package/dist/transaction_route.d.ts +84 -0
- package/dist/transaction_route.js +477 -0
- package/dist/wire_transaction.d.ts +35 -0
- package/dist/wire_transaction.js +191 -0
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -32,12 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.high_throughput_shred_stream_config = exports.low_latency_shred_stream_config = exports.default_shred_stream_config = exports.highThroughputShredStreamConfig = exports.lowLatencyShredStreamConfig = exports.defaultShredStreamConfig = exports.wireBytesToShredWasmTx = exports.decodeShredstreamEntriesBincode = exports.decodeEntriesBincodeNested = exports.decodeEntriesBincodeFlat = exports.bincodeVecEntryCount = exports.loadAddressLookupTableAccounts = exports.fullAccountKeyStringsFromShredTx = exports.dexEventsFromShredWasmTxWithFullKeys = exports.dexEventsFromShredWasmTx = exports.ShredEventQueue = exports.ShredStreamClient = void 0;
|
|
39
|
+
exports.pubkeyBytesToBs58 = exports.grpcTxIndexFromInfo = exports.parseDexEventsFromGrpcTransactionInfo = exports.convert_rpc_to_grpc = exports.convertRpcToGrpc = exports.applyAccountFillsToLogEvents = exports.fillDataRpc = exports.fillAccountsFromTransactionDataRpc = exports.parseRpcTransaction = exports.parseTransactionFromRpc = exports.isWarmedUp = exports.warmupParser = exports.build_account_pubkeys_with_cache = exports.buildAccountPubkeysWithCache = exports.AccountPubkeyCache = exports.normalizeBuySellFromInputMint = exports.normalizeBuySellFromTokenDelta = exports.vaultPriceFromBalances = exports.sqrtPriceX64ToPrice = exports.elapsedMicrosSince = exports.nowNanos = exports.nowMicros = exports.nowUs = exports.parse_log = exports.parseLog = exports.parseTransactionWithStreamingListener = exports.parseLogsStreaming = exports.parseTransactionEventsStreaming = exports.parseTransactionWithListener = exports.parseLogsOnly = exports.parseTransactionEvents = exports.enrichPumpfunSameTxPostMerge = exports.enrichPumpfunTradesFromCreateInstructions = exports.enrichCreateV2ObservedFeeRecipient = exports.enrichCreateV2FromCreateEvents = exports.formatParseError = exports.exactI64 = exports.exactU64 = exports.exactInteger = exports.dexEventToJsonString = exports.bigintToJsonReplacer = exports.defaultPubkey = exports.metadataForDexEvent = exports.SLOW_PROCESSING_THRESHOLD_US = exports.DEFAULT_REQUEST_TIMEOUT = exports.DEFAULT_METRICS_WINDOW_SECONDS = exports.DEFAULT_METRICS_PRINT_INTERVAL_SECONDS = exports.DEFAULT_MAX_DECODING_MESSAGE_SIZE = exports.DEFAULT_CONNECT_TIMEOUT = exports.DEFAULT_CHANNEL_SIZE = void 0;
|
|
40
|
+
exports.RAYDIUM_CPMM_PROGRAM_ID = exports.RAYDIUM_LAUNCHLAB_PROGRAM_ID = exports.PUMP_FEES_PROGRAM_ID = exports.PUMPSWAP_FEES_PROGRAM_ID = exports.PUMPSWAP_PROGRAM_ID = exports.PUMPFUN_PROGRAM_ID = exports.PROTOCOL_PROGRAM_IDS = exports.all_event_types = exports.ALL_EVENT_TYPES = exports.eventTypeFilterAllowsInstructionParsing = exports.eventTypeFilterIncludesPumpFees = exports.eventTypeFilterIncludesRaydiumLaunchlab = exports.eventTypeFilterIncludesOrcaWhirlpool = exports.eventTypeFilterIncludesRaydiumAmmV4 = exports.eventTypeFilterIncludesRaydiumCpmm = exports.eventTypeFilterIncludesRaydiumClmm = exports.eventTypeFilterIncludesMeteoraDlmm = exports.eventTypeFilterIncludesMeteoraPools = exports.eventTypeFilterIncludesMeteoraDbc = exports.eventTypeFilterIncludesMeteoraDammV2 = exports.eventTypeFilterIncludesPumpswap = exports.eventTypeFilterIncludesPumpfun = exports.eventTypeFilterExclude = exports.eventTypeFilterIncludeOnly = exports.accountFilterMemcmp = exports.accountFilterFromProgramOwners = exports.slotFilterMaxSlot = exports.slotFilterMinSlot = exports.newSlotFilter = exports.newAccountFilter = exports.transactionFilterFromProgramIds = exports.newTransactionFilter = exports.highThroughputClientConfig = exports.lowLatencyClientConfig = exports.defaultClientConfig = exports.try_yellowstone_signature = exports.collect_watch_transfer_counterparty_pairs = exports.spl_token_counterparty_by_owner = exports.token_balance_raw_amount = exports.heuristic_sol_counterparties_for_watched_keys = exports.lamport_balance_deltas = exports.collect_account_keys_bs58 = exports.pubkey_bytes_to_bs58 = exports.tryYellowstoneSignature = exports.collectWatchTransferCounterpartyPairs = exports.splTokenCounterpartyByOwner = exports.tokenBalanceRawAmount = exports.heuristicSolCounterpartiesForWatchedKeys = exports.lamportBalanceDeltas = exports.collectAccountKeysBs58 = void 0;
|
|
41
|
+
exports.discriminatorToProtocol = exports.discriminator_to_name = exports.discriminatorToName = exports.parse_log_unified = exports.parse_log_optimized = exports.parse_meteora_dlmm_log = exports.parse_meteora_damm_log = exports.parseProgramCompleteInfo = exports.parseLogUnified = exports.parseLogOptimizedWithProgramId = exports.parseLogOptimized = exports.parseInvokeInfo = exports.build_subscribe_transaction_filters_named = exports.build_subscribe_request_with_commitment = exports.build_subscribe_request = exports.CommitmentLevel = exports.buildSubscribeTransactionFiltersNamed = exports.buildSubscribeRequestWithCommitment = exports.buildSubscribeRequest = exports.exclude_types = exports.include_only = exports.event_type_filter_exclude = exports.event_type_filter_include_only = exports.account_filter_memcmp = exports.account_filter_from_program_owners = exports.slot_filter_max_slot = exports.slot_filter_min_slot = exports.new_slot_filter = exports.new_account_filter = exports.transaction_filter_from_program_ids = exports.new_transaction_filter = exports.high_throughput_client_config = exports.low_latency_client_config = exports.default_client_config = exports.account_filter_for_protocols = exports.transaction_filter_for_protocol_accounts = exports.transaction_filter_for_protocols = exports.get_program_ids_for_protocols = exports.protocol_program_ids = exports.accountFilterForProtocols = exports.transactionFilterForProtocolAccounts = exports.transactionFilterForProtocols = exports.getProgramIdsForProtocols = exports.METEORA_DBC_PROGRAM_ID = exports.METEORA_DLMM_PROGRAM_ID = exports.METEORA_DAMM_V2_PROGRAM_ID = exports.METEORA_POOLS_PROGRAM_ID = exports.ORCA_WHIRLPOOL_PROGRAM_ID = exports.RAYDIUM_AMM_V4_PROGRAM_ID = exports.RAYDIUM_CLMM_PROGRAM_ID = void 0;
|
|
42
|
+
exports.event_parser = exports.geyserGrpcChannelOptions = exports.defaultGeyserConnectConfig = exports.connectYellowstoneGeyser = exports.YellowstoneGrpc = exports.programIds = exports.parse_pump_fees_instruction = exports.parse_meteora_pools_instruction = exports.parse_meteora_dlmm_instruction = exports.parse_meteora_damm_instruction = exports.parse_pumpswap_instruction = exports.parse_pumpfun_instruction = exports.parse_instruction_unified = exports.parsePumpFeesInstruction = exports.parseMeteoraPoolsInstruction = exports.parseMeteoraDlmmInstruction = exports.parseMeteoraDammInstruction = exports.parsePumpswapInstruction = exports.parsePumpfunInstruction = exports.parseInstructionUnified = exports.user_wallet_pubkey_for_onchain_account = exports.rpc_resolve_user_wallet_pubkey = exports.parse_pumpswap_pool = exports.parse_pumpswap_global_config = exports.parse_pumpfun_global = exports.parse_token_account = exports.parse_nonce_account = exports.parse_account_unified = exports.rpcResolveUserWalletPubkey = exports.userWalletPubkeyForOnchainAccount = exports.hasDiscriminator = exports.isPoolAccount = exports.isGlobalConfigAccount = exports.parsePumpswapAccount = exports.parsePumpswapPool = exports.parsePumpswapGlobalConfig = exports.isPumpfunGlobalAccount = exports.parsePumpfunAccount = exports.parsePumpfunGlobal = exports.parseTokenAccount = exports.isNonceAccount = exports.parseNonceAccount = exports.parseAccountUnified = exports.u64leDiscriminator = exports.PUMPSWAP_DISC = exports.PROGRAM_LOG_DISC = exports.parseMeteoraDammLog = exports.lookup_discriminator = exports.lookupDiscriminator = exports.discriminator_to_protocol = void 0;
|
|
43
|
+
exports.buildSubscribeRequestWithEventFilter = exports.parseBlockMetaUpdate = exports.analyzeSimulationRoutes = exports.decodeWireTransaction = exports.high_throughput_shred_stream_config = exports.low_latency_shred_stream_config = exports.default_shred_stream_config = exports.highThroughputShredStreamConfig = exports.lowLatencyShredStreamConfig = exports.defaultShredStreamConfig = exports.wireBytesToShredWasmTx = exports.decodeShredstreamEntriesBincode = exports.decodeEntriesBincodeNested = exports.decodeEntriesBincodeFlat = exports.bincodeVecEntryCount = exports.loadAddressLookupTableAccounts = exports.fullAccountKeyStringsFromShredTx = exports.dexEventsFromShredWasmTxWithFullKeys = exports.dexEventsFromShredWasmTx = exports.ShredEventQueue = exports.ShredStreamClient = exports.geyser_grpc_channel_options = exports.default_geyser_connect_config = exports.connect_yellowstone_geyser = void 0;
|
|
41
44
|
var constants_js_1 = require("./common/constants.js");
|
|
42
45
|
Object.defineProperty(exports, "DEFAULT_CHANNEL_SIZE", { enumerable: true, get: function () { return constants_js_1.DEFAULT_CHANNEL_SIZE; } });
|
|
43
46
|
Object.defineProperty(exports, "DEFAULT_CONNECT_TIMEOUT", { enumerable: true, get: function () { return constants_js_1.DEFAULT_CONNECT_TIMEOUT; } });
|
|
@@ -52,6 +55,10 @@ Object.defineProperty(exports, "defaultPubkey", { enumerable: true, get: functio
|
|
|
52
55
|
var json_utils_js_1 = require("./core/json_utils.js");
|
|
53
56
|
Object.defineProperty(exports, "bigintToJsonReplacer", { enumerable: true, get: function () { return json_utils_js_1.bigintToJsonReplacer; } });
|
|
54
57
|
Object.defineProperty(exports, "dexEventToJsonString", { enumerable: true, get: function () { return json_utils_js_1.dexEventToJsonString; } });
|
|
58
|
+
var metadata_js_1 = require("./core/metadata.js");
|
|
59
|
+
Object.defineProperty(exports, "exactInteger", { enumerable: true, get: function () { return metadata_js_1.exactInteger; } });
|
|
60
|
+
Object.defineProperty(exports, "exactU64", { enumerable: true, get: function () { return metadata_js_1.exactU64; } });
|
|
61
|
+
Object.defineProperty(exports, "exactI64", { enumerable: true, get: function () { return metadata_js_1.exactI64; } });
|
|
55
62
|
var error_js_1 = require("./core/error.js");
|
|
56
63
|
Object.defineProperty(exports, "formatParseError", { enumerable: true, get: function () { return error_js_1.formatParseError; } });
|
|
57
64
|
var pumpfun_fee_enrich_js_1 = require("./core/pumpfun_fee_enrich.js");
|
|
@@ -298,3 +305,14 @@ var index_js_2 = require("./shredstream/index.js");
|
|
|
298
305
|
Object.defineProperty(exports, "default_shred_stream_config", { enumerable: true, get: function () { return index_js_2.defaultShredStreamConfig; } });
|
|
299
306
|
Object.defineProperty(exports, "low_latency_shred_stream_config", { enumerable: true, get: function () { return index_js_2.lowLatencyShredStreamConfig; } });
|
|
300
307
|
Object.defineProperty(exports, "high_throughput_shred_stream_config", { enumerable: true, get: function () { return index_js_2.highThroughputShredStreamConfig; } });
|
|
308
|
+
var wire_transaction_js_1 = require("./wire_transaction.js");
|
|
309
|
+
Object.defineProperty(exports, "decodeWireTransaction", { enumerable: true, get: function () { return wire_transaction_js_1.decodeWireTransaction; } });
|
|
310
|
+
__exportStar(require("./transaction_route.js"), exports);
|
|
311
|
+
__exportStar(require("./stonkfun_registry.js"), exports);
|
|
312
|
+
__exportStar(require("./liquidity_snapshot.js"), exports);
|
|
313
|
+
var simulation_route_js_1 = require("./simulation_route.js");
|
|
314
|
+
Object.defineProperty(exports, "analyzeSimulationRoutes", { enumerable: true, get: function () { return simulation_route_js_1.analyzeSimulationRoutes; } });
|
|
315
|
+
var block_meta_js_1 = require("./grpc/block_meta.js");
|
|
316
|
+
Object.defineProperty(exports, "parseBlockMetaUpdate", { enumerable: true, get: function () { return block_meta_js_1.parseBlockMetaUpdate; } });
|
|
317
|
+
var subscribe_builder_js_3 = require("./grpc/subscribe_builder.js");
|
|
318
|
+
Object.defineProperty(exports, "buildSubscribeRequestWithEventFilter", { enumerable: true, get: function () { return subscribe_builder_js_3.buildSubscribeRequestWithEventFilter; } });
|
package/dist/instr/inner.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
2
|
import type { EventTypeFilter } from "../grpc/types.js";
|
|
3
|
-
export declare function parseInnerCompiledInstructionIfSupported(data: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, filter: EventTypeFilter | undefined, programId: string): DexEvent | null;
|
|
4
|
-
export declare function parseInnerInstructionUnified(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, filter: EventTypeFilter | undefined, programId: string, isCreatedBuy?: boolean): DexEvent | null;
|
|
3
|
+
export declare function parseInnerCompiledInstructionIfSupported(data: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, filter: EventTypeFilter | undefined, programId: string): DexEvent | null;
|
|
4
|
+
export declare function parseInnerInstructionUnified(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, filter: EventTypeFilter | undefined, programId: string, isCreatedBuy?: boolean): DexEvent | null;
|
package/dist/instr/inner.js
CHANGED
|
@@ -235,7 +235,7 @@ function normalInstructionDataMayParse(programId, data) {
|
|
|
235
235
|
if (data.length === 0)
|
|
236
236
|
return false;
|
|
237
237
|
if (programId === program_ids_js_1.RAYDIUM_AMM_V4_PROGRAM_ID)
|
|
238
|
-
return firstByteIn(data, [1, 3, 4, 7, 9, 11]);
|
|
238
|
+
return firstByteIn(data, [1, 3, 4, 7, 9, 11, 16, 17]);
|
|
239
239
|
if (programId === program_ids_js_1.METEORA_DLMM_PROGRAM_ID)
|
|
240
240
|
return headIn(data, IX.METEORA_DLMM);
|
|
241
241
|
if (programId === program_ids_js_1.METEORA_DAMM_V2_PROGRAM_ID) {
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* 2) **CPI 事件形**:前 8 字节为外层 Anchor discriminator,8..16 为 `emit!` 事件 disc,16.. 为载荷。
|
|
6
6
|
*/
|
|
7
7
|
import type { DexEvent } from "../core/dex_event.js";
|
|
8
|
-
export declare function parseMeteoraDammInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
8
|
+
export declare function parseMeteoraDammInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
|
-
export declare function parseMeteoraDlmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
2
|
+
export declare function parseMeteoraDlmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
|
-
export declare function parseMeteoraPoolsInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
2
|
+
export declare function parseMeteoraPoolsInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
package/dist/instr/mod.d.ts
CHANGED
|
@@ -15,4 +15,4 @@ export { parseOrcaWhirlpoolInstruction } from "./orca_whirlpool_ix.js";
|
|
|
15
15
|
export { parseRaydiumLaunchlabInstruction } from "./raydium_launchlab_ix.js";
|
|
16
16
|
export { parsePumpFeesInstruction } from "./pump_fees_ix.js";
|
|
17
17
|
export * from "./program_ids.js";
|
|
18
|
-
export declare function parseInstructionUnified(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, eventTypeFilter: EventTypeFilter | undefined, programId: string): DexEvent | null;
|
|
18
|
+
export declare function parseInstructionUnified(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, eventTypeFilter: EventTypeFilter | undefined, programId: string): DexEvent | null;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Whirlpool 的 `swap` / `increase_liquidity_v2` / `decrease_liquidity` 与 Raydium CLMM 同源,复用同一组 Anchor 前 8 字节。
|
|
6
6
|
*/
|
|
7
7
|
import type { DexEvent } from "../core/dex_event.js";
|
|
8
|
-
export declare function parseOrcaWhirlpoolInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
8
|
+
export declare function parseOrcaWhirlpoolInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
|
-
export declare function parsePumpFeesInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
2
|
+
export declare function parsePumpFeesInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { DexEvent } from "../core/dex_event.js";
|
|
5
5
|
export declare const PUMPFUN_SOL_QUOTE_MINT = "So11111111111111111111111111111111111111111";
|
|
6
|
-
export declare function parsePumpfunInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
6
|
+
export declare function parsePumpfunInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
package/dist/instr/pumpfun_ix.js
CHANGED
|
@@ -346,9 +346,9 @@ function parsePumpfunInstruction(instructionData, accounts, signature, slot, txI
|
|
|
346
346
|
program: accounts[15] ?? Z,
|
|
347
347
|
observed_fee_recipient: Z,
|
|
348
348
|
...createNumericDefaults(),
|
|
349
|
-
quote_mint:
|
|
350
|
-
quote_vault:
|
|
351
|
-
quote_token_program:
|
|
349
|
+
quote_mint: exports.PUMPFUN_SOL_QUOTE_MINT,
|
|
350
|
+
quote_vault: Z,
|
|
351
|
+
quote_token_program: Z,
|
|
352
352
|
ix_name: "create_v2",
|
|
353
353
|
is_mayhem_mode: isMayhemMode,
|
|
354
354
|
is_cashback_enabled: isCashbackEnabled,
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* PumpSwap 指令解析
|
|
3
3
|
*/
|
|
4
4
|
import type { DexEvent } from "../core/dex_event.js";
|
|
5
|
-
export declare function parsePumpswapInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs?: number): DexEvent | null;
|
|
5
|
+
export declare function parsePumpswapInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs?: number | bigint | string): DexEvent | null;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* 单字节 discriminator;Swap 账户顺序与链上 `SwapBaseIn`/`SwapBaseOut` 一致(18 个账户)。
|
|
4
4
|
*/
|
|
5
5
|
import type { DexEvent } from "../core/dex_event.js";
|
|
6
|
-
export declare function parseRaydiumAmmV4Instruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
6
|
+
export declare function parseRaydiumAmmV4Instruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -29,7 +29,9 @@ const SWAP = {
|
|
|
29
29
|
USER_DEST_TOKEN: 16,
|
|
30
30
|
USER_OWNER: 17,
|
|
31
31
|
};
|
|
32
|
-
function swapAccountIndexes(accountCount) {
|
|
32
|
+
function swapAccountIndexes(accountCount, modern) {
|
|
33
|
+
if (modern)
|
|
34
|
+
return { ...SWAP, AMM_OPEN_ORDERS: -1, AMM_TARGET_ORDERS: -1, POOL_COIN_TOKEN: 3, POOL_PC_TOKEN: 4, SERUM_PROGRAM: -1, SERUM_MARKET: -1, SERUM_BIDS: -1, SERUM_ASKS: -1, SERUM_EVENT_QUEUE: -1, SERUM_COIN_VAULT: -1, SERUM_PC_VAULT: -1, SERUM_VAULT_SIGNER: -1, USER_SOURCE_TOKEN: 5, USER_DEST_TOKEN: 6, USER_OWNER: 7 };
|
|
33
35
|
if (accountCount !== 17)
|
|
34
36
|
return SWAP;
|
|
35
37
|
return {
|
|
@@ -56,7 +58,7 @@ function swapBaseInFromIx(instructionData, accounts, meta) {
|
|
|
56
58
|
const amount_in = (0, utils_js_1.readU64LE)(instructionData, 1) ?? 0n;
|
|
57
59
|
const minimum_amount_out = (0, utils_js_1.readU64LE)(instructionData, 9) ?? 0n;
|
|
58
60
|
const g = (i) => (0, utils_js_1.getAccount)(accounts, i) ?? Z;
|
|
59
|
-
const indexes = swapAccountIndexes(accounts.length);
|
|
61
|
+
const indexes = swapAccountIndexes(accounts.length, instructionData[0] === 16 || instructionData[0] === 17);
|
|
60
62
|
return {
|
|
61
63
|
RaydiumAmmV4Swap: {
|
|
62
64
|
metadata: meta,
|
|
@@ -91,7 +93,7 @@ function swapBaseOutFromIx(instructionData, accounts, meta) {
|
|
|
91
93
|
const max_amount_in = (0, utils_js_1.readU64LE)(instructionData, 1) ?? 0n;
|
|
92
94
|
const amount_out = (0, utils_js_1.readU64LE)(instructionData, 9) ?? 0n;
|
|
93
95
|
const g = (i) => (0, utils_js_1.getAccount)(accounts, i) ?? Z;
|
|
94
|
-
const indexes = swapAccountIndexes(accounts.length);
|
|
96
|
+
const indexes = swapAccountIndexes(accounts.length, instructionData[0] === 16 || instructionData[0] === 17);
|
|
95
97
|
return {
|
|
96
98
|
RaydiumAmmV4Swap: {
|
|
97
99
|
metadata: meta,
|
|
@@ -124,11 +126,13 @@ function parseRaydiumAmmV4Instruction(instructionData, accounts, signature, slot
|
|
|
124
126
|
if (instructionData.length < 1)
|
|
125
127
|
return null;
|
|
126
128
|
const instrType = instructionData[0];
|
|
129
|
+
if ((instrType === 16 || instrType === 17) && accounts.length < 8)
|
|
130
|
+
return null;
|
|
127
131
|
const meta = (0, utils_js_1.ixMeta)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
128
|
-
if (instrType === INSTR_TYPE.SWAP_BASE_IN) {
|
|
132
|
+
if (instrType === INSTR_TYPE.SWAP_BASE_IN || instrType === 16) {
|
|
129
133
|
return swapBaseInFromIx(instructionData, accounts, meta);
|
|
130
134
|
}
|
|
131
|
-
if (instrType === INSTR_TYPE.SWAP_BASE_OUT) {
|
|
135
|
+
if (instrType === INSTR_TYPE.SWAP_BASE_OUT || instrType === 17) {
|
|
132
136
|
return swapBaseOutFromIx(instructionData, accounts, meta);
|
|
133
137
|
}
|
|
134
138
|
return null;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Raydium CLMM 指令解析(与 Orca Whirlpool 同源 Anchor 布局:swap / 增减流动性)
|
|
3
3
|
*/
|
|
4
4
|
import type { DexEvent } from "../core/dex_event.js";
|
|
5
|
-
export declare function parseRaydiumClmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
5
|
+
export declare function parseRaydiumClmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Raydium CPMM 指令解析(Anchor:8 字节 discriminator + Borsh 参数)
|
|
3
3
|
*/
|
|
4
4
|
import type { DexEvent } from "../core/dex_event.js";
|
|
5
|
-
export declare function parseRaydiumCpmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
5
|
+
export declare function parseRaydiumCpmmInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* 2) **Anchor 外层指令**:`global:buy` / `sell` / `create_pool` / `migrate_to_amm` 等(sha256 前 8 字节),参数多为 Borsh u64。
|
|
6
6
|
*/
|
|
7
7
|
import type { DexEvent } from "../core/dex_event.js";
|
|
8
|
-
export declare function parseRaydiumLaunchlabInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
8
|
+
export declare function parseRaydiumLaunchlabInstruction(instructionData: Uint8Array, accounts: string[], signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -51,6 +51,8 @@ function parseMintParams(payload) {
|
|
|
51
51
|
return { symbol: symbol.s, name: name.s, uri: uri.s, decimals };
|
|
52
52
|
}
|
|
53
53
|
function tradeFromTwoU64(payload, accounts, meta, isBuy, exactIn) {
|
|
54
|
+
if (payload.length < 16 || accounts.length < 5)
|
|
55
|
+
return null;
|
|
54
56
|
const first = (0, utils_js_1.readU64LE)(payload, 0) ?? 0n;
|
|
55
57
|
const second = (0, utils_js_1.readU64LE)(payload, 8) ?? 0n;
|
|
56
58
|
const amount_in = exactIn ? first : second;
|
|
@@ -66,6 +68,31 @@ function tradeFromTwoU64(payload, accounts, meta, isBuy, exactIn) {
|
|
|
66
68
|
amount_out,
|
|
67
69
|
is_buy: isBuy,
|
|
68
70
|
trade_direction: isBuy ? "Buy" : "Sell",
|
|
71
|
+
total_base_sell: 0n,
|
|
72
|
+
virtual_base: 0n,
|
|
73
|
+
virtual_quote: 0n,
|
|
74
|
+
real_base_before: 0n,
|
|
75
|
+
real_quote_before: 0n,
|
|
76
|
+
real_base_after: 0n,
|
|
77
|
+
real_quote_after: 0n,
|
|
78
|
+
protocol_fee: 0n,
|
|
79
|
+
platform_fee: 0n,
|
|
80
|
+
creator_fee: 0n,
|
|
81
|
+
share_fee: 0n,
|
|
82
|
+
pool_status: "Fund",
|
|
83
|
+
global_config: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
|
|
84
|
+
platform_config: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
|
|
85
|
+
user_base_token: (0, utils_js_1.getAccount)(accounts, 5) ?? Z,
|
|
86
|
+
user_quote_token: (0, utils_js_1.getAccount)(accounts, 6) ?? Z,
|
|
87
|
+
base_vault: (0, utils_js_1.getAccount)(accounts, 7) ?? Z,
|
|
88
|
+
quote_vault: (0, utils_js_1.getAccount)(accounts, 8) ?? Z,
|
|
89
|
+
base_mint: (0, utils_js_1.getAccount)(accounts, 9) ?? Z,
|
|
90
|
+
quote_mint: (0, utils_js_1.getAccount)(accounts, 10) ?? Z,
|
|
91
|
+
base_token_program: (0, utils_js_1.getAccount)(accounts, 11) ?? Z,
|
|
92
|
+
quote_token_program: (0, utils_js_1.getAccount)(accounts, 12) ?? Z,
|
|
93
|
+
system_program: (0, utils_js_1.getAccount)(accounts, 15) ?? Z,
|
|
94
|
+
platform_associated_account: (0, utils_js_1.getAccount)(accounts, 16) ?? Z,
|
|
95
|
+
creator_associated_account: (0, utils_js_1.getAccount)(accounts, 17) ?? Z,
|
|
69
96
|
exact_in: exactIn,
|
|
70
97
|
},
|
|
71
98
|
};
|
|
@@ -106,6 +133,8 @@ function parseRaydiumLaunchlabInstruction(instructionData, accounts, signature,
|
|
|
106
133
|
if (headEq(instructionData, ANCHOR.INITIALIZE) ||
|
|
107
134
|
headEq(instructionData, ANCHOR.INITIALIZE_V2) ||
|
|
108
135
|
headEq(instructionData, ANCHOR.INITIALIZE_WITH_TOKEN_2022)) {
|
|
136
|
+
if (accounts.length < 6)
|
|
137
|
+
return null;
|
|
109
138
|
const base_mint_param = parseMintParams(rest);
|
|
110
139
|
if (!base_mint_param)
|
|
111
140
|
return null;
|
|
@@ -115,11 +144,42 @@ function parseRaydiumLaunchlabInstruction(instructionData, accounts, signature,
|
|
|
115
144
|
base_mint_param,
|
|
116
145
|
pool_state: (0, utils_js_1.getAccount)(accounts, 5) ?? Z,
|
|
117
146
|
creator: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
|
|
147
|
+
payer: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
|
|
148
|
+
global_config: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
|
|
149
|
+
platform_config: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
|
|
150
|
+
base_mint: (0, utils_js_1.getAccount)(accounts, 6) ?? Z,
|
|
151
|
+
quote_mint: (0, utils_js_1.getAccount)(accounts, 7) ?? Z,
|
|
152
|
+
base_vault: (0, utils_js_1.getAccount)(accounts, 8) ?? Z,
|
|
153
|
+
quote_vault: (0, utils_js_1.getAccount)(accounts, 9) ?? Z,
|
|
154
|
+
base_token_program: (0, utils_js_1.getAccount)(accounts, headEq(instructionData, ANCHOR.INITIALIZE_WITH_TOKEN_2022)
|
|
155
|
+
? 10
|
|
156
|
+
: 11) ?? Z,
|
|
157
|
+
quote_token_program: (0, utils_js_1.getAccount)(accounts, headEq(instructionData, ANCHOR.INITIALIZE_WITH_TOKEN_2022)
|
|
158
|
+
? 11
|
|
159
|
+
: 12) ?? Z,
|
|
118
160
|
},
|
|
119
161
|
};
|
|
120
162
|
}
|
|
121
|
-
if (headEq(instructionData, ANCHOR.MIGRATE_TO_AMM) ||
|
|
122
|
-
|
|
163
|
+
if (headEq(instructionData, ANCHOR.MIGRATE_TO_AMM) ||
|
|
164
|
+
headEq(instructionData, ANCHOR.MIGRATE_TO_CPSWAP)) {
|
|
165
|
+
const cp = headEq(instructionData, ANCHOR.MIGRATE_TO_CPSWAP);
|
|
166
|
+
if (accounts.length < (cp ? 28 : 32) ||
|
|
167
|
+
(!cp && instructionData.length < 17))
|
|
168
|
+
return null;
|
|
169
|
+
return {
|
|
170
|
+
RaydiumLaunchlabMigrateAmm: {
|
|
171
|
+
metadata: meta,
|
|
172
|
+
old_pool: accounts[cp ? 17 : 23],
|
|
173
|
+
new_pool: accounts[cp ? 5 : 13],
|
|
174
|
+
user: accounts[0],
|
|
175
|
+
liquidity_amount: 0n,
|
|
176
|
+
liquidity_amount_known: false,
|
|
177
|
+
base_mint: accounts[1],
|
|
178
|
+
quote_mint: accounts[2],
|
|
179
|
+
platform_config: cp ? accounts[3] : Z,
|
|
180
|
+
destination_program: accounts[cp ? 4 : 12],
|
|
181
|
+
},
|
|
182
|
+
};
|
|
123
183
|
}
|
|
124
184
|
return null;
|
|
125
185
|
}
|
package/dist/instr/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare function ixMeta(signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): EventMetadata;
|
|
1
|
+
import { type EventMetadata } from "../core/metadata.js";
|
|
2
|
+
export declare function ixMeta(signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): EventMetadata;
|
|
3
3
|
export declare function getAccount(accounts: string[], i: number): string | undefined;
|
|
4
4
|
/** Borsh 前缀字符串,返回 (utf8, 下一个 offset);失败返回 null */
|
|
5
5
|
export declare function readBorshStrAt(data: Uint8Array, offset: number): {
|
package/dist/instr/utils.js
CHANGED
|
@@ -5,15 +5,10 @@ exports.ixMeta = ixMeta;
|
|
|
5
5
|
exports.getAccount = getAccount;
|
|
6
6
|
exports.readBorshStrAt = readBorshStrAt;
|
|
7
7
|
exports.readPubkeyIx = readPubkeyIx;
|
|
8
|
+
const metadata_js_1 = require("../core/metadata.js");
|
|
8
9
|
const binary_js_1 = require("../util/binary.js");
|
|
9
10
|
function ixMeta(signature, slot, txIndex, blockTimeUs, grpcRecvUs) {
|
|
10
|
-
return
|
|
11
|
-
signature,
|
|
12
|
-
slot,
|
|
13
|
-
tx_index: txIndex,
|
|
14
|
-
block_time_us: blockTimeUs ?? 0,
|
|
15
|
-
grpc_recv_us: grpcRecvUs,
|
|
16
|
-
};
|
|
11
|
+
return (0, metadata_js_1.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
17
12
|
}
|
|
18
13
|
function getAccount(accounts, i) {
|
|
19
14
|
return accounts[i];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AccountData } from "./accounts/types.js";
|
|
2
|
+
import type { EventMetadata } from "./core/metadata.js";
|
|
3
|
+
export interface RawAccountSnapshotEvent {
|
|
4
|
+
metadata: EventMetadata;
|
|
5
|
+
account: AccountData;
|
|
6
|
+
write_version: bigint;
|
|
7
|
+
is_startup: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type LiquiditySnapshotKind = "LaunchLabGlobalConfig" | "LaunchLabPlatformConfig" | {
|
|
10
|
+
LaunchLabPool: {
|
|
11
|
+
base_mint: string;
|
|
12
|
+
quote_mint: string;
|
|
13
|
+
global_config: string;
|
|
14
|
+
platform_config: string;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
DlmmPool: {
|
|
18
|
+
token_x_mint: string;
|
|
19
|
+
token_y_mint: string;
|
|
20
|
+
active_id: number;
|
|
21
|
+
bin_step: number;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
DlmmBinArray: {
|
|
25
|
+
pool: string;
|
|
26
|
+
index: bigint;
|
|
27
|
+
};
|
|
28
|
+
} | {
|
|
29
|
+
DlmmBitmap: {
|
|
30
|
+
pool: string;
|
|
31
|
+
};
|
|
32
|
+
} | {
|
|
33
|
+
OrcaDynamicTickArray: {
|
|
34
|
+
pool: string;
|
|
35
|
+
start_tick_index: number;
|
|
36
|
+
tick_bitmap: bigint;
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
OrcaAdaptiveOracle: {
|
|
40
|
+
pool: string;
|
|
41
|
+
};
|
|
42
|
+
} | {
|
|
43
|
+
ClmmBitmap: {
|
|
44
|
+
pool: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export interface LiquidityAccountSnapshotEvent {
|
|
48
|
+
metadata: EventMetadata;
|
|
49
|
+
pubkey: string;
|
|
50
|
+
owner: string;
|
|
51
|
+
kind: LiquiditySnapshotKind;
|
|
52
|
+
data: Uint8Array;
|
|
53
|
+
}
|
|
54
|
+
export declare function parseLiquidityAccount(account: AccountData, metadata: EventMetadata): LiquidityAccountSnapshotEvent | null;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseLiquidityAccount = parseLiquidityAccount;
|
|
7
|
+
/** Full subscription bytes and validated liquidity identities, without RPC. */
|
|
8
|
+
const bs58_1 = __importDefault(require("bs58"));
|
|
9
|
+
const transaction_route_js_1 = require("./transaction_route.js");
|
|
10
|
+
function parseLiquidityAccount(account, metadata) {
|
|
11
|
+
if (account.lamports <= 0n || account.executable)
|
|
12
|
+
return null;
|
|
13
|
+
const d = Buffer.from(account.data), disc = d.subarray(0, 8).toString("hex"), owner = account.owner, key = (o) => bs58_1.default.encode(d.subarray(o, o + 32));
|
|
14
|
+
let kind;
|
|
15
|
+
if (owner === transaction_route_js_1.ROUTE_PROGRAMS.LaunchLab) {
|
|
16
|
+
if (disc === "f7ede3f5d7c3de46" && d.length >= 429)
|
|
17
|
+
kind = {
|
|
18
|
+
LaunchLabPool: {
|
|
19
|
+
base_mint: key(205),
|
|
20
|
+
quote_mint: key(237),
|
|
21
|
+
global_config: key(141),
|
|
22
|
+
platform_config: key(173),
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
else if (disc === "95089ccaa0fcb0d9" && d.length >= 35)
|
|
26
|
+
kind = "LaunchLabGlobalConfig";
|
|
27
|
+
else if (disc === "a04e8000f853e6a0" && d.length >= 728)
|
|
28
|
+
kind = "LaunchLabPlatformConfig";
|
|
29
|
+
}
|
|
30
|
+
else if (owner === transaction_route_js_1.ROUTE_PROGRAMS.MeteoraDlmm) {
|
|
31
|
+
if (disc === "210b3162b565b10d" && d.length >= 904)
|
|
32
|
+
kind = {
|
|
33
|
+
DlmmPool: {
|
|
34
|
+
token_x_mint: key(88),
|
|
35
|
+
token_y_mint: key(120),
|
|
36
|
+
active_id: d.readInt32LE(76),
|
|
37
|
+
bin_step: d.readUInt16LE(80),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
else if (disc === "5c8e5cdc059446b5" && d.length >= 10136)
|
|
41
|
+
kind = { DlmmBinArray: { pool: key(24), index: d.readBigInt64LE(8) } };
|
|
42
|
+
else if (disc === "506f7c7137ed1205" && d.length >= 1576)
|
|
43
|
+
kind = { DlmmBitmap: { pool: key(8) } };
|
|
44
|
+
}
|
|
45
|
+
else if (owner === transaction_route_js_1.ROUTE_PROGRAMS.OrcaWhirlpool) {
|
|
46
|
+
if (disc === "11d8f68ee1c7da38" && d.length >= 148) {
|
|
47
|
+
const bitmap = d.readBigUInt64LE(44) + (d.readBigUInt64LE(52) << 64n);
|
|
48
|
+
if (bitmap >> 88n)
|
|
49
|
+
return null;
|
|
50
|
+
let offset = 60;
|
|
51
|
+
for (let i = 0; i < 88; i++) {
|
|
52
|
+
const tag = d[offset];
|
|
53
|
+
if (offset >= d.length ||
|
|
54
|
+
(tag !== 0 && tag !== 1) ||
|
|
55
|
+
tag !== Number((bitmap >> BigInt(i)) & 1n))
|
|
56
|
+
return null;
|
|
57
|
+
offset += 1 + (tag ? 112 : 0);
|
|
58
|
+
if (offset > d.length)
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
kind = {
|
|
62
|
+
OrcaDynamicTickArray: {
|
|
63
|
+
pool: key(12),
|
|
64
|
+
start_tick_index: d.readInt32LE(8),
|
|
65
|
+
tick_bitmap: bitmap,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
else if (disc === "8bc283b38cb3e5f4" && d.length >= 254)
|
|
70
|
+
kind = { OrcaAdaptiveOracle: { pool: key(8) } };
|
|
71
|
+
}
|
|
72
|
+
else if (owner === transaction_route_js_1.ROUTE_PROGRAMS.RaydiumClmm &&
|
|
73
|
+
disc === "3c9624db61808b99" &&
|
|
74
|
+
d.length >= 1832)
|
|
75
|
+
kind = { ClmmBitmap: { pool: key(8) } };
|
|
76
|
+
return kind
|
|
77
|
+
? {
|
|
78
|
+
metadata,
|
|
79
|
+
pubkey: account.pubkey,
|
|
80
|
+
owner,
|
|
81
|
+
kind,
|
|
82
|
+
data: Uint8Array.from(d),
|
|
83
|
+
}
|
|
84
|
+
: null;
|
|
85
|
+
}
|
|
@@ -18,4 +18,4 @@ export declare function parseCreateDynamicConfigFromData(data: Uint8Array, meta:
|
|
|
18
18
|
/**
|
|
19
19
|
* Meteora DAMM Program data 入口;与 Rust `logs/meteora_damm.rs` 一致。
|
|
20
20
|
*/
|
|
21
|
-
export declare function parseMeteoraDammLog(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
21
|
+
export declare function parseMeteoraDammLog(log: string, signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -11,6 +11,7 @@ exports.parseCreateConfigFromData = parseCreateConfigFromData;
|
|
|
11
11
|
exports.parseCreateDynamicConfigFromData = parseCreateDynamicConfigFromData;
|
|
12
12
|
exports.parseMeteoraDammLog = parseMeteoraDammLog;
|
|
13
13
|
const metadata_js_1 = require("../core/metadata.js");
|
|
14
|
+
const metadata_js_2 = require("../core/metadata.js");
|
|
14
15
|
const dex_event_js_1 = require("../core/dex_event.js");
|
|
15
16
|
const program_data_js_1 = require("./program_data.js");
|
|
16
17
|
const binary_js_1 = require("../util/binary.js");
|
|
@@ -38,7 +39,8 @@ const CREATE_DYNAMIC_CONFIG = discOf([231, 197, 13, 164, 248, 213, 133, 152]);
|
|
|
38
39
|
*/
|
|
39
40
|
exports.COMPOUNDING_FEE_LAYOUT_ACTIVATION_SLOT = 406_048_752;
|
|
40
41
|
function usesCompoundingFeeLayout(slot) {
|
|
41
|
-
|
|
42
|
+
const n = (0, metadata_js_1.exactU64)(slot);
|
|
43
|
+
return n === 0n || n >= BigInt(exports.COMPOUNDING_FEE_LAYOUT_ACTIVATION_SLOT);
|
|
42
44
|
}
|
|
43
45
|
function bn64(v) {
|
|
44
46
|
return v ?? 0n;
|
|
@@ -709,7 +711,7 @@ function parseMeteoraDammLog(log, signature, slot, txIndex, blockTimeUs, grpcRec
|
|
|
709
711
|
return null;
|
|
710
712
|
const disc = new DataView(programData.buffer, programData.byteOffset, 8).getBigUint64(0, true);
|
|
711
713
|
const data = programData.subarray(8);
|
|
712
|
-
const meta = (0,
|
|
714
|
+
const meta = (0, metadata_js_2.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
|
|
713
715
|
if (disc === SWAP)
|
|
714
716
|
return parseSwapEvent(data, meta);
|
|
715
717
|
if (disc === SWAP2)
|
|
@@ -4,4 +4,4 @@ import type { DexEvent } from "../core/dex_event.js";
|
|
|
4
4
|
export declare function parseDlmmFromDecoded(programData: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
5
5
|
export declare function parseDlmmEventFromData(discriminator: bigint, data: Uint8Array, metadata: EventMetadata): DexEvent | null;
|
|
6
6
|
/** 从整行日志解析 */
|
|
7
|
-
export declare function parseMeteoraDlmmLog(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number): DexEvent | null;
|
|
7
|
+
export declare function parseMeteoraDlmmLog(log: string, signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DexEvent } from "../core/dex_event.js";
|
|
2
2
|
import type { EventTypeFilter } from "../grpc/types.js";
|
|
3
|
-
export declare function parseLogOptimized(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, eventTypeFilter: EventTypeFilter | undefined, isCreatedBuy: boolean, recentBlockhash?: Uint8Array, programId?: string): DexEvent | null;
|
|
3
|
+
export declare function parseLogOptimized(log: string, signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, eventTypeFilter: EventTypeFilter | undefined, isCreatedBuy: boolean, recentBlockhash?: Uint8Array, programId?: string): DexEvent | null;
|
|
4
4
|
/** 单行日志统一解析;`txIndex` 与 Rust gRPC `parse_logs(..., tx_idx, ...)` / `info.index` 对齐。 */
|
|
5
|
-
export declare function parseLogUnified(log: string, signature: string, slot: number, blockTimeUs: number | undefined, txIndex?: number): DexEvent | null;
|
|
6
|
-
export declare function parseLogOptimizedWithProgramId(log: string, signature: string, slot: number, txIndex: number, blockTimeUs: number | undefined, grpcRecvUs: number, eventTypeFilter: EventTypeFilter | undefined, isCreatedBuy: boolean, recentBlockhash: Uint8Array | undefined, programId: string | undefined): DexEvent | null;
|
|
5
|
+
export declare function parseLogUnified(log: string, signature: string, slot: number | bigint | string, blockTimeUs: number | bigint | string | undefined, txIndex?: number | bigint | string): DexEvent | null;
|
|
6
|
+
export declare function parseLogOptimizedWithProgramId(log: string, signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string, eventTypeFilter: EventTypeFilter | undefined, isCreatedBuy: boolean, recentBlockhash: Uint8Array | undefined, programId: string | undefined): DexEvent | null;
|
|
7
7
|
export declare function parseInvokeInfo(log: string): {
|
|
8
8
|
programId: string;
|
|
9
9
|
depth: number;
|
package/dist/logs/pump.js
CHANGED
|
@@ -241,6 +241,17 @@ function parseCreateFromData(data, metadata) {
|
|
|
241
241
|
if (!n3)
|
|
242
242
|
return null;
|
|
243
243
|
o = n3.next;
|
|
244
|
+
if (data.length - o === 96) {
|
|
245
|
+
return { PumpFunCreate: {
|
|
246
|
+
metadata, name: n1.s, symbol: n2.s, uri: n3.s,
|
|
247
|
+
mint: (0, binary_js_1.readPubkey)(data, o), bonding_curve: (0, binary_js_1.readPubkey)(data, o + 32), user: (0, binary_js_1.readPubkey)(data, o + 64),
|
|
248
|
+
creator: (0, dex_event_js_1.defaultPubkey)(), timestamp: 0n, virtual_token_reserves: 0n, virtual_sol_reserves: 0n,
|
|
249
|
+
real_token_reserves: 0n, token_total_supply: 0n, token_program: (0, dex_event_js_1.defaultPubkey)(),
|
|
250
|
+
is_mayhem_mode: false, is_cashback_enabled: false, quote_mint: normalizePumpfunQuoteMint((0, dex_event_js_1.defaultPubkey)()),
|
|
251
|
+
quote_vault: (0, dex_event_js_1.defaultPubkey)(), quote_token_program: (0, dex_event_js_1.defaultPubkey)(), virtual_quote_reserves: 0n,
|
|
252
|
+
creator_fee_bps: 0n, is_holder_reward: false, ix_name: "create",
|
|
253
|
+
} };
|
|
254
|
+
}
|
|
244
255
|
if (data.length < o + 32 * 4 + 8 * 5 + 32 + 1)
|
|
245
256
|
return null;
|
|
246
257
|
const mint = (0, binary_js_1.readPubkey)(data, o);
|
|
@@ -19,12 +19,18 @@ function bn64(v) {
|
|
|
19
19
|
return v ?? 0n;
|
|
20
20
|
}
|
|
21
21
|
function parseRaydiumLaunchlabTradeFromData(data, metadata) {
|
|
22
|
+
if (data.length !== 139 || data[136] > 1 || data[137] > 2 || data[138] > 1)
|
|
23
|
+
return null;
|
|
22
24
|
const pool_state = (0, binary_js_1.readPubkey)(data, 0);
|
|
23
25
|
const amount_in = (0, binary_js_1.readU64LE)(data, 88);
|
|
24
26
|
const amount_out = (0, binary_js_1.readU64LE)(data, 96);
|
|
25
27
|
const trade_direction = (0, binary_js_1.readU8)(data, 136);
|
|
26
28
|
const exact_in = (0, binary_js_1.readBool)(data, 138);
|
|
27
|
-
if (!pool_state ||
|
|
29
|
+
if (!pool_state ||
|
|
30
|
+
amount_in === null ||
|
|
31
|
+
amount_out === null ||
|
|
32
|
+
trade_direction === null ||
|
|
33
|
+
exact_in === null) {
|
|
28
34
|
return null;
|
|
29
35
|
}
|
|
30
36
|
const is_buy = trade_direction === 0;
|
|
@@ -36,6 +42,18 @@ function parseRaydiumLaunchlabTradeFromData(data, metadata) {
|
|
|
36
42
|
amount_out: bn64(amount_out),
|
|
37
43
|
is_buy,
|
|
38
44
|
trade_direction: is_buy ? "Buy" : "Sell",
|
|
45
|
+
total_base_sell: (0, binary_js_1.readU64LE)(data, 32),
|
|
46
|
+
virtual_base: (0, binary_js_1.readU64LE)(data, 40),
|
|
47
|
+
virtual_quote: (0, binary_js_1.readU64LE)(data, 48),
|
|
48
|
+
real_base_before: (0, binary_js_1.readU64LE)(data, 56),
|
|
49
|
+
real_quote_before: (0, binary_js_1.readU64LE)(data, 64),
|
|
50
|
+
real_base_after: (0, binary_js_1.readU64LE)(data, 72),
|
|
51
|
+
real_quote_after: (0, binary_js_1.readU64LE)(data, 80),
|
|
52
|
+
protocol_fee: (0, binary_js_1.readU64LE)(data, 104),
|
|
53
|
+
platform_fee: (0, binary_js_1.readU64LE)(data, 112),
|
|
54
|
+
creator_fee: (0, binary_js_1.readU64LE)(data, 120),
|
|
55
|
+
share_fee: (0, binary_js_1.readU64LE)(data, 128),
|
|
56
|
+
pool_status: ["Fund", "Migrate", "Trade"][data[137]],
|
|
39
57
|
exact_in,
|
|
40
58
|
};
|
|
41
59
|
return { RaydiumLaunchlabTrade: ev };
|