client: add gRPC channel options to Node.js (#306)

This commit is contained in:
Kirill Fomichev 2024-03-21 10:53:48 -05:00
parent aafd827df8
commit 834b986d47
No known key found for this signature in database
GPG Key ID: 6AA0144D5E0C0C0A
10 changed files with 6405 additions and 11 deletions

View File

@ -14,6 +14,8 @@ The minor version will be incremented upon a breaking change and the patch versi
### Features ### Features
- client: add gRPC channel options to Node.js ([#306](https://github.com/rpcpool/yellowstone-grpc/pull/306))
### Breaking ### Breaking
## 2024-03-26 ## 2024-03-26

View File

@ -19,7 +19,7 @@
}, },
"../../yellowstone-grpc-client-nodejs": { "../../yellowstone-grpc-client-nodejs": {
"name": "@triton-one/yellowstone-grpc", "name": "@triton-one/yellowstone-grpc",
"version": "0.3.0", "version": "0.4.0",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@grpc/grpc-js": "^1.8.0" "@grpc/grpc-js": "^1.8.0"

View File

@ -9,7 +9,9 @@ async function main() {
const args = parseCommandLineArgs(); const args = parseCommandLineArgs();
// Open connection. // Open connection.
const client = new Client(args.endpoint, args.xToken); const client = new Client(args.endpoint, args.xToken, {
'grpc.max_receive_message_length': 64 * 1024 * 1024 // 64MiB
});
const commitment = parseCommitmentLevel(args.commitment); const commitment = parseCommitmentLevel(args.commitment);

View File

@ -2,6 +2,3 @@ node_modules
# Ignore built files # Ignore built files
dist/**/* dist/**/*
# Do not include automatically generated files.
src/grpc/*.ts

View File

@ -1,12 +1,12 @@
{ {
"name": "@triton-one/yellowstone-grpc", "name": "@triton-one/yellowstone-grpc",
"version": "0.3.0", "version": "0.4.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@triton-one/yellowstone-grpc", "name": "@triton-one/yellowstone-grpc",
"version": "0.3.0", "version": "0.4.0",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@grpc/grpc-js": "^1.8.0" "@grpc/grpc-js": "^1.8.0"

View File

@ -1,6 +1,6 @@
{ {
"name": "@triton-one/yellowstone-grpc", "name": "@triton-one/yellowstone-grpc",
"version": "0.3.0", "version": "0.4.0",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "Triton One", "author": "Triton One",
"description": "Yellowstone gRPC Geyser Node.js Client", "description": "Yellowstone gRPC Geyser Node.js Client",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,12 @@ import {
SubscribeRequestFilterTransactions, SubscribeRequestFilterTransactions,
} from "./grpc/geyser"; } from "./grpc/geyser";
import { ChannelCredentials, credentials, Metadata } from "@grpc/grpc-js"; import {
ChannelCredentials,
credentials,
ChannelOptions,
Metadata,
} from "@grpc/grpc-js";
// Reexport automatically generated types // Reexport automatically generated types
export { export {
@ -51,7 +56,11 @@ export {
export default class Client { export default class Client {
_client: GeyserClient; _client: GeyserClient;
constructor(endpoint: string, xToken: string | undefined) { constructor(
endpoint: string,
xToken: string | undefined,
channelOptions: ChannelOptions | undefined
) {
let creds: ChannelCredentials; let creds: ChannelCredentials;
const endpointURL = new URL(endpoint); const endpointURL = new URL(endpoint);
@ -72,7 +81,7 @@ export default class Client {
creds = ChannelCredentials.createInsecure(); creds = ChannelCredentials.createInsecure();
} }
this._client = new GeyserClient(endpointURL.host, creds); this._client = new GeyserClient(endpointURL.host, creds, channelOptions);
} }
async subscribe() { async subscribe() {