Yellowstone Fumarole Python Client
Project description
Fumarole Python SDK
This module contains Fumarole SDK for python programming language.
Configuration
endpoint: <"https://fumarole.endpoint.rpcpool.com">
x-token: <YOUR X-TOKEN secret here>
Manage consumer group
Refer to fume CLI to manage your consumer groups.
Examples
from typing import Optional
import uuid
import asyncio
import logging
from os import environ
from collections import defaultdict
from yellowstone_fumarole_client.config import FumaroleConfig
from yellowstone_fumarole_client import FumaroleClient
from yellowstone_fumarole_proto.fumarole_v2_pb2 import CreateConsumerGroupRequest
from yellowstone_fumarole_proto.geyser_pb2 import (
SubscribeRequest,
SubscribeRequestFilterAccounts,
SubscribeRequestFilterTransactions,
SubscribeRequestFilterBlocksMeta,
SubscribeRequestFilterEntry,
SubscribeRequestFilterSlots,
)
from yellowstone_fumarole_proto.geyser_pb2 import (
SubscribeUpdate,
SubscribeUpdateTransaction,
SubscribeUpdateBlockMeta,
SubscribeUpdateAccount,
SubscribeUpdateEntry,
SubscribeUpdateSlot,
)
async def dragonsmouth_like_session(fumarole_config):
with open("~/.fumarole/config.yaml") as f:
fumarole_config = FumaroleConfig.from_yaml(f)
client: FumaroleClient = await FumaroleClient.connect(fumarole_config)
await client.delete_all_consumer_groups()
# --- This is optional ---
resp = await client.create_consumer_group(
CreateConsumerGroupRequest(
consumer_group_name="test",
)
)
assert resp.consumer_group_id, "Failed to create consumer group"
# --- END OF OPTIONAL BLOCK ---
session = await client.dragonsmouth_subscribe(
consumer_group_name="test",
request=SubscribeRequest(
# accounts={"fumarole": SubscribeRequestFilterAccounts()},
transactions={"fumarole": SubscribeRequestFilterTransactions()},
blocks_meta={"fumarole": SubscribeRequestFilterBlocksMeta()},
entry={"fumarole": SubscribeRequestFilterEntry()},
slots={"fumarole": SubscribeRequestFilterSlots()},
),
)
dragonsmouth_source = session.source
handle = session.fumarole_handle
block_map = defaultdict(BlockConstruction)
while True:
tasks = [asyncio.create_task(dragonsmouth_source.get()), handle]
done, pending = await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
for t in done:
if tasks[0] == t:
result: SubscribeUpdate = t.result()
if result.HasField("block_meta"):
block_meta: SubscribeUpdateBlockMeta = result.block_meta
elif result.HasField("transaction"):
tx: SubscribeUpdateTransaction = result.transaction
elif result.HasField("account"):
account: SubscribeUpdateAccount = result.account
elif result.HasField("entry"):
entry: SubscribeUpdateEntry = result.entry
elif result.HasField("slot"):
result: SubscribeUpdateSlot = result.slot
else:
result = t.result()
raise RuntimeError("failed to get dragonsmouth source: %s" % result)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yellowstone_fumarole_client-0.1.0rc2.tar.gz.
File metadata
- Download URL: yellowstone_fumarole_client-0.1.0rc2.tar.gz
- Upload date:
- Size: 34.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.8.0-60-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9f8114c21f34b9367d6b45aff0710917802ed798cf8be596a0f7779fa77447e
|
|
| MD5 |
5ebb6a6793ee0af2ae6180d0caa3b307
|
|
| BLAKE2b-256 |
e58494bc50c7fb8524ea3352d493e9d3250efd7e766bae8d2f9ce2b4450593fa
|
File details
Details for the file yellowstone_fumarole_client-0.1.0rc2-py3-none-any.whl.
File metadata
- Download URL: yellowstone_fumarole_client-0.1.0rc2-py3-none-any.whl
- Upload date:
- Size: 39.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.8.0-60-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc7958a615151830d81ba1da1f5a9688f86a3cfad0a97c56941ee39777916693
|
|
| MD5 |
ae8cafd10cbea039600e9e701085d992
|
|
| BLAKE2b-256 |
f8fd2e6e9080f0e1ed766f8e7210d3f61b1918e764f992ca3ce7dc8387d1a197
|