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"
)Note
SEP-0023 support is not enabled by default, if you want to enable it, please set ENABLE_SEP_0023 to
true
in the environment variable, on Linux and MacOS, generally you can useexport ENABLE_SEP_0023=true
to set it.- Raises
FeatureNotEnabledError
: if account_id is a muxed account and ENABLE_SEP_0023 is not set totrue
.- Return type
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 an asset 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_ALPHANUM4
- 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_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_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 (
str
) – 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 (
str
) – 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_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_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 (
str
) – 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 (
str
) – 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 async 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, **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 you
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)[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 session
- 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 public_key: str
Returns public key associated with this
Keypair
object- Return type
- Returns
public key
- property secret: str
Returns secret key associated with this
Keypair
object- Return type
- 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
- 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.
- Return type
- 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.Note
SEP-0023 support is not enabled by default, if you want to enable it, please set ENABLE_SEP_0023 to
true
in the environment variable, on Linux and MacOS, generally you can useexport ENABLE_SEP_0023=true
to set it.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
.Note
SEP-0023 support is not enabled by default, if you want to enable it, please set ENABLE_SEP_0023 to
true
in the environment variable, on Linux and MacOS, generally you can useexport ENABLE_SEP_0023=true
to set it.- Raises
FeatureNotEnabledError
: if ENABLE_SEP_0023 is not set totrue
.- Return type
- 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"
)Note
SEP-0023 support is not enabled by default, if you want to enable it, please set ENABLE_SEP_0023 to
true
in the environment variable, on Linux and MacOS, generally you can useexport ENABLE_SEP_0023=true
to set it.- Raises
FeatureNotEnabledError
: if account_muxed_id is notNone
and ENABLE_SEP_0023 is not set totrue
.- Return type
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.
- classmethod from_xdr_object(cls, xdr_object)[source]
Create the appropriate
Operation
subclass from the XDR object.
- static get_source_from_xdr_obj(xdr_object)[source]
Get the source account from account the operation xdr object.
- Parameters
xdr_object (
Operation
) – the operation xdr object.- Return type
- Returns
The source account from account the operation xdr object.
- static to_xdr_amount(value)[source]
Converts an amount to the appropriate value to send over the network as a part of an XDR object.
Each asset amount is encoded as a signed 64-bit integer in the XDR structures. An asset amount unit (that which is seen by end users) is scaled down by a factor of ten million (10,000,000) to arrive at the native 64-bit integer representation. For example, the integer amount value 25,123,456 equals 2.5123456 units of the asset. This scaling allows for seven decimal places of precision in human-friendly amount units.
This static method correctly multiplies the value by the scaling factor in order to come to the integer value used in XDR structures.
See Stellar’s documentation on Asset Precision for more information.
AccountMerge
- class stellar_sdk.operation.AccountMerge(destination, source=None)[source]
The
AccountMerge
object, which represents a AccountMerge operation on Stellar’s network.Transfers the native balance (the amount of XLM an account holds) to another account and removes the source account from the ledger.
Threshold: High
See Account Merge for more information.
- Parameters
destination (
Union
[MuxedAccount
,str
]) – Destination to merge the source account into.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
AccountMerge
object from an XDR Operation object.- Return type
AllowTrust
- class stellar_sdk.operation.AllowTrust(trustor, asset_code, authorize, source=None)[source]
The
AllowTrust
object, which represents a AllowTrust operation on Stellar’s network.Updates the authorized flag of an existing trustline. This can only be called by the issuer of a trustline’s asset.
The issuer can only clear the authorized flag if the issuer has the
AUTH_REVOCABLE_FLAG
set. Otherwise, the issuer can only set the authorized flag.Threshold: Low
See Allow Trust for more information.
- Parameters
trustor (
str
) – The trusting account (the one being authorized).asset_code (
str
) – The asset code being authorized.authorize (
Union
[TrustLineEntryFlag
,bool
]) – True to authorize the line, False to deauthorize,if you need further control, you can also usestellar_sdk.operation.allow_trust.TrustLineEntryFlag
.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
AllowTrust
object from an XDR Operation object.- Return type
- class stellar_sdk.operation.allow_trust.TrustLineEntryFlag(value)[source]
Indicates which flags to set. For details about the flags, please refer to the CAP-0018.
UNAUTHORIZED_FLAG: The account can hold a balance but cannot receive payments, send payments, maintain offers or manage offers
AUTHORIZED_FLAG: The account can hold a balance, receive payments, send payments, maintain offers or manage offers
AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG: The account can hold a balance and maintain offers but cannot receive payments, send payments or manage offers
BumpSequence
- class stellar_sdk.operation.BumpSequence(bump_to, source=None)[source]
The
BumpSequence
object, which represents a BumpSequence operation on Stellar’s network.Bump sequence allows to bump forward the sequence number of the source account of the operation, allowing to invalidate any transactions with a smaller sequence number. If the specified bumpTo sequence number is greater than the source account’s sequence number, the account’s sequence number is updated with that value, otherwise it’s not modified.
Threshold: Low
See Bump Sequence for more information.
- Parameters
bump_to (
int
) – Sequence number to bump to.source (
Union
[MuxedAccount
,str
,None
]) – The optional source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
BumpSequence
object from an XDR Operation object.- Return type
ChangeTrust
- class stellar_sdk.operation.ChangeTrust(asset, limit=None, source=None)[source]
The
ChangeTrust
object, which represents a ChangeTrust operation on Stellar’s network.Creates, updates, or deletes a trustline. For more on trustlines, please refer to the assets documentation.
Threshold: Medium
See Change Trust for more information.
- Parameters
asset (
Union
[Asset
,LiquidityPoolAsset
]) – The asset for the trust line.limit (
Union
[str
,Decimal
,None
]) – The limit for the asset, defaults to max int64(922337203685.4775807
). If the limit is set to"0"
it deletes the trustline.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
ChangeTrust
object from an XDR Operation object.- Return type
CreateAccount
- class stellar_sdk.operation.CreateAccount(destination, starting_balance, source=None)[source]
The
CreateAccount
object, which represents a Create Account operation on Stellar’s network.This operation creates and funds a new account with the specified starting balance.
Threshold: Medium
See Create Account for more information.
- Parameters
destination (
str
) – Destination account ID to create an account for.starting_balance (
Union
[str
,Decimal
]) – Amount in XLM the account should be funded for. Must be greater than the reserve balance amount.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
CreateAccount
object from an XDR Operation object.- Return type
CreatePassiveSellOffer
- class stellar_sdk.operation.CreatePassiveSellOffer(selling, buying, amount, price, source=None)[source]
The
CreatePassiveSellOffer
object, which represents a CreatePassiveSellOffer operation on Stellar’s network.A passive sell offer is an offer that does not act on and take a reverse offer of equal price. Instead, they only take offers of lesser price. For example, if an offer exists to buy 5 BTC for 30 XLM, and you make a passive sell offer to buy 30 XLM for 5 BTC, your passive sell offer does not take the first offer.
Note that regular offers made later than your passive sell offer can act on and take your passive sell offer, even if the regular offer is of the same price as your passive sell offer.
Passive sell offers allow market makers to have zero spread. If you want to trade EUR for USD at 1:1 price and USD for EUR also at 1:1, you can create two passive sell offers so the two offers don’t immediately act on each other.
Once the passive sell offer is created, you can manage it like any other offer using the manage offer operation - see
ManageBuyOffer
for more details.Threshold: Medium
See Create Passive Sell Offer for more information.
- Parameters
selling (
Asset
) – What you’re selling.buying (
Asset
) – What you’re buying.amount (
Union
[str
,Decimal
]) – The total amount you’re selling. If 0, deletes the offer.price (
Union
[Price
,str
,Decimal
]) – Price of 1 unit of selling in terms of buying.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
CreatePassiveSellOffer
object from an XDR Operation object.- Return type
Inflation
- class stellar_sdk.operation.Inflation(source=None)[source]
The
Inflation
object, which represents a Inflation operation on Stellar’s network.This operation runs inflation.
Threshold: Low
- Parameters
source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
LiquidityPoolDeposit
- class stellar_sdk.operation.LiquidityPoolDeposit(liquidity_pool_id, max_amount_a, max_amount_b, min_price, max_price, source=None)[source]
The
LiquidityPoolDeposit
object, which represents a LiquidityPoolDeposit operation on Stellar’s network.Creates a liquidity pool deposit operation.
Threshold: Medium
See Liquidity Pool Deposit for more information.
- Parameters
liquidity_pool_id (
str
) – The liquidity pool ID.max_amount_a (
Union
[str
,Decimal
]) – Maximum amount of first asset to deposit.max_amount_b (
Union
[str
,Decimal
]) – Maximum amount of second asset to deposit.min_price (
Union
[str
,Decimal
,Price
]) – Minimum deposit_a/deposit_b price.max_price (
Union
[str
,Decimal
,Price
]) – Maximum deposit_a/deposit_b price.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
LiquidityPoolDeposit
object from an XDR Operation object.- Return type
LiquidityPoolWithdraw
- class stellar_sdk.operation.LiquidityPoolWithdraw(liquidity_pool_id, amount, min_amount_a, min_amount_b, source=None)[source]
The
LiquidityPoolWithdraw
object, which represents a LiquidityPoolWithdraw operation on Stellar’s network.Creates a liquidity pool withdraw operation.
Threshold: Medium
See Liquidity Pool Withdraw for more information.
- Parameters
liquidity_pool_id (
str
) – The liquidity pool ID.amount (
Union
[str
,Decimal
]) – Amount of pool shares to withdraw.min_amount_a (
Union
[str
,Decimal
]) – Minimum amount of first asset to withdraw.min_amount_b (
Union
[str
,Decimal
]) – Minimum amount of second asset to withdraw.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
LiquidityPoolWithdraw
object from an XDR Operation object.- Return type
ManageBuyOffer
- class stellar_sdk.operation.ManageBuyOffer(selling, buying, amount, price, offer_id=0, source=None)[source]
The
ManageBuyOffer
object, which represents a ManageBuyOffer operation on Stellar’s network.Creates, updates, or deletes an buy offer.
If you want to create a new offer set offer_id to
0
.If you want to update an existing offer set offer_id to existing offer ID.
If you want to delete an existing offer set offer_id to existing offer ID and set amount to
0
.Threshold: Medium
See Manage Buy Offer for more information.
- Parameters
selling (
Asset
) – What you’re selling.buying (
Asset
) – What you’re buying.amount (
Union
[str
,Decimal
]) – Amount being bought. if set to0
, delete the offer.price (
Union
[Price
,str
,Decimal
]) – Price of thing being bought in terms of what you are selling.offer_id (
int
) – If0
, will create a new offer (default). Otherwise, edits an existing offer.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
ManageBuyOffer
object from an XDR Operation object.- Return type
ManageData
- class stellar_sdk.operation.ManageData(data_name, data_value, source=None)[source]
The
ManageData
object, which represents a ManageData operation on Stellar’s network.Allows you to set, modify or delete a Data Entry (name/value pair) that is attached to a particular account. An account can have an arbitrary amount of DataEntries attached to it. Each DataEntry increases the minimum balance needed to be held by the account.
DataEntries can be used for application specific things. They are not used by the core Stellar protocol.
Threshold: Medium
See Manage Data for more information.
- Parameters
data_name (
str
) – If this is a new Name it will add the given name/value pair to the account. If this Name is already present then the associated value will be modified. Up to 64 bytes long.data_value (
Union
[str
,bytes
,None
]) – If not present then the existing data_name will be deleted. If present then this value will be set in the DataEntry. Up to 64 bytes long.source (
Union
[MuxedAccount
,str
,None
]) – The optional source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
ManageData
object from an XDR Operation object.- Return type
ManageSellOffer
- class stellar_sdk.operation.ManageSellOffer(selling, buying, amount, price, offer_id=0, source=None)[source]
The
ManageSellOffer
object, which represents a ManageSellOffer operation on Stellar’s network.Creates, updates, or deletes an sell offer.
If you want to create a new offer set offer_id to
0
.If you want to update an existing offer set offer_id to existing offer ID.
If you want to delete an existing offer set offer_id to existing offer ID and set amount to
0
.Threshold: Medium
See Manage Sell Offer for more information.
- Parameters
selling (
Asset
) – What you’re selling.buying (
Asset
) – What you’re buying.amount (
Union
[str
,Decimal
]) – The total amount you’re selling. If0
, deletes the offer.price (
Union
[Price
,str
,Decimal
]) – Price of 1 unit of selling in terms of buying.offer_id (
int
) – If0
, will create a new offer (default). Otherwise, edits an existing offer.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
ManageSellOffer
object from an XDR Operation object.- Return type
PathPaymentStrictReceive
- class stellar_sdk.operation.PathPaymentStrictReceive(destination, send_asset, send_max, dest_asset, dest_amount, path, source=None)[source]
The
PathPaymentStrictReceive
object, which represents a PathPaymentStrictReceive operation on Stellar’s network.Sends an amount in a specific asset to a destination account through a path of offers. This allows the asset sent (e.g. 450 XLM) to be different from the asset received (e.g. 6 BTC).
Threshold: Medium
See Path Payment Strict Receive for more information.
- Parameters
destination (
Union
[MuxedAccount
,str
]) – The destination account to send to.send_asset (
Asset
) – The asset to pay with.send_max (
Union
[str
,Decimal
]) – The maximum amount of send_asset to send.dest_asset (
Asset
) – The asset the destination will receive.dest_amount (
Union
[str
,Decimal
]) – The amount the destination receives.path (
List
[Asset
]) – A list of Asset objects to use as the path.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
PathPaymentStrictReceive
object from an XDR Operation object.- Return type
PathPaymentStrictSend
- class stellar_sdk.operation.PathPaymentStrictSend(destination, send_asset, send_amount, dest_asset, dest_min, path, source=None)[source]
The
PathPaymentStrictSend
object, which represents a PathPaymentStrictSend operation on Stellar’s network.Sends an amount in a specific asset to a destination account through a path of offers. This allows the asset sent (e.g, 450 XLM) to be different from the asset received (e.g, 6 BTC).
Threshold: Medium
See Path Payment Strict Send for more information.
- Parameters
destination (
Union
[MuxedAccount
,str
]) – The destination account to send to.send_asset (
Asset
) – The asset to pay with.send_amount (
Union
[str
,Decimal
]) – Amount of send_asset to send.dest_asset (
Asset
) – The asset the destination will receive.dest_min (
Union
[str
,Decimal
]) – The minimum amount of dest_asset to be received.path (
List
[Asset
]) – A list of Asset objects to use as the path.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
PathPaymentStrictSend
object from an XDR Operation object.- Return type
Payment
- class stellar_sdk.operation.Payment(destination, asset, amount, source=None)[source]
The
Payment
object, which represents a Payment operation on Stellar’s network.Sends an amount in a specific asset to a destination account.
Threshold: Medium
See Payment for more information.
- Parameters
SetOptions
- class stellar_sdk.operation.SetOptions(inflation_dest=None, clear_flags=None, set_flags=None, master_weight=None, low_threshold=None, med_threshold=None, high_threshold=None, signer=None, home_domain=None, source=None)[source]
The
SetOptions
object, which represents a SetOptions operation on Stellar’s network.This operation sets the options for an account.
For more information on the signing options, please refer to the multi-sig doc.
When updating signers or other thresholds, the threshold of this operation is high.
Threshold: Medium or High
See Set Options for more information.
- Parameters
inflation_dest (
Optional
[str
]) – Account of the inflation destination.clear_flags (
Union
[int
,AuthorizationFlag
,None
]) –Indicates which flags to clear. For details about the flags, please refer to the Control Access to an Asset - Flag. The bit mask integer subtracts from the existing flags of the account. This allows for setting specific bits without knowledge of existing flags, you can also use
stellar_sdk.operation.set_options.AuthorizationFlag
AUTHORIZATION_REQUIRED = 1
AUTHORIZATION_REVOCABLE = 2
AUTHORIZATION_IMMUTABLE = 4
AUTHORIZATION_CLAWBACK_ENABLED = 8
set_flags (
Union
[int
,AuthorizationFlag
,None
]) –Indicates which flags to set. For details about the flags, please refer to the Control Access to an Asset - Flag. The bit mask integer adds onto the existing flags of the account. This allows for setting specific bits without knowledge of existing flags, you can also use
stellar_sdk.operation.set_options.AuthorizationFlag
AUTHORIZATION_REQUIRED = 1
AUTHORIZATION_REVOCABLE = 2
AUTHORIZATION_IMMUTABLE = 4
AUTHORIZATION_CLAWBACK_ENABLED = 8
master_weight (
Optional
[int
]) – A number from 0-255 (inclusive) representing the weight of the master key. If the weight of the master key is updated to 0, it is effectively disabled.low_threshold (
Optional
[int
]) – A number from 0-255 (inclusive) representing the threshold this account sets on all operations it performs that have a low threshold.med_threshold (
Optional
[int
]) – A number from 0-255 (inclusive) representing the threshold this account sets on all operations it performs that have a medium threshold.high_threshold (
Optional
[int
]) – A number from 0-255 (inclusive) representing the threshold this account sets on all operations it performs that have a high threshold.home_domain (
Optional
[str
]) – sets the home domain used for reverse federation lookup.signer (
Optional
[Signer
]) – Add, update, or remove a signer from the account.source (
Union
[MuxedAccount
,str
,None
]) – The source account for the operation. Defaults to the transaction’s source account.
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
SetOptions
object from an XDR Operation object.- Return type
- class stellar_sdk.operation.set_options.AuthorizationFlag(value)[source]
Indicates which flags to set. For details about the flags, please refer to the Control Access to an Asset - Flag.
CreateClaimableBalance
- class stellar_sdk.operation.CreateClaimableBalance(asset, amount, claimants, source=None)[source]
The
CreateClaimableBalance
object, which represents a CreateClaimableBalance operation on Stellar’s network.Creates a ClaimableBalanceEntry. See Claimable Balance for more information on parameters and usage.
Threshold: Medium
See Create Claimable Balance for more information.
- Parameters
- classmethod from_xdr_object(cls, xdr_object)[source]
Creates a
CreateClaimableBalance
object from an XDR Operation object.- Return type
- class stellar_sdk.operation.Claimant(destination, predicate=None)[source]
The
Claimant
object represents a claimable balance claimant.- Parameters
destination (
str
) – The destination account ID.predicate (
Optional
[ClaimPredicate
]) – The claim predicate. It is optional, it defaults to unconditional if none is specified.
- class stellar_sdk.operation.ClaimPredicate(claim_predicate_type, and_predicates, or_predicates, not_predicate, abs_before, rel_before)[source]
The
ClaimPredicate
object, which represents a ClaimPredicate on Stellar’s network.We do not recommend that you build it through the constructor, please use the helper function.
- Parameters
claim_predicate_type (
ClaimPredicateType
) – Type of ClaimPredicate.and_predicates (
Optional
[ClaimPredicateGroup
]) – The ClaimPredicates.or_predicates (
Optional
[ClaimPredicateGroup
]) – The ClaimPredicates.not_predicate (
Optional
[ClaimPredicate
]) – The ClaimPredicate.rel_before (
Optional
[int
]) – seconds since closeTime of the ledger in which the ClaimableBalanceEntry was created.
- classmethod predicate_and(cls, left, right)[source]
Returns an and claim predicate
- Parameters
left (
ClaimPredicate
) – a ClaimPredicate.right (
ClaimPredicate
) – a ClaimPredicate.
- Return type
- Returns
an and claim predicate.
- classmethod predicate_before_absolute_time(cls, abs_before)[source]
Returns a before_absolute_time claim predicate.
This predicate will be fulfilled if the closing time of the ledger that includes the
CreateClaimableBalance
operation is less than this (absolute) Unix timestamp.- Parameters
abs_before (
int
) – Unix epoch.- Return type
- Returns
a before_absolute_time claim predicate.
- classmethod predicate_before_relative_time(cls, seconds)[source]
Returns a before_relative_time claim predicate.
This predicate will be fulfilled if the closing time of the ledger that includes the
CreateClaimableBalance
operation plus this relative time delta (in seconds) is less than the current time.- Parameters
seconds (
int
) – seconds since closeTime of the ledger in which the ClaimableBalanceEntry was created.- Return type
- Returns
a before_relative_time claim predicate.