@pipeit/fastlane 0.1.0 → 0.1.2

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.
Binary file
Binary file
Binary file
package/index.d.ts CHANGED
@@ -14,25 +14,104 @@ export interface TpuClientConfig {
14
14
  /** Whether to pre-warm connections to upcoming leaders (default: true). */
15
15
  prewarmConnections?: boolean
16
16
  }
17
+ /** Result for a single leader send attempt. */
18
+ export interface LeaderSendResult {
19
+ /** Validator identity pubkey. */
20
+ identity: string
21
+ /** TPU socket address. */
22
+ address: string
23
+ /** Whether send succeeded. */
24
+ success: boolean
25
+ /** Latency for this leader in milliseconds. */
26
+ latencyMs: number
27
+ /** Error message if failed. */
28
+ error?: string
29
+ /** Error code for programmatic handling. */
30
+ errorCode?: string
31
+ /** Number of attempts made for this leader. */
32
+ attempts: number
33
+ }
17
34
  /** Result from sending a transaction. */
18
35
  export interface SendResult {
19
36
  /** Whether the transaction was successfully delivered. */
20
37
  delivered: boolean
21
- /** Latency in milliseconds. */
38
+ /** Total latency in milliseconds. */
22
39
  latencyMs: number
23
40
  /** Number of leaders the transaction was sent to. */
24
41
  leaderCount: number
42
+ /** Per-leader breakdown of send results. */
43
+ leaders: Array<LeaderSendResult>
44
+ /** Total retry attempts made across all leaders. */
45
+ retryCount: number
46
+ }
47
+ /** Client health and statistics. */
48
+ export interface TpuClientStats {
49
+ /** Number of active QUIC connections. */
50
+ connectionCount: number
51
+ /** Current estimated slot. */
52
+ currentSlot: number
53
+ /** Number of QUIC endpoints. */
54
+ endpointCount: number
55
+ /** Client ready state: "initializing", "ready", or "error". */
56
+ readyState: string
57
+ /** Seconds since client was created. */
58
+ uptimeSecs: number
59
+ /** Number of validators with known sockets. */
60
+ knownValidators: number
61
+ }
62
+ /** Result from continuous send until confirmed. */
63
+ export interface SendUntilConfirmedResult {
64
+ /** Whether the transaction was confirmed on-chain. */
65
+ confirmed: boolean
66
+ /** Transaction signature (base58). */
67
+ signature: string
68
+ /** Number of send rounds attempted. */
69
+ rounds: number
70
+ /** Total number of leader sends across all rounds. */
71
+ totalLeadersSent: number
72
+ /** Total latency in milliseconds. */
73
+ latencyMs: number
74
+ /** Error message if failed. */
75
+ error?: string
25
76
  }
26
- /** Native QUIC client for direct Solana TPU transaction submission. */
77
+ /**
78
+ * Native QUIC client for direct Solana TPU transaction submission.
79
+ *
80
+ * Supports continuous resubmission until confirmed for high landing rates.
81
+ */
27
82
  export declare class TpuClient {
28
83
  /** Creates a new TPU client instance. */
29
84
  constructor(config: TpuClientConfig)
30
- /** Sends a serialized transaction to TPU endpoints. */
85
+ /**
86
+ * Sends a serialized transaction to TPU endpoints (single attempt).
87
+ *
88
+ * Returns detailed per-leader results including retry statistics.
89
+ * For higher landing rates, use `send_until_confirmed` instead.
90
+ */
31
91
  sendTransaction(transaction: Buffer): Promise<SendResult>
92
+ /**
93
+ * Sends a transaction continuously until confirmed or timeout.
94
+ *
95
+ * Uses slot-aware leader selection to minimize tx leakage:
96
+ * - Slots 0-2 of leader window: sends to current leader only
97
+ * - Slot 3 of leader window: sends to current + next leader (hedge)
98
+ *
99
+ * Falls back to fixed fanout if slot estimation is unreliable.
100
+ *
101
+ * # Arguments
102
+ * * `transaction` - Serialized signed transaction
103
+ * * `timeout_ms` - Maximum time to wait for confirmation (default: 30000ms)
104
+ *
105
+ * # Returns
106
+ * Result indicating whether the transaction was confirmed on-chain.
107
+ */
108
+ sendUntilConfirmed(transaction: Buffer, timeoutMs?: number | undefined | null): Promise<SendUntilConfirmedResult>
32
109
  /** Gets the current estimated slot number. */
33
110
  getCurrentSlot(): number
34
111
  /** Gets the number of active QUIC connections. */
35
112
  getConnectionCount(): Promise<number>
113
+ /** Gets comprehensive client statistics. */
114
+ getStats(): Promise<TpuClientStats>
36
115
  /** Waits for the client to be fully initialized. */
37
116
  waitReady(): Promise<void>
38
117
  /** Shuts down the client and closes all connections. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipeit/fastlane",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Native QUIC client for direct Solana TPU transaction submission",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",