Skip to content

Commit

Permalink
release: 12.0.0 (#1006)
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat authored Nov 28, 2024
1 parent 7e1ae05 commit ae0ade2
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 14 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ You can find more examples `here <https://github.com/StellarCN/py-stellar-base/t
response = server.submit_transaction(transaction)
print(response)
stellar-contract-bindings
-------------------------
stellar-contract-bindings allows you to generate Python bindings for Stellar Soroban smart contracts, it makes calling
Stellar Soroban contracts easier. click `here <https://github.com/lightsail-network/stellar-contract-bindings>`__ for more information.

stellar-model
-------------
stellar-model allows you to parse the JSON returned by Stellar Horizon
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion stellar_sdk/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = "[email protected], [email protected]"
__license__ = "Apache License 2.0"
15 changes: 9 additions & 6 deletions stellar_sdk/contract/contract_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class ContractClient:
This client is a wrapper for :py:class:`TransactionBuilder <stellar_sdk.TransactionBuilder>` and :py:class:`SorobanServer <stellar_sdk.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 <https://github.com/lightsail-network/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.
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
15 changes: 9 additions & 6 deletions stellar_sdk/contract/contract_client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class ContractClientAsync:
This client is a wrapper for :py:class:`TransactionBuilder <stellar_sdk.TransactionBuilder>` and :py:class:`SorobanServerAsync <stellar_sdk.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 <https://github.com/lightsail-network/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.
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ae0ade2

Please sign in to comment.