client: add gRPC channel options to Node.js (#306)
This commit is contained in:
parent
aafd827df8
commit
834b986d47
|
@ -14,6 +14,8 @@ The minor version will be incremented upon a breaking change and the patch versi
|
|||
|
||||
### Features
|
||||
|
||||
- client: add gRPC channel options to Node.js ([#306](https://github.com/rpcpool/yellowstone-grpc/pull/306))
|
||||
|
||||
### Breaking
|
||||
|
||||
## 2024-03-26
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
},
|
||||
"../../yellowstone-grpc-client-nodejs": {
|
||||
"name": "@triton-one/yellowstone-grpc",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.8.0"
|
||||
|
|
|
@ -9,7 +9,9 @@ async function main() {
|
|||
const args = parseCommandLineArgs();
|
||||
|
||||
// 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);
|
||||
|
||||
|
|
|
@ -2,6 +2,3 @@ node_modules
|
|||
|
||||
# Ignore built files
|
||||
dist/**/*
|
||||
|
||||
# Do not include automatically generated files.
|
||||
src/grpc/*.ts
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@triton-one/yellowstone-grpc",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@triton-one/yellowstone-grpc",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.8.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@triton-one/yellowstone-grpc",
|
||||
"version": "0.3.0",
|
||||
"version": "0.4.0",
|
||||
"license": "Apache-2.0",
|
||||
"author": "Triton One",
|
||||
"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
|
@ -17,7 +17,12 @@ import {
|
|||
SubscribeRequestFilterTransactions,
|
||||
} from "./grpc/geyser";
|
||||
|
||||
import { ChannelCredentials, credentials, Metadata } from "@grpc/grpc-js";
|
||||
import {
|
||||
ChannelCredentials,
|
||||
credentials,
|
||||
ChannelOptions,
|
||||
Metadata,
|
||||
} from "@grpc/grpc-js";
|
||||
|
||||
// Reexport automatically generated types
|
||||
export {
|
||||
|
@ -51,7 +56,11 @@ export {
|
|||
export default class Client {
|
||||
_client: GeyserClient;
|
||||
|
||||
constructor(endpoint: string, xToken: string | undefined) {
|
||||
constructor(
|
||||
endpoint: string,
|
||||
xToken: string | undefined,
|
||||
channelOptions: ChannelOptions | undefined
|
||||
) {
|
||||
let creds: ChannelCredentials;
|
||||
|
||||
const endpointURL = new URL(endpoint);
|
||||
|
@ -72,7 +81,7 @@ export default class Client {
|
|||
creds = ChannelCredentials.createInsecure();
|
||||
}
|
||||
|
||||
this._client = new GeyserClient(endpointURL.host, creds);
|
||||
this._client = new GeyserClient(endpointURL.host, creds, channelOptions);
|
||||
}
|
||||
|
||||
async subscribe() {
|
||||
|
|
Loading…
Reference in New Issue