|
|
1 ano atrás | |
|---|---|---|
| .. | ||
| jito_geyser | 2 anos atrás | |
| README.md | 1 ano atrás | |
| poetry.lock | 2 anos atrás | |
| pyproject.toml | 1 ano atrás | |
This library contains python code to interact with Jito's Geyser Plugin.
$ pip install jito_geyser
We no longer support access to geyser. Please use 3rd party providers.
from grpc import ssl_channel_credentials, secure_channel
from jito_geyser.generated.geyser_pb2 import SubscribeSlotUpdateRequest
from jito_geyser.generated.geyser_pb2_grpc import GeyserStub
GEYSER_URL = "mainnet.rpc.jito.wtf"
ACCESS_TOKEN = "ACCESS_TOKEN_HERE"
channel = secure_channel(GEYSER_URL, ssl_channel_credentials())
client = GeyserStub(channel)
for msg in client.SubscribeSlotUpdates(SubscribeSlotUpdateRequest(), metadata=[("access-token", ACCESS_TOKEN)]):
print(msg)
This example listens to pyth-owned accounts
from grpc import ssl_channel_credentials, secure_channel
from solders.pubkey import Pubkey # note: probably need to install solders for this import
from jito_geyser.generated.geyser_pb2 import SubscribeProgramsUpdatesRequest
from jito_geyser.generated.geyser_pb2_grpc import GeyserStub
GEYSER_URL = "mainnet.rpc.jito.wtf"
ACCESS_TOKEN = "ACCESS_TOKEN_HERE"
ACCOUNTS = [bytes(Pubkey.from_string("FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH"))]
channel = secure_channel(GEYSER_URL, ssl_channel_credentials())
client = GeyserStub(channel)
for msg in client.SubscribeProgramUpdates(SubscribeProgramsUpdatesRequest(programs=ACCOUNTS), metadata=[("access-token", ACCESS_TOKEN)]):
print(msg)
Install pip
$ curl -sSL https://bootstrap.pypa.io/get-pip.py | python 3 -
Install poetry
$ curl -sSL https://install.python-poetry.org | python3 -
Setup environment and build protobufs
$ poetry install
$ poetry shell
$ poetry protoc
Linting
$ poetry run black .
$ poetry run isort .
Publishing package
$ poetry protoc && poetry build && poetry publish