Complete JavaScript and TypeScript examples for integrating with NextBlock's gRPC API using @grpc/grpc-js and @solana/web3.js.
Overview
These examples demonstrate how to:
Establish secure gRPC connections with authentication
Submit single and batched transactions with proper tipping
Stream real-time tip floor data for dynamic tip optimization
Maintain persistent connections with keepalive mechanisms
Prerequisites
Install the required dependencies:
npminstall@grpc/grpc-js@grpc/proto-loadernpminstall@solana/web3.js@solana/spl-tokennpminstalltypescript@types/node# For TypeScript support# Generate JavaScript gRPC client from nextblock-proto# See https://github.com/nextblock-ag/nextblock-proto for instructions
Examples
Core Examples
Connection - Establish gRPC connections with authentication