@triton-one/yellowstone-grpc 1.3.1 → 1.4.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.
@@ -40,6 +40,7 @@ export interface SubscribeRequest {
40
40
  commitment?: CommitmentLevel | undefined;
41
41
  accountsDataSlice: SubscribeRequestAccountsDataSlice[];
42
42
  ping?: SubscribeRequestPing | undefined;
43
+ fromSlot?: string | undefined;
43
44
  }
44
45
  export interface SubscribeRequest_AccountsEntry {
45
46
  key: string;
@@ -132,6 +133,7 @@ export interface SubscribeUpdate {
132
133
  pong?: SubscribeUpdatePong | undefined;
133
134
  blockMeta?: SubscribeUpdateBlockMeta | undefined;
134
135
  entry?: SubscribeUpdateEntry | undefined;
136
+ createdAt: Date | undefined;
135
137
  }
136
138
  export interface SubscribeUpdateAccount {
137
139
  account: SubscribeUpdateAccountInfo | undefined;
@@ -327,6 +329,7 @@ export declare const SubscribeRequest: {
327
329
  ping?: {
328
330
  id?: number;
329
331
  };
332
+ fromSlot?: string | undefined;
330
333
  } & {
331
334
  accounts?: {
332
335
  [x: string]: {
@@ -560,6 +563,7 @@ export declare const SubscribeRequest: {
560
563
  } & {
561
564
  id?: number;
562
565
  } & { [K_29 in Exclude<keyof I["ping"], "id">]: never; };
566
+ fromSlot?: string | undefined;
563
567
  } & { [K_30 in Exclude<keyof I, keyof SubscribeRequest>]: never; }>(base?: I): SubscribeRequest;
564
568
  fromPartial<I_1 extends {
565
569
  accounts?: {
@@ -632,6 +636,7 @@ export declare const SubscribeRequest: {
632
636
  ping?: {
633
637
  id?: number;
634
638
  };
639
+ fromSlot?: string | undefined;
635
640
  } & {
636
641
  accounts?: {
637
642
  [x: string]: {
@@ -865,6 +870,7 @@ export declare const SubscribeRequest: {
865
870
  } & {
866
871
  id?: number;
867
872
  } & { [K_60 in Exclude<keyof I_1["ping"], "id">]: never; };
873
+ fromSlot?: string | undefined;
868
874
  } & { [K_61 in Exclude<keyof I_1, keyof SubscribeRequest>]: never; }>(object: I_1): SubscribeRequest;
869
875
  };
870
876
  export declare const SubscribeRequest_AccountsEntry: {
@@ -2133,6 +2139,7 @@ export declare const SubscribeUpdate: {
2133
2139
  executedTransactionCount?: string;
2134
2140
  startingTransactionIndex?: string;
2135
2141
  };
2142
+ createdAt?: Date | undefined;
2136
2143
  } & {
2137
2144
  filters?: string[] & string[] & { [K in Exclude<keyof I["filters"], keyof string[]>]: never; };
2138
2145
  account?: {
@@ -3707,6 +3714,7 @@ export declare const SubscribeUpdate: {
3707
3714
  executedTransactionCount?: string;
3708
3715
  startingTransactionIndex?: string;
3709
3716
  } & { [K_88 in Exclude<keyof I["entry"], keyof SubscribeUpdateEntry>]: never; };
3717
+ createdAt?: Date | undefined;
3710
3718
  } & { [K_89 in Exclude<keyof I, keyof SubscribeUpdate>]: never; }>(base?: I): SubscribeUpdate;
3711
3719
  fromPartial<I_1 extends {
3712
3720
  filters?: string[];
@@ -3999,6 +4007,7 @@ export declare const SubscribeUpdate: {
3999
4007
  executedTransactionCount?: string;
4000
4008
  startingTransactionIndex?: string;
4001
4009
  };
4010
+ createdAt?: Date | undefined;
4002
4011
  } & {
4003
4012
  filters?: string[] & string[] & { [K_90 in Exclude<keyof I_1["filters"], keyof string[]>]: never; };
4004
4013
  account?: {
@@ -5573,6 +5582,7 @@ export declare const SubscribeUpdate: {
5573
5582
  executedTransactionCount?: string;
5574
5583
  startingTransactionIndex?: string;
5575
5584
  } & { [K_178 in Exclude<keyof I_1["entry"], keyof SubscribeUpdateEntry>]: never; };
5585
+ createdAt?: Date | undefined;
5576
5586
  } & { [K_179 in Exclude<keyof I_1, keyof SubscribeUpdate>]: never; }>(object: I_1): SubscribeUpdate;
5577
5587
  };
5578
5588
  export declare const SubscribeUpdateAccount: {
@@ -5,6 +5,7 @@ exports.GeyserClient = exports.GeyserService = exports.IsBlockhashValidResponse
5
5
  var grpc_js_1 = require("@grpc/grpc-js");
6
6
  var Long = require("long");
7
7
  var _m0 = require("protobufjs/minimal");
8
+ var timestamp_1 = require("./google/protobuf/timestamp");
8
9
  var solana_storage_1 = require("./solana-storage");
9
10
  exports.protobufPackage = "geyser";
10
11
  var CommitmentLevel;
@@ -82,6 +83,7 @@ function createBaseSubscribeRequest() {
82
83
  commitment: undefined,
83
84
  accountsDataSlice: [],
84
85
  ping: undefined,
86
+ fromSlot: undefined,
85
87
  };
86
88
  }
87
89
  exports.SubscribeRequest = {
@@ -125,6 +127,9 @@ exports.SubscribeRequest = {
125
127
  if (message.ping !== undefined) {
126
128
  exports.SubscribeRequestPing.encode(message.ping, writer.uint32(74).fork()).ldelim();
127
129
  }
130
+ if (message.fromSlot !== undefined) {
131
+ writer.uint32(88).uint64(message.fromSlot);
132
+ }
128
133
  return writer;
129
134
  },
130
135
  decode: function (input, length) {
@@ -185,6 +190,9 @@ exports.SubscribeRequest = {
185
190
  case 9:
186
191
  message.ping = exports.SubscribeRequestPing.decode(reader, reader.uint32());
187
192
  break;
193
+ case 11:
194
+ message.fromSlot = longToString(reader.uint64());
195
+ break;
188
196
  default:
189
197
  reader.skipType(tag & 7);
190
198
  break;
@@ -248,6 +256,7 @@ exports.SubscribeRequest = {
248
256
  ? object.accountsDataSlice.map(function (e) { return exports.SubscribeRequestAccountsDataSlice.fromJSON(e); })
249
257
  : [],
250
258
  ping: isSet(object.ping) ? exports.SubscribeRequestPing.fromJSON(object.ping) : undefined,
259
+ fromSlot: isSet(object.fromSlot) ? String(object.fromSlot) : undefined,
251
260
  };
252
261
  },
253
262
  toJSON: function (message) {
@@ -312,13 +321,14 @@ exports.SubscribeRequest = {
312
321
  obj.accountsDataSlice = [];
313
322
  }
314
323
  message.ping !== undefined && (obj.ping = message.ping ? exports.SubscribeRequestPing.toJSON(message.ping) : undefined);
324
+ message.fromSlot !== undefined && (obj.fromSlot = message.fromSlot);
315
325
  return obj;
316
326
  },
317
327
  create: function (base) {
318
328
  return exports.SubscribeRequest.fromPartial(base !== null && base !== void 0 ? base : {});
319
329
  },
320
330
  fromPartial: function (object) {
321
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
331
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
322
332
  var message = createBaseSubscribeRequest();
323
333
  message.accounts = Object.entries((_a = object.accounts) !== null && _a !== void 0 ? _a : {}).reduce(function (acc, _a) {
324
334
  var key = _a[0], value = _a[1];
@@ -375,6 +385,7 @@ exports.SubscribeRequest = {
375
385
  message.ping = (object.ping !== undefined && object.ping !== null)
376
386
  ? exports.SubscribeRequestPing.fromPartial(object.ping)
377
387
  : undefined;
388
+ message.fromSlot = (_k = object.fromSlot) !== null && _k !== void 0 ? _k : undefined;
378
389
  return message;
379
390
  },
380
391
  };
@@ -1562,6 +1573,7 @@ function createBaseSubscribeUpdate() {
1562
1573
  pong: undefined,
1563
1574
  blockMeta: undefined,
1564
1575
  entry: undefined,
1576
+ createdAt: undefined,
1565
1577
  };
1566
1578
  }
1567
1579
  exports.SubscribeUpdate = {
@@ -1598,6 +1610,9 @@ exports.SubscribeUpdate = {
1598
1610
  if (message.entry !== undefined) {
1599
1611
  exports.SubscribeUpdateEntry.encode(message.entry, writer.uint32(66).fork()).ldelim();
1600
1612
  }
1613
+ if (message.createdAt !== undefined) {
1614
+ timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(90).fork()).ldelim();
1615
+ }
1601
1616
  return writer;
1602
1617
  },
1603
1618
  decode: function (input, length) {
@@ -1637,6 +1652,9 @@ exports.SubscribeUpdate = {
1637
1652
  case 8:
1638
1653
  message.entry = exports.SubscribeUpdateEntry.decode(reader, reader.uint32());
1639
1654
  break;
1655
+ case 11:
1656
+ message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
1657
+ break;
1640
1658
  default:
1641
1659
  reader.skipType(tag & 7);
1642
1660
  break;
@@ -1658,6 +1676,7 @@ exports.SubscribeUpdate = {
1658
1676
  pong: isSet(object.pong) ? exports.SubscribeUpdatePong.fromJSON(object.pong) : undefined,
1659
1677
  blockMeta: isSet(object.blockMeta) ? exports.SubscribeUpdateBlockMeta.fromJSON(object.blockMeta) : undefined,
1660
1678
  entry: isSet(object.entry) ? exports.SubscribeUpdateEntry.fromJSON(object.entry) : undefined,
1679
+ createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
1661
1680
  };
1662
1681
  },
1663
1682
  toJSON: function (message) {
@@ -1682,13 +1701,14 @@ exports.SubscribeUpdate = {
1682
1701
  message.blockMeta !== undefined &&
1683
1702
  (obj.blockMeta = message.blockMeta ? exports.SubscribeUpdateBlockMeta.toJSON(message.blockMeta) : undefined);
1684
1703
  message.entry !== undefined && (obj.entry = message.entry ? exports.SubscribeUpdateEntry.toJSON(message.entry) : undefined);
1704
+ message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString());
1685
1705
  return obj;
1686
1706
  },
1687
1707
  create: function (base) {
1688
1708
  return exports.SubscribeUpdate.fromPartial(base !== null && base !== void 0 ? base : {});
1689
1709
  },
1690
1710
  fromPartial: function (object) {
1691
- var _a;
1711
+ var _a, _b;
1692
1712
  var message = createBaseSubscribeUpdate();
1693
1713
  message.filters = ((_a = object.filters) === null || _a === void 0 ? void 0 : _a.map(function (e) { return e; })) || [];
1694
1714
  message.account = (object.account !== undefined && object.account !== null)
@@ -1718,6 +1738,7 @@ exports.SubscribeUpdate = {
1718
1738
  message.entry = (object.entry !== undefined && object.entry !== null)
1719
1739
  ? exports.SubscribeUpdateEntry.fromPartial(object.entry)
1720
1740
  : undefined;
1741
+ message.createdAt = (_b = object.createdAt) !== null && _b !== void 0 ? _b : undefined;
1721
1742
  return message;
1722
1743
  },
1723
1744
  };
@@ -3449,6 +3470,27 @@ function base64FromBytes(arr) {
3449
3470
  return tsProtoGlobalThis.btoa(bin_1.join(""));
3450
3471
  }
3451
3472
  }
3473
+ function toTimestamp(date) {
3474
+ var seconds = Math.trunc(date.getTime() / 1000).toString();
3475
+ var nanos = (date.getTime() % 1000) * 1000000;
3476
+ return { seconds: seconds, nanos: nanos };
3477
+ }
3478
+ function fromTimestamp(t) {
3479
+ var millis = Number(t.seconds) * 1000;
3480
+ millis += t.nanos / 1000000;
3481
+ return new Date(millis);
3482
+ }
3483
+ function fromJsonTimestamp(o) {
3484
+ if (o instanceof Date) {
3485
+ return o;
3486
+ }
3487
+ else if (typeof o === "string") {
3488
+ return new Date(o);
3489
+ }
3490
+ else {
3491
+ return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
3492
+ }
3493
+ }
3452
3494
  function longToString(long) {
3453
3495
  return long.toString();
3454
3496
  }
@@ -0,0 +1,139 @@
1
+ import * as _m0 from "protobufjs/minimal";
2
+ export declare const protobufPackage = "google.protobuf";
3
+ /**
4
+ * A Timestamp represents a point in time independent of any time zone or local
5
+ * calendar, encoded as a count of seconds and fractions of seconds at
6
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
7
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
8
+ * Gregorian calendar backwards to year one.
9
+ *
10
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
11
+ * second table is needed for interpretation, using a [24-hour linear
12
+ * smear](https://developers.google.com/time/smear).
13
+ *
14
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
15
+ * restricting to that range, we ensure that we can convert to and from [RFC
16
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
17
+ *
18
+ * # Examples
19
+ *
20
+ * Example 1: Compute Timestamp from POSIX `time()`.
21
+ *
22
+ * Timestamp timestamp;
23
+ * timestamp.set_seconds(time(NULL));
24
+ * timestamp.set_nanos(0);
25
+ *
26
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
27
+ *
28
+ * struct timeval tv;
29
+ * gettimeofday(&tv, NULL);
30
+ *
31
+ * Timestamp timestamp;
32
+ * timestamp.set_seconds(tv.tv_sec);
33
+ * timestamp.set_nanos(tv.tv_usec * 1000);
34
+ *
35
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
36
+ *
37
+ * FILETIME ft;
38
+ * GetSystemTimeAsFileTime(&ft);
39
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
40
+ *
41
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
42
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
43
+ * Timestamp timestamp;
44
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
45
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
46
+ *
47
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
48
+ *
49
+ * long millis = System.currentTimeMillis();
50
+ *
51
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
52
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
53
+ *
54
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
55
+ *
56
+ * Instant now = Instant.now();
57
+ *
58
+ * Timestamp timestamp =
59
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
60
+ * .setNanos(now.getNano()).build();
61
+ *
62
+ * Example 6: Compute Timestamp from current time in Python.
63
+ *
64
+ * timestamp = Timestamp()
65
+ * timestamp.GetCurrentTime()
66
+ *
67
+ * # JSON Mapping
68
+ *
69
+ * In JSON format, the Timestamp type is encoded as a string in the
70
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
71
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
72
+ * where {year} is always expressed using four digits while {month}, {day},
73
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
74
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
75
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
76
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
77
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
78
+ * able to accept both UTC and other timezones (as indicated by an offset).
79
+ *
80
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
81
+ * 01:30 UTC on January 15, 2017.
82
+ *
83
+ * In JavaScript, one can convert a Date object to this format using the
84
+ * standard
85
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
86
+ * method. In Python, a standard `datetime.datetime` object can be converted
87
+ * to this format using
88
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
89
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
90
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
91
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
92
+ * ) to obtain a formatter capable of generating timestamps in this format.
93
+ */
94
+ export interface Timestamp {
95
+ /**
96
+ * Represents seconds of UTC time since Unix epoch
97
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
98
+ * 9999-12-31T23:59:59Z inclusive.
99
+ */
100
+ seconds: string;
101
+ /**
102
+ * Non-negative fractions of a second at nanosecond resolution. Negative
103
+ * second values with fractions must still have non-negative nanos values
104
+ * that count forward in time. Must be from 0 to 999,999,999
105
+ * inclusive.
106
+ */
107
+ nanos: number;
108
+ }
109
+ export declare const Timestamp: {
110
+ encode(message: Timestamp, writer?: _m0.Writer): _m0.Writer;
111
+ decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp;
112
+ fromJSON(object: any): Timestamp;
113
+ toJSON(message: Timestamp): unknown;
114
+ create<I extends {
115
+ seconds?: string;
116
+ nanos?: number;
117
+ } & {
118
+ seconds?: string;
119
+ nanos?: number;
120
+ } & { [K in Exclude<keyof I, keyof Timestamp>]: never; }>(base?: I): Timestamp;
121
+ fromPartial<I_1 extends {
122
+ seconds?: string;
123
+ nanos?: number;
124
+ } & {
125
+ seconds?: string;
126
+ nanos?: number;
127
+ } & { [K_1 in Exclude<keyof I_1, keyof Timestamp>]: never; }>(object: I_1): Timestamp;
128
+ };
129
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
130
+ export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
131
+ [K in keyof T]?: DeepPartial<T[K]>;
132
+ } : Partial<T>;
133
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
134
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
135
+ [K in keyof P]: Exact<P[K], I[K]>;
136
+ } & {
137
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
138
+ };
139
+ export {};
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Timestamp = exports.protobufPackage = void 0;
4
+ /* eslint-disable */
5
+ var Long = require("long");
6
+ var _m0 = require("protobufjs/minimal");
7
+ exports.protobufPackage = "google.protobuf";
8
+ function createBaseTimestamp() {
9
+ return { seconds: "0", nanos: 0 };
10
+ }
11
+ exports.Timestamp = {
12
+ encode: function (message, writer) {
13
+ if (writer === void 0) { writer = _m0.Writer.create(); }
14
+ if (message.seconds !== "0") {
15
+ writer.uint32(8).int64(message.seconds);
16
+ }
17
+ if (message.nanos !== 0) {
18
+ writer.uint32(16).int32(message.nanos);
19
+ }
20
+ return writer;
21
+ },
22
+ decode: function (input, length) {
23
+ var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
24
+ var end = length === undefined ? reader.len : reader.pos + length;
25
+ var message = createBaseTimestamp();
26
+ while (reader.pos < end) {
27
+ var tag = reader.uint32();
28
+ switch (tag >>> 3) {
29
+ case 1:
30
+ message.seconds = longToString(reader.int64());
31
+ break;
32
+ case 2:
33
+ message.nanos = reader.int32();
34
+ break;
35
+ default:
36
+ reader.skipType(tag & 7);
37
+ break;
38
+ }
39
+ }
40
+ return message;
41
+ },
42
+ fromJSON: function (object) {
43
+ return {
44
+ seconds: isSet(object.seconds) ? String(object.seconds) : "0",
45
+ nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
46
+ };
47
+ },
48
+ toJSON: function (message) {
49
+ var obj = {};
50
+ message.seconds !== undefined && (obj.seconds = message.seconds);
51
+ message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
52
+ return obj;
53
+ },
54
+ create: function (base) {
55
+ return exports.Timestamp.fromPartial(base !== null && base !== void 0 ? base : {});
56
+ },
57
+ fromPartial: function (object) {
58
+ var _a, _b;
59
+ var message = createBaseTimestamp();
60
+ message.seconds = (_a = object.seconds) !== null && _a !== void 0 ? _a : "0";
61
+ message.nanos = (_b = object.nanos) !== null && _b !== void 0 ? _b : 0;
62
+ return message;
63
+ },
64
+ };
65
+ function longToString(long) {
66
+ return long.toString();
67
+ }
68
+ // If you get a compile-error about 'Constructor<Long> and ... have no overlap',
69
+ // add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'.
70
+ if (_m0.util.Long !== Long) {
71
+ _m0.util.Long = Long;
72
+ _m0.configure();
73
+ }
74
+ function isSet(value) {
75
+ return value !== null && value !== undefined;
76
+ }
package/dist/index.js CHANGED
@@ -115,7 +115,7 @@ var Client = /** @class */ (function () {
115
115
  this._insecureXToken = xToken;
116
116
  }
117
117
  }
118
- this._client = new geyser_1.GeyserClient("".concat(endpointURL.host, ":").concat(port), creds, channelOptions);
118
+ this._client = new geyser_1.GeyserClient("".concat(endpointURL.hostname, ":").concat(port), creds, channelOptions);
119
119
  }
120
120
  Client.prototype._getInsecureMetadata = function () {
121
121
  var metadata = new grpc_js_1.Metadata();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triton-one/yellowstone-grpc",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Triton One",
6
6
  "description": "Yellowstone gRPC Geyser Node.js Client",