@validators-dao/solana-stream-sdk 0.2.0 → 0.3.0
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/LICENSE.txt +67 -0
- package/README.md +169 -13
- package/dist/index.d.ts +180 -4
- package/dist/index.js +1335 -3
- package/dist/index.js.map +1 -1
- package/package.json +22 -11
- package/LICENSE +0 -21
- package/dist/index.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,1336 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import Client2, {
|
|
3
|
+
CommitmentLevel as CommitmentLevel2,
|
|
4
|
+
SubscribeRequestAccountsDataSlice,
|
|
5
|
+
SubscribeRequestFilterAccounts as SubscribeRequestFilterAccounts2,
|
|
6
|
+
SubscribeRequestFilterBlocks,
|
|
7
|
+
SubscribeRequestFilterBlocksMeta,
|
|
8
|
+
SubscribeRequestFilterEntry,
|
|
9
|
+
SubscribeRequestFilterSlots as SubscribeRequestFilterSlots2,
|
|
10
|
+
SubscribeRequestFilterTransactions as SubscribeRequestFilterTransactions2
|
|
11
|
+
} from "@triton-one/yellowstone-grpc";
|
|
12
|
+
import bs58 from "bs58";
|
|
13
|
+
|
|
14
|
+
// src/generated/shredstream.ts
|
|
15
|
+
import { BinaryReader as BinaryReader3, BinaryWriter as BinaryWriter3 } from "@bufbuild/protobuf/wire";
|
|
16
|
+
import {
|
|
17
|
+
makeGenericClientConstructor
|
|
18
|
+
} from "@grpc/grpc-js";
|
|
19
|
+
|
|
20
|
+
// src/generated/google/protobuf/timestamp.ts
|
|
21
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
22
|
+
|
|
23
|
+
// src/generated/shared.ts
|
|
24
|
+
import { BinaryReader as BinaryReader2, BinaryWriter as BinaryWriter2 } from "@bufbuild/protobuf/wire";
|
|
25
|
+
function createBaseSocket() {
|
|
26
|
+
return { ip: "", port: 0 };
|
|
27
|
+
}
|
|
28
|
+
var Socket = {
|
|
29
|
+
encode(message, writer = new BinaryWriter2()) {
|
|
30
|
+
if (message.ip !== "") {
|
|
31
|
+
writer.uint32(10).string(message.ip);
|
|
32
|
+
}
|
|
33
|
+
if (message.port !== 0) {
|
|
34
|
+
writer.uint32(16).int64(message.port);
|
|
35
|
+
}
|
|
36
|
+
return writer;
|
|
37
|
+
},
|
|
38
|
+
decode(input, length) {
|
|
39
|
+
const reader = input instanceof BinaryReader2 ? input : new BinaryReader2(input);
|
|
40
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
41
|
+
const message = createBaseSocket();
|
|
42
|
+
while (reader.pos < end) {
|
|
43
|
+
const tag = reader.uint32();
|
|
44
|
+
switch (tag >>> 3) {
|
|
45
|
+
case 1: {
|
|
46
|
+
if (tag !== 10) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
message.ip = reader.string();
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
case 2: {
|
|
53
|
+
if (tag !== 16) {
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
message.port = longToNumber(reader.int64());
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
reader.skip(tag & 7);
|
|
64
|
+
}
|
|
65
|
+
return message;
|
|
66
|
+
},
|
|
67
|
+
fromJSON(object) {
|
|
68
|
+
return {
|
|
69
|
+
ip: isSet(object.ip) ? globalThis.String(object.ip) : "",
|
|
70
|
+
port: isSet(object.port) ? globalThis.Number(object.port) : 0
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
toJSON(message) {
|
|
74
|
+
const obj = {};
|
|
75
|
+
if (message.ip !== "") {
|
|
76
|
+
obj.ip = message.ip;
|
|
77
|
+
}
|
|
78
|
+
if (message.port !== 0) {
|
|
79
|
+
obj.port = Math.round(message.port);
|
|
80
|
+
}
|
|
81
|
+
return obj;
|
|
82
|
+
},
|
|
83
|
+
create(base) {
|
|
84
|
+
return Socket.fromPartial(base ?? {});
|
|
85
|
+
},
|
|
86
|
+
fromPartial(object) {
|
|
87
|
+
const message = createBaseSocket();
|
|
88
|
+
message.ip = object.ip ?? "";
|
|
89
|
+
message.port = object.port ?? 0;
|
|
90
|
+
return message;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
function longToNumber(int64) {
|
|
94
|
+
const num = globalThis.Number(int64.toString());
|
|
95
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
96
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
97
|
+
}
|
|
98
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
99
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
100
|
+
}
|
|
101
|
+
return num;
|
|
102
|
+
}
|
|
103
|
+
function isSet(value) {
|
|
104
|
+
return value !== null && value !== void 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/generated/shredstream.ts
|
|
108
|
+
var CommitmentLevel = /* @__PURE__ */ ((CommitmentLevel3) => {
|
|
109
|
+
CommitmentLevel3[CommitmentLevel3["PROCESSED"] = 0] = "PROCESSED";
|
|
110
|
+
CommitmentLevel3[CommitmentLevel3["CONFIRMED"] = 1] = "CONFIRMED";
|
|
111
|
+
CommitmentLevel3[CommitmentLevel3["FINALIZED"] = 2] = "FINALIZED";
|
|
112
|
+
CommitmentLevel3[CommitmentLevel3["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
113
|
+
return CommitmentLevel3;
|
|
114
|
+
})(CommitmentLevel || {});
|
|
115
|
+
function commitmentLevelFromJSON(object) {
|
|
116
|
+
switch (object) {
|
|
117
|
+
case 0:
|
|
118
|
+
case "PROCESSED":
|
|
119
|
+
return 0 /* PROCESSED */;
|
|
120
|
+
case 1:
|
|
121
|
+
case "CONFIRMED":
|
|
122
|
+
return 1 /* CONFIRMED */;
|
|
123
|
+
case 2:
|
|
124
|
+
case "FINALIZED":
|
|
125
|
+
return 2 /* FINALIZED */;
|
|
126
|
+
case -1:
|
|
127
|
+
case "UNRECOGNIZED":
|
|
128
|
+
default:
|
|
129
|
+
return -1 /* UNRECOGNIZED */;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function commitmentLevelToJSON(object) {
|
|
133
|
+
switch (object) {
|
|
134
|
+
case 0 /* PROCESSED */:
|
|
135
|
+
return "PROCESSED";
|
|
136
|
+
case 1 /* CONFIRMED */:
|
|
137
|
+
return "CONFIRMED";
|
|
138
|
+
case 2 /* FINALIZED */:
|
|
139
|
+
return "FINALIZED";
|
|
140
|
+
case -1 /* UNRECOGNIZED */:
|
|
141
|
+
default:
|
|
142
|
+
return "UNRECOGNIZED";
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function createBaseHeartbeat() {
|
|
146
|
+
return { socket: void 0, regions: [] };
|
|
147
|
+
}
|
|
148
|
+
var Heartbeat = {
|
|
149
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
150
|
+
if (message.socket !== void 0) {
|
|
151
|
+
Socket.encode(message.socket, writer.uint32(10).fork()).join();
|
|
152
|
+
}
|
|
153
|
+
for (const v of message.regions) {
|
|
154
|
+
writer.uint32(18).string(v);
|
|
155
|
+
}
|
|
156
|
+
return writer;
|
|
157
|
+
},
|
|
158
|
+
decode(input, length) {
|
|
159
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
160
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
161
|
+
const message = createBaseHeartbeat();
|
|
162
|
+
while (reader.pos < end) {
|
|
163
|
+
const tag = reader.uint32();
|
|
164
|
+
switch (tag >>> 3) {
|
|
165
|
+
case 1: {
|
|
166
|
+
if (tag !== 10) {
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
message.socket = Socket.decode(reader, reader.uint32());
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
case 2: {
|
|
173
|
+
if (tag !== 18) {
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
message.regions.push(reader.string());
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
reader.skip(tag & 7);
|
|
184
|
+
}
|
|
185
|
+
return message;
|
|
186
|
+
},
|
|
187
|
+
fromJSON(object) {
|
|
188
|
+
return {
|
|
189
|
+
socket: isSet2(object.socket) ? Socket.fromJSON(object.socket) : void 0,
|
|
190
|
+
regions: globalThis.Array.isArray(object?.regions) ? object.regions.map((e) => globalThis.String(e)) : []
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
toJSON(message) {
|
|
194
|
+
const obj = {};
|
|
195
|
+
if (message.socket !== void 0) {
|
|
196
|
+
obj.socket = Socket.toJSON(message.socket);
|
|
197
|
+
}
|
|
198
|
+
if (message.regions?.length) {
|
|
199
|
+
obj.regions = message.regions;
|
|
200
|
+
}
|
|
201
|
+
return obj;
|
|
202
|
+
},
|
|
203
|
+
create(base) {
|
|
204
|
+
return Heartbeat.fromPartial(base ?? {});
|
|
205
|
+
},
|
|
206
|
+
fromPartial(object) {
|
|
207
|
+
const message = createBaseHeartbeat();
|
|
208
|
+
message.socket = object.socket !== void 0 && object.socket !== null ? Socket.fromPartial(object.socket) : void 0;
|
|
209
|
+
message.regions = object.regions?.map((e) => e) || [];
|
|
210
|
+
return message;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
function createBaseHeartbeatResponse() {
|
|
214
|
+
return { ttlMs: 0 };
|
|
215
|
+
}
|
|
216
|
+
var HeartbeatResponse = {
|
|
217
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
218
|
+
if (message.ttlMs !== 0) {
|
|
219
|
+
writer.uint32(8).uint32(message.ttlMs);
|
|
220
|
+
}
|
|
221
|
+
return writer;
|
|
222
|
+
},
|
|
223
|
+
decode(input, length) {
|
|
224
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
225
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
226
|
+
const message = createBaseHeartbeatResponse();
|
|
227
|
+
while (reader.pos < end) {
|
|
228
|
+
const tag = reader.uint32();
|
|
229
|
+
switch (tag >>> 3) {
|
|
230
|
+
case 1: {
|
|
231
|
+
if (tag !== 8) {
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
message.ttlMs = reader.uint32();
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
reader.skip(tag & 7);
|
|
242
|
+
}
|
|
243
|
+
return message;
|
|
244
|
+
},
|
|
245
|
+
fromJSON(object) {
|
|
246
|
+
return { ttlMs: isSet2(object.ttlMs) ? globalThis.Number(object.ttlMs) : 0 };
|
|
247
|
+
},
|
|
248
|
+
toJSON(message) {
|
|
249
|
+
const obj = {};
|
|
250
|
+
if (message.ttlMs !== 0) {
|
|
251
|
+
obj.ttlMs = Math.round(message.ttlMs);
|
|
252
|
+
}
|
|
253
|
+
return obj;
|
|
254
|
+
},
|
|
255
|
+
create(base) {
|
|
256
|
+
return HeartbeatResponse.fromPartial(base ?? {});
|
|
257
|
+
},
|
|
258
|
+
fromPartial(object) {
|
|
259
|
+
const message = createBaseHeartbeatResponse();
|
|
260
|
+
message.ttlMs = object.ttlMs ?? 0;
|
|
261
|
+
return message;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
function createBaseSubscribeEntriesRequest() {
|
|
265
|
+
return { accounts: {}, transactions: {}, slots: {}, commitment: void 0 };
|
|
266
|
+
}
|
|
267
|
+
var SubscribeEntriesRequest = {
|
|
268
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
269
|
+
Object.entries(message.accounts).forEach(([key, value]) => {
|
|
270
|
+
SubscribeEntriesRequest_AccountsEntry.encode({ key, value }, writer.uint32(10).fork()).join();
|
|
271
|
+
});
|
|
272
|
+
Object.entries(message.transactions).forEach(([key, value]) => {
|
|
273
|
+
SubscribeEntriesRequest_TransactionsEntry.encode({ key, value }, writer.uint32(26).fork()).join();
|
|
274
|
+
});
|
|
275
|
+
Object.entries(message.slots).forEach(([key, value]) => {
|
|
276
|
+
SubscribeEntriesRequest_SlotsEntry.encode({ key, value }, writer.uint32(18).fork()).join();
|
|
277
|
+
});
|
|
278
|
+
if (message.commitment !== void 0) {
|
|
279
|
+
writer.uint32(48).int32(message.commitment);
|
|
280
|
+
}
|
|
281
|
+
return writer;
|
|
282
|
+
},
|
|
283
|
+
decode(input, length) {
|
|
284
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
285
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
286
|
+
const message = createBaseSubscribeEntriesRequest();
|
|
287
|
+
while (reader.pos < end) {
|
|
288
|
+
const tag = reader.uint32();
|
|
289
|
+
switch (tag >>> 3) {
|
|
290
|
+
case 1: {
|
|
291
|
+
if (tag !== 10) {
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
const entry1 = SubscribeEntriesRequest_AccountsEntry.decode(reader, reader.uint32());
|
|
295
|
+
if (entry1.value !== void 0) {
|
|
296
|
+
message.accounts[entry1.key] = entry1.value;
|
|
297
|
+
}
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
case 3: {
|
|
301
|
+
if (tag !== 26) {
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
const entry3 = SubscribeEntriesRequest_TransactionsEntry.decode(reader, reader.uint32());
|
|
305
|
+
if (entry3.value !== void 0) {
|
|
306
|
+
message.transactions[entry3.key] = entry3.value;
|
|
307
|
+
}
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
case 2: {
|
|
311
|
+
if (tag !== 18) {
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
const entry2 = SubscribeEntriesRequest_SlotsEntry.decode(reader, reader.uint32());
|
|
315
|
+
if (entry2.value !== void 0) {
|
|
316
|
+
message.slots[entry2.key] = entry2.value;
|
|
317
|
+
}
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
case 6: {
|
|
321
|
+
if (tag !== 48) {
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
message.commitment = reader.int32();
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
reader.skip(tag & 7);
|
|
332
|
+
}
|
|
333
|
+
return message;
|
|
334
|
+
},
|
|
335
|
+
fromJSON(object) {
|
|
336
|
+
return {
|
|
337
|
+
accounts: isObject(object.accounts) ? Object.entries(object.accounts).reduce(
|
|
338
|
+
(acc, [key, value]) => {
|
|
339
|
+
acc[key] = SubscribeRequestFilterAccounts.fromJSON(value);
|
|
340
|
+
return acc;
|
|
341
|
+
},
|
|
342
|
+
{}
|
|
343
|
+
) : {},
|
|
344
|
+
transactions: isObject(object.transactions) ? Object.entries(object.transactions).reduce(
|
|
345
|
+
(acc, [key, value]) => {
|
|
346
|
+
acc[key] = SubscribeRequestFilterTransactions.fromJSON(value);
|
|
347
|
+
return acc;
|
|
348
|
+
},
|
|
349
|
+
{}
|
|
350
|
+
) : {},
|
|
351
|
+
slots: isObject(object.slots) ? Object.entries(object.slots).reduce((acc, [key, value]) => {
|
|
352
|
+
acc[key] = SubscribeRequestFilterSlots.fromJSON(value);
|
|
353
|
+
return acc;
|
|
354
|
+
}, {}) : {},
|
|
355
|
+
commitment: isSet2(object.commitment) ? commitmentLevelFromJSON(object.commitment) : void 0
|
|
356
|
+
};
|
|
357
|
+
},
|
|
358
|
+
toJSON(message) {
|
|
359
|
+
const obj = {};
|
|
360
|
+
if (message.accounts) {
|
|
361
|
+
const entries = Object.entries(message.accounts);
|
|
362
|
+
if (entries.length > 0) {
|
|
363
|
+
obj.accounts = {};
|
|
364
|
+
entries.forEach(([k, v]) => {
|
|
365
|
+
obj.accounts[k] = SubscribeRequestFilterAccounts.toJSON(v);
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (message.transactions) {
|
|
370
|
+
const entries = Object.entries(message.transactions);
|
|
371
|
+
if (entries.length > 0) {
|
|
372
|
+
obj.transactions = {};
|
|
373
|
+
entries.forEach(([k, v]) => {
|
|
374
|
+
obj.transactions[k] = SubscribeRequestFilterTransactions.toJSON(v);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (message.slots) {
|
|
379
|
+
const entries = Object.entries(message.slots);
|
|
380
|
+
if (entries.length > 0) {
|
|
381
|
+
obj.slots = {};
|
|
382
|
+
entries.forEach(([k, v]) => {
|
|
383
|
+
obj.slots[k] = SubscribeRequestFilterSlots.toJSON(v);
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (message.commitment !== void 0) {
|
|
388
|
+
obj.commitment = commitmentLevelToJSON(message.commitment);
|
|
389
|
+
}
|
|
390
|
+
return obj;
|
|
391
|
+
},
|
|
392
|
+
create(base) {
|
|
393
|
+
return SubscribeEntriesRequest.fromPartial(base ?? {});
|
|
394
|
+
},
|
|
395
|
+
fromPartial(object) {
|
|
396
|
+
const message = createBaseSubscribeEntriesRequest();
|
|
397
|
+
message.accounts = Object.entries(object.accounts ?? {}).reduce(
|
|
398
|
+
(acc, [key, value]) => {
|
|
399
|
+
if (value !== void 0) {
|
|
400
|
+
acc[key] = SubscribeRequestFilterAccounts.fromPartial(value);
|
|
401
|
+
}
|
|
402
|
+
return acc;
|
|
403
|
+
},
|
|
404
|
+
{}
|
|
405
|
+
);
|
|
406
|
+
message.transactions = Object.entries(object.transactions ?? {}).reduce((acc, [key, value]) => {
|
|
407
|
+
if (value !== void 0) {
|
|
408
|
+
acc[key] = SubscribeRequestFilterTransactions.fromPartial(value);
|
|
409
|
+
}
|
|
410
|
+
return acc;
|
|
411
|
+
}, {});
|
|
412
|
+
message.slots = Object.entries(object.slots ?? {}).reduce(
|
|
413
|
+
(acc, [key, value]) => {
|
|
414
|
+
if (value !== void 0) {
|
|
415
|
+
acc[key] = SubscribeRequestFilterSlots.fromPartial(value);
|
|
416
|
+
}
|
|
417
|
+
return acc;
|
|
418
|
+
},
|
|
419
|
+
{}
|
|
420
|
+
);
|
|
421
|
+
message.commitment = object.commitment ?? void 0;
|
|
422
|
+
return message;
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
function createBaseSubscribeEntriesRequest_AccountsEntry() {
|
|
426
|
+
return { key: "", value: void 0 };
|
|
427
|
+
}
|
|
428
|
+
var SubscribeEntriesRequest_AccountsEntry = {
|
|
429
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
430
|
+
if (message.key !== "") {
|
|
431
|
+
writer.uint32(10).string(message.key);
|
|
432
|
+
}
|
|
433
|
+
if (message.value !== void 0) {
|
|
434
|
+
SubscribeRequestFilterAccounts.encode(message.value, writer.uint32(18).fork()).join();
|
|
435
|
+
}
|
|
436
|
+
return writer;
|
|
437
|
+
},
|
|
438
|
+
decode(input, length) {
|
|
439
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
440
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
441
|
+
const message = createBaseSubscribeEntriesRequest_AccountsEntry();
|
|
442
|
+
while (reader.pos < end) {
|
|
443
|
+
const tag = reader.uint32();
|
|
444
|
+
switch (tag >>> 3) {
|
|
445
|
+
case 1: {
|
|
446
|
+
if (tag !== 10) {
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
message.key = reader.string();
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
case 2: {
|
|
453
|
+
if (tag !== 18) {
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
message.value = SubscribeRequestFilterAccounts.decode(reader, reader.uint32());
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
reader.skip(tag & 7);
|
|
464
|
+
}
|
|
465
|
+
return message;
|
|
466
|
+
},
|
|
467
|
+
fromJSON(object) {
|
|
468
|
+
return {
|
|
469
|
+
key: isSet2(object.key) ? globalThis.String(object.key) : "",
|
|
470
|
+
value: isSet2(object.value) ? SubscribeRequestFilterAccounts.fromJSON(object.value) : void 0
|
|
471
|
+
};
|
|
472
|
+
},
|
|
473
|
+
toJSON(message) {
|
|
474
|
+
const obj = {};
|
|
475
|
+
if (message.key !== "") {
|
|
476
|
+
obj.key = message.key;
|
|
477
|
+
}
|
|
478
|
+
if (message.value !== void 0) {
|
|
479
|
+
obj.value = SubscribeRequestFilterAccounts.toJSON(message.value);
|
|
480
|
+
}
|
|
481
|
+
return obj;
|
|
482
|
+
},
|
|
483
|
+
create(base) {
|
|
484
|
+
return SubscribeEntriesRequest_AccountsEntry.fromPartial(base ?? {});
|
|
485
|
+
},
|
|
486
|
+
fromPartial(object) {
|
|
487
|
+
const message = createBaseSubscribeEntriesRequest_AccountsEntry();
|
|
488
|
+
message.key = object.key ?? "";
|
|
489
|
+
message.value = object.value !== void 0 && object.value !== null ? SubscribeRequestFilterAccounts.fromPartial(object.value) : void 0;
|
|
490
|
+
return message;
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
function createBaseSubscribeEntriesRequest_TransactionsEntry() {
|
|
494
|
+
return { key: "", value: void 0 };
|
|
495
|
+
}
|
|
496
|
+
var SubscribeEntriesRequest_TransactionsEntry = {
|
|
497
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
498
|
+
if (message.key !== "") {
|
|
499
|
+
writer.uint32(10).string(message.key);
|
|
500
|
+
}
|
|
501
|
+
if (message.value !== void 0) {
|
|
502
|
+
SubscribeRequestFilterTransactions.encode(message.value, writer.uint32(18).fork()).join();
|
|
503
|
+
}
|
|
504
|
+
return writer;
|
|
505
|
+
},
|
|
506
|
+
decode(input, length) {
|
|
507
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
508
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
509
|
+
const message = createBaseSubscribeEntriesRequest_TransactionsEntry();
|
|
510
|
+
while (reader.pos < end) {
|
|
511
|
+
const tag = reader.uint32();
|
|
512
|
+
switch (tag >>> 3) {
|
|
513
|
+
case 1: {
|
|
514
|
+
if (tag !== 10) {
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
message.key = reader.string();
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
case 2: {
|
|
521
|
+
if (tag !== 18) {
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
message.value = SubscribeRequestFilterTransactions.decode(reader, reader.uint32());
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
reader.skip(tag & 7);
|
|
532
|
+
}
|
|
533
|
+
return message;
|
|
534
|
+
},
|
|
535
|
+
fromJSON(object) {
|
|
536
|
+
return {
|
|
537
|
+
key: isSet2(object.key) ? globalThis.String(object.key) : "",
|
|
538
|
+
value: isSet2(object.value) ? SubscribeRequestFilterTransactions.fromJSON(object.value) : void 0
|
|
539
|
+
};
|
|
540
|
+
},
|
|
541
|
+
toJSON(message) {
|
|
542
|
+
const obj = {};
|
|
543
|
+
if (message.key !== "") {
|
|
544
|
+
obj.key = message.key;
|
|
545
|
+
}
|
|
546
|
+
if (message.value !== void 0) {
|
|
547
|
+
obj.value = SubscribeRequestFilterTransactions.toJSON(message.value);
|
|
548
|
+
}
|
|
549
|
+
return obj;
|
|
550
|
+
},
|
|
551
|
+
create(base) {
|
|
552
|
+
return SubscribeEntriesRequest_TransactionsEntry.fromPartial(base ?? {});
|
|
553
|
+
},
|
|
554
|
+
fromPartial(object) {
|
|
555
|
+
const message = createBaseSubscribeEntriesRequest_TransactionsEntry();
|
|
556
|
+
message.key = object.key ?? "";
|
|
557
|
+
message.value = object.value !== void 0 && object.value !== null ? SubscribeRequestFilterTransactions.fromPartial(object.value) : void 0;
|
|
558
|
+
return message;
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
function createBaseSubscribeEntriesRequest_SlotsEntry() {
|
|
562
|
+
return { key: "", value: void 0 };
|
|
563
|
+
}
|
|
564
|
+
var SubscribeEntriesRequest_SlotsEntry = {
|
|
565
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
566
|
+
if (message.key !== "") {
|
|
567
|
+
writer.uint32(10).string(message.key);
|
|
568
|
+
}
|
|
569
|
+
if (message.value !== void 0) {
|
|
570
|
+
SubscribeRequestFilterSlots.encode(message.value, writer.uint32(18).fork()).join();
|
|
571
|
+
}
|
|
572
|
+
return writer;
|
|
573
|
+
},
|
|
574
|
+
decode(input, length) {
|
|
575
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
576
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
577
|
+
const message = createBaseSubscribeEntriesRequest_SlotsEntry();
|
|
578
|
+
while (reader.pos < end) {
|
|
579
|
+
const tag = reader.uint32();
|
|
580
|
+
switch (tag >>> 3) {
|
|
581
|
+
case 1: {
|
|
582
|
+
if (tag !== 10) {
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
message.key = reader.string();
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
case 2: {
|
|
589
|
+
if (tag !== 18) {
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
message.value = SubscribeRequestFilterSlots.decode(reader, reader.uint32());
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
reader.skip(tag & 7);
|
|
600
|
+
}
|
|
601
|
+
return message;
|
|
602
|
+
},
|
|
603
|
+
fromJSON(object) {
|
|
604
|
+
return {
|
|
605
|
+
key: isSet2(object.key) ? globalThis.String(object.key) : "",
|
|
606
|
+
value: isSet2(object.value) ? SubscribeRequestFilterSlots.fromJSON(object.value) : void 0
|
|
607
|
+
};
|
|
608
|
+
},
|
|
609
|
+
toJSON(message) {
|
|
610
|
+
const obj = {};
|
|
611
|
+
if (message.key !== "") {
|
|
612
|
+
obj.key = message.key;
|
|
613
|
+
}
|
|
614
|
+
if (message.value !== void 0) {
|
|
615
|
+
obj.value = SubscribeRequestFilterSlots.toJSON(message.value);
|
|
616
|
+
}
|
|
617
|
+
return obj;
|
|
618
|
+
},
|
|
619
|
+
create(base) {
|
|
620
|
+
return SubscribeEntriesRequest_SlotsEntry.fromPartial(base ?? {});
|
|
621
|
+
},
|
|
622
|
+
fromPartial(object) {
|
|
623
|
+
const message = createBaseSubscribeEntriesRequest_SlotsEntry();
|
|
624
|
+
message.key = object.key ?? "";
|
|
625
|
+
message.value = object.value !== void 0 && object.value !== null ? SubscribeRequestFilterSlots.fromPartial(object.value) : void 0;
|
|
626
|
+
return message;
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
function createBaseSubscribeRequestFilterAccounts() {
|
|
630
|
+
return { account: [], owner: [], filters: [], nonemptyTxnSignature: void 0 };
|
|
631
|
+
}
|
|
632
|
+
var SubscribeRequestFilterAccounts = {
|
|
633
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
634
|
+
for (const v of message.account) {
|
|
635
|
+
writer.uint32(18).string(v);
|
|
636
|
+
}
|
|
637
|
+
for (const v of message.owner) {
|
|
638
|
+
writer.uint32(26).string(v);
|
|
639
|
+
}
|
|
640
|
+
for (const v of message.filters) {
|
|
641
|
+
SubscribeRequestFilterAccountsFilter.encode(v, writer.uint32(34).fork()).join();
|
|
642
|
+
}
|
|
643
|
+
if (message.nonemptyTxnSignature !== void 0) {
|
|
644
|
+
writer.uint32(40).bool(message.nonemptyTxnSignature);
|
|
645
|
+
}
|
|
646
|
+
return writer;
|
|
647
|
+
},
|
|
648
|
+
decode(input, length) {
|
|
649
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
650
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
651
|
+
const message = createBaseSubscribeRequestFilterAccounts();
|
|
652
|
+
while (reader.pos < end) {
|
|
653
|
+
const tag = reader.uint32();
|
|
654
|
+
switch (tag >>> 3) {
|
|
655
|
+
case 2: {
|
|
656
|
+
if (tag !== 18) {
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
message.account.push(reader.string());
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
case 3: {
|
|
663
|
+
if (tag !== 26) {
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
666
|
+
message.owner.push(reader.string());
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
669
|
+
case 4: {
|
|
670
|
+
if (tag !== 34) {
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
message.filters.push(SubscribeRequestFilterAccountsFilter.decode(reader, reader.uint32()));
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
case 5: {
|
|
677
|
+
if (tag !== 40) {
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
message.nonemptyTxnSignature = reader.bool();
|
|
681
|
+
continue;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
reader.skip(tag & 7);
|
|
688
|
+
}
|
|
689
|
+
return message;
|
|
690
|
+
},
|
|
691
|
+
fromJSON(object) {
|
|
692
|
+
return {
|
|
693
|
+
account: globalThis.Array.isArray(object?.account) ? object.account.map((e) => globalThis.String(e)) : [],
|
|
694
|
+
owner: globalThis.Array.isArray(object?.owner) ? object.owner.map((e) => globalThis.String(e)) : [],
|
|
695
|
+
filters: globalThis.Array.isArray(object?.filters) ? object.filters.map((e) => SubscribeRequestFilterAccountsFilter.fromJSON(e)) : [],
|
|
696
|
+
nonemptyTxnSignature: isSet2(object.nonemptyTxnSignature) ? globalThis.Boolean(object.nonemptyTxnSignature) : void 0
|
|
697
|
+
};
|
|
698
|
+
},
|
|
699
|
+
toJSON(message) {
|
|
700
|
+
const obj = {};
|
|
701
|
+
if (message.account?.length) {
|
|
702
|
+
obj.account = message.account;
|
|
703
|
+
}
|
|
704
|
+
if (message.owner?.length) {
|
|
705
|
+
obj.owner = message.owner;
|
|
706
|
+
}
|
|
707
|
+
if (message.filters?.length) {
|
|
708
|
+
obj.filters = message.filters.map((e) => SubscribeRequestFilterAccountsFilter.toJSON(e));
|
|
709
|
+
}
|
|
710
|
+
if (message.nonemptyTxnSignature !== void 0) {
|
|
711
|
+
obj.nonemptyTxnSignature = message.nonemptyTxnSignature;
|
|
712
|
+
}
|
|
713
|
+
return obj;
|
|
714
|
+
},
|
|
715
|
+
create(base) {
|
|
716
|
+
return SubscribeRequestFilterAccounts.fromPartial(base ?? {});
|
|
717
|
+
},
|
|
718
|
+
fromPartial(object) {
|
|
719
|
+
const message = createBaseSubscribeRequestFilterAccounts();
|
|
720
|
+
message.account = object.account?.map((e) => e) || [];
|
|
721
|
+
message.owner = object.owner?.map((e) => e) || [];
|
|
722
|
+
message.filters = object.filters?.map((e) => SubscribeRequestFilterAccountsFilter.fromPartial(e)) || [];
|
|
723
|
+
message.nonemptyTxnSignature = object.nonemptyTxnSignature ?? void 0;
|
|
724
|
+
return message;
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
function createBaseSubscribeRequestFilterAccountsFilter() {
|
|
728
|
+
return { memcmp: void 0, datasize: void 0, tokenAccountState: void 0, lamports: void 0 };
|
|
729
|
+
}
|
|
730
|
+
var SubscribeRequestFilterAccountsFilter = {
|
|
731
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
732
|
+
if (message.memcmp !== void 0) {
|
|
733
|
+
SubscribeRequestFilterAccountsFilterMemcmp.encode(message.memcmp, writer.uint32(10).fork()).join();
|
|
734
|
+
}
|
|
735
|
+
if (message.datasize !== void 0) {
|
|
736
|
+
writer.uint32(16).uint64(message.datasize);
|
|
737
|
+
}
|
|
738
|
+
if (message.tokenAccountState !== void 0) {
|
|
739
|
+
writer.uint32(24).bool(message.tokenAccountState);
|
|
740
|
+
}
|
|
741
|
+
if (message.lamports !== void 0) {
|
|
742
|
+
SubscribeRequestFilterAccountsFilterLamports.encode(message.lamports, writer.uint32(34).fork()).join();
|
|
743
|
+
}
|
|
744
|
+
return writer;
|
|
745
|
+
},
|
|
746
|
+
decode(input, length) {
|
|
747
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
748
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
749
|
+
const message = createBaseSubscribeRequestFilterAccountsFilter();
|
|
750
|
+
while (reader.pos < end) {
|
|
751
|
+
const tag = reader.uint32();
|
|
752
|
+
switch (tag >>> 3) {
|
|
753
|
+
case 1: {
|
|
754
|
+
if (tag !== 10) {
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
message.memcmp = SubscribeRequestFilterAccountsFilterMemcmp.decode(reader, reader.uint32());
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
case 2: {
|
|
761
|
+
if (tag !== 16) {
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
message.datasize = longToNumber2(reader.uint64());
|
|
765
|
+
continue;
|
|
766
|
+
}
|
|
767
|
+
case 3: {
|
|
768
|
+
if (tag !== 24) {
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
771
|
+
message.tokenAccountState = reader.bool();
|
|
772
|
+
continue;
|
|
773
|
+
}
|
|
774
|
+
case 4: {
|
|
775
|
+
if (tag !== 34) {
|
|
776
|
+
break;
|
|
777
|
+
}
|
|
778
|
+
message.lamports = SubscribeRequestFilterAccountsFilterLamports.decode(reader, reader.uint32());
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
783
|
+
break;
|
|
784
|
+
}
|
|
785
|
+
reader.skip(tag & 7);
|
|
786
|
+
}
|
|
787
|
+
return message;
|
|
788
|
+
},
|
|
789
|
+
fromJSON(object) {
|
|
790
|
+
return {
|
|
791
|
+
memcmp: isSet2(object.memcmp) ? SubscribeRequestFilterAccountsFilterMemcmp.fromJSON(object.memcmp) : void 0,
|
|
792
|
+
datasize: isSet2(object.datasize) ? globalThis.Number(object.datasize) : void 0,
|
|
793
|
+
tokenAccountState: isSet2(object.tokenAccountState) ? globalThis.Boolean(object.tokenAccountState) : void 0,
|
|
794
|
+
lamports: isSet2(object.lamports) ? SubscribeRequestFilterAccountsFilterLamports.fromJSON(object.lamports) : void 0
|
|
795
|
+
};
|
|
796
|
+
},
|
|
797
|
+
toJSON(message) {
|
|
798
|
+
const obj = {};
|
|
799
|
+
if (message.memcmp !== void 0) {
|
|
800
|
+
obj.memcmp = SubscribeRequestFilterAccountsFilterMemcmp.toJSON(message.memcmp);
|
|
801
|
+
}
|
|
802
|
+
if (message.datasize !== void 0) {
|
|
803
|
+
obj.datasize = Math.round(message.datasize);
|
|
804
|
+
}
|
|
805
|
+
if (message.tokenAccountState !== void 0) {
|
|
806
|
+
obj.tokenAccountState = message.tokenAccountState;
|
|
807
|
+
}
|
|
808
|
+
if (message.lamports !== void 0) {
|
|
809
|
+
obj.lamports = SubscribeRequestFilterAccountsFilterLamports.toJSON(message.lamports);
|
|
810
|
+
}
|
|
811
|
+
return obj;
|
|
812
|
+
},
|
|
813
|
+
create(base) {
|
|
814
|
+
return SubscribeRequestFilterAccountsFilter.fromPartial(base ?? {});
|
|
815
|
+
},
|
|
816
|
+
fromPartial(object) {
|
|
817
|
+
const message = createBaseSubscribeRequestFilterAccountsFilter();
|
|
818
|
+
message.memcmp = object.memcmp !== void 0 && object.memcmp !== null ? SubscribeRequestFilterAccountsFilterMemcmp.fromPartial(object.memcmp) : void 0;
|
|
819
|
+
message.datasize = object.datasize ?? void 0;
|
|
820
|
+
message.tokenAccountState = object.tokenAccountState ?? void 0;
|
|
821
|
+
message.lamports = object.lamports !== void 0 && object.lamports !== null ? SubscribeRequestFilterAccountsFilterLamports.fromPartial(object.lamports) : void 0;
|
|
822
|
+
return message;
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
function createBaseSubscribeRequestFilterAccountsFilterMemcmp() {
|
|
826
|
+
return { offset: 0, bytes: void 0, base58: void 0, base64: void 0 };
|
|
827
|
+
}
|
|
828
|
+
var SubscribeRequestFilterAccountsFilterMemcmp = {
|
|
829
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
830
|
+
if (message.offset !== 0) {
|
|
831
|
+
writer.uint32(8).uint64(message.offset);
|
|
832
|
+
}
|
|
833
|
+
if (message.bytes !== void 0) {
|
|
834
|
+
writer.uint32(18).bytes(message.bytes);
|
|
835
|
+
}
|
|
836
|
+
if (message.base58 !== void 0) {
|
|
837
|
+
writer.uint32(26).string(message.base58);
|
|
838
|
+
}
|
|
839
|
+
if (message.base64 !== void 0) {
|
|
840
|
+
writer.uint32(34).string(message.base64);
|
|
841
|
+
}
|
|
842
|
+
return writer;
|
|
843
|
+
},
|
|
844
|
+
decode(input, length) {
|
|
845
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
846
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
847
|
+
const message = createBaseSubscribeRequestFilterAccountsFilterMemcmp();
|
|
848
|
+
while (reader.pos < end) {
|
|
849
|
+
const tag = reader.uint32();
|
|
850
|
+
switch (tag >>> 3) {
|
|
851
|
+
case 1: {
|
|
852
|
+
if (tag !== 8) {
|
|
853
|
+
break;
|
|
854
|
+
}
|
|
855
|
+
message.offset = longToNumber2(reader.uint64());
|
|
856
|
+
continue;
|
|
857
|
+
}
|
|
858
|
+
case 2: {
|
|
859
|
+
if (tag !== 18) {
|
|
860
|
+
break;
|
|
861
|
+
}
|
|
862
|
+
message.bytes = reader.bytes();
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
865
|
+
case 3: {
|
|
866
|
+
if (tag !== 26) {
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
message.base58 = reader.string();
|
|
870
|
+
continue;
|
|
871
|
+
}
|
|
872
|
+
case 4: {
|
|
873
|
+
if (tag !== 34) {
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
message.base64 = reader.string();
|
|
877
|
+
continue;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
881
|
+
break;
|
|
882
|
+
}
|
|
883
|
+
reader.skip(tag & 7);
|
|
884
|
+
}
|
|
885
|
+
return message;
|
|
886
|
+
},
|
|
887
|
+
fromJSON(object) {
|
|
888
|
+
return {
|
|
889
|
+
offset: isSet2(object.offset) ? globalThis.Number(object.offset) : 0,
|
|
890
|
+
bytes: isSet2(object.bytes) ? bytesFromBase64(object.bytes) : void 0,
|
|
891
|
+
base58: isSet2(object.base58) ? globalThis.String(object.base58) : void 0,
|
|
892
|
+
base64: isSet2(object.base64) ? globalThis.String(object.base64) : void 0
|
|
893
|
+
};
|
|
894
|
+
},
|
|
895
|
+
toJSON(message) {
|
|
896
|
+
const obj = {};
|
|
897
|
+
if (message.offset !== 0) {
|
|
898
|
+
obj.offset = Math.round(message.offset);
|
|
899
|
+
}
|
|
900
|
+
if (message.bytes !== void 0) {
|
|
901
|
+
obj.bytes = base64FromBytes(message.bytes);
|
|
902
|
+
}
|
|
903
|
+
if (message.base58 !== void 0) {
|
|
904
|
+
obj.base58 = message.base58;
|
|
905
|
+
}
|
|
906
|
+
if (message.base64 !== void 0) {
|
|
907
|
+
obj.base64 = message.base64;
|
|
908
|
+
}
|
|
909
|
+
return obj;
|
|
910
|
+
},
|
|
911
|
+
create(base) {
|
|
912
|
+
return SubscribeRequestFilterAccountsFilterMemcmp.fromPartial(base ?? {});
|
|
913
|
+
},
|
|
914
|
+
fromPartial(object) {
|
|
915
|
+
const message = createBaseSubscribeRequestFilterAccountsFilterMemcmp();
|
|
916
|
+
message.offset = object.offset ?? 0;
|
|
917
|
+
message.bytes = object.bytes ?? void 0;
|
|
918
|
+
message.base58 = object.base58 ?? void 0;
|
|
919
|
+
message.base64 = object.base64 ?? void 0;
|
|
920
|
+
return message;
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
function createBaseSubscribeRequestFilterAccountsFilterLamports() {
|
|
924
|
+
return { eq: void 0, ne: void 0, lt: void 0, gt: void 0 };
|
|
925
|
+
}
|
|
926
|
+
var SubscribeRequestFilterAccountsFilterLamports = {
|
|
927
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
928
|
+
if (message.eq !== void 0) {
|
|
929
|
+
writer.uint32(8).uint64(message.eq);
|
|
930
|
+
}
|
|
931
|
+
if (message.ne !== void 0) {
|
|
932
|
+
writer.uint32(16).uint64(message.ne);
|
|
933
|
+
}
|
|
934
|
+
if (message.lt !== void 0) {
|
|
935
|
+
writer.uint32(24).uint64(message.lt);
|
|
936
|
+
}
|
|
937
|
+
if (message.gt !== void 0) {
|
|
938
|
+
writer.uint32(32).uint64(message.gt);
|
|
939
|
+
}
|
|
940
|
+
return writer;
|
|
941
|
+
},
|
|
942
|
+
decode(input, length) {
|
|
943
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
944
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
945
|
+
const message = createBaseSubscribeRequestFilterAccountsFilterLamports();
|
|
946
|
+
while (reader.pos < end) {
|
|
947
|
+
const tag = reader.uint32();
|
|
948
|
+
switch (tag >>> 3) {
|
|
949
|
+
case 1: {
|
|
950
|
+
if (tag !== 8) {
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
message.eq = longToNumber2(reader.uint64());
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
case 2: {
|
|
957
|
+
if (tag !== 16) {
|
|
958
|
+
break;
|
|
959
|
+
}
|
|
960
|
+
message.ne = longToNumber2(reader.uint64());
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
963
|
+
case 3: {
|
|
964
|
+
if (tag !== 24) {
|
|
965
|
+
break;
|
|
966
|
+
}
|
|
967
|
+
message.lt = longToNumber2(reader.uint64());
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
970
|
+
case 4: {
|
|
971
|
+
if (tag !== 32) {
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
message.gt = longToNumber2(reader.uint64());
|
|
975
|
+
continue;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
reader.skip(tag & 7);
|
|
982
|
+
}
|
|
983
|
+
return message;
|
|
984
|
+
},
|
|
985
|
+
fromJSON(object) {
|
|
986
|
+
return {
|
|
987
|
+
eq: isSet2(object.eq) ? globalThis.Number(object.eq) : void 0,
|
|
988
|
+
ne: isSet2(object.ne) ? globalThis.Number(object.ne) : void 0,
|
|
989
|
+
lt: isSet2(object.lt) ? globalThis.Number(object.lt) : void 0,
|
|
990
|
+
gt: isSet2(object.gt) ? globalThis.Number(object.gt) : void 0
|
|
991
|
+
};
|
|
992
|
+
},
|
|
993
|
+
toJSON(message) {
|
|
994
|
+
const obj = {};
|
|
995
|
+
if (message.eq !== void 0) {
|
|
996
|
+
obj.eq = Math.round(message.eq);
|
|
997
|
+
}
|
|
998
|
+
if (message.ne !== void 0) {
|
|
999
|
+
obj.ne = Math.round(message.ne);
|
|
1000
|
+
}
|
|
1001
|
+
if (message.lt !== void 0) {
|
|
1002
|
+
obj.lt = Math.round(message.lt);
|
|
1003
|
+
}
|
|
1004
|
+
if (message.gt !== void 0) {
|
|
1005
|
+
obj.gt = Math.round(message.gt);
|
|
1006
|
+
}
|
|
1007
|
+
return obj;
|
|
1008
|
+
},
|
|
1009
|
+
create(base) {
|
|
1010
|
+
return SubscribeRequestFilterAccountsFilterLamports.fromPartial(base ?? {});
|
|
1011
|
+
},
|
|
1012
|
+
fromPartial(object) {
|
|
1013
|
+
const message = createBaseSubscribeRequestFilterAccountsFilterLamports();
|
|
1014
|
+
message.eq = object.eq ?? void 0;
|
|
1015
|
+
message.ne = object.ne ?? void 0;
|
|
1016
|
+
message.lt = object.lt ?? void 0;
|
|
1017
|
+
message.gt = object.gt ?? void 0;
|
|
1018
|
+
return message;
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
function createBaseSubscribeRequestFilterSlots() {
|
|
1022
|
+
return { filterByCommitment: void 0, interslotUpdates: void 0 };
|
|
1023
|
+
}
|
|
1024
|
+
var SubscribeRequestFilterSlots = {
|
|
1025
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
1026
|
+
if (message.filterByCommitment !== void 0) {
|
|
1027
|
+
writer.uint32(8).bool(message.filterByCommitment);
|
|
1028
|
+
}
|
|
1029
|
+
if (message.interslotUpdates !== void 0) {
|
|
1030
|
+
writer.uint32(16).bool(message.interslotUpdates);
|
|
1031
|
+
}
|
|
1032
|
+
return writer;
|
|
1033
|
+
},
|
|
1034
|
+
decode(input, length) {
|
|
1035
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
1036
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
1037
|
+
const message = createBaseSubscribeRequestFilterSlots();
|
|
1038
|
+
while (reader.pos < end) {
|
|
1039
|
+
const tag = reader.uint32();
|
|
1040
|
+
switch (tag >>> 3) {
|
|
1041
|
+
case 1: {
|
|
1042
|
+
if (tag !== 8) {
|
|
1043
|
+
break;
|
|
1044
|
+
}
|
|
1045
|
+
message.filterByCommitment = reader.bool();
|
|
1046
|
+
continue;
|
|
1047
|
+
}
|
|
1048
|
+
case 2: {
|
|
1049
|
+
if (tag !== 16) {
|
|
1050
|
+
break;
|
|
1051
|
+
}
|
|
1052
|
+
message.interslotUpdates = reader.bool();
|
|
1053
|
+
continue;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1057
|
+
break;
|
|
1058
|
+
}
|
|
1059
|
+
reader.skip(tag & 7);
|
|
1060
|
+
}
|
|
1061
|
+
return message;
|
|
1062
|
+
},
|
|
1063
|
+
fromJSON(object) {
|
|
1064
|
+
return {
|
|
1065
|
+
filterByCommitment: isSet2(object.filterByCommitment) ? globalThis.Boolean(object.filterByCommitment) : void 0,
|
|
1066
|
+
interslotUpdates: isSet2(object.interslotUpdates) ? globalThis.Boolean(object.interslotUpdates) : void 0
|
|
1067
|
+
};
|
|
1068
|
+
},
|
|
1069
|
+
toJSON(message) {
|
|
1070
|
+
const obj = {};
|
|
1071
|
+
if (message.filterByCommitment !== void 0) {
|
|
1072
|
+
obj.filterByCommitment = message.filterByCommitment;
|
|
1073
|
+
}
|
|
1074
|
+
if (message.interslotUpdates !== void 0) {
|
|
1075
|
+
obj.interslotUpdates = message.interslotUpdates;
|
|
1076
|
+
}
|
|
1077
|
+
return obj;
|
|
1078
|
+
},
|
|
1079
|
+
create(base) {
|
|
1080
|
+
return SubscribeRequestFilterSlots.fromPartial(base ?? {});
|
|
1081
|
+
},
|
|
1082
|
+
fromPartial(object) {
|
|
1083
|
+
const message = createBaseSubscribeRequestFilterSlots();
|
|
1084
|
+
message.filterByCommitment = object.filterByCommitment ?? void 0;
|
|
1085
|
+
message.interslotUpdates = object.interslotUpdates ?? void 0;
|
|
1086
|
+
return message;
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
function createBaseSubscribeRequestFilterTransactions() {
|
|
1090
|
+
return { accountInclude: [], accountExclude: [], accountRequired: [] };
|
|
1091
|
+
}
|
|
1092
|
+
var SubscribeRequestFilterTransactions = {
|
|
1093
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
1094
|
+
for (const v of message.accountInclude) {
|
|
1095
|
+
writer.uint32(26).string(v);
|
|
1096
|
+
}
|
|
1097
|
+
for (const v of message.accountExclude) {
|
|
1098
|
+
writer.uint32(34).string(v);
|
|
1099
|
+
}
|
|
1100
|
+
for (const v of message.accountRequired) {
|
|
1101
|
+
writer.uint32(50).string(v);
|
|
1102
|
+
}
|
|
1103
|
+
return writer;
|
|
1104
|
+
},
|
|
1105
|
+
decode(input, length) {
|
|
1106
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
1107
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
1108
|
+
const message = createBaseSubscribeRequestFilterTransactions();
|
|
1109
|
+
while (reader.pos < end) {
|
|
1110
|
+
const tag = reader.uint32();
|
|
1111
|
+
switch (tag >>> 3) {
|
|
1112
|
+
case 3: {
|
|
1113
|
+
if (tag !== 26) {
|
|
1114
|
+
break;
|
|
1115
|
+
}
|
|
1116
|
+
message.accountInclude.push(reader.string());
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
case 4: {
|
|
1120
|
+
if (tag !== 34) {
|
|
1121
|
+
break;
|
|
1122
|
+
}
|
|
1123
|
+
message.accountExclude.push(reader.string());
|
|
1124
|
+
continue;
|
|
1125
|
+
}
|
|
1126
|
+
case 6: {
|
|
1127
|
+
if (tag !== 50) {
|
|
1128
|
+
break;
|
|
1129
|
+
}
|
|
1130
|
+
message.accountRequired.push(reader.string());
|
|
1131
|
+
continue;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1135
|
+
break;
|
|
1136
|
+
}
|
|
1137
|
+
reader.skip(tag & 7);
|
|
1138
|
+
}
|
|
1139
|
+
return message;
|
|
1140
|
+
},
|
|
1141
|
+
fromJSON(object) {
|
|
1142
|
+
return {
|
|
1143
|
+
accountInclude: globalThis.Array.isArray(object?.accountInclude) ? object.accountInclude.map((e) => globalThis.String(e)) : [],
|
|
1144
|
+
accountExclude: globalThis.Array.isArray(object?.accountExclude) ? object.accountExclude.map((e) => globalThis.String(e)) : [],
|
|
1145
|
+
accountRequired: globalThis.Array.isArray(object?.accountRequired) ? object.accountRequired.map((e) => globalThis.String(e)) : []
|
|
1146
|
+
};
|
|
1147
|
+
},
|
|
1148
|
+
toJSON(message) {
|
|
1149
|
+
const obj = {};
|
|
1150
|
+
if (message.accountInclude?.length) {
|
|
1151
|
+
obj.accountInclude = message.accountInclude;
|
|
1152
|
+
}
|
|
1153
|
+
if (message.accountExclude?.length) {
|
|
1154
|
+
obj.accountExclude = message.accountExclude;
|
|
1155
|
+
}
|
|
1156
|
+
if (message.accountRequired?.length) {
|
|
1157
|
+
obj.accountRequired = message.accountRequired;
|
|
1158
|
+
}
|
|
1159
|
+
return obj;
|
|
1160
|
+
},
|
|
1161
|
+
create(base) {
|
|
1162
|
+
return SubscribeRequestFilterTransactions.fromPartial(base ?? {});
|
|
1163
|
+
},
|
|
1164
|
+
fromPartial(object) {
|
|
1165
|
+
const message = createBaseSubscribeRequestFilterTransactions();
|
|
1166
|
+
message.accountInclude = object.accountInclude?.map((e) => e) || [];
|
|
1167
|
+
message.accountExclude = object.accountExclude?.map((e) => e) || [];
|
|
1168
|
+
message.accountRequired = object.accountRequired?.map((e) => e) || [];
|
|
1169
|
+
return message;
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
function createBaseEntry() {
|
|
1173
|
+
return { slot: 0, entries: new Uint8Array(0) };
|
|
1174
|
+
}
|
|
1175
|
+
var Entry = {
|
|
1176
|
+
encode(message, writer = new BinaryWriter3()) {
|
|
1177
|
+
if (message.slot !== 0) {
|
|
1178
|
+
writer.uint32(8).uint64(message.slot);
|
|
1179
|
+
}
|
|
1180
|
+
if (message.entries.length !== 0) {
|
|
1181
|
+
writer.uint32(18).bytes(message.entries);
|
|
1182
|
+
}
|
|
1183
|
+
return writer;
|
|
1184
|
+
},
|
|
1185
|
+
decode(input, length) {
|
|
1186
|
+
const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
|
|
1187
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
1188
|
+
const message = createBaseEntry();
|
|
1189
|
+
while (reader.pos < end) {
|
|
1190
|
+
const tag = reader.uint32();
|
|
1191
|
+
switch (tag >>> 3) {
|
|
1192
|
+
case 1: {
|
|
1193
|
+
if (tag !== 8) {
|
|
1194
|
+
break;
|
|
1195
|
+
}
|
|
1196
|
+
message.slot = longToNumber2(reader.uint64());
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
case 2: {
|
|
1200
|
+
if (tag !== 18) {
|
|
1201
|
+
break;
|
|
1202
|
+
}
|
|
1203
|
+
message.entries = reader.bytes();
|
|
1204
|
+
continue;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
reader.skip(tag & 7);
|
|
1211
|
+
}
|
|
1212
|
+
return message;
|
|
1213
|
+
},
|
|
1214
|
+
fromJSON(object) {
|
|
1215
|
+
return {
|
|
1216
|
+
slot: isSet2(object.slot) ? globalThis.Number(object.slot) : 0,
|
|
1217
|
+
entries: isSet2(object.entries) ? bytesFromBase64(object.entries) : new Uint8Array(0)
|
|
1218
|
+
};
|
|
1219
|
+
},
|
|
1220
|
+
toJSON(message) {
|
|
1221
|
+
const obj = {};
|
|
1222
|
+
if (message.slot !== 0) {
|
|
1223
|
+
obj.slot = Math.round(message.slot);
|
|
1224
|
+
}
|
|
1225
|
+
if (message.entries.length !== 0) {
|
|
1226
|
+
obj.entries = base64FromBytes(message.entries);
|
|
1227
|
+
}
|
|
1228
|
+
return obj;
|
|
1229
|
+
},
|
|
1230
|
+
create(base) {
|
|
1231
|
+
return Entry.fromPartial(base ?? {});
|
|
1232
|
+
},
|
|
1233
|
+
fromPartial(object) {
|
|
1234
|
+
const message = createBaseEntry();
|
|
1235
|
+
message.slot = object.slot ?? 0;
|
|
1236
|
+
message.entries = object.entries ?? new Uint8Array(0);
|
|
1237
|
+
return message;
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
var ShredstreamService = {
|
|
1241
|
+
/** RPC endpoint to send heartbeats to keep shreds flowing */
|
|
1242
|
+
sendHeartbeat: {
|
|
1243
|
+
path: "/shredstream.Shredstream/SendHeartbeat",
|
|
1244
|
+
requestStream: false,
|
|
1245
|
+
responseStream: false,
|
|
1246
|
+
requestSerialize: (value) => Buffer.from(Heartbeat.encode(value).finish()),
|
|
1247
|
+
requestDeserialize: (value) => Heartbeat.decode(value),
|
|
1248
|
+
responseSerialize: (value) => Buffer.from(HeartbeatResponse.encode(value).finish()),
|
|
1249
|
+
responseDeserialize: (value) => HeartbeatResponse.decode(value)
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
var ShredstreamClient = makeGenericClientConstructor(
|
|
1253
|
+
ShredstreamService,
|
|
1254
|
+
"shredstream.Shredstream"
|
|
1255
|
+
);
|
|
1256
|
+
var ShredstreamProxyService = {
|
|
1257
|
+
subscribeEntries: {
|
|
1258
|
+
path: "/shredstream.ShredstreamProxy/SubscribeEntries",
|
|
1259
|
+
requestStream: false,
|
|
1260
|
+
responseStream: true,
|
|
1261
|
+
requestSerialize: (value) => Buffer.from(SubscribeEntriesRequest.encode(value).finish()),
|
|
1262
|
+
requestDeserialize: (value) => SubscribeEntriesRequest.decode(value),
|
|
1263
|
+
responseSerialize: (value) => Buffer.from(Entry.encode(value).finish()),
|
|
1264
|
+
responseDeserialize: (value) => Entry.decode(value)
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
var ShredstreamProxyClient = makeGenericClientConstructor(
|
|
1268
|
+
ShredstreamProxyService,
|
|
1269
|
+
"shredstream.ShredstreamProxy"
|
|
1270
|
+
);
|
|
1271
|
+
function bytesFromBase64(b64) {
|
|
1272
|
+
if (globalThis.Buffer) {
|
|
1273
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
1274
|
+
} else {
|
|
1275
|
+
const bin = globalThis.atob(b64);
|
|
1276
|
+
const arr = new Uint8Array(bin.length);
|
|
1277
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
1278
|
+
arr[i] = bin.charCodeAt(i);
|
|
1279
|
+
}
|
|
1280
|
+
return arr;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
function base64FromBytes(arr) {
|
|
1284
|
+
if (globalThis.Buffer) {
|
|
1285
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
1286
|
+
} else {
|
|
1287
|
+
const bin = [];
|
|
1288
|
+
arr.forEach((byte) => {
|
|
1289
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
1290
|
+
});
|
|
1291
|
+
return globalThis.btoa(bin.join(""));
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
function longToNumber2(int64) {
|
|
1295
|
+
const num = globalThis.Number(int64.toString());
|
|
1296
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
1297
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
1298
|
+
}
|
|
1299
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
1300
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
1301
|
+
}
|
|
1302
|
+
return num;
|
|
1303
|
+
}
|
|
1304
|
+
function isObject(value) {
|
|
1305
|
+
return typeof value === "object" && value !== null;
|
|
1306
|
+
}
|
|
1307
|
+
function isSet2(value) {
|
|
1308
|
+
return value !== null && value !== void 0;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// src/index.ts
|
|
1312
|
+
import { credentials, Metadata as Metadata2 } from "@grpc/grpc-js";
|
|
1313
|
+
import { createRequire } from "module";
|
|
1314
|
+
var require2 = createRequire(import.meta.url);
|
|
1315
|
+
var { decodeSolanaEntries } = require2("@validators-dao/solana-entry-decoder");
|
|
1316
|
+
export {
|
|
1317
|
+
CommitmentLevel2 as CommitmentLevel,
|
|
1318
|
+
Client2 as GeyserClient,
|
|
1319
|
+
Metadata2 as Metadata,
|
|
1320
|
+
CommitmentLevel as ShredsCommitmentLevel,
|
|
1321
|
+
Entry as ShredsEntryFns,
|
|
1322
|
+
SubscribeEntriesRequest as ShredsSubscribeEntriesRequestFns,
|
|
1323
|
+
ShredstreamClient,
|
|
1324
|
+
ShredstreamProxyClient,
|
|
1325
|
+
SubscribeRequestAccountsDataSlice,
|
|
1326
|
+
SubscribeRequestFilterAccounts2 as SubscribeRequestFilterAccounts,
|
|
1327
|
+
SubscribeRequestFilterBlocks,
|
|
1328
|
+
SubscribeRequestFilterBlocksMeta,
|
|
1329
|
+
SubscribeRequestFilterEntry,
|
|
1330
|
+
SubscribeRequestFilterSlots2 as SubscribeRequestFilterSlots,
|
|
1331
|
+
SubscribeRequestFilterTransactions2 as SubscribeRequestFilterTransactions,
|
|
1332
|
+
bs58,
|
|
1333
|
+
credentials,
|
|
1334
|
+
decodeSolanaEntries
|
|
1335
|
+
};
|
|
4
1336
|
//# sourceMappingURL=index.js.map
|