This example can contains errors or be behind of the latest stable version, please use it only as an example of how your subscription can looks like. If you want well tested production ready example, please check our implementation on Rust.
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
npm start -- --endpoint https://api.rpcpool.com \
--x-token "<token>" \
subscribe \
--accounts --accounts-account "<Pubkey>"
npm start -- --endpoint https://api.rpcpool.com \
--x-token "<token>" \
subscribe \
--slots
npm start -- -e="https://api.rpcpool.com" \
--x-token "<token>" \
--commitment processed \
subscribe \
--slots
npm start -- -e="https://api.rpcpool.com" \
--x-token "<token>" \
subscribe \
--transactions \
--transactions-vote false \
--transactions-failed false \
--transactions-account-include "<Pubkey>"
npm start -- -e="https://api.rpcpool.com" \
--x-token "<token>" \
ping
response: 1
npm start -- -e="https://api.rpcpool.com" \
--x-token "<token>" \
get-latest-blockhash
response: {
slot: 5188,
blockhash: '5N5v1HQq5EFui4yaPRBAN8cF23KWdJWhvvTnNu97JEH8',
lastValidBlockHeight: 5175
}
npm start -- -e="https://api.rpcpool.com" \
--x-token "<token>" \
get-block-height
response: 5188
npm start -- -e="https://api.rpcpool.com" \
--x-token "<token>" \
get-slot
response: 196214563
npm start -- -e="https://api.rpcpool.com" \
--x-token "<token>" \
is-blockhash-valid --blockhash "<blockhash>"
response: { slot: 196214563, valid: true }
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\"}" }