Releases: StellarCN/py-stellar-base
3.0.0-beta3
PyPi Package: https://pypi.org/project/stellar-sdk/3.0.0b3/
Documentation: https://stellar-sdk.readthedocs.io/en/3.0.0-beta3/
Update
- feat: updates the SEP-10 utility function parameters and return values to support SEP-10 v3.0 (#400)
- refactor: change the type of Operation.TYPE_CODE from
stellar_sdk.xdr.OperationType
tostr
. (#401)
2.9.0
PyPi Package: https://pypi.org/project/stellar-sdk/2.9.0/
Documentation: https://stellar-sdk.readthedocs.io/en/2.9.0/
This update include breaking changes
Breaking changes
-
Updates the SEP-10 utility function parameters and return values to support SEP-10 v3.0
-
The following functions replaced the
domain_name
parameter withhome_domains
:stellar_sdk.sep.stellar_web_authentication.read_challenge_transaction()
stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_signers()
stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_signed_by_client()
stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_signed_by_client_master_key()
stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_threshold()
stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction()
-
The following function replaced the
domain_name
parameter withhome_domain
:stellar_sdk.sep.stellar_web_authentication.build_challenge_transaction()
-
stellar_sdk.sep.stellar_web_authentication.read_challenge_transaction()
now returns an additional object attribute,matched_home_domain
-
3.0.0-beta2
This is a pre-release version, please do not use it in production.
PyPi Package: https://pypi.org/project/stellar-sdk/3.0.0b2/
Documentation: https://stellar-sdk.readthedocs.io/en/3.0.0-beta2/
Update
- refactor: change the type of Operation.TYPE_CODE from
stellar_sdk.xdr.OperationType
tostr
. (#401)
3.0.0-beta1
This is a pre-release version, please do not use it in production.
PyPi Package: https://pypi.org/project/stellar-sdk/3.0.0b1/
Documentation: https://stellar-sdk.readthedocs.io/en/3.0.0-beta1/
Update
- Add mypy check and bug fix. (#398)
- Fix wrong type hinting.
3.0.0-beta0
This update include breaking changes.
This is a pre-release version, please do not use it in production.
PyPi Package: https://pypi.org/project/stellar-sdk/3.0.0b0/
Documentation: https://stellar-sdk.readthedocs.io/en/3.0.0-beta0/
The XDR code used in the v2 version has a long history, and I know it is a little bit painful to use it. This release brings new XDR code generated by the new XDR generator, with type hint support, if you need to use XDR objects, this release will bring a great experience improvement.
Breaking changes
-
The old XDR code has been completely removed, and you can find the new XDR code here. (#383)
The XDR Object returned by the following functions has changed:
- Asset.to_xdr_object()
- TransactionEnvelope.to_xdr_object()
- FeeBumpTransaction.to_xdr_object()
- Keypair.xdr_public_key()
- Keypair.xdr_account_id()
- Keypair.xdr_muxed_account()
- Keypair.sign_decorated()
- Memo.to_xdr_object() (All types of Memos.)
- ClaimPredicate.to_xdr_object()
- Claimant.to_xdr_object()
- Operation.to_xdr_object() (All types of Operations.)
- Price.to_xdr_object()
- Signer.to_xdr_object()
- SignerKey.to_xdr_object()
- TimeBounds.to_xdr_object()
-
Rename the field that accepts XDR Object in the
from_xdr_object
function toxdr_object
. (#384)This change affects the following functions:
- Asset.from_xdr_object(cls, asset_xdr_object: stellar_xdr.Asset)
- FeeBumpTransaction.from_xdr_object(cls, te_xdr_object: stellar_xdr.TransactionEnvelope, cls, te_xdr_object: stellar_xdr.TransactionEnvelope)
- Memo.from_xdr_object(cls, xdr_obj: stellar_xdr.Memo) (All types of Memos.)
- Opeartion.from_xdr_object(cls, operation_xdr_object: stellar_xdr.Operation) (All types of Operations.)
- Price.from_xdr_object(cls, price_xdr_object: stellar_xdr.Price)
- Signer.from_xdr_object(cls, signer_xdr_object: stellar_xdr.Signer)
- SignerKey.from_xdr_object(cls, xdr_object: stellar_xdr.SignerKey)
- TimeBounds.from_xdr_object(cls, time_bounds_xdr_object: stellar_xdr.TimeBounds)
- Transaction.from_xdr_object(cls, tx_xdr_object: Union[stellar_xdr.Transaction, stellar_xdr.TransactionV0], v1: bool = False)
- TransactionEnvelope.from_xdr_object(cls, te_xdr_object: stellar_xdr.TransactionEnvelope, network_passphrase: str)
-
Remove Operation.type_code(), and add Operation.TYPE_CODE, it returns
stellar_sdk.xdr.OperationType
. (#390) -
Remove deprecated classes and functions. (#389)
The following classes and functions were marked as deprecated in v2, and now we have removed them.
Classes:
-
stellar_sdk.call_builder.paths_call_builder.PathsCallBuilder
-
stellar_sdk.call_builder.payments_call_builder.PaymentsCallBuilder
-
stellar_sdk.operation.path_payment.PathPayment
Functions:
-
stellar_sdk.call_builder.accounts_call_builder.AccountsCallBuilder.signer(self, signer: str)
-
stellar_sdk.call_builder.accounts_call_builder.AccountsCallBuilder.asset(self, asset: Asset)
-
stellar_sdk.call_builder.offers_call_builder.OffersCallBuilder.account(self, account_id: str)
-
stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_signed_by_client(challenge_transaction: str, server_account_id: str, domain_name: str, network_passphrase: str)
-
stellar_sdk.server.Server.paths(selfsource_account: str, destination_account: str, destination_asset: Asset, destination_amount: str)
-
stellar_sdk.server.Server.payments(self)
-
stellar_sdk.transaction_builder.TransactionBuilder.append_path_payment_op(self, destination: str, send_code: str, send_issuer: Optional[str], send_max: Union[str, Decimal], dest_code: str, dest_issuer: Optional[str], dest_amount: Union[str, Decimal], path: List[Asset], source: str = None)
-
Updated
- add missing
__str__
and__equals__
functions. (#385)
Tips
-
Parse XDR into XDR object, the resolved object has complete type hint support, and you can also analyze it through the debug tool(such as PyCharm Debugger).
from stellar_sdk.xdr import TransactionEnvelope xdr = "AAAAAgAAAAA1y7+IlEXtO3+d01lKBazo8wCpZsqsEItW7y2WHv2sOgAAAfQAD5ZNAAQJtwAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAGAQSwhD6XHfd4T2PjJc088ZwWyrfxr6Tcq7baksg1EHAAAAAlNJTEFVU0QAAAAAAAAAAABgEEsIQ+lx33eE9j4yXNPPGcFsq38a+k3Ku22pLINRBwAAAAAC+vCAAAAAAAAAAAEe/aw6AAAAQEDTXnTMoAwF7zM/dWDLAmxA02mVSXdqAbUzs1N/pJtrkOwlEk021zLnjTEo/5FeYGDaNktS8RemgQDYPxoL1QY=" te = TransactionEnvelope.from_xdr(xdr) ...
Hope you like this release, feedback is welcome 😃
2.8.1
PyPi Package: https://pypi.org/project/stellar-sdk/2.8.1/
Documentation: https://stellar-sdk.readthedocs.io/en/2.8.1/
Update
- feat: add support for SEP-0010 v2.1.0. (#380)
In SEP-0010 v2.1.0, the domain_name
field is no longer needed, but it may be used in the future, so we still keep it to reduce breaking changes.
2.8.0
This update include breaking changes
PyPi Package: https://pypi.org/project/stellar-sdk/2.8.0/
Documentation: https://stellar-sdk.readthedocs.io/en/2.8.0/
Update
- feat: add support for Stellar Protocol 14. (#367)
Added
-
feat: add support for CAP-23. (#371)
We have added methods to
TransactionBuilder
, you can use them to construct corresponding operations, method list:- append_create_claimable_balance_op
- append_claim_claimable_balance_op
We have added
ClaimPredicate
, please use helper function to build ClaimPredicate, method list:- predicate_and
- predicate_or
- predicate_not
- predicate_before_absolute_time
- predicate_before_relative_time
- predicate_unconditional
The following is an example.
from stellar_sdk import Server, TransactionBuilder, Keypair, ClaimPredicate, Claimant, Asset, Network sponsor_secret = "SAOJHTVFCYVKUMPNQI7RUSI566GKWXP7RXOHP4SV6JAVUQKSIWGPZFPJ" claimant_secret = "SBOLGU7D7A7MTY4JZ3WZUKSKB6NZBQFNQG3BZT4HZW4AAVZJRG7TWXGQ" sponsor_keypair = Keypair.from_secret(sponsor_secret) claimant_keypair = Keypair.from_secret(claimant_secret) server = Server("https://horizon-testnet.stellar.org") network_passphrase = Network.TESTNET_NETWORK_PASSPHRASE # Create Claimable Balance sponsor_account = server.load_account(sponsor_keypair.public_key) predicate_left = ClaimPredicate.predicate_before_relative_time(60 * 60 * 24 * 7) predicate_right = ClaimPredicate.predicate_not(ClaimPredicate.predicate_before_relative_time(60 * 3)) predicate = ClaimPredicate.predicate_and(predicate_left, predicate_right) claimant = Claimant(destination=claimant_keypair.public_key, predicate=predicate) create_claimable_balance_te = TransactionBuilder( source_account=sponsor_account, network_passphrase=network_passphrase ).append_create_claimable_balance_op( asset=Asset.native(), amount="100", claimants=[claimant], source=sponsor_keypair.public_key ).build() create_claimable_balance_te.sign(sponsor_keypair) create_claimable_balance_resp = server.submit_transaction(create_claimable_balance_te) print(create_claimable_balance_resp) # Claim Claimable Balance balance_id = "00000000550e14acbdafcd3089289363b3b0c8bec9b4edd87298c690655b4b2456d68ba0" claimant_account = server.load_account(claimant_keypair.public_key) claim_claimable_balance_te = TransactionBuilder( source_account=claimant_account, network_passphrase=network_passphrase ).append_claim_claimable_balance_op( balance_id=balance_id, source=claimant_keypair.public_key ).build() claim_claimable_balance_te.sign(claimant_keypair) claim_claimable_balance_resp = server.submit_transaction(claim_claimable_balance_te) print(claim_claimable_balance_resp)
-
feat: add support for CAP-33. (#372 #374)
We have added methods to
TransactionBuilder
, you can use them to construct corresponding operations, method list:- append_begin_sponsoring_future_reserves_op
- append_end_sponsoring_future_reserves_op
- append_revoke_account_sponsorship_op
- append_revoke_trustline_sponsorship_op
- append_revoke_offer_sponsorship_op
- append_revoke_data_sponsorship_op
- append_revoke_claimable_balance_sponsorship_op
- append_revoke_ed25519_public_key_signer_sponsorship_op
- append_revoke_hashx_signer_sponsorship_op
- append_revoke_pre_auth_tx_signer_sponsorship_op
The following is an example.
from stellar_sdk import Server, TransactionBuilder, Keypair, Network sponsor_secret = "SAOJHTVFCYVKUMPNQI7RUSI566GKWXP7RXOHP4SV6JAVUQKSIWGPZFPJ" new_account_secret = "SCN5D72JHQAHUHGIA23SLS3LBYCPHJWD7HLYNJRBBZIG4PD74UCGQBYM" sponsor_keypair = Keypair.from_secret(sponsor_secret) newly_created_keypair = Keypair.from_secret(new_account_secret) server = Server("https://horizon-testnet.stellar.org") network_passphrase = Network.TESTNET_NETWORK_PASSPHRASE # Sponsoring Account Creation # https://github.com/stellar/stellar-protocol/blob/master/core/cap-0033.md#example-sponsoring-account-creation sponsor_account = server.load_account(sponsor_keypair.public_key) sponsoring_account_creation_te = TransactionBuilder( source_account=sponsor_account, network_passphrase=network_passphrase ).append_begin_sponsoring_future_reserves_op( sponsored_id=newly_created_keypair.public_key, source=sponsor_keypair.public_key ).append_create_account_op( destination=newly_created_keypair.public_key, starting_balance="10", source=sponsor_keypair.public_key ).append_end_sponsoring_future_reserves_op( source=newly_created_keypair.public_key ).build() sponsoring_account_creation_te.sign(sponsor_keypair) sponsoring_account_creation_te.sign(new_account_secret) sponsoring_account_creation_resp = server.submit_transaction(sponsoring_account_creation_te) print(sponsoring_account_creation_resp) # Revoke Account Sponsorship sponsor_account = server.load_account(sponsor_keypair.public_key) revoke_account_sponsorship_te = TransactionBuilder( source_account=sponsor_account, network_passphrase=network_passphrase ).append_revoke_account_sponsorship_op( account_id=newly_created_keypair.public_key, source=sponsor_keypair.public_key ).build() revoke_account_sponsorship_te.sign(sponsor_keypair) revoke_account_sponsorship_resp = server.submit_transaction(revoke_account_sponsorship_te) print(revoke_account_sponsorship_resp)
-
feat: add support for new endpoint of Protocol 14. (#373)
The following are the newly added endpoints.
- server.claimable_balances().claimable_balance(claimable_balance_id)
- server.claimable_balances().for_asset(asset)
- server.claimable_balances().for_sponsor(sponsor)
- server.claimable_balances().for_claimant(claimant)
- server.accounts().for_sponsor(sponsor)
- server.offers().for_sponsor(sponsor)
Breaking changes
- The type of
stellar_sdk.signer.Signer.signer_key
is changed fromXdr.types.SignerKey
tostellar_sdk.signer_key.SignerKey
.
2.8.0-beta1
This update include breaking changes
Update
- feat: add support for Stellar Protocol 14. (#367)
Added
-
feat: add support for CAP-23. (#371)
We have added methods to
TransactionBuilder
, you can use them to construct corresponding operations, method list:- append_create_claimable_balance_op
- append_claim_claimable_balance_op
We have added
ClaimPredicate
, please use helper function to build ClaimPredicate, method list:- predicate_and
- predicate_or
- predicate_not
- predicate_before_absolute_time
- predicate_before_relative_time
- predicate_unconditional
The following is an example.
from stellar_sdk import Server, TransactionBuilder, Keypair, ClaimPredicate, Claimant, Asset, Network sponsor_secret = "SAOJHTVFCYVKUMPNQI7RUSI566GKWXP7RXOHP4SV6JAVUQKSIWGPZFPJ" claimant_secret = "SBOLGU7D7A7MTY4JZ3WZUKSKB6NZBQFNQG3BZT4HZW4AAVZJRG7TWXGQ" sponsor_keypair = Keypair.from_secret(sponsor_secret) claimant_keypair = Keypair.from_secret(claimant_secret) server = Server("https://horizon-testnet.stellar.org") network_passphrase = Network.TESTNET_NETWORK_PASSPHRASE # Create Claimable Balance sponsor_account = server.load_account(sponsor_keypair.public_key) predicate_left = ClaimPredicate.predicate_before_relative_time(60 * 60 * 24 * 7) predicate_right = ClaimPredicate.predicate_not(ClaimPredicate.predicate_before_relative_time(60 * 3)) predicate = ClaimPredicate.predicate_and(predicate_left, predicate_right) claimant = Claimant(destination=claimant_keypair.public_key, predicate=predicate) create_claimable_balance_te = TransactionBuilder( source_account=sponsor_account, network_passphrase=network_passphrase ).append_create_claimable_balance_op( asset=Asset.native(), amount="100", claimants=[claimant], source=sponsor_keypair.public_key ).build() create_claimable_balance_te.sign(sponsor_keypair) create_claimable_balance_resp = server.submit_transaction(create_claimable_balance_te) print(create_claimable_balance_resp) # Claim Claimable Balance balance_id = "00000000550e14acbdafcd3089289363b3b0c8bec9b4edd87298c690655b4b2456d68ba0" claimant_account = server.load_account(claimant_keypair.public_key) claim_claimable_balance_te = TransactionBuilder( source_account=claimant_account, network_passphrase=network_passphrase ).append_claim_claimable_balance_op( balance_id=balance_id, source=claimant_keypair.public_key ).build() claim_claimable_balance_te.sign(claimant_keypair) claim_claimable_balance_resp = server.submit_transaction(claim_claimable_balance_te) print(claim_claimable_balance_resp)
-
feat: add support for CAP-33. (#372 #374)
We have added methods to
TransactionBuilder
, you can use them to construct corresponding operations, method list:- append_begin_sponsoring_future_reserves_op
- append_end_sponsoring_future_reserves_op
- append_revoke_account_sponsorship_op
- append_revoke_trustline_sponsorship_op
- append_revoke_offer_sponsorship_op
- append_revoke_data_sponsorship_op
- append_revoke_claimable_balance_sponsorship_op
- append_revoke_ed25519_public_key_signer_sponsorship_op
- append_revoke_hashx_signer_sponsorship_op
- append_revoke_pre_auth_tx_signer_sponsorship_op
The following is an example.
from stellar_sdk import Server, TransactionBuilder, Keypair, Network sponsor_secret = "SAOJHTVFCYVKUMPNQI7RUSI566GKWXP7RXOHP4SV6JAVUQKSIWGPZFPJ" new_account_secret = "SCN5D72JHQAHUHGIA23SLS3LBYCPHJWD7HLYNJRBBZIG4PD74UCGQBYM" sponsor_keypair = Keypair.from_secret(sponsor_secret) newly_created_keypair = Keypair.from_secret(new_account_secret) server = Server("https://horizon-testnet.stellar.org") network_passphrase = Network.TESTNET_NETWORK_PASSPHRASE # Sponsoring Account Creation # https://github.com/stellar/stellar-protocol/blob/master/core/cap-0033.md#example-sponsoring-account-creation sponsor_account = server.load_account(sponsor_keypair.public_key) sponsoring_account_creation_te = TransactionBuilder( source_account=sponsor_account, network_passphrase=network_passphrase ).append_begin_sponsoring_future_reserves_op( sponsored_id=newly_created_keypair.public_key, source=sponsor_keypair.public_key ).append_create_account_op( destination=newly_created_keypair.public_key, starting_balance="10", source=sponsor_keypair.public_key ).append_end_sponsoring_future_reserves_op( source=newly_created_keypair.public_key ).build() sponsoring_account_creation_te.sign(sponsor_keypair) sponsoring_account_creation_te.sign(new_account_secret) sponsoring_account_creation_resp = server.submit_transaction(sponsoring_account_creation_te) print(sponsoring_account_creation_resp) # Revoke Account Sponsorship sponsor_account = server.load_account(sponsor_keypair.public_key) revoke_account_sponsorship_te = TransactionBuilder( source_account=sponsor_account, network_passphrase=network_passphrase ).append_revoke_account_sponsorship_op( account_id=newly_created_keypair.public_key, source=sponsor_keypair.public_key ).build() revoke_account_sponsorship_te.sign(sponsor_keypair) revoke_account_sponsorship_resp = server.submit_transaction(revoke_account_sponsorship_te) print(revoke_account_sponsorship_resp)
-
feat: add support for new endpoint of Protocol 14. (#373)
The following are the newly added endpoints.
- server.claimable_balances().claimable_balance(claimable_balance_id)
- server.claimable_balances().for_asset(asset)
- server.claimable_balances().for_sponsor(sponsor)
- server.claimable_balances().for_claimant(claimant)
- server.accounts().for_sponsor(sponsor)
- server.offers().for_sponsor(sponsor)
Breaking changes
- The type of
stellar_sdk.signer.Signer.signer_key
is changed fromXdr.types.SignerKey
tostellar_sdk.signer_key.SignerKey
.
2.7.0
This update include breaking changes
Update
- feat: add support for SEP-0010 v2.0.0. (#363)
Breaking changes
Due to the addition of support for SEP-10 v2.0.0, we no longer support SEP-10 v1.x.
The domain_name parameter is required in SEP-10, and the anchor_name parameter is no longer needed, you can get these SEP-10 changes here.
There have been some breaking changes to SEP-10 related functions, the following is a breaking changes list, you can also check our latest document.
- stellar_sdk.sep.stellar_web_authentication.build_challenge_transaction (domain_name parameter is required, anchor_name parameter has been removed.)
- stellar_sdk.sep.stellar_web_authentication.read_challenge_transaction (domain_name parameter is required)
- stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_signers (domain_name parameter is required)
- stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_signed_by_client (domain_name parameter is required)
- stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_signed_by_client_master_key (domain_name parameter is required)
- stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_threshold (domain_name parameter is required)
- stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction (domain_name parameter is required)