API Documentation
Account
- class stellar_sdk.account.Account(account, sequence, raw_data=None)[source]
The
Account
object represents a single account on the Stellar network and its sequence number.Account tracks the sequence number as it is used by
TransactionBuilder
.Normally, you can get an
Account
instance throughstellar_sdk.server.Server.load_account()
orstellar_sdk.server_async.ServerAsync.load_account()
.An example:
from stellar_sdk import Keypair, Server server = Server(horizon_url="https://horizon-testnet.stellar.org") source = Keypair.from_secret("SBFZCHU5645DOKRWYBXVOXY2ELGJKFRX6VGGPRYUWHQ7PMXXJNDZFMKD") # `account` can also be a muxed account source_account = server.load_account(account=source.public_key)
See Accounts for more information.
- Parameters:
account (
Union
[str
,MuxedAccount
]) – Account Id of the account (ex."GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA"
) or muxed account (ex."MBZSQ3YZMZEWL5ZRCEQ5CCSOTXCFCMKDGFFP4IEQN2KN6LCHCLI46AAAAAAAAAAE2L2QE"
)sequence (
int
) – Current sequence number of the account.
- load_ed25519_public_key_signers()[source]
Load ed25519 public key signers.
- Return type:
List
[Ed25519PublicKeySigner
]
- property universal_account_id: str
Get the universal account id, if account is ed25519 public key, it will return ed25519 public key (ex.
"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
), otherwise it will return muxed account (ex."MAAAAAAAAAAAJURAAB2X52XFQP6FBXLGT6LWOOWMEXWHEWBDVRZ7V5WH34Y22MPFBHUHY"
)
Address
- class stellar_sdk.address.Address(address)[source]
Represents a single address in the Stellar network. An address can represent an account or a contract.
- Parameters:
address (
str
) – ID of the account or contract. (ex.GBJCHUKZMTFSLOMNC7P4TS4VJJBTCYL3XKSOLXAUJSD56C4LHND5TWUC
orCA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUWDA
)
- static from_raw_contract(contract)[source]
Creates a new contract Address object from a buffer of raw bytes.
- class stellar_sdk.address.AddressType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Represents an Address type.
- ACCOUNT = 0
An account address, address looks like
GBJCHUKZMTFSLOMNC7P4TS4VJJBTCYL3XKSOLXAUJSD56C4LHND5TWUC
.
- CONTRACT = 1
An contract address, address looks like
CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5
.
Asset
- class stellar_sdk.asset.Asset(code, issuer=None)[source]
The
Asset
object, which represents an asset and its corresponding issuer on the Stellar network.The following example shows how to create an Asset object:
from stellar_sdk import Asset native_asset = Asset.native() # You can also create a native asset through Asset("XLM"). credit_alphanum4_asset = Asset("USD", "GBSKJPM2FM6O2C6GVZNAUAMGXZ6I4QIUPMNWVDN2NZULPWWTV3GI2SOX") credit_alphanum12_asset = Asset("BANANA", "GA6VT2PDD73TNNRYLPJPJYAAI7EGKBATZ7V562S7XY7TJD4GNOXRG6OS") print(f"Asset type: {credit_alphanum4_asset.type}\n" f"Asset code: {credit_alphanum4_asset.code}\n" f"Asset issuer: {credit_alphanum4_asset.issuer}\n" f"Is native asset: {credit_alphanum4_asset.is_native()}")
For more information about the formats used for asset codes and how issuers work on Stellar’s network, see Stellar’s guide on assets.
- Parameters:
code (
str
) – The asset code, in the formats specified in Stellar’s guide on assets.issuer (
Optional
[str
]) – The account ID of the issuer. Note if the currency is the native currency (XLM (Lumens)), no issuer is necessary.
- Raises:
AssetCodeInvalidError
: ifcode
is invalid.AssetIssuerInvalidError
: ifissuer
is not a valid ed25519 public key.
- static check_if_asset_code_is_valid(code)[source]
Check whether the code passed in by the user is a valid asset code, if not, an exception will be thrown.
- Parameters:
code (
str
) – The asset code.- Raises:
AssetCodeInvalidError
: ifcode
is invalid.- Return type:
- classmethod from_xdr_object(xdr_object)[source]
Create a
Asset
from an XDR Asset/ChangeTrustAsset/TrustLineAsset object.Please note that this function only supports processing the following types of assets:
ASSET_TYPE_NATIVE
ASSET_TYPE_CREDIT_ALPHANUM4
ASSET_TYPE_CREDIT_ALPHANUM12
- Parameters:
xdr_object (
Union
[Asset
,ChangeTrustAsset
,TrustLineAsset
]) – The XDR Asset/ChangeTrustAsset/TrustLineAsset object.- Return type:
- Returns:
A new
Asset
object from the given XDR object.
- guess_asset_type()[source]
Return the type of the asset, Can be one of following types:
native
,credit_alphanum4
orcredit_alphanum12
.- Return type:
- Returns:
The type of the asset.
- is_native()[source]
Return
Ture
if theAsset
object is the native asset.- Return type:
- Returns:
True
if the asset object is native,False
otherwise.
- classmethod native()[source]
Returns an asset object for the native asset.
- Return type:
- Returns:
An asset object for the native asset.
- to_change_trust_asset_xdr_object()[source]
Returns the xdr object for this asset.
- Return type:
- Returns:
XDR ChangeTrustAsset object
- to_trust_line_asset_xdr_object()[source]
Returns the xdr object for this asset.
- Return type:
- Returns:
XDR TrustLineAsset object
Call Builder
AccountsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.AccountsCallBuilder(horizon_url, client)[source]
Creates a new
AccountsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.accounts()
.See List All Accounts for more information.
- Parameters:
horizon_url – Horizon server URL.
client (
BaseSyncClient
) – The client instance used to send request.
- account_id(account_id)
Returns information and links relating to a single account. The balances section in the returned JSON will also list all the trust lines this account has set up.
See Retrieve an Account for more information.
- Parameters:
account_id (
str
) – account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current AccountCallBuilder instance
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_asset(asset)
Filtering accounts who have a trustline to an asset. The result is a list of accounts.
See List All Accounts for more information.
- Parameters:
asset (
Asset
) – an issued asset- Returns:
current AccountCallBuilder instance
- for_liquidity_pool(liquidity_pool_id)
Filtering accounts who have a trustline for the given pool. The result is a list of accounts.
See List All Accounts for more information.
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string., for example:"dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7"
- Returns:
current AccountCallBuilder instance
- for_signer(signer)
Filtering accounts who have a given signer. The result is a list of accounts.
See List All Accounts for more information.
- Parameters:
signer (
str
) – signer’s account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current AccountCallBuilder instance
- for_sponsor(sponsor)
Filtering accounts where the given account is sponsoring the account or any of its sub-entries.
See List All Accounts for more information.
- Parameters:
sponsor (
str
) – the sponsor id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current AccountCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
AssetsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.AssetsCallBuilder(horizon_url, client)[source]
Creates a new
AssetsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.assets()
.See List All Assets for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_code(asset_code)
This endpoint filters all assets by the asset code.
See List All Assets for more information.
- Parameters:
asset_code (
str
) – asset code, for example: USD- Returns:
current AssetCallBuilder instance
- for_issuer(asset_issuer)
This endpoint filters all assets by the asset issuer.
See List All Assets for more information.
- Parameters:
asset_issuer (
str
) – asset issuer, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current AssetCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
ClaimableBalancesCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.ClaimableBalancesCallBuilder(horizon_url, client)[source]
Creates a new
ClaimableBalancesCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.claimable_balance()
.See List Claimable Balances for more information.
- Parameters:
horizon_url – Horizon server URL.
client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- claimable_balance(claimable_balance_id)
Returns information and links relating to a single claimable balance.
See List Claimable Balances for more information.
- Parameters:
claimable_balance_id (
str
) – claimable balance id- Returns:
current AccountCallBuilder instance
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_asset(asset)
Returns all claimable balances which provide a balance for the given asset.
See List Claimable Balances for more information.
- Parameters:
asset (
Asset
) – an asset- Returns:
current ClaimableBalancesCallBuilder instance
- for_claimant(claimant)
Returns all claimable balances which can be claimed by the given account ID.
See List Claimable Balances for more information.
- Parameters:
claimant (
str
) – the account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current ClaimableBalancesCallBuilder instance
- for_sponsor(sponsor)
Returns all claimable balances which are sponsored by the given account ID.
See List Claimable Balances for more information.
- Parameters:
sponsor (
str
) – the sponsor id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current ClaimableBalancesCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
DataCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.DataCallBuilder(horizon_url, client, account_id, data_name)[source]
Creates a new
DataCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.data()
.See Retrieve an Account’s Data for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.account_id (
str
) – account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
data_name (
str
) – Key name
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
EffectsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.EffectsCallBuilder(horizon_url, client)[source]
Creates a new
EffectsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.effects()
.See List All Effects for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint represents all effects that changed a given account. It will return relevant effects from the creation of the account to the current ledger.
See Retrieve an Account’s Effects for more information.
- Parameters:
account_id (
str
) – account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
this EffectCallBuilder instance
- for_ledger(sequence)
Effects are the specific ways that the ledger was changed by any operation. This endpoint represents all effects that occurred in the given ledger.
See Retrieve a Ledger’s Effects for more information.
- for_liquidity_pool(liquidity_pool_id)
This endpoint represents all effects that occurred as a result of a given liquidity pool.
See Liquidity Pools - Retrieve related Effects for more information.
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
this EffectsCallBuilder instance
- for_operation(operation_id)
This endpoint represents all effects that occurred as a result of a given operation.
See Retrieve an Operation’s Effects for more information.
- for_transaction(transaction_hash)
This endpoint represents all effects that occurred as a result of a given transaction.
See Retrieve a Transaction’s Effects for more information.
- Parameters:
transaction_hash (
str
) – transaction hash- Returns:
this EffectCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
FeeStatsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.FeeStatsCallBuilder(horizon_url, client)[source]
Creates a new
FeeStatsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.fee_stats()
.See Fee Stats for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
LedgersCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.LedgersCallBuilder(horizon_url, client)[source]
Creates a new
LedgersCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.ledgers()
.See List All Ledgers for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- ledger(sequence)
Provides information on a single ledger.
See Retrieve a Ledger for more information.
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
LiquidityPoolsBuilder
- class stellar_sdk.call_builder.call_builder_sync.LiquidityPoolsBuilder(horizon_url, client)[source]
Creates a new
LiquidityPoolsBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.liquidity_pools()
.See List Liquidity Pools for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
Filter pools for a specific account
See List Liquidity Pools for more information.
- Parameters:
account_id (
str
) – account id- Returns:
current LiquidityPoolsBuilder instance
- for_reserves(reserves)
Get pools by reserves.
Horizon will provide an endpoint to find all liquidity pools which contain a given set of reserve assets.
See List Liquidity Pools for more information.
- Returns:
current LiquidityPoolsBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- liquidity_pool(liquidity_pool_id)
Provides information on a liquidity pool.
See Retrieve a Liquidity Pool for more information.
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
current LiquidityPoolsBuilder instance
OffersCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.OffersCallBuilder(horizon_url, client)[source]
Creates a new
OffersCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.offers()
.See List All Offers for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint represents all offers a given account has currently open and can be used in streaming mode.
See Retrieve an Account’s Offers for more information.
- Parameters:
account_id (
str
) – Account ID- Returns:
current PaymentsCallBuilder instance
- for_buying(buying)
Returns all offers buying an asset.
People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the current offers, allowing filtering by seller, selling_asset or buying_asset.
See List All Offers for more information.
- Parameters:
buying (
Asset
) – The asset being bought.- Returns:
this OffersCallBuilder instance
- for_seller(seller)
Returns all offers where the given account is the seller.
People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the current offers, allowing filtering by seller, selling_asset or buying_asset.
See List All Offers for more information.
- Parameters:
seller (
str
) – Account ID of the offer creator- Returns:
this OffersCallBuilder instance
- for_selling(selling)
Returns all offers selling an asset.
People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the current offers, allowing filtering by seller, selling_asset or buying_asset.
See List All Offers for more information.
- Parameters:
selling (
Asset
) – The asset being sold.- Returns:
this OffersCallBuilder instance
- for_sponsor(sponsor)
Filtering offers where the given account is sponsoring the offer entry.
See List All Offers for more information.
- Parameters:
sponsor (
str
) – the sponsor id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current OffersCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- offer(offer_id)
Returns information and links relating to a single offer.
See Retrieve an Offer for more information.
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
OperationsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.OperationsCallBuilder(horizon_url, client)[source]
Creates a new
OperationsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.operations()
.See List All Operations for more information.
- Parameters:
horizon_url – Horizon server URL.
client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint represents all operations that were included in valid transactions that affected a particular account.
See Retrieve an Account’s Operations for more information.
- Parameters:
account_id (
str
) – Account ID- Returns:
this OperationCallBuilder instance
- for_claimable_balance(claimable_balance_id)
This endpoint represents successful operations referencing a given claimable balance and can be used in streaming mode.
See Claimable Balances - Retrieve related Operations for more information.
- Parameters:
claimable_balance_id (
str
) – This claimable balance’s id encoded in a hex string representation.- Returns:
this OperationCallBuilder instance
- for_ledger(sequence)
This endpoint returns all operations that occurred in a given ledger.
See Retrieve a Ledger’s Operations for more information.
- for_liquidity_pool(liquidity_pool_id)
This endpoint represents all operations that are part of a given liquidity pool.
See Liquidity Pools - Retrieve related Operations for more information.
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
this OperationCallBuilder instance
- for_transaction(transaction_hash)
This endpoint represents all operations that are part of a given transaction.
See Retrieve a Transaction’s Operations for more information.
- Parameters:
transaction_hash (
str
) – Transaction Hash- Returns:
this OperationCallBuilder instance
- include_failed(include_failed)
Adds a parameter defining whether to include failed transactions. By default only operations of successful transactions are returned.
- Parameters:
include_failed (
bool
) – Set to True to include operations of failed transactions.- Returns:
current OperationsCallBuilder instance
- join(join)
join represents join param in queries, currently only supports transactions
- Parameters:
join (
str
) – join represents join param in queries, currently only supports transactions- Returns:
current OperationsCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- operation(operation_id)
The operation details endpoint provides information on a single operation. The operation ID provided in the id argument specifies which operation to load.
See Retrieve an Operation for more information.
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
OrderbookCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.OrderbookCallBuilder(horizon_url, client, selling, buying)[source]
Creates a new
OrderbookCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.orderbook()
.See Orderbook for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.selling (
Asset
) – Asset being soldbuying (
Asset
) – Asset being bought
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
PaymentsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.PaymentsCallBuilder(horizon_url, client)[source]
Creates a new
PaymentsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.payments()
.See List All Payments for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint responds with a collection of Payment operations where the given account was either the sender or receiver.
See Retrieve an Account’s Payments for more information.
- Parameters:
account_id (
str
) – Account ID- Returns:
current PaymentsCallBuilder instance
- for_ledger(sequence)
This endpoint represents all payment operations that are part of a valid transactions in a given ledger.
See Retrieve a Ledger’s Payments for more information.
- for_transaction(transaction_hash)
This endpoint represents all payment operations that are part of a given transaction.
P.S. The documentation provided by SDF seems to be missing this API.
- Parameters:
transaction_hash (
str
) – Transaction hash- Returns:
current PaymentsCallBuilder instance
- include_failed(include_failed)
Adds a parameter defining whether to include failed transactions. By default only payments of successful transactions are returned.
- Parameters:
include_failed (
bool
) – Set toTrue
to include payments of failed transactions.- Returns:
current PaymentsCallBuilder instance
- join(join)
join represents join param in queries, currently only supports transactions
- Parameters:
join (
str
) – join represents join param in queries, currently only supports transactions- Returns:
current OperationsCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
RootCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.RootCallBuilder(horizon_url, client)[source]
Creates a new
RootCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.root()
.- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
StrictReceivePathsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.StrictReceivePathsCallBuilder(horizon_url, client, source, destination_asset, destination_amount)[source]
Creates a new
StrictReceivePathsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.strict_receive_paths()
.The Stellar Network allows payments to be made across assets through path payments. A path payment specifies a series of assets to route a payment through, from source asset (the asset debited from the payer) to destination asset (the asset credited to the payee).
A path search is specified using:
The source address or source assets.
The asset and amount that the destination account should receive.
As part of the search, horizon will load a list of assets available to the source address and will find any payment paths from those source assets to the desired destination asset. The search’s amount parameter will be used to determine if there a given path can satisfy a payment of the desired amount.
If a list of assets is passed as the source, horizon will find any payment paths from those source assets to the desired destination asset.
See List Strict Receive Payment Paths for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.source (
Union
[str
,List
[Asset
]]) – The sender’s account ID or a list of Assets. Any returned path must use a source that the sender can hold.destination_asset (
Asset
) – The destination asset.destination_amount (
Union
[str
,Decimal
]) – The amount, denominated in the destination asset, that any returned path should be able to satisfy.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
StrictSendPathsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.StrictSendPathsCallBuilder(horizon_url, client, source_asset, source_amount, destination)[source]
Creates a new
StrictSendPathsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.strict_send_paths()
.The Stellar Network allows payments to be made across assets through path payments. A strict send path payment specifies a series of assets to route a payment through, from source asset (the asset debited from the payer) to destination asset (the asset credited to the payee).
A strict send path search is specified using:
The source asset
The source amount
The destination assets or destination account.
As part of the search, horizon will load a list of assets available to the source address and will find any payment paths from those source assets to the desired destination asset. The search’s source_amount parameter will be used to determine if there a given path can satisfy a payment of the desired amount.
See List Strict Send Payment Paths for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.source_asset (
Asset
) – The asset to be sent.source_amount (
Union
[str
,Decimal
]) – The amount, denominated in the source asset, that any returned path should be able to satisfy.destination (
Union
[str
,List
[Asset
]]) – The destination account or the destination assets.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
TradeAggregationsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.TradeAggregationsCallBuilder(horizon_url, client, base, counter, resolution, start_time=None, end_time=None, offset=None)[source]
Creates a new
TradeAggregationsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.trade_aggregations()
.Trade Aggregations facilitate efficient gathering of historical trade data.
See List Trade Aggregations for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.base (
Asset
) – base assetcounter (
Asset
) – counter assetresolution (
int
) – segment duration as millis since epoch. Supported values are 1 minute (60000), 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).start_time (
int
) – lower time boundary represented as millis since epochend_time (
int
) – upper time boundary represented as millis since epochoffset (
int
) – segments can be offset using this parameter. Expressed in milliseconds. Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
TradesCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.TradesCallBuilder(horizon_url, client)[source]
Creates a new
TradesCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.trades()
.See List All Trades for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
Filter trades for a specific account
See Retrieve an Account’s Trades for more information.
- Parameters:
account_id (
str
) – account id- Returns:
current TradesCallBuilder instance
- for_asset_pair(base, counter)
Filter trades for a specific asset pair (orderbook)
See List All Trades for more information.
- for_liquidity_pool(liquidity_pool_id)
Filter trades for a specific liquidity pool.
See Liquidity Pools - Retrieve related Trades
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
current TradesCallBuilder instance
- for_offer(offer_id)
Filter trades for a specific offer
See List All Trades for more information.
- for_trade_type(trade_type)
Filter trades for a specific trade type
Horizon will reject requests which attempt to set trade_type to
liquidity_pools
when using the offer id filter.- Parameters:
trade_type (
str
) – trade type, the currently supported types are"orderbook"
,"liquidity_pool"
and"all"
, defaults to"all"
.- Returns:
current TradesCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
TransactionsCallBuilder
- class stellar_sdk.call_builder.call_builder_sync.TransactionsCallBuilder(horizon_url, client)[source]
Creates a new
TransactionsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.Server.transactions()
.See List All Transactions for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseSyncClient
) – The client instance used to send request.
- call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint represents all transactions that affected a given account.
See Retrieve an Account’s Transactions for more information.
- Parameters:
account_id (
str
) – account id- Returns:
current TransactionsCallBuilder instance
- for_claimable_balance(claimable_balance_id)
This endpoint represents all transactions referencing a given claimable balance and can be used in streaming mode.
See Claimable Balances - Retrieve related Transactions
- Parameters:
claimable_balance_id (
str
) – This claimable balance’s id encoded in a hex string representation.- Returns:
current TransactionsCallBuilder instance
- for_ledger(sequence)
This endpoint represents all transactions in a given ledger.
See Retrieve a Ledger’s Transactions for more information.
- for_liquidity_pool(liquidity_pool_id)
This endpoint represents all transactions referencing a given liquidity pool.
See Liquidity Pools - Retrieve related Transactions
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
this TransactionsCallBuilder instance
- include_failed(include_failed)
Adds a parameter defining whether to include failed transactions. By default only transactions of successful transactions are returned.
- Parameters:
include_failed (
bool
) – Set to True to include failed transactions.- Returns:
current TransactionsCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- transaction(transaction_hash)
The transaction details endpoint provides information on a single transaction. The transaction hash provided in the hash argument specifies which transaction to load.
See Retrieve a Transaction for more information.
- Parameters:
transaction_hash (
str
) – transaction hash- Returns:
current TransactionsCallBuilder instance
Call Builder Async
AccountsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.AccountsCallBuilder(horizon_url, client)[source]
Creates a new
AccountsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.accounts()
.See List All Accounts for more information.
- Parameters:
horizon_url – Horizon server URL.
client (
BaseAsyncClient
) – The client instance used to send request.
- account_id(account_id)
Returns information and links relating to a single account. The balances section in the returned JSON will also list all the trust lines this account has set up.
See Retrieve an Account for more information.
- Parameters:
account_id (
str
) – account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current AccountCallBuilder instance
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_asset(asset)
Filtering accounts who have a trustline to an asset. The result is a list of accounts.
See List All Accounts for more information.
- Parameters:
asset (
Asset
) – an issued asset- Returns:
current AccountCallBuilder instance
- for_liquidity_pool(liquidity_pool_id)
Filtering accounts who have a trustline for the given pool. The result is a list of accounts.
See List All Accounts for more information.
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string., for example:"dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7"
- Returns:
current AccountCallBuilder instance
- for_signer(signer)
Filtering accounts who have a given signer. The result is a list of accounts.
See List All Accounts for more information.
- Parameters:
signer (
str
) – signer’s account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current AccountCallBuilder instance
- for_sponsor(sponsor)
Filtering accounts where the given account is sponsoring the account or any of its sub-entries.
See List All Accounts for more information.
- Parameters:
sponsor (
str
) – the sponsor id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current AccountCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
AssetsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.AssetsCallBuilder(horizon_url, client)[source]
Creates a new
AssetsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.assets()
.See List All Assets for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_code(asset_code)
This endpoint filters all assets by the asset code.
See List All Assets for more information.
- Parameters:
asset_code (
str
) – asset code, for example: USD- Returns:
current AssetCallBuilder instance
- for_issuer(asset_issuer)
This endpoint filters all assets by the asset issuer.
See List All Assets for more information.
- Parameters:
asset_issuer (
str
) – asset issuer, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current AssetCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
ClaimableBalancesCallBuilder
- class stellar_sdk.call_builder.call_builder_async.ClaimableBalancesCallBuilder(horizon_url, client)[source]
Creates a new
ClaimableBalancesCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.claimable_balance()
.See List Claimable Balances for more information.
- Parameters:
horizon_url – Horizon server URL.
client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- claimable_balance(claimable_balance_id)
Returns information and links relating to a single claimable balance.
See List Claimable Balances for more information.
- Parameters:
claimable_balance_id (
str
) – claimable balance id- Returns:
current AccountCallBuilder instance
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_asset(asset)
Returns all claimable balances which provide a balance for the given asset.
See List Claimable Balances for more information.
- Parameters:
asset (
Asset
) – an asset- Returns:
current ClaimableBalancesCallBuilder instance
- for_claimant(claimant)
Returns all claimable balances which can be claimed by the given account ID.
See List Claimable Balances for more information.
- Parameters:
claimant (
str
) – the account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current ClaimableBalancesCallBuilder instance
- for_sponsor(sponsor)
Returns all claimable balances which are sponsored by the given account ID.
See List Claimable Balances for more information.
- Parameters:
sponsor (
str
) – the sponsor id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current ClaimableBalancesCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
DataCallBuilder
- class stellar_sdk.call_builder.call_builder_async.DataCallBuilder(horizon_url, client, account_id, data_name)[source]
Creates a new
DataCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.data()
.See Retrieve an Account’s Data for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.account_id (
str
) – account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
data_name (
str
) – Key name
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
EffectsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.EffectsCallBuilder(horizon_url, client)[source]
Creates a new
EffectsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.effects()
.See List All Effects for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint represents all effects that changed a given account. It will return relevant effects from the creation of the account to the current ledger.
See Retrieve an Account’s Effects for more information.
- Parameters:
account_id (
str
) – account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
this EffectCallBuilder instance
- for_ledger(sequence)
Effects are the specific ways that the ledger was changed by any operation. This endpoint represents all effects that occurred in the given ledger.
See Retrieve a Ledger’s Effects for more information.
- for_liquidity_pool(liquidity_pool_id)
This endpoint represents all effects that occurred as a result of a given liquidity pool.
See Liquidity Pools - Retrieve related Effects for more information.
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
this EffectsCallBuilder instance
- for_operation(operation_id)
This endpoint represents all effects that occurred as a result of a given operation.
See Retrieve an Operation’s Effects for more information.
- for_transaction(transaction_hash)
This endpoint represents all effects that occurred as a result of a given transaction.
See Retrieve a Transaction’s Effects for more information.
- Parameters:
transaction_hash (
str
) – transaction hash- Returns:
this EffectCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
FeeStatsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.FeeStatsCallBuilder(horizon_url, client)[source]
Creates a new
FeeStatsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.fee_stats()
.See Fee Stats for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
LedgersCallBuilder
- class stellar_sdk.call_builder.call_builder_async.LedgersCallBuilder(horizon_url, client)[source]
Creates a new
LedgersCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.ledgers()
.See List All Ledgers for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- ledger(sequence)
Provides information on a single ledger.
See Retrieve a Ledger for more information.
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
LiquidityPoolsBuilder
- class stellar_sdk.call_builder.call_builder_async.LiquidityPoolsBuilder(horizon_url, client)[source]
Creates a new
LiquidityPoolsBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.liquidity_pools()
.See List Liquidity Pools for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
Filter pools for a specific account
See List Liquidity Pools for more information.
- Parameters:
account_id (
str
) – account id- Returns:
current LiquidityPoolsBuilder instance
- for_reserves(reserves)
Get pools by reserves.
Horizon will provide an endpoint to find all liquidity pools which contain a given set of reserve assets.
See List Liquidity Pools for more information.
- Returns:
current LiquidityPoolsBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- liquidity_pool(liquidity_pool_id)
Provides information on a liquidity pool.
See Retrieve a Liquidity Pool for more information.
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
current LiquidityPoolsBuilder instance
OffersCallBuilder
- class stellar_sdk.call_builder.call_builder_async.OffersCallBuilder(horizon_url, client)[source]
Creates a new
OffersCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.offers()
.See List All Offers for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint represents all offers a given account has currently open and can be used in streaming mode.
See Retrieve an Account’s Offers for more information.
- Parameters:
account_id (
str
) – Account ID- Returns:
current PaymentsCallBuilder instance
- for_buying(buying)
Returns all offers buying an asset.
People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the current offers, allowing filtering by seller, selling_asset or buying_asset.
See List All Offers for more information.
- Parameters:
buying (
Asset
) – The asset being bought.- Returns:
this OffersCallBuilder instance
- for_seller(seller)
Returns all offers where the given account is the seller.
People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the current offers, allowing filtering by seller, selling_asset or buying_asset.
See List All Offers for more information.
- Parameters:
seller (
str
) – Account ID of the offer creator- Returns:
this OffersCallBuilder instance
- for_selling(selling)
Returns all offers selling an asset.
People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the current offers, allowing filtering by seller, selling_asset or buying_asset.
See List All Offers for more information.
- Parameters:
selling (
Asset
) – The asset being sold.- Returns:
this OffersCallBuilder instance
- for_sponsor(sponsor)
Filtering offers where the given account is sponsoring the offer entry.
See List All Offers for more information.
- Parameters:
sponsor (
str
) – the sponsor id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
- Returns:
current OffersCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- offer(offer_id)
Returns information and links relating to a single offer.
See Retrieve an Offer for more information.
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
OperationsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.OperationsCallBuilder(horizon_url, client)[source]
Creates a new
OperationsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.operations()
.See List All Operations for more information.
- Parameters:
horizon_url – Horizon server URL.
client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint represents all operations that were included in valid transactions that affected a particular account.
See Retrieve an Account’s Operations for more information.
- Parameters:
account_id (
str
) – Account ID- Returns:
this OperationCallBuilder instance
- for_claimable_balance(claimable_balance_id)
This endpoint represents successful operations referencing a given claimable balance and can be used in streaming mode.
See Claimable Balances - Retrieve related Operations for more information.
- Parameters:
claimable_balance_id (
str
) – This claimable balance’s id encoded in a hex string representation.- Returns:
this OperationCallBuilder instance
- for_ledger(sequence)
This endpoint returns all operations that occurred in a given ledger.
See Retrieve a Ledger’s Operations for more information.
- for_liquidity_pool(liquidity_pool_id)
This endpoint represents all operations that are part of a given liquidity pool.
See Liquidity Pools - Retrieve related Operations for more information.
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
this OperationCallBuilder instance
- for_transaction(transaction_hash)
This endpoint represents all operations that are part of a given transaction.
See Retrieve a Transaction’s Operations for more information.
- Parameters:
transaction_hash (
str
) – Transaction Hash- Returns:
this OperationCallBuilder instance
- include_failed(include_failed)
Adds a parameter defining whether to include failed transactions. By default only operations of successful transactions are returned.
- Parameters:
include_failed (
bool
) – Set to True to include operations of failed transactions.- Returns:
current OperationsCallBuilder instance
- join(join)
join represents join param in queries, currently only supports transactions
- Parameters:
join (
str
) – join represents join param in queries, currently only supports transactions- Returns:
current OperationsCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- operation(operation_id)
The operation details endpoint provides information on a single operation. The operation ID provided in the id argument specifies which operation to load.
See Retrieve an Operation for more information.
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
OrderbookCallBuilder
- class stellar_sdk.call_builder.call_builder_async.OrderbookCallBuilder(horizon_url, client, selling, buying)[source]
Creates a new
OrderbookCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.orderbook()
.See Orderbook for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.selling (
Asset
) – Asset being soldbuying (
Asset
) – Asset being bought
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
PaymentsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.PaymentsCallBuilder(horizon_url, client)[source]
Creates a new
PaymentsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.payments()
.See List All Payments for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint responds with a collection of Payment operations where the given account was either the sender or receiver.
See Retrieve an Account’s Payments for more information.
- Parameters:
account_id (
str
) – Account ID- Returns:
current PaymentsCallBuilder instance
- for_ledger(sequence)
This endpoint represents all payment operations that are part of a valid transactions in a given ledger.
See Retrieve a Ledger’s Payments for more information.
- for_transaction(transaction_hash)
This endpoint represents all payment operations that are part of a given transaction.
P.S. The documentation provided by SDF seems to be missing this API.
- Parameters:
transaction_hash (
str
) – Transaction hash- Returns:
current PaymentsCallBuilder instance
- include_failed(include_failed)
Adds a parameter defining whether to include failed transactions. By default only payments of successful transactions are returned.
- Parameters:
include_failed (
bool
) – Set toTrue
to include payments of failed transactions.- Returns:
current PaymentsCallBuilder instance
- join(join)
join represents join param in queries, currently only supports transactions
- Parameters:
join (
str
) – join represents join param in queries, currently only supports transactions- Returns:
current OperationsCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
RootCallBuilder
- class stellar_sdk.call_builder.call_builder_async.RootCallBuilder(horizon_url, client)[source]
Creates a new
RootCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.root()
.- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
StrictReceivePathsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.StrictReceivePathsCallBuilder(horizon_url, client, source, destination_asset, destination_amount)[source]
Creates a new
StrictReceivePathsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.strict_receive_paths()
.The Stellar Network allows payments to be made across assets through path payments. A path payment specifies a series of assets to route a payment through, from source asset (the asset debited from the payer) to destination asset (the asset credited to the payee).
A path search is specified using:
The source address or source assets.
The asset and amount that the destination account should receive.
As part of the search, horizon will load a list of assets available to the source address and will find any payment paths from those source assets to the desired destination asset. The search’s amount parameter will be used to determine if there a given path can satisfy a payment of the desired amount.
If a list of assets is passed as the source, horizon will find any payment paths from those source assets to the desired destination asset.
See List Strict Receive Payment Paths for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.source (
Union
[str
,List
[Asset
]]) – The sender’s account ID or a list of Assets. Any returned path must use a source that the sender can hold.destination_asset (
Asset
) – The destination asset.destination_amount (
Union
[str
,Decimal
]) – The amount, denominated in the destination asset, that any returned path should be able to satisfy.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
StrictSendPathsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.StrictSendPathsCallBuilder(horizon_url, client, source_asset, source_amount, destination)[source]
Creates a new
StrictSendPathsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.strict_send_paths()
.The Stellar Network allows payments to be made across assets through path payments. A strict send path payment specifies a series of assets to route a payment through, from source asset (the asset debited from the payer) to destination asset (the asset credited to the payee).
A strict send path search is specified using:
The source asset
The source amount
The destination assets or destination account.
As part of the search, horizon will load a list of assets available to the source address and will find any payment paths from those source assets to the desired destination asset. The search’s source_amount parameter will be used to determine if there a given path can satisfy a payment of the desired amount.
See List Strict Send Payment Paths for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.source_asset (
Asset
) – The asset to be sent.source_amount (
Union
[str
,Decimal
]) – The amount, denominated in the source asset, that any returned path should be able to satisfy.destination (
Union
[str
,List
[Asset
]]) – The destination account or the destination assets.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
TradeAggregationsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.TradeAggregationsCallBuilder(horizon_url, client, base, counter, resolution, start_time=None, end_time=None, offset=None)[source]
Creates a new
TradeAggregationsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.trade_aggregations()
.Trade Aggregations facilitate efficient gathering of historical trade data.
See List Trade Aggregations for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.base (
Asset
) – base assetcounter (
Asset
) – counter assetresolution (
int
) – segment duration as millis since epoch. Supported values are 1 minute (60000), 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).start_time (
int
) – lower time boundary represented as millis since epochend_time (
int
) – upper time boundary represented as millis since epochoffset (
int
) – segments can be offset using this parameter. Expressed in milliseconds. Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
TradesCallBuilder
- class stellar_sdk.call_builder.call_builder_async.TradesCallBuilder(horizon_url, client)[source]
Creates a new
TradesCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.trades()
.See List All Trades for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
Filter trades for a specific account
See Retrieve an Account’s Trades for more information.
- Parameters:
account_id (
str
) – account id- Returns:
current TradesCallBuilder instance
- for_asset_pair(base, counter)
Filter trades for a specific asset pair (orderbook)
See List All Trades for more information.
- for_liquidity_pool(liquidity_pool_id)
Filter trades for a specific liquidity pool.
See Liquidity Pools - Retrieve related Trades
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
current TradesCallBuilder instance
- for_offer(offer_id)
Filter trades for a specific offer
See List All Trades for more information.
- for_trade_type(trade_type)
Filter trades for a specific trade type
Horizon will reject requests which attempt to set trade_type to
liquidity_pools
when using the offer id filter.- Parameters:
trade_type (
str
) – trade type, the currently supported types are"orderbook"
,"liquidity_pool"
and"all"
, defaults to"all"
.- Returns:
current TradesCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
TransactionsCallBuilder
- class stellar_sdk.call_builder.call_builder_async.TransactionsCallBuilder(horizon_url, client)[source]
Creates a new
TransactionsCallBuilder
pointed to server defined by horizon_url. Do not create this object directly, usestellar_sdk.ServerAsync.transactions()
.See List All Transactions for more information.
- Parameters:
horizon_url (
str
) – Horizon server URL.client (
BaseAsyncClient
) – The client instance used to send request.
- async call()
Triggers a HTTP request using this builder’s current configuration.
- Return type:
- Returns:
If it is called synchronous, the response will be returned. If it is called asynchronously, it will return Coroutine.
- Raises:
ConnectionError
: if you have not successfully connected to the server.NotFoundError
: if status_code == 404BadRequestError
: if 400 <= status_code < 500 and status_code != 404BadResponseError
: if 500 <= status_code < 600UnknownRequestError
: if an unknown error occurs, please submit an issue
- cursor(cursor)
Sets
cursor
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- for_account(account_id)
This endpoint represents all transactions that affected a given account.
See Retrieve an Account’s Transactions for more information.
- Parameters:
account_id (
str
) – account id- Returns:
current TransactionsCallBuilder instance
- for_claimable_balance(claimable_balance_id)
This endpoint represents all transactions referencing a given claimable balance and can be used in streaming mode.
See Claimable Balances - Retrieve related Transactions
- Parameters:
claimable_balance_id (
str
) – This claimable balance’s id encoded in a hex string representation.- Returns:
current TransactionsCallBuilder instance
- for_ledger(sequence)
This endpoint represents all transactions in a given ledger.
See Retrieve a Ledger’s Transactions for more information.
- for_liquidity_pool(liquidity_pool_id)
This endpoint represents all transactions referencing a given liquidity pool.
See Liquidity Pools - Retrieve related Transactions
- Parameters:
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Returns:
this TransactionsCallBuilder instance
- include_failed(include_failed)
Adds a parameter defining whether to include failed transactions. By default only transactions of successful transactions are returned.
- Parameters:
include_failed (
bool
) – Set to True to include failed transactions.- Returns:
current TransactionsCallBuilder instance
- limit(limit)
Sets
limit
parameter for the current call. Returns the CallBuilder object on which this method has been called.See Pagination
- Parameters:
limit (
int
) – Number of records the server should return.- Returns:
- order(desc=True)
Sets order parameter for the current call. Returns the CallBuilder object on which this method has been called.
- Parameters:
desc (
bool
) – Sort direction,True
to get desc sort direction, the default setting isTrue
.- Returns:
current CallBuilder instance
- async stream()
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
an EventSource.
- Raise:
StreamClientError
- Failed to fetch stream resource.
- transaction(transaction_hash)
The transaction details endpoint provides information on a single transaction. The transaction hash provided in the hash argument specifies which transaction to load.
See Retrieve a Transaction for more information.
- Parameters:
transaction_hash (
str
) – transaction hash- Returns:
current TransactionsCallBuilder instance
Client
BaseAsyncClient
- class stellar_sdk.client.base_async_client.BaseAsyncClient[source]
This is an abstract class, and if you want to implement your own asynchronous client, you must implement this class.
- abstract stream(url, params=None)[source]
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
- Parameters:
- Return type:
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns:
a dict AsyncGenerator for server response
- Raise:
BaseSyncClient
- class stellar_sdk.client.base_sync_client.BaseSyncClient[source]
This is an abstract class, and if you want to implement your own synchronous client, you must implement this class.
- abstract stream(url, params=None)[source]
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
AiohttpClient
- class stellar_sdk.client.aiohttp_client.AiohttpClient(pool_size=None, request_timeout=11, post_timeout=33.0, backoff_factor=0.5, user_agent=None, custom_headers=None, **kwargs)[source]
The
AiohttpClient
object is a asynchronous http client, which represents the interface for making requests to a server instance.- Parameters:
pool_size (
Optional
[int
]) – persistent connection to Horizon and connection poolrequest_timeout (
float
) – the timeout for all GET requestspost_timeout (
float
) – the timeout for all POST requestsbackoff_factor (
Optional
[float
]) – a backoff factor to apply between attempts after the second tryuser_agent (
Optional
[str
]) – the server can use it to identify youcustom_headers (
Optional
[Dict
[str
,str
]]) – any additional HTTP headers to add in requests