API reference¶
This section lists the primary modules and public classes exposed by the SDK. Each entry is generated automatically from the source docstrings.
Core modules¶
Async helpers for Horizon/Soroban operations tied to the OVRL asset. |
|
Network presets and configuration objects for the OVRL SDK. |
|
OVRL token metadata and shared constants for the SDK. |
|
Custom exception types for the OVRL SDK (Apache-2.0). |
|
Soroban-specific helpers for contract workflows in the OVRL SDK. |
|
Lightweight dataclasses modeling responses for the OVRL SDK. |
Key entry points¶
Client¶
- class ovrl_sdk.client.OVRLClient(*, network=NetworkConfig(name='testnet', horizon_url='https://horizon-testnet.stellar.org', passphrase=stellar_sdk.Network.TESTNET_NETWORK_PASSPHRASE, soroban_rpc_url='https://rpc-testnet.stellar.org', friendbot_url='https://friendbot.stellar.org'), base_fee=200, aiohttp_client=None)[source]¶
Bases:
objectAsync-first helper that wraps Horizon/Soroban flows for the OVRL token.
The client wires up the correct network endpoints, asset metadata, quoting helpers, and transaction builders so developers can bootstrap accounts, create trustlines, send payments, inspect history, and perform swaps without re-learning the raw stellar-sdk surface. Instantiate it with a NetworkPresets value (or custom config) and reuse the object across your async tasks.
- Parameters:
network (NetworkConfig)
base_fee (int)
aiohttp_client (Optional[AiohttpClient])
- async close()[source]¶
Dispose the internally owned HTTP client, if any.
- Returns:
None. Provided for symmetry with async context managers.
- Return type:
None
- async load_account(account_id)[source]¶
Load an account from Horizon or raise
OVRLErrorif missing.- Parameters:
account_id (str) – Public key to fetch from Horizon.
- Returns:
The Horizon account wrapper returned by stellar-sdk.
- Raises:
OVRLError – When the account cannot be found.
- async ensure_friendbot(account_id)[source]¶
Invoke the configured Friendbot endpoint for a target account.
- async inspect_account(account_id)[source]¶
Return summarized account status including trustline and balance details.
- Parameters:
account_id (str) – Public key to inspect.
- Returns:
AccountStatus snapshot describing existence, trustline, and balance.
- Return type:
AccountStatus
- asset_metadata()[source]¶
Return static metadata describing the OVRL asset.
- Returns:
AssetMetadata with code, issuer, max supply, decimals, etc.
- Return type:
AssetMetadata
- async get_ovrl_balance(account_id)[source]¶
Fetch the OVRL balance snapshot for the given Stellar account.
- Parameters:
account_id (str) – Public key whose OVRL balance should be fetched.
- Returns:
BalanceSnapshot describing limit, balance, and liabilities.
- Raises:
OVRLError – If the account lacks an OVRL trustline.
- Return type:
BalanceSnapshot
- async get_asset_stats()[source]¶
Retrieve Horizon-reported aggregate statistics for OVRL.
- Returns:
AssetStats representing supply, holders, liquidity pools, etc.
- Return type:
AssetStats
- async get_circulating_supply()[source]¶
Compute circulating supply after subtracting token-owned wallets.
- Returns:
Decimal supply excluding issuer-controlled holdings.
- Return type:
- async has_trustline(account_id)[source]¶
Check whether the account already holds a trustline for OVRL.
- async ensure_trustline(secret, *, limit='100000000000')[source]¶
Create a trustline if missing and return whether one was added.
- async bootstrap_account(*, account_secret, funding_secret=None, starting_balance='2', trustline_limit='100000000000')[source]¶
Ensure the account exists, is funded, and has the OVRL trustline.
- Parameters:
- Returns:
AccountStatus after the bootstrap workflow completes.
- Return type:
AccountStatus
- async create_trustline(secret, *, limit='100000000000')[source]¶
Submit a change-trust operation for OVRL with the specified limit.
- async create_account(*, funding_secret, destination, starting_balance='2')[source]¶
Create and fund a new Stellar account via a direct create-account op.
- async ensure_account(account_id, *, funding_secret=None, starting_balance='2')[source]¶
Guarantee that an on-ledger account exists via Friendbot or a funding key.
- Parameters:
- Returns:
True when a new account was created, False if it already existed.
- Return type:
- async pay(*, source_secret, destination, amount, memo=None)[source]¶
Send a simple OVRL payment with an optional memo.
- Parameters:
- Returns:
TransactionResult for the submitted payment transaction.
- Return type:
TransactionResult
- async send_path_payment(*, source_secret, destination, send_max, dest_amount, path=None)[source]¶
Send OVRL through a strict-receive path payment.
- Parameters:
source_secret (str) – Secret key that signs the transaction.
destination (str) – Recipient account ID.
send_max (str) – Maximum OVRL you are willing to spend.
dest_amount (str) – Destination amount that must be received.
path (Iterable[stellar_sdk.Asset] | None) – Optional iterable of intermediary
Assethops.
- Returns:
TransactionResult for the submitted swap transaction.
- Return type:
TransactionResult
- async batch_pay(*, source_secret, payouts, memo=None, chunk_size=100)[source]¶
Chunk and submit multiple payment operations in batches.
- Parameters:
- Returns:
List of TransactionResult objects, one per submitted transaction.
- Return type:
List[TransactionResult]
- async list_payments_page(account_id, *, limit=10, only_ovrl=True, order='desc', cursor=None, payment_types=None)[source]¶
Return a single page of payments for the account with cursor metadata.
- Parameters:
account_id (str) – Account whose payment history should be fetched.
limit (int) – Number of records per page (max 200 per Horizon).
only_ovrl (bool) – Filter to OVRL payments only when True.
order (str) – “asc” or “desc” order for paging.
cursor (str | None) – Optional paging token to resume from.
payment_types (Sequence[str] | None) – Optional Horizon type filters.
- Returns:
PaymentPage containing typed records and the next cursor.
- Return type:
PaymentPage
- async list_payments(account_id, *, limit=10, only_ovrl=True, order='desc', cursor=None, payment_types=None)[source]¶
Return payment records without pagination metadata.
- Parameters:
account_id (str) – Account whose payment history will be read.
limit (int) – Maximum records per fetch (<=200 per Horizon).
only_ovrl (bool) – When True, filter records to OVRL payments.
order (str) – “asc” or “desc” ordering.
cursor (str | None) – Optional paging token to resume from.
payment_types (Sequence[str] | None) – Optional Horizon payment type filters.
- Returns:
List of
PaymentRecordobjects.- Return type:
List[PaymentRecord]
- async summarize_payments(account_id, *, limit=100, only_ovrl=True, payment_types=None, max_pages=10, cursor=None)[source]¶
Summarize total count/amount across multiple payment pages.
- Parameters:
account_id (str) – Public key whose history should be summarized.
limit (int) – Page size forwarded to Horizon.
only_ovrl (bool) – Restrict to OVRL-denominated payments.
payment_types (Sequence[str] | None) – Optional Horizon payment type filters.
max_pages (int) – Maximum number of pages to fetch.
cursor (str | None) – Optional paging token to resume from.
- Returns:
Aggregated
PaymentSummaryvalue.- Return type:
PaymentSummary
- async list_top_holders(*, limit=10)[source]¶
Return the richest OVRL accounts along with their balances.
- async payment_watcher(account_id, *, only_ovrl=True, poll_interval=5.0, limit=10, max_rounds=None, start_cursor=None, replay_most_recent=True, payment_types=None)[source]¶
Poll for new payments, yielding records incrementally.
- Parameters:
account_id (str) – Account to watch.
only_ovrl (bool) – When True, skip non-OVRL payments.
poll_interval (float) – Seconds to sleep between Horizon polls.
limit (int) – Page size per poll.
max_rounds (int | None) – Optional number of polls before stopping.
start_cursor (str | None) – Optional cursor to resume from.
replay_most_recent (bool) – Whether to emit the latest page before polling forward.
payment_types (Sequence[str] | None) – Optional Horizon payment type filters.
- Yields:
PaymentRecord objects as new payments appear.
- Return type:
AsyncIterator[PaymentRecord]
- async get_account_overview(account_id)[source]¶
Fetch raw account JSON from Horizon and normalize into
AccountOverview.- Parameters:
account_id (str) – Public key to load via Horizon.
- Returns:
AccountOverview representing the latest Horizon payload.
- Return type:
AccountOverview
- async quote_paths_to_ovrl(destination_amount, *, source_assets=None)[source]¶
Enumerate strict-receive paths that deliver the requested OVRL amount.
- async quote_paths_from_ovrl(send_amount, *, destination_assets=None)[source]¶
Enumerate strict-send paths that spend OVRL into target assets.
- async wait_for_transaction(tx_hash, *, timeout=30, poll_interval=2)[source]¶
Poll Horizon until the transaction appears or timeout occurs.
- Parameters:
- Returns:
Horizon transaction JSON once the record is available.
- Raises:
OVRLError – If the timeout elapses before the transaction is found.
- Return type:
- async submit_envelope_xdr(envelope_xdr)[source]¶
Submit a base64-encoded envelope XDR using Horizon.
- Parameters:
envelope_xdr (str) – Base64-encoded transaction envelope.
- Returns:
TransactionResultdescribing Horizon’s response.- Return type:
TransactionResult
- async submit_with_retry(envelope, *, attempts=3, backoff_seconds=2.0)[source]¶
Submit a built envelope with retry/backoff semantics.
- Parameters:
- Returns:
TransactionResulton success.- Raises:
OVRLError – If attempts is invalid or submission ultimately fails.
- Return type:
TransactionResult
- async validate_home_domain()[source]¶
Ensure Horizon’s recorded home domain matches the TOML contents.
- Returns:
True when the home domain configuration is valid.
- Raises:
OVRLError – When Horizon or TOML data disagree.
- Return type:
- async get_fee_stats()[source]¶
Return the latest Horizon-reported fee statistics.
- Returns:
FeeStatsparsed from Horizon.- Return type:
FeeStats
- async quote_ovrl_price(*, counter_asset=stellar_sdk.Asset, amount='1')[source]¶
Return the per-unit counter-asset value for OVRL.
- async quote_ovrl_to_asset(amount, *, counter_asset=stellar_sdk.Asset)[source]¶
Quote how much of the counter asset is received for the OVRL amount.
- async quote_asset_to_ovrl(amount, *, source_asset=stellar_sdk.Asset)[source]¶
Quote how much OVRL can be received for a counter-asset amount.
- async swap_from_ovrl(*, source_secret, destination, amount, counter_asset=stellar_sdk.Asset, memo=None)[source]¶
Execute a strict-send swap spending OVRL into a counter asset.
- Parameters:
- Returns:
TransactionResultreferencing the submitted transaction.- Return type:
TransactionResult
- async swap_to_ovrl(*, source_secret, destination, ovrl_amount, source_asset=stellar_sdk.Asset, memo=None)[source]¶
Execute a strict-receive swap delivering OVRL.
- Parameters:
- Returns:
TransactionResultreferencing the submitted transaction.- Return type:
TransactionResult
- static format_price(amount, *, currency='USD', style='symbol', precision=2, notation='standard', trim_trailing=True)[source]¶
Format a numeric value with currency styling and optional grouped/compact notation.
- Parameters:
amount (str | Decimal) – Numeric amount (string or Decimal) to format.
currency (str) – ISO currency code used for symbol/code output.
style (str) –
symbol(default),code, orplaintext rendering.precision (int) – Decimal places to display (>=0).
notation (str) –
standard,grouped, orcompactfor thousands abbreviations.trim_trailing (bool) – When True, drop redundant trailing zeros.
- Returns:
Formatted currency string.
- Raises:
OVRLError – If unsupported precision/style/notation values are provided.
- Return type:
Soroban helpers¶
- class ovrl_sdk.soroban.SorobanTokenClient(client, contract_id, *, scale=7, toolkit=None)[source]¶
High-level helpers for invoking the Soroban token interface (balance/transfer/etc).
- Parameters:
client (OVRLClient)
contract_id (str)
scale (int)
toolkit (Optional[SorobanToolkit])
- async balance(*, secret, account_id)[source]¶
Return the contract-level token balance for
account_id.
- async transfer(*, secret, destination, amount)[source]¶
Transfer tokens from the caller to
destinationusing Soroban.
- async allowance(*, secret, owner, spender)[source]¶
Return the approved allowance between
ownerandspender.
- async approve(*, secret, spender, amount, expiration_ledger=None)[source]¶
Approve the
spenderto withdraw up toamounttokens.- Parameters:
- Returns:
SorobanInvocationdescribing the approval transaction.- Return type:
SorobanInvocation
Data models¶
Lightweight dataclasses modeling responses for the OVRL SDK.
Defines high-level records for balances, payments, quotes, pagination, and transaction summaries returned by the async client. License: Apache-2.0. Authors: Overlumens (github.com/overlumens) and Md Mahedi Zaman Zaber (github.com/zaber-dev).
- class ovrl_sdk.types.AccountOverview(account_id, sequence, subentry_count, last_modified_ledger, balances, signers)[source]
Bases:
objectLightweight wrapper around the Horizon account payload.
- Parameters:
- account_id: str
- sequence: str
- subentry_count: int
- class ovrl_sdk.types.AccountStatus(account_id, exists, has_trustline, overview, balance, needs_friendbot)[source]
Bases:
objectHigh-level status report produced by OVRLClient.inspect_account.
- Parameters:
- account_id: str
- exists: bool
- has_trustline: bool
- overview: AccountOverview | None
- balance: BalanceSnapshot | None
- needs_friendbot: bool
- class ovrl_sdk.types.AssetMetadata(code, issuer, home_domain, max_supply, issuer_locked, decimal_scale)[source]
Bases:
objectStatic attributes describing the OVRL asset.
- Parameters:
- code: str
- issuer: str
- home_domain: str
- max_supply: Decimal
- issuer_locked: bool
- decimal_scale: int
- class ovrl_sdk.types.AssetStats(amount, num_accounts, num_claimable_balances, claimable_balances_amount, liquidity_pools_amount, num_liquidity_pools, home_domain, last_modified_ledger, flags)[source]
Bases:
objectAggregated Horizon stats for OVRL (supply, holders, flags).
- Parameters:
- amount: Decimal
- num_accounts: int
- num_claimable_balances: int
- claimable_balances_amount: Decimal
- liquidity_pools_amount: Decimal
- num_liquidity_pools: int
- class ovrl_sdk.types.BalanceSnapshot(account_id, asset_code, asset_issuer, balance, limit, buying_liabilities, selling_liabilities)[source]
Bases:
objectRepresents a point-in-time OVRL balance pulled from Horizon.
- Parameters:
- account_id: str
- asset_code: str
- asset_issuer: str
- balance: Decimal
- buying_liabilities: Decimal
- selling_liabilities: Decimal
- class ovrl_sdk.types.FeeStats(last_ledger, last_ledger_base_fee, ledger_capacity_usage, min_accepted_fee, mode_accepted_fee, p10_accepted_fee, p50_accepted_fee, p95_accepted_fee, p99_accepted_fee)[source]
Bases:
objectSnapshot of Horizon fee percentile metrics.
- Parameters:
- last_ledger: int
- last_ledger_base_fee: int
- ledger_capacity_usage: Decimal
- min_accepted_fee: int
- mode_accepted_fee: int
- p10_accepted_fee: int
- p50_accepted_fee: int
- p95_accepted_fee: int
- p99_accepted_fee: int
- class ovrl_sdk.types.PathQuote(destination_amount, source_amount, path_assets=<factory>, source_asset_code=None, source_asset_issuer=None, destination_asset_code=None, destination_asset_issuer=None)[source]
Bases:
objectNormalized strict send/receive path quote for logging or decision making.
- Parameters:
- destination_amount: Decimal
- source_amount: Decimal
- class ovrl_sdk.types.PaymentIntent(destination, amount, source=None, memo=None)[source]
Bases:
objectDeclarative payout description consumed by OVRLClient.batch_pay.
- destination: str
- class ovrl_sdk.types.PaymentPage(records, next_cursor, record_count, total_amount)[source]
Bases:
objectSingle page of payment history plus pagination metadata.
- Parameters:
- records: List[PaymentRecord]
- record_count: int
- total_amount: Decimal
- class ovrl_sdk.types.PaymentRecord(id, source, destination, amount, asset_code, asset_issuer, created_at, memo=None, paging_token=None)[source]
Bases:
objectTyped version of a payment response returned by Horizon.
- Parameters:
- id: str
- source: str
- amount: Decimal
- asset_code: str
- created_at: str
- class ovrl_sdk.types.PaymentSummary(record_count, total_amount, last_cursor)[source]
Bases:
objectAggregate stats produced by OVRLClient.summarize_payments.
- record_count: int
- total_amount: Decimal