@triton-one/yellowstone-grpc
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -9,3 +9,5 @@ /** | ||
_client: GeyserClient; | ||
_insecureXToken: string | undefined; | ||
constructor(endpoint: string, xToken: string | undefined, channelOptions: ChannelOptions | undefined); | ||
private _getInsecureMetadata; | ||
subscribe(): Promise<import("@grpc/grpc-js").ClientDuplexStream<import("./grpc/geyser").SubscribeRequest, import("./grpc/geyser").SubscribeUpdate>>; | ||
@@ -12,0 +14,0 @@ subscribeOnce(accounts: { |
@@ -100,5 +100,15 @@ "use strict"; | ||
creds = grpc_js_1.ChannelCredentials.createInsecure(); | ||
if (xToken !== undefined) { | ||
this._insecureXToken = xToken; | ||
} | ||
} | ||
this._client = new geyser_1.GeyserClient(endpointURL.host, creds, channelOptions); | ||
} | ||
Client.prototype._getInsecureMetadata = function () { | ||
var metadata = new grpc_js_1.Metadata(); | ||
if (this._insecureXToken) { | ||
metadata.add("x-token", this._insecureXToken); | ||
} | ||
return metadata; | ||
}; | ||
Client.prototype.subscribe = function () { | ||
@@ -108,3 +118,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this._client.subscribe()]; | ||
case 0: return [4 /*yield*/, this._client.subscribe(this._getInsecureMetadata())]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
@@ -120,3 +130,3 @@ } | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this._client.subscribe()]; | ||
case 0: return [4 /*yield*/, this._client.subscribe(this._getInsecureMetadata())]; | ||
case 1: | ||
@@ -157,3 +167,3 @@ stream = _a.sent(); | ||
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
_this._client.ping({ count: count }, function (err, response) { | ||
_this._client.ping({ count: count }, _this._getInsecureMetadata(), function (err, response) { | ||
if (err === null || err === undefined) { | ||
@@ -178,3 +188,3 @@ resolve(response.count); | ||
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
_this._client.getLatestBlockhash({ commitment: commitment }, function (err, response) { | ||
_this._client.getLatestBlockhash({ commitment: commitment }, _this._getInsecureMetadata(), function (err, response) { | ||
if (err === null || err === undefined) { | ||
@@ -199,3 +209,3 @@ resolve(response); | ||
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
_this._client.getBlockHeight({ commitment: commitment }, function (err, response) { | ||
_this._client.getBlockHeight({ commitment: commitment }, _this._getInsecureMetadata(), function (err, response) { | ||
if (err === null || err === undefined) { | ||
@@ -220,3 +230,3 @@ resolve(response.blockHeight); | ||
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
_this._client.getSlot({ commitment: commitment }, function (err, response) { | ||
_this._client.getSlot({ commitment: commitment }, _this._getInsecureMetadata(), function (err, response) { | ||
if (err === null || err === undefined) { | ||
@@ -241,3 +251,3 @@ resolve(response.slot); | ||
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
_this._client.isBlockhashValid({ blockhash: blockhash, commitment: commitment }, function (err, response) { | ||
_this._client.isBlockhashValid({ blockhash: blockhash, commitment: commitment }, _this._getInsecureMetadata(), function (err, response) { | ||
if (err === null || err === undefined) { | ||
@@ -262,3 +272,3 @@ resolve(response); | ||
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) { | ||
_this._client.getVersion({}, function (err, response) { | ||
_this._client.getVersion({}, _this._getInsecureMetadata(), function (err, response) { | ||
if (err === null || err === undefined) { | ||
@@ -265,0 +275,0 @@ resolve(response.version); |
{ | ||
"name": "@triton-one/yellowstone-grpc", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "author": "Triton One", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
847307
19537