Skip to content

3.0.0-beta0

Pre-release
Pre-release
Compare
Choose a tag to compare
@overcat overcat released this 23 Oct 01:46
ed6f5a8

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 to xdr_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)
    ...

    pycharm_debugger

Hope you like this release, feedback is welcome 😃