Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.49 KB

File metadata and controls

56 lines (39 loc) · 2.49 KB

JetStream Go Example

JetStream example client built on the OrbitFlare Go SDK (github.com/orbitflare/orbitflare-sdk-go).

It ships two runnable examples that both use the SDK's typed account filters (no hand-written protobuf) and share one pump.fun instruction decoder (internal/decoder):

  • v1 streams transactions matching a typed filter and decodes pump.fun create / buy / sell instructions on each one.
  • v2 does the same on the v2 client, and because it opts into enrichment it also prints each transaction's fee payer, compute-unit price, and computed priority fee. After some pump.fun activity it adds a Raydium filter to the live stream (no reconnect) and routes each transaction by the filter it matched.

The SDK handles connection lifecycle, reconnection, endpoint failover, and ping/pong.

Run

# JetStream v1
go run ./cmd/v1

# JetStream v2
go run ./cmd/v2

By default both filter on the pump.fun program. Override the filter and endpoint from the CLI:

go run ./cmd/v1 -include <pubkey>,<pubkey> -required <pubkey>
go run ./cmd/v2 -url http://ny.jetstream.orbitflare.com

The endpoint also falls back to the ORBITFLARE_JETSTREAM_URL environment variable (default http://fra.jetstream.orbitflare.com). Build binaries with go build ./cmd/v1 ./cmd/v2, then run ./v1 or ./v2.

Layout

  • internal/decoder/pumpfun.go - pump.fun instruction decoder, shared by both binaries
  • internal/cli/cli.go - shared CLI (endpoint + include/exclude/required account filters)
  • cmd/v1/main.go - v1 stream + decode
  • cmd/v2/main.go - v2 stream + decode + enrichment

Example output

# v1
slot=431459059 sig=5S6kHErbpKRDqmvp sell amount=8340153679582 min_sol_output=1236123991

# v2 (fee payer, cu price, and priority fee come from enrichment)
filter pumpfun accepted=true
seq=8 slot=431461327 sig=5T5um7ApWa3PibTy fee_payer=ARJAji15W3X7mY3D cu_price=3333333 priority_fee=999999lp buy amount=3576654744 max_sol_cost=110000
[filters] added raydium to the live stream (no reconnect)
seq=338 slot=431460045 sig=22D1yGiAoB9YsRHZ fee_payer=CNsGG5KEuupSKF3w cu_price=0 priority_fee=0lp [raydium]

Learn more