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.raw_data (
Optional
[Dict
[str
,Any
]]) – Raw horizon response data.
- 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"
)
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(cls, 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(cls)[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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
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 (
Optional
[int
]) – lower time boundary represented as millis since epochend_time (
Optional
[int
]) – upper time boundary represented as millis since epochoffset (
Optional
[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
- 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
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_pools"
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
- 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
- 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
- Return type
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns
an EventSource.
- Raise
StreamClientError
- Failed to fetch stream resource.
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
- 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
- Return type
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns
an EventSource.
- Raise
StreamClientError
- Failed to fetch stream resource.
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
- 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
- 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
- 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
- Return type
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns
an EventSource.
- Raise
StreamClientError
- Failed to fetch stream resource.
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
- 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
- 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
- Return type
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns
an EventSource.
- Raise
StreamClientError
- Failed to fetch stream resource.
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
- 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
- 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
- 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
- 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
- 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
- Return type
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns
an EventSource.
- Raise
StreamClientError
- Failed to fetch stream resource.
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
- 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
- Return type
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns
an EventSource.
- Raise
StreamClientError
- Failed to fetch stream resource.
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
- 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
- Return type
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns
an EventSource.
- Raise
StreamClientError
- Failed to fetch stream resource.
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 (
Optional
[int
]) – lower time boundary represented as millis since epochend_time (
Optional
[int
]) – upper time boundary represented as millis since epochoffset (
Optional
[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
- 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
- Return type
AsyncGenerator
[Dict
[str
,Any
],None
]- Returns
an EventSource.
- Raise
StreamClientError
- Failed to fetch stream resource.
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_pools"
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
- 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
- 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
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
RequestsClient¶
- class stellar_sdk.client.requests_client.RequestsClient(pool_size=10, num_retries=3, request_timeout=11, post_timeout=33.0, backoff_factor=0.5, session=None, stream_session=None, custom_headers=None)[source]¶
The
RequestsClient
object is a synchronous http client, which represents the interface for making requests to a server instance.- Parameters
pool_size (
int
) – persistent connection to Horizon and connection poolnum_retries (
int
) – configurable request retry functionalityrequest_timeout (
int
) – the timeout for all GET requestspost_timeout (
float
) – the timeout for all POST requestsbackoff_factor (
float
) – a backoff factor to apply between attempts after the second trysession (
Optional
[Session
]) – the request sessionstream_session (
Optional
[Session
]) – the stream request sessioncustom_headers (
Optional
[Dict
[str
,str
]]) – any additional HTTP headers to add in requests
- stream(url, params=None)[source]¶
Creates an EventSource that listens for incoming messages from the server.
See MDN EventSource
SimpleRequestsClient¶
- class stellar_sdk.client.simple_requests_client.SimpleRequestsClient[source]¶
The
SimpleRequestsClient
object is a synchronous http client, which represents the interface for making requests to a server instance.This client is to guide you in writing a client that suits your needs. I don’t recommend that you actually use it.
Response¶
Exceptions¶
SdkError¶
BadSignatureError¶
Ed25519PublicKeyInvalidError¶
Ed25519SecretSeedInvalidError¶
MissingEd25519SecretSeedError¶
MemoInvalidException¶
AssetCodeInvalidError¶
AssetIssuerInvalidError¶
NoApproximationError¶
SignatureExistError¶
BaseRequestError¶
ConnectionError¶
BaseHorizonError¶
NotFoundError¶
BadRequestError¶
BadResponseError¶
FeatureNotEnabledError¶
Keypair¶
- class stellar_sdk.keypair.Keypair(verify_key, signing_key=None)[source]¶
The
Keypair
object, which represents a signing and verifying key for use with the Stellar network.Instead of instantiating the class directly, we recommend using one of several class methods:
Learn how to create a key through our documentation: Generate Keypair.
- Parameters
verify_key (
VerifyKey
) – The verifying (public) Ed25519 key in the keypair.signing_key (
Optional
[SigningKey
]) – The signing (private) Ed25519 key in the keypair.
- classmethod from_mnemonic_phrase(cls, mnemonic_phrase, language=Language.ENGLISH, passphrase='', index=0)[source]¶
Generate a
Keypair
object via a mnemonic phrase.- Parameters
mnemonic_phrase (
str
) – A unique string used to deterministically generate keypairs.language (
Union
[Language
,str
]) – The language of the mnemonic phrase, defaults to english.passphrase (
str
) – An optional passphrase used as part of the salt during PBKDF2 rounds when generating the seed from the mnemonic.index (
int
) –The index of the keypair generated by the mnemonic. This allows for multiple Keypairs to be derived from the same mnemonic, such as:
>>> from stellar_sdk.keypair import Keypair >>> mnemonic = 'update hello cry airport drive chunk elite boat shaft sea describe number' # Don't use this mnemonic in practice. >>> kp1 = Keypair.from_mnemonic_phrase(mnemonic, index=0) >>> kp2 = Keypair.from_mnemonic_phrase(mnemonic, index=1) >>> kp3 = Keypair.from_mnemonic_phrase(mnemonic, index=2)
- Return type
- Returns
A new
Keypair
object derived from the mnemonic.
- classmethod from_public_key(cls, public_key)[source]¶
Generate a
Keypair
object from a public key.- Parameters
public_key (
str
) – public key (ex."GATPGGOIE6VWADVKD3ER3IFO2IH6DTOA5G535ITB3TT66FZFSIZEAU2B"
)- Return type
- Returns
A new
Keypair
object derived by the public key.- Raise
Ed25519PublicKeyInvalidError
: if public_key is not a valid ed25519 public key.
- classmethod from_raw_ed25519_public_key(cls, raw_public_key)[source]¶
Generate a
Keypair
object from ed25519 public key raw bytes.
- classmethod from_raw_ed25519_seed(cls, raw_seed)[source]¶
Generate a
Keypair
object from ed25519 secret key seed raw bytes.
- classmethod from_secret(cls, secret)[source]¶
Generate a
Keypair
object from a secret key.- Parameters
secret (
str
) – secret key (ex."SB2LHKBL24ITV2Y346BU46XPEL45BDAFOOJLZ6SESCJZ6V5JMP7D6G5X"
)- Return type
- Returns
A new
Keypair
object derived by the secret.- Raise
Ed25519SecretSeedInvalidError
: if secret is not a valid ed25519 secret seed.
- static generate_mnemonic_phrase(language=Language.ENGLISH, strength=128)[source]¶
Generate a mnemonic phrase.
- property secret: str¶
Returns secret key associated with this
Keypair
object- Returns
secret key
- Raise
MissingEd25519SecretSeedError
TheKeypair
does not contain secret seed
- sign(data)[source]¶
Sign the provided data with the keypair’s private key.
- Parameters
data (
bytes
) – The data to sign.- Return type
- Returns
signed bytes
- Raise
MissingEd25519SecretSeedError
: ifKeypair
does not contain secret seed.
- sign_decorated(data)[source]¶
Sign the provided data with the keypair’s private key and returns DecoratedSignature.
- Parameters
data (
bytes
) – signed bytes- Return type
- Returns
sign decorated
- sign_payload_decorated(data)[source]¶
Returns the decorated signature hint for a signed payload signer.
The signature hint of an ed25519 signed payload signer is the last 4 bytes of the ed25519 public key XORed with last 4 bytes of the payload. If the payload has a length less than 4 bytes, then 1 to 4 zero bytes are appended to the payload such that it has a length of 4 bytes, for calculating the hint.
- Parameters
data (
bytes
) – data to both sign and treat as the payload- Return type
- Returns
sign decorated
- signature_hint()[source]¶
Returns signature hint associated with this
Keypair
object- Return type
- Returns
signature hint
- verify(data, signature)[source]¶
Verify the provided data and signature match this keypair’s public key.
- Parameters
- Raise
BadSignatureError
: if the verification failed and the signature was incorrect.- Return type
LiquidityPoolAsset¶
- stellar_sdk.liquidity_pool_asset.LIQUIDITY_POOL_FEE_V18 = 30¶
LIQUIDITY_POOL_FEE_V18 is the default liquidity pool fee in protocol v18. It defaults to 30 base points (0.3%).
- class stellar_sdk.liquidity_pool_asset.LiquidityPoolAsset(asset_a, asset_b, fee=30)[source]¶
The
LiquidityPoolAsset
object, which represents a liquidity pool trustline change.- Parameters
asset_a (
Asset
) – The first asset in the Pool, it must respect the rule asset_a < asset_b. Seestellar_sdk.liquidity_pool_asset.LiquidityPoolAsset.is_valid_lexicographic_order()
for more details on how assets are sorted.asset_b (
Asset
) – The second asset in the Pool, it must respect the rule asset_a < asset_b. Seestellar_sdk.liquidity_pool_asset.LiquidityPoolAsset.is_valid_lexicographic_order()
for more details on how assets are sorted.fee (
int
) – The liquidity pool fee. For now the only fee supported is 30.
- Raise
ValueError
- classmethod from_xdr_object(cls, xdr_object)[source]¶
Create a
LiquidityPoolAsset
from an XDR ChangeTrustAsset object.- Parameters
xdr_object (
ChangeTrustAsset
) – The XDR ChangeTrustAsset object.- Return type
- Returns
A new
LiquidityPoolAsset
object from the given XDR ChangeTrustAsset object.
- static is_valid_lexicographic_order(asset_a, asset_b)[source]¶
Compares if asset_a < asset_b according with the criteria:
First compare the type (eg. native before alphanum4 before alphanum12).
If the types are equal, compare the assets codes.
If the asset codes are equal, compare the issuers.
- property liquidity_pool_id: str¶
Computes the liquidity pool id for current instance.
- Returns
Liquidity pool id.
LiquidityPoolId¶
- class stellar_sdk.liquidity_pool_id.LiquidityPoolId(liquidity_pool_id)[source]¶
The
LiquidityPoolId
object, which represents the asset referenced by a trustline to a liquidity pool.- Parameters
liquidity_pool_id (
str
) – The ID of the liquidity pool in hex string.- Raise
ValueError
- classmethod from_xdr_object(cls, xdr_object)[source]¶
Create a
LiquidityPoolId
from an XDR Asset object.- Parameters
xdr_object (
TrustLineAsset
) – The XDR TrustLineAsset object.- Return type
- Returns
A new
LiquidityPoolId
object from the given XDR TrustLineAsset object.
Memo¶
Memo¶
- class stellar_sdk.memo.Memo[source]¶
The
Memo
object, which represents the base class for memos for use with Stellar transactions.The memo for a transaction contains optional extra information about the transaction taking place. It is the responsibility of the client to interpret this value.
See the following implementations that serve a more practical use with the library:
NoneMemo
- No memo.TextMemo
- A string encoded using either ASCII or UTF-8, up to 28-bytes long.IdMemo
- A 64 bit unsigned integer.HashMemo
- A 32 byte hash.RetHashMemo
- A 32 byte hash intended to be interpreted as the hash of the transaction the sender is refunding.
See Stellar’s documentation on Transactions for more information on how memos are used within transactions, as well as information on the available types of memos.
NoneMemo¶
TextMemo¶
- class stellar_sdk.memo.TextMemo(text)[source]¶
The
TextMemo
, which representsMEMO_TEXT
in a transaction.- Parameters
text (
Union
[str
,bytes
]) – A string encoded using either ASCII or UTF-8, up to 28-bytes long. Note, text can be anything, see this issue for more information.- Raises
MemoInvalidException
: iftext
is not a valid text memo.
IdMemo¶
- class stellar_sdk.memo.IdMemo(memo_id)[source]¶
The
IdMemo
which representsMEMO_ID
in a transaction.- Parameters
memo_id (
int
) – A 64 bit unsigned integer.- Raises
MemoInvalidException
: ifid
is not a valid id memo.
HashMemo¶
- class stellar_sdk.memo.HashMemo(memo_hash)[source]¶
The
HashMemo
which representsMEMO_HASH
in a transaction.- Parameters
memo_hash (
Union
[bytes
,str
]) – A 32 byte hash hex encoded string.- Raises
MemoInvalidException
: ifmemo_hash
is not a valid hash memo.
ReturnHashMemo¶
- class stellar_sdk.memo.ReturnHashMemo(memo_return)[source]¶
The
ReturnHashMemo
which representsMEMO_RETURN
in a transaction.MEMO_RETURN is typically used with refunds/returns over the network - it is a 32 byte hash intended to be interpreted as the hash of the transaction the sender is refunding.
- Parameters
memo_return (
Union
[bytes
,str
]) – A 32 byte hash or hex encoded string intended to be interpreted as the hash of the transaction the sender is refunding.- Raises
MemoInvalidException
: ifmemo_return
is not a valid return hash memo.
- classmethod from_xdr_object(cls, xdr_object)[source]¶
Returns an
ReturnHashMemo
object from XDR memo object.- Return type
- to_xdr_object()[source]¶
Creates an XDR Memo object that represents this
ReturnHashMemo
.- Return type
MuxedAccount¶
- class stellar_sdk.muxed_account.MuxedAccount(account_id, account_muxed_id=None)[source]¶
The
MuxedAccount
object, which represents a multiplexed account on Stellar’s network.An example:
from stellar_sdk import MuxedAccount account_id = "GAQAA5L65LSYH7CQ3VTJ7F3HHLGCL3DSLAR2Y47263D56MNNGHSQSTVY" account_muxed_id = 1234 account_muxed = "MAQAA5L65LSYH7CQ3VTJ7F3HHLGCL3DSLAR2Y47263D56MNNGHSQSAAAAAAAAAAE2LP26" # generate account_muxed muxed = MuxedAccount(account=account_id, account_muxed_id=1234) # account_muxed_id is optional. print(f"account_muxed: {muxed.account_muxed}") # `account_muxed` returns ``None`` if `account_muxed_id` is ``None``. # parse account_muxed muxed = MuxedAccount.from_account(account_muxed) print(f"account_id: {muxed.account_id}\n" f"account_muxed_id: {muxed.account_muxed_id}")
See SEP-0023 for more information.
- Parameters
account_id (
str
) – ed25519 account id, for example:"GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
. It should be a string starting withG
. If you want to build a MuxedAccount object using an address starting withM
, please usestellar_sdk.MuxedAccount.from_account()
.account_muxed_id (
Optional
[int
]) – account multiplexing id (ex.1234
)
- property account_muxed: Optional[str]¶
Get the multiplex address starting with
M
, returnNone
if account_id_id isNone
.
- classmethod from_account(cls, account)[source]¶
Create a
MuxedAccount
object from account id or muxed account id.- Parameters
account (
str
) – account id or muxed account id (ex."GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
or"MAAAAAAAAAAAJURAAB2X52XFQP6FBXLGT6LWOOWMEXWHEWBDVRZ7V5WH34Y22MPFBHUHY"
)- Return type
- classmethod from_xdr_object(cls, xdr_object)[source]¶
Create a
MuxedAccount
object from an XDR Asset object.- Parameters
xdr_object (
MuxedAccount
) – The MuxedAccount object.- Return type
- Returns
A new
MuxedAccount
object from the given XDR MuxedAccount object.
- to_xdr_object()[source]¶
Returns the xdr object for this MuxedAccount object.
- Return type
- Returns
XDR MuxedAccount object
- property universal_account_id: str¶
Get the universal account id, if account_muxed_id is
None
, it will return ed25519 public key (ex."GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD"
), otherwise it will return muxed account (ex."MAAAAAAAAAAAJURAAB2X52XFQP6FBXLGT6LWOOWMEXWHEWBDVRZ7V5WH34Y22MPFBHUHY"
)
Network¶
- class stellar_sdk.network.Network(network_passphrase)[source]¶
The
Network
object, which represents a Stellar network.This class represents such a stellar network such as the Public network and the Test network.
- Parameters
network_passphrase (
str
) – The passphrase for the network. (ex."Public Global Stellar Network ; September 2015"
)
-
PUBLIC_NETWORK_PASSPHRASE:
str
= 'Public Global Stellar Network ; September 2015'¶ The Public network passphrase.
- network_id()[source]¶
Get the network ID of the network, which is an hash of the passphrase.
- Return type
- Returns
The network ID of the network.
Operation¶
Operation¶
- class stellar_sdk.operation.Operation(source=None)[source]¶
The
Operation
object, which represents an operation on Stellar’s network.An operation is an individual command that mutates Stellar’s ledger. It is typically rolled up into a transaction (a transaction is a list of operations with additional metadata).
Operations are executed on behalf of the source account specified in the transaction, unless there is an override defined for the operation.
For more on operations, see Stellar’s documentation on operations as well as Stellar’s List of Operations, which includes information such as the security necessary for a given operation, as well as information about when validity checks occur on the network.
The
Operation
class is typically not used, but rather one of its subclasses is typically included in transactions.- Parameters
source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.