-
Notifications
You must be signed in to change notification settings - Fork 350
Expand file tree
/
Copy pathindex.d.ts
More file actions
173 lines (160 loc) · 5.36 KB
/
Copy pathindex.d.ts
File metadata and controls
173 lines (160 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/* auto-generated by NAPI-RS */
/* eslint-disable */
export declare class CompressedAccountFilterSet {
constructor(maxCapacity: number)
insert(pubkey: string): boolean
insertBytes(pubkey: Buffer): boolean
remove(pubkey: string): boolean
removeBytes(pubkey: Buffer): boolean
contains(pubkey: string): boolean
containsBytes(pubkey: Buffer): boolean
len(): number
capacity(): number
isEmpty(): boolean
toProto(): Buffer
toAccountFilter(): Buffer
toBlockFilter(): Buffer
}
/**
* DuplexStream Engine
*
* The inner engine for a custom implementation of stream.Duplex
* on the JS runtime.
*
* This is not meant to be directly interacted with by the user
* rather an underlying stream implementation where stream.Duplex
* will `_read()` from and `_write()` to.
*/
export declare class DuplexStream {
/**
* Read JS Accesspoint.
*
* Retrieve one encoded `SubscribeUpdate` payload from the worker.
*/
read(): Promise<Buffer | undefined | null>
/** Return current native stream queue counters for diagnostics. */
stats(): DuplexStreamStats
/** Close the stream and reject future writes. */
close(): void
writeRaw(requestBytes: Buffer): void
}
/**
* DuplexStreamDeshred Engine.
*
* Similar to `DuplexStream`, but targets the deshred pre-execution stream.
*/
export declare class DuplexStreamDeshred {
/** Retrieve one encoded `SubscribeUpdateDeshred` payload. */
read(): Promise<Buffer | undefined | null>
/** Return current native stream queue counters for diagnostics. */
stats(): DuplexStreamStats
close(): void
writeRaw(requestBytes: Buffer): void
}
/**
* Main client struct exposed to JavaScript via NAPI.
*
* The client maintains a persistent gRPC connection that is created once
* in the constructor and reused for all subsequent operations.
*/
export declare class GrpcClient {
/**
* Creates a new gRPC client and establishes a connection.
*
* This is an async factory method that:
* 1. Initializes the crypto provider (required for TLS)
* 2. Builds the client with the provided configuration
* 3. Establishes the gRPC connection
* 4. Wraps the client for safe concurrent access
*
* The connection is persistent and will be reused for all subsequent operations.
*/
static new(endpoint: string, xToken?: string | undefined | null, channelOptions?: JsChannelOptions | undefined | null, reconnectConfig?: JsReconnectConfig | undefined | null): Promise<GrpcClient>
getLatestBlockhash(requestBytes: Buffer): Promise<Buffer>
ping(requestBytes: Buffer): Promise<Buffer>
getBlockHeight(requestBytes: Buffer): Promise<Buffer>
getSlot(requestBytes: Buffer): Promise<Buffer>
isBlockhashValid(requestBytes: Buffer): Promise<Buffer>
getVersion(requestBytes: Buffer): Promise<Buffer>
subscribeReplayInfo(requestBytes: Buffer): Promise<Buffer>
/**
* Creates a subscription stream bound to this client connection.
*
* The returned value is consumed by the JS SDK `ClientDuplexStream` wrapper,
* which handles Node stream lifecycle and protobuf payload decoding.
*/
subscribe(initialRequestBytes?: Buffer | undefined | null): Promise<DuplexStream>
/**
* Creates a deshred subscription stream bound to this client connection.
*
* Unlike `subscribe()`, this method opens the underlying gRPC stream before
* resolving, so server-side `UNIMPLEMENTED` errors bubble to TypeScript
* callers through the returned Promise.
*/
subscribeDeshred(): Promise<DuplexStreamDeshred>
}
export const AUTORECONNECT_FILTER_KEY: string
export declare function decodeTxError(err: Array<number>): string
export interface DuplexStreamStats {
queuedMessages: number
queuedBytes: number
maxQueuedBytes: number
updatesEnqueued: number
updatesDequeued: number
grpcUpdatesReceived: number
readCalls: number
}
export declare function encodeDeshredTx(data: Uint8Array, encoding: WasmUiTransactionEncoding): string
export declare function encodeTx(data: Uint8Array, encoding: WasmUiTransactionEncoding, maxSupportedTransactionVersion: number | undefined | null, showRewards: boolean): string
/**
* ChannelOptions from JS.
*
* Struct to hold the channel options configuration
* passed from JS.
*
* Note:
* The type u32 is being used because of napi's built-in
* support for u32 to number (JS) conversion.
*/
export interface JsChannelOptions {
grpcConnectTimeout?: number
grpcBufferSize?: number
grpcHttp2KeepAliveInterval?: number
grpcInitialConnectionWindowSize?: number
grpcInitialStreamWindowSize?: number
grpcKeepAliveTimeout?: number
grpcTcpKeepalive?: number
grpcTimeout?: number
grpcMaxDecodingMessageSize?: number
grpcMaxEncodingMessageSize?: number
grpcDefaultCompressionAlgorithm?: JsCompressionAlgorithm
grpcSetXRequestSnapshot?: boolean
grpcHttp2AdaptiveWindow?: boolean
grpcKeepAliveWhileIdle?: boolean
grpcTcpNodelay?: boolean
}
export declare const enum JsCompressionAlgorithm {
Gzip = 0,
Zstd = 1
}
export interface JsReconnectBackoff {
initialIntervalMs?: number
multiplier?: number
maxRetries?: number
}
export interface JsReconnectConfig {
/**
* Omitted or true enables reconnect when this object is provided.
* False keeps legacy no-reconnect behavior.
*/
enabled?: boolean
backoff?: JsReconnectBackoff
slotRetention?: number
}
export declare const enum WasmUiTransactionEncoding {
Binary = 0,
Base64 = 1,
Base58 = 2,
Json = 3,
JsonParsed = 4
}