Skip to content

Latest commit

 

History

History
128 lines (99 loc) · 2.29 KB

README.md

File metadata and controls

128 lines (99 loc) · 2.29 KB

TypeScript client example

This is a sample client for Solana geyser gRPC written in TypeScript.

This can be used in the following way:

npm start -- --endpoint https://api.rpcpool.com \
  --x-token <token> \
  subscribe \
  --accounts --accounts-account SysvarC1ock11111111111111111111111111111111

subscribe to account updates

npm start -- --endpoint https://api.rpcpool.com \
  --x-token "<token>" \
  subscribe \
  --accounts --accounts-account "<Pubkey>"

subscribe to slot updates

npm start -- --endpoint https://api.rpcpool.com \
  --x-token "<token>" \
  subscribe \
  --slots

subscribe to slot updates, commitment processed

npm start -- -e="https://api.rpcpool.com" \
  --x-token "<token>" \
  --commitment processed \
  subscribe \
  --slots

subscribe to transaction updates

npm start -- -e="https://api.rpcpool.com" \
  --x-token "<token>" \
  subscribe \
  --transactions \
  --transactions-vote false \
  --transactions-failed false \
  --transactions-account-include "<Pubkey>"

unary Ping

npm start -- -e="https://api.rpcpool.com" \
  --x-token "<token>" \
  ping
response: 1

unary GetLatestBlockhash

npm start -- -e="https://api.rpcpool.com" \
  --x-token "<token>" \
  get-latest-blockhash
response: {
  slot: 5188,
  blockhash: '5N5v1HQq5EFui4yaPRBAN8cF23KWdJWhvvTnNu97JEH8',
  lastValidBlockHeight: 5175
}

unary GetBlockHeight

npm start -- -e="https://api.rpcpool.com" \
  --x-token "<token>" \
  get-block-height
response: 5188

unary GetSlot

npm start -- -e="https://api.rpcpool.com" \
  --x-token "<token>" \
  get-slot
response: 196214563

unary IsBlockhashValid

npm start -- -e="https://api.rpcpool.com" \
  --x-token "<token>" \
  is-blockhash-valid --blockhash "<blockhash>"
response: { slot: 196214563, valid: true }

unary GetVersion

npm start -- -e="https://api.rpcpool.com" \
  --x-token "<token>" \
  get-version
response: { version: "{\"version\":\"0.7.0+solana.1.15.2\",\"proto\":\"1.2.0+solana.1.15.2\",\"solana\":\"1.15.2\",\"git\":\"e03a47c-modified\",\"rustc\":\"1.68.0-nightly\",\"buildts\":\"2023-05-27T08:20:15.440278Z\"}" }