sol-parser-sdk 0.5.14 → 0.5.16

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.
Files changed (108) hide show
  1. package/NATIVE_ALIGNMENT.md +312 -0
  2. package/NATIVE_DAMM_FACTORY_ALIGNMENT_20261004.md +16 -0
  3. package/NATIVE_DAMM_FACTORY_EVIDENCE_20261004.json +55 -0
  4. package/NATIVE_MIGRATION.md +38 -0
  5. package/NATIVE_PUMPFUN_NATIVE_DEBIT_ALIGNMENT_20261004.md +18 -0
  6. package/NATIVE_PUMPFUN_NATIVE_DEBIT_EVIDENCE_20261004.json +57 -0
  7. package/NATIVE_PUMPFUN_SETTLEMENT_ALIGNMENT_20261004.md +11 -0
  8. package/NATIVE_PUMPFUN_SETTLEMENT_EVIDENCE_20261004.json +70 -0
  9. package/README.md +24 -1
  10. package/README_CN.md +21 -1
  11. package/dist/accounts/mod.js +7 -0
  12. package/dist/accounts/pumpfun.js +17 -0
  13. package/dist/accounts/pumpswap.js +18 -3
  14. package/dist/core/account_dispatcher_rpc.js +24 -4
  15. package/dist/core/account_fill_meteora.d.ts +1 -1
  16. package/dist/core/account_fill_meteora.js +12 -1
  17. package/dist/core/account_fill_raydium.js +12 -2
  18. package/dist/core/account_fill_raydium_launchlab.js +54 -0
  19. package/dist/core/clock.js +1 -1
  20. package/dist/core/common_filler_rpc.d.ts +2 -2
  21. package/dist/core/common_filler_rpc.js +66 -0
  22. package/dist/core/dex_event.d.ts +157 -0
  23. package/dist/core/metadata.d.ts +9 -5
  24. package/dist/core/metadata.js +28 -4
  25. package/dist/core/unified_parser.d.ts +7 -7
  26. package/dist/grpc/block_meta.d.ts +9 -0
  27. package/dist/grpc/block_meta.js +26 -0
  28. package/dist/grpc/client.d.ts +24 -9
  29. package/dist/grpc/client.js +129 -67
  30. package/dist/grpc/geyser_connect.d.ts +3 -3
  31. package/dist/grpc/geyser_connect.js +13 -15
  32. package/dist/grpc/log_instr_dedup.js +6 -0
  33. package/dist/grpc/native_client.d.ts +26 -0
  34. package/dist/grpc/native_client.js +101 -0
  35. package/dist/grpc/order_buffer.d.ts +1 -1
  36. package/dist/grpc/order_buffer.js +10 -9
  37. package/dist/grpc/program_ids.js +2 -0
  38. package/dist/grpc/protocol/LICENSE +202 -0
  39. package/dist/grpc/protocol/NOTICE +4 -0
  40. package/dist/grpc/protocol/geyser.d.ts +342 -0
  41. package/dist/grpc/protocol/geyser.js +37 -0
  42. package/dist/grpc/protocol/geyser.proto +326 -0
  43. package/dist/grpc/protocol/solana-storage.d.ts +139 -0
  44. package/dist/grpc/protocol/solana-storage.js +14 -0
  45. package/dist/grpc/protocol/solana-storage.proto +151 -0
  46. package/dist/grpc/rpc_to_grpc.d.ts +1 -1
  47. package/dist/grpc/subscribe_builder.d.ts +5 -3
  48. package/dist/grpc/subscribe_builder.js +11 -3
  49. package/dist/grpc/transaction_meta.d.ts +1 -1
  50. package/dist/grpc/types.d.ts +8 -8
  51. package/dist/grpc/types.js +15 -2
  52. package/dist/grpc/yellowstone_parse.d.ts +3 -3
  53. package/dist/grpc/yellowstone_parse.js +6 -8
  54. package/dist/grpc/yellowstone_transaction_adapter.d.ts +1 -1
  55. package/dist/index.d.ts +11 -1
  56. package/dist/index.js +23 -5
  57. package/dist/instr/inner.d.ts +2 -2
  58. package/dist/instr/inner.js +1 -1
  59. package/dist/instr/meteora_damm_ix.d.ts +1 -1
  60. package/dist/instr/meteora_damm_ix.js +41 -79
  61. package/dist/instr/meteora_dlmm_ix.d.ts +1 -1
  62. package/dist/instr/meteora_dlmm_ix.js +10 -0
  63. package/dist/instr/meteora_pools_ix.d.ts +1 -1
  64. package/dist/instr/mod.d.ts +1 -1
  65. package/dist/instr/orca_whirlpool_ix.d.ts +1 -1
  66. package/dist/instr/pump_fees_ix.d.ts +1 -1
  67. package/dist/instr/pumpfun_ix.d.ts +1 -1
  68. package/dist/instr/pumpfun_ix.js +16 -0
  69. package/dist/instr/pumpswap_ix.d.ts +1 -1
  70. package/dist/instr/pumpswap_ix.js +13 -5
  71. package/dist/instr/raydium_amm_v4_ix.d.ts +1 -1
  72. package/dist/instr/raydium_amm_v4_ix.js +9 -5
  73. package/dist/instr/raydium_clmm_ix.d.ts +1 -1
  74. package/dist/instr/raydium_cpmm_ix.d.ts +1 -1
  75. package/dist/instr/raydium_launchlab_ix.d.ts +1 -1
  76. package/dist/instr/raydium_launchlab_ix.js +62 -2
  77. package/dist/instr/utils.d.ts +2 -2
  78. package/dist/instr/utils.js +2 -7
  79. package/dist/liquidity_snapshot.d.ts +54 -0
  80. package/dist/liquidity_snapshot.js +85 -0
  81. package/dist/logs/meteora_damm.d.ts +17 -1
  82. package/dist/logs/meteora_damm.js +386 -12
  83. package/dist/logs/meteora_dlmm.d.ts +1 -1
  84. package/dist/logs/meteora_dlmm.js +10 -0
  85. package/dist/logs/optimized_matcher.d.ts +3 -3
  86. package/dist/logs/optimized_matcher.js +35 -1
  87. package/dist/logs/program_log_discriminators.d.ts +5 -0
  88. package/dist/logs/program_log_discriminators.js +5 -0
  89. package/dist/logs/pump.js +10 -0
  90. package/dist/logs/pump_amm.js +22 -1
  91. package/dist/logs/raydium_launchlab.js +19 -1
  92. package/dist/rpc_transaction.d.ts +4 -3
  93. package/dist/rpc_transaction.js +3 -2
  94. package/dist/shredstream/client.js +3 -7
  95. package/dist/shredstream/entries_decode.js +9 -85
  96. package/dist/shredstream/instruction_parse.d.ts +3 -3
  97. package/dist/shredstream/proto_types.d.ts +1 -1
  98. package/dist/shredstream/wire_to_shred_tx.d.ts +1 -1
  99. package/dist/shredstream/wire_to_shred_tx.js +9 -44
  100. package/dist/simulation_route.d.ts +6 -0
  101. package/dist/simulation_route.js +242 -0
  102. package/dist/stonkfun_registry.d.ts +30 -0
  103. package/dist/stonkfun_registry.js +137 -0
  104. package/dist/transaction_route.d.ts +84 -0
  105. package/dist/transaction_route.js +477 -0
  106. package/dist/wire_transaction.d.ts +35 -0
  107. package/dist/wire_transaction.js +191 -0
  108. package/package.json +7 -4
package/dist/logs/pump.js CHANGED
@@ -171,6 +171,8 @@ function parseTradeFromData(data, metadata, isCreatedBuy) {
171
171
  const quote_amount = readOptionalU64(data, tail);
172
172
  const virtual_quote_reserves = readOptionalU64(data, tail);
173
173
  const real_quote_reserves = readOptionalU64(data, tail);
174
+ const holder_rewards_bps = readOptionalU64(data, tail);
175
+ const holder_rewards = readOptionalU64(data, tail);
174
176
  const trade = {
175
177
  metadata,
176
178
  mint,
@@ -206,6 +208,8 @@ function parseTradeFromData(data, metadata, isCreatedBuy) {
206
208
  quote_amount,
207
209
  virtual_quote_reserves,
208
210
  real_quote_reserves,
211
+ holder_rewards_bps,
212
+ holder_rewards,
209
213
  is_cashback_coin: cashback_fee_basis_points > 0n,
210
214
  bonding_curve: (0, dex_event_js_1.defaultPubkey)(),
211
215
  associated_bonding_curve: (0, dex_event_js_1.defaultPubkey)(),
@@ -274,6 +278,10 @@ function parseCreateFromData(data, metadata) {
274
278
  const quote_mint = normalizePumpfunQuoteMint(o + 32 <= data.length ? (0, binary_js_1.readPubkey)(data, o) : (0, dex_event_js_1.defaultPubkey)());
275
279
  o += 32;
276
280
  const virtual_quote_reserves = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
281
+ o += 8;
282
+ const creator_fee_bps = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
283
+ o += 8;
284
+ const is_holder_reward = (0, binary_js_1.readBool)(data, o) ?? false;
277
285
  const ev = {
278
286
  metadata,
279
287
  name: n1.s,
@@ -295,6 +303,8 @@ function parseCreateFromData(data, metadata) {
295
303
  quote_vault: (0, dex_event_js_1.defaultPubkey)(),
296
304
  quote_token_program: (0, dex_event_js_1.defaultPubkey)(),
297
305
  virtual_quote_reserves,
306
+ creator_fee_bps,
307
+ is_holder_reward,
298
308
  ix_name: "create",
299
309
  };
300
310
  return { PumpFunCreate: ev };
@@ -26,6 +26,8 @@ function emptyTradeTail() {
26
26
  virtual_quote_reserves: 0n,
27
27
  can_boost: false,
28
28
  base_supply: 0n,
29
+ holder_rewards_bps: 0n,
30
+ holder_rewards: 0n,
29
31
  };
30
32
  }
31
33
  function parseTradeTail(data) {
@@ -55,6 +57,12 @@ function parseTradeTail(data) {
55
57
  return null;
56
58
  tail.can_boost = canBoost === 1;
57
59
  tail.base_supply = bn64((0, binary_js_1.readU64LE)(data, 49));
60
+ if (data.length !== 57 && data.length < 73)
61
+ return null;
62
+ if (data.length >= 73) {
63
+ tail.holder_rewards_bps = bn64((0, binary_js_1.readU64LE)(data, 57));
64
+ tail.holder_rewards = bn64((0, binary_js_1.readU64LE)(data, 65));
65
+ }
58
66
  return tail;
59
67
  }
60
68
  function readStrictBorshString(data, offset) {
@@ -188,6 +196,8 @@ function parseBuyFromData(data, metadata) {
188
196
  virtual_quote_reserves: tail.virtual_quote_reserves,
189
197
  can_boost: tail.can_boost,
190
198
  base_supply: tail.base_supply,
199
+ holder_rewards_bps: tail.holder_rewards_bps,
200
+ holder_rewards: tail.holder_rewards,
191
201
  is_pump_pool: false,
192
202
  base_mint: ZP,
193
203
  quote_mint: ZP,
@@ -286,6 +296,8 @@ function parseSellFromData(data, metadata) {
286
296
  virtual_quote_reserves: tail.virtual_quote_reserves,
287
297
  can_boost: tail.can_boost,
288
298
  base_supply: tail.base_supply,
299
+ holder_rewards_bps: tail.holder_rewards_bps,
300
+ holder_rewards: tail.holder_rewards,
289
301
  is_pump_pool: false,
290
302
  base_mint: ZP,
291
303
  quote_mint: ZP,
@@ -299,9 +311,11 @@ function parseSellFromData(data, metadata) {
299
311
  return { PumpSwapSell: ev };
300
312
  }
301
313
  function parseCreatePoolFromData(data, metadata) {
302
- const REQUIRED = 8 + 2 + 32 * 6 + 2 + 8 * 7 + 1;
314
+ const REQUIRED = 326;
303
315
  if (data.length < REQUIRED)
304
316
  return null;
317
+ if (data.length !== REQUIRED && data.length < 335)
318
+ return null;
305
319
  let o = 0;
306
320
  const timestamp = bnI64((0, binary_js_1.readI64LE)(data, o));
307
321
  o += 8;
@@ -344,6 +358,9 @@ function parseCreatePoolFromData(data, metadata) {
344
358
  const coin_creator = (0, binary_js_1.readPubkey)(data, o);
345
359
  o += 32;
346
360
  const is_mayhem_mode = data.length > 325 && (0, binary_js_1.readBool)(data, 325) === true;
361
+ const creator_fee_bps = data.length >= 334 ? bn64((0, binary_js_1.readU64LE)(data, 326)) : 0n;
362
+ const can_edit_creator_fee = data.length > 334 && (0, binary_js_1.readBool)(data, 334) === true;
363
+ const is_holder_reward = data.length > 335 && (0, binary_js_1.readBool)(data, 335) === true;
347
364
  const ev = {
348
365
  metadata,
349
366
  timestamp,
@@ -367,6 +384,10 @@ function parseCreatePoolFromData(data, metadata) {
367
384
  user_quote_token_account,
368
385
  coin_creator,
369
386
  is_mayhem_mode,
387
+ is_cashback_coin: false,
388
+ creator_fee_bps,
389
+ can_edit_creator_fee,
390
+ is_holder_reward,
370
391
  };
371
392
  return { PumpSwapCreatePool: ev };
372
393
  }
@@ -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 || amount_in === null || amount_out === null || trade_direction === null || exact_in === null) {
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 };
@@ -13,9 +13,10 @@ export declare function applyAccountFillsToLogEvents(events: DexEvent[], msg: Me
13
13
  * 解析已获取的 `VersionedTransactionResponse`(顺序:指令 → 日志 → 账户/数据填充)。
14
14
  */
15
15
  export declare function parseRpcTransaction(tx: VersionedTransactionResponse, signature: string, filter?: EventTypeFilter, options?: {
16
- grpcRecvUs?: number;
17
- txIndex?: number;
18
- blockTimeUs?: number;
16
+ slot?: bigint | string | number;
17
+ grpcRecvUs?: bigint | string | number;
18
+ txIndex?: bigint | string | number;
19
+ blockTimeUs?: bigint | string | number;
19
20
  }): {
20
21
  ok: true;
21
22
  events: DexEvent[];
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fillDataRpc = exports.fillAccountsFromTransactionDataRpc = void 0;
7
7
  exports.applyAccountFillsToLogEvents = applyAccountFillsToLogEvents;
8
8
  exports.parseRpcTransaction = parseRpcTransaction;
9
+ const metadata_js_1 = require("./core/metadata.js");
9
10
  /**
10
11
  * RPC 交易解析:外层 + 内层指令 → 日志 → `fillAccountsFromTransactionDataRpc` → `fillDataRpc`。
11
12
  */
@@ -483,8 +484,8 @@ function parseRpcTransaction(tx, signature, filter, options) {
483
484
  };
484
485
  }
485
486
  const meta = tx.meta ?? null;
486
- const slot = tx.slot;
487
- const blockTimeUs = options?.blockTimeUs ?? (tx.blockTime != null ? tx.blockTime * 1_000_000 : undefined);
487
+ const slot = (0, metadata_js_1.exactU64)(options?.slot ?? tx.slot, "slot");
488
+ const blockTimeUs = options?.blockTimeUs ?? (tx.blockTime != null ? (0, metadata_js_1.exactI64)(tx.blockTime) * 1000000n : undefined);
488
489
  const grpcRecvUs = options?.grpcRecvUs ?? Math.floor(Date.now() * 1000);
489
490
  const txIndex = options?.txIndex ?? 0;
490
491
  const rb = recentBlockhashBytes(msg.recentBlockhash);
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ShredStreamClient = exports.ShredEventQueue = void 0;
37
+ const metadata_js_1 = require("../core/metadata.js");
37
38
  /**
38
39
  * ShredStream 客户端:与 Rust `shredstream/client.rs` 对齐(gRPC + bincode 解码 + `parseTransactionEvents`)。
39
40
  */
@@ -120,7 +121,7 @@ function setGrpcRecvUsMut(event, grpcRecvUs) {
120
121
  return;
121
122
  const inner = event[key];
122
123
  if (inner?.metadata)
123
- inner.metadata.grpc_recv_us = grpcRecvUs;
124
+ inner.metadata.grpc_recv_us = (0, metadata_js_1.exactI64)(grpcRecvUs);
124
125
  }
125
126
  class ShredStreamClient {
126
127
  endpoint;
@@ -394,10 +395,5 @@ class ShredStreamClient {
394
395
  }
395
396
  exports.ShredStreamClient = ShredStreamClient;
396
397
  function toSlotNumber(slot) {
397
- if (typeof slot === "number")
398
- return slot;
399
- if (typeof slot === "bigint")
400
- return Number(slot);
401
- const n = Number(slot);
402
- return Number.isFinite(n) ? Math.floor(n) : 0;
398
+ return (0, metadata_js_1.exactU64)(slot, "ShredStream slot");
403
399
  }
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.bincodeVecEntryCount = bincodeVecEntryCount;
4
7
  exports.decodeCompactU16 = decodeCompactU16;
@@ -6,6 +9,8 @@ exports.parseTransaction = parseTransaction;
6
9
  exports.decodeEntriesBincodeFlat = decodeEntriesBincodeFlat;
7
10
  exports.decodeEntriesBincodeNested = decodeEntriesBincodeNested;
8
11
  exports.decodeShredstreamEntriesBincode = decodeShredstreamEntriesBincode;
12
+ const bs58_1 = __importDefault(require("bs58"));
13
+ const wire_transaction_js_1 = require("../wire_transaction.js");
9
14
  const wire_to_shred_tx_js_1 = require("./wire_to_shred_tx.js");
10
15
  const MAX_VEC_ENTRIES = 100_000;
11
16
  function readU64LE(buf, offset) {
@@ -43,94 +48,13 @@ function decodeCompactU16(buf, pos) {
43
48
  }
44
49
  /** 返回 (txWireLength, signatures);失败返回 null */
45
50
  function parseTransaction(buf, pos) {
46
- const start = pos;
47
- if (pos >= buf.length)
48
- return null;
49
- const sigCountEnc = decodeCompactU16(buf, pos);
50
- if (!sigCountEnc)
51
- return null;
52
- let p = pos + sigCountEnc.bytes;
53
- const sigCount = sigCountEnc.value;
54
- const sigsEnd = p + sigCount * 64;
55
- if (sigsEnd > buf.length)
56
- return null;
57
- const sigs = [];
58
- for (let i = 0; i < sigCount; i++) {
59
- sigs.push(buf.subarray(p, p + 64));
60
- p += 64;
51
+ try {
52
+ const { transaction, length } = (0, wire_transaction_js_1.decodeWireTransaction)(buf, pos, false);
53
+ return { txLen: length, sigs: transaction.signatures.map(s => bs58_1.default.decode(s)) };
61
54
  }
62
- if (p >= buf.length)
63
- return null;
64
- const msgFirst = buf[p];
65
- const isV0 = msgFirst >= 0x80;
66
- if (isV0)
67
- p += 1;
68
- p += 3;
69
- if (p > buf.length)
70
- return null;
71
- const acctEnc = decodeCompactU16(buf, p);
72
- if (!acctEnc)
73
- return null;
74
- p += acctEnc.bytes;
75
- p += acctEnc.value * 32;
76
- if (p > buf.length)
77
- return null;
78
- p += 32;
79
- if (p > buf.length)
80
- return null;
81
- const ixCountEnc = decodeCompactU16(buf, p);
82
- if (!ixCountEnc)
55
+ catch {
83
56
  return null;
84
- p += ixCountEnc.bytes;
85
- const ixCount = ixCountEnc.value;
86
- for (let ix = 0; ix < ixCount; ix++) {
87
- p += 1;
88
- if (p > buf.length)
89
- return null;
90
- const acctLenEnc = decodeCompactU16(buf, p);
91
- if (!acctLenEnc)
92
- return null;
93
- p += acctLenEnc.bytes;
94
- p += acctLenEnc.value;
95
- if (p > buf.length)
96
- return null;
97
- const dataLenEnc = decodeCompactU16(buf, p);
98
- if (!dataLenEnc)
99
- return null;
100
- p += dataLenEnc.bytes;
101
- p += dataLenEnc.value;
102
- if (p > buf.length)
103
- return null;
104
- }
105
- if (isV0) {
106
- if (p >= buf.length)
107
- return null;
108
- const atlCountEnc = decodeCompactU16(buf, p);
109
- if (!atlCountEnc)
110
- return null;
111
- p += atlCountEnc.bytes;
112
- const atlCount = atlCountEnc.value;
113
- for (let atl = 0; atl < atlCount; atl++) {
114
- p += 32;
115
- if (p > buf.length)
116
- return null;
117
- const wLenEnc = decodeCompactU16(buf, p);
118
- if (!wLenEnc)
119
- return null;
120
- p += wLenEnc.bytes;
121
- p += wLenEnc.value;
122
- if (p > buf.length)
123
- return null;
124
- const rLenEnc = decodeCompactU16(buf, p);
125
- if (!rLenEnc)
126
- return null;
127
- p += rLenEnc.bytes;
128
- p += rLenEnc.value;
129
- if (p > buf.length)
130
- return null;
131
- }
132
57
  }
133
- return { txLen: p - start, sigs };
134
58
  }
135
59
  class BatchDecoder {
136
60
  buffer = new Uint8Array(0);
@@ -21,7 +21,7 @@ export type ShredWasmTx = {
21
21
  accounts: string[];
22
22
  instructions?: ShredWasmCompiledIx[];
23
23
  /** 缺省则按仅静态账户处理 */
24
- messageVersion?: "legacy" | "v0";
24
+ messageVersion?: "legacy" | "v0" | "v1";
25
25
  header?: MessageHeader;
26
26
  recentBlockhash?: Uint8Array;
27
27
  addressTableLookups?: ShredAddressTableLookup[];
@@ -29,6 +29,6 @@ export type ShredWasmTx = {
29
29
  /**
30
30
  * 使用已解析的完整账户表(静态+ALT)解析外层指令。
31
31
  */
32
- export declare function dexEventsFromShredWasmTxWithFullKeys(tx: ShredWasmTx, fullAccountKeys: string[], slot: number, txIndex: number, grpcRecvUs: number, eventTypeFilter?: EventTypeFilter): DexEvent[];
32
+ export declare function dexEventsFromShredWasmTxWithFullKeys(tx: ShredWasmTx, fullAccountKeys: string[], slot: number | bigint | string, txIndex: number | bigint | string, grpcRecvUs: number | bigint | string, eventTypeFilter?: EventTypeFilter): DexEvent[];
33
33
  /** 仅静态账户表(无 RPC 时;V0+ALT 缺失账户以默认 pubkey 占位) */
34
- export declare function dexEventsFromShredWasmTx(tx: ShredWasmTx, slot: number, txIndex: number, grpcRecvUs: number, eventTypeFilter?: EventTypeFilter): DexEvent[];
34
+ export declare function dexEventsFromShredWasmTx(tx: ShredWasmTx, slot: number | bigint | string, txIndex: number | bigint | string, grpcRecvUs: number | bigint | string, eventTypeFilter?: EventTypeFilter): DexEvent[];
@@ -4,6 +4,6 @@
4
4
  */
5
5
  export type SubscribeEntriesRequest = Record<string, never>;
6
6
  export interface ShredstreamEntryMessage {
7
- slot: number | string | bigint;
7
+ slot: number | bigint | string | string | bigint;
8
8
  entries: Uint8Array | Buffer;
9
9
  }
@@ -1,2 +1,2 @@
1
- import type { ShredWasmTx } from "./instruction_parse.js";
1
+ import type { ShredWasmTx } from './instruction_parse.js';
2
2
  export declare function wireBytesToShredWasmTx(raw: Uint8Array): ShredWasmTx | null;
@@ -4,54 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.wireBytesToShredWasmTx = wireBytesToShredWasmTx;
7
- /**
8
- * 线格式交易字节 → `ShredWasmTx`(与原 wasm-pack 展开字段对齐,供 `parseInstructionUnified`)。
9
- */
10
- const web3_js_1 = require("@solana/web3.js");
7
+ /** Native wire decoding shared with RPC routes, including V1 without ALT. */
11
8
  const bs58_1 = __importDefault(require("bs58"));
9
+ const wire_transaction_js_1 = require("../wire_transaction.js");
12
10
  function wireBytesToShredWasmTx(raw) {
13
11
  try {
14
- const vt = web3_js_1.VersionedTransaction.deserialize(Buffer.from(raw));
15
- const sig0 = vt.signatures[0];
16
- if (!sig0)
12
+ const { transaction: tx } = (0, wire_transaction_js_1.decodeWireTransaction)(raw), msg = tx.message;
13
+ if (!tx.signatures[0])
17
14
  return null;
18
- const signature = bs58_1.default.encode(sig0);
19
- const msg = vt.message;
20
- if (msg instanceof web3_js_1.MessageV0) {
21
- const lookups = msg.addressTableLookups.map((l) => ({
22
- accountKey: l.accountKey.toBase58(),
23
- writableIndexes: new Uint8Array(l.writableIndexes),
24
- readonlyIndexes: new Uint8Array(l.readonlyIndexes),
25
- }));
26
- const instructions = msg.compiledInstructions.map((ix) => ({
27
- programIdIndex: ix.programIdIndex,
28
- accounts: new Uint8Array(ix.accountKeyIndexes),
29
- data: new Uint8Array(ix.data),
30
- }));
31
- return {
32
- signature,
33
- accounts: msg.staticAccountKeys.map((k) => k.toBase58()),
34
- instructions,
35
- messageVersion: "v0",
36
- header: msg.header,
37
- recentBlockhash: Uint8Array.from(bs58_1.default.decode(msg.recentBlockhash)),
38
- addressTableLookups: lookups,
39
- };
40
- }
41
- const m = msg;
42
- const instructions = m.compiledInstructions.map((ix) => ({
43
- programIdIndex: ix.programIdIndex,
44
- accounts: new Uint8Array(ix.accountKeyIndexes),
45
- data: new Uint8Array(ix.data),
46
- }));
47
- return {
48
- signature,
49
- accounts: m.staticAccountKeys.map((k) => k.toBase58()),
50
- instructions,
51
- messageVersion: "legacy",
52
- header: m.header,
53
- recentBlockhash: Uint8Array.from(bs58_1.default.decode(m.recentBlockhash)),
54
- };
15
+ return { signature: tx.signatures[0], accounts: msg.accountKeys,
16
+ instructions: msg.instructions.map(ix => ({ programIdIndex: ix.programIdIndex, accounts: Uint8Array.from(ix.accounts), data: bs58_1.default.decode(ix.data) })),
17
+ messageVersion: tx.version === 'legacy' ? 'legacy' : tx.version === 0 ? 'v0' : 'v1', header: msg.header,
18
+ recentBlockhash: bs58_1.default.decode(msg.recentBlockhash),
19
+ addressTableLookups: msg.addressTableLookups.map(l => ({ ...l, writableIndexes: Uint8Array.from(l.writableIndexes), readonlyIndexes: Uint8Array.from(l.readonlyIndexes) })) };
55
20
  }
56
21
  catch {
57
22
  return null;
@@ -0,0 +1,6 @@
1
+ import { type TransactionRoute } from "./transaction_route.js";
2
+ /** Original wire plus simulateTransaction response. Parsed SPL transfers and ATA setup.
3
+ * Unsupported parsed CPI fail explicitly; raw/compiled CPI are preserved.
4
+ * V0 ALT requires the existing compiled route API and loadedAddresses.
5
+ */
6
+ export declare function analyzeSimulationRoutes(wire: Uint8Array, response: unknown, graduatedPools?: readonly string[]): TransactionRoute;