From ae0ade2feb3402e2b593f7a6623025c14ca66622 Mon Sep 17 00:00:00 2001 From: Jun Luo <4catcode@gmail.com> Date: Thu, 28 Nov 2024 11:31:08 +0800 Subject: [PATCH] release: 12.0.0 (#1006) --- CHANGELOG.md | 24 +++++++++++++++++++ README.rst | 5 ++++ pyproject.toml | 2 +- stellar_sdk/__version__.py | 2 +- stellar_sdk/contract/contract_client.py | 15 +++++++----- stellar_sdk/contract/contract_client_async.py | 15 +++++++----- 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7abdd52..5fd0664c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,30 @@ Release History ### Pending +### Version 12.0.0 + +Released on November 28, 2024 + +This is the first stable release that supports Protocol 22. While the network has not upgraded yet, +you can start integrating the new features into your codebase if you want a head start. + +If you are using this SDK to call Soroban contracts, please check [stellar-contract-bindings](https://github.com/lightsail-network/stellar-contract-bindings), +which can automatically generate contract binding code for you, making it incredibly easy to call contracts. + +The following log is the changes since 11.1.0: + +#### Update +- feat: add support for Soroban PRC's `getVersionInfo` API interfaces. ([#984](https://github.com/StellarCN/py-stellar-base/pull/984)) +- feat: Add `transaction_hash` to `GetTransactionResponse` and `GetTransactionsResponse`. ([#984](https://github.com/StellarCN/py-stellar-base/pull/984)) +- feat: `scval.from_enum` and `scval.to_enum` now support multiple values. ([#1004](https://github.com/StellarCN/py-stellar-base/pull/1004)) +- feat: add support for Soroban PRC's `getLedgers` API interfaces. ([#992](https://github.com/StellarCN/py-stellar-base/pull/992)) +- feat: add `stellar_sdk.contract.ContractClient` and `stellar_sdk.contract.ContractClientAsync`, this greatly reduces the difficulty of calling contracts, and you can learn more through the documentation and [examples](https://github.com/StellarCN/py-stellar-base/blob/main/examples/soroban_invoke_contract_function.py). ([#998](https://github.com/StellarCN/py-stellar-base/pull/998)) + +#### Breaking changes +- refactor!: The `EventInfo.paging_token` field has been marked as deprecated, use the `cursor` in `GetEventsResponse` instead. (Reverted in 12.0.0-beta1) ([#984](https://github.com/StellarCN/py-stellar-base/pull/984)) +- refactor!: The legacy `cost` field has been removed from `SimulateTransactionResponse`, parse it from `transaction_data` instead. ([#984](https://github.com/StellarCN/py-stellar-base/pull/984)) +- feat!: support constructors in contract creation via `TransactionBuilder.append_create_contract_op`, the signature of the function has been changed. ([#979](https://github.com/StellarCN/py-stellar-base/pull/979)) +- refactor!: Updated `signer` parameter in auth to accept a callable returning (public_key, signatures) instead of just public_key. ([#982](https://github.com/StellarCN/py-stellar-base/pull/982)) ### Version 12.0.0-beta6 diff --git a/README.rst b/README.rst index 07c2672b..8b03fd4a 100644 --- a/README.rst +++ b/README.rst @@ -98,6 +98,11 @@ You can find more examples `here `__ for more information. + stellar-model ------------- stellar-model allows you to parse the JSON returned by Stellar Horizon diff --git a/pyproject.toml b/pyproject.toml index 453464c2..1f49a039 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stellar-sdk" -version = "12.0.0b6" +version = "12.0.0" description = "The Python Stellar SDK library provides APIs to build transactions and connect to Horizon and Soroban-RPC server." authors = [ "overcat <4catcode@gmail.com>", diff --git a/stellar_sdk/__version__.py b/stellar_sdk/__version__.py index d2cff78e..57ac4b9f 100644 --- a/stellar_sdk/__version__.py +++ b/stellar_sdk/__version__.py @@ -11,7 +11,7 @@ __description__ = "The Python Stellar SDK library provides APIs to build transactions and connect to Horizon and Soroban-RPC server." __url__ = "https://github.com/StellarCN/py-stellar-base" __issues__ = f"{__url__}/issues" -__version__ = "12.0.0b6" +__version__ = "12.0.0" __author__ = "Eno, overcat" __author_email__ = "appweb.cn@gmail.com, 4catcode@gmail.com" __license__ = "Apache License 2.0" diff --git a/stellar_sdk/contract/contract_client.py b/stellar_sdk/contract/contract_client.py index 065c49b7..22240243 100644 --- a/stellar_sdk/contract/contract_client.py +++ b/stellar_sdk/contract/contract_client.py @@ -20,6 +20,9 @@ class ContractClient: This client is a wrapper for :py:class:`TransactionBuilder ` and :py:class:`SorobanServer `. If you need more fine-grained control, please consider using them directly. + I strongly recommend that you do not use this client directly, but instead use `stellar-contract-bindings `_ to + generate contract binding code, which will make calling the contract much simpler. + :param contract_id: The ID of the Soroban contract. :param rpc_url: The URL of the RPC server. :param network_passphrase: The network passphrase. @@ -31,7 +34,7 @@ def __init__( contract_id: str, rpc_url: str, network_passphrase: str, - request_client: BaseSyncClient = None, + request_client: Optional[BaseSyncClient] = None, ): self.contract_id = contract_id self.rpc_url = rpc_url @@ -41,9 +44,9 @@ def __init__( def invoke( self, function_name: str, - parameters: Sequence[stellar_xdr.SCVal] = None, + parameters: Optional[Sequence[stellar_xdr.SCVal]] = None, source: Union[str, MuxedAccount] = NULL_ACCOUNT, - signer: Keypair = None, + signer: Optional[Keypair] = None, parse_result_xdr_fn: Optional[Callable[[stellar_xdr.SCVal], T]] = None, base_fee: int = 100, transaction_timeout: int = 300, @@ -87,7 +90,7 @@ def upload_contract_wasm( source: Union[str, MuxedAccount], signer: Keypair, soroban_server: SorobanServer, - network_passphrase: str = None, + network_passphrase: Optional[str] = None, base_fee: int = 100, transaction_timeout: int = 300, submit_timeout: int = 120, @@ -135,7 +138,7 @@ def create_contract( soroban_server: SorobanServer, constructor_args: Optional[Sequence[stellar_xdr.SCVal]] = None, salt: Optional[bytes] = None, - network_passphrase: str = None, + network_passphrase: Optional[str] = None, base_fee: int = 100, transaction_timeout: int = 300, submit_timeout: int = 120, @@ -186,7 +189,7 @@ def create_stellar_asset_contract_from_asset( source: Union[str, MuxedAccount], signer: Keypair, soroban_server: SorobanServer, - network_passphrase: str = None, + network_passphrase: Optional[str] = None, base_fee: int = 100, submit_timeout: int = 120, ) -> str: diff --git a/stellar_sdk/contract/contract_client_async.py b/stellar_sdk/contract/contract_client_async.py index 95bb3dad..4981ad87 100644 --- a/stellar_sdk/contract/contract_client_async.py +++ b/stellar_sdk/contract/contract_client_async.py @@ -19,6 +19,9 @@ class ContractClientAsync: This client is a wrapper for :py:class:`TransactionBuilder ` and :py:class:`SorobanServerAsync `. If you need more fine-grained control, please consider using them directly. + I strongly recommend that you do not use this client directly, but instead use `stellar-contract-bindings `_ to + generate contract binding code, which will make calling the contract much simpler. + :param contract_id: The ID of the Soroban contract. :param rpc_url: The URL of the RPC server. :param network_passphrase: The network passphrase. @@ -30,7 +33,7 @@ def __init__( contract_id: str, rpc_url: str, network_passphrase: str, - request_client: BaseAsyncClient = None, + request_client: Optional[BaseAsyncClient] = None, ): self.contract_id = contract_id self.rpc_url = rpc_url @@ -40,9 +43,9 @@ def __init__( async def invoke( self, function_name: str, - parameters: Sequence[stellar_xdr.SCVal] = None, + parameters: Optional[Sequence[stellar_xdr.SCVal]] = None, source: Union[str, MuxedAccount] = NULL_ACCOUNT, - signer: Keypair = None, + signer: Optional[Keypair] = None, parse_result_xdr_fn: Optional[Callable[[stellar_xdr.SCVal], T]] = None, base_fee: int = 100, transaction_timeout: int = 300, @@ -86,7 +89,7 @@ async def upload_contract_wasm( source: Union[str, MuxedAccount], signer: Keypair, soroban_server: SorobanServerAsync, - network_passphrase: str = None, + network_passphrase: Optional[str] = None, base_fee: int = 100, transaction_timeout: int = 300, submit_timeout: int = 120, @@ -132,7 +135,7 @@ async def create_contract( soroban_server: SorobanServerAsync, constructor_args: Optional[Sequence[stellar_xdr.SCVal]] = None, salt: Optional[bytes] = None, - network_passphrase: str = None, + network_passphrase: Optional[str] = None, base_fee: int = 100, transaction_timeout: int = 300, submit_timeout: int = 120, @@ -181,7 +184,7 @@ async def create_stellar_asset_contract_from_asset( source: Union[str, MuxedAccount], signer: Keypair, soroban_server: SorobanServerAsync, - network_passphrase: str = None, + network_passphrase: Optional[str] = None, base_fee: int = 100, submit_timeout: int = 120, ) -> str: