Devnet-first Python SDK for TxLINE REST, SSE, validation, and Solana instruction builders.
Project description
TxLINE Python SDK
Devnet-first Python SDK for TxLINE REST APIs, SSE streams, validation helpers, Solana instruction builders, and checked purchase quote transaction bytes.
This package intentionally supports TxLINE Devnet only. Mainnet constants are documented in
NOTES.mdfor source comparison, but mainnet transaction flows are not implemented or presented as safe.
Development
cd python
python -m pip install -e ".[dev]"
python -m pytest
python -m ruff check .
python -m ruff format --check .
python -m mypy src
python -m build
Import name:
import txline
Quick Start
from txline import ApiToken, GuestJwt, TxlineClient, TxlineConfig
with TxlineClient(TxlineConfig.devnet()) as client:
guest = client.start_guest_session()
client.set_guest_jwt(guest)
client.set_api_token(ApiToken("caller-provided-activated-api-token"))
fixtures = client.fixtures().snapshot()
print(len(fixtures))
Async clients are available too:
from txline import ApiToken, AsyncTxlineClient, TxlineConfig
async with AsyncTxlineClient(TxlineConfig.devnet()) as client:
guest = await client.start_guest_session()
client.set_guest_jwt(guest)
client.set_api_token(ApiToken("caller-provided-activated-api-token"))
scores = await client.scores().historical_by_fixture(17952170)
REST Examples
client.set_guest_jwt(GuestJwt("caller-provided-guest-jwt"))
client.set_api_token(ApiToken("caller-provided-api-token"))
odds = client.odds().snapshot(17952170)
scores = client.scores().snapshot(17952170)
legacy = client.scores().stat_validation_legacy(17952170, seq=941, stat_key=1002)
v2 = client.scores().stat_validation_v2(17952170, seq=941, stat_keys=[1001, 1002])
Activation preimage helper:
message = client.activation_preimage("SUBSCRIBE_TX_SIGNATURE", [])
For an empty league bundle, this signs:
SUBSCRIBE_TX_SIGNATURE::guest-jwt
SSE Streams
Streams require both the guest JWT and activated API token to be set on the client.
from txline.sse import StreamOptions
async for event in client.scores_stream().stream(
StreamOptions(fixture_id=17952170, initial_backoff=1.0, max_backoff=30.0)
):
print(event.id, event.data.seq)
Streams parse SSE blocks, filter event: heartbeat, preserve
Last-Event-ID, respect retry: hints, reconnect after interruptions, and
refresh guest JWTs on stream 401/403.
Validation Helpers
from txline.validation import Comparison, NDimensionalStrategy, TraderPredicate
strategy = (
NDimensionalStrategy.builder(stat_count=2)
.single(0, TraderPredicate(1, Comparison.GREATER_THAN))
.build()
)
payload = v2.to_validation_input()
Proof hashes decode from base64, URL-safe base64, hex, or byte arrays and must be exactly 32 bytes.
Solana Instruction Builders
from txline.solana import Pubkey
from txline.solana.instructions import subscribe_instruction
solana = client.solana()
pdas = solana.pdas()
user = Pubkey.from_string("11111111111111111111111111111111")
ix = subscribe_instruction(
solana.program_id(),
pdas.subscribe_accounts(user),
service_level_id=1,
weeks=4,
)
The SDK builds deterministic instruction data and account metas for subscription, faucet, purchase, validation, and low-level public trading instructions. It does not sign or send transactions.
Purchase Quote Safety
Use checked purchase quote flows before signing backend-provided transaction bytes:
checked = client.purchase_quote_checked(
buyer="buyer-public-key",
txline_amount=1_000,
expected_backend_signer="backend-public-key",
)
tx_bytes = checked.transaction_bytes()
The checker verifies the expected backend signer, decodes the transaction,
rejects address table lookups, limits invoked programs, requires exactly one
TxLINE purchase_subscription_token_usdt instruction, verifies the requested
amount, and checks the expected Devnet account layout.
Live examples require caller-provided credentials, wallet signatures, and wallet/RPC code. Do not commit JWTs, API tokens, private keys, seed phrases, wallet signatures, or full auth headers.
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 txline-0.3.5.tar.gz.
File metadata
- Download URL: txline-0.3.5.tar.gz
- Upload date:
- Size: 35.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d241a3a6066c45bed7b4fbd34940bf611ea7327fe049623d3175314e07ffb626
|
|
| MD5 |
32923208083e69b9025e1f00b6842b2e
|
|
| BLAKE2b-256 |
03c16130dd35ccb6cedafae17c7de52ff9a048ad82c8fff8b56d0e0f92d5620d
|
Provenance
The following attestation bundles were made for txline-0.3.5.tar.gz:
Publisher:
release.yml on Berektassuly/txline
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
txline-0.3.5.tar.gz -
Subject digest:
d241a3a6066c45bed7b4fbd34940bf611ea7327fe049623d3175314e07ffb626 - Sigstore transparency entry: 2089720192
- Sigstore integration time:
-
Permalink:
Berektassuly/txline@e0b078f8cce51736b1a6a1404b108c74929e5fee -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Berektassuly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e0b078f8cce51736b1a6a1404b108c74929e5fee -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file txline-0.3.5-py3-none-any.whl.
File metadata
- Download URL: txline-0.3.5-py3-none-any.whl
- Upload date:
- Size: 34.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbda260eaaf35c6881bff808477f41f9513ea61e9d4ebdff9a13133740bb31dd
|
|
| MD5 |
0829ac3bf2d13c71c6e161dc337a1797
|
|
| BLAKE2b-256 |
a1918a595f2bb0c796e82468768399ed2b4c5d87c85c2768be725e872523682e
|
Provenance
The following attestation bundles were made for txline-0.3.5-py3-none-any.whl:
Publisher:
release.yml on Berektassuly/txline
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
txline-0.3.5-py3-none-any.whl -
Subject digest:
cbda260eaaf35c6881bff808477f41f9513ea61e9d4ebdff9a13133740bb31dd - Sigstore transparency entry: 2089720591
- Sigstore integration time:
-
Permalink:
Berektassuly/txline@e0b078f8cce51736b1a6a1404b108c74929e5fee -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Berektassuly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e0b078f8cce51736b1a6a1404b108c74929e5fee -
Trigger Event:
workflow_dispatch
-
Statement type: