diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 69b2c57a9..bad0d90db 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:focal
+FROM ubuntu:jammy
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
# this user's GID/UID must match your local user UID/GID to avoid permission issues
@@ -20,20 +20,11 @@ RUN apt-get update && apt-get upgrade -qy && apt-get install -qy \
make \
python-is-python3 \
python3 \
- python3-pip \
- ruby \
- fish && \
+ python3-pip && \
apt-get autoclean -y && \
apt-get autoremove -y && \
apt-get clean
-# Install xdrgen
-RUN cd /opt && \
- git clone --branch python-sdk https://github.com/overcat/xdrgen && \
- cd xdrgen && \
- gem build xdrgen.gemspec && \
- gem install xdrgen-*.gem
-
# Install poetry
RUN pip install poetry
@@ -46,7 +37,7 @@ ENV LC_ALL en_US.UTF-8
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
RUN groupadd --gid $USER_GID $USERNAME \
- && useradd -s /bin/fish --uid $USER_UID --gid $USER_GID -m $USERNAME \
+ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
# [Optional] Add sudo support for the non-root user
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
@@ -57,4 +48,4 @@ ENV DEBIAN_FRONTEND=
USER $USERNAME
-CMD ["/bin/fish"]
\ No newline at end of file
+CMD ["/bin/bash"]
\ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 873191ae4..0a148479b 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,7 +1,6 @@
-// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
-// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/ubuntu-18.04-git
+// For format details, see https://aka.ms/vscode-remote/devcontainer.json
{
- "name": "Stellar Python SDK Dev",
+ "name": "python dev",
"dockerFile": "Dockerfile",
"build": {
"args": {}
@@ -10,37 +9,15 @@
"remoteEnv": {
// "PIP_INDEX_URL": "https://mirrors.ustc.edu.cn/pypi/web/simple"
},
- // The optional 'runArgs' property can be used to specify additional runtime arguments.
"runArgs": [],
- // Use 'settings' to set *default* container specific settings.json values on container create.
- // You can edit these settings after create using File > Preferences > Settings > Remote.
- "settings": {
- "terminal.integrated.profiles.linux": {
- "bash": {
- "path": "/bin/bash"
- },
- "fish": {
- "path": "/bin/fish"
- }
- },
- "terminal.integrated.defaultProfile.linux": "fish"
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "ms-python.python"
+ ]
+ }
},
- // Use 'forwardPorts' to make a list of ports inside the container available locally.
- // "forwardPorts": [3000],
- // Use 'portsAttributes' to set default properties for specific forwarded ports. More info: https://code.visualstudio.com/docs/remote/devcontainerjson-reference.
- // "portsAttributes": {
- // },
- // Use 'otherPortsAttributes' to configure any ports that aren't configured using 'portsAttributes'.
- // "otherPortsAttributes": {
- // "onAutoForward": "silent"
- // },
- // Uncomment the next line to run commands after the container is created.
- "postCreateCommand": "poetry install",
+ "postCreateCommand": "poetry install --all-extras",
"postAttachCommand": "poetry shell",
- // Add the IDs of extensions you want installed when the container is created in the array below.
- "extensions": ["donjayamanne.python-extension-pack"],
- // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
- // On Linux, this will prevent new files getting created as root, but you may need to update the USER_UID
- // and USER_GID in .devcontainer/Dockerfile to match your user if not 1000.
"remoteUser": "vscode"
}
diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml
index 2ef8a2777..dc27f1867 100644
--- a/.github/workflows/continuous-integration-workflow.yml
+++ b/.github/workflows/continuous-integration-workflow.yml
@@ -1,17 +1,25 @@
-name: GitHub Action
+name: Test and Deploy
on:
push:
pull_request:
- branches-ignore:
- - 'temp*'
- - 'tmp*'
release:
- types: [ created ]
+ types:
+ - created
jobs:
+ pre-commit:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
+ with:
+ python-version: '3.10'
+ - uses: pre-commit/action@v3.0.0
+
test:
runs-on: ubuntu-latest
+ needs: pre-commit
strategy:
fail-fast: false
matrix:
@@ -21,6 +29,10 @@ jobs:
steps:
- uses: actions/checkout@v3
+ - name: Start httpbin server
+ run: |
+ docker run -d -p 9876:80 kennethreitz/httpbin
+
- name: Install poetry
run: pipx install poetry
@@ -32,17 +44,19 @@ jobs:
- name: Install dependencies
run: |
- poetry install
+ poetry install --extras 'aiohttp'
+
+ - name: Ensure httpbin server is running
+ run: |
+ while true; do response=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:9876/get); if [ "$response" = "200" ]; then echo "HTTP 200 OK received"; break; else echo "Retrying..."; sleep 1; fi; done
+
+ - name: Echo installed packages
+ run: |
+ poetry show
- name: Test with pytest
run: poetry run pytest -v -rs tests --runslow --cov=./ --cov-report=xml
- - name: Test with pytest (runtime type checking disabled)
- if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.7'
- run: poetry run pytest -v -rs tests --runslow
- env:
- STELLAR_SDK_RUNTIME_TYPE_CHECKING: 0
-
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.7'
uses: codecov/codecov-action@v3
@@ -55,6 +69,7 @@ jobs:
mypy-check:
runs-on: ubuntu-latest
+ needs: pre-commit
steps:
- uses: actions/checkout@v3
@@ -69,7 +84,7 @@ jobs:
- name: Install dependencies
run: |
- poetry install
+ poetry install --extras 'aiohttp'
- name: Run mypy check
run: |
@@ -78,25 +93,24 @@ jobs:
poetry run mypy examples
deploy:
- needs: test
+ needs: [ test, mypy-check ]
runs-on: ubuntu-latest
- if: github.event_name == 'release'
+ if: github.event_name == 'release' && github.event.action == 'created'
+ permissions:
+ id-token: write
steps:
- uses: actions/checkout@v3
- - name: Install poetry
- run: pipx install poetry
-
- name: Setup Python
uses: actions/setup-python@v4
with:
- python-version: '3.10'
+ python-version: '3.11'
+
+ - name: Install poetry
+ run: pipx install poetry
- name: Build Packages
run: poetry build
- - name: Publish distribution 📦 to Test PyPI
- uses: pypa/gh-action-pypi-publish@master
- with:
- password: ${{ secrets.test_pypi_api_token }}
- repository_url: https://test.pypi.org/legacy/
+ - name: Publish package distributions to PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000..127795041
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,18 @@
+repos:
+ - repo: https://github.com/PyCQA/autoflake
+ rev: "v2.1.1"
+ hooks:
+ - id: autoflake
+ args: [--in-place, --ignore-init-module-imports, --remove-all-unused-imports]
+
+ - repo: https://github.com/pycqa/isort
+ rev: "5.11.5"
+ hooks:
+ - id: isort
+
+ - repo: https://github.com/pre-commit/mirrors-mypy
+ rev: 'v1.4.1'
+ hooks:
+ - id: mypy
+ additional_dependencies: [types-requests==2.31.0.2, types-toml==0.10.8.7, types-urllib3==1.26.25.14]
+ exclude: ^docs/
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
new file mode 100644
index 000000000..103b52cfd
--- /dev/null
+++ b/.readthedocs.yaml
@@ -0,0 +1,31 @@
+# .readthedocs.yaml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+# Set the version of Python and other tools you might need
+build:
+ os: ubuntu-22.04
+ tools:
+ python: "3.11"
+
+# Build documentation in the docs/ directory with Sphinx
+sphinx:
+ configuration: docs/en/conf.py
+ builder: html
+ fail_on_warning: false
+
+# We recommend specifying your dependencies to enable reproducible builds:
+# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
+python:
+ install:
+ - method: pip
+ path: .
+ - requirements: docs/requirements.txt
+
+# Build PDF & ePub
+formats:
+ - epub
+ - pdf
\ No newline at end of file
diff --git a/.xdr/update_xdr.py b/.xdr/update_xdr.py
deleted file mode 100644
index 930653cfe..000000000
--- a/.xdr/update_xdr.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import os
-from urllib.parse import urljoin
-
-import requests
-
-BASE_XDR_GITHUB_URL = (
- "https://raw.githubusercontent.com/stellar/stellar-core/master/src/xdr/"
-)
-XDR_FILES = (
- "Stellar-SCP.x",
- "Stellar-ledger-entries.x",
- "Stellar-ledger.x",
- "Stellar-overlay.x",
- "Stellar-transaction.x",
- "Stellar-types.x",
-)
-BASE_DIR = os.path.dirname(os.path.realpath(__file__))
-print("Downloading xdr files from {}".format(BASE_XDR_GITHUB_URL))
-for filename in XDR_FILES:
- print("Downloading {}".format(filename))
- url = urljoin(BASE_XDR_GITHUB_URL, filename)
- file = os.path.join(BASE_DIR, filename)
- resp = requests.get(url, allow_redirects=True)
- open(file, "wb").write(resp.content)
-print("Finished")
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ec671b13b..995c769d8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,38 @@
Release History
==============
+### Version 9.0.0-alpha2
+
+Released on September 16, 2023
+
+#### Update
+- feat: add support for Soroban Preview 11 ([#777](https://github.com/StellarCN/py-stellar-base/pull/777))
+
+### Version 9.0.0-alpha1
+
+Released on Aug 28, 2023
+
+#### Update
+- fix: fix the issue where soroban data is not correctly set when building a transaction through TransactionBuilder. ([#770](https://github.com/StellarCN/py-stellar-base/pull/770))
+
+### Version 9.0.0-alpha0
+
+Released on Aug 27, 2023
+
+#### Add
+- feat: add support for Soroban Preview 10. Please check the examples in the `examples` folder to learn how to use it.
+
+#### Update
+- Runtime type checking has now been removed. Please use tools like mypy for type checking. ([#706](https://github.com/StellarCN/py-stellar-base/pull/706))
+- Add `__hash__` to the xdr classes. ([#757](https://github.com/StellarCN/py-stellar-base/pull/757))
+- Make `aiohttp` and `aiohttp-sse-client` as optional dependencies. ([#765](https://github.com/StellarCN/py-stellar-base/pull/765))
+- Publishing to PyPI with a Trusted Publisher. ([#767](https://github.com/StellarCN/py-stellar-base/pull/767))
+- Update dependencies.
+
+#### Breaking changes
+- Remove `ValueError`, `TypeError` and `AttributeError` from `stellar_sdk.exceptions`. ([#763](https://github.com/StellarCN/py-stellar-base/pull/763))
+
+
### Version 8.2.1
Released on June 22, 2023
diff --git a/Makefile b/Makefile
index 0370ed7df..c7d49c0a8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,26 @@
+XDRS = xdr/Stellar-SCP.x \
+xdr/Stellar-ledger-entries.x \
+xdr/Stellar-ledger.x \
+xdr/Stellar-overlay.x \
+xdr/Stellar-transaction.x \
+xdr/Stellar-types.x \
+xdr/Stellar-contract-env-meta.x \
+xdr/Stellar-contract-meta.x \
+xdr/Stellar-contract-spec.x \
+xdr/Stellar-contract.x \
+xdr/Stellar-internal.x \
+xdr/Stellar-contract-config-setting.x
+
+XDRGEN_REPO=overcat/xdrgen
+XDRGEN_COMMIT=c98916346eeea7e37aaea039de03c1e5ea0a116a
+XDRNEXT_COMMIT=9ac02641139e6717924fdad716f6e958d0168491
+
+UNAME := $(shell uname)
+SED := sed
+ifeq ($(UNAME), Darwin)
+ SED := sed -i ''
+endif
+
# default target does nothing
.DEFAULT_GOAL: default
default: ;
@@ -32,23 +55,41 @@ pypi:
clean:
find . -name \*.pyc -delete
- rm -rf coverage.xml .coverage dist htmlcov stellar_sdk.egg-info tests/.mypy_cache tests/.pytest_cache docs/en/_build docs/zh_CN/_build
+ rm -rf coverage.xml .coverage dist htmlcov stellar_sdk.egg-info tests/.mypy_cache tests/.pytest_cache docs/en/_build docs/zh_CN/_build
.PHONY: clean
-download-xdr:
- python .xdr/update_xdr.py
-.PHONY: download-xdr
-
-gen-xdr:
- rm -rf stellar_sdk/xdr/*
- xdrgen -o stellar_sdk/xdr -l python -n stellar .xdr/*.x
- autoflake --in-place --ignore-init-module-imports --remove-all-unused-imports stellar_sdk/xdr/*.py
- isort stellar_sdk/xdr/
- black stellar_sdk/xdr/
-.PHONY: gen-xdr
-
format:
- autoflake --in-place --ignore-init-module-imports --remove-all-unused-imports .
+ autoflake --in-place --ignore-init-module-imports --remove-all-unused-imports --recursive .
isort .
black .
-.PHONY: format
\ No newline at end of file
+.PHONY: format
+
+replace-xdr-keywords:
+ find xdr -type f -exec $(SED) 's/from;/from_;/g' {} +
+.PHONY: replace-xdr-keywords
+
+xdr-generate: $(XDRS)
+ make replace-xdr-keywords
+ docker run -it --rm -v $$PWD:/wd -w /wd ruby /bin/bash -c '\
+ gem install specific_install -v 0.3.8 && \
+ gem specific_install https://github.com/$(XDRGEN_REPO).git -b $(XDRGEN_COMMIT) && \
+ xdrgen \
+ --language python \
+ --namespace stellar \
+ --output stellar_sdk/xdr \
+ $(XDRS)'
+ $(SED) '/stellar_sdk\.xdr/,$$d' docs/en/api.rst
+ python docs/gen_xdr_api.py >> docs/en/api.rst
+.PHONY: xdr-generate
+
+xdr/%.x:
+ curl -Lsf -o $@ https://raw.githubusercontent.com/stellar/stellar-xdr/$(XDRNEXT_COMMIT)/$(@F)
+.PHONY: xdr
+
+xdr-clean:
+ rm xdr/*.x || true
+ rm stellar_sdk/xdr/*.py || true
+.PHONY: xdr-clean
+
+xdr-update: xdr-clean xdr-generate format
+.PHONY: xdr-update
\ No newline at end of file
diff --git a/README.rst b/README.rst
index 3090c7b6c..087ed391d 100644
--- a/README.rst
+++ b/README.rst
@@ -33,18 +33,19 @@ Stellar Python SDK
:alt: PyPI - Implementation
:target: https://pypi.python.org/pypi/stellar-sdk
-.. image:: https://img.shields.io/badge/Stellar%20Protocol-19-blue
+.. image:: https://img.shields.io/badge/Stellar%20Protocol-20-blue
:alt: Stellar Protocol
:target: https://developers.stellar.org/docs/glossary/scp/
py-stellar-base is a Python library for communicating with
-a `Stellar Horizon server`_. It is used for building Stellar apps on Python. It supports **Python 3.7+** as
+a `Stellar Horizon server`_ and `Soroban-RPC server`_. It is used for building Stellar apps on Python. It supports **Python 3.7+** as
well as PyPy 3.7+.
It provides:
- a networking layer API for Horizon endpoints.
-- facilities for building and signing transactions, for communicating with a Stellar Horizon instance, and for submitting transactions or querying network history.
+- a networking layer API for Soroban-RPC server methods.
+- facilities for building and signing transactions, for communicating with a Stellar Horizon and Soroban-RPC instance, and for submitting transactions or querying network history.
Documentation
-------------
@@ -55,7 +56,13 @@ Installing
.. code-block:: text
- pip install -U stellar-sdk
+ pip install stellar-sdk==9.0.0a2
+
+If you need to use asynchronous, please use the following command to install the required dependencies.
+
+.. code-block:: text
+
+ pip install stellar-sdk[aiohttp]==9.0.0a2
We follow `Semantic Versioning 2.0.0 `_, and I strongly
recommend that you specify its major version number in the dependency
@@ -65,8 +72,6 @@ A Simple Example
----------------
You can find more examples `here `__.
-Building transaction with synchronous server
-
.. code-block:: python
# Alice pay 10.25 XLM to Bob
@@ -93,46 +98,6 @@ Building transaction with synchronous server
response = server.submit_transaction(transaction)
print(response)
-
-* Building transaction with asynchronous server
-
-.. code-block:: python
-
- # Alice pay 10.25 XLM to Bob
- import asyncio
-
- from stellar_sdk import Asset, ServerAsync, Keypair, TransactionBuilder, Network
- from stellar_sdk.client.aiohttp_client import AiohttpClient
-
- alice_keypair = Keypair.from_secret("SBFZCHU5645DOKRWYBXVOXY2ELGJKFRX6VGGPRYUWHQ7PMXXJNDZFMKD")
- bob_address = "GA7YNBW5CBTJZ3ZZOWX3ZNBKD6OE7A7IHUQVWMY62W2ZBG2SGZVOOPVH"
-
-
- async def payment():
- async with ServerAsync(
- horizon_url="https://horizon-testnet.stellar.org", client=AiohttpClient()
- ) as server:
- alice_account = await server.load_account(alice_keypair.public_key)
- base_fee = 100
- transaction = (
- TransactionBuilder(
- source_account=alice_account,
- network_passphrase=Network.TESTNET_NETWORK_PASSPHRASE,
- base_fee=base_fee,
- )
- .add_text_memo("Hello, Stellar!")
- .append_payment_op(bob_address, Asset.native(), "10.25")
- .set_timeout(30)
- .build()
- )
- transaction.sign(alice_keypair)
- response = await server.submit_transaction(transaction)
- print(response)
-
-
- if __name__ == "__main__":
- asyncio.run(payment())
-
Soroban support
---------------
As `Soroban `_ is still under active development, I have not merged it into the main branch.
@@ -155,4 +120,5 @@ Links
Thank you to all the people who have already contributed to py-stellar-base!
-.. _Stellar Horizon server: https://github.com/stellar/go/tree/master/services/horizon
\ No newline at end of file
+.. _Stellar Horizon server: https://github.com/stellar/go/tree/master/services/horizon
+.. _Soroban-RPC server: https://soroban.stellar.org/docs/reference/rpc
\ No newline at end of file
diff --git a/docs/en/api.rst b/docs/en/api.rst
index 595142bf2..957af5264 100644
--- a/docs/en/api.rst
+++ b/docs/en/api.rst
@@ -9,12 +9,21 @@ API Documentation
Account
-^^^^^^^^
+^^^^^^^
.. autoclass:: stellar_sdk.account.Account
:members:
:inherited-members:
+Address
+^^^^^^^
+
+.. autoclass:: stellar_sdk.address.Address
+ :members:
+
+.. autoclass:: stellar_sdk.address.AddressType
+ :members:
+
Asset
^^^^^
@@ -622,6 +631,21 @@ SetTrustLineFlags
.. autoclass:: stellar_sdk.operation.set_trust_line_flags.TrustLineFlags
:members:
+InvokeHostFunction
+------------------
+.. autoclass:: stellar_sdk.operation.InvokeHostFunction
+ :members: to_xdr_object, from_xdr_object
+
+BumpFootprintExpiration
+-----------------------
+.. autoclass:: stellar_sdk.operation.BumpFootprintExpiration
+ :members: to_xdr_object, from_xdr_object
+
+RestoreFootprint
+----------------
+.. autoclass:: stellar_sdk.operation.RestoreFootprint
+ :members: to_xdr_object, from_xdr_object
+
Price
^^^^^
@@ -714,6 +738,66 @@ TransactionBuilder
.. autoclass:: stellar_sdk.transaction_builder.TransactionBuilder
:members:
+SorobanDataBuilder
+^^^^^^^^^^^^^^^^^^
+
+.. autoclass:: stellar_sdk.SorobanDataBuilder
+ :members:
+
+SorobanServer
+^^^^^^^^^^^^^
+
+.. autoclass:: stellar_sdk.SorobanServer
+ :members:
+
+Soroban RPC Definitions
+^^^^^^^^^^^^^^^^^^^^^^^
+.. automodule:: stellar_sdk.soroban_rpc
+ :members:
+
+scval
+^^^^^
+.. autofunction:: stellar_sdk.scval.to_address
+.. autofunction:: stellar_sdk.scval.from_address
+.. autofunction:: stellar_sdk.scval.to_bool
+.. autofunction:: stellar_sdk.scval.from_bool
+.. autofunction:: stellar_sdk.scval.to_bytes
+.. autofunction:: stellar_sdk.scval.from_bytes
+.. autofunction:: stellar_sdk.scval.to_duration
+.. autofunction:: stellar_sdk.scval.from_duration
+.. autofunction:: stellar_sdk.scval.to_int32
+.. autofunction:: stellar_sdk.scval.from_int32
+.. autofunction:: stellar_sdk.scval.to_int64
+.. autofunction:: stellar_sdk.scval.from_int64
+.. autofunction:: stellar_sdk.scval.to_int128
+.. autofunction:: stellar_sdk.scval.from_int128
+.. autofunction:: stellar_sdk.scval.to_int256
+.. autofunction:: stellar_sdk.scval.from_int256
+.. autofunction:: stellar_sdk.scval.to_map
+.. autofunction:: stellar_sdk.scval.from_map
+.. autofunction:: stellar_sdk.scval.to_string
+.. autofunction:: stellar_sdk.scval.from_string
+.. autofunction:: stellar_sdk.scval.to_symbol
+.. autofunction:: stellar_sdk.scval.from_symbol
+.. autofunction:: stellar_sdk.scval.to_timepoint
+.. autofunction:: stellar_sdk.scval.from_timepoint
+.. autofunction:: stellar_sdk.scval.to_uint32
+.. autofunction:: stellar_sdk.scval.from_uint32
+.. autofunction:: stellar_sdk.scval.to_uint64
+.. autofunction:: stellar_sdk.scval.from_uint64
+.. autofunction:: stellar_sdk.scval.to_uint128
+.. autofunction:: stellar_sdk.scval.from_uint128
+.. autofunction:: stellar_sdk.scval.to_uint256
+.. autofunction:: stellar_sdk.scval.from_uint256
+.. autofunction:: stellar_sdk.scval.to_vec
+.. autofunction:: stellar_sdk.scval.from_vec
+.. autofunction:: stellar_sdk.scval.to_enum
+.. autofunction:: stellar_sdk.scval.from_enum
+.. autofunction:: stellar_sdk.scval.to_tuple_struct
+.. autofunction:: stellar_sdk.scval.from_tuple_struct
+.. autofunction:: stellar_sdk.scval.to_struct
+.. autofunction:: stellar_sdk.scval.from_struct
+
Helpers
^^^^^^^
.. autofunction:: stellar_sdk.helpers.parse_transaction_envelope_from_xdr
@@ -922,6 +1006,18 @@ BucketMetadataExt
-----------------
.. autoclass:: stellar_sdk.xdr.bucket_metadata_ext.BucketMetadataExt
+BumpFootprintExpirationOp
+-------------------------
+.. autoclass:: stellar_sdk.xdr.bump_footprint_expiration_op.BumpFootprintExpirationOp
+
+BumpFootprintExpirationResult
+-----------------------------
+.. autoclass:: stellar_sdk.xdr.bump_footprint_expiration_result.BumpFootprintExpirationResult
+
+BumpFootprintExpirationResultCode
+---------------------------------
+.. autoclass:: stellar_sdk.xdr.bump_footprint_expiration_result_code.BumpFootprintExpirationResultCode
+
BumpSequenceOp
--------------
.. autoclass:: stellar_sdk.xdr.bump_sequence_op.BumpSequenceOp
@@ -1054,6 +1150,106 @@ ClawbackResultCode
------------------
.. autoclass:: stellar_sdk.xdr.clawback_result_code.ClawbackResultCode
+ConfigSettingContractBandwidthV0
+--------------------------------
+.. autoclass:: stellar_sdk.xdr.config_setting_contract_bandwidth_v0.ConfigSettingContractBandwidthV0
+
+ConfigSettingContractComputeV0
+------------------------------
+.. autoclass:: stellar_sdk.xdr.config_setting_contract_compute_v0.ConfigSettingContractComputeV0
+
+ConfigSettingContractEventsV0
+-----------------------------
+.. autoclass:: stellar_sdk.xdr.config_setting_contract_events_v0.ConfigSettingContractEventsV0
+
+ConfigSettingContractExecutionLanesV0
+-------------------------------------
+.. autoclass:: stellar_sdk.xdr.config_setting_contract_execution_lanes_v0.ConfigSettingContractExecutionLanesV0
+
+ConfigSettingContractHistoricalDataV0
+-------------------------------------
+.. autoclass:: stellar_sdk.xdr.config_setting_contract_historical_data_v0.ConfigSettingContractHistoricalDataV0
+
+ConfigSettingContractLedgerCostV0
+---------------------------------
+.. autoclass:: stellar_sdk.xdr.config_setting_contract_ledger_cost_v0.ConfigSettingContractLedgerCostV0
+
+ConfigSettingEntry
+------------------
+.. autoclass:: stellar_sdk.xdr.config_setting_entry.ConfigSettingEntry
+
+ConfigSettingID
+---------------
+.. autoclass:: stellar_sdk.xdr.config_setting_id.ConfigSettingID
+
+ConfigUpgradeSet
+----------------
+.. autoclass:: stellar_sdk.xdr.config_upgrade_set.ConfigUpgradeSet
+
+ConfigUpgradeSetKey
+-------------------
+.. autoclass:: stellar_sdk.xdr.config_upgrade_set_key.ConfigUpgradeSetKey
+
+ContractCodeEntry
+-----------------
+.. autoclass:: stellar_sdk.xdr.contract_code_entry.ContractCodeEntry
+
+ContractCostParamEntry
+----------------------
+.. autoclass:: stellar_sdk.xdr.contract_cost_param_entry.ContractCostParamEntry
+
+ContractCostParams
+------------------
+.. autoclass:: stellar_sdk.xdr.contract_cost_params.ContractCostParams
+
+ContractCostType
+----------------
+.. autoclass:: stellar_sdk.xdr.contract_cost_type.ContractCostType
+
+ContractDataDurability
+----------------------
+.. autoclass:: stellar_sdk.xdr.contract_data_durability.ContractDataDurability
+
+ContractDataEntry
+-----------------
+.. autoclass:: stellar_sdk.xdr.contract_data_entry.ContractDataEntry
+
+ContractEvent
+-------------
+.. autoclass:: stellar_sdk.xdr.contract_event.ContractEvent
+
+ContractEventBody
+-----------------
+.. autoclass:: stellar_sdk.xdr.contract_event_body.ContractEventBody
+
+ContractEventType
+-----------------
+.. autoclass:: stellar_sdk.xdr.contract_event_type.ContractEventType
+
+ContractEventV0
+---------------
+.. autoclass:: stellar_sdk.xdr.contract_event_v0.ContractEventV0
+
+ContractExecutable
+------------------
+.. autoclass:: stellar_sdk.xdr.contract_executable.ContractExecutable
+
+ContractExecutableType
+----------------------
+.. autoclass:: stellar_sdk.xdr.contract_executable_type.ContractExecutableType
+
+ContractIDPreimage
+------------------
+.. autoclass:: stellar_sdk.xdr.contract_id_preimage.ContractIDPreimage
+
+ContractIDPreimageFromAddress
+-----------------------------
+.. autoclass:: stellar_sdk.xdr.contract_id_preimage_from_address.ContractIDPreimageFromAddress
+
+ContractIDPreimageType
+----------------------
+.. autoclass:: stellar_sdk.xdr.contract_id_preimage_type.ContractIDPreimageType
+
CreateAccountOp
---------------
.. autoclass:: stellar_sdk.xdr.create_account_op.CreateAccountOp
@@ -1078,6 +1274,10 @@ CreateClaimableBalanceResultCode
--------------------------------
.. autoclass:: stellar_sdk.xdr.create_claimable_balance_result_code.CreateClaimableBalanceResultCode
+CreateContractArgs
+------------------
+.. autoclass:: stellar_sdk.xdr.create_contract_args.CreateContractArgs
+
CreatePassiveSellOfferOp
------------------------
.. autoclass:: stellar_sdk.xdr.create_passive_sell_offer_op.CreatePassiveSellOfferOp
@@ -1110,6 +1310,10 @@ DecoratedSignature
------------------
.. autoclass:: stellar_sdk.xdr.decorated_signature.DecoratedSignature
+DiagnosticEvent
+---------------
+.. autoclass:: stellar_sdk.xdr.diagnostic_event.DiagnosticEvent
+
DontHave
--------
.. autoclass:: stellar_sdk.xdr.dont_have.DontHave
@@ -1146,6 +1350,14 @@ ErrorCode
---------
.. autoclass:: stellar_sdk.xdr.error_code.ErrorCode
+EvictionIterator
+----------------
+.. autoclass:: stellar_sdk.xdr.eviction_iterator.EvictionIterator
+
+ExpirationEntry
+---------------
+.. autoclass:: stellar_sdk.xdr.expiration_entry.ExpirationEntry
+
ExtensionPoint
--------------
.. autoclass:: stellar_sdk.xdr.extension_point.ExtensionPoint
@@ -1170,6 +1382,18 @@ Float
-----
.. autoclass:: stellar_sdk.xdr.base.Float
+FloodAdvert
+-----------
+.. autoclass:: stellar_sdk.xdr.flood_advert.FloodAdvert
+
+FloodDemand
+-----------
+.. autoclass:: stellar_sdk.xdr.flood_demand.FloodDemand
+
+GeneralizedTransactionSet
+-------------------------
+.. autoclass:: stellar_sdk.xdr.generalized_transaction_set.GeneralizedTransactionSet
+
Hash
----
.. autoclass:: stellar_sdk.xdr.hash.Hash
@@ -1178,6 +1402,10 @@ HashIDPreimage
--------------
.. autoclass:: stellar_sdk.xdr.hash_id_preimage.HashIDPreimage
+HashIDPreimageContractID
+------------------------
+.. autoclass:: stellar_sdk.xdr.hash_id_preimage_contract_id.HashIDPreimageContractID
+
HashIDPreimageOperationID
-------------------------
.. autoclass:: stellar_sdk.xdr.hash_id_preimage_operation_id.HashIDPreimageOperationID
@@ -1186,6 +1414,10 @@ HashIDPreimageRevokeID
----------------------
.. autoclass:: stellar_sdk.xdr.hash_id_preimage_revoke_id.HashIDPreimageRevokeID
+HashIDPreimageSorobanAuthorization
+----------------------------------
+.. autoclass:: stellar_sdk.xdr.hash_id_preimage_soroban_authorization.HashIDPreimageSorobanAuthorization
+
Hello
-----
.. autoclass:: stellar_sdk.xdr.hello.Hello
@@ -1198,6 +1430,14 @@ HmacSha256Mac
-------------
.. autoclass:: stellar_sdk.xdr.hmac_sha256_mac.HmacSha256Mac
+HostFunction
+------------
+.. autoclass:: stellar_sdk.xdr.host_function.HostFunction
+
+HostFunctionType
+----------------
+.. autoclass:: stellar_sdk.xdr.host_function_type.HostFunctionType
+
Hyper
-----
.. autoclass:: stellar_sdk.xdr.base.Hyper
@@ -1234,6 +1474,14 @@ InnerTransactionResultResult
----------------------------
.. autoclass:: stellar_sdk.xdr.inner_transaction_result_result.InnerTransactionResultResult
+Int128Parts
+-----------
+.. autoclass:: stellar_sdk.xdr.int128_parts.Int128Parts
+
+Int256Parts
+-----------
+.. autoclass:: stellar_sdk.xdr.int256_parts.Int256Parts
+
Int32
-----
.. autoclass:: stellar_sdk.xdr.int32.Int32
@@ -1246,6 +1494,26 @@ Integer
-------
.. autoclass:: stellar_sdk.xdr.base.Integer
+InvokeContractArgs
+------------------
+.. autoclass:: stellar_sdk.xdr.invoke_contract_args.InvokeContractArgs
+
+InvokeHostFunctionOp
+--------------------
+.. autoclass:: stellar_sdk.xdr.invoke_host_function_op.InvokeHostFunctionOp
+
+InvokeHostFunctionResult
+------------------------
+.. autoclass:: stellar_sdk.xdr.invoke_host_function_result.InvokeHostFunctionResult
+
+InvokeHostFunctionResultCode
+----------------------------
+.. autoclass:: stellar_sdk.xdr.invoke_host_function_result_code.InvokeHostFunctionResultCode
+
+InvokeHostFunctionSuccessPreImage
+---------------------------------
+.. autoclass:: stellar_sdk.xdr.invoke_host_function_success_pre_image.InvokeHostFunctionSuccessPreImage
+
LedgerBounds
------------
.. autoclass:: stellar_sdk.xdr.ledger_bounds.LedgerBounds
@@ -1258,6 +1526,14 @@ LedgerCloseMetaV0
-----------------
.. autoclass:: stellar_sdk.xdr.ledger_close_meta_v0.LedgerCloseMetaV0
+LedgerCloseMetaV1
+-----------------
+.. autoclass:: stellar_sdk.xdr.ledger_close_meta_v1.LedgerCloseMetaV1
+
+LedgerCloseMetaV2
+-----------------
+.. autoclass:: stellar_sdk.xdr.ledger_close_meta_v2.LedgerCloseMetaV2
+
LedgerCloseValueSignature
-------------------------
.. autoclass:: stellar_sdk.xdr.ledger_close_value_signature.LedgerCloseValueSignature
@@ -1298,6 +1574,10 @@ LedgerEntryType
---------------
.. autoclass:: stellar_sdk.xdr.ledger_entry_type.LedgerEntryType
+LedgerFootprint
+---------------
+.. autoclass:: stellar_sdk.xdr.ledger_footprint.LedgerFootprint
+
LedgerHeader
------------
.. autoclass:: stellar_sdk.xdr.ledger_header.LedgerHeader
@@ -1338,10 +1618,26 @@ LedgerKeyClaimableBalance
-------------------------
.. autoclass:: stellar_sdk.xdr.ledger_key_claimable_balance.LedgerKeyClaimableBalance
+LedgerKeyConfigSetting
+----------------------
+.. autoclass:: stellar_sdk.xdr.ledger_key_config_setting.LedgerKeyConfigSetting
+
+LedgerKeyContractCode
+---------------------
+.. autoclass:: stellar_sdk.xdr.ledger_key_contract_code.LedgerKeyContractCode
+
+LedgerKeyContractData
+---------------------
+.. autoclass:: stellar_sdk.xdr.ledger_key_contract_data.LedgerKeyContractData
+
LedgerKeyData
-------------
.. autoclass:: stellar_sdk.xdr.ledger_key_data.LedgerKeyData
+LedgerKeyExpiration
+-------------------
+.. autoclass:: stellar_sdk.xdr.ledger_key_expiration.LedgerKeyExpiration
+
LedgerKeyLiquidityPool
----------------------
.. autoclass:: stellar_sdk.xdr.ledger_key_liquidity_pool.LedgerKeyLiquidityPool
@@ -1594,6 +1890,18 @@ PeerStats
---------
.. autoclass:: stellar_sdk.xdr.peer_stats.PeerStats
+PersistedSCPState
+-----------------
+.. autoclass:: stellar_sdk.xdr.persisted_scp_state.PersistedSCPState
+
+PersistedSCPStateV0
+-------------------
+.. autoclass:: stellar_sdk.xdr.persisted_scp_state_v0.PersistedSCPStateV0
+
+PersistedSCPStateV1
+-------------------
+.. autoclass:: stellar_sdk.xdr.persisted_scp_state_v1.PersistedSCPStateV1
+
PoolID
------
.. autoclass:: stellar_sdk.xdr.pool_id.PoolID
@@ -1622,6 +1930,18 @@ PublicKeyType
-------------
.. autoclass:: stellar_sdk.xdr.public_key_type.PublicKeyType
+RestoreFootprintOp
+------------------
+.. autoclass:: stellar_sdk.xdr.restore_footprint_op.RestoreFootprintOp
+
+RestoreFootprintResult
+----------------------
+.. autoclass:: stellar_sdk.xdr.restore_footprint_result.RestoreFootprintResult
+
+RestoreFootprintResultCode
+--------------------------
+.. autoclass:: stellar_sdk.xdr.restore_footprint_result_code.RestoreFootprintResultCode
+
RevokeSponsorshipOp
-------------------
.. autoclass:: stellar_sdk.xdr.revoke_sponsorship_op.RevokeSponsorshipOp
@@ -1642,6 +1962,66 @@ RevokeSponsorshipType
---------------------
.. autoclass:: stellar_sdk.xdr.revoke_sponsorship_type.RevokeSponsorshipType
+SCAddress
+---------
+.. autoclass:: stellar_sdk.xdr.sc_address.SCAddress
+
+SCAddressType
+-------------
+.. autoclass:: stellar_sdk.xdr.sc_address_type.SCAddressType
+
+SCBytes
+-------
+.. autoclass:: stellar_sdk.xdr.sc_bytes.SCBytes
+
+SCContractInstance
+------------------
+.. autoclass:: stellar_sdk.xdr.sc_contract_instance.SCContractInstance
+
+SCEnvMetaEntry
+--------------
+.. autoclass:: stellar_sdk.xdr.sc_env_meta_entry.SCEnvMetaEntry
+
+SCEnvMetaKind
+-------------
+.. autoclass:: stellar_sdk.xdr.sc_env_meta_kind.SCEnvMetaKind
+
+SCError
+-------
+.. autoclass:: stellar_sdk.xdr.sc_error.SCError
+
+SCErrorCode
+-----------
+.. autoclass:: stellar_sdk.xdr.sc_error_code.SCErrorCode
+
+SCErrorType
+-----------
+.. autoclass:: stellar_sdk.xdr.sc_error_type.SCErrorType
+
+SCMap
+-----
+.. autoclass:: stellar_sdk.xdr.sc_map.SCMap
+
+SCMapEntry
+----------
+.. autoclass:: stellar_sdk.xdr.sc_map_entry.SCMapEntry
+
+SCMetaEntry
+-----------
+.. autoclass:: stellar_sdk.xdr.sc_meta_entry.SCMetaEntry
+
+SCMetaKind
+----------
+.. autoclass:: stellar_sdk.xdr.sc_meta_kind.SCMetaKind
+
+SCMetaV0
+--------
+.. autoclass:: stellar_sdk.xdr.sc_meta_v0.SCMetaV0
+
+SCNonceKey
+----------
+.. autoclass:: stellar_sdk.xdr.sc_nonce_key.SCNonceKey
+
SCPBallot
---------
.. autoclass:: stellar_sdk.xdr.scp_ballot.SCPBallot
@@ -1690,10 +2070,130 @@ SCPStatementType
----------------
.. autoclass:: stellar_sdk.xdr.scp_statement_type.SCPStatementType
+SCSpecEntry
+-----------
+.. autoclass:: stellar_sdk.xdr.sc_spec_entry.SCSpecEntry
+
+SCSpecEntryKind
+---------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_entry_kind.SCSpecEntryKind
+
+SCSpecFunctionInputV0
+---------------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_function_input_v0.SCSpecFunctionInputV0
+
+SCSpecFunctionV0
+----------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_function_v0.SCSpecFunctionV0
+
+SCSpecType
+----------
+.. autoclass:: stellar_sdk.xdr.sc_spec_type.SCSpecType
+
+SCSpecTypeBytesN
+----------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_type_bytes_n.SCSpecTypeBytesN
+
+SCSpecTypeDef
+-------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_type_def.SCSpecTypeDef
+
+SCSpecTypeMap
+-------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_type_map.SCSpecTypeMap
+
+SCSpecTypeOption
+----------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_type_option.SCSpecTypeOption
+
+SCSpecTypeResult
+----------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_type_result.SCSpecTypeResult
+
+SCSpecTypeTuple
+---------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_type_tuple.SCSpecTypeTuple
+
+SCSpecTypeUDT
+-------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_type_udt.SCSpecTypeUDT
+
+SCSpecTypeVec
+-------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_type_vec.SCSpecTypeVec
+
+SCSpecUDTEnumCaseV0
+-------------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_enum_case_v0.SCSpecUDTEnumCaseV0
+
+SCSpecUDTEnumV0
+---------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_enum_v0.SCSpecUDTEnumV0
+
+SCSpecUDTErrorEnumCaseV0
+------------------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_error_enum_case_v0.SCSpecUDTErrorEnumCaseV0
+
+SCSpecUDTErrorEnumV0
+--------------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_error_enum_v0.SCSpecUDTErrorEnumV0
+
+SCSpecUDTStructFieldV0
+----------------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_struct_field_v0.SCSpecUDTStructFieldV0
+
+SCSpecUDTStructV0
+-----------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_struct_v0.SCSpecUDTStructV0
+
+SCSpecUDTUnionCaseTupleV0
+-------------------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_union_case_tuple_v0.SCSpecUDTUnionCaseTupleV0
+
+SCSpecUDTUnionCaseV0
+--------------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_union_case_v0.SCSpecUDTUnionCaseV0
+
+SCSpecUDTUnionCaseV0Kind
+------------------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_union_case_v0_kind.SCSpecUDTUnionCaseV0Kind
+
+SCSpecUDTUnionCaseVoidV0
+------------------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_union_case_void_v0.SCSpecUDTUnionCaseVoidV0
+
+SCSpecUDTUnionV0
+----------------
+.. autoclass:: stellar_sdk.xdr.sc_spec_udt_union_v0.SCSpecUDTUnionV0
+
+SCString
+--------
+.. autoclass:: stellar_sdk.xdr.sc_string.SCString
+
+SCSymbol
+--------
+.. autoclass:: stellar_sdk.xdr.sc_symbol.SCSymbol
+
+SCVal
+-----
+.. autoclass:: stellar_sdk.xdr.sc_val.SCVal
+
+SCValType
+---------
+.. autoclass:: stellar_sdk.xdr.sc_val_type.SCValType
+
+SCVec
+-----
+.. autoclass:: stellar_sdk.xdr.sc_vec.SCVec
+
SendMore
--------
.. autoclass:: stellar_sdk.xdr.send_more.SendMore
+SendMoreExtended
+----------------
+.. autoclass:: stellar_sdk.xdr.send_more_extended.SendMoreExtended
+
SequenceNumber
--------------
.. autoclass:: stellar_sdk.xdr.sequence_number.SequenceNumber
@@ -1758,10 +2258,54 @@ SimplePaymentResult
-------------------
.. autoclass:: stellar_sdk.xdr.simple_payment_result.SimplePaymentResult
+SorobanAddressCredentials
+-------------------------
+.. autoclass:: stellar_sdk.xdr.soroban_address_credentials.SorobanAddressCredentials
+
+SorobanAuthorizationEntry
+-------------------------
+.. autoclass:: stellar_sdk.xdr.soroban_authorization_entry.SorobanAuthorizationEntry
+
+SorobanAuthorizedFunction
+-------------------------
+.. autoclass:: stellar_sdk.xdr.soroban_authorized_function.SorobanAuthorizedFunction
+
+SorobanAuthorizedFunctionType
+-----------------------------
+.. autoclass:: stellar_sdk.xdr.soroban_authorized_function_type.SorobanAuthorizedFunctionType
+
+SorobanAuthorizedInvocation
+---------------------------
+.. autoclass:: stellar_sdk.xdr.soroban_authorized_invocation.SorobanAuthorizedInvocation
+
+SorobanCredentials
+------------------
+.. autoclass:: stellar_sdk.xdr.soroban_credentials.SorobanCredentials
+
+SorobanCredentialsType
+----------------------
+.. autoclass:: stellar_sdk.xdr.soroban_credentials_type.SorobanCredentialsType
+
+SorobanResources
+----------------
+.. autoclass:: stellar_sdk.xdr.soroban_resources.SorobanResources
+
+SorobanTransactionData
+----------------------
+.. autoclass:: stellar_sdk.xdr.soroban_transaction_data.SorobanTransactionData
+
+SorobanTransactionMeta
+----------------------
+.. autoclass:: stellar_sdk.xdr.soroban_transaction_meta.SorobanTransactionMeta
+
SponsorshipDescriptor
---------------------
.. autoclass:: stellar_sdk.xdr.sponsorship_descriptor.SponsorshipDescriptor
+StateExpirationSettings
+-----------------------
+.. autoclass:: stellar_sdk.xdr.state_expiration_settings.StateExpirationSettings
+
StellarMessage
--------------
.. autoclass:: stellar_sdk.xdr.stellar_message.StellarMessage
@@ -1778,6 +2322,10 @@ StellarValueType
----------------
.. autoclass:: stellar_sdk.xdr.stellar_value_type.StellarValueType
+StoredTransactionSet
+--------------------
+.. autoclass:: stellar_sdk.xdr.stored_transaction_set.StoredTransactionSet
+
String
------
.. autoclass:: stellar_sdk.xdr.base.String
@@ -1794,6 +2342,10 @@ SurveyMessageCommandType
------------------------
.. autoclass:: stellar_sdk.xdr.survey_message_command_type.SurveyMessageCommandType
+SurveyMessageResponseType
+-------------------------
+.. autoclass:: stellar_sdk.xdr.survey_message_response_type.SurveyMessageResponseType
+
SurveyRequestMessage
--------------------
.. autoclass:: stellar_sdk.xdr.survey_request_message.SurveyRequestMessage
@@ -1822,9 +2374,13 @@ TimePoint
---------
.. autoclass:: stellar_sdk.xdr.time_point.TimePoint
-TopologyResponseBody
---------------------
-.. autoclass:: stellar_sdk.xdr.topology_response_body.TopologyResponseBody
+TopologyResponseBodyV0
+----------------------
+.. autoclass:: stellar_sdk.xdr.topology_response_body_v0.TopologyResponseBodyV0
+
+TopologyResponseBodyV1
+----------------------
+.. autoclass:: stellar_sdk.xdr.topology_response_body_v1.TopologyResponseBodyV1
Transaction
-----------
@@ -1866,6 +2422,14 @@ TransactionMetaV2
-----------------
.. autoclass:: stellar_sdk.xdr.transaction_meta_v2.TransactionMetaV2
+TransactionMetaV3
+-----------------
+.. autoclass:: stellar_sdk.xdr.transaction_meta_v3.TransactionMetaV3
+
+TransactionPhase
+----------------
+.. autoclass:: stellar_sdk.xdr.transaction_phase.TransactionPhase
+
TransactionResult
-----------------
.. autoclass:: stellar_sdk.xdr.transaction_result.TransactionResult
@@ -1898,6 +2462,10 @@ TransactionSet
--------------
.. autoclass:: stellar_sdk.xdr.transaction_set.TransactionSet
+TransactionSetV1
+----------------
+.. autoclass:: stellar_sdk.xdr.transaction_set_v1.TransactionSetV1
+
TransactionSignaturePayload
---------------------------
.. autoclass:: stellar_sdk.xdr.transaction_signature_payload.TransactionSignaturePayload
@@ -1954,6 +2522,34 @@ TrustLineFlags
--------------
.. autoclass:: stellar_sdk.xdr.trust_line_flags.TrustLineFlags
+TxAdvertVector
+--------------
+.. autoclass:: stellar_sdk.xdr.tx_advert_vector.TxAdvertVector
+
+TxDemandVector
+--------------
+.. autoclass:: stellar_sdk.xdr.tx_demand_vector.TxDemandVector
+
+TxSetComponent
+--------------
+.. autoclass:: stellar_sdk.xdr.tx_set_component.TxSetComponent
+
+TxSetComponentTxsMaybeDiscountedFee
+-----------------------------------
+.. autoclass:: stellar_sdk.xdr.tx_set_component_txs_maybe_discounted_fee.TxSetComponentTxsMaybeDiscountedFee
+
+TxSetComponentType
+------------------
+.. autoclass:: stellar_sdk.xdr.tx_set_component_type.TxSetComponentType
+
+UInt128Parts
+------------
+.. autoclass:: stellar_sdk.xdr.u_int128_parts.UInt128Parts
+
+UInt256Parts
+------------
+.. autoclass:: stellar_sdk.xdr.u_int256_parts.UInt256Parts
+
Uint256
-------
.. autoclass:: stellar_sdk.xdr.uint256.Uint256
@@ -1988,6 +2584,8 @@ Value
Constants
---------
+.. autodata:: stellar_sdk.xdr.constants.AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED
+.. autodata:: stellar_sdk.xdr.constants.CONTRACT_COST_COUNT_LIMIT
.. autodata:: stellar_sdk.xdr.constants.LIQUIDITY_POOL_FEE_V18
.. autodata:: stellar_sdk.xdr.constants.MASK_ACCOUNT_FLAGS
.. autodata:: stellar_sdk.xdr.constants.MASK_ACCOUNT_FLAGS_V17
@@ -1998,4 +2596,10 @@ Constants
.. autodata:: stellar_sdk.xdr.constants.MASK_TRUSTLINE_FLAGS_V13
.. autodata:: stellar_sdk.xdr.constants.MASK_TRUSTLINE_FLAGS_V17
.. autodata:: stellar_sdk.xdr.constants.MAX_OPS_PER_TX
-.. autodata:: stellar_sdk.xdr.constants.MAX_SIGNERS
\ No newline at end of file
+.. autodata:: stellar_sdk.xdr.constants.MAX_SIGNERS
+.. autodata:: stellar_sdk.xdr.constants.SCSYMBOL_LIMIT
+.. autodata:: stellar_sdk.xdr.constants.SC_SPEC_DOC_LIMIT
+.. autodata:: stellar_sdk.xdr.constants.TX_ADVERT_VECTOR_MAX_SIZE
+.. autodata:: stellar_sdk.xdr.constants.TX_DEMAND_VECTOR_MAX_SIZE
+(stellar-sdk-py3.10) py-stellar-base [soroban-update●●]
+
diff --git a/docs/en/conf.py b/docs/en/conf.py
index c31f012be..ad2f6adeb 100644
--- a/docs/en/conf.py
+++ b/docs/en/conf.py
@@ -38,6 +38,7 @@
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx_autodoc_typehints",
+ "sphinxcontrib.autodoc_pydantic",
]
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
@@ -183,3 +184,6 @@
"Miscellaneous",
),
]
+
+autodoc_pydantic_model_show_json = True
+autodoc_pydantic_settings_show_json = False
diff --git a/docs/en/index.rst b/docs/en/index.rst
index c41266dd1..edf327d10 100644
--- a/docs/en/index.rst
+++ b/docs/en/index.rst
@@ -40,18 +40,19 @@ Stellar Python SDK
:alt: PyPI - Implementation
:target: https://pypi.python.org/pypi/stellar-sdk
-.. image:: https://img.shields.io/badge/Stellar%20Protocol-19-blue
+.. image:: https://img.shields.io/badge/Stellar%20Protocol-20-blue
:alt: Stellar Protocol
:target: https://developers.stellar.org/docs/glossary/scp/
py-stellar-base is a Python library for communicating with
-a `Stellar Horizon server`_. It is used for building Stellar apps on Python. It supports **Python 3.7+** as
+a `Stellar Horizon server`_ and `Soroban-RPC server`_. It is used for building Stellar apps on Python. It supports **Python 3.7+** as
well as PyPy 3.7+.
It provides:
- a networking layer API for Horizon endpoints.
-- facilities for building and signing transactions, for communicating with a Stellar Horizon instance, and for submitting transactions or querying network history.
+- a networking layer API for Soroban-RPC server methods.
+- facilities for building and signing transactions, for communicating with a Stellar Horizon and Soroban-RPC instance, and for submitting transactions or querying network history.
Quickstart
----------
@@ -113,3 +114,4 @@ Thank you to all the people who have already contributed to Stellar ecosystem!
.. _Stellar Horizon server: https://github.com/stellar/go/tree/master/services/horizon
.. _pip: https://pip.pypa.io/en/stable/quickstart/
.. _Stellar JavaScript SDK: https://github.com/stellar/js-stellar-sdk
+.. _Soroban-RPC server: https://soroban.stellar.org/docs/reference/rpc
\ No newline at end of file
diff --git a/docs/gen_xdr_api.py b/docs/gen_xdr_api.py
new file mode 100644
index 000000000..b3ef7aeb6
--- /dev/null
+++ b/docs/gen_xdr_api.py
@@ -0,0 +1,27 @@
+import inspect
+
+import stellar_sdk.xdr
+import stellar_sdk.xdr.constants
+
+title = "stellar_sdk.xdr"
+print(title)
+print("^" * len(title))
+print("")
+
+for _, cls in inspect.getmembers(stellar_sdk.xdr, inspect.isclass):
+ cls_name = cls.__qualname__
+ cls_module = cls.__module__
+ cls_full_name = f"{cls_module}.{cls_name}"
+ print(cls_name)
+ print("-" * len(cls_name))
+ print(f".. autoclass:: {cls_full_name}")
+ print("")
+
+constant_names = [
+ item for item in dir(stellar_sdk.xdr.constants) if not item.startswith("__")
+]
+
+print("Constants")
+print("---------")
+for n in constant_names:
+ print(f".. autodata:: stellar_sdk.xdr.constants.{n}")
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 3428dbbcd..2e650e1ca 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,5 +1,4 @@
-sphinx
-sphinx-rtd-theme
-sphinx-autodoc-typehints
-# install stellar-sdk in the readthedocs.io environment
-.
\ No newline at end of file
+Sphinx==7.2.3
+sphinx-rtd-theme==1.3.0
+sphinx-autodoc-typehints==1.24.0
+autodoc-pydantic==2.0.1
\ No newline at end of file
diff --git a/docs/zh_CN/Makefile b/docs/zh_CN/Makefile
deleted file mode 100644
index 247e5232f..000000000
--- a/docs/zh_CN/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Minimal makefile for Sphinx documentation
-#
-
-# You can set these variables from the command line.
-SPHINXOPTS =
-SPHINXBUILD = sphinx-build
-SPHINXPROJ = py-stellar-base
-SOURCEDIR = .
-BUILDDIR = _build
-
-# Put it first so that "make" without argument is like "make help".
-help:
- @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
-
-.PHONY: help Makefile
-
-# Catch-all target: route all unknown targets to Sphinx using the new
-# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
-%: Makefile
- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/zh_CN/api.rst b/docs/zh_CN/api.rst
deleted file mode 100644
index 580e3845e..000000000
--- a/docs/zh_CN/api.rst
+++ /dev/null
@@ -1,2000 +0,0 @@
-.. _api:
-
-*****************
-API 文档
-*****************
-
-
-.. module:: stellar_sdk
-
-
-Account
-^^^^^^^^
-
-.. autoclass:: stellar_sdk.account.Account
- :members:
- :inherited-members:
-
-Asset
-^^^^^
-
-.. autoclass:: stellar_sdk.asset.Asset
- :members:
- :inherited-members:
-
-Call Builder
-^^^^^^^^^^^^
-
-AccountsCallBuilder
--------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.AccountsCallBuilder
- :members:
- :inherited-members:
-
-AssetsCallBuilder
------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.AssetsCallBuilder
- :members:
- :inherited-members:
-
-ClaimableBalancesCallBuilder
-----------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.ClaimableBalancesCallBuilder
- :members:
- :inherited-members:
-
-DataCallBuilder
----------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.DataCallBuilder
- :members:
- :inherited-members:
-
-EffectsCallBuilder
-------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.EffectsCallBuilder
- :members:
- :inherited-members:
-
-FeeStatsCallBuilder
--------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.FeeStatsCallBuilder
- :members:
- :inherited-members:
-
-LedgersCallBuilder
-------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.LedgersCallBuilder
- :members:
- :inherited-members:
-
-LiquidityPoolsBuilder
----------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.LiquidityPoolsBuilder
- :members:
- :inherited-members:
-
-OffersCallBuilder
----------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.OffersCallBuilder
- :members:
- :inherited-members:
-
-OperationsCallBuilder
----------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.OperationsCallBuilder
- :members:
- :inherited-members:
-
-OrderbookCallBuilder
---------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.OrderbookCallBuilder
- :members:
- :inherited-members:
-
-PaymentsCallBuilder
--------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.PaymentsCallBuilder
- :members:
- :inherited-members:
-
-RootCallBuilder
--------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.RootCallBuilder
- :members:
- :inherited-members:
-
-StrictReceivePathsCallBuilder
-------------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.StrictReceivePathsCallBuilder
- :members:
- :inherited-members:
-
-StrictSendPathsCallBuilder
-------------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.StrictSendPathsCallBuilder
- :members:
- :inherited-members:
-
-TradeAggregationsCallBuilder
-----------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.TradeAggregationsCallBuilder
- :members:
- :inherited-members:
-
-TradesCallBuilder
------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.TradesCallBuilder
- :members:
- :inherited-members:
-
-TransactionsCallBuilder
------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_sync.TransactionsCallBuilder
- :members:
- :inherited-members:
-
-Call Builder Async
-^^^^^^^^^^^^^^^^^^
-
-AccountsCallBuilder
--------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.AccountsCallBuilder
- :members:
- :inherited-members:
-
-AssetsCallBuilder
------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.AssetsCallBuilder
- :members:
- :inherited-members:
-
-ClaimableBalancesCallBuilder
-----------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.ClaimableBalancesCallBuilder
- :members:
- :inherited-members:
-
-DataCallBuilder
----------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.DataCallBuilder
- :members:
- :inherited-members:
-
-EffectsCallBuilder
-------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.EffectsCallBuilder
- :members:
- :inherited-members:
-
-FeeStatsCallBuilder
--------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.FeeStatsCallBuilder
- :members:
- :inherited-members:
-
-LedgersCallBuilder
-------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.LedgersCallBuilder
- :members:
- :inherited-members:
-
-LiquidityPoolsBuilder
----------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.LiquidityPoolsBuilder
- :members:
- :inherited-members:
-
-OffersCallBuilder
----------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.OffersCallBuilder
- :members:
- :inherited-members:
-
-OperationsCallBuilder
----------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.OperationsCallBuilder
- :members:
- :inherited-members:
-
-OrderbookCallBuilder
---------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.OrderbookCallBuilder
- :members:
- :inherited-members:
-
-PaymentsCallBuilder
--------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.PaymentsCallBuilder
- :members:
- :inherited-members:
-
-RootCallBuilder
--------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.RootCallBuilder
- :members:
- :inherited-members:
-
-StrictReceivePathsCallBuilder
-------------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.StrictReceivePathsCallBuilder
- :members:
- :inherited-members:
-
-StrictSendPathsCallBuilder
-------------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.StrictSendPathsCallBuilder
- :members:
- :inherited-members:
-
-TradeAggregationsCallBuilder
-----------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.TradeAggregationsCallBuilder
- :members:
- :inherited-members:
-
-TradesCallBuilder
------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.TradesCallBuilder
- :members:
- :inherited-members:
-
-TransactionsCallBuilder
------------------------
-.. autoclass:: stellar_sdk.call_builder.call_builder_async.TransactionsCallBuilder
- :members:
- :inherited-members:
-
-Client
-^^^^^^
-
-BaseAsyncClient
----------------
-
-.. autoclass:: stellar_sdk.client.base_async_client.BaseAsyncClient
- :members:
-
-BaseSyncClient
----------------
-
-.. autoclass:: stellar_sdk.client.base_sync_client.BaseSyncClient
- :members:
-
-AiohttpClient
---------------
-
-.. autoclass:: stellar_sdk.client.aiohttp_client.AiohttpClient
- :members:
-
-RequestsClient
---------------
-
-.. autoclass:: stellar_sdk.client.requests_client.RequestsClient
- :members:
-
-SimpleRequestsClient
---------------------
-
-.. autoclass:: stellar_sdk.client.simple_requests_client.SimpleRequestsClient
- :members:
-
-Response
---------
-
-.. autoclass:: stellar_sdk.client.response.Response
- :members:
-
-
-
-Exceptions
-^^^^^^^^^^
-
-SdkError
---------
-
-.. autoclass:: stellar_sdk.exceptions.SdkError
- :members:
-
-BadSignatureError
------------------
-
-.. autoclass:: stellar_sdk.exceptions.BadSignatureError
- :members:
-
-Ed25519PublicKeyInvalidError
-----------------------------
-
-.. autoclass:: stellar_sdk.exceptions.Ed25519PublicKeyInvalidError
- :members:
-
-Ed25519SecretSeedInvalidError
------------------------------
-
-.. autoclass:: stellar_sdk.exceptions.Ed25519SecretSeedInvalidError
- :members:
-
-MissingEd25519SecretSeedError
------------------------------
-
-.. autoclass:: stellar_sdk.exceptions.MissingEd25519SecretSeedError
- :members:
-
-MemoInvalidException
---------------------
-
-.. autoclass:: stellar_sdk.exceptions.MemoInvalidException
- :members:
-
-AssetCodeInvalidError
----------------------
-
-.. autoclass:: stellar_sdk.exceptions.AssetCodeInvalidError
- :members:
-
-AssetIssuerInvalidError
------------------------
-
-.. autoclass:: stellar_sdk.exceptions.AssetIssuerInvalidError
- :members:
-
-NoApproximationError
---------------------
-
-.. autoclass:: stellar_sdk.exceptions.NoApproximationError
- :members:
-
-SignatureExistError
--------------------
-
-.. autoclass:: stellar_sdk.exceptions.SignatureExistError
- :members:
-
-BaseRequestError
-----------------
-
-.. autoclass:: stellar_sdk.exceptions.BaseRequestError
- :members:
-
-ConnectionError
----------------
-
-.. autoclass:: stellar_sdk.exceptions.ConnectionError
- :members:
-
-BaseHorizonError
-----------------
-
-.. autoclass:: stellar_sdk.exceptions.BaseHorizonError
- :members:
-
-NotFoundError
--------------
-
-.. autoclass:: stellar_sdk.exceptions.NotFoundError
- :members:
-
-BadRequestError
----------------
-
-.. autoclass:: stellar_sdk.exceptions.BadRequestError
- :members:
-
-BadResponseError
-----------------
-
-.. autoclass:: stellar_sdk.exceptions.BadResponseError
- :members:
-
-FeatureNotEnabledError
-----------------------
-
-.. autoclass:: stellar_sdk.exceptions.FeatureNotEnabledError
- :members:
-
-Keypair
-^^^^^^^
-
-.. autoclass:: stellar_sdk.keypair.Keypair
- :members:
- :inherited-members:
-
-LiquidityPoolAsset
-^^^^^^^^^^^^^^^^^^
-.. autodata:: stellar_sdk.liquidity_pool_asset.LIQUIDITY_POOL_FEE_V18
-.. autoclass:: stellar_sdk.liquidity_pool_asset.LiquidityPoolAsset
- :members:
-
-LiquidityPoolId
-^^^^^^^^^^^^^^^
-.. autoclass:: stellar_sdk.liquidity_pool_id.LiquidityPoolId
- :members:
-
-Memo
-^^^^
-
-Memo
-----
-
-.. autoclass:: stellar_sdk.memo.Memo
- :members:
-
-NoneMemo
---------
-.. autoclass:: stellar_sdk.memo.NoneMemo
- :members:
-
-TextMemo
---------
-.. autoclass:: stellar_sdk.memo.TextMemo
- :members:
-
-IdMemo
-------
-.. autoclass:: stellar_sdk.memo.IdMemo
- :members:
-
-HashMemo
---------
-.. autoclass:: stellar_sdk.memo.HashMemo
- :members:
-
-ReturnHashMemo
---------------
-.. autoclass:: stellar_sdk.memo.ReturnHashMemo
- :members:
-
-MuxedAccount
-^^^^^^^^^^^^
-
-.. autoclass:: stellar_sdk.muxed_account.MuxedAccount
- :members:
-
-Network
-^^^^^^^
-
-.. autoclass:: stellar_sdk.network.Network
- :members:
- :inherited-members:
-
-.. _operation_list_archor:
-
-Operation
-^^^^^^^^^
-
-Operation
----------
-.. autoclass:: stellar_sdk.operation.Operation
- :members:
- :inherited-members:
-
-AccountMerge
-------------
-.. autoclass:: stellar_sdk.operation.AccountMerge
- :members: to_xdr_object, from_xdr_object
-
-AllowTrust
-----------
-.. autoclass:: stellar_sdk.operation.AllowTrust
- :members: to_xdr_object, from_xdr_object
-
-.. autoclass:: stellar_sdk.operation.allow_trust.TrustLineEntryFlag
- :members:
-
-BumpSequence
-------------
-.. autoclass:: stellar_sdk.operation.BumpSequence
- :members: to_xdr_object, from_xdr_object
-
-ChangeTrust
------------
-.. autoclass:: stellar_sdk.operation.ChangeTrust
- :members: to_xdr_object, from_xdr_object
-
-CreateAccount
--------------
-.. autoclass:: stellar_sdk.operation.CreateAccount
- :members: to_xdr_object, from_xdr_object
-
-CreatePassiveSellOffer
-----------------------
-.. autoclass:: stellar_sdk.operation.CreatePassiveSellOffer
- :members: to_xdr_object, from_xdr_object
-
-Inflation
----------
-.. autoclass:: stellar_sdk.operation.Inflation
- :members: to_xdr_object, from_xdr_object
-
-LiquidityPoolDeposit
---------------------
-.. autoclass:: stellar_sdk.operation.LiquidityPoolDeposit
- :members: to_xdr_object, from_xdr_object
-
-LiquidityPoolWithdraw
----------------------
-.. autoclass:: stellar_sdk.operation.LiquidityPoolWithdraw
- :members: to_xdr_object, from_xdr_object
-
-ManageBuyOffer
---------------
-.. autoclass:: stellar_sdk.operation.ManageBuyOffer
- :members: to_xdr_object, from_xdr_object
-
-ManageData
-----------
-.. autoclass:: stellar_sdk.operation.ManageData
- :members: to_xdr_object, from_xdr_object
-
-ManageSellOffer
----------------
-.. autoclass:: stellar_sdk.operation.ManageSellOffer
- :members: to_xdr_object, from_xdr_object
-
-PathPaymentStrictReceive
-------------------------
-.. autoclass:: stellar_sdk.operation.PathPaymentStrictReceive
- :members: to_xdr_object, from_xdr_object
-
-PathPaymentStrictSend
----------------------
-.. autoclass:: stellar_sdk.operation.PathPaymentStrictSend
- :members: to_xdr_object, from_xdr_object
-
-Payment
--------
-.. autoclass:: stellar_sdk.operation.Payment
- :members: to_xdr_object, from_xdr_object
-
-SetOptions
-----------
-.. autoclass:: stellar_sdk.operation.SetOptions
- :members: to_xdr_object, from_xdr_object
-
-.. autoclass:: stellar_sdk.operation.set_options.AuthorizationFlag
- :members:
-
-CreateClaimableBalance
-----------------------
-.. autoclass:: stellar_sdk.operation.CreateClaimableBalance
- :members: to_xdr_object, from_xdr_object
-
-.. autoclass:: stellar_sdk.operation.Claimant
- :members:
-
-.. autoclass:: stellar_sdk.operation.ClaimPredicate
- :members:
-
-.. autoclass:: stellar_sdk.operation.create_claimable_balance.ClaimPredicateType
- :members:
-
-.. autoclass:: stellar_sdk.operation.create_claimable_balance.ClaimPredicateGroup
- :members:
-
-ClaimClaimableBalance
----------------------
-.. autoclass:: stellar_sdk.operation.ClaimClaimableBalance
- :members: to_xdr_object, from_xdr_object
-
-BeginSponsoringFutureReserves
------------------------------
-.. autoclass:: stellar_sdk.operation.BeginSponsoringFutureReserves
- :members: to_xdr_object, from_xdr_object
-
-EndSponsoringFutureReserves
----------------------------
-.. autoclass:: stellar_sdk.operation.EndSponsoringFutureReserves
- :members: to_xdr_object, from_xdr_object
-
-RevokeSponsorship
------------------
-.. autoclass:: stellar_sdk.operation.RevokeSponsorship
- :members: to_xdr_object, from_xdr_object
-
-.. autoclass:: stellar_sdk.operation.revoke_sponsorship.RevokeSponsorshipType
- :members:
-
-.. autoclass:: stellar_sdk.operation.revoke_sponsorship.TrustLine
- :members:
-
-.. autoclass:: stellar_sdk.operation.revoke_sponsorship.Offer
- :members:
-
-.. autoclass:: stellar_sdk.operation.revoke_sponsorship.Data
- :members:
-
-.. autoclass:: stellar_sdk.operation.revoke_sponsorship.Signer
- :members:
-
-Clawback
---------
-.. autoclass:: stellar_sdk.operation.Clawback
- :members: to_xdr_object, from_xdr_object
-
-ClawbackClaimableBalance
-------------------------
-.. autoclass:: stellar_sdk.operation.ClawbackClaimableBalance
- :members: to_xdr_object, from_xdr_object
-
-SetTrustLineFlags
------------------
-.. autoclass:: stellar_sdk.operation.SetTrustLineFlags
- :members: to_xdr_object, from_xdr_object
-
-.. autoclass:: stellar_sdk.operation.set_trust_line_flags.TrustLineFlags
- :members:
-
-Price
-^^^^^
-
-.. autoclass:: stellar_sdk.price.Price
- :members:
- :inherited-members:
-
-Server
-^^^^^^
-
-.. autoclass:: stellar_sdk.server.Server
- :members:
- :inherited-members:
-
-ServerAsync
-^^^^^^^^^^^
-
-.. autoclass:: stellar_sdk.server_async.ServerAsync
- :members:
- :inherited-members:
-
-Signer
-^^^^^^
-
-.. autoclass:: stellar_sdk.signer.Signer
- :members:
- :inherited-members:
-
-SignerKey
-^^^^^^^^^
-
-.. autoclass:: stellar_sdk.signer_key.SignerKey
- :members:
- :inherited-members:
-
-.. autoclass:: stellar_sdk.signer_key.SignerKeyType
- :members:
-
-StrKey
-^^^^^^
-
-.. autoclass:: stellar_sdk.strkey.StrKey
- :members:
- :inherited-members:
-
-TimeBounds
-^^^^^^^^^^
-
-.. autoclass:: stellar_sdk.time_bounds.TimeBounds
- :members:
- :inherited-members:
-
-DecoratedSignature
-^^^^^^^^^^^^^^^^^^
-
-.. autoclass:: stellar_sdk.decorated_signature.DecoratedSignature
- :members:
- :inherited-members:
-
-Transaction
-^^^^^^^^^^^
-
-.. autoclass:: stellar_sdk.transaction.Transaction
- :members:
-
-TransactionEnvelope
-^^^^^^^^^^^^^^^^^^^
-
-.. autoclass:: stellar_sdk.transaction_envelope.TransactionEnvelope
- :members:
- :inherited-members:
-
-FeeBumpTransaction
-^^^^^^^^^^^^^^^^^^
-
-.. autoclass:: stellar_sdk.fee_bump_transaction.FeeBumpTransaction
- :members:
- :inherited-members:
-
-FeeBumpTransactionEnvelope
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-.. autoclass:: stellar_sdk.fee_bump_transaction_envelope.FeeBumpTransactionEnvelope
- :members:
- :inherited-members:
-
-TransactionBuilder
-^^^^^^^^^^^^^^^^^^
-
-.. autoclass:: stellar_sdk.transaction_builder.TransactionBuilder
- :members:
-
-Helpers
-^^^^^^^
-.. autofunction:: stellar_sdk.helpers.parse_transaction_envelope_from_xdr
-
-Stellar Ecosystem Proposals
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-SEP 0001: stellar.toml
-----------------------
-.. autofunction:: stellar_sdk.sep.stellar_toml.fetch_stellar_toml
-.. autofunction:: stellar_sdk.sep.stellar_toml.fetch_stellar_toml_async
-
-SEP 0002: Federation protocol
------------------------------
-.. autofunction:: stellar_sdk.sep.federation.resolve_stellar_address
-.. autofunction:: stellar_sdk.sep.federation.resolve_stellar_address_async
-.. autofunction:: stellar_sdk.sep.federation.resolve_account_id_async
-.. autofunction:: stellar_sdk.sep.federation.resolve_account_id
-.. autoclass:: stellar_sdk.sep.federation.FederationRecord
- :members:
-
-SEP 0005: Key Derivation Methods for Stellar Accounts
------------------------------------------------------
-.. autoclass:: stellar_sdk.sep.mnemonic.StellarMnemonic
- :members:
-.. autoclass:: stellar_sdk.sep.mnemonic.Language
- :members:
- :undoc-members:
-
-SEP 0007: URI Scheme to facilitate delegated signing
------------------------------------------------------
-.. autoclass:: stellar_sdk.sep.stellar_uri.PayStellarUri
- :members:
- :inherited-members:
-.. autoclass:: stellar_sdk.sep.stellar_uri.TransactionStellarUri
- :members:
- :inherited-members:
-.. autoclass:: stellar_sdk.sep.stellar_uri.Replacement
- :members:
- :inherited-members:
-
-SEP 0010: Stellar Web Authentication
-------------------------------------
-.. autofunction:: stellar_sdk.sep.stellar_web_authentication.build_challenge_transaction
-.. autofunction:: stellar_sdk.sep.stellar_web_authentication.read_challenge_transaction
-.. autofunction:: stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_threshold
-.. autofunction:: stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_signed_by_client_master_key
-.. autofunction:: stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction_signers
-.. autofunction:: stellar_sdk.sep.stellar_web_authentication.verify_challenge_transaction
-.. autoclass:: stellar_sdk.sep.stellar_web_authentication.ChallengeTransaction
- :members:
-
-SEP 0011: Txrep: human-readable low-level representation of Stellar transactions
----------------------------------------------------------------------------------
-.. autofunction:: stellar_sdk.sep.txrep.to_txrep
-.. autofunction:: stellar_sdk.sep.txrep.from_txrep
-
-SEP 0035: Operation IDs
------------------------
-.. autoclass:: stellar_sdk.sep.toid.TOID
- :members:
- :inherited-members:
-
-Exceptions
-----------
-.. autoclass:: stellar_sdk.sep.exceptions.StellarTomlNotFoundError
-.. autoclass:: stellar_sdk.sep.exceptions.InvalidFederationAddress
-.. autoclass:: stellar_sdk.sep.exceptions.FederationServerNotFoundError
-.. autoclass:: stellar_sdk.sep.exceptions.BadFederationResponseError
-.. autoclass:: stellar_sdk.sep.exceptions.InvalidSep10ChallengeError
-.. autoclass:: stellar_sdk.sep.exceptions.AccountRequiresMemoError
-
-.. _stellar_sdk_xdr:
-
-^^^^^^^^^^^^^^^
-
-AccountEntry
-------------
-.. autoclass:: stellar_sdk.xdr.account_entry.AccountEntry
-
-AccountEntryExt
----------------
-.. autoclass:: stellar_sdk.xdr.account_entry_ext.AccountEntryExt
-
-AccountEntryExtensionV1
------------------------
-.. autoclass:: stellar_sdk.xdr.account_entry_extension_v1.AccountEntryExtensionV1
-
-AccountEntryExtensionV1Ext
---------------------------
-.. autoclass:: stellar_sdk.xdr.account_entry_extension_v1_ext.AccountEntryExtensionV1Ext
-
-AccountEntryExtensionV2
------------------------
-.. autoclass:: stellar_sdk.xdr.account_entry_extension_v2.AccountEntryExtensionV2
-
-AccountEntryExtensionV2Ext
---------------------------
-.. autoclass:: stellar_sdk.xdr.account_entry_extension_v2_ext.AccountEntryExtensionV2Ext
-
-AccountEntryExtensionV3
------------------------
-.. autoclass:: stellar_sdk.xdr.account_entry_extension_v3.AccountEntryExtensionV3
-
-AccountFlags
-------------
-.. autoclass:: stellar_sdk.xdr.account_flags.AccountFlags
-
-AccountID
----------
-.. autoclass:: stellar_sdk.xdr.account_id.AccountID
-
-AccountMergeResult
-------------------
-.. autoclass:: stellar_sdk.xdr.account_merge_result.AccountMergeResult
-
-AccountMergeResultCode
-----------------------
-.. autoclass:: stellar_sdk.xdr.account_merge_result_code.AccountMergeResultCode
-
-AllowTrustOp
-------------
-.. autoclass:: stellar_sdk.xdr.allow_trust_op.AllowTrustOp
-
-AllowTrustResult
-----------------
-.. autoclass:: stellar_sdk.xdr.allow_trust_result.AllowTrustResult
-
-AllowTrustResultCode
---------------------
-.. autoclass:: stellar_sdk.xdr.allow_trust_result_code.AllowTrustResultCode
-
-AlphaNum12
-----------
-.. autoclass:: stellar_sdk.xdr.alpha_num12.AlphaNum12
-
-AlphaNum4
----------
-.. autoclass:: stellar_sdk.xdr.alpha_num4.AlphaNum4
-
-Asset
------
-.. autoclass:: stellar_sdk.xdr.asset.Asset
-
-AssetCode
----------
-.. autoclass:: stellar_sdk.xdr.asset_code.AssetCode
-
-AssetCode12
------------
-.. autoclass:: stellar_sdk.xdr.asset_code12.AssetCode12
-
-AssetCode4
-----------
-.. autoclass:: stellar_sdk.xdr.asset_code4.AssetCode4
-
-AssetType
----------
-.. autoclass:: stellar_sdk.xdr.asset_type.AssetType
-
-Auth
-----
-.. autoclass:: stellar_sdk.xdr.auth.Auth
-
-AuthCert
---------
-.. autoclass:: stellar_sdk.xdr.auth_cert.AuthCert
-
-AuthenticatedMessage
---------------------
-.. autoclass:: stellar_sdk.xdr.authenticated_message.AuthenticatedMessage
-
-AuthenticatedMessageV0
-----------------------
-.. autoclass:: stellar_sdk.xdr.authenticated_message_v0.AuthenticatedMessageV0
-
-BeginSponsoringFutureReservesOp
--------------------------------
-.. autoclass:: stellar_sdk.xdr.begin_sponsoring_future_reserves_op.BeginSponsoringFutureReservesOp
-
-BeginSponsoringFutureReservesResult
------------------------------------
-.. autoclass:: stellar_sdk.xdr.begin_sponsoring_future_reserves_result.BeginSponsoringFutureReservesResult
-
-BeginSponsoringFutureReservesResultCode
----------------------------------------
-.. autoclass:: stellar_sdk.xdr.begin_sponsoring_future_reserves_result_code.BeginSponsoringFutureReservesResultCode
-
-Boolean
--------
-.. autoclass:: stellar_sdk.xdr.base.Boolean
-
-BucketEntry
------------
-.. autoclass:: stellar_sdk.xdr.bucket_entry.BucketEntry
-
-BucketEntryType
----------------
-.. autoclass:: stellar_sdk.xdr.bucket_entry_type.BucketEntryType
-
-BucketMetadata
---------------
-.. autoclass:: stellar_sdk.xdr.bucket_metadata.BucketMetadata
-
-BucketMetadataExt
------------------
-.. autoclass:: stellar_sdk.xdr.bucket_metadata_ext.BucketMetadataExt
-
-BumpSequenceOp
---------------
-.. autoclass:: stellar_sdk.xdr.bump_sequence_op.BumpSequenceOp
-
-BumpSequenceResult
-------------------
-.. autoclass:: stellar_sdk.xdr.bump_sequence_result.BumpSequenceResult
-
-BumpSequenceResultCode
-----------------------
-.. autoclass:: stellar_sdk.xdr.bump_sequence_result_code.BumpSequenceResultCode
-
-ChangeTrustAsset
-----------------
-.. autoclass:: stellar_sdk.xdr.change_trust_asset.ChangeTrustAsset
-
-ChangeTrustOp
--------------
-.. autoclass:: stellar_sdk.xdr.change_trust_op.ChangeTrustOp
-
-ChangeTrustResult
------------------
-.. autoclass:: stellar_sdk.xdr.change_trust_result.ChangeTrustResult
-
-ChangeTrustResultCode
----------------------
-.. autoclass:: stellar_sdk.xdr.change_trust_result_code.ChangeTrustResultCode
-
-ClaimAtom
----------
-.. autoclass:: stellar_sdk.xdr.claim_atom.ClaimAtom
-
-ClaimAtomType
--------------
-.. autoclass:: stellar_sdk.xdr.claim_atom_type.ClaimAtomType
-
-ClaimClaimableBalanceOp
------------------------
-.. autoclass:: stellar_sdk.xdr.claim_claimable_balance_op.ClaimClaimableBalanceOp
-
-ClaimClaimableBalanceResult
----------------------------
-.. autoclass:: stellar_sdk.xdr.claim_claimable_balance_result.ClaimClaimableBalanceResult
-
-ClaimClaimableBalanceResultCode
--------------------------------
-.. autoclass:: stellar_sdk.xdr.claim_claimable_balance_result_code.ClaimClaimableBalanceResultCode
-
-ClaimLiquidityAtom
-------------------
-.. autoclass:: stellar_sdk.xdr.claim_liquidity_atom.ClaimLiquidityAtom
-
-ClaimOfferAtom
---------------
-.. autoclass:: stellar_sdk.xdr.claim_offer_atom.ClaimOfferAtom
-
-ClaimOfferAtomV0
-----------------
-.. autoclass:: stellar_sdk.xdr.claim_offer_atom_v0.ClaimOfferAtomV0
-
-ClaimPredicate
---------------
-.. autoclass:: stellar_sdk.xdr.claim_predicate.ClaimPredicate
-
-ClaimPredicateType
-------------------
-.. autoclass:: stellar_sdk.xdr.claim_predicate_type.ClaimPredicateType
-
-ClaimableBalanceEntry
----------------------
-.. autoclass:: stellar_sdk.xdr.claimable_balance_entry.ClaimableBalanceEntry
-
-ClaimableBalanceEntryExt
-------------------------
-.. autoclass:: stellar_sdk.xdr.claimable_balance_entry_ext.ClaimableBalanceEntryExt
-
-ClaimableBalanceEntryExtensionV1
---------------------------------
-.. autoclass:: stellar_sdk.xdr.claimable_balance_entry_extension_v1.ClaimableBalanceEntryExtensionV1
-
-ClaimableBalanceEntryExtensionV1Ext
------------------------------------
-.. autoclass:: stellar_sdk.xdr.claimable_balance_entry_extension_v1_ext.ClaimableBalanceEntryExtensionV1Ext
-
-ClaimableBalanceFlags
----------------------
-.. autoclass:: stellar_sdk.xdr.claimable_balance_flags.ClaimableBalanceFlags
-
-ClaimableBalanceID
-------------------
-.. autoclass:: stellar_sdk.xdr.claimable_balance_id.ClaimableBalanceID
-
-ClaimableBalanceIDType
-----------------------
-.. autoclass:: stellar_sdk.xdr.claimable_balance_id_type.ClaimableBalanceIDType
-
-Claimant
---------
-.. autoclass:: stellar_sdk.xdr.claimant.Claimant
-
-ClaimantType
-------------
-.. autoclass:: stellar_sdk.xdr.claimant_type.ClaimantType
-
-ClaimantV0
-----------
-.. autoclass:: stellar_sdk.xdr.claimant_v0.ClaimantV0
-
-ClawbackClaimableBalanceOp
---------------------------
-.. autoclass:: stellar_sdk.xdr.clawback_claimable_balance_op.ClawbackClaimableBalanceOp
-
-ClawbackClaimableBalanceResult
-------------------------------
-.. autoclass:: stellar_sdk.xdr.clawback_claimable_balance_result.ClawbackClaimableBalanceResult
-
-ClawbackClaimableBalanceResultCode
-----------------------------------
-.. autoclass:: stellar_sdk.xdr.clawback_claimable_balance_result_code.ClawbackClaimableBalanceResultCode
-
-ClawbackOp
-----------
-.. autoclass:: stellar_sdk.xdr.clawback_op.ClawbackOp
-
-ClawbackResult
---------------
-.. autoclass:: stellar_sdk.xdr.clawback_result.ClawbackResult
-
-ClawbackResultCode
-------------------
-.. autoclass:: stellar_sdk.xdr.clawback_result_code.ClawbackResultCode
-
-CreateAccountOp
----------------
-.. autoclass:: stellar_sdk.xdr.create_account_op.CreateAccountOp
-
-CreateAccountResult
--------------------
-.. autoclass:: stellar_sdk.xdr.create_account_result.CreateAccountResult
-
-CreateAccountResultCode
------------------------
-.. autoclass:: stellar_sdk.xdr.create_account_result_code.CreateAccountResultCode
-
-CreateClaimableBalanceOp
-------------------------
-.. autoclass:: stellar_sdk.xdr.create_claimable_balance_op.CreateClaimableBalanceOp
-
-CreateClaimableBalanceResult
-----------------------------
-.. autoclass:: stellar_sdk.xdr.create_claimable_balance_result.CreateClaimableBalanceResult
-
-CreateClaimableBalanceResultCode
---------------------------------
-.. autoclass:: stellar_sdk.xdr.create_claimable_balance_result_code.CreateClaimableBalanceResultCode
-
-CreatePassiveSellOfferOp
-------------------------
-.. autoclass:: stellar_sdk.xdr.create_passive_sell_offer_op.CreatePassiveSellOfferOp
-
-CryptoKeyType
--------------
-.. autoclass:: stellar_sdk.xdr.crypto_key_type.CryptoKeyType
-
-Curve25519Public
-----------------
-.. autoclass:: stellar_sdk.xdr.curve25519_public.Curve25519Public
-
-Curve25519Secret
-----------------
-.. autoclass:: stellar_sdk.xdr.curve25519_secret.Curve25519Secret
-
-DataEntry
----------
-.. autoclass:: stellar_sdk.xdr.data_entry.DataEntry
-
-DataEntryExt
-------------
-.. autoclass:: stellar_sdk.xdr.data_entry_ext.DataEntryExt
-
-DataValue
----------
-.. autoclass:: stellar_sdk.xdr.data_value.DataValue
-
-DecoratedSignature
-------------------
-.. autoclass:: stellar_sdk.xdr.decorated_signature.DecoratedSignature
-
-DontHave
---------
-.. autoclass:: stellar_sdk.xdr.dont_have.DontHave
-
-Double
-------
-.. autoclass:: stellar_sdk.xdr.base.Double
-
-Duration
---------
-.. autoclass:: stellar_sdk.xdr.duration.Duration
-
-EncryptedBody
--------------
-.. autoclass:: stellar_sdk.xdr.encrypted_body.EncryptedBody
-
-EndSponsoringFutureReservesResult
----------------------------------
-.. autoclass:: stellar_sdk.xdr.end_sponsoring_future_reserves_result.EndSponsoringFutureReservesResult
-
-EndSponsoringFutureReservesResultCode
--------------------------------------
-.. autoclass:: stellar_sdk.xdr.end_sponsoring_future_reserves_result_code.EndSponsoringFutureReservesResultCode
-
-EnvelopeType
-------------
-.. autoclass:: stellar_sdk.xdr.envelope_type.EnvelopeType
-
-Error
------
-.. autoclass:: stellar_sdk.xdr.error.Error
-
-ErrorCode
----------
-.. autoclass:: stellar_sdk.xdr.error_code.ErrorCode
-
-ExtensionPoint
---------------
-.. autoclass:: stellar_sdk.xdr.extension_point.ExtensionPoint
-
-FeeBumpTransaction
-------------------
-.. autoclass:: stellar_sdk.xdr.fee_bump_transaction.FeeBumpTransaction
-
-FeeBumpTransactionEnvelope
---------------------------
-.. autoclass:: stellar_sdk.xdr.fee_bump_transaction_envelope.FeeBumpTransactionEnvelope
-
-FeeBumpTransactionExt
----------------------
-.. autoclass:: stellar_sdk.xdr.fee_bump_transaction_ext.FeeBumpTransactionExt
-
-FeeBumpTransactionInnerTx
--------------------------
-.. autoclass:: stellar_sdk.xdr.fee_bump_transaction_inner_tx.FeeBumpTransactionInnerTx
-
-Float
------
-.. autoclass:: stellar_sdk.xdr.base.Float
-
-Hash
-----
-.. autoclass:: stellar_sdk.xdr.hash.Hash
-
-HashIDPreimage
---------------
-.. autoclass:: stellar_sdk.xdr.hash_id_preimage.HashIDPreimage
-
-HashIDPreimageOperationID
--------------------------
-.. autoclass:: stellar_sdk.xdr.hash_id_preimage_operation_id.HashIDPreimageOperationID
-
-HashIDPreimageRevokeID
-----------------------
-.. autoclass:: stellar_sdk.xdr.hash_id_preimage_revoke_id.HashIDPreimageRevokeID
-
-Hello
------
-.. autoclass:: stellar_sdk.xdr.hello.Hello
-
-HmacSha256Key
--------------
-.. autoclass:: stellar_sdk.xdr.hmac_sha256_key.HmacSha256Key
-
-HmacSha256Mac
--------------
-.. autoclass:: stellar_sdk.xdr.hmac_sha256_mac.HmacSha256Mac
-
-Hyper
------
-.. autoclass:: stellar_sdk.xdr.base.Hyper
-
-IPAddrType
-----------
-.. autoclass:: stellar_sdk.xdr.ip_addr_type.IPAddrType
-
-InflationPayout
----------------
-.. autoclass:: stellar_sdk.xdr.inflation_payout.InflationPayout
-
-InflationResult
----------------
-.. autoclass:: stellar_sdk.xdr.inflation_result.InflationResult
-
-InflationResultCode
--------------------
-.. autoclass:: stellar_sdk.xdr.inflation_result_code.InflationResultCode
-
-InnerTransactionResult
-----------------------
-.. autoclass:: stellar_sdk.xdr.inner_transaction_result.InnerTransactionResult
-
-InnerTransactionResultExt
--------------------------
-.. autoclass:: stellar_sdk.xdr.inner_transaction_result_ext.InnerTransactionResultExt
-
-InnerTransactionResultPair
---------------------------
-.. autoclass:: stellar_sdk.xdr.inner_transaction_result_pair.InnerTransactionResultPair
-
-InnerTransactionResultResult
-----------------------------
-.. autoclass:: stellar_sdk.xdr.inner_transaction_result_result.InnerTransactionResultResult
-
-Int32
------
-.. autoclass:: stellar_sdk.xdr.int32.Int32
-
-Int64
------
-.. autoclass:: stellar_sdk.xdr.int64.Int64
-
-Integer
--------
-.. autoclass:: stellar_sdk.xdr.base.Integer
-
-LedgerBounds
-------------
-.. autoclass:: stellar_sdk.xdr.ledger_bounds.LedgerBounds
-
-LedgerCloseMeta
----------------
-.. autoclass:: stellar_sdk.xdr.ledger_close_meta.LedgerCloseMeta
-
-LedgerCloseMetaV0
------------------
-.. autoclass:: stellar_sdk.xdr.ledger_close_meta_v0.LedgerCloseMetaV0
-
-LedgerCloseValueSignature
--------------------------
-.. autoclass:: stellar_sdk.xdr.ledger_close_value_signature.LedgerCloseValueSignature
-
-LedgerEntry
------------
-.. autoclass:: stellar_sdk.xdr.ledger_entry.LedgerEntry
-
-LedgerEntryChange
------------------
-.. autoclass:: stellar_sdk.xdr.ledger_entry_change.LedgerEntryChange
-
-LedgerEntryChangeType
----------------------
-.. autoclass:: stellar_sdk.xdr.ledger_entry_change_type.LedgerEntryChangeType
-
-LedgerEntryChanges
-------------------
-.. autoclass:: stellar_sdk.xdr.ledger_entry_changes.LedgerEntryChanges
-
-LedgerEntryData
----------------
-.. autoclass:: stellar_sdk.xdr.ledger_entry_data.LedgerEntryData
-
-LedgerEntryExt
---------------
-.. autoclass:: stellar_sdk.xdr.ledger_entry_ext.LedgerEntryExt
-
-LedgerEntryExtensionV1
-----------------------
-.. autoclass:: stellar_sdk.xdr.ledger_entry_extension_v1.LedgerEntryExtensionV1
-
-LedgerEntryExtensionV1Ext
--------------------------
-.. autoclass:: stellar_sdk.xdr.ledger_entry_extension_v1_ext.LedgerEntryExtensionV1Ext
-
-LedgerEntryType
----------------
-.. autoclass:: stellar_sdk.xdr.ledger_entry_type.LedgerEntryType
-
-LedgerHeader
-------------
-.. autoclass:: stellar_sdk.xdr.ledger_header.LedgerHeader
-
-LedgerHeaderExt
----------------
-.. autoclass:: stellar_sdk.xdr.ledger_header_ext.LedgerHeaderExt
-
-LedgerHeaderExtensionV1
------------------------
-.. autoclass:: stellar_sdk.xdr.ledger_header_extension_v1.LedgerHeaderExtensionV1
-
-LedgerHeaderExtensionV1Ext
---------------------------
-.. autoclass:: stellar_sdk.xdr.ledger_header_extension_v1_ext.LedgerHeaderExtensionV1Ext
-
-LedgerHeaderFlags
------------------
-.. autoclass:: stellar_sdk.xdr.ledger_header_flags.LedgerHeaderFlags
-
-LedgerHeaderHistoryEntry
-------------------------
-.. autoclass:: stellar_sdk.xdr.ledger_header_history_entry.LedgerHeaderHistoryEntry
-
-LedgerHeaderHistoryEntryExt
----------------------------
-.. autoclass:: stellar_sdk.xdr.ledger_header_history_entry_ext.LedgerHeaderHistoryEntryExt
-
-LedgerKey
----------
-.. autoclass:: stellar_sdk.xdr.ledger_key.LedgerKey
-
-LedgerKeyAccount
-----------------
-.. autoclass:: stellar_sdk.xdr.ledger_key_account.LedgerKeyAccount
-
-LedgerKeyClaimableBalance
--------------------------
-.. autoclass:: stellar_sdk.xdr.ledger_key_claimable_balance.LedgerKeyClaimableBalance
-
-LedgerKeyData
--------------
-.. autoclass:: stellar_sdk.xdr.ledger_key_data.LedgerKeyData
-
-LedgerKeyLiquidityPool
-----------------------
-.. autoclass:: stellar_sdk.xdr.ledger_key_liquidity_pool.LedgerKeyLiquidityPool
-
-LedgerKeyOffer
---------------
-.. autoclass:: stellar_sdk.xdr.ledger_key_offer.LedgerKeyOffer
-
-LedgerKeyTrustLine
-------------------
-.. autoclass:: stellar_sdk.xdr.ledger_key_trust_line.LedgerKeyTrustLine
-
-LedgerSCPMessages
------------------
-.. autoclass:: stellar_sdk.xdr.ledger_scp_messages.LedgerSCPMessages
-
-LedgerUpgrade
--------------
-.. autoclass:: stellar_sdk.xdr.ledger_upgrade.LedgerUpgrade
-
-LedgerUpgradeType
------------------
-.. autoclass:: stellar_sdk.xdr.ledger_upgrade_type.LedgerUpgradeType
-
-Liabilities
------------
-.. autoclass:: stellar_sdk.xdr.liabilities.Liabilities
-
-LiquidityPoolConstantProductParameters
---------------------------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_constant_product_parameters.LiquidityPoolConstantProductParameters
-
-LiquidityPoolDepositOp
-----------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_deposit_op.LiquidityPoolDepositOp
-
-LiquidityPoolDepositResult
---------------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_deposit_result.LiquidityPoolDepositResult
-
-LiquidityPoolDepositResultCode
-------------------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_deposit_result_code.LiquidityPoolDepositResultCode
-
-LiquidityPoolEntry
-------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_entry.LiquidityPoolEntry
-
-LiquidityPoolEntryBody
-----------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_entry_body.LiquidityPoolEntryBody
-
-LiquidityPoolEntryConstantProduct
----------------------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_entry_constant_product.LiquidityPoolEntryConstantProduct
-
-LiquidityPoolParameters
------------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_parameters.LiquidityPoolParameters
-
-LiquidityPoolType
------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_type.LiquidityPoolType
-
-LiquidityPoolWithdrawOp
------------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_withdraw_op.LiquidityPoolWithdrawOp
-
-LiquidityPoolWithdrawResult
----------------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_withdraw_result.LiquidityPoolWithdrawResult
-
-LiquidityPoolWithdrawResultCode
--------------------------------
-.. autoclass:: stellar_sdk.xdr.liquidity_pool_withdraw_result_code.LiquidityPoolWithdrawResultCode
-
-ManageBuyOfferOp
-----------------
-.. autoclass:: stellar_sdk.xdr.manage_buy_offer_op.ManageBuyOfferOp
-
-ManageBuyOfferResult
---------------------
-.. autoclass:: stellar_sdk.xdr.manage_buy_offer_result.ManageBuyOfferResult
-
-ManageBuyOfferResultCode
-------------------------
-.. autoclass:: stellar_sdk.xdr.manage_buy_offer_result_code.ManageBuyOfferResultCode
-
-ManageDataOp
-------------
-.. autoclass:: stellar_sdk.xdr.manage_data_op.ManageDataOp
-
-ManageDataResult
-----------------
-.. autoclass:: stellar_sdk.xdr.manage_data_result.ManageDataResult
-
-ManageDataResultCode
---------------------
-.. autoclass:: stellar_sdk.xdr.manage_data_result_code.ManageDataResultCode
-
-ManageOfferEffect
------------------
-.. autoclass:: stellar_sdk.xdr.manage_offer_effect.ManageOfferEffect
-
-ManageOfferSuccessResult
-------------------------
-.. autoclass:: stellar_sdk.xdr.manage_offer_success_result.ManageOfferSuccessResult
-
-ManageOfferSuccessResultOffer
------------------------------
-.. autoclass:: stellar_sdk.xdr.manage_offer_success_result_offer.ManageOfferSuccessResultOffer
-
-ManageSellOfferOp
------------------
-.. autoclass:: stellar_sdk.xdr.manage_sell_offer_op.ManageSellOfferOp
-
-ManageSellOfferResult
----------------------
-.. autoclass:: stellar_sdk.xdr.manage_sell_offer_result.ManageSellOfferResult
-
-ManageSellOfferResultCode
--------------------------
-.. autoclass:: stellar_sdk.xdr.manage_sell_offer_result_code.ManageSellOfferResultCode
-
-Memo
-----
-.. autoclass:: stellar_sdk.xdr.memo.Memo
-
-MemoType
---------
-.. autoclass:: stellar_sdk.xdr.memo_type.MemoType
-
-MessageType
------------
-.. autoclass:: stellar_sdk.xdr.message_type.MessageType
-
-MuxedAccount
-------------
-.. autoclass:: stellar_sdk.xdr.muxed_account.MuxedAccount
-
-MuxedAccountMed25519
---------------------
-.. autoclass:: stellar_sdk.xdr.muxed_account_med25519.MuxedAccountMed25519
-
-NodeID
-------
-.. autoclass:: stellar_sdk.xdr.node_id.NodeID
-
-OfferEntry
-----------
-.. autoclass:: stellar_sdk.xdr.offer_entry.OfferEntry
-
-OfferEntryExt
--------------
-.. autoclass:: stellar_sdk.xdr.offer_entry_ext.OfferEntryExt
-
-OfferEntryFlags
----------------
-.. autoclass:: stellar_sdk.xdr.offer_entry_flags.OfferEntryFlags
-
-Opaque
-------
-.. autoclass:: stellar_sdk.xdr.base.Opaque
-
-Operation
----------
-.. autoclass:: stellar_sdk.xdr.operation.Operation
-
-OperationBody
--------------
-.. autoclass:: stellar_sdk.xdr.operation_body.OperationBody
-
-OperationMeta
--------------
-.. autoclass:: stellar_sdk.xdr.operation_meta.OperationMeta
-
-OperationResult
----------------
-.. autoclass:: stellar_sdk.xdr.operation_result.OperationResult
-
-OperationResultCode
--------------------
-.. autoclass:: stellar_sdk.xdr.operation_result_code.OperationResultCode
-
-OperationResultTr
------------------
-.. autoclass:: stellar_sdk.xdr.operation_result_tr.OperationResultTr
-
-OperationType
--------------
-.. autoclass:: stellar_sdk.xdr.operation_type.OperationType
-
-PathPaymentStrictReceiveOp
---------------------------
-.. autoclass:: stellar_sdk.xdr.path_payment_strict_receive_op.PathPaymentStrictReceiveOp
-
-PathPaymentStrictReceiveResult
-------------------------------
-.. autoclass:: stellar_sdk.xdr.path_payment_strict_receive_result.PathPaymentStrictReceiveResult
-
-PathPaymentStrictReceiveResultCode
-----------------------------------
-.. autoclass:: stellar_sdk.xdr.path_payment_strict_receive_result_code.PathPaymentStrictReceiveResultCode
-
-PathPaymentStrictReceiveResultSuccess
--------------------------------------
-.. autoclass:: stellar_sdk.xdr.path_payment_strict_receive_result_success.PathPaymentStrictReceiveResultSuccess
-
-PathPaymentStrictSendOp
------------------------
-.. autoclass:: stellar_sdk.xdr.path_payment_strict_send_op.PathPaymentStrictSendOp
-
-PathPaymentStrictSendResult
----------------------------
-.. autoclass:: stellar_sdk.xdr.path_payment_strict_send_result.PathPaymentStrictSendResult
-
-PathPaymentStrictSendResultCode
--------------------------------
-.. autoclass:: stellar_sdk.xdr.path_payment_strict_send_result_code.PathPaymentStrictSendResultCode
-
-PathPaymentStrictSendResultSuccess
-----------------------------------
-.. autoclass:: stellar_sdk.xdr.path_payment_strict_send_result_success.PathPaymentStrictSendResultSuccess
-
-PaymentOp
----------
-.. autoclass:: stellar_sdk.xdr.payment_op.PaymentOp
-
-PaymentResult
--------------
-.. autoclass:: stellar_sdk.xdr.payment_result.PaymentResult
-
-PaymentResultCode
------------------
-.. autoclass:: stellar_sdk.xdr.payment_result_code.PaymentResultCode
-
-PeerAddress
------------
-.. autoclass:: stellar_sdk.xdr.peer_address.PeerAddress
-
-PeerAddressIp
--------------
-.. autoclass:: stellar_sdk.xdr.peer_address_ip.PeerAddressIp
-
-PeerStatList
-------------
-.. autoclass:: stellar_sdk.xdr.peer_stat_list.PeerStatList
-
-PeerStats
----------
-.. autoclass:: stellar_sdk.xdr.peer_stats.PeerStats
-
-PoolID
-------
-.. autoclass:: stellar_sdk.xdr.pool_id.PoolID
-
-PreconditionType
-----------------
-.. autoclass:: stellar_sdk.xdr.precondition_type.PreconditionType
-
-Preconditions
--------------
-.. autoclass:: stellar_sdk.xdr.preconditions.Preconditions
-
-PreconditionsV2
----------------
-.. autoclass:: stellar_sdk.xdr.preconditions_v2.PreconditionsV2
-
-Price
------
-.. autoclass:: stellar_sdk.xdr.price.Price
-
-PublicKey
----------
-.. autoclass:: stellar_sdk.xdr.public_key.PublicKey
-
-PublicKeyType
--------------
-.. autoclass:: stellar_sdk.xdr.public_key_type.PublicKeyType
-
-RevokeSponsorshipOp
--------------------
-.. autoclass:: stellar_sdk.xdr.revoke_sponsorship_op.RevokeSponsorshipOp
-
-RevokeSponsorshipOpSigner
--------------------------
-.. autoclass:: stellar_sdk.xdr.revoke_sponsorship_op_signer.RevokeSponsorshipOpSigner
-
-RevokeSponsorshipResult
------------------------
-.. autoclass:: stellar_sdk.xdr.revoke_sponsorship_result.RevokeSponsorshipResult
-
-RevokeSponsorshipResultCode
----------------------------
-.. autoclass:: stellar_sdk.xdr.revoke_sponsorship_result_code.RevokeSponsorshipResultCode
-
-RevokeSponsorshipType
----------------------
-.. autoclass:: stellar_sdk.xdr.revoke_sponsorship_type.RevokeSponsorshipType
-
-SCPBallot
----------
-.. autoclass:: stellar_sdk.xdr.scp_ballot.SCPBallot
-
-SCPEnvelope
------------
-.. autoclass:: stellar_sdk.xdr.scp_envelope.SCPEnvelope
-
-SCPHistoryEntry
----------------
-.. autoclass:: stellar_sdk.xdr.scp_history_entry.SCPHistoryEntry
-
-SCPHistoryEntryV0
------------------
-.. autoclass:: stellar_sdk.xdr.scp_history_entry_v0.SCPHistoryEntryV0
-
-SCPNomination
--------------
-.. autoclass:: stellar_sdk.xdr.scp_nomination.SCPNomination
-
-SCPQuorumSet
-------------
-.. autoclass:: stellar_sdk.xdr.scp_quorum_set.SCPQuorumSet
-
-SCPStatement
-------------
-.. autoclass:: stellar_sdk.xdr.scp_statement.SCPStatement
-
-SCPStatementConfirm
--------------------
-.. autoclass:: stellar_sdk.xdr.scp_statement_confirm.SCPStatementConfirm
-
-SCPStatementExternalize
------------------------
-.. autoclass:: stellar_sdk.xdr.scp_statement_externalize.SCPStatementExternalize
-
-SCPStatementPledges
--------------------
-.. autoclass:: stellar_sdk.xdr.scp_statement_pledges.SCPStatementPledges
-
-SCPStatementPrepare
--------------------
-.. autoclass:: stellar_sdk.xdr.scp_statement_prepare.SCPStatementPrepare
-
-SCPStatementType
-----------------
-.. autoclass:: stellar_sdk.xdr.scp_statement_type.SCPStatementType
-
-SendMore
---------
-.. autoclass:: stellar_sdk.xdr.send_more.SendMore
-
-SequenceNumber
---------------
-.. autoclass:: stellar_sdk.xdr.sequence_number.SequenceNumber
-
-SetOptionsOp
-------------
-.. autoclass:: stellar_sdk.xdr.set_options_op.SetOptionsOp
-
-SetOptionsResult
-----------------
-.. autoclass:: stellar_sdk.xdr.set_options_result.SetOptionsResult
-
-SetOptionsResultCode
---------------------
-.. autoclass:: stellar_sdk.xdr.set_options_result_code.SetOptionsResultCode
-
-SetTrustLineFlagsOp
--------------------
-.. autoclass:: stellar_sdk.xdr.set_trust_line_flags_op.SetTrustLineFlagsOp
-
-SetTrustLineFlagsResult
------------------------
-.. autoclass:: stellar_sdk.xdr.set_trust_line_flags_result.SetTrustLineFlagsResult
-
-SetTrustLineFlagsResultCode
----------------------------
-.. autoclass:: stellar_sdk.xdr.set_trust_line_flags_result_code.SetTrustLineFlagsResultCode
-
-Signature
----------
-.. autoclass:: stellar_sdk.xdr.signature.Signature
-
-SignatureHint
--------------
-.. autoclass:: stellar_sdk.xdr.signature_hint.SignatureHint
-
-SignedSurveyRequestMessage
---------------------------
-.. autoclass:: stellar_sdk.xdr.signed_survey_request_message.SignedSurveyRequestMessage
-
-SignedSurveyResponseMessage
----------------------------
-.. autoclass:: stellar_sdk.xdr.signed_survey_response_message.SignedSurveyResponseMessage
-
-Signer
-------
-.. autoclass:: stellar_sdk.xdr.signer.Signer
-
-SignerKey
----------
-.. autoclass:: stellar_sdk.xdr.signer_key.SignerKey
-
-SignerKeyEd25519SignedPayload
------------------------------
-.. autoclass:: stellar_sdk.xdr.signer_key_ed25519_signed_payload.SignerKeyEd25519SignedPayload
-
-SignerKeyType
--------------
-.. autoclass:: stellar_sdk.xdr.signer_key_type.SignerKeyType
-
-SimplePaymentResult
--------------------
-.. autoclass:: stellar_sdk.xdr.simple_payment_result.SimplePaymentResult
-
-SponsorshipDescriptor
----------------------
-.. autoclass:: stellar_sdk.xdr.sponsorship_descriptor.SponsorshipDescriptor
-
-StellarMessage
---------------
-.. autoclass:: stellar_sdk.xdr.stellar_message.StellarMessage
-
-StellarValue
-------------
-.. autoclass:: stellar_sdk.xdr.stellar_value.StellarValue
-
-StellarValueExt
----------------
-.. autoclass:: stellar_sdk.xdr.stellar_value_ext.StellarValueExt
-
-StellarValueType
-----------------
-.. autoclass:: stellar_sdk.xdr.stellar_value_type.StellarValueType
-
-String
-------
-.. autoclass:: stellar_sdk.xdr.base.String
-
-String32
---------
-.. autoclass:: stellar_sdk.xdr.string32.String32
-
-String64
---------
-.. autoclass:: stellar_sdk.xdr.string64.String64
-
-SurveyMessageCommandType
-------------------------
-.. autoclass:: stellar_sdk.xdr.survey_message_command_type.SurveyMessageCommandType
-
-SurveyRequestMessage
---------------------
-.. autoclass:: stellar_sdk.xdr.survey_request_message.SurveyRequestMessage
-
-SurveyResponseBody
-------------------
-.. autoclass:: stellar_sdk.xdr.survey_response_body.SurveyResponseBody
-
-SurveyResponseMessage
----------------------
-.. autoclass:: stellar_sdk.xdr.survey_response_message.SurveyResponseMessage
-
-ThresholdIndexes
-----------------
-.. autoclass:: stellar_sdk.xdr.threshold_indexes.ThresholdIndexes
-
-Thresholds
-----------
-.. autoclass:: stellar_sdk.xdr.thresholds.Thresholds
-
-TimeBounds
-----------
-.. autoclass:: stellar_sdk.xdr.time_bounds.TimeBounds
-
-TimePoint
----------
-.. autoclass:: stellar_sdk.xdr.time_point.TimePoint
-
-TopologyResponseBody
---------------------
-.. autoclass:: stellar_sdk.xdr.topology_response_body.TopologyResponseBody
-
-Transaction
------------
-.. autoclass:: stellar_sdk.xdr.transaction.Transaction
-
-TransactionEnvelope
--------------------
-.. autoclass:: stellar_sdk.xdr.transaction_envelope.TransactionEnvelope
-
-TransactionExt
---------------
-.. autoclass:: stellar_sdk.xdr.transaction_ext.TransactionExt
-
-TransactionHistoryEntry
------------------------
-.. autoclass:: stellar_sdk.xdr.transaction_history_entry.TransactionHistoryEntry
-
-TransactionHistoryEntryExt
---------------------------
-.. autoclass:: stellar_sdk.xdr.transaction_history_entry_ext.TransactionHistoryEntryExt
-
-TransactionHistoryResultEntry
------------------------------
-.. autoclass:: stellar_sdk.xdr.transaction_history_result_entry.TransactionHistoryResultEntry
-
-TransactionHistoryResultEntryExt
---------------------------------
-.. autoclass:: stellar_sdk.xdr.transaction_history_result_entry_ext.TransactionHistoryResultEntryExt
-
-TransactionMeta
----------------
-.. autoclass:: stellar_sdk.xdr.transaction_meta.TransactionMeta
-
-TransactionMetaV1
------------------
-.. autoclass:: stellar_sdk.xdr.transaction_meta_v1.TransactionMetaV1
-
-TransactionMetaV2
------------------
-.. autoclass:: stellar_sdk.xdr.transaction_meta_v2.TransactionMetaV2
-
-TransactionResult
------------------
-.. autoclass:: stellar_sdk.xdr.transaction_result.TransactionResult
-
-TransactionResultCode
----------------------
-.. autoclass:: stellar_sdk.xdr.transaction_result_code.TransactionResultCode
-
-TransactionResultExt
---------------------
-.. autoclass:: stellar_sdk.xdr.transaction_result_ext.TransactionResultExt
-
-TransactionResultMeta
----------------------
-.. autoclass:: stellar_sdk.xdr.transaction_result_meta.TransactionResultMeta
-
-TransactionResultPair
----------------------
-.. autoclass:: stellar_sdk.xdr.transaction_result_pair.TransactionResultPair
-
-TransactionResultResult
------------------------
-.. autoclass:: stellar_sdk.xdr.transaction_result_result.TransactionResultResult
-
-TransactionResultSet
---------------------
-.. autoclass:: stellar_sdk.xdr.transaction_result_set.TransactionResultSet
-
-TransactionSet
---------------
-.. autoclass:: stellar_sdk.xdr.transaction_set.TransactionSet
-
-TransactionSignaturePayload
----------------------------
-.. autoclass:: stellar_sdk.xdr.transaction_signature_payload.TransactionSignaturePayload
-
-TransactionSignaturePayloadTaggedTransaction
---------------------------------------------
-.. autoclass:: stellar_sdk.xdr.transaction_signature_payload_tagged_transaction.TransactionSignaturePayloadTaggedTransaction
-
-TransactionV0
--------------
-.. autoclass:: stellar_sdk.xdr.transaction_v0.TransactionV0
-
-TransactionV0Envelope
----------------------
-.. autoclass:: stellar_sdk.xdr.transaction_v0_envelope.TransactionV0Envelope
-
-TransactionV0Ext
-----------------
-.. autoclass:: stellar_sdk.xdr.transaction_v0_ext.TransactionV0Ext
-
-TransactionV1Envelope
----------------------
-.. autoclass:: stellar_sdk.xdr.transaction_v1_envelope.TransactionV1Envelope
-
-TrustLineAsset
---------------
-.. autoclass:: stellar_sdk.xdr.trust_line_asset.TrustLineAsset
-
-TrustLineEntry
---------------
-.. autoclass:: stellar_sdk.xdr.trust_line_entry.TrustLineEntry
-
-TrustLineEntryExt
------------------
-.. autoclass:: stellar_sdk.xdr.trust_line_entry_ext.TrustLineEntryExt
-
-TrustLineEntryExtensionV2
--------------------------
-.. autoclass:: stellar_sdk.xdr.trust_line_entry_extension_v2.TrustLineEntryExtensionV2
-
-TrustLineEntryExtensionV2Ext
-----------------------------
-.. autoclass:: stellar_sdk.xdr.trust_line_entry_extension_v2_ext.TrustLineEntryExtensionV2Ext
-
-TrustLineEntryV1
-----------------
-.. autoclass:: stellar_sdk.xdr.trust_line_entry_v1.TrustLineEntryV1
-
-TrustLineEntryV1Ext
--------------------
-.. autoclass:: stellar_sdk.xdr.trust_line_entry_v1_ext.TrustLineEntryV1Ext
-
-TrustLineFlags
---------------
-.. autoclass:: stellar_sdk.xdr.trust_line_flags.TrustLineFlags
-
-Uint256
--------
-.. autoclass:: stellar_sdk.xdr.uint256.Uint256
-
-Uint32
-------
-.. autoclass:: stellar_sdk.xdr.uint32.Uint32
-
-Uint64
-------
-.. autoclass:: stellar_sdk.xdr.uint64.Uint64
-
-UnsignedHyper
--------------
-.. autoclass:: stellar_sdk.xdr.base.UnsignedHyper
-
-UnsignedInteger
----------------
-.. autoclass:: stellar_sdk.xdr.base.UnsignedInteger
-
-UpgradeEntryMeta
-----------------
-.. autoclass:: stellar_sdk.xdr.upgrade_entry_meta.UpgradeEntryMeta
-
-UpgradeType
------------
-.. autoclass:: stellar_sdk.xdr.upgrade_type.UpgradeType
-
-Value
------
-.. autoclass:: stellar_sdk.xdr.value.Value
-
-Constants
----------
-.. autodata:: stellar_sdk.xdr.constants.LIQUIDITY_POOL_FEE_V18
-.. autodata:: stellar_sdk.xdr.constants.MASK_ACCOUNT_FLAGS
-.. autodata:: stellar_sdk.xdr.constants.MASK_ACCOUNT_FLAGS_V17
-.. autodata:: stellar_sdk.xdr.constants.MASK_CLAIMABLE_BALANCE_FLAGS
-.. autodata:: stellar_sdk.xdr.constants.MASK_LEDGER_HEADER_FLAGS
-.. autodata:: stellar_sdk.xdr.constants.MASK_OFFERENTRY_FLAGS
-.. autodata:: stellar_sdk.xdr.constants.MASK_TRUSTLINE_FLAGS
-.. autodata:: stellar_sdk.xdr.constants.MASK_TRUSTLINE_FLAGS_V13
-.. autodata:: stellar_sdk.xdr.constants.MASK_TRUSTLINE_FLAGS_V17
-.. autodata:: stellar_sdk.xdr.constants.MAX_OPS_PER_TX
-.. autodata:: stellar_sdk.xdr.constants.MAX_SIGNERS
\ No newline at end of file
diff --git a/docs/zh_CN/assets.rst b/docs/zh_CN/assets.rst
deleted file mode 100644
index 443bf7abc..000000000
--- a/docs/zh_CN/assets.rst
+++ /dev/null
@@ -1,34 +0,0 @@
-.. _assets:
-
-
-****
-资产
-****
-
-:py:class:`Asset ` 的实例代表着 Stellar 网络中的资产。目前 Stellar 网络中有着三种类型的资产:
-
-* 原生资产 **XLM** (**ASSET_TYPE_NATIVE**),
-* 资产代码长度最长为 4 位的资产 (**ASSET_TYPE_CREDIT_ALPHANUM4**),
-* 资产代码长度最长为 12 位的资产 (**ASSET_TYPE_CREDIT_ALPHANUM12**).
-
-你可以通过 :py:meth:`native() ` 来创建原生资产:
-
-.. code-block:: python
- :linenos:
-
- from stellar_sdk import Asset
- native = Asset.native()
-
-
-你也可以通过 :py:class:`Asset ` 来创建一个自发行资产,它应该包含资产代码与发行账户:
-
-.. code-block:: python
- :linenos:
-
- from stellar_sdk import Asset
- # 创建资产代码为 TEST,发行方为 GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB 的资产
- test_asset = Asset("TEST", "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB")
- is_native = test_asset.is_native() # False
- # 创建由 GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB 发行的 Google 股票资产
- google_stock_asset = Asset('US38259P7069', 'GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB')
- google_stock_asset_type = google_stock_asset.type # credit_alphanum12
\ No newline at end of file
diff --git a/docs/zh_CN/asynchronous.rst b/docs/zh_CN/asynchronous.rst
deleted file mode 100644
index 4bc9d51b7..000000000
--- a/docs/zh_CN/asynchronous.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-.. _asynchronous:
-
-
-********
-异步请求
-********
-
-现在我们支持通过异步请求来提交事务了,当然我们不会强迫你使用异步,毕竟同步代码更容易编写,也有着更多的开发库可以选择。
-
-下面这个示例演示了如何通过异步请求发起一笔付款,你可以与 `这个示例 `__ 进行对比,
-它们的功能是完全相同的,只是后者发起的是同步请求。
-
-.. literalinclude:: ../../examples/payment_async.py
- :language: python
- :linenos:
-
-下面这个示例演示了如何通过异步的监听多个端点。
-
-.. literalinclude:: ../../examples/stream_requests_async.py
- :language: python
- :linenos:
diff --git a/docs/zh_CN/building_transactions.rst b/docs/zh_CN/building_transactions.rst
deleted file mode 100644
index 0fb105190..000000000
--- a/docs/zh_CN/building_transactions.rst
+++ /dev/null
@@ -1,73 +0,0 @@
-.. _building_transactions:
-
-
-********
-构建事务
-********
-
-`事务 `_ 是修改账本的命令,事务中一般包含了付款、创建订单、配置账户等操作。
-
-每个事务都有一个源 `账户 `__,这个帐号将会为这笔事务支付 `手续费 `_,且这个事务会使用源账户的序列号。
-
-事务由一个或多个 `操作组成 `_,
-每个操作都有一个源账户,如果一个账户没有设置源账户的话,那么它将使用事务的源账户作为它的源账户。
-
-`TransactionBuilder `_
--------------------------------------------------------------------------------------------------------------
-
-我们可以通过 :py:class:`TransactionBuilder ` 来构建一个新的事务。
-你需要在 TransactionBuilder 中配置事务的 **源账户**。这个事务会使用给定账户(:py:class:`Account `)的序列号,
-当你调用 :py:meth:`build() ` 生成一个事务时,该账户的序列号会加 1.
-
-事务中的操作可以通过调用 :py:meth:`append_operation ` 来添加。
-你可以阅读 :ref:`operation_list_archor` 来了解 Stellar 网络中有哪些类型的操作。
-:py:meth:`append_operation `
-会返回当前的 :py:class:`TransactionBuilder `
-示例,所以你可以链式的调用它。一般来说你并不需要直接调用它,我们提供了一系列便捷的函数,我更推荐你使用这些函数,比如你可以通过
-:py:meth:`append_payment_op ` 向
-:py:class:`TransactionBuilder ` 中添加一个付款操作。
-
-当你添加完操作之后,你可以调用 :py:meth:`build() `,
-它会返回一个 :py:class:`TransactionEnvelope `。
-整个事务都被包装在 :py:class:`TransactionEnvelope ` 当中,
-随后你需要使用密钥对它进行签名,只有经过正确签名的事务才会被 Stellar 网络所接受。
-
-.. literalinclude:: ../../examples/transaction_builder.py
- :language: python
- :linenos:
-
-序列号
-----------------
-事务的序列号必须与源帐户的序列号匹配,如果不匹配的话该事务会被 Stellar 网络拒绝。当一个事务生效之后,源账户的序列号会加 1。
-
-有两种方法可以确保使用的序列号是正确的:
-
-#. 在提交事务前从 Horizon 获取账户的序列号
-#. 在本地管理事务的序列号
-
-当你尝试快速的向 Stellar 网络提交大量事务时,从网络中获取到的序列号可能是不正确的,你应该在本地对序列号进行管理。
-
-添加备注(Memo)
----------------
-
-事务可以包含一个用于附加额外信息的 **memo**,当前有 5 种类型的 memo:
-
-* :py:class:`stellar_sdk.memo.NoneMemo` - 空 memo,
-* :py:class:`stellar_sdk.memo.TextMemo`` - 28-字节的 Ascii 编码的字符型 memo,
-* :py:class:`stellar_sdk.memo.IdMemo`- 64-位的数字型 memo,
-* :py:class:`stellar_sdk.memo.HashMemo` - 32-字节的 hash 编码的 memo,
-* :py:class:`stellar_sdk.memo.ReturnHashMemo` - 32-字节的 hash 编码的 memo,用与包含退款事务的 ID.
-
-.. literalinclude:: ../../examples/transaction_builder_with_memo.py
- :language: python
- :linenos:
-
-事务(Transaction)与事务信封(TransactionEnvelope)
---------------------------------------------------
-人们常常对这两个概念感到困惑,但是官方已经给出了非常好的解释。
-
-事务可以视为修改账本状态的命令,事务可以被用来发送付款,创建订单、修改事务或授权其他账户持有你发行的资产。
-如果将账本视为一个数据库,那么事务就是 SQL 命令。
-
-当一个事务构建好了之后,它需要被包装到事务信封当中,事务信封可以包含事务以及签名。大多数的事务信封都只包含一个签名,但是如果用户启用了多重签名的话,
-事务信封便会包含多个签名了。最终在 Stellar 网络中留存的是事务信封。
diff --git a/docs/zh_CN/conf.py b/docs/zh_CN/conf.py
deleted file mode 100644
index 23b25caae..000000000
--- a/docs/zh_CN/conf.py
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-#
-# py-stellar-base documentation build configuration file, created by
-# sphinx-quickstart on Sat Jan 20 11:58:02 2018.
-#
-# This file is execfile()d with the current directory set to its
-# containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#
-import os
-import sys
-
-# Insert py-stellar-base's Path for Autodoc
-sys.path.insert(0, os.path.abspath(".."))
-
-# -- General configuration ------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#
-# needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
-extensions = [
- "sphinx.ext.autodoc",
- "sphinx.ext.coverage",
- "sphinx.ext.intersphinx",
- "sphinx.ext.viewcode",
- "sphinx_autodoc_typehints",
-]
-
-intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ["_templates"]
-
-# The suffix(es) of source filenames.
-# You can specify multiple suffix as a list of string:
-#
-# source_suffix = ['.rst', '.md']
-source_suffix = ".rst"
-
-# The master toctree document.
-master_doc = "index"
-
-# General information about the project.
-project = "py-stellar-base"
-copyright = "2019, StellarCN and Individual Contributors"
-author = "StellarCN and Individual Contributors"
-
-import stellar_sdk
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = stellar_sdk.__version__.split("-")[0]
-# The full version, including alpha/beta/rc tags.
-release = stellar_sdk.__version__
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#
-# This is also used if you do content translation via gettext catalogs.
-# Usually you set "language" from the command line for these cases.
-language = "zh_CN"
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-# This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = "sphinx"
-
-# If true, `todo` and `todoList` produce output, else they produce nothing.
-todo_include_todos = False
-
-# -- Options for HTML output ----------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-#
-html_theme = "sphinx_rtd_theme"
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#
-html_theme_options = {"collapse_navigation": False, "style_external_links": False}
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = []
-
-# Custom sidebar templates, must be a dictionary that maps document names
-# to template names.
-#
-# This is required for the alabaster theme
-# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
-# html_sidebars = {
-# 'index': [
-# 'about.html',
-# 'navigation.html',
-# 'relations.html', # needs 'show_related': True theme option to display
-# 'searchbox.html',
-# ],
-# '**': [
-# 'about.html',
-# 'localtoc.html',
-# 'relations.html', # needs 'show_related': True theme option to display
-# 'searchbox.html',
-# ]
-# }
-
-# -- Options for HTMLHelp output ------------------------------------------
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = "py-stellar-base-doc"
-
-# -- Options for LaTeX output ---------------------------------------------
-
-latex_elements = {
- # The paper size ('letterpaper' or 'a4paper').
- #
- # 'papersize': 'letterpaper',
- # The font size ('10pt', '11pt' or '12pt').
- #
- # 'pointsize': '10pt',
- # Additional stuff for the LaTeX preamble.
- #
- # 'preamble': '',
- # Latex figure (float) alignment
- #
- # 'figure_align': 'htbp',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title,
-# author, documentclass [howto, manual, or own class]).
-latex_documents = [
- (
- master_doc,
- "py-stellar-base.tex",
- "py-stellar-base Documentation",
- "Stellar Community",
- "manual",
- ),
-]
-
-# -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [(master_doc, "pystellar", "py-stellar-base Documentation", [author], 1)]
-
-# -- Options for Texinfo output -------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- (
- master_doc,
- "py-stellar-base",
- "py-stellar-base Documentation",
- author,
- "py-stellar-base",
- "One line description of project.",
- "Miscellaneous",
- ),
-]
diff --git a/docs/zh_CN/create_account.rst b/docs/zh_CN/create_account.rst
deleted file mode 100644
index 0b3a28739..000000000
--- a/docs/zh_CN/create_account.rst
+++ /dev/null
@@ -1,32 +0,0 @@
-.. _create_account:
-
-
-**************
-创建账户
-**************
-
-你需要通过 :py:class:`CreateAccount
-` 操作来创建 Stellar 中的账户。
-由于 `恒星网络对账户有着最低持币要求
-`_,
-所以你需要给待激活账户发送一定数量的 XLM。当前这个数量是 **1 XLM (2
-x 0.5 Base Reserve)**,它可能会变化,但是通常很长时间才会变动一次,所以你可以将它视为一个固定值。
-
-使用测试网络
-=====================
-如果你想在测试网络中进行测试,你可以通过 `Friendbot
-`_
-来激活你的帐号。
-
-.. literalinclude:: ../../examples/create_account_friendbot.py
- :language: python
- :linenos:
-
-使用公共网络
-==============================
-如果你想在公共网络中创建一个账户的话,你可以让你的朋友给你发送一些 XLM,也可以在交易所购买一些,
-当你从交易所提取 XLM 到一个新账户时,交易所一般会帮你创建好这个账户。如果你想使用你的账户创建另外一个账户的话,可以参考下面的代码。
-
-.. literalinclude:: ../../examples/create_account.py
- :language: python
- :linenos:
\ No newline at end of file
diff --git a/docs/zh_CN/generate_keypair.rst b/docs/zh_CN/generate_keypair.rst
deleted file mode 100644
index 78679886e..000000000
--- a/docs/zh_CN/generate_keypair.rst
+++ /dev/null
@@ -1,43 +0,0 @@
-.. _generate_keypair:
-
-
-**************
-生成 Keypair
-**************
-
-在 Stellar 网络中,:py:class:`Keypair ` 用来给事务签名,
-:py:class:`Keypair ` 可以包含公钥与密钥,当然也可以只包含公钥。
-
-如果 :py:class:`Keypair ` 中没有包含密钥,那么它不能用来签署事务。
-我们可以使用密钥来创建一个 Keypair:
-
-.. code-block:: python
- :linenos:
-
- from stellar_sdk import Keypair
-
- keypair = Keypair.from_secret("SBK2VIYYSVG76E7VC3QHYARNFLY2EAQXDHRC7BMXBBGIFG74ARPRMNQM")
- public_key = keypair.public_key # GDHMW6QZOL73SHKG2JA3YHXFDHM46SS5ZRWEYF5BCYHX2C5TVO6KZBYL
- can_sign = keypair.can_sign() # True
-
-
-我们也可以用公钥来创建一个功能有限的 Keypair:
-
-.. code-block:: python
- :linenos:
-
- from stellar_sdk import Keypair
-
- keypair = Keypair.from_public_key("GDHMW6QZOL73SHKG2JA3YHXFDHM46SS5ZRWEYF5BCYHX2C5TVO6KZBYL")
- can_sign = keypair.can_sign() # False
-
-还可以生成一个随机的 Keypair:
-
-.. code-block:: python
- :linenos:
-
- from stellar_sdk import Keypair
-
- keypair = Keypair.random()
- print("Public Key: " + keypair.public_key)
- print("Secret Seed: " + keypair.secret)
\ No newline at end of file
diff --git a/docs/zh_CN/index.rst b/docs/zh_CN/index.rst
deleted file mode 100644
index 4534cb2a5..000000000
--- a/docs/zh_CN/index.rst
+++ /dev/null
@@ -1,109 +0,0 @@
-.. py-stellar-base documentation master file, created by
- sphinx-quickstart on Sat Jan 20 11:58:02 2018.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-.. .. include:: ../README.rst
-
-Stellar Python SDK
-==================
-
-.. image:: https://img.shields.io/github/workflow/status/StellarCN/py-stellar-base/GitHub%20Action/master?maxAge=1800
- :alt: GitHub Action
- :target: https://github.com/StellarCN/py-stellar-base/actions
-
-.. image:: https://img.shields.io/readthedocs/stellar-sdk.svg?maxAge=1800
- :alt: Read the Docs
- :target: https://stellar-sdk.readthedocs.io/en/latest/
-
-.. image:: https://static.pepy.tech/personalized-badge/stellar-sdk?period=total&units=abbreviation&left_color=grey&right_color=brightgreen&left_text=Downloads
- :alt: PyPI - Downloads
- :target: https://pypi.python.org/pypi/stellar-sdk
-
-.. image:: https://img.shields.io/codeclimate/maintainability/StellarCN/py-stellar-base?maxAge=1800
- :alt: Code Climate maintainability
- :target: https://codeclimate.com/github/StellarCN/py-stellar-base/maintainability
-
-.. image:: https://img.shields.io/codecov/c/github/StellarCN/py-stellar-base/v2?maxAge=1800
- :alt: Codecov
- :target: https://codecov.io/gh/StellarCN/py-stellar-base
-
-.. image:: https://img.shields.io/pypi/v/stellar-sdk.svg?maxAge=1800
- :alt: PyPI
- :target: https://pypi.python.org/pypi/stellar-sdk
-
-.. image:: https://img.shields.io/badge/python-%3E%3D3.7-blue
- :alt: Python - Version
- :target: https://pypi.python.org/pypi/stellar-sdk
-
-.. image:: https://img.shields.io/badge/implementation-cpython%20%7C%20pypy-blue
- :alt: PyPI - Implementation
- :target: https://pypi.python.org/pypi/stellar-sdk
-
-.. image:: https://img.shields.io/badge/Stellar%20Protocol-19-blue
- :alt: Stellar Protocol
- :target: https://developers.stellar.org/docs/glossary/scp/
-
-py-stellar-base 是用于开发 Stellar 应用程序的 Python 库。它目前支持 Python 3.7+ 和 PyPy3.7+。
-
-它提供了:
-
-- 完全访问 Horizon 各个接口的能力
-- 快速的构建与签署事务,并将它提交到 Stellar 网络
-
-入门
-----------
-我强烈推荐你阅读官方的 `开发者文档 `_ ,
-其中介绍了诸多基础的概念,能帮助你快速的了解 Stellar 网络中的各种概念。
-
-.. toctree::
- :maxdepth: 2
-
- install
- generate_keypair
- create_account
- querying_horizon
- assets
- building_transactions
- payment
- asynchronous
- multi_signature_account
- xdr
-
-API 文档
------------------
-Here you'll find detailed documentation on specific functions, classes, and
-methods.
-
-.. toctree::
- :maxdepth: 2
-
- api
-
-stellar-model
--------------
-stellar-model 可以将 Stellar Horizon 返回的 JSON 解析为 Python 实例,以提高你的开发效率,
-请 `点击这里 `__ 获取更多信息。
-
-资源
------
-* 文档: https://stellar-sdk.readthedocs.io
-* 源代码: https://github.com/StellarCN/py-stellar-base
-* 示例: https://github.com/StellarCN/py-stellar-base/tree/main/examples
-* Issue 追踪: https://github.com/StellarCN/py-stellar-base/issues
-* 许可证: `Apache License 2.0 `_
-* 已发布版本: https://pypi.org/project/stellar-sdk/
-
-致谢
-------
-这份文档是在 `Stellar JavaScript SDK`_ 文档的基础上完成的。在此感谢所有向 Stellar 生态贡献过自己的一份力量的同学。
-
-
-:ref:`genindex`
----------------
-
-
-.. _here: https://github.com/StellarCN/py-stellar-base/tree/master/examples
-.. _Stellar Horizon server: https://github.com/stellar/go/tree/master/services/horizon
-.. _pip: https://pip.pypa.io/en/stable/quickstart/
-.. _Stellar JavaScript SDK: https://github.com/stellar/js-stellar-sdk
diff --git a/docs/zh_CN/install.rst b/docs/zh_CN/install.rst
deleted file mode 100644
index eda70fad4..000000000
--- a/docs/zh_CN/install.rst
+++ /dev/null
@@ -1,31 +0,0 @@
-.. _install:
-
-*****
-安装
-*****
-
-通过 pip 安装
-=========================
-
-使用 pip 来安装最新版的 Stellar Python SDK :
-
-.. code-block:: text
-
- pip install -U stellar-sdk
-
-Stellar Python SDK 的发布遵循 `Semantic Versioning 2.0.0 `_ ,我强烈建议
-你在依赖文件中锁定其版本号,以避免破坏性更新带来的未知影响。想要更多的了解如何安装依赖,请参阅 `Hitchhiker's Guide to Python
-`_ 。
-
-通过源码安装
-============
-
-请尽可能使用上述方法安装。最新的代码可能不稳定。
-
-你可以先克隆 `这个仓库 `_,然后通过源码安装 SDK:
-
-.. code-block:: bash
-
- git clone https://github.com/StellarCN/py-stellar-base.git
- cd py-stellar-base
- pip install .
diff --git a/docs/zh_CN/make.bat b/docs/zh_CN/make.bat
deleted file mode 100644
index f0d4e3d3b..000000000
--- a/docs/zh_CN/make.bat
+++ /dev/null
@@ -1,36 +0,0 @@
-@ECHO OFF
-
-pushd %~dp0
-
-REM Command file for Sphinx documentation
-
-if "%SPHINXBUILD%" == "" (
- set SPHINXBUILD=sphinx-build
-)
-set SOURCEDIR=.
-set BUILDDIR=_build
-set SPHINXPROJ=py-stellar-base
-
-if "%1" == "" goto help
-
-%SPHINXBUILD% >NUL 2>NUL
-if errorlevel 9009 (
- echo.
- echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
- echo.installed, then set the SPHINXBUILD environment variable to point
- echo.to the full path of the 'sphinx-build' executable. Alternatively you
- echo.may add the Sphinx directory to PATH.
- echo.
- echo.If you don't have Sphinx installed, grab it from
- echo.http://sphinx-doc.org/
- exit /b 1
-)
-
-%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
-goto end
-
-:help
-%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
-
-:end
-popd
diff --git a/docs/zh_CN/multi_signature_account.rst b/docs/zh_CN/multi_signature_account.rst
deleted file mode 100644
index 0641c5b67..000000000
--- a/docs/zh_CN/multi_signature_account.rst
+++ /dev/null
@@ -1,24 +0,0 @@
-.. _multi_signature_account:
-
-
-***********************
-多重签名账户
-***********************
-
-通过为账户启用 `多重签名 `_ ,你可以使这个账户创建的事务需要
-经过多个公钥的签名才能生效。首先你需要为账户配置 **阈值(threshold)**,在 Stellar 网络中,每个操作都有着自己的权限等级,这个等级分为高、中、低三等,
-你可以为每个等级配置一个阈值,这个值可以在 1-255 之间。你可以为你的账户添加多个签名者,每个签名者都有着自己的权重,这个权重可以在 1-255 之间,如果你想
-从账户中删除一个签名者,那么你只需要将这个签名者的权重设置为 0。任何事务得到的签名权重必须大于或等于它所需要的阈值才能生效。
-
-首先,我们来设置账户的阈值等级,我们将低级权限操作的阈值设为 1,中级权限操作的阈值设置为 2,高级权限操作的阈值设置为 3。付款操作是一个中级权限的操作。
-如果你的主公钥权重为 1,那么你需要使用另外一个公钥进行签名,使它获得的权重大于等于 2 才行。
-
-在下面这个示例中,我们将做以下几件事情:
-
-* 向账户中添加第二个签名账户
-* 为我们的主公钥设置权重,并设置阈值等级
-* 创建一个需要多重签名的付款事务
-
-.. literalinclude:: ../../examples/set_up_multisig_account.py
- :language: python
- :linenos:
diff --git a/docs/zh_CN/payment.rst b/docs/zh_CN/payment.rst
deleted file mode 100644
index 41d9167be..000000000
--- a/docs/zh_CN/payment.rst
+++ /dev/null
@@ -1,30 +0,0 @@
-.. _payment:
-
-
-******************************
-构建一个付款事务
-******************************
-
-付款
-=======
-
-在下面这个示例中,你需要先确保收款账户已经在 Stellar 网络中激活了。
-你可以使用同步方法在此处提交这个事务,也可以使用异步方法提交这个事务。
-
-.. literalinclude:: ../../examples/payment.py
- :language: python
- :linenos:
-
-路径付款(Path Payment)
-========================
-
-在下面这个示例中,我们将使用付款账户 *GABJLI6IVBKJ7HIC5NN7HHDCIEW3CMWQ2DWYHREQQUFWSWZ2CDAMZZX4* 向 *GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB* 发送
-5.5 个由 *GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW* 发行的 *GBP*,而付款账户最多会扣除 1000 XLM。以下示例资产经过了
-三轮交换:XLM->USD, USD->EUR, EUR->GBP。
-
-* *USD* 由 *GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB* 发行
-* *EUR* 由 *GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL* 发行
-
-.. literalinclude:: ../../examples/path_payment.py
- :language: python
- :linenos:
\ No newline at end of file
diff --git a/docs/zh_CN/querying_horizon.rst b/docs/zh_CN/querying_horizon.rst
deleted file mode 100644
index 7b8c04df4..000000000
--- a/docs/zh_CN/querying_horizon.rst
+++ /dev/null
@@ -1,37 +0,0 @@
-.. _querying_horizon:
-
-
-*********************
-通过 Horizon 查询数据
-*********************
-
-通过 Stellar Python SDK 你可以访问 Horizon 的各个接口。
-
-构建请求
-=========
-
-SDK 使用 `建造者模式 `_ 来创建请求。通过 :py:class:`Server ` ,我们可以链式的构建一个请求。
-(请参阅 `Horizon 文档 `_ 来了解有哪些方法是可用的。)
-
-.. literalinclude:: ../../examples/query_horizon.py
- :language: python
- :linenos:
-
-当请求构建完成之后,我们可以通过调用 :py:meth:`call() `或 :py:meth:`stream() ` 以向 Horizon 发起请求。
-:py:meth:`call() ` 将会立即返回一个响应。
-
-构建流式(Stream)请求
-=====================
-
-很多接口都能通过 :py:meth:`stream() ` 调用。
-与 :py:meth:`call() ` 不同,它不立刻返回结果,
-而是会返回一个 EventSource。
-
-Horizon 将会实时的返回从当前时间开始产生的数据,当然你也可以通过 :py:meth:`cursor() ` 指定一个时间点。
-(请参阅 `Horizon 文档 `_ 了解有哪些接口支持 Stream。)
-
-下面这个示例将会实时打印这个账户提交的事务。
-
-.. literalinclude:: ../../examples/stream_requests.py
- :language: python
- :linenos:
\ No newline at end of file
diff --git a/docs/zh_CN/xdr.rst b/docs/zh_CN/xdr.rst
deleted file mode 100644
index ac97da5a2..000000000
--- a/docs/zh_CN/xdr.rst
+++ /dev/null
@@ -1,16 +0,0 @@
-.. _xdr:
-
-***
-XDR
-***
-
-XDR,也被称为外部数据表示法(External Data Representation),它被运用在 Stellar 网络和协议中。
-总账、事务、事务结果、历史,甚至在运行节点的计算机之间传递的消息都是使用 XDR 进行编码的。
-
-:ref:`stellar_sdk_xdr` 模块提供了完整的构建与解析 XDR 的能力。
-
-以下示例展示了如何将 XDR 字符解析为一个 XDR 对象。
-
-.. literalinclude:: ../../examples/parse_transaction_result_xdr.py
- :language: python
- :linenos:
diff --git a/examples/manage_sell_offer.py b/examples/manage_sell_offer.py
index af0c07a65..d5dbcc3d8 100644
--- a/examples/manage_sell_offer.py
+++ b/examples/manage_sell_offer.py
@@ -10,7 +10,6 @@
from stellar_sdk.asset import Asset
from stellar_sdk.keypair import Keypair
from stellar_sdk.network import Network
-from stellar_sdk.operation.manage_sell_offer import ManageSellOffer
from stellar_sdk.server import Server
from stellar_sdk.transaction_builder import TransactionBuilder
diff --git a/examples/soroban_auth_with_transaction_invoke.py b/examples/soroban_auth_with_transaction_invoke.py
new file mode 100644
index 000000000..d86eb384a
--- /dev/null
+++ b/examples/soroban_auth_with_transaction_invoke.py
@@ -0,0 +1,69 @@
+"""This example demonstrates how to invoke an auth contract with [Transaction Invoker] authrization.
+
+See https://soroban.stellar.org/docs/how-to-guides/auth
+See https://soroban.stellar.org/docs/learn/authorization#transaction-invoker
+"""
+import time
+
+from stellar_sdk import Keypair, Network, SorobanServer, TransactionBuilder, scval
+from stellar_sdk import xdr as stellar_xdr
+from stellar_sdk.exceptions import PrepareTransactionException
+from stellar_sdk.soroban_rpc import GetTransactionStatus, SendTransactionStatus
+
+rpc_server_url = "https://rpc-futurenet.stellar.org:443/"
+soroban_server = SorobanServer(rpc_server_url)
+network_passphrase = Network.FUTURENET_NETWORK_PASSPHRASE
+
+# https://github.com/stellar/soroban-examples/tree/v0.6.0/auth
+contract_id = "CAROXTYEBHAQWS2DFQBFZPMHWDUMPB2HJRNPPUMJUNBC3USBZJYKTAKF"
+tx_submitter_kp = Keypair.from_secret(
+ "SAAPYAPTTRZMCUZFPG3G66V4ZMHTK4TWA6NS7U4F7Z3IMUD52EK4DDEV"
+)
+
+func_name = "increment"
+args = [scval.to_address(tx_submitter_kp.public_key), scval.to_uint32(10)]
+
+source = soroban_server.load_account(tx_submitter_kp.public_key)
+tx = (
+ TransactionBuilder(source, network_passphrase, base_fee=100)
+ .add_time_bounds(0, 0)
+ .append_invoke_contract_function_op(
+ contract_id=contract_id,
+ function_name=func_name,
+ parameters=args,
+ )
+ .build()
+)
+
+try:
+ tx = soroban_server.prepare_transaction(tx)
+except PrepareTransactionException as e:
+ print(f"Got exception: {e.simulate_transaction_response}")
+ raise e
+
+tx.sign(tx_submitter_kp)
+print(f"Signed XDR:\n{tx.to_xdr()}")
+
+send_transaction_data = soroban_server.send_transaction(tx)
+print(f"sent transaction: {send_transaction_data}")
+if send_transaction_data.status != SendTransactionStatus.PENDING:
+ raise Exception("send transaction failed")
+
+while True:
+ print("waiting for transaction to be confirmed...")
+ get_transaction_data = soroban_server.get_transaction(send_transaction_data.hash)
+ if get_transaction_data.status != GetTransactionStatus.NOT_FOUND:
+ break
+ time.sleep(3)
+
+print(f"transaction: {get_transaction_data}")
+
+if get_transaction_data.status == GetTransactionStatus.SUCCESS:
+ assert get_transaction_data.result_meta_xdr is not None
+ transaction_meta = stellar_xdr.TransactionMeta.from_xdr(
+ get_transaction_data.result_meta_xdr
+ )
+ result = transaction_meta.v3.soroban_meta.return_value.u32 # type: ignore
+ print(f"Function result: {result}")
+else:
+ print(f"Transaction failed: {get_transaction_data.result_xdr}")
diff --git a/examples/soroban_bump_footprint_expiration.py b/examples/soroban_bump_footprint_expiration.py
new file mode 100644
index 000000000..2fad20296
--- /dev/null
+++ b/examples/soroban_bump_footprint_expiration.py
@@ -0,0 +1,71 @@
+"""This example shows how to bump footprint expiration.
+
+See https://soroban.stellar.org/docs/fundamentals-and-concepts/state-expiration#bumpfootprintexpirationop
+"""
+import time
+
+from stellar_sdk import (
+ Address,
+ Keypair,
+ Network,
+ SorobanDataBuilder,
+ SorobanServer,
+ TransactionBuilder,
+)
+from stellar_sdk import xdr as stellar_xdr
+from stellar_sdk.exceptions import PrepareTransactionException
+from stellar_sdk.soroban_rpc import GetTransactionStatus
+
+secret = "SAAPYAPTTRZMCUZFPG3G66V4ZMHTK4TWA6NS7U4F7Z3IMUD52EK4DDEV"
+rpc_server_url = "https://rpc-futurenet.stellar.org:443/"
+contract_id = "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K"
+network_passphrase = Network.FUTURENET_NETWORK_PASSPHRASE
+
+kp = Keypair.from_secret(secret)
+soroban_server = SorobanServer(rpc_server_url)
+source = soroban_server.load_account(kp.public_key)
+
+ledger_key = stellar_xdr.LedgerKey(
+ stellar_xdr.LedgerEntryType.CONTRACT_DATA,
+ contract_data=stellar_xdr.LedgerKeyContractData(
+ contract=Address(contract_id).to_xdr_sc_address(),
+ key=stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE),
+ durability=stellar_xdr.ContractDataDurability.PERSISTENT,
+ ),
+)
+soroban_data = SorobanDataBuilder().set_read_only([ledger_key]).build()
+
+tx = (
+ TransactionBuilder(source, network_passphrase, base_fee=50000)
+ .set_timeout(300)
+ .append_bump_footprint_expiration_op(ledgers_to_expire=101)
+ .set_soroban_data(soroban_data)
+ .build()
+)
+print(f"XDR: {tx.to_xdr()}")
+
+try:
+ tx = soroban_server.prepare_transaction(tx)
+except PrepareTransactionException as e:
+ print(f"Got exception: {e.simulate_transaction_response}")
+ raise e
+
+tx.sign(kp)
+print(f"Signed XDR: {tx.to_xdr()}")
+
+send_transaction_data = soroban_server.send_transaction(tx)
+print(f"sent transaction: {send_transaction_data}")
+
+while True:
+ print("waiting for transaction to be confirmed...")
+ get_transaction_data = soroban_server.get_transaction(send_transaction_data.hash)
+ if get_transaction_data.status != GetTransactionStatus.NOT_FOUND:
+ break
+ time.sleep(3)
+
+print(f"transaction: {get_transaction_data}")
+
+if get_transaction_data.status == GetTransactionStatus.SUCCESS:
+ print(f"transaction success")
+else:
+ print(f"Transaction failed: {get_transaction_data.result_xdr}")
diff --git a/examples/soroban_deploy_contract.py b/examples/soroban_deploy_contract.py
new file mode 100644
index 000000000..5820063a7
--- /dev/null
+++ b/examples/soroban_deploy_contract.py
@@ -0,0 +1,112 @@
+"""This example shows how to deploy a compiled contract to the Stellar network.
+"""
+import time
+
+from stellar_sdk import Keypair, Network, SorobanServer, StrKey, TransactionBuilder
+from stellar_sdk import xdr as stellar_xdr
+from stellar_sdk.exceptions import PrepareTransactionException
+from stellar_sdk.soroban_rpc import GetTransactionStatus, SendTransactionStatus
+
+# TODO: You need to replace the following parameters according to the actual situation
+secret = "SAAPYAPTTRZMCUZFPG3G66V4ZMHTK4TWA6NS7U4F7Z3IMUD52EK4DDEV"
+rpc_server_url = "https://rpc-futurenet.stellar.org:443/"
+network_passphrase = Network.FUTURENET_NETWORK_PASSPHRASE
+contract_file_path = "/Users/overcat/repo/stellar/soroban-examples/hello_world/target/wasm32-unknown-unknown/release/soroban_hello_world_contract.wasm"
+
+kp = Keypair.from_secret(secret)
+soroban_server = SorobanServer(rpc_server_url)
+
+print("uploading contract...")
+source = soroban_server.load_account(kp.public_key)
+
+# with open(contract_file_path, "rb") as f:
+# contract_bin = f.read()
+
+tx = (
+ TransactionBuilder(source, network_passphrase)
+ .set_timeout(300)
+ .append_upload_contract_wasm_op(
+ contract=contract_file_path, # the path to the contract, or binary data
+ )
+ .build()
+)
+
+try:
+ tx = soroban_server.prepare_transaction(tx)
+except PrepareTransactionException as e:
+ print(f"Got exception: {e.simulate_transaction_response}")
+ raise e
+
+tx.sign(kp)
+send_transaction_data = soroban_server.send_transaction(tx)
+print(f"sent transaction: {send_transaction_data}")
+if send_transaction_data.status != SendTransactionStatus.PENDING:
+ raise Exception("send transaction failed")
+
+while True:
+ print("waiting for transaction to be confirmed...")
+ get_transaction_data = soroban_server.get_transaction(send_transaction_data.hash)
+ if get_transaction_data.status != GetTransactionStatus.NOT_FOUND:
+ break
+ time.sleep(3)
+
+print(f"transaction: {get_transaction_data}")
+
+wasm_id = None
+if get_transaction_data.status == GetTransactionStatus.SUCCESS:
+ assert get_transaction_data.result_meta_xdr is not None
+ transaction_meta = stellar_xdr.TransactionMeta.from_xdr(
+ get_transaction_data.result_meta_xdr
+ )
+ wasm_id = transaction_meta.v3.soroban_meta.return_value.bytes.sc_bytes.hex() # type: ignore
+ print(f"wasm id: {wasm_id}")
+else:
+ print(f"Transaction failed: {get_transaction_data.result_xdr}")
+
+assert wasm_id, "wasm id should not be empty"
+
+print("creating contract...")
+
+source = soroban_server.load_account(
+ kp.public_key
+) # refresh source account, because the current SDK will increment the sequence number by one after building a transaction
+
+tx = (
+ TransactionBuilder(source, network_passphrase)
+ .set_timeout(300)
+ .append_create_contract_op(wasm_id=wasm_id, address=kp.public_key)
+ .build()
+)
+
+try:
+ tx = soroban_server.prepare_transaction(tx)
+except PrepareTransactionException as e:
+ print(f"Got exception: {e.simulate_transaction_response}")
+ raise e
+
+tx.sign(kp)
+
+send_transaction_data = soroban_server.send_transaction(tx)
+if send_transaction_data.status != SendTransactionStatus.PENDING:
+ raise Exception("send transaction failed")
+print(f"sent transaction: {send_transaction_data}")
+
+while True:
+ print("waiting for transaction to be confirmed...")
+ get_transaction_data = soroban_server.get_transaction(send_transaction_data.hash)
+ if get_transaction_data.status != GetTransactionStatus.NOT_FOUND:
+ break
+ time.sleep(3)
+
+print(f"transaction: {get_transaction_data}")
+
+if get_transaction_data.status == GetTransactionStatus.SUCCESS:
+ assert get_transaction_data.result_meta_xdr is not None
+ transaction_meta = stellar_xdr.TransactionMeta.from_xdr(
+ get_transaction_data.result_meta_xdr
+ )
+ result = transaction_meta.v3.soroban_meta.return_value.address.contract_id.hash # type: ignore
+ contract_id = StrKey.encode_contract(result)
+ print(f"contract id: {contract_id}")
+else:
+ print(f"Transaction failed: {get_transaction_data.result_xdr}")
diff --git a/examples/soroban_deploy_create_wrapped_token_contract.py b/examples/soroban_deploy_create_wrapped_token_contract.py
new file mode 100644
index 000000000..2944d4373
--- /dev/null
+++ b/examples/soroban_deploy_create_wrapped_token_contract.py
@@ -0,0 +1,68 @@
+"""
+This example shows how to deploy a wrapped token contract to the Stellar network.
+"""
+import time
+
+from stellar_sdk import (
+ Asset,
+ Keypair,
+ Network,
+ SorobanServer,
+ StrKey,
+ TransactionBuilder,
+)
+from stellar_sdk import xdr as stellar_xdr
+from stellar_sdk.exceptions import PrepareTransactionException
+from stellar_sdk.soroban_rpc import GetTransactionStatus, SendTransactionStatus
+
+# TODO: You need to replace the following parameters according to the actual situation
+secret = "SAAPYAPTTRZMCUZFPG3G66V4ZMHTK4TWA6NS7U4F7Z3IMUD52EK4DDEV"
+rpc_server_url = "https://rpc-futurenet.stellar.org:443/"
+network_passphrase = Network.FUTURENET_NETWORK_PASSPHRASE
+hello_asset = Asset("XLM", "GBCXQUEPSEGIKXLYODHKMZD7YMTZ4IUY3BYPRZL4D5MSJZHHE7HG6RWR")
+
+kp = Keypair.from_secret(secret)
+soroban_server = SorobanServer(rpc_server_url)
+source = soroban_server.load_account(kp.public_key)
+
+tx = (
+ TransactionBuilder(source, network_passphrase)
+ .set_timeout(300)
+ .append_create_token_contract_from_asset_op(asset=hello_asset)
+ .build()
+)
+
+print(tx.to_xdr())
+
+try:
+ tx = soroban_server.prepare_transaction(tx)
+except PrepareTransactionException as e:
+ print(f"Got exception: {e.simulate_transaction_response}")
+ raise e
+
+tx.sign(kp)
+
+send_transaction_data = soroban_server.send_transaction(tx)
+print(f"sent transaction: {send_transaction_data}")
+if send_transaction_data.status != SendTransactionStatus.PENDING:
+ raise Exception("send transaction failed")
+
+while True:
+ print("waiting for transaction to be confirmed...")
+ get_transaction_data = soroban_server.get_transaction(send_transaction_data.hash)
+ if get_transaction_data.status != GetTransactionStatus.NOT_FOUND:
+ break
+ time.sleep(3)
+
+print(f"transaction: {get_transaction_data}")
+
+if get_transaction_data.status == GetTransactionStatus.SUCCESS:
+ assert get_transaction_data.result_meta_xdr is not None
+ transaction_meta = stellar_xdr.TransactionMeta.from_xdr(
+ get_transaction_data.result_meta_xdr
+ )
+ result = transaction_meta.v3.soroban_meta.return_value.address.contract_id.hash # type: ignore
+ contract_id = StrKey.encode_contract(result)
+ print(f"contract id: {contract_id}")
+else:
+ print(f"Transaction failed: {get_transaction_data.result_xdr}")
diff --git a/examples/soroban_invoke_contract_function.py b/examples/soroban_invoke_contract_function.py
new file mode 100644
index 000000000..80b3647eb
--- /dev/null
+++ b/examples/soroban_invoke_contract_function.py
@@ -0,0 +1,74 @@
+"""This example shows how to call the Soroban contract.
+
+ The current API is in an unstable state.
+
+1. You need to follow [this tutorial](https://soroban.stellar.org/docs/tutorials/deploy-to-local-network)
+ to deploy the [Hello World contract](https://github.com/stellar/soroban-examples/tree/main/hello_world) first.
+
+2. Install Stellar Python SDK from pypi:
+ pip install stellar-sdk==9.0.0a2
+
+3. Modify the necessary parameters in this script, then run it.
+"""
+import time
+
+from stellar_sdk import Keypair, Network, SorobanServer, TransactionBuilder, scval
+from stellar_sdk import xdr as stellar_xdr
+from stellar_sdk.exceptions import PrepareTransactionException
+from stellar_sdk.soroban_rpc import GetTransactionStatus, SendTransactionStatus
+
+# TODO: You need to replace the following parameters according to the actual situation
+secret = "SAAPYAPTTRZMCUZFPG3G66V4ZMHTK4TWA6NS7U4F7Z3IMUD52EK4DDEV"
+rpc_server_url = "https://rpc-futurenet.stellar.org:443/"
+contract_id = "CDJO3KQKJFHFEZY2ZSWS4CTZEAZUO2SZNRWO2Y7QQS4X3UWSOLFJHSS3"
+network_passphrase = Network.FUTURENET_NETWORK_PASSPHRASE
+
+kp = Keypair.from_secret(secret)
+soroban_server = SorobanServer(rpc_server_url)
+source = soroban_server.load_account(kp.public_key)
+
+# Let's build a transaction that invokes the `hello` function.
+tx = (
+ TransactionBuilder(source, network_passphrase, base_fee=100)
+ .set_timeout(300)
+ .append_invoke_contract_function_op(
+ contract_id=contract_id,
+ function_name="hello",
+ parameters=[scval.to_symbol("world")],
+ )
+ .build()
+)
+print(f"XDR: {tx.to_xdr()}")
+
+try:
+ tx = soroban_server.prepare_transaction(tx)
+except PrepareTransactionException as e:
+ print(f"Got exception: {e.simulate_transaction_response}")
+ raise e
+
+tx.sign(kp)
+print(f"Signed XDR: {tx.to_xdr()}")
+
+send_transaction_data = soroban_server.send_transaction(tx)
+print(f"sent transaction: {send_transaction_data}")
+if send_transaction_data.status != SendTransactionStatus.PENDING:
+ raise Exception("send transaction failed")
+while True:
+ print("waiting for transaction to be confirmed...")
+ get_transaction_data = soroban_server.get_transaction(send_transaction_data.hash)
+ if get_transaction_data.status != GetTransactionStatus.NOT_FOUND:
+ break
+ time.sleep(3)
+
+print(f"transaction: {get_transaction_data}")
+
+if get_transaction_data.status == GetTransactionStatus.SUCCESS:
+ assert get_transaction_data.result_meta_xdr is not None
+ transaction_meta = stellar_xdr.TransactionMeta.from_xdr(
+ get_transaction_data.result_meta_xdr
+ )
+ result = transaction_meta.v3.soroban_meta.return_value # type: ignore[union-attr]
+ output = [x.sym.sc_symbol.decode() for x in result.vec.sc_vec] # type: ignore
+ print(f"transaction result: {output}")
+else:
+ print(f"Transaction failed: {get_transaction_data.result_xdr}")
diff --git a/examples/soroban_payment.py b/examples/soroban_payment.py
new file mode 100644
index 000000000..23a6be540
--- /dev/null
+++ b/examples/soroban_payment.py
@@ -0,0 +1,73 @@
+"""This example demonstrates how to send payment in the Soroban.
+
+See https://soroban.stellar.org/docs/reference/interfaces/token-interface
+"""
+import time
+
+from stellar_sdk import Keypair, Network, SorobanServer, TransactionBuilder, scval
+from stellar_sdk import xdr as stellar_xdr
+from stellar_sdk.exceptions import PrepareTransactionException
+from stellar_sdk.soroban_rpc import GetTransactionStatus, SendTransactionStatus
+
+rpc_server_url = "https://rpc-futurenet.stellar.org:443/"
+soroban_server = SorobanServer(rpc_server_url)
+network_passphrase = Network.FUTURENET_NETWORK_PASSPHRASE
+
+alice_kp = Keypair.from_secret(
+ "SAAPYAPTTRZMCUZFPG3G66V4ZMHTK4TWA6NS7U4F7Z3IMUD52EK4DDEV"
+) # GDAT5HWTGIU4TSSZ4752OUC4SABDLTLZFRPZUJ3D6LKBNEPA7V2CIG54
+bob_kp = Keypair.from_secret(
+ "SAEZSI6DY7AXJFIYA4PM6SIBNEYYXIEM2MSOTHFGKHDW32MBQ7KVO6EN"
+) # GBMLPRFCZDZJPKUPHUSHCKA737GOZL7ERZLGGMJ6YGHBFJZ6ZKMKCZTM
+native_token_contract_id = "CB64D3G7SM2RTH6JSGG34DDTFTQ5CFDKVDZJZSODMCX4NJ2HV2KN7OHT"
+
+alice_source = soroban_server.load_account(alice_kp.public_key)
+
+args = [
+ scval.to_address(alice_kp.public_key), # from
+ scval.to_address(bob_kp.public_key), # to
+ scval.to_int128(100 * 10**7), # amount, 100 XLM
+]
+
+tx = (
+ TransactionBuilder(alice_source, network_passphrase, base_fee=500)
+ .add_time_bounds(0, 0)
+ .append_invoke_contract_function_op(
+ contract_id=native_token_contract_id,
+ function_name="transfer",
+ parameters=args,
+ )
+ .build()
+)
+
+try:
+ tx = soroban_server.prepare_transaction(tx)
+except PrepareTransactionException as e:
+ print(f"Got exception: {e.simulate_transaction_response}")
+ raise e
+
+tx.sign(alice_kp)
+print(f"Signed XDR:\n{tx.to_xdr()}")
+
+send_transaction_data = soroban_server.send_transaction(tx)
+print(f"sent transaction: {send_transaction_data}")
+if send_transaction_data.status != SendTransactionStatus.PENDING:
+ raise Exception("send transaction failed")
+while True:
+ print("waiting for transaction to be confirmed...")
+ get_transaction_data = soroban_server.get_transaction(send_transaction_data.hash)
+ if get_transaction_data.status != GetTransactionStatus.NOT_FOUND:
+ break
+ time.sleep(3)
+
+print(f"transaction: {get_transaction_data}")
+
+if get_transaction_data.status == GetTransactionStatus.SUCCESS:
+ assert get_transaction_data.result_meta_xdr is not None
+ transaction_meta = stellar_xdr.TransactionMeta.from_xdr(
+ get_transaction_data.result_meta_xdr
+ )
+ if transaction_meta.v3.soroban_meta.return_value.type == stellar_xdr.SCValType.SCV_VOID: # type: ignore[union-attr]
+ print("send success")
+else:
+ print(f"Transaction failed: {get_transaction_data.result_xdr}")
diff --git a/examples/soroban_restore_footprint.py b/examples/soroban_restore_footprint.py
new file mode 100644
index 000000000..38b2e9d4c
--- /dev/null
+++ b/examples/soroban_restore_footprint.py
@@ -0,0 +1,74 @@
+"""This example shows how to restore footprint.
+
+See https://soroban.stellar.org/docs/fundamentals-and-concepts/state-expiration#restorefootprintop
+"""
+import time
+
+from stellar_sdk import (
+ Keypair,
+ Network,
+ SorobanDataBuilder,
+ SorobanServer,
+ TransactionBuilder,
+)
+from stellar_sdk import xdr as stellar_xdr
+from stellar_sdk.address import Address
+from stellar_sdk.exceptions import PrepareTransactionException
+from stellar_sdk.soroban_rpc import GetTransactionStatus, SendTransactionStatus
+
+secret = "SAAPYAPTTRZMCUZFPG3G66V4ZMHTK4TWA6NS7U4F7Z3IMUD52EK4DDEV"
+rpc_server_url = "https://rpc-futurenet.stellar.org:443/"
+contract_id = "CAEZUQ3JTKBLIYFZEHKSK5X2K3MGU66B4F6MJFEKZKF6ZFRWBERV3BKF"
+network_passphrase = Network.STANDALONE_NETWORK_PASSPHRASE
+
+kp = Keypair.from_secret(secret)
+soroban_server = SorobanServer(rpc_server_url)
+source = soroban_server.load_account(kp.public_key)
+
+ledger_key = stellar_xdr.LedgerKey(
+ stellar_xdr.LedgerEntryType.CONTRACT_DATA,
+ contract_data=stellar_xdr.LedgerKeyContractData(
+ contract=Address(contract_id).to_xdr_sc_address(),
+ key=stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE),
+ durability=stellar_xdr.ContractDataDurability.PERSISTENT,
+ ),
+)
+soroban_data = SorobanDataBuilder().set_read_only([ledger_key]).build()
+
+tx = (
+ TransactionBuilder(source, network_passphrase, base_fee=50000)
+ .set_timeout(300)
+ .append_restore_footprint_op()
+ .set_soroban_data(soroban_data)
+ .build()
+)
+print(f"XDR: {tx.to_xdr()}")
+
+try:
+ tx = soroban_server.prepare_transaction(tx)
+except PrepareTransactionException as e:
+ print(f"Got exception: {e.simulate_transaction_response}")
+ raise e
+
+tx.sign(kp)
+print(f"Signed XDR: {tx.to_xdr()}")
+
+send_transaction_data = soroban_server.send_transaction(tx)
+print(f"sent transaction: {send_transaction_data}")
+
+if send_transaction_data.status != SendTransactionStatus.PENDING:
+ raise Exception("send transaction failed")
+
+while True:
+ print("waiting for transaction to be confirmed...")
+ get_transaction_data = soroban_server.get_transaction(send_transaction_data.hash)
+ if get_transaction_data.status != GetTransactionStatus.NOT_FOUND:
+ break
+ time.sleep(3)
+
+print(f"transaction: {get_transaction_data}")
+
+if get_transaction_data.status == GetTransactionStatus.SUCCESS:
+ print(f"transaction success")
+else:
+ print(f"Transaction failed: {get_transaction_data.result_xdr}")
diff --git a/poetry.lock b/poetry.lock
index c54dbd496..bb0f9bbb7 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
+# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
[[package]]
name = "aiohttp"
@@ -114,7 +114,7 @@ speedups = ["Brotli", "aiodns", "cchardet"]
name = "aiohttp-sse-client"
version = "0.2.1"
description = "A Server-Sent Event python client base on aiohttp"
-optional = false
+optional = true
python-versions = "*"
files = [
{file = "aiohttp-sse-client-0.2.1.tar.gz", hash = "sha256:5004e29271624af586158dc7166cb0687a7a5997aab5b808f4b53400e1b72e3b"},
@@ -127,6 +127,20 @@ attrs = "*"
multidict = "*"
yarl = "*"
+[[package]]
+name = "aioresponses"
+version = "0.7.4"
+description = "Mock out requests made by ClientSession from aiohttp package"
+optional = false
+python-versions = "*"
+files = [
+ {file = "aioresponses-0.7.4-py2.py3-none-any.whl", hash = "sha256:1160486b5ea96fcae6170cf2bdef029b9d3a283b7dbeabb3d7f1182769bfb6b7"},
+ {file = "aioresponses-0.7.4.tar.gz", hash = "sha256:9b8c108b36354c04633bad0ea752b55d956a7602fe3e3234b939fc44af96f1d8"},
+]
+
+[package.dependencies]
+aiohttp = ">=2.0.0,<4.0.0"
+
[[package]]
name = "aiosignal"
version = "1.3.1"
@@ -141,15 +155,29 @@ files = [
[package.dependencies]
frozenlist = ">=1.1.0"
+[[package]]
+name = "annotated-types"
+version = "0.5.0"
+description = "Reusable constraint types to use with typing.Annotated"
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "annotated_types-0.5.0-py3-none-any.whl", hash = "sha256:58da39888f92c276ad970249761ebea80ba544b77acddaa1a4d6cf78287d45fd"},
+ {file = "annotated_types-0.5.0.tar.gz", hash = "sha256:47cdc3490d9ac1506ce92c7aaa76c579dc3509ff11e098fc867e5130ab7be802"},
+]
+
+[package.dependencies]
+typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""}
+
[[package]]
name = "async-timeout"
-version = "4.0.2"
+version = "4.0.3"
description = "Timeout context manager for asyncio programs"
optional = false
-python-versions = ">=3.6"
+python-versions = ">=3.7"
files = [
- {file = "async-timeout-4.0.2.tar.gz", hash = "sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15"},
- {file = "async_timeout-4.0.2-py3-none-any.whl", hash = "sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c"},
+ {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"},
+ {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"},
]
[package.dependencies]
@@ -254,13 +282,13 @@ uvloop = ["uvloop (>=0.15.2)"]
[[package]]
name = "certifi"
-version = "2023.5.7"
+version = "2023.7.22"
description = "Python package for providing Mozilla's CA Bundle."
optional = false
python-versions = ">=3.6"
files = [
- {file = "certifi-2023.5.7-py3-none-any.whl", hash = "sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716"},
- {file = "certifi-2023.5.7.tar.gz", hash = "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7"},
+ {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"},
+ {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"},
]
[[package]]
@@ -425,13 +453,13 @@ files = [
[[package]]
name = "click"
-version = "8.1.5"
+version = "8.1.7"
description = "Composable command line interface toolkit"
optional = false
python-versions = ">=3.7"
files = [
- {file = "click-8.1.5-py3-none-any.whl", hash = "sha256:e576aa487d679441d7d30abb87e1b43d24fc53bffb8758443b1a9e1cee504548"},
- {file = "click-8.1.5.tar.gz", hash = "sha256:4be4b1af8d665c6d942909916d31a213a106800c47d0eeba73d34da3cbc11367"},
+ {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"},
+ {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"},
]
[package.dependencies]
@@ -526,13 +554,13 @@ toml = ["tomli"]
[[package]]
name = "exceptiongroup"
-version = "1.1.2"
+version = "1.1.3"
description = "Backport of PEP 654 (exception groups)"
optional = false
python-versions = ">=3.7"
files = [
- {file = "exceptiongroup-1.1.2-py3-none-any.whl", hash = "sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"},
- {file = "exceptiongroup-1.1.2.tar.gz", hash = "sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"},
+ {file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"},
+ {file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"},
]
[package.extras]
@@ -707,16 +735,6 @@ files = [
{file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"},
{file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"},
{file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"},
- {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"},
{file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"},
{file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"},
{file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"},
@@ -914,32 +932,32 @@ files = [
[[package]]
name = "pathspec"
-version = "0.11.1"
+version = "0.11.2"
description = "Utility library for gitignore style pattern matching of file paths."
optional = false
python-versions = ">=3.7"
files = [
- {file = "pathspec-0.11.1-py3-none-any.whl", hash = "sha256:d8af70af76652554bd134c22b3e8a1cc46ed7d91edcdd721ef1a0c51a84a5293"},
- {file = "pathspec-0.11.1.tar.gz", hash = "sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687"},
+ {file = "pathspec-0.11.2-py3-none-any.whl", hash = "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20"},
+ {file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"},
]
[[package]]
name = "platformdirs"
-version = "3.9.1"
+version = "3.10.0"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
optional = false
python-versions = ">=3.7"
files = [
- {file = "platformdirs-3.9.1-py3-none-any.whl", hash = "sha256:ad8291ae0ae5072f66c16945166cb11c63394c7a3ad1b1bc9828ca3162da8c2f"},
- {file = "platformdirs-3.9.1.tar.gz", hash = "sha256:1b42b450ad933e981d56e59f1b97495428c9bd60698baab9f3eb3d00d5822421"},
+ {file = "platformdirs-3.10.0-py3-none-any.whl", hash = "sha256:d7c24979f292f916dc9cbf8648319032f551ea8c49a4c9bf2fb556a02070ec1d"},
+ {file = "platformdirs-3.10.0.tar.gz", hash = "sha256:b45696dab2d7cc691a3226759c0d3b00c47c8b6e293d96f6436f733303f77f6d"},
]
[package.dependencies]
-typing-extensions = {version = ">=4.6.3", markers = "python_version < \"3.8\""}
+typing-extensions = {version = ">=4.7.1", markers = "python_version < \"3.8\""}
[package.extras]
-docs = ["furo (>=2023.5.20)", "proselint (>=0.13)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"]
-test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)"]
+docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.1)", "sphinx-autodoc-typehints (>=1.24)"]
+test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)"]
[[package]]
name = "pluggy"
@@ -970,6 +988,143 @@ files = [
{file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"},
]
+[[package]]
+name = "pydantic"
+version = "2.3.0"
+description = "Data validation using Python type hints"
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "pydantic-2.3.0-py3-none-any.whl", hash = "sha256:45b5e446c6dfaad9444819a293b921a40e1db1aa61ea08aede0522529ce90e81"},
+ {file = "pydantic-2.3.0.tar.gz", hash = "sha256:1607cc106602284cd4a00882986570472f193fde9cb1259bceeaedb26aa79a6d"},
+]
+
+[package.dependencies]
+annotated-types = ">=0.4.0"
+pydantic-core = "2.6.3"
+typing-extensions = ">=4.6.1"
+
+[package.extras]
+email = ["email-validator (>=2.0.0)"]
+
+[[package]]
+name = "pydantic-core"
+version = "2.6.3"
+description = ""
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "pydantic_core-2.6.3-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:1a0ddaa723c48af27d19f27f1c73bdc615c73686d763388c8683fe34ae777bad"},
+ {file = "pydantic_core-2.6.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5cfde4fab34dd1e3a3f7f3db38182ab6c95e4ea91cf322242ee0be5c2f7e3d2f"},
+ {file = "pydantic_core-2.6.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5493a7027bfc6b108e17c3383959485087d5942e87eb62bbac69829eae9bc1f7"},
+ {file = "pydantic_core-2.6.3-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:84e87c16f582f5c753b7f39a71bd6647255512191be2d2dbf49458c4ef024588"},
+ {file = "pydantic_core-2.6.3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:522a9c4a4d1924facce7270c84b5134c5cabcb01513213662a2e89cf28c1d309"},
+ {file = "pydantic_core-2.6.3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aaafc776e5edc72b3cad1ccedb5fd869cc5c9a591f1213aa9eba31a781be9ac1"},
+ {file = "pydantic_core-2.6.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a750a83b2728299ca12e003d73d1264ad0440f60f4fc9cee54acc489249b728"},
+ {file = "pydantic_core-2.6.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9e8b374ef41ad5c461efb7a140ce4730661aadf85958b5c6a3e9cf4e040ff4bb"},
+ {file = "pydantic_core-2.6.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b594b64e8568cf09ee5c9501ede37066b9fc41d83d58f55b9952e32141256acd"},
+ {file = "pydantic_core-2.6.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2a20c533cb80466c1d42a43a4521669ccad7cf2967830ac62c2c2f9cece63e7e"},
+ {file = "pydantic_core-2.6.3-cp310-none-win32.whl", hash = "sha256:04fe5c0a43dec39aedba0ec9579001061d4653a9b53a1366b113aca4a3c05ca7"},
+ {file = "pydantic_core-2.6.3-cp310-none-win_amd64.whl", hash = "sha256:6bf7d610ac8f0065a286002a23bcce241ea8248c71988bda538edcc90e0c39ad"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-macosx_10_7_x86_64.whl", hash = "sha256:6bcc1ad776fffe25ea5c187a028991c031a00ff92d012ca1cc4714087e575973"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:df14f6332834444b4a37685810216cc8fe1fe91f447332cd56294c984ecbff1c"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0b7486d85293f7f0bbc39b34e1d8aa26210b450bbd3d245ec3d732864009819"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a892b5b1871b301ce20d40b037ffbe33d1407a39639c2b05356acfef5536d26a"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:883daa467865e5766931e07eb20f3e8152324f0adf52658f4d302242c12e2c32"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d4eb77df2964b64ba190eee00b2312a1fd7a862af8918ec70fc2d6308f76ac64"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1ce8c84051fa292a5dc54018a40e2a1926fd17980a9422c973e3ebea017aa8da"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:22134a4453bd59b7d1e895c455fe277af9d9d9fbbcb9dc3f4a97b8693e7e2c9b"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:02e1c385095efbd997311d85c6021d32369675c09bcbfff3b69d84e59dc103f6"},
+ {file = "pydantic_core-2.6.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d79f1f2f7ebdb9b741296b69049ff44aedd95976bfee38eb4848820628a99b50"},
+ {file = "pydantic_core-2.6.3-cp311-none-win32.whl", hash = "sha256:430ddd965ffd068dd70ef4e4d74f2c489c3a313adc28e829dd7262cc0d2dd1e8"},
+ {file = "pydantic_core-2.6.3-cp311-none-win_amd64.whl", hash = "sha256:84f8bb34fe76c68c9d96b77c60cef093f5e660ef8e43a6cbfcd991017d375950"},
+ {file = "pydantic_core-2.6.3-cp311-none-win_arm64.whl", hash = "sha256:5a2a3c9ef904dcdadb550eedf3291ec3f229431b0084666e2c2aa8ff99a103a2"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-macosx_10_7_x86_64.whl", hash = "sha256:8421cf496e746cf8d6b677502ed9a0d1e4e956586cd8b221e1312e0841c002d5"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bb128c30cf1df0ab78166ded1ecf876620fb9aac84d2413e8ea1594b588c735d"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:37a822f630712817b6ecc09ccc378192ef5ff12e2c9bae97eb5968a6cdf3b862"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:240a015102a0c0cc8114f1cba6444499a8a4d0333e178bc504a5c2196defd456"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3f90e5e3afb11268628c89f378f7a1ea3f2fe502a28af4192e30a6cdea1e7d5e"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:340e96c08de1069f3d022a85c2a8c63529fd88709468373b418f4cf2c949fb0e"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1480fa4682e8202b560dcdc9eeec1005f62a15742b813c88cdc01d44e85308e5"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f14546403c2a1d11a130b537dda28f07eb6c1805a43dae4617448074fd49c282"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:a87c54e72aa2ef30189dc74427421e074ab4561cf2bf314589f6af5b37f45e6d"},
+ {file = "pydantic_core-2.6.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f93255b3e4d64785554e544c1c76cd32f4a354fa79e2eeca5d16ac2e7fdd57aa"},
+ {file = "pydantic_core-2.6.3-cp312-none-win32.whl", hash = "sha256:f70dc00a91311a1aea124e5f64569ea44c011b58433981313202c46bccbec0e1"},
+ {file = "pydantic_core-2.6.3-cp312-none-win_amd64.whl", hash = "sha256:23470a23614c701b37252618e7851e595060a96a23016f9a084f3f92f5ed5881"},
+ {file = "pydantic_core-2.6.3-cp312-none-win_arm64.whl", hash = "sha256:1ac1750df1b4339b543531ce793b8fd5c16660a95d13aecaab26b44ce11775e9"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-macosx_10_7_x86_64.whl", hash = "sha256:a53e3195f134bde03620d87a7e2b2f2046e0e5a8195e66d0f244d6d5b2f6d31b"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-macosx_11_0_arm64.whl", hash = "sha256:f2969e8f72c6236c51f91fbb79c33821d12a811e2a94b7aa59c65f8dbdfad34a"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:672174480a85386dd2e681cadd7d951471ad0bb028ed744c895f11f9d51b9ebe"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:002d0ea50e17ed982c2d65b480bd975fc41086a5a2f9c924ef8fc54419d1dea3"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3ccc13afee44b9006a73d2046068d4df96dc5b333bf3509d9a06d1b42db6d8bf"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:439a0de139556745ae53f9cc9668c6c2053444af940d3ef3ecad95b079bc9987"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d63b7545d489422d417a0cae6f9898618669608750fc5e62156957e609e728a5"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b44c42edc07a50a081672e25dfe6022554b47f91e793066a7b601ca290f71e42"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1c721bfc575d57305dd922e6a40a8fe3f762905851d694245807a351ad255c58"},
+ {file = "pydantic_core-2.6.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:5e4a2cf8c4543f37f5dc881de6c190de08096c53986381daebb56a355be5dfe6"},
+ {file = "pydantic_core-2.6.3-cp37-none-win32.whl", hash = "sha256:d9b4916b21931b08096efed090327f8fe78e09ae8f5ad44e07f5c72a7eedb51b"},
+ {file = "pydantic_core-2.6.3-cp37-none-win_amd64.whl", hash = "sha256:a8acc9dedd304da161eb071cc7ff1326aa5b66aadec9622b2574ad3ffe225525"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-macosx_10_7_x86_64.whl", hash = "sha256:5e9c068f36b9f396399d43bfb6defd4cc99c36215f6ff33ac8b9c14ba15bdf6b"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e61eae9b31799c32c5f9b7be906be3380e699e74b2db26c227c50a5fc7988698"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d85463560c67fc65cd86153a4975d0b720b6d7725cf7ee0b2d291288433fc21b"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9616567800bdc83ce136e5847d41008a1d602213d024207b0ff6cab6753fe645"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9e9b65a55bbabda7fccd3500192a79f6e474d8d36e78d1685496aad5f9dbd92c"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f468d520f47807d1eb5d27648393519655eadc578d5dd862d06873cce04c4d1b"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9680dd23055dd874173a3a63a44e7f5a13885a4cfd7e84814be71be24fba83db"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9a718d56c4d55efcfc63f680f207c9f19c8376e5a8a67773535e6f7e80e93170"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:8ecbac050856eb6c3046dea655b39216597e373aa8e50e134c0e202f9c47efec"},
+ {file = "pydantic_core-2.6.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:788be9844a6e5c4612b74512a76b2153f1877cd845410d756841f6c3420230eb"},
+ {file = "pydantic_core-2.6.3-cp38-none-win32.whl", hash = "sha256:07a1aec07333bf5adebd8264047d3dc518563d92aca6f2f5b36f505132399efc"},
+ {file = "pydantic_core-2.6.3-cp38-none-win_amd64.whl", hash = "sha256:621afe25cc2b3c4ba05fff53525156d5100eb35c6e5a7cf31d66cc9e1963e378"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-macosx_10_7_x86_64.whl", hash = "sha256:813aab5bfb19c98ae370952b6f7190f1e28e565909bfc219a0909db168783465"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:50555ba3cb58f9861b7a48c493636b996a617db1a72c18da4d7f16d7b1b9952b"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19e20f8baedd7d987bd3f8005c146e6bcbda7cdeefc36fad50c66adb2dd2da48"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b0a5d7edb76c1c57b95df719af703e796fc8e796447a1da939f97bfa8a918d60"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f06e21ad0b504658a3a9edd3d8530e8cea5723f6ea5d280e8db8efc625b47e49"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea053cefa008fda40f92aab937fb9f183cf8752e41dbc7bc68917884454c6362"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:171a4718860790f66d6c2eda1d95dd1edf64f864d2e9f9115840840cf5b5713f"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5ed7ceca6aba5331ece96c0e328cd52f0dcf942b8895a1ed2642de50800b79d3"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:acafc4368b289a9f291e204d2c4c75908557d4f36bd3ae937914d4529bf62a76"},
+ {file = "pydantic_core-2.6.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:1aa712ba150d5105814e53cb141412217146fedc22621e9acff9236d77d2a5ef"},
+ {file = "pydantic_core-2.6.3-cp39-none-win32.whl", hash = "sha256:44b4f937b992394a2e81a5c5ce716f3dcc1237281e81b80c748b2da6dd5cf29a"},
+ {file = "pydantic_core-2.6.3-cp39-none-win_amd64.whl", hash = "sha256:9b33bf9658cb29ac1a517c11e865112316d09687d767d7a0e4a63d5c640d1b17"},
+ {file = "pydantic_core-2.6.3-pp310-pypy310_pp73-macosx_10_7_x86_64.whl", hash = "sha256:d7050899026e708fb185e174c63ebc2c4ee7a0c17b0a96ebc50e1f76a231c057"},
+ {file = "pydantic_core-2.6.3-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:99faba727727b2e59129c59542284efebbddade4f0ae6a29c8b8d3e1f437beb7"},
+ {file = "pydantic_core-2.6.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5fa159b902d22b283b680ef52b532b29554ea2a7fc39bf354064751369e9dbd7"},
+ {file = "pydantic_core-2.6.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:046af9cfb5384f3684eeb3f58a48698ddab8dd870b4b3f67f825353a14441418"},
+ {file = "pydantic_core-2.6.3-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:930bfe73e665ebce3f0da2c6d64455098aaa67e1a00323c74dc752627879fc67"},
+ {file = "pydantic_core-2.6.3-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:85cc4d105747d2aa3c5cf3e37dac50141bff779545ba59a095f4a96b0a460e70"},
+ {file = "pydantic_core-2.6.3-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:b25afe9d5c4f60dcbbe2b277a79be114e2e65a16598db8abee2a2dcde24f162b"},
+ {file = "pydantic_core-2.6.3-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:e49ce7dc9f925e1fb010fc3d555250139df61fa6e5a0a95ce356329602c11ea9"},
+ {file = "pydantic_core-2.6.3-pp37-pypy37_pp73-macosx_10_7_x86_64.whl", hash = "sha256:2dd50d6a1aef0426a1d0199190c6c43ec89812b1f409e7fe44cb0fbf6dfa733c"},
+ {file = "pydantic_core-2.6.3-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c6595b0d8c8711e8e1dc389d52648b923b809f68ac1c6f0baa525c6440aa0daa"},
+ {file = "pydantic_core-2.6.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4ef724a059396751aef71e847178d66ad7fc3fc969a1a40c29f5aac1aa5f8784"},
+ {file = "pydantic_core-2.6.3-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:3c8945a105f1589ce8a693753b908815e0748f6279959a4530f6742e1994dcb6"},
+ {file = "pydantic_core-2.6.3-pp37-pypy37_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c8c6660089a25d45333cb9db56bb9e347241a6d7509838dbbd1931d0e19dbc7f"},
+ {file = "pydantic_core-2.6.3-pp37-pypy37_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:692b4ff5c4e828a38716cfa92667661a39886e71136c97b7dac26edef18767f7"},
+ {file = "pydantic_core-2.6.3-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:f1a5d8f18877474c80b7711d870db0eeef9442691fcdb00adabfc97e183ee0b0"},
+ {file = "pydantic_core-2.6.3-pp38-pypy38_pp73-macosx_10_7_x86_64.whl", hash = "sha256:3796a6152c545339d3b1652183e786df648ecdf7c4f9347e1d30e6750907f5bb"},
+ {file = "pydantic_core-2.6.3-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:b962700962f6e7a6bd77e5f37320cabac24b4c0f76afeac05e9f93cf0c620014"},
+ {file = "pydantic_core-2.6.3-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:56ea80269077003eaa59723bac1d8bacd2cd15ae30456f2890811efc1e3d4413"},
+ {file = "pydantic_core-2.6.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75c0ebbebae71ed1e385f7dfd9b74c1cff09fed24a6df43d326dd7f12339ec34"},
+ {file = "pydantic_core-2.6.3-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:252851b38bad3bfda47b104ffd077d4f9604a10cb06fe09d020016a25107bf98"},
+ {file = "pydantic_core-2.6.3-pp38-pypy38_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:6656a0ae383d8cd7cc94e91de4e526407b3726049ce8d7939049cbfa426518c8"},
+ {file = "pydantic_core-2.6.3-pp38-pypy38_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:d9140ded382a5b04a1c030b593ed9bf3088243a0a8b7fa9f071a5736498c5483"},
+ {file = "pydantic_core-2.6.3-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:d38bbcef58220f9c81e42c255ef0bf99735d8f11edef69ab0b499da77105158a"},
+ {file = "pydantic_core-2.6.3-pp39-pypy39_pp73-macosx_10_7_x86_64.whl", hash = "sha256:c9d469204abcca28926cbc28ce98f28e50e488767b084fb3fbdf21af11d3de26"},
+ {file = "pydantic_core-2.6.3-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:48c1ed8b02ffea4d5c9c220eda27af02b8149fe58526359b3c07eb391cb353a2"},
+ {file = "pydantic_core-2.6.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b2b1bfed698fa410ab81982f681f5b1996d3d994ae8073286515ac4d165c2e7"},
+ {file = "pydantic_core-2.6.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bf9d42a71a4d7a7c1f14f629e5c30eac451a6fc81827d2beefd57d014c006c4a"},
+ {file = "pydantic_core-2.6.3-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4292ca56751aebbe63a84bbfc3b5717abb09b14d4b4442cc43fd7c49a1529efd"},
+ {file = "pydantic_core-2.6.3-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:7dc2ce039c7290b4ef64334ec7e6ca6494de6eecc81e21cb4f73b9b39991408c"},
+ {file = "pydantic_core-2.6.3-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:615a31b1629e12445c0e9fc8339b41aaa6cc60bd53bf802d5fe3d2c0cda2ae8d"},
+ {file = "pydantic_core-2.6.3-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:1fa1f6312fb84e8c281f32b39affe81984ccd484da6e9d65b3d18c202c666149"},
+ {file = "pydantic_core-2.6.3.tar.gz", hash = "sha256:1508f37ba9e3ddc0189e6ff4e2228bd2d3c3a4641cbe8c07177162f76ed696c7"},
+]
+
+[package.dependencies]
+typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0"
+
[[package]]
name = "pyflakes"
version = "3.0.1"
@@ -1116,6 +1271,25 @@ urllib3 = ">=1.21.1,<3"
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
+[[package]]
+name = "requests-mock"
+version = "1.11.0"
+description = "Mock out responses from the requests package"
+optional = false
+python-versions = "*"
+files = [
+ {file = "requests-mock-1.11.0.tar.gz", hash = "sha256:ef10b572b489a5f28e09b708697208c4a3b2b89ef80a9f01584340ea357ec3c4"},
+ {file = "requests_mock-1.11.0-py2.py3-none-any.whl", hash = "sha256:f7fae383f228633f6bececebdab236c478ace2284d6292c6e7e2867b9ab74d15"},
+]
+
+[package.dependencies]
+requests = ">=2.3,<3"
+six = "*"
+
+[package.extras]
+fixture = ["fixtures"]
+test = ["fixtures", "mock", "purl", "pytest", "requests-futures", "sphinx", "testtools"]
+
[[package]]
name = "six"
version = "1.16.0"
@@ -1213,21 +1387,6 @@ files = [
{file = "typed_ast-1.5.5.tar.gz", hash = "sha256:94282f7a354f36ef5dbce0ef3467ebf6a258e370ab33d5b40c249fa996e590dd"},
]
-[[package]]
-name = "typeguard"
-version = "2.13.3"
-description = "Run-time type checker for Python"
-optional = false
-python-versions = ">=3.5.3"
-files = [
- {file = "typeguard-2.13.3-py3-none-any.whl", hash = "sha256:5e3e3be01e887e7eafae5af63d1f36c849aaa94e3a0112097312aabfa16284f1"},
- {file = "typeguard-2.13.3.tar.gz", hash = "sha256:00edaa8da3a133674796cf5ea87d9f4b4c367d77476e185e80251cc13dfbb8c4"},
-]
-
-[package.extras]
-doc = ["sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"]
-test = ["mypy", "pytest", "typing-extensions"]
-
[[package]]
name = "types-requests"
version = "2.31.0.2"
@@ -1255,13 +1414,13 @@ files = [
[[package]]
name = "types-urllib3"
-version = "1.26.25.13"
+version = "1.26.25.14"
description = "Typing stubs for urllib3"
optional = false
python-versions = "*"
files = [
- {file = "types-urllib3-1.26.25.13.tar.gz", hash = "sha256:3300538c9dc11dad32eae4827ac313f5d986b8b21494801f1bf97a1ac6c03ae5"},
- {file = "types_urllib3-1.26.25.13-py3-none-any.whl", hash = "sha256:5dbd1d2bef14efee43f5318b5d36d805a489f6600252bb53626d4bfafd95e27c"},
+ {file = "types-urllib3-1.26.25.14.tar.gz", hash = "sha256:229b7f577c951b8c1b92c1bc2b2fdb0b49847bd2af6d1cc2a2e3dd340f3bda8f"},
+ {file = "types_urllib3-1.26.25.14-py3-none-any.whl", hash = "sha256:9683bbb7fb72e32bfe9d2be6e04875fbe1b3eeec3cbb4ea231435aa7fd6b4f0e"},
]
[[package]]
@@ -1277,20 +1436,19 @@ files = [
[[package]]
name = "urllib3"
-version = "2.0.4"
+version = "1.26.16"
description = "HTTP library with thread-safe connection pooling, file post, and more."
optional = false
-python-versions = ">=3.7"
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
files = [
- {file = "urllib3-2.0.4-py3-none-any.whl", hash = "sha256:de7df1803967d2c2a98e4b11bb7d6bd9210474c46e8a0401514e3a42a75ebde4"},
- {file = "urllib3-2.0.4.tar.gz", hash = "sha256:8d22f86aae8ef5e410d4f539fde9ce6b2113a001bb4d189e0aed70642d602b11"},
+ {file = "urllib3-1.26.16-py2.py3-none-any.whl", hash = "sha256:8d36afa7616d8ab714608411b4a3b13e58f463aee519024578e062e141dce20f"},
+ {file = "urllib3-1.26.16.tar.gz", hash = "sha256:8f135f6502756bde6b2a9b28989df5fbe87c9970cecaa69041edcce7f0589b14"},
]
[package.extras]
-brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"]
-secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"]
-socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
-zstd = ["zstandard (>=0.18.0)"]
+brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"]
+secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"]
+socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
[[package]]
name = "werkzeug"
@@ -1424,9 +1582,9 @@ docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker
testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"]
[extras]
-docs = []
+aiohttp = ["aiohttp", "aiohttp-sse-client"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.7,<4.0"
-content-hash = "c133082b7ecfbe66c648b13d99f2844d70371866cf55ba0aa9033b785bd69816"
+content-hash = "5511a745687214cb8fbfde714e803c824f6a827c3b5efcb5845f1030c53da2c3"
diff --git a/pyproject.toml b/pyproject.toml
index 88f832835..5f4b5525a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "stellar-sdk"
-version = "8.2.1"
+version = "9.0.0a2"
description = "The Python Stellar SDK library provides APIs to build transactions and connect to Horizon."
authors = [
"overcat <4catcode@gmail.com>",
@@ -27,7 +27,7 @@ keywords = [
]
license = "Apache License 2.0"
classifiers = [
- "Development Status :: 5 - Production/Stable",
+ "Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
@@ -47,15 +47,18 @@ classifiers = [
python = ">=3.7,<4.0"
PyNaCl = "^1.4.0"
requests = "^2.26.0"
-aiohttp = "^3.8.1"
-aiohttp-sse-client = "^0.2.1"
+aiohttp = { version = "^3.8.1", optional = true}
+aiohttp-sse-client = { version = "^0.2.1", optional = true}
stellar-base-sseclient = "^0.0.21"
mnemonic = "^0.20"
toml = "^0.10.2"
-typeguard = "^2.13.0"
-urllib3 = ">=1.26.7,<3.0.0"
+urllib3 = "^1.26.7"
+pydantic = "^2.3.0"
xdrlib3 = "^0.1.1"
+[tool.poetry.extras]
+aiohttp = ["aiohttp", "aiohttp-sse-client"]
+
[tool.poetry.dev-dependencies]
pytest = "^7.4.2"
pytest-cov = "^4.1.0"
@@ -69,9 +72,8 @@ types-requests = {version = "^2.31.0", markers = "platform_python_implementation
autoflake = "^2.1"
isort = "^5.10.1"
black = "^23.3.0"
-
-[tool.poetry.extras]
-docs = ["sphinx", "sphinx-rtd-theme", "sphinx-autodoc-typehints"]
+requests-mock = "^1.11.0"
+aioresponses = "^0.7.4"
[tool.mypy]
show_error_codes = true
@@ -102,6 +104,9 @@ exclude_lines = [
"pass"
]
+[tool.isort]
+profile = "black"
+
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
diff --git a/stellar_sdk/__init__.py b/stellar_sdk/__init__.py
index ecbe5474a..37fa84f9f 100644
--- a/stellar_sdk/__init__.py
+++ b/stellar_sdk/__init__.py
@@ -1,3 +1,4 @@
+from . import scval
from .__version__ import (
__author__,
__author_email__,
@@ -9,8 +10,8 @@
__version__,
)
from .account import *
+from .address import *
from .asset import *
-from .client.aiohttp_client import AiohttpClient
from .client.requests_client import RequestsClient
from .decorated_signature import *
from .fee_bump_transaction import *
@@ -27,11 +28,19 @@
from .preconditions import *
from .price import *
from .server import *
-from .server_async import *
from .signer import *
from .signer_key import *
+from .soroban_data_builder import *
+from .soroban_server import *
from .strkey import *
from .time_bounds import *
from .transaction import *
from .transaction_builder import *
from .transaction_envelope import *
+
+# aiohttp required
+try:
+ from .client.aiohttp_client import AiohttpClient
+ from .server_async import *
+except ImportError:
+ pass
diff --git a/stellar_sdk/__version__.py b/stellar_sdk/__version__.py
index 501b64eef..351224e0c 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."
__url__ = "https://github.com/StellarCN/py-stellar-base"
__issues__ = f"{__url__}/issues"
-__version__ = "8.2.1"
+__version__ = "9.0.0a2"
__author__ = "Eno, overcat"
__author_email__ = "appweb.cn@gmail.com, 4catcode@gmail.com"
__license__ = "Apache License 2.0"
diff --git a/stellar_sdk/account.py b/stellar_sdk/account.py
index ca53da231..b0c9c06ea 100644
--- a/stellar_sdk/account.py
+++ b/stellar_sdk/account.py
@@ -2,12 +2,10 @@
from .muxed_account import MuxedAccount
from .sep.ed25519_public_key_signer import Ed25519PublicKeySigner
-from .type_checked import type_checked
__all__ = ["Account"]
-@type_checked
class Account:
"""The :class:`Account` object represents a single
account on the Stellar network and its sequence number.
@@ -89,6 +87,9 @@ def load_ed25519_public_key_signers(self) -> List[Ed25519PublicKeySigner]:
)
return ed25519_public_key_signers
+ def __hash__(self):
+ return hash((self.account, self.sequence, self.raw_data))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -98,7 +99,6 @@ def __str__(self):
return f""
-@type_checked
class Thresholds:
def __init__(
self, low_threshold: int, med_threshold: int, high_threshold: int
@@ -107,6 +107,9 @@ def __init__(
self.med_threshold = med_threshold
self.high_threshold = high_threshold
+ def __hash__(self):
+ return hash((self.low_threshold, self.med_threshold, self.high_threshold))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/address.py b/stellar_sdk/address.py
new file mode 100644
index 000000000..ceecc7fb5
--- /dev/null
+++ b/stellar_sdk/address.py
@@ -0,0 +1,138 @@
+import binascii
+from enum import IntEnum
+from typing import Union
+
+from . import xdr as stellar_xdr
+from .strkey import StrKey
+from .xdr import Hash
+
+__all__ = ["Address"]
+
+
+class AddressType(IntEnum):
+ """Represents an Address type."""
+
+ ACCOUNT = 0
+ """An account address, address looks like ``GBJCHUKZMTFSLOMNC7P4TS4VJJBTCYL3XKSOLXAUJSD56C4LHND5TWUC``."""
+
+ CONTRACT = 1
+ """An contract address, address looks like ``CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5``."""
+
+
+class Address:
+ """Represents a single address in the Stellar network.
+ An address can represent an account or a contract.
+
+ :param address: ID of the account or contract. (ex. ``GBJCHUKZMTFSLOMNC7P4TS4VJJBTCYL3XKSOLXAUJSD56C4LHND5TWUC``
+ or ``CA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUWDA``)
+ """
+
+ def __init__(self, address: str):
+ if StrKey.is_valid_ed25519_public_key(address):
+ self.type = AddressType.ACCOUNT
+ self.key = StrKey.decode_ed25519_public_key(address)
+ elif StrKey.is_valid_contract(address):
+ self.type = AddressType.CONTRACT
+ self.key = StrKey.decode_contract(address)
+ else:
+ raise ValueError("Unsupported address type.")
+
+ @property
+ def address(self) -> str:
+ """Returns the encoded address.
+
+ :return: The encoded address.
+ """
+ if self.type == AddressType.ACCOUNT:
+ return StrKey.encode_ed25519_public_key(self.key)
+ elif self.type == AddressType.CONTRACT:
+ return StrKey.encode_contract(self.key)
+ else:
+ raise ValueError("Unsupported address type.")
+
+ @staticmethod
+ def from_raw_account(account: Union[bytes, str]) -> "Address":
+ """Creates a new account Address object from raw bytes.
+
+ :param account: The raw bytes of the account.
+ :return: A new Address object.
+ """
+ if isinstance(account, str):
+ account = binascii.unhexlify(account)
+ return Address(StrKey.encode_ed25519_public_key(account))
+
+ @staticmethod
+ def from_raw_contract(contract: Union[bytes, str]) -> "Address":
+ """Creates a new contract Address object from a buffer of raw bytes.
+
+ :param contract: The raw bytes of the contract.
+ :return: A new Address object.
+ """
+ if isinstance(contract, str):
+ contract = binascii.unhexlify(contract)
+ return Address(StrKey.encode_contract(contract))
+
+ def to_xdr_sc_address(self) -> stellar_xdr.SCAddress:
+ """Converts the Address object to a :class:`stellar_sdk.xdr.SCAddress` XDR object.
+
+ :return: A :class:`stellar_sdk.xdr.SCAddress` XDR object.
+ """
+ if self.type == AddressType.ACCOUNT:
+ account = stellar_xdr.AccountID(
+ stellar_xdr.PublicKey(
+ stellar_xdr.PublicKeyType.PUBLIC_KEY_TYPE_ED25519,
+ stellar_xdr.Uint256(self.key),
+ )
+ )
+ return stellar_xdr.SCAddress(
+ stellar_xdr.SCAddressType.SC_ADDRESS_TYPE_ACCOUNT, account_id=account
+ )
+ elif self.type == AddressType.CONTRACT:
+ contract = Hash(self.key)
+ return stellar_xdr.SCAddress(
+ stellar_xdr.SCAddressType.SC_ADDRESS_TYPE_CONTRACT, contract_id=contract
+ )
+ else:
+ raise ValueError("Unsupported address type.")
+
+ @classmethod
+ def from_xdr_sc_address(cls, sc_address: stellar_xdr.SCAddress) -> "Address":
+ """Creates a new Address object from a :class:`stellar_sdk.xdr.SCAddress` XDR object.
+
+ :param sc_address: The :class:`stellar_sdk.xdr.SCAddress` XDR object.
+ :return: A new Address object.
+ """
+ if sc_address.type == stellar_xdr.SCAddressType.SC_ADDRESS_TYPE_ACCOUNT:
+ assert sc_address.account_id is not None
+ assert sc_address.account_id.account_id.ed25519 is not None
+ return cls.from_raw_account(
+ sc_address.account_id.account_id.ed25519.uint256
+ )
+ elif sc_address.type == stellar_xdr.SCAddressType.SC_ADDRESS_TYPE_CONTRACT:
+ assert sc_address.contract_id is not None
+ return cls.from_raw_contract(sc_address.contract_id.hash)
+ else:
+ raise ValueError("Unsupported address type.")
+
+ def to_xdr_sc_val(self) -> stellar_xdr.SCVal:
+ return stellar_xdr.SCVal(
+ stellar_xdr.SCValType.SCV_ADDRESS, address=self.to_xdr_sc_address()
+ )
+
+ @classmethod
+ def from_xdr_sc_val(cls, sc_val: stellar_xdr.SCVal) -> "Address":
+ if sc_val.type != stellar_xdr.SCValType.SCV_ADDRESS:
+ raise ValueError("Unsupported SCVal type.")
+ assert sc_val.address is not None
+ return cls.from_xdr_sc_address(sc_val.address)
+
+ def __hash__(self):
+ return hash((self.key, self.type))
+
+ def __eq__(self, other: object) -> bool:
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.key == other.key and self.type == other.type
+
+ def __str__(self):
+ return f""
diff --git a/stellar_sdk/asset.py b/stellar_sdk/asset.py
index 633082f0d..9d29bc2af 100644
--- a/stellar_sdk/asset.py
+++ b/stellar_sdk/asset.py
@@ -2,15 +2,13 @@
from typing import Dict, Optional, Type, Union
from . import xdr as stellar_xdr
-from .exceptions import AssetCodeInvalidError, AssetIssuerInvalidError, AttributeError
+from .exceptions import AssetCodeInvalidError, AssetIssuerInvalidError
from .keypair import Keypair
from .strkey import StrKey
-from .type_checked import type_checked
__all__ = ["Asset"]
-@type_checked
class Asset:
"""The :class:`Asset` object, which represents an asset and its
corresponding issuer on the Stellar network.
diff --git a/stellar_sdk/base_server.py b/stellar_sdk/base_server.py
index 2c148ba8b..6b7ffa27f 100644
--- a/stellar_sdk/base_server.py
+++ b/stellar_sdk/base_server.py
@@ -38,12 +38,10 @@
from .sep.exceptions import AccountRequiresMemoError
from .transaction import Transaction
from .transaction_envelope import TransactionEnvelope
-from .type_checked import type_checked
__all__ = ["BaseServer"]
-@type_checked
class BaseServer:
def submit_transaction(
self,
diff --git a/stellar_sdk/base_transaction_envelope.py b/stellar_sdk/base_transaction_envelope.py
index b14a6b417..64b37fdd1 100644
--- a/stellar_sdk/base_transaction_envelope.py
+++ b/stellar_sdk/base_transaction_envelope.py
@@ -1,26 +1,26 @@
from abc import abstractmethod
-from typing import Generic, List, TypeVar, Union
+from typing import Generic, List, Sequence, TypeVar, Union
from . import xdr as stellar_xdr
from .decorated_signature import DecoratedSignature
from .exceptions import SignatureExistError
from .keypair import Keypair
from .network import Network
-from .type_checked import type_checked
from .utils import hex_to_bytes, sha256
T = TypeVar("T")
-@type_checked
class BaseTransactionEnvelope(Generic[T]):
def __init__(
self,
network_passphrase: str,
- signatures: List[DecoratedSignature] = None,
+ signatures: Sequence[DecoratedSignature] = None,
) -> None:
self.network_passphrase: str = network_passphrase
- self.signatures: List[DecoratedSignature] = signatures or []
+ self.signatures: List[DecoratedSignature] = (
+ list(signatures) if signatures else []
+ )
self._network_id: bytes = Network(network_passphrase).network_id()
def hash(self) -> bytes:
@@ -136,6 +136,10 @@ def from_xdr(cls, xdr: str, network_passphrase: str) -> T:
xdr_object = stellar_xdr.TransactionEnvelope.from_xdr(xdr)
return cls.from_xdr_object(xdr_object, network_passphrase)
+ @abstractmethod
+ def __hash__(self):
+ pass # pragma: no cover
+
@abstractmethod
def __eq__(self, other: object) -> bool:
pass # pragma: no cover
diff --git a/stellar_sdk/call_builder/base/base_accounts_call_builder.py b/stellar_sdk/call_builder/base/base_accounts_call_builder.py
index ae4d7d438..f83e280e5 100644
--- a/stellar_sdk/call_builder/base/base_accounts_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_accounts_call_builder.py
@@ -1,12 +1,10 @@
from ...asset import Asset
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
from ...utils import convert_assets_to_horizon_param
__all__ = ["BaseAccountsCallBuilder"]
-@type_checked
class BaseAccountsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`AccountsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_assets_call_builder.py b/stellar_sdk/call_builder/base/base_assets_call_builder.py
index ca2f87bf0..bde3b7d6c 100644
--- a/stellar_sdk/call_builder/base/base_assets_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_assets_call_builder.py
@@ -1,10 +1,8 @@
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseAssetsCallBuilder"]
-@type_checked
class BaseAssetsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`AssetsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_call_builder.py b/stellar_sdk/call_builder/base/base_call_builder.py
index 2492b49c1..e6bfe7fc6 100644
--- a/stellar_sdk/call_builder/base/base_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_call_builder.py
@@ -9,12 +9,9 @@
Union,
)
-from ...type_checked import type_checked
-
__all__ = ["BaseCallBuilder"]
-@type_checked
class BaseCallBuilder:
"""Creates a new :class:`BaseCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_claimable_balances_call_builder.py b/stellar_sdk/call_builder/base/base_claimable_balances_call_builder.py
index 0f98eb812..3369057d5 100644
--- a/stellar_sdk/call_builder/base/base_claimable_balances_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_claimable_balances_call_builder.py
@@ -1,12 +1,10 @@
from ...asset import Asset
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
from ...utils import convert_assets_to_horizon_param
__all__ = ["BaseClaimableBalancesCallBuilder"]
-@type_checked
class BaseClaimableBalancesCallBuilder(BaseCallBuilder):
"""Creates a new :class:`ClaimableBalancesCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_data_call_builder.py b/stellar_sdk/call_builder/base/base_data_call_builder.py
index 845d6f7ae..3e1620f26 100644
--- a/stellar_sdk/call_builder/base/base_data_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_data_call_builder.py
@@ -1,10 +1,8 @@
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseDataCallBuilder"]
-@type_checked
class BaseDataCallBuilder(BaseCallBuilder):
"""Creates a new :class:`DataCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_effects_call_builder.py b/stellar_sdk/call_builder/base/base_effects_call_builder.py
index 6a6974437..7ca29e4c4 100644
--- a/stellar_sdk/call_builder/base/base_effects_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_effects_call_builder.py
@@ -1,12 +1,10 @@
from typing import Union
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseEffectsCallBuilder"]
-@type_checked
class BaseEffectsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`EffectsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_fee_stats_call_builder.py b/stellar_sdk/call_builder/base/base_fee_stats_call_builder.py
index 2e4db0545..09226041b 100644
--- a/stellar_sdk/call_builder/base/base_fee_stats_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_fee_stats_call_builder.py
@@ -1,10 +1,8 @@
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseFeeStatsCallBuilder"]
-@type_checked
class BaseFeeStatsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`FeeStatsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_ledgers_call_builder.py b/stellar_sdk/call_builder/base/base_ledgers_call_builder.py
index ade1e1697..b63f2fb9b 100644
--- a/stellar_sdk/call_builder/base/base_ledgers_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_ledgers_call_builder.py
@@ -1,12 +1,10 @@
from typing import Union
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseLedgersCallBuilder"]
-@type_checked
class BaseLedgersCallBuilder(BaseCallBuilder):
"""Creates a new :class:`LedgersCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_liquidity_pools_builder.py b/stellar_sdk/call_builder/base/base_liquidity_pools_builder.py
index c1c94c041..b1bdd8dbb 100644
--- a/stellar_sdk/call_builder/base/base_liquidity_pools_builder.py
+++ b/stellar_sdk/call_builder/base/base_liquidity_pools_builder.py
@@ -1,14 +1,12 @@
-from typing import List
+from typing import Sequence
-from ... import Asset
+from ...asset import Asset
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
from ...utils import convert_assets_to_horizon_param
__all__ = ["BaseLiquidityPoolsBuilder"]
-@type_checked
class BaseLiquidityPoolsBuilder(BaseCallBuilder):
"""Creates a new :class:`LiquidityPoolsBuilder` pointed to server defined by horizon_url.
@@ -32,7 +30,7 @@ def liquidity_pool(self, liquidity_pool_id: str):
self.endpoint = f"liquidity_pools/{liquidity_pool_id}"
return self
- def for_reserves(self, reserves: List[Asset]):
+ def for_reserves(self, reserves: Sequence[Asset]):
"""Get pools by reserves.
Horizon will provide an endpoint to find all liquidity pools
diff --git a/stellar_sdk/call_builder/base/base_offers_call_builder.py b/stellar_sdk/call_builder/base/base_offers_call_builder.py
index 441bd0c06..305e2f87c 100644
--- a/stellar_sdk/call_builder/base/base_offers_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_offers_call_builder.py
@@ -2,12 +2,10 @@
from ...asset import Asset
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseOffersCallBuilder"]
-@type_checked
class BaseOffersCallBuilder(BaseCallBuilder):
"""Creates a new :class:`OffersCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_operations_call_builder.py b/stellar_sdk/call_builder/base/base_operations_call_builder.py
index 8c6d0c2bb..c7fbc65c3 100644
--- a/stellar_sdk/call_builder/base/base_operations_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_operations_call_builder.py
@@ -1,12 +1,10 @@
from typing import Union
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseOperationsCallBuilder"]
-@type_checked
class BaseOperationsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`OperationsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_orderbook_call_builder.py b/stellar_sdk/call_builder/base/base_orderbook_call_builder.py
index 243742f3e..36a45a92f 100644
--- a/stellar_sdk/call_builder/base/base_orderbook_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_orderbook_call_builder.py
@@ -1,11 +1,9 @@
from ...asset import Asset
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseOrderbookCallBuilder"]
-@type_checked
class BaseOrderbookCallBuilder(BaseCallBuilder):
"""Creates a new :class:`OrderbookCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_payments_call_builder.py b/stellar_sdk/call_builder/base/base_payments_call_builder.py
index f9c3fded4..0147ffa49 100644
--- a/stellar_sdk/call_builder/base/base_payments_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_payments_call_builder.py
@@ -1,12 +1,10 @@
from typing import Union
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BasePaymentsCallBuilder"]
-@type_checked
class BasePaymentsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`PaymentsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_root_call_builder.py b/stellar_sdk/call_builder/base/base_root_call_builder.py
index c23c45a8d..c57265b79 100644
--- a/stellar_sdk/call_builder/base/base_root_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_root_call_builder.py
@@ -1,10 +1,8 @@
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseRootCallBuilder"]
-@type_checked
class BaseRootCallBuilder(BaseCallBuilder):
"""Creates a new :class:`RootCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_strict_receive_paths_call_builder.py b/stellar_sdk/call_builder/base/base_strict_receive_paths_call_builder.py
index 9dbc765c9..a7ae3df16 100644
--- a/stellar_sdk/call_builder/base/base_strict_receive_paths_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_strict_receive_paths_call_builder.py
@@ -3,13 +3,11 @@
from ...asset import Asset
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
from ...utils import convert_assets_to_horizon_param
__all__ = ["BaseStrictReceivePathsCallBuilder"]
-@type_checked
class BaseStrictReceivePathsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`StrictReceivePathsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_strict_send_paths_call_builder.py b/stellar_sdk/call_builder/base/base_strict_send_paths_call_builder.py
index 533ed7cab..7d7d2bc0c 100644
--- a/stellar_sdk/call_builder/base/base_strict_send_paths_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_strict_send_paths_call_builder.py
@@ -3,13 +3,11 @@
from ...asset import Asset
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
from ...utils import convert_assets_to_horizon_param
__all__ = ["BaseStrictSendPathsCallBuilder"]
-@type_checked
class BaseStrictSendPathsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`StrictSendPathsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_trades_aggregation_call_builder.py b/stellar_sdk/call_builder/base/base_trades_aggregation_call_builder.py
index 06aa33c80..831db7add 100644
--- a/stellar_sdk/call_builder/base/base_trades_aggregation_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_trades_aggregation_call_builder.py
@@ -1,12 +1,9 @@
from ...asset import Asset
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...exceptions import ValueError
-from ...type_checked import type_checked
__all__ = ["BaseTradeAggregationsCallBuilder"]
-@type_checked
class BaseTradeAggregationsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`TradeAggregationsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_trades_call_builder.py b/stellar_sdk/call_builder/base/base_trades_call_builder.py
index c07676f8c..c58a691a6 100644
--- a/stellar_sdk/call_builder/base/base_trades_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_trades_call_builder.py
@@ -2,12 +2,10 @@
from ...asset import Asset
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseTradesCallBuilder"]
-@type_checked
class BaseTradesCallBuilder(BaseCallBuilder):
"""Creates a new :class:`TradesCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/base/base_transactions_call_builder.py b/stellar_sdk/call_builder/base/base_transactions_call_builder.py
index cd29f1602..38455b2e6 100644
--- a/stellar_sdk/call_builder/base/base_transactions_call_builder.py
+++ b/stellar_sdk/call_builder/base/base_transactions_call_builder.py
@@ -1,12 +1,10 @@
from typing import Union
from ...call_builder.base.base_call_builder import BaseCallBuilder
-from ...type_checked import type_checked
__all__ = ["BaseTransactionsCallBuilder"]
-@type_checked
class BaseTransactionsCallBuilder(BaseCallBuilder):
"""Creates a new :class:`TransactionsCallBuilder` pointed to server defined by horizon_url.
diff --git a/stellar_sdk/call_builder/call_builder_async/accounts_call_builder.py b/stellar_sdk/call_builder/call_builder_async/accounts_call_builder.py
index a425b6918..5e0da12f8 100644
--- a/stellar_sdk/call_builder/call_builder_async/accounts_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/accounts_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base.base_accounts_call_builder import BaseAccountsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["AccountsCallBuilder"]
-@type_checked
class AccountsCallBuilder(BaseCallBuilder, BaseAccountsCallBuilder):
"""Creates a new :class:`AccountsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.accounts`.
diff --git a/stellar_sdk/call_builder/call_builder_async/assets_call_builder.py b/stellar_sdk/call_builder/call_builder_async/assets_call_builder.py
index 297fe3f72..8353e8e0f 100644
--- a/stellar_sdk/call_builder/call_builder_async/assets_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/assets_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseAssetsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["AssetsCallBuilder"]
-@type_checked
class AssetsCallBuilder(BaseCallBuilder, BaseAssetsCallBuilder):
"""Creates a new :class:`AssetsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.assets`.
diff --git a/stellar_sdk/call_builder/call_builder_async/base_call_builder.py b/stellar_sdk/call_builder/call_builder_async/base_call_builder.py
index cce46c06f..70b6dce3d 100644
--- a/stellar_sdk/call_builder/call_builder_async/base_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/base_call_builder.py
@@ -4,13 +4,11 @@
from ...client.base_async_client import BaseAsyncClient
from ...client.response import Response
from ...exceptions import NotPageableError, raise_request_exception
-from ...type_checked import type_checked
from ...utils import urljoin_with_query
__all__ = ["BaseCallBuilder"]
-@type_checked
class BaseCallBuilder(_BaseCallBuilder):
"""Creates a new :class:`BaseCallBuilder` pointed to server defined by horizon_url.
@@ -78,6 +76,16 @@ async def prev(self) -> Dict[str, Any]:
raise NotPageableError("The prev page does not exist.")
return await self._call(self.prev_href, None)
+ def __hash__(self):
+ return hash(
+ (
+ self.params,
+ self.endpoint,
+ self.horizon_url,
+ self.client,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/call_builder/call_builder_async/claimable_balances_call_builder.py b/stellar_sdk/call_builder/call_builder_async/claimable_balances_call_builder.py
index 6544f91e6..fc1587b00 100644
--- a/stellar_sdk/call_builder/call_builder_async/claimable_balances_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/claimable_balances_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseClaimableBalancesCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["ClaimableBalancesCallBuilder"]
-@type_checked
class ClaimableBalancesCallBuilder(BaseCallBuilder, BaseClaimableBalancesCallBuilder):
"""Creates a new :class:`ClaimableBalancesCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.claimable_balance`.
diff --git a/stellar_sdk/call_builder/call_builder_async/data_call_builder.py b/stellar_sdk/call_builder/call_builder_async/data_call_builder.py
index 4369ae718..1a22c92df 100644
--- a/stellar_sdk/call_builder/call_builder_async/data_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/data_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseDataCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["DataCallBuilder"]
-@type_checked
class DataCallBuilder(BaseCallBuilder, BaseDataCallBuilder):
"""Creates a new :class:`DataCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.data`.
diff --git a/stellar_sdk/call_builder/call_builder_async/effects_call_builder.py b/stellar_sdk/call_builder/call_builder_async/effects_call_builder.py
index 3627a0a1a..389603613 100644
--- a/stellar_sdk/call_builder/call_builder_async/effects_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/effects_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseEffectsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["EffectsCallBuilder"]
-@type_checked
class EffectsCallBuilder(BaseCallBuilder, BaseEffectsCallBuilder):
"""Creates a new :class:`EffectsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.effects`.
diff --git a/stellar_sdk/call_builder/call_builder_async/fee_stats_call_builder.py b/stellar_sdk/call_builder/call_builder_async/fee_stats_call_builder.py
index 53f304a98..661aa8ef9 100644
--- a/stellar_sdk/call_builder/call_builder_async/fee_stats_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/fee_stats_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseFeeStatsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["FeeStatsCallBuilder"]
-@type_checked
class FeeStatsCallBuilder(BaseCallBuilder, BaseFeeStatsCallBuilder):
"""Creates a new :class:`FeeStatsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.fee_stats`.
diff --git a/stellar_sdk/call_builder/call_builder_async/ledgers_call_builder.py b/stellar_sdk/call_builder/call_builder_async/ledgers_call_builder.py
index 48679fc71..d5bbb9f73 100644
--- a/stellar_sdk/call_builder/call_builder_async/ledgers_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/ledgers_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseLedgersCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["LedgersCallBuilder"]
-@type_checked
class LedgersCallBuilder(BaseCallBuilder, BaseLedgersCallBuilder):
"""Creates a new :class:`LedgersCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.ledgers`.
diff --git a/stellar_sdk/call_builder/call_builder_async/liquidity_pools_builder.py b/stellar_sdk/call_builder/call_builder_async/liquidity_pools_builder.py
index bdb901cce..d9154e031 100644
--- a/stellar_sdk/call_builder/call_builder_async/liquidity_pools_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/liquidity_pools_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseLiquidityPoolsBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["LiquidityPoolsBuilder"]
-@type_checked
class LiquidityPoolsBuilder(BaseCallBuilder, BaseLiquidityPoolsBuilder):
"""Creates a new :class:`LiquidityPoolsBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.liquidity_pools`.
diff --git a/stellar_sdk/call_builder/call_builder_async/offers_call_builder.py b/stellar_sdk/call_builder/call_builder_async/offers_call_builder.py
index d388b3eea..532007812 100644
--- a/stellar_sdk/call_builder/call_builder_async/offers_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/offers_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseOffersCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["OffersCallBuilder"]
-@type_checked
class OffersCallBuilder(BaseCallBuilder, BaseOffersCallBuilder):
"""Creates a new :class:`OffersCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.offers`.
diff --git a/stellar_sdk/call_builder/call_builder_async/operations_call_builder.py b/stellar_sdk/call_builder/call_builder_async/operations_call_builder.py
index 3089fe645..97d1eb899 100644
--- a/stellar_sdk/call_builder/call_builder_async/operations_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/operations_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseOperationsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["OperationsCallBuilder"]
-@type_checked
class OperationsCallBuilder(BaseCallBuilder, BaseOperationsCallBuilder):
"""Creates a new :class:`OperationsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.operations`.
diff --git a/stellar_sdk/call_builder/call_builder_async/orderbook_call_builder.py b/stellar_sdk/call_builder/call_builder_async/orderbook_call_builder.py
index 3f282a015..e6b47810b 100644
--- a/stellar_sdk/call_builder/call_builder_async/orderbook_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/orderbook_call_builder.py
@@ -2,12 +2,10 @@
from ...call_builder.base import BaseOrderbookCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["OrderbookCallBuilder"]
-@type_checked
class OrderbookCallBuilder(BaseCallBuilder, BaseOrderbookCallBuilder):
"""Creates a new :class:`OrderbookCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.orderbook`.
diff --git a/stellar_sdk/call_builder/call_builder_async/payments_call_builder.py b/stellar_sdk/call_builder/call_builder_async/payments_call_builder.py
index 3e7f06ac9..9016e7122 100644
--- a/stellar_sdk/call_builder/call_builder_async/payments_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/payments_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BasePaymentsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["PaymentsCallBuilder"]
-@type_checked
class PaymentsCallBuilder(BaseCallBuilder, BasePaymentsCallBuilder):
"""Creates a new :class:`PaymentsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.payments`.
diff --git a/stellar_sdk/call_builder/call_builder_async/root_call_builder.py b/stellar_sdk/call_builder/call_builder_async/root_call_builder.py
index bc7d6efd4..b2a4f9b10 100644
--- a/stellar_sdk/call_builder/call_builder_async/root_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/root_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseRootCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["RootCallBuilder"]
-@type_checked
class RootCallBuilder(BaseCallBuilder, BaseRootCallBuilder):
"""Creates a new :class:`RootCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.root`.
diff --git a/stellar_sdk/call_builder/call_builder_async/strict_receive_paths_call_builder.py b/stellar_sdk/call_builder/call_builder_async/strict_receive_paths_call_builder.py
index 45344bee9..94fcd4193 100644
--- a/stellar_sdk/call_builder/call_builder_async/strict_receive_paths_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/strict_receive_paths_call_builder.py
@@ -5,12 +5,10 @@
from ...call_builder.base import BaseStrictReceivePathsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["StrictReceivePathsCallBuilder"]
-@type_checked
class StrictReceivePathsCallBuilder(BaseCallBuilder, BaseStrictReceivePathsCallBuilder):
"""Creates a new :class:`StrictReceivePathsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.strict_receive_paths`.
diff --git a/stellar_sdk/call_builder/call_builder_async/strict_send_paths_call_builder.py b/stellar_sdk/call_builder/call_builder_async/strict_send_paths_call_builder.py
index 1aa8e4699..b6616b201 100644
--- a/stellar_sdk/call_builder/call_builder_async/strict_send_paths_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/strict_send_paths_call_builder.py
@@ -5,12 +5,10 @@
from ...call_builder.base import BaseStrictSendPathsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["StrictSendPathsCallBuilder"]
-@type_checked
class StrictSendPathsCallBuilder(BaseCallBuilder, BaseStrictSendPathsCallBuilder):
"""Creates a new :class:`StrictSendPathsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.strict_send_paths`.
diff --git a/stellar_sdk/call_builder/call_builder_async/trades_aggregation_call_builder.py b/stellar_sdk/call_builder/call_builder_async/trades_aggregation_call_builder.py
index 5c2ae4988..3b379e739 100644
--- a/stellar_sdk/call_builder/call_builder_async/trades_aggregation_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/trades_aggregation_call_builder.py
@@ -2,12 +2,10 @@
from ...call_builder.base import BaseTradeAggregationsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["TradeAggregationsCallBuilder"]
-@type_checked
class TradeAggregationsCallBuilder(BaseCallBuilder, BaseTradeAggregationsCallBuilder):
"""Creates a new :class:`TradeAggregationsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.trade_aggregations`.
diff --git a/stellar_sdk/call_builder/call_builder_async/trades_call_builder.py b/stellar_sdk/call_builder/call_builder_async/trades_call_builder.py
index 52bf81201..9305e782a 100644
--- a/stellar_sdk/call_builder/call_builder_async/trades_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/trades_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseTradesCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["TradesCallBuilder"]
-@type_checked
class TradesCallBuilder(BaseCallBuilder, BaseTradesCallBuilder):
"""Creates a new :class:`TradesCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.trades`.
diff --git a/stellar_sdk/call_builder/call_builder_async/transactions_call_builder.py b/stellar_sdk/call_builder/call_builder_async/transactions_call_builder.py
index dcb476c00..1cedb0150 100644
--- a/stellar_sdk/call_builder/call_builder_async/transactions_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_async/transactions_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseTransactionsCallBuilder
from ...call_builder.call_builder_async.base_call_builder import BaseCallBuilder
from ...client.base_async_client import BaseAsyncClient
-from ...type_checked import type_checked
__all__ = ["TransactionsCallBuilder"]
-@type_checked
class TransactionsCallBuilder(BaseCallBuilder, BaseTransactionsCallBuilder):
"""Creates a new :class:`TransactionsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.ServerAsync.transactions`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/accounts_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/accounts_call_builder.py
index 8fcb7236a..3db421031 100644
--- a/stellar_sdk/call_builder/call_builder_sync/accounts_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/accounts_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base.base_accounts_call_builder import BaseAccountsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["AccountsCallBuilder"]
-@type_checked
class AccountsCallBuilder(BaseCallBuilder, BaseAccountsCallBuilder):
"""Creates a new :class:`AccountsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.accounts`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/assets_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/assets_call_builder.py
index 1b9e8c4a2..5e1938d20 100644
--- a/stellar_sdk/call_builder/call_builder_sync/assets_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/assets_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseAssetsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["AssetsCallBuilder"]
-@type_checked
class AssetsCallBuilder(BaseCallBuilder, BaseAssetsCallBuilder):
"""Creates a new :class:`AssetsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.assets`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/base_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/base_call_builder.py
index bb0daf5d2..122032412 100644
--- a/stellar_sdk/call_builder/call_builder_sync/base_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/base_call_builder.py
@@ -4,13 +4,11 @@
from ...client.base_sync_client import BaseSyncClient
from ...client.response import Response
from ...exceptions import NotPageableError, raise_request_exception
-from ...type_checked import type_checked
from ...utils import urljoin_with_query
__all__ = ["BaseCallBuilder"]
-@type_checked
class BaseCallBuilder(_BaseCallBuilder):
"""Creates a new :class:`BaseCallBuilder` pointed to server defined by horizon_url.
@@ -76,6 +74,16 @@ def prev(self) -> Dict[str, Any]:
raise NotPageableError("The prev page does not exist.")
return self._call(self.prev_href, None)
+ def __hash__(self):
+ return hash(
+ (
+ self.params,
+ self.endpoint,
+ self.horizon_url,
+ self.client,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/call_builder/call_builder_sync/claimable_balances_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/claimable_balances_call_builder.py
index 78dc45f69..a0559fdc8 100644
--- a/stellar_sdk/call_builder/call_builder_sync/claimable_balances_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/claimable_balances_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseClaimableBalancesCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["ClaimableBalancesCallBuilder"]
-@type_checked
class ClaimableBalancesCallBuilder(BaseCallBuilder, BaseClaimableBalancesCallBuilder):
"""Creates a new :class:`ClaimableBalancesCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.claimable_balance`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/data_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/data_call_builder.py
index 884a4086e..651d7f84c 100644
--- a/stellar_sdk/call_builder/call_builder_sync/data_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/data_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseDataCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["DataCallBuilder"]
-@type_checked
class DataCallBuilder(BaseCallBuilder, BaseDataCallBuilder):
"""Creates a new :class:`DataCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.data`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/effects_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/effects_call_builder.py
index 0a15ec433..8c4f05719 100644
--- a/stellar_sdk/call_builder/call_builder_sync/effects_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/effects_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseEffectsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["EffectsCallBuilder"]
-@type_checked
class EffectsCallBuilder(BaseCallBuilder, BaseEffectsCallBuilder):
"""Creates a new :class:`EffectsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.effects`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/fee_stats_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/fee_stats_call_builder.py
index bb357c9c5..92eeb5c92 100644
--- a/stellar_sdk/call_builder/call_builder_sync/fee_stats_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/fee_stats_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseFeeStatsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["FeeStatsCallBuilder"]
-@type_checked
class FeeStatsCallBuilder(BaseCallBuilder, BaseFeeStatsCallBuilder):
"""Creates a new :class:`FeeStatsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.fee_stats`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/ledgers_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/ledgers_call_builder.py
index 97e5f63df..5ba72f35f 100644
--- a/stellar_sdk/call_builder/call_builder_sync/ledgers_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/ledgers_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseLedgersCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["LedgersCallBuilder"]
-@type_checked
class LedgersCallBuilder(BaseCallBuilder, BaseLedgersCallBuilder):
"""Creates a new :class:`LedgersCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.ledgers`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/liquidity_pools_builder.py b/stellar_sdk/call_builder/call_builder_sync/liquidity_pools_builder.py
index 33f138813..843e89d54 100644
--- a/stellar_sdk/call_builder/call_builder_sync/liquidity_pools_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/liquidity_pools_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseLiquidityPoolsBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["LiquidityPoolsBuilder"]
-@type_checked
class LiquidityPoolsBuilder(BaseCallBuilder, BaseLiquidityPoolsBuilder):
"""Creates a new :class:`LiquidityPoolsBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.liquidity_pools`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/offers_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/offers_call_builder.py
index 4f9efe021..6b8ec7948 100644
--- a/stellar_sdk/call_builder/call_builder_sync/offers_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/offers_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseOffersCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["OffersCallBuilder"]
-@type_checked
class OffersCallBuilder(BaseCallBuilder, BaseOffersCallBuilder):
"""Creates a new :class:`OffersCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.offers`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/operations_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/operations_call_builder.py
index 7592a8c74..70ee2a94b 100644
--- a/stellar_sdk/call_builder/call_builder_sync/operations_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/operations_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseOperationsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["OperationsCallBuilder"]
-@type_checked
class OperationsCallBuilder(BaseCallBuilder, BaseOperationsCallBuilder):
"""Creates a new :class:`OperationsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.operations`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/orderbook_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/orderbook_call_builder.py
index ffe928cff..9dbdc7e5e 100644
--- a/stellar_sdk/call_builder/call_builder_sync/orderbook_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/orderbook_call_builder.py
@@ -2,12 +2,10 @@
from ...call_builder.base import BaseOrderbookCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["OrderbookCallBuilder"]
-@type_checked
class OrderbookCallBuilder(BaseCallBuilder, BaseOrderbookCallBuilder):
"""Creates a new :class:`OrderbookCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.orderbook`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/payments_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/payments_call_builder.py
index 0107c55f2..e44cca240 100644
--- a/stellar_sdk/call_builder/call_builder_sync/payments_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/payments_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BasePaymentsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["PaymentsCallBuilder"]
-@type_checked
class PaymentsCallBuilder(BaseCallBuilder, BasePaymentsCallBuilder):
"""Creates a new :class:`PaymentsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.payments`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/root_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/root_call_builder.py
index 20678c81a..7035b5ef5 100644
--- a/stellar_sdk/call_builder/call_builder_sync/root_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/root_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseRootCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["RootCallBuilder"]
-@type_checked
class RootCallBuilder(BaseCallBuilder, BaseRootCallBuilder):
"""Creates a new :class:`RootCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.root`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/strict_receive_paths_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/strict_receive_paths_call_builder.py
index e0efc568a..e7e29c0be 100644
--- a/stellar_sdk/call_builder/call_builder_sync/strict_receive_paths_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/strict_receive_paths_call_builder.py
@@ -5,12 +5,10 @@
from ...call_builder.base import BaseStrictReceivePathsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["StrictReceivePathsCallBuilder"]
-@type_checked
class StrictReceivePathsCallBuilder(BaseCallBuilder, BaseStrictReceivePathsCallBuilder):
"""Creates a new :class:`StrictReceivePathsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.strict_receive_paths`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/strict_send_paths_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/strict_send_paths_call_builder.py
index 703764d69..0e76642aa 100644
--- a/stellar_sdk/call_builder/call_builder_sync/strict_send_paths_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/strict_send_paths_call_builder.py
@@ -5,12 +5,10 @@
from ...call_builder.base import BaseStrictSendPathsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["StrictSendPathsCallBuilder"]
-@type_checked
class StrictSendPathsCallBuilder(BaseCallBuilder, BaseStrictSendPathsCallBuilder):
"""Creates a new :class:`StrictSendPathsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.strict_send_paths`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/trades_aggregation_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/trades_aggregation_call_builder.py
index 346c51c31..c993b340d 100644
--- a/stellar_sdk/call_builder/call_builder_sync/trades_aggregation_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/trades_aggregation_call_builder.py
@@ -2,12 +2,10 @@
from ...call_builder.base import BaseTradeAggregationsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["TradeAggregationsCallBuilder"]
-@type_checked
class TradeAggregationsCallBuilder(BaseCallBuilder, BaseTradeAggregationsCallBuilder):
"""Creates a new :class:`TradeAggregationsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.trade_aggregations`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/trades_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/trades_call_builder.py
index 8f4bdf0a2..a6401eff0 100644
--- a/stellar_sdk/call_builder/call_builder_sync/trades_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/trades_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseTradesCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["TradesCallBuilder"]
-@type_checked
class TradesCallBuilder(BaseCallBuilder, BaseTradesCallBuilder):
"""Creates a new :class:`TradesCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.trades`.
diff --git a/stellar_sdk/call_builder/call_builder_sync/transactions_call_builder.py b/stellar_sdk/call_builder/call_builder_sync/transactions_call_builder.py
index c598db605..87c5598a6 100644
--- a/stellar_sdk/call_builder/call_builder_sync/transactions_call_builder.py
+++ b/stellar_sdk/call_builder/call_builder_sync/transactions_call_builder.py
@@ -1,12 +1,10 @@
from ...call_builder.base import BaseTransactionsCallBuilder
from ...call_builder.call_builder_sync.base_call_builder import BaseCallBuilder
from ...client.base_sync_client import BaseSyncClient
-from ...type_checked import type_checked
__all__ = ["TransactionsCallBuilder"]
-@type_checked
class TransactionsCallBuilder(BaseCallBuilder, BaseTransactionsCallBuilder):
"""Creates a new :class:`TransactionsCallBuilder` pointed to server defined by horizon_url.
Do not create this object directly, use :func:`stellar_sdk.Server.transactions`.
diff --git a/stellar_sdk/client/aiohttp_client.py b/stellar_sdk/client/aiohttp_client.py
index 6ac694d89..0e71addba 100644
--- a/stellar_sdk/client/aiohttp_client.py
+++ b/stellar_sdk/client/aiohttp_client.py
@@ -3,12 +3,8 @@
import logging
from typing import Any, AsyncGenerator, Dict, Optional
-import aiohttp
-from aiohttp_sse_client.client import EventSource
-
from ..__version__ import __version__
from ..exceptions import ConnectionError, StreamClientError
-from ..type_checked import type_checked
from . import defines
from .base_async_client import BaseAsyncClient
from .response import Response
@@ -59,10 +55,16 @@ async def __readline(self) -> bytes:
return b"".join(line)
-aiohttp.streams.StreamReader.readline = __readline # type: ignore[assignment]
+try:
+ import aiohttp
+ from aiohttp_sse_client.client import EventSource
+
+ aiohttp.streams.StreamReader.readline = __readline # type: ignore[assignment]
+ _AIOHTTP_DEPS_INSTALLED = True
+except ImportError:
+ _AIOHTTP_DEPS_INSTALLED = False
-@type_checked
class AiohttpClient(BaseAsyncClient):
"""The :class:`AiohttpClient` object is a asynchronous http client,
which represents the interface for making requests to a server instance.
@@ -85,6 +87,11 @@ def __init__(
custom_headers: Optional[Dict[str, str]] = None,
**kwargs,
) -> None:
+ if not _AIOHTTP_DEPS_INSTALLED:
+ raise ImportError(
+ "The required dependencies have not been installed. "
+ "Please install `stellar-sdk[aiohttp]` to use this feature."
+ )
self.pool_size = pool_size
self.backoff_factor: Optional[float] = backoff_factor
self.request_timeout: float = request_timeout
@@ -101,7 +108,6 @@ def __init__(
self.headers: dict = {
**IDENTIFICATION_HEADERS,
- "Content-Type": "application/x-www-form-urlencoded",
"User-Agent": self.user_agent,
}
@@ -137,17 +143,23 @@ async def get(self, url: str, params: Dict[str, str] = None) -> Response:
except aiohttp.ClientError as e: # TODO: need more research
raise ConnectionError(e)
- async def post(self, url: str, data: Dict[str, str] = None) -> Response:
+ async def post(
+ self, url: str, data: Dict[str, str] = None, json_data: Dict[str, Any] = None
+ ) -> Response:
"""Perform HTTP POST request.
:param url: the request url
:param data: the data send to server
+ :param json_data: the json data send to server
:return: the response from server
:raise: :exc:`ConnectionError `
"""
try:
response = await self._session.post(
- url, data=data, timeout=aiohttp.ClientTimeout(total=self.post_timeout)
+ url,
+ data=data,
+ json=json_data,
+ timeout=aiohttp.ClientTimeout(total=self.post_timeout),
)
return Response(
status_code=response.status,
diff --git a/stellar_sdk/client/base_async_client.py b/stellar_sdk/client/base_async_client.py
index 76da05a1e..226b07dca 100644
--- a/stellar_sdk/client/base_async_client.py
+++ b/stellar_sdk/client/base_async_client.py
@@ -24,11 +24,17 @@ async def get(self, url: str, params: Dict[str, str] = None) -> Response:
pass # pragma: no cover
@abstractmethod
- async def post(self, url: str, data: Dict[str, str]) -> Response:
+ async def post(
+ self,
+ url: str,
+ data: Dict[str, str] = None,
+ json_data: Dict[str, Any] = None,
+ ) -> Response:
"""Perform HTTP POST request.
:param url: the request url
:param data: the data send to server
+ :param json_data: the json data send to server
:return: the response from server
:raise: :exc:`ConnectionError `
"""
diff --git a/stellar_sdk/client/base_sync_client.py b/stellar_sdk/client/base_sync_client.py
index 51558f43f..dc979a436 100644
--- a/stellar_sdk/client/base_sync_client.py
+++ b/stellar_sdk/client/base_sync_client.py
@@ -21,18 +21,22 @@ def get(self, url: str, params: Dict[str, str] = None) -> Response:
:return: the response from server
:raise: :exc:`ConnectionError `
"""
- pass
@abstractmethod
- def post(self, url: str, data: Dict[str, str]) -> Response:
+ def post(
+ self,
+ url: str,
+ data: Dict[str, str] = None,
+ json_data: Dict[str, Any] = None,
+ ) -> Response:
"""Perform HTTP POST request.
:param url: the request url
:param data: the data send to server
+ :param json_data: the json data send to server
:return: the response from server
:raise: :exc:`ConnectionError `
"""
- pass
@abstractmethod
def stream(
@@ -49,7 +53,6 @@ def stream(
:return: a dict Generator for server response
:raise: :exc:`ConnectionError `
"""
- pass
@abstractmethod
def close(self):
diff --git a/stellar_sdk/client/requests_client.py b/stellar_sdk/client/requests_client.py
index 3be53ed04..13ed33eae 100644
--- a/stellar_sdk/client/requests_client.py
+++ b/stellar_sdk/client/requests_client.py
@@ -12,7 +12,6 @@
from ..client.base_sync_client import BaseSyncClient
from ..client.response import Response
from ..exceptions import ConnectionError
-from ..type_checked import type_checked
from . import defines
DEFAULT_NUM_RETRIES = 3
@@ -26,7 +25,6 @@
__all__ = ["RequestsClient"]
-@type_checked
class RequestsClient(BaseSyncClient):
"""The :class:`RequestsClient` object is a synchronous http client,
which represents the interface for making requests to a server instance.
@@ -134,16 +132,21 @@ def get(self, url: str, params: Dict[str, str] = None) -> Response:
url=resp.url,
)
- def post(self, url: str, data: Dict[str, str] = None) -> Response:
+ def post(
+ self, url: str, data: Dict[str, str] = None, json_data: Dict[str, Any] = None
+ ) -> Response:
"""Perform HTTP POST request.
:param url: the request url
:param data: the data send to server
+ :param json_data: the json data send to server
:return: the response from server
:raise: :exc:`ConnectionError `
"""
try:
- resp = self._session.post(url, data=data, timeout=self.post_timeout)
+ resp = self._session.post(
+ url, data=data, json=json_data, timeout=self.post_timeout
+ )
except (RequestException, NewConnectionError) as err:
raise ConnectionError(err)
return Response(
diff --git a/stellar_sdk/client/response.py b/stellar_sdk/client/response.py
index 25c4ac13b..f36ea1957 100644
--- a/stellar_sdk/client/response.py
+++ b/stellar_sdk/client/response.py
@@ -1,11 +1,8 @@
import json
-from ..type_checked import type_checked
-
__all__ = ["Response"]
-@type_checked
class Response:
"""The :class:`Response ` object, which contains a
server's response to an HTTP request.
@@ -29,6 +26,11 @@ def json(self) -> dict:
"""
return json.loads(self.text)
+ def __hash__(self):
+ return hash(
+ (self.status_code, self.text, tuple(self.headers.items()), self.url)
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/client/simple_requests_client.py b/stellar_sdk/client/simple_requests_client.py
index 768906984..fedca7ada 100644
--- a/stellar_sdk/client/simple_requests_client.py
+++ b/stellar_sdk/client/simple_requests_client.py
@@ -6,7 +6,6 @@
from ..__version__ import __version__
from ..client.response import Response
-from ..type_checked import type_checked
from .base_sync_client import BaseSyncClient
USER_AGENT = f"py-stellar-base/{__version__}/SimpleRequestsClient"
@@ -19,7 +18,6 @@
__all__ = ["SimpleRequestsClient"]
-@type_checked
class SimpleRequestsClient(BaseSyncClient):
"""The :class:`SimpleRequestsClient` object is a synchronous http client,
which represents the interface for making requests to a server instance.
@@ -47,16 +45,19 @@ def get(self, url: str, params: Dict[str, str] = None) -> Response:
url=resp.url,
)
- def post(self, url: str, data: Dict[str, str]) -> Response:
+ def post(
+ self, url: str, data: Dict[str, str] = None, json_data: Dict[str, Any] = None
+ ) -> Response:
"""Perform HTTP POST request.
:param url: the request url
:param data: the data send to server
+ :param json_data: the json data send to server
:return: the response from server
:raise: :exc:`ConnectionError `
"""
try:
- resp = requests.post(url=url, data=data, headers=HEADERS)
+ resp = requests.post(url=url, data=data, json=json_data, headers=HEADERS)
except (RequestException, NewConnectionError) as err:
raise ConnectionError(err)
return Response(
diff --git a/stellar_sdk/decorated_signature.py b/stellar_sdk/decorated_signature.py
index 98991e0f7..8a6544899 100644
--- a/stellar_sdk/decorated_signature.py
+++ b/stellar_sdk/decorated_signature.py
@@ -1,10 +1,8 @@
from . import xdr as stellar_xdr
-from .type_checked import type_checked
__all__ = ["DecoratedSignature"]
-@type_checked
class DecoratedSignature:
def __init__(
self,
@@ -41,6 +39,9 @@ def from_xdr_object(
signature = xdr_object.signature.signature
return cls(signature_hint, signature)
+ def __hash__(self):
+ return hash((self.signature_hint, self.signature))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/exceptions.py b/stellar_sdk/exceptions.py
index 2e6e5a392..786586393 100644
--- a/stellar_sdk/exceptions.py
+++ b/stellar_sdk/exceptions.py
@@ -2,13 +2,9 @@
from typing import Optional
from .client.response import Response
-from .type_checked import type_checked
__all__ = [
"SdkError",
- "ValueError",
- "TypeError",
- "AttributeError",
"BadSignatureError",
"Ed25519PublicKeyInvalidError",
"Ed25519SecretSeedInvalidError",
@@ -29,13 +25,12 @@
"NotPageableError",
"StreamClientError",
"FeatureNotEnabledError",
+ "SorobanRpcErrorResponse",
+ "AccountNotFoundException",
+ "PrepareTransactionException",
]
-
-# The following is kept for compatibility
-ValueError = ValueError
-TypeError = TypeError
-AttributeError = AttributeError
+from .soroban_rpc import SimulateTransactionResponse
class SdkError(Exception):
@@ -172,7 +167,37 @@ class FeatureNotEnabledError(SdkError):
"""The feature is not enabled."""
-@type_checked
+class SorobanRpcErrorResponse(BaseRequestError):
+ """The exception is thrown when the RPC server returns an error response."""
+
+ def __init__(
+ self, code: int, message: Optional[str], data: Optional[str] = None
+ ) -> None:
+ super().__init__(message)
+ self.code = code
+ self.data = data
+ self.message = message
+
+
+class AccountNotFoundException(SdkError):
+ """The exception is thrown when trying to load an account that doesn't exist on the Stellar network."""
+
+ def __init__(self, account_id: str) -> None:
+ super().__init__(f"Account not found, account_id: {account_id}")
+ self.account_id = account_id
+
+
+class PrepareTransactionException(SdkError):
+ """The exception is thrown when trying to prepare a transaction."""
+
+ def __init__(
+ self, message: str, simulate_transaction_response: SimulateTransactionResponse
+ ) -> None:
+ super().__init__(message)
+ self.message = message
+ self.simulate_transaction_response = simulate_transaction_response
+
+
def raise_request_exception(response: Response) -> None:
status_code = response.status_code
if status_code == 200:
diff --git a/stellar_sdk/fee_bump_transaction.py b/stellar_sdk/fee_bump_transaction.py
index eb55b77de..09290b766 100644
--- a/stellar_sdk/fee_bump_transaction.py
+++ b/stellar_sdk/fee_bump_transaction.py
@@ -1,19 +1,16 @@
from typing import Union
from . import xdr as stellar_xdr
-from .exceptions import ValueError
from .keypair import Keypair
from .muxed_account import MuxedAccount
from .transaction import Transaction
from .transaction_envelope import TransactionEnvelope
-from .type_checked import type_checked
BASE_FEE = 100
__all__ = ["FeeBumpTransaction"]
-@type_checked
class FeeBumpTransaction:
"""The :class:`FeeBumpTransaction` object, which represents a fee bump transaction
on Stellar's network.
@@ -116,10 +113,23 @@ def from_xdr(cls, xdr: str, network_passphrase: str) -> "FeeBumpTransaction":
xdr_object = stellar_xdr.FeeBumpTransaction.from_xdr(xdr)
return cls.from_xdr_object(xdr_object, network_passphrase)
+ def __hash__(self):
+ return hash(
+ (
+ self.fee_source,
+ self.base_fee,
+ self.inner_transaction_envelope,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
- return self.to_xdr_object() == other.to_xdr_object()
+ return (
+ self.fee_source == other.fee_source
+ and self.base_fee == other.base_fee
+ and self.inner_transaction_envelope == other.inner_transaction_envelope
+ )
def __str__(self):
return (
diff --git a/stellar_sdk/fee_bump_transaction_envelope.py b/stellar_sdk/fee_bump_transaction_envelope.py
index cfadb2117..3a1587cb0 100644
--- a/stellar_sdk/fee_bump_transaction_envelope.py
+++ b/stellar_sdk/fee_bump_transaction_envelope.py
@@ -1,16 +1,15 @@
-from typing import List, Union
+from typing import Sequence, Union
+
from xdrlib3 import Packer
from . import xdr as stellar_xdr
from .base_transaction_envelope import BaseTransactionEnvelope
from .decorated_signature import DecoratedSignature
from .fee_bump_transaction import FeeBumpTransaction
-from .type_checked import type_checked
__all__ = ["FeeBumpTransactionEnvelope"]
-@type_checked
class FeeBumpTransactionEnvelope(BaseTransactionEnvelope["FeeBumpTransactionEnvelope"]):
"""The :class:`FeeBumpTransactionEnvelope` object, which represents a fee bump transaction
envelope ready to sign and submit to send over the network.
@@ -34,7 +33,7 @@ def __init__(
self,
transaction: FeeBumpTransaction,
network_passphrase: str,
- signatures: List[DecoratedSignature] = None,
+ signatures: Sequence[DecoratedSignature] = None,
) -> None:
super().__init__(network_passphrase, signatures)
self.transaction: FeeBumpTransaction = transaction
@@ -114,6 +113,9 @@ def from_xdr_object(
te = cls(tx, network_passphrase=network_passphrase, signatures=signatures)
return te
+ def __hash__(self):
+ return hash((self.transaction, self.network_passphrase, self.signatures))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/helpers.py b/stellar_sdk/helpers.py
index deec0c060..1d465bb1a 100644
--- a/stellar_sdk/helpers.py
+++ b/stellar_sdk/helpers.py
@@ -2,12 +2,10 @@
from .fee_bump_transaction_envelope import FeeBumpTransactionEnvelope
from .transaction_envelope import TransactionEnvelope
-from .type_checked import type_checked
__all__ = ["parse_transaction_envelope_from_xdr"]
-@type_checked
def parse_transaction_envelope_from_xdr(
xdr: str, network_passphrase: str
) -> Union[TransactionEnvelope, FeeBumpTransactionEnvelope]:
diff --git a/stellar_sdk/keypair.py b/stellar_sdk/keypair.py
index 0ed649e4d..5f21b86a2 100644
--- a/stellar_sdk/keypair.py
+++ b/stellar_sdk/keypair.py
@@ -6,15 +6,13 @@
from . import xdr as stellar_xdr
from .decorated_signature import DecoratedSignature
-from .exceptions import AttributeError, BadSignatureError, MissingEd25519SecretSeedError
+from .exceptions import BadSignatureError, MissingEd25519SecretSeedError
from .sep.mnemonic import Language, StellarMnemonic
from .strkey import StrKey
-from .type_checked import type_checked
__all__ = ["Keypair"]
-@type_checked
class Keypair:
"""The :class:`Keypair` object, which represents a signing and
verifying key for use with the Stellar network.
@@ -287,6 +285,9 @@ def sign_payload_decorated(self, data: bytes) -> DecoratedSignature:
hint = bytes(map(lambda x, y: x ^ y, key_hint, payload_hint))
return DecoratedSignature(hint, signature)
+ def __hash__(self):
+ return hash((self.verify_key, self.signing_key))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/ledger_bounds.py b/stellar_sdk/ledger_bounds.py
index 3ca468b19..9cc609b56 100644
--- a/stellar_sdk/ledger_bounds.py
+++ b/stellar_sdk/ledger_bounds.py
@@ -1,11 +1,8 @@
from . import xdr as stellar_xdr
-from .exceptions import ValueError
-from .type_checked import type_checked
__all__ = ["LedgerBounds"]
-@type_checked
class LedgerBounds:
"""LedgerBounds represents the ledger interval that a transaction is valid.
@@ -50,6 +47,9 @@ def from_xdr_object(cls, xdr_object: stellar_xdr.LedgerBounds) -> "LedgerBounds"
max_ledger=xdr_object.max_ledger.uint32,
)
+ def __hash__(self):
+ return hash((self.min_ledger, self.max_ledger))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/liquidity_pool_asset.py b/stellar_sdk/liquidity_pool_asset.py
index eb3c44f08..345b451b8 100644
--- a/stellar_sdk/liquidity_pool_asset.py
+++ b/stellar_sdk/liquidity_pool_asset.py
@@ -1,7 +1,5 @@
from . import xdr as stellar_xdr
from .asset import Asset
-from .exceptions import ValueError
-from .type_checked import type_checked
from .utils import sha256
__all__ = ["LiquidityPoolAsset", "LIQUIDITY_POOL_FEE_V18"]
@@ -11,7 +9,6 @@
LIQUIDITY_POOL_FEE_V18 = stellar_xdr.LIQUIDITY_POOL_FEE_V18
-@type_checked
class LiquidityPoolAsset:
"""The :class:`LiquidityPoolAsset` object, which represents a liquidity pool trustline change.
@@ -28,7 +25,6 @@ class LiquidityPoolAsset:
def __init__(
self, asset_a: Asset, asset_b: Asset, fee: int = LIQUIDITY_POOL_FEE_V18
) -> None:
-
if not self.is_valid_lexicographic_order(asset_a, asset_b):
raise ValueError("`Assets are not in lexicographic order.")
@@ -140,6 +136,9 @@ def _liquidity_pool_parameters(self) -> stellar_xdr.LiquidityPoolParameters:
liquidity_pool_constant_product_parameters,
)
+ def __hash__(self):
+ return hash((self.asset_a, self.asset_b, self.fee, self.type))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/liquidity_pool_id.py b/stellar_sdk/liquidity_pool_id.py
index 5e0b35e06..caeb186af 100644
--- a/stellar_sdk/liquidity_pool_id.py
+++ b/stellar_sdk/liquidity_pool_id.py
@@ -1,14 +1,11 @@
import binascii
from . import xdr as stellar_xdr
-from .exceptions import ValueError
-from .type_checked import type_checked
from .utils import raise_if_not_valid_hash
__all__ = ["LiquidityPoolId"]
-@type_checked
class LiquidityPoolId:
"""The :class:`LiquidityPoolId` object, which represents the asset referenced by a trustline to a liquidity pool.
@@ -48,6 +45,9 @@ def from_xdr_object(
liquidity_pool_id = xdr_object.liquidity_pool_id.pool_id.hash.hex()
return cls(liquidity_pool_id)
+ def __hash__(self):
+ return hash((self.liquidity_pool_id, self.type))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/memo.py b/stellar_sdk/memo.py
index 2a30cb49e..b9de674d6 100644
--- a/stellar_sdk/memo.py
+++ b/stellar_sdk/memo.py
@@ -3,13 +3,11 @@
from . import xdr as stellar_xdr
from .exceptions import MemoInvalidException
-from .type_checked import type_checked
from .utils import hex_to_bytes
__all__ = ["Memo", "NoneMemo", "TextMemo", "IdMemo", "HashMemo", "ReturnHashMemo"]
-@type_checked
class Memo(object, metaclass=abc.ABCMeta):
"""The :class:`Memo` object, which represents the base class for memos for
use with Stellar transactions.
@@ -53,12 +51,15 @@ def from_xdr_object(xdr_object: stellar_xdr.Memo) -> "Memo":
memo_cls = xdr_types.get(xdr_object.type, NoneMemo)
return memo_cls.from_xdr_object(xdr_object) # type: ignore[attr-defined]
+ @abc.abstractmethod
+ def __hash__(self):
+ pass # pragma: no cover
+
@abc.abstractmethod
def __eq__(self, other: object) -> bool:
pass # pragma: no cover
-@type_checked
class NoneMemo(Memo):
"""The :class:`NoneMemo`, which represents no memo for a transaction."""
@@ -72,6 +73,9 @@ def to_xdr_object(self) -> stellar_xdr.Memo:
"""Creates an XDR Memo object that represents this :class:`NoneMemo`."""
return stellar_xdr.Memo(type=stellar_xdr.MemoType.MEMO_NONE)
+ def __hash__(self):
+ return hash(None)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -81,7 +85,6 @@ def __str__(self):
return ""
-@type_checked
class TextMemo(Memo):
"""The :class:`TextMemo`, which represents ``MEMO_TEXT`` in a transaction.
@@ -116,6 +119,9 @@ def to_xdr_object(self) -> stellar_xdr.Memo:
type=stellar_xdr.MemoType.MEMO_TEXT, text=self.memo_text
)
+ def __hash__(self):
+ return hash(self.memo_text)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -125,7 +131,6 @@ def __str__(self):
return f""
-@type_checked
class IdMemo(Memo):
"""The :class:`IdMemo` which represents ``MEMO_ID`` in a transaction.
@@ -155,6 +160,9 @@ def to_xdr_object(self) -> stellar_xdr.Memo:
type=stellar_xdr.MemoType.MEMO_ID, id=stellar_xdr.Uint64(self.memo_id)
)
+ def __hash__(self):
+ return hash(self.memo_id)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -164,7 +172,6 @@ def __str__(self):
return f""
-@type_checked
class HashMemo(Memo):
"""The :class:`HashMemo` which represents ``MEMO_HASH`` in a transaction.
@@ -195,6 +202,9 @@ def to_xdr_object(self) -> stellar_xdr.Memo:
type=stellar_xdr.MemoType.MEMO_HASH, hash=stellar_xdr.Hash(self.memo_hash)
)
+ def __hash__(self):
+ return hash(self.memo_hash)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -204,7 +214,6 @@ def __str__(self):
return f""
-@type_checked
class ReturnHashMemo(Memo):
"""The :class:`ReturnHashMemo` which represents ``MEMO_RETURN`` in a transaction.
@@ -241,6 +250,9 @@ def to_xdr_object(self) -> stellar_xdr.Memo:
ret_hash=stellar_xdr.Hash(self.memo_return),
)
+ def __hash__(self):
+ return hash(self.memo_return)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/muxed_account.py b/stellar_sdk/muxed_account.py
index 4e92ab822..7ca3bfd5b 100644
--- a/stellar_sdk/muxed_account.py
+++ b/stellar_sdk/muxed_account.py
@@ -1,15 +1,12 @@
from typing import Optional
from . import xdr as stellar_xdr
-from .exceptions import ValueError
from .keypair import Keypair
from .strkey import StrKey
-from .type_checked import type_checked
__all__ = ["MuxedAccount"]
-@type_checked
class MuxedAccount:
"""The :class:`MuxedAccount` object, which represents a multiplexed account on Stellar's network.
@@ -135,6 +132,9 @@ def from_xdr_object(cls, xdr_object: stellar_xdr.MuxedAccount) -> "MuxedAccount"
)
return cls(account_id=account_id, account_muxed_id=account_id_id)
+ def __hash__(self):
+ return hash((self.account_id, self.account_muxed_id))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/network.py b/stellar_sdk/network.py
index 3c056c4a4..60e7af91f 100644
--- a/stellar_sdk/network.py
+++ b/stellar_sdk/network.py
@@ -1,10 +1,8 @@
-from .type_checked import type_checked
from .utils import sha256
__all__ = ["Network"]
-@type_checked
class Network:
"""The :class:`Network` object, which represents a Stellar network.
@@ -21,6 +19,15 @@ class Network:
TESTNET_NETWORK_PASSPHRASE: str = "Test SDF Network ; September 2015"
"""The Test network passphrase."""
+ FUTURENET_NETWORK_PASSPHRASE: str = "Test SDF Future Network ; October 2022"
+ """The Future network passphrase."""
+
+ STANDALONE_NETWORK_PASSPHRASE: str = "Standalone Network ; February 2017"
+ """The Standalone network passphrase."""
+
+ SANDBOX_NETWORK_PASSPHRASE = "Local Sandbox Stellar Network ; September 2022"
+ """The Sandbox network passphrase."""
+
def __init__(self, network_passphrase: str) -> None:
self.network_passphrase: str = network_passphrase
@@ -48,6 +55,9 @@ def testnet_network(cls) -> "Network":
"""
return cls(cls.TESTNET_NETWORK_PASSPHRASE)
+ def __hash__(self):
+ return hash(self.network_passphrase)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/operation/__init__.py b/stellar_sdk/operation/__init__.py
index f3b993972..e613e95c4 100644
--- a/stellar_sdk/operation/__init__.py
+++ b/stellar_sdk/operation/__init__.py
@@ -1,6 +1,7 @@
from .account_merge import *
from .allow_trust import *
from .begin_sponsoring_future_reserves import *
+from .bump_footprint_expiration import *
from .bump_sequence import *
from .change_trust import *
from .claim_claimable_balance import *
@@ -11,6 +12,7 @@
from .create_passive_sell_offer import *
from .end_sponsoring_future_reserves import *
from .inflation import *
+from .invoke_host_function import *
from .liquidity_pool_deposit import *
from .liquidity_pool_withdraw import *
from .manage_buy_offer import *
@@ -20,6 +22,7 @@
from .path_payment_strict_receive import *
from .path_payment_strict_send import *
from .payment import *
+from .restore_footprint import *
from .revoke_sponsorship import *
from .set_options import *
from .set_trust_line_flags import *
diff --git a/stellar_sdk/operation/account_merge.py b/stellar_sdk/operation/account_merge.py
index 0cf8d172f..2f019285b 100644
--- a/stellar_sdk/operation/account_merge.py
+++ b/stellar_sdk/operation/account_merge.py
@@ -2,13 +2,11 @@
from .. import xdr as stellar_xdr
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from .operation import Operation
__all__ = ["AccountMerge"]
-@type_checked
class AccountMerge(Operation):
"""The :class:`AccountMerge` object, which represents a
AccountMerge operation on Stellar's network.
diff --git a/stellar_sdk/operation/allow_trust.py b/stellar_sdk/operation/allow_trust.py
index 6c3ab44af..2a84cf3a7 100644
--- a/stellar_sdk/operation/allow_trust.py
+++ b/stellar_sdk/operation/allow_trust.py
@@ -7,7 +7,6 @@
from ..keypair import Keypair
from ..muxed_account import MuxedAccount
from ..strkey import StrKey
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_ed25519_public_key
from .operation import Operation
@@ -30,7 +29,6 @@ class TrustLineEntryFlag(IntFlag):
AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG = 2
-@type_checked
class AllowTrust(Operation):
"""The :class:`AllowTrust` object, which represents a AllowTrust operation
on Stellar's network.
diff --git a/stellar_sdk/operation/begin_sponsoring_future_reserves.py b/stellar_sdk/operation/begin_sponsoring_future_reserves.py
index 5d0ddbbc9..3cabd3635 100644
--- a/stellar_sdk/operation/begin_sponsoring_future_reserves.py
+++ b/stellar_sdk/operation/begin_sponsoring_future_reserves.py
@@ -4,14 +4,12 @@
from ..keypair import Keypair
from ..muxed_account import MuxedAccount
from ..strkey import StrKey
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_ed25519_public_key
from .operation import Operation
__all__ = ["BeginSponsoringFutureReserves"]
-@type_checked
class BeginSponsoringFutureReserves(Operation):
"""The :class:`BeginSponsoringFutureReserves` object, which represents a BeginSponsoringFutureReserves
operation on Stellar's network.
diff --git a/stellar_sdk/operation/bump_footprint_expiration.py b/stellar_sdk/operation/bump_footprint_expiration.py
new file mode 100644
index 000000000..c12d45908
--- /dev/null
+++ b/stellar_sdk/operation/bump_footprint_expiration.py
@@ -0,0 +1,62 @@
+from typing import Optional, Union
+
+from .. import xdr as stellar_xdr
+from ..muxed_account import MuxedAccount
+from .operation import Operation
+
+__all__ = ["BumpFootprintExpiration"]
+
+
+class BumpFootprintExpiration(Operation):
+ """The :class:`BumpFootprintExpiration` object, which represents a BumpFootprintExpiration
+ operation on Stellar's network.
+
+ Threshold: Medium
+
+ See `BumpFootprintExpirationOp `_.
+
+ :param ledgers_to_expire: The number of ledgers past the LCL (last closed ledger)
+ by which to extend the validity of the ledger keys in this transaction.
+ :param source: The source account for the operation. Defaults to the transaction's source account.
+ """
+
+ _XDR_OPERATION_TYPE: stellar_xdr.OperationType = (
+ stellar_xdr.OperationType.BUMP_FOOTPRINT_EXPIRATION
+ )
+
+ def __init__(
+ self, ledgers_to_expire: int, source: Optional[Union[MuxedAccount, str]] = None
+ ) -> None:
+ super().__init__(source)
+ if ledgers_to_expire < 0 or ledgers_to_expire > 2**32 - 1:
+ raise ValueError(
+ f"`ledgers_to_expire` value must be between 0 and 2**32-1, got {ledgers_to_expire}"
+ )
+
+ self.ledgers_to_expire: int = ledgers_to_expire
+
+ def _to_operation_body(self) -> stellar_xdr.OperationBody:
+ op = stellar_xdr.BumpFootprintExpirationOp(
+ ext=stellar_xdr.ExtensionPoint(0),
+ ledgers_to_expire=stellar_xdr.Uint32(self.ledgers_to_expire),
+ )
+ body = stellar_xdr.OperationBody(
+ type=self._XDR_OPERATION_TYPE, bump_footprint_expiration_op=op
+ )
+ return body
+
+ @classmethod
+ def from_xdr_object(
+ cls, xdr_object: stellar_xdr.Operation
+ ) -> "BumpFootprintExpiration":
+ """Creates a :class:`BumpFootprintExpiration` object from an XDR Operation object."""
+ source = Operation.get_source_from_xdr_obj(xdr_object)
+ assert xdr_object.body.bump_footprint_expiration_op is not None
+ ledgers_to_expire = (
+ xdr_object.body.bump_footprint_expiration_op.ledgers_to_expire.uint32
+ )
+ op = cls(source=source, ledgers_to_expire=ledgers_to_expire)
+ return op
+
+ def __str__(self):
+ return f""
diff --git a/stellar_sdk/operation/bump_sequence.py b/stellar_sdk/operation/bump_sequence.py
index 51e02b418..0f857351e 100644
--- a/stellar_sdk/operation/bump_sequence.py
+++ b/stellar_sdk/operation/bump_sequence.py
@@ -2,13 +2,11 @@
from .. import xdr as stellar_xdr
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from .operation import Operation
__all__ = ["BumpSequence"]
-@type_checked
class BumpSequence(Operation):
"""The :class:`BumpSequence` object, which represents a
BumpSequence operation on Stellar's network.
diff --git a/stellar_sdk/operation/change_trust.py b/stellar_sdk/operation/change_trust.py
index 88c5d67ae..cd50e494c 100644
--- a/stellar_sdk/operation/change_trust.py
+++ b/stellar_sdk/operation/change_trust.py
@@ -5,14 +5,12 @@
from ..asset import Asset
from ..liquidity_pool_asset import LiquidityPoolAsset
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount
from .operation import Operation
__all__ = ["ChangeTrust"]
-@type_checked
class ChangeTrust(Operation):
"""The :class:`ChangeTrust` object, which represents a ChangeTrust
operation on Stellar's network.
diff --git a/stellar_sdk/operation/claim_claimable_balance.py b/stellar_sdk/operation/claim_claimable_balance.py
index 21e4a7543..772bddf96 100644
--- a/stellar_sdk/operation/claim_claimable_balance.py
+++ b/stellar_sdk/operation/claim_claimable_balance.py
@@ -4,14 +4,12 @@
from .. import xdr as stellar_xdr
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_balance_id
from .operation import Operation
__all__ = ["ClaimClaimableBalance"]
-@type_checked
class ClaimClaimableBalance(Operation):
"""The :class:`ClaimClaimableBalance` object, which represents a ClaimClaimableBalance
operation on Stellar's network.
diff --git a/stellar_sdk/operation/clawback.py b/stellar_sdk/operation/clawback.py
index 5abd51d37..a678e5fd3 100644
--- a/stellar_sdk/operation/clawback.py
+++ b/stellar_sdk/operation/clawback.py
@@ -4,14 +4,12 @@
from .. import xdr as stellar_xdr
from ..asset import Asset
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount
from .operation import Operation
__all__ = ["Clawback"]
-@type_checked
class Clawback(Operation):
"""The :class:`Clawback` object, which represents a Clawback operation on
Stellar's network.
diff --git a/stellar_sdk/operation/clawback_claimable_balance.py b/stellar_sdk/operation/clawback_claimable_balance.py
index 56d409a02..0aca9d290 100644
--- a/stellar_sdk/operation/clawback_claimable_balance.py
+++ b/stellar_sdk/operation/clawback_claimable_balance.py
@@ -4,14 +4,12 @@
from .. import xdr as stellar_xdr
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_balance_id
from .operation import Operation
__all__ = ["ClawbackClaimableBalance"]
-@type_checked
class ClawbackClaimableBalance(Operation):
"""The :class:`ClawbackClaimableBalance` object, which represents a ClawbackClaimableBalance operation on
Stellar's network.
diff --git a/stellar_sdk/operation/create_account.py b/stellar_sdk/operation/create_account.py
index a126ade0d..2c459f9dd 100644
--- a/stellar_sdk/operation/create_account.py
+++ b/stellar_sdk/operation/create_account.py
@@ -5,14 +5,12 @@
from ..keypair import Keypair
from ..muxed_account import MuxedAccount
from ..strkey import StrKey
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount, raise_if_not_valid_ed25519_public_key
from .operation import Operation
__all__ = ["CreateAccount"]
-@type_checked
class CreateAccount(Operation):
"""The :class:`CreateAccount` object, which represents a Create Account
operation on Stellar's network.
diff --git a/stellar_sdk/operation/create_claimable_balance.py b/stellar_sdk/operation/create_claimable_balance.py
index 820d19682..4518b4139 100644
--- a/stellar_sdk/operation/create_claimable_balance.py
+++ b/stellar_sdk/operation/create_claimable_balance.py
@@ -1,14 +1,12 @@
from decimal import Decimal
from enum import IntEnum
-from typing import List, Optional, Union
+from typing import Optional, Sequence, Union
from .. import xdr as stellar_xdr
from ..asset import Asset
-from ..exceptions import ValueError
from ..keypair import Keypair
from ..muxed_account import MuxedAccount
from ..strkey import StrKey
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount, raise_if_not_valid_ed25519_public_key
from .operation import Operation
@@ -26,7 +24,6 @@ class ClaimPredicateType(IntEnum):
CLAIM_PREDICATE_BEFORE_RELATIVE_TIME = 5
-@type_checked
class ClaimPredicateGroup:
"""Used to assemble the left and right values for and_predicates and or_predicates.
@@ -38,6 +35,9 @@ def __init__(self, left: "ClaimPredicate", right: "ClaimPredicate") -> None:
self.left = left
self.right = right
+ def __hash__(self):
+ return hash((self.left, self.right))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -47,7 +47,6 @@ def __str__(self):
return f""
-@type_checked
class ClaimPredicate:
"""The :class:`ClaimPredicate` object, which represents a ClaimPredicate on Stellar's network.
@@ -288,6 +287,18 @@ def from_xdr_object(
f"{claim_predicate_type} is an unsupported ClaimPredicateType."
)
+ def __hash__(self):
+ return hash(
+ (
+ self.claim_predicate_type,
+ self.and_predicates,
+ self.or_predicates,
+ self.not_predicate,
+ self.abs_before,
+ self.rel_before,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -311,7 +322,6 @@ def __str__(self):
)
-@type_checked
class Claimant:
"""The :class:`Claimant` object represents a claimable balance claimant.
@@ -347,6 +357,9 @@ def from_xdr_object(cls, xdr_object: stellar_xdr.Claimant) -> "Claimant":
predicate = ClaimPredicate.from_xdr_object(xdr_object.v0.predicate)
return cls(destination=destination, predicate=predicate)
+ def __hash__(self):
+ return hash((self.destination, self.predicate))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -360,7 +373,6 @@ def __str__(self):
)
-@type_checked
class CreateClaimableBalance(Operation):
"""The :class:`CreateClaimableBalance` object, which represents a CreateClaimableBalance
operation on Stellar's network.
@@ -387,13 +399,13 @@ def __init__(
self,
asset: Asset,
amount: Union[str, Decimal],
- claimants: List[Claimant],
+ claimants: Sequence[Claimant],
source: Optional[Union[MuxedAccount, str]] = None,
) -> None:
super().__init__(source)
self.asset: Asset = asset
self.amount: str = str(amount)
- self.claimants: List[Claimant] = claimants
+ self.claimants: Sequence[Claimant] = claimants
raise_if_not_valid_amount(self.amount, "amount")
def _to_operation_body(self) -> stellar_xdr.OperationBody:
diff --git a/stellar_sdk/operation/create_passive_sell_offer.py b/stellar_sdk/operation/create_passive_sell_offer.py
index b8f672d9b..16824fd96 100644
--- a/stellar_sdk/operation/create_passive_sell_offer.py
+++ b/stellar_sdk/operation/create_passive_sell_offer.py
@@ -5,14 +5,12 @@
from ..asset import Asset
from ..muxed_account import MuxedAccount
from ..price import Price
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount
from .operation import Operation
__all__ = ["CreatePassiveSellOffer"]
-@type_checked
class CreatePassiveSellOffer(Operation):
"""The :class:`CreatePassiveSellOffer` object, which represents a
CreatePassiveSellOffer operation on Stellar's network.
diff --git a/stellar_sdk/operation/end_sponsoring_future_reserves.py b/stellar_sdk/operation/end_sponsoring_future_reserves.py
index 48b76e104..852fc58e0 100644
--- a/stellar_sdk/operation/end_sponsoring_future_reserves.py
+++ b/stellar_sdk/operation/end_sponsoring_future_reserves.py
@@ -2,13 +2,11 @@
from .. import xdr as stellar_xdr
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from .operation import Operation
__all__ = ["EndSponsoringFutureReserves"]
-@type_checked
class EndSponsoringFutureReserves(Operation):
"""The :class:`EndSponsoringFutureReserves` object, which represents a EndSponsoringFutureReserves
operation on Stellar's network.
diff --git a/stellar_sdk/operation/inflation.py b/stellar_sdk/operation/inflation.py
index 87f413612..f6e3dc5ca 100644
--- a/stellar_sdk/operation/inflation.py
+++ b/stellar_sdk/operation/inflation.py
@@ -2,13 +2,11 @@
from .. import xdr as stellar_xdr
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from .operation import Operation
__all__ = ["Inflation"]
-@type_checked
class Inflation(Operation):
"""The :class:`Inflation` object, which represents a
Inflation operation on Stellar's network.
diff --git a/stellar_sdk/operation/invoke_host_function.py b/stellar_sdk/operation/invoke_host_function.py
new file mode 100644
index 000000000..b9a091586
--- /dev/null
+++ b/stellar_sdk/operation/invoke_host_function.py
@@ -0,0 +1,63 @@
+from typing import List, Optional, Sequence, Union
+
+from .. import xdr as stellar_xdr
+from ..muxed_account import MuxedAccount
+from .operation import Operation
+
+__all__ = ["InvokeHostFunction"]
+
+
+class InvokeHostFunction(Operation):
+ """The :class:`InvokeHostFunction` object, which represents a InvokeHostFunction
+ operation on Stellar's network.
+
+ Threshold: Medium
+
+ See `Interacting with Soroban via Stellar `_.
+
+ :param host_function: The host function to invoke.
+ :param auth: The authorizations required to execute the host function.
+ :param source: The source account for the operation. Defaults to the transaction's source account.
+ """
+
+ _XDR_OPERATION_TYPE: stellar_xdr.OperationType = (
+ stellar_xdr.OperationType.INVOKE_HOST_FUNCTION
+ )
+
+ def __init__(
+ self,
+ host_function: stellar_xdr.HostFunction,
+ auth: Sequence[stellar_xdr.SorobanAuthorizationEntry] = None,
+ source: Optional[Union[MuxedAccount, str]] = None,
+ ):
+ super().__init__(source)
+ self.host_function = host_function
+ self.auth: List[stellar_xdr.SorobanAuthorizationEntry] = (
+ list(auth) if auth else []
+ )
+
+ def _to_operation_body(self) -> stellar_xdr.OperationBody:
+ invoke_host_function_op = stellar_xdr.InvokeHostFunctionOp(
+ host_function=self.host_function, auth=self.auth
+ )
+ body = stellar_xdr.OperationBody(
+ type=self._XDR_OPERATION_TYPE,
+ invoke_host_function_op=invoke_host_function_op,
+ )
+ return body
+
+ @classmethod
+ def from_xdr_object(cls, xdr_object: stellar_xdr.Operation) -> "InvokeHostFunction":
+ """Creates a :class:`InvokeHostFunction` object from an XDR Operation object."""
+ source = Operation.get_source_from_xdr_obj(xdr_object)
+ assert xdr_object.body.invoke_host_function_op is not None
+ host_function = xdr_object.body.invoke_host_function_op.host_function
+ auth = xdr_object.body.invoke_host_function_op.auth
+ return cls(
+ host_function=host_function,
+ auth=auth,
+ source=source,
+ )
+
+ def __str__(self):
+ return f""
diff --git a/stellar_sdk/operation/liquidity_pool_deposit.py b/stellar_sdk/operation/liquidity_pool_deposit.py
index 59d071e55..2df7aa5c9 100644
--- a/stellar_sdk/operation/liquidity_pool_deposit.py
+++ b/stellar_sdk/operation/liquidity_pool_deposit.py
@@ -5,14 +5,12 @@
from .. import xdr as stellar_xdr
from ..muxed_account import MuxedAccount
from ..price import Price
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount, raise_if_not_valid_hash
from .operation import Operation
__all__ = ["LiquidityPoolDeposit"]
-@type_checked
class LiquidityPoolDeposit(Operation):
"""The :class:`LiquidityPoolDeposit` object, which represents a LiquidityPoolDeposit
operation on Stellar's network.
diff --git a/stellar_sdk/operation/liquidity_pool_withdraw.py b/stellar_sdk/operation/liquidity_pool_withdraw.py
index e5dd1fff8..a330135b4 100644
--- a/stellar_sdk/operation/liquidity_pool_withdraw.py
+++ b/stellar_sdk/operation/liquidity_pool_withdraw.py
@@ -4,14 +4,12 @@
from .. import xdr as stellar_xdr
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount, raise_if_not_valid_hash
from .operation import Operation
__all__ = ["LiquidityPoolWithdraw"]
-@type_checked
class LiquidityPoolWithdraw(Operation):
"""The :class:`LiquidityPoolWithdraw` object, which represents a LiquidityPoolWithdraw
operation on Stellar's network.
diff --git a/stellar_sdk/operation/manage_buy_offer.py b/stellar_sdk/operation/manage_buy_offer.py
index 076b02670..69f6c0834 100644
--- a/stellar_sdk/operation/manage_buy_offer.py
+++ b/stellar_sdk/operation/manage_buy_offer.py
@@ -5,14 +5,12 @@
from ..asset import Asset
from ..muxed_account import MuxedAccount
from ..price import Price
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount
from .operation import Operation
__all__ = ["ManageBuyOffer"]
-@type_checked
class ManageBuyOffer(Operation):
"""The :class:`ManageBuyOffer` object, which represents a ManageBuyOffer
operation on Stellar's network.
diff --git a/stellar_sdk/operation/manage_data.py b/stellar_sdk/operation/manage_data.py
index cdc067683..5c2fa3e7c 100644
--- a/stellar_sdk/operation/manage_data.py
+++ b/stellar_sdk/operation/manage_data.py
@@ -1,15 +1,12 @@
from typing import Optional, Union
from .. import xdr as stellar_xdr
-from ..exceptions import ValueError
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from .operation import Operation
__all__ = ["ManageData"]
-@type_checked
class ManageData(Operation):
"""The :class:`ManageData` object, which represents a
ManageData operation on Stellar's network.
diff --git a/stellar_sdk/operation/manage_sell_offer.py b/stellar_sdk/operation/manage_sell_offer.py
index f760fcf24..896862bf4 100644
--- a/stellar_sdk/operation/manage_sell_offer.py
+++ b/stellar_sdk/operation/manage_sell_offer.py
@@ -5,14 +5,12 @@
from ..asset import Asset
from ..muxed_account import MuxedAccount
from ..price import Price
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount
from .operation import Operation
__all__ = ["ManageSellOffer"]
-@type_checked
class ManageSellOffer(Operation):
"""The :class:`ManageSellOffer` object, which represents a ManageSellOffer
operation on Stellar's network.
diff --git a/stellar_sdk/operation/operation.py b/stellar_sdk/operation/operation.py
index f5a5f9cf4..a33a05065 100644
--- a/stellar_sdk/operation/operation.py
+++ b/stellar_sdk/operation/operation.py
@@ -5,12 +5,10 @@
from .. import utils
from .. import xdr as stellar_xdr
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
__all__ = ["Operation"]
-@type_checked
class Operation(metaclass=ABCMeta):
"""The :class:`Operation` object, which represents an operation on
Stellar's network.
@@ -76,7 +74,7 @@ def to_xdr_amount(value: Union[str, Decimal]) -> int:
@staticmethod
def from_xdr_amount(value: int) -> str:
- """Converts an str amount from an XDR amount object
+ """Converts a str amount from an XDR amount object
:param value: The amount to convert to a string from an XDR int64
amount.
@@ -126,6 +124,9 @@ def get_source_from_xdr_obj(
return MuxedAccount.from_xdr_object(xdr_object.source_account)
return None
+ def __hash__(self):
+ return hash(self.to_xdr_object())
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/operation/path_payment_strict_receive.py b/stellar_sdk/operation/path_payment_strict_receive.py
index 2d2494243..fc10e1dc1 100644
--- a/stellar_sdk/operation/path_payment_strict_receive.py
+++ b/stellar_sdk/operation/path_payment_strict_receive.py
@@ -1,17 +1,15 @@
from decimal import Decimal
-from typing import List, Optional, Union
+from typing import Optional, Sequence, Union
from .. import xdr as stellar_xdr
from ..asset import Asset
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount
from .operation import Operation
__all__ = ["PathPaymentStrictReceive"]
-@type_checked
class PathPaymentStrictReceive(Operation):
"""The :class:`PathPaymentStrictReceive` object, which represents a PathPaymentStrictReceive
operation on Stellar's network.
@@ -45,7 +43,7 @@ def __init__(
send_max: Union[str, Decimal],
dest_asset: Asset,
dest_amount: Union[str, Decimal],
- path: List[Asset],
+ path: Sequence[Asset],
source: Optional[Union[MuxedAccount, str]] = None,
) -> None:
super().__init__(source)
@@ -56,7 +54,7 @@ def __init__(
self.send_max: str = str(send_max)
self.dest_asset: Asset = dest_asset
self.dest_amount: str = str(dest_amount)
- self.path: List[Asset] = path # a list of paths/assets
+ self.path: Sequence[Asset] = path # a list of paths/assets
raise_if_not_valid_amount(self.send_max, "send_max")
raise_if_not_valid_amount(self.dest_amount, "dest_amount")
diff --git a/stellar_sdk/operation/path_payment_strict_send.py b/stellar_sdk/operation/path_payment_strict_send.py
index 286d10548..c0c6dd131 100644
--- a/stellar_sdk/operation/path_payment_strict_send.py
+++ b/stellar_sdk/operation/path_payment_strict_send.py
@@ -1,17 +1,15 @@
from decimal import Decimal
-from typing import List, Optional, Union
+from typing import Optional, Sequence, Union
from .. import xdr as stellar_xdr
from ..asset import Asset
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount
from .operation import Operation
__all__ = ["PathPaymentStrictSend"]
-@type_checked
class PathPaymentStrictSend(Operation):
"""The :class:`PathPaymentStrictSend` object, which represents a PathPaymentStrictSend
operation on Stellar's network.
@@ -45,7 +43,7 @@ def __init__(
send_amount: Union[str, Decimal],
dest_asset: Asset,
dest_min: Union[str, Decimal],
- path: List[Asset],
+ path: Sequence[Asset],
source: Optional[Union[MuxedAccount, str]] = None,
) -> None:
super().__init__(source)
@@ -56,7 +54,7 @@ def __init__(
self.send_amount: str = str(send_amount)
self.dest_asset: Asset = dest_asset
self.dest_min: str = str(dest_min)
- self.path: List[Asset] = path # a list of paths/assets
+ self.path: Sequence[Asset] = path # a list of paths/assets
raise_if_not_valid_amount(self.send_amount, "send_amount")
raise_if_not_valid_amount(self.dest_min, "dest_min")
diff --git a/stellar_sdk/operation/payment.py b/stellar_sdk/operation/payment.py
index 4ea06b5d4..2cfaf70f3 100644
--- a/stellar_sdk/operation/payment.py
+++ b/stellar_sdk/operation/payment.py
@@ -4,14 +4,12 @@
from .. import xdr as stellar_xdr
from ..asset import Asset
from ..muxed_account import MuxedAccount
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount
from .operation import Operation
__all__ = ["Payment"]
-@type_checked
class Payment(Operation):
"""The :class:`Payment` object, which represents a Payment operation on
Stellar's network.
diff --git a/stellar_sdk/operation/restore_footprint.py b/stellar_sdk/operation/restore_footprint.py
new file mode 100644
index 000000000..5b9db1a05
--- /dev/null
+++ b/stellar_sdk/operation/restore_footprint.py
@@ -0,0 +1,45 @@
+from typing import Optional, Union
+
+from .. import xdr as stellar_xdr
+from ..muxed_account import MuxedAccount
+from .operation import Operation
+
+__all__ = ["RestoreFootprint"]
+
+
+class RestoreFootprint(Operation):
+ """The :class:`RestoreFootprint` object, which represents a RestoreFootprint
+ operation on Stellar's network.
+
+ Threshold: Medium
+
+ See `RestoreFootprintOp `_.
+
+ :param source: The source account for the operation. Defaults to the transaction's source account.
+ """
+
+ _XDR_OPERATION_TYPE: stellar_xdr.OperationType = (
+ stellar_xdr.OperationType.RESTORE_FOOTPRINT
+ )
+
+ def __init__(self, source: Optional[Union[MuxedAccount, str]] = None) -> None:
+ super().__init__(source)
+
+ def _to_operation_body(self) -> stellar_xdr.OperationBody:
+ op = stellar_xdr.RestoreFootprintOp(
+ ext=stellar_xdr.ExtensionPoint(0),
+ )
+ body = stellar_xdr.OperationBody(
+ type=self._XDR_OPERATION_TYPE, restore_footprint_op=op
+ )
+ return body
+
+ @classmethod
+ def from_xdr_object(cls, xdr_object: stellar_xdr.Operation) -> "RestoreFootprint":
+ """Creates a :class:`RestoreFootprint` object from an XDR Operation object."""
+ source = Operation.get_source_from_xdr_obj(xdr_object)
+ op = cls(source=source)
+ return op
+
+ def __str__(self):
+ return f""
diff --git a/stellar_sdk/operation/revoke_sponsorship.py b/stellar_sdk/operation/revoke_sponsorship.py
index b2e89806b..6e59584fc 100644
--- a/stellar_sdk/operation/revoke_sponsorship.py
+++ b/stellar_sdk/operation/revoke_sponsorship.py
@@ -5,13 +5,11 @@
from .. import xdr as stellar_xdr
from ..asset import Asset
-from ..exceptions import ValueError
from ..keypair import Keypair
from ..liquidity_pool_id import LiquidityPoolId
from ..muxed_account import MuxedAccount
from ..signer_key import SignerKey
from ..strkey import StrKey
-from ..type_checked import type_checked
from ..utils import (
raise_if_not_valid_balance_id,
raise_if_not_valid_ed25519_public_key,
@@ -34,13 +32,15 @@ class RevokeSponsorshipType(IntEnum):
LIQUIDITY_POOL = 6
-@type_checked
class TrustLine:
def __init__(self, account_id: str, asset: Union[Asset, LiquidityPoolId]) -> None:
self.account_id = account_id
self.asset = asset
raise_if_not_valid_ed25519_public_key(self.account_id, "account_id")
+ def __hash__(self):
+ return hash((self.account_id, self.asset))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -50,13 +50,15 @@ def __str__(self):
return f""
-@type_checked
class Offer:
def __init__(self, seller_id: str, offer_id: int) -> None:
self.seller_id = seller_id
self.offer_id = offer_id
raise_if_not_valid_ed25519_public_key(self.seller_id, "seller_id")
+ def __hash__(self):
+ return hash((self.seller_id, self.offer_id))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -66,13 +68,15 @@ def __str__(self):
return f""
-@type_checked
class Data:
def __init__(self, account_id: str, data_name: str) -> None:
self.account_id = account_id
self.data_name = data_name
raise_if_not_valid_ed25519_public_key(self.account_id, "account_id")
+ def __hash__(self):
+ return hash((self.account_id, self.data_name))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -82,13 +86,15 @@ def __str__(self):
return f""
-@type_checked
class Signer:
def __init__(self, account_id: str, signer_key: SignerKey) -> None:
self.account_id = account_id
self.signer_key = signer_key
raise_if_not_valid_ed25519_public_key(self.account_id, "account_id")
+ def __hash__(self):
+ return hash((self.account_id, self.signer_key))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -100,7 +106,6 @@ def __str__(self):
return f""
-@type_checked
class RevokeSponsorship(Operation):
"""The :class:`RevokeSponsorship` object, which represents a RevokeSponsorship
operation on Stellar's network.
@@ -130,6 +135,7 @@ class RevokeSponsorship(Operation):
_XDR_OPERATION_TYPE: stellar_xdr.OperationType = (
stellar_xdr.OperationType.REVOKE_SPONSORSHIP
)
+ # TODO: Protocol 20?
def __init__(
self,
@@ -529,6 +535,21 @@ def from_xdr_object(cls, xdr_object: stellar_xdr.Operation) -> "RevokeSponsorshi
raise ValueError(f"{op_type} is an unsupported RevokeSponsorship type.")
return op
+ def __hash__(self):
+ return hash(
+ (
+ self.revoke_sponsorship_type,
+ self.account_id,
+ self.trustline,
+ self.offer,
+ self.data,
+ self.claimable_balance_id,
+ self.liquidity_pool_id,
+ self.signer,
+ self.source,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/operation/set_options.py b/stellar_sdk/operation/set_options.py
index 7d8dcf2ec..742605746 100644
--- a/stellar_sdk/operation/set_options.py
+++ b/stellar_sdk/operation/set_options.py
@@ -7,7 +7,6 @@
from ..muxed_account import MuxedAccount
from ..signer import Signer
from ..strkey import StrKey
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_ed25519_public_key
from .operation import Operation
@@ -25,7 +24,6 @@ class AuthorizationFlag(IntFlag):
AUTHORIZATION_CLAWBACK_ENABLED = 8
-@type_checked
class SetOptions(Operation):
"""The :class:`SetOptions` object, which represents a SetOptions operation
on Stellar's network.
diff --git a/stellar_sdk/operation/set_trust_line_flags.py b/stellar_sdk/operation/set_trust_line_flags.py
index 0e2ca862a..ed99a703d 100644
--- a/stellar_sdk/operation/set_trust_line_flags.py
+++ b/stellar_sdk/operation/set_trust_line_flags.py
@@ -6,7 +6,6 @@
from ..keypair import Keypair
from ..muxed_account import MuxedAccount
from ..strkey import StrKey
-from ..type_checked import type_checked
from ..utils import raise_if_not_valid_ed25519_public_key
from .operation import Operation
@@ -29,7 +28,6 @@ class TrustLineFlags(IntFlag):
TRUSTLINE_CLAWBACK_ENABLED_FLAG = 4
-@type_checked
class SetTrustLineFlags(Operation):
"""The :class:`SetTrustLineFlags` object, which represents a SetTrustLineFlags operation on
Stellar's network.
diff --git a/stellar_sdk/preconditions.py b/stellar_sdk/preconditions.py
index c873dc34e..cc70d2567 100644
--- a/stellar_sdk/preconditions.py
+++ b/stellar_sdk/preconditions.py
@@ -1,4 +1,4 @@
-from typing import List, Optional
+from typing import List, Optional, Sequence
from . import xdr as stellar_xdr
from .ledger_bounds import LedgerBounds
@@ -33,7 +33,7 @@ def __init__(
min_sequence_number: int = None,
min_sequence_age: int = None,
min_sequence_ledger_gap: int = None,
- extra_signers: List[SignerKey] = None,
+ extra_signers: Sequence[SignerKey] = None,
):
if not extra_signers:
extra_signers = []
@@ -179,6 +179,18 @@ def from_xdr_object(cls, xdr_object: stellar_xdr.Preconditions) -> "Precondition
else:
raise ValueError(f"Invalid PreconditionType: {xdr_object.type!r}")
+ def __hash__(self):
+ return hash(
+ (
+ self.time_bounds,
+ self.ledger_bounds,
+ self.min_sequence_number,
+ self.min_sequence_age,
+ self.min_sequence_ledger_gap,
+ self.extra_signers,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/price.py b/stellar_sdk/price.py
index 45be9fea4..fd69a8388 100644
--- a/stellar_sdk/price.py
+++ b/stellar_sdk/price.py
@@ -2,13 +2,11 @@
from typing import Union
from . import xdr as stellar_xdr
-from .type_checked import type_checked
from .utils import best_rational_approximation
__all__ = ["Price"]
-@type_checked
class Price:
"""Create a new price. Price in Stellar is represented as a fraction.
@@ -71,6 +69,9 @@ def __le__(self, other):
return NotImplemented
return (self.n * other.d) <= (other.n * self.d)
+ def __hash__(self):
+ return hash((self.n, self.d))
+
def __eq__(self, other):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/scval.py b/stellar_sdk/scval.py
new file mode 100644
index 000000000..418a6d5ec
--- /dev/null
+++ b/stellar_sdk/scval.py
@@ -0,0 +1,644 @@
+from typing import Dict, List, Optional, Sequence, Tuple, Union
+
+from . import xdr as stellar_xdr
+from .address import Address
+
+__all__ = [
+ "to_address",
+ "from_address",
+ "to_bool",
+ "from_bool",
+ "to_bytes",
+ "from_bytes",
+ "to_duration",
+ "from_duration",
+ "to_int32",
+ "from_int32",
+ "to_int64",
+ "from_int64",
+ "to_int128",
+ "from_int128",
+ "to_int256",
+ "from_int256",
+ "to_map",
+ "from_map",
+ "to_string",
+ "from_string",
+ "to_symbol",
+ "from_symbol",
+ "to_timepoint",
+ "from_timepoint",
+ "to_uint32",
+ "from_uint32",
+ "to_uint64",
+ "from_uint64",
+ "to_uint128",
+ "from_uint128",
+ "to_uint256",
+ "from_uint256",
+ "to_vec",
+ "from_vec",
+ "to_enum",
+ "from_enum",
+ "to_struct",
+ "from_struct",
+ "to_tuple_struct",
+ "from_tuple_struct",
+]
+
+
+def to_address(data: Union[Address, str]) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an :class:`stellar_sdk.address.Address` object.
+
+ :param data: The :class:`stellar_sdk.address.Address` object to convert.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_ADDRESS`.
+ """
+ if isinstance(data, str):
+ data = Address(data)
+ return stellar_xdr.SCVal(
+ stellar_xdr.SCValType.SCV_ADDRESS, address=data.to_xdr_sc_address()
+ )
+
+
+def from_address(sc_val: stellar_xdr.SCVal) -> Address:
+ """Creates an :class:`stellar_sdk.address.Address` object from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: An :class:`stellar_sdk.address.Address` object.
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_ADDRESS`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_ADDRESS:
+ raise ValueError(f"Invalid sc_val type, must be SCV_ADDRESS, got {sc_val.type}")
+ assert sc_val.address is not None
+ return Address.from_xdr_sc_address(sc_val.address)
+
+
+def to_bool(data: bool) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from a bool value.
+
+ :param data: The bool value to convert.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_BOOL`.
+ """
+ return stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_BOOL, b=data)
+
+
+def from_bool(sc_val: stellar_xdr.SCVal) -> bool:
+ """Creates a bool value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: A bool value.
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_BOOL`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_BOOL:
+ raise ValueError(f"Invalid sc_val type, must be SCV_BOOL, got {sc_val.type}")
+ assert sc_val.b is not None
+ return sc_val.b
+
+
+def to_bytes(data: bytes) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from a bytes value.
+
+ :param data: The bytes value to convert.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_BYTES`.
+ """
+ return stellar_xdr.SCVal(
+ stellar_xdr.SCValType.SCV_BYTES, bytes=stellar_xdr.SCBytes(data)
+ )
+
+
+def from_bytes(sc_val: stellar_xdr.SCVal) -> bytes:
+ """Creates a bytes value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: A bytes value.
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_BYTES`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_BYTES:
+ raise ValueError(f"Invalid sc_val type, must be SCV_BYTES, got {sc_val.type}")
+ assert sc_val.bytes is not None
+ return bytes(sc_val.bytes.sc_bytes)
+
+
+def to_duration(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The duration. (uint64)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_DURATION`.
+ :raises: :exc:`ValueError` if ``value`` is out of uint64 range.
+ """
+ if data < 0 or data > 2**64 - 1:
+ raise ValueError("Invalid data, must be between 0 and 2**64 - 1.")
+ duration = stellar_xdr.Duration(stellar_xdr.Uint64(data))
+ return stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_DURATION, duration=duration)
+
+
+def from_duration(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: The duration. (uint64)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_DURATION`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_DURATION:
+ raise ValueError(
+ f"Invalid sc_val type, must be SCV_DURATION, got {sc_val.type}"
+ )
+ assert sc_val.duration is not None
+ return sc_val.duration.duration.uint64
+
+
+def to_int32(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The int to convert. (int32)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_I32`.
+ :raises: :exc:`ValueError` if ``value`` is out of int32 range.
+ """
+ if data < -(2**31) or data > 2**31 - 1:
+ raise ValueError("Invalid data, must be between -(2**31) and 2**31 - 1.")
+
+ return stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_I32, i32=stellar_xdr.Int32(data))
+
+
+def from_int32(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: An int value. (int32)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_I32`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_I32:
+ raise ValueError(f"Invalid sc_val type, must be SCV_I32, got {sc_val.type}")
+ assert sc_val.i32 is not None
+ return sc_val.i32.int32
+
+
+def to_int64(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The int to convert. (int64)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_I64`.
+ :raises: :exc:`ValueError` if ``value`` is out of int64 range.
+ """
+ if data < -(2**63) or data > 2**63 - 1:
+ raise ValueError("Invalid data, must be between -(2**63) and 2**63 - 1.")
+
+ return stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_I64, i64=stellar_xdr.Int64(data))
+
+
+def from_int64(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: An int value. (int64)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_I64`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_I64:
+ raise ValueError(f"Invalid sc_val type, must be SCV_I64, got {sc_val.type}")
+ assert sc_val.i64 is not None
+ return sc_val.i64.int64
+
+
+def to_int128(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The int to convert. (int128)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_I128`.
+ :raises: :exc:`ValueError` if ``value`` is out of int128 range.
+ """
+ if data < -(2**127) or data > 2**127 - 1:
+ raise ValueError("Invalid data, must be between -(2**127) and 2**127 - 1.")
+
+ value_bytes = data.to_bytes(16, "big", signed=True)
+ i128 = stellar_xdr.Int128Parts(
+ hi=stellar_xdr.Int64(int.from_bytes(value_bytes[0:8], "big", signed=True)),
+ lo=stellar_xdr.Uint64(int.from_bytes(value_bytes[8:16], "big", signed=False)),
+ )
+ return stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_I128, i128=i128)
+
+
+def from_int128(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: An int value. (int128)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_I128`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_I128:
+ raise ValueError(f"Invalid sc_val type, must be SCV_I128, got {sc_val.type}")
+ assert sc_val.i128 is not None
+
+ value_bytes = sc_val.i128.hi.int64.to_bytes(
+ 8, "big", signed=True
+ ) + sc_val.i128.lo.uint64.to_bytes(8, "big", signed=False)
+ return int.from_bytes(value_bytes, "big", signed=True)
+
+
+def to_int256(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The int to convert. (int256)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_I256`.
+ :raises: :exc:`ValueError` if ``value`` is out of int256 range.
+ """
+ if data < -(2**255) or data > 2**255 - 1:
+ raise ValueError("Invalid data, must be between -(2**255) and 2**255 - 1.")
+
+ value_bytes = data.to_bytes(32, "big", signed=True)
+ hi_hi, hi_lo, lo_hi, lo_lo = (
+ int.from_bytes(value_bytes[0:8], "big", signed=True),
+ int.from_bytes(value_bytes[8:16], "big", signed=False),
+ int.from_bytes(value_bytes[16:24], "big", signed=False),
+ int.from_bytes(value_bytes[24:32], "big", signed=False),
+ )
+ i256 = stellar_xdr.Int256Parts(
+ hi_hi=stellar_xdr.Int64(hi_hi),
+ hi_lo=stellar_xdr.Uint64(hi_lo),
+ lo_hi=stellar_xdr.Uint64(lo_hi),
+ lo_lo=stellar_xdr.Uint64(lo_lo),
+ )
+ return stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_I256, i256=i256)
+
+
+def from_int256(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: An int value. (int256)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_I256`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_I256:
+ raise ValueError(f"Invalid sc_val type, must be SCV_I256, got {sc_val.type}")
+ assert sc_val.i256 is not None
+
+ value_bytes = (
+ sc_val.i256.hi_hi.int64.to_bytes(8, "big", signed=True)
+ + sc_val.i256.hi_lo.uint64.to_bytes(8, "big", signed=False)
+ + sc_val.i256.lo_hi.uint64.to_bytes(8, "big", signed=False)
+ + sc_val.i256.lo_lo.uint64.to_bytes(8, "big", signed=False)
+ )
+ return int.from_bytes(value_bytes, "big", signed=True)
+
+
+def to_map(data: Dict[stellar_xdr.SCVal, stellar_xdr.SCVal]) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an OrderedDict value.
+
+ :param data: The dict value to convert.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_MAP`.
+ """
+ return stellar_xdr.SCVal(
+ stellar_xdr.SCValType.SCV_MAP,
+ map=stellar_xdr.SCMap(
+ sc_map=[
+ stellar_xdr.SCMapEntry(key=key, val=value)
+ for key, value in data.items()
+ ]
+ ),
+ )
+
+
+def from_map(sc_val: stellar_xdr.SCVal) -> Dict[stellar_xdr.SCVal, stellar_xdr.SCVal]:
+ """Creates a dict value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: The map value.
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_MAP`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_MAP:
+ raise ValueError(f"Invalid sc_val type, must be SCV_MAP, got {sc_val.type}")
+ assert sc_val.map is not None
+ return dict([(entry.key, entry.val) for entry in sc_val.map.sc_map])
+
+
+def to_string(data: Union[str, bytes]) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from a string value.
+
+ :param data: The string value to convert.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_STRING`.
+ """
+ if isinstance(data, str):
+ data = data.encode("utf-8")
+ return stellar_xdr.SCVal(
+ stellar_xdr.SCValType.SCV_STRING, str=stellar_xdr.SCString(data)
+ )
+
+
+def from_string(sc_val: stellar_xdr.SCVal) -> bytes:
+ """Creates a string value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: A string value in bytes.
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_STRING`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_STRING:
+ raise ValueError(f"Invalid sc_val type, must be SCV_STRING, got {sc_val.type}")
+ assert sc_val.str is not None
+ return sc_val.str.sc_string
+
+
+def to_symbol(data: str) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from a symbol value.
+
+ :param data: The symbol value to convert.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_SYMBOL`.
+ """
+ return stellar_xdr.SCVal(
+ stellar_xdr.SCValType.SCV_SYMBOL, sym=stellar_xdr.SCSymbol(data.encode("utf-8"))
+ )
+
+
+def from_symbol(sc_val: stellar_xdr.SCVal) -> str:
+ """Creates a symbol value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: A symbol value.
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_SYMBOL`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_SYMBOL:
+ raise ValueError(f"Invalid sc_val type, must be SCV_SYMBOL, got {sc_val.type}")
+ assert sc_val.sym is not None
+ return sc_val.sym.sc_symbol.decode("utf-8")
+
+
+def to_timepoint(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The time point. (uint64)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_TIME_POINT`.
+ :raises: :exc:`ValueError` if ``value`` is out of uint64 range.
+ """
+ if data < 0 or data > 2**64 - 1:
+ raise ValueError("Invalid data, must be between 0 and 2**64 - 1.")
+ time_point = stellar_xdr.TimePoint(stellar_xdr.Uint64(data))
+ return stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_TIMEPOINT, timepoint=time_point)
+
+
+def from_timepoint(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: The time point. (uint64)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_TIMEPOINT`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_TIMEPOINT:
+ raise ValueError(
+ f"Invalid sc_val type, must be SCV_TIMEPOINT, got {sc_val.type}"
+ )
+ assert sc_val.timepoint is not None
+ return sc_val.timepoint.time_point.uint64
+
+
+def to_uint32(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The int to convert. (uint32)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_U32`.
+ :raises: :exc:`ValueError` if ``value`` is out of uint32 range.
+ """
+ if data < 0 or data > 2**32 - 1:
+ raise ValueError("Invalid data, must be between 0 and 2**32 - 1.")
+
+ return stellar_xdr.SCVal(
+ stellar_xdr.SCValType.SCV_U32, u32=stellar_xdr.Uint32(data)
+ )
+
+
+def from_uint32(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: An int value. (uint32)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_U32`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_U32:
+ raise ValueError(f"Invalid sc_val type, must be SCV_U32, got {sc_val.type}")
+ assert sc_val.u32 is not None
+ return sc_val.u32.uint32
+
+
+def to_uint64(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The int to convert. (uint64)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_U64`.
+ :raises: :exc:`ValueError` if ``value`` is out of uint64 range.
+ """
+ if data < 0 or data > 2**64 - 1:
+ raise ValueError("Invalid data, must be between 0 and 2**64 - 1.")
+
+ return stellar_xdr.SCVal(
+ stellar_xdr.SCValType.SCV_U64, u64=stellar_xdr.Uint64(data)
+ )
+
+
+def from_uint64(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: An int value. (uint64)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_U64`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_U64:
+ raise ValueError(f"Invalid sc_val type, must be SCV_U64, got {sc_val.type}")
+ assert sc_val.u64 is not None
+ return sc_val.u64.uint64
+
+
+def to_uint128(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The int to convert. (uint128)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_U128`.
+ :raises: :exc:`ValueError` if ``value`` is out of uint128 range.
+ """
+ if data < 0 or data > 2**128 - 1:
+ raise ValueError("Invalid data, must be between 0 and 2**128 - 1.")
+
+ value_bytes = data.to_bytes(16, "big", signed=False)
+ u128 = stellar_xdr.UInt128Parts(
+ hi=stellar_xdr.Uint64(int.from_bytes(value_bytes[0:8], "big", signed=False)),
+ lo=stellar_xdr.Uint64(int.from_bytes(value_bytes[8:16], "big", signed=False)),
+ )
+ return stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_U128, u128=u128)
+
+
+def from_uint128(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: An int value. (uint128)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_U128`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_U128:
+ raise ValueError(f"Invalid sc_val type, must be SCV_U128, got {sc_val.type}")
+ assert sc_val.u128 is not None
+
+ value_bytes = sc_val.u128.hi.uint64.to_bytes(
+ 8, "big", signed=False
+ ) + sc_val.u128.lo.uint64.to_bytes(8, "big", signed=False)
+ return int.from_bytes(value_bytes, "big", signed=False)
+
+
+def to_uint256(data: int) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from an int value.
+
+ :param data: The int to convert. (uint256)
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_U256`.
+ :raises: :exc:`ValueError` if ``value`` is out of uint256 range.
+ """
+ if data < 0 or data > 2**256 - 1:
+ raise ValueError("Invalid data, must be between 0 and 2**256 - 1.")
+
+ value_bytes = data.to_bytes(32, "big", signed=False)
+ hi_hi, hi_lo, lo_hi, lo_lo = (
+ int.from_bytes(value_bytes[0:8], "big", signed=False),
+ int.from_bytes(value_bytes[8:16], "big", signed=False),
+ int.from_bytes(value_bytes[16:24], "big", signed=False),
+ int.from_bytes(value_bytes[24:32], "big", signed=False),
+ )
+ u256 = stellar_xdr.UInt256Parts(
+ hi_hi=stellar_xdr.Uint64(hi_hi),
+ hi_lo=stellar_xdr.Uint64(hi_lo),
+ lo_hi=stellar_xdr.Uint64(lo_hi),
+ lo_lo=stellar_xdr.Uint64(lo_lo),
+ )
+ return stellar_xdr.SCVal(stellar_xdr.SCValType.SCV_U256, u256=u256)
+
+
+def from_uint256(sc_val: stellar_xdr.SCVal) -> int:
+ """Creates an int value from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: The value. (uint256)
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_U256`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_U256:
+ raise ValueError(f"Invalid sc_val type, must be SCV_U256, got {sc_val.type}")
+ assert sc_val.u256 is not None
+
+ value_bytes = (
+ sc_val.u256.hi_hi.uint64.to_bytes(8, "big", signed=False)
+ + sc_val.u256.hi_lo.uint64.to_bytes(8, "big", signed=False)
+ + sc_val.u256.lo_hi.uint64.to_bytes(8, "big", signed=False)
+ + sc_val.u256.lo_lo.uint64.to_bytes(8, "big", signed=False)
+ )
+ return int.from_bytes(value_bytes, "big", signed=False)
+
+
+def to_vec(data: Sequence[stellar_xdr.SCVal]) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object from a list of :class:`stellar_sdk.xdr.SCVal` XDR objects.
+
+ :param data: The list of :class:`stellar_sdk.xdr.SCVal` XDR objects.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object with type :class:`stellar_sdk.xdr.SCValType.SCV_VEC`.
+ """
+ return stellar_xdr.SCVal(
+ stellar_xdr.SCValType.SCV_VEC, vec=stellar_xdr.SCVec(list(data))
+ )
+
+
+def from_vec(sc_val: stellar_xdr.SCVal) -> List[stellar_xdr.SCVal]:
+ """Creates a list of :class:`stellar_sdk.xdr.SCVal` XDR objects from a :class:`stellar_sdk.xdr.SCVal` XDR object.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: The list of :class:`stellar_sdk.xdr.SCVal` XDR objects.
+ :raises: :exc:`ValueError` if ``sc_val`` is not of type :class:`stellar_sdk.xdr.SCValType.SCV_VEC`.
+ """
+ if sc_val.type != stellar_xdr.SCValType.SCV_VEC:
+ raise ValueError(f"Invalid sc_val type, must be VEC, got {sc_val.type}")
+ assert sc_val.vec is not None
+ return sc_val.vec.sc_vec
+
+
+def to_enum(key: str, data: Optional[stellar_xdr.SCVal]) -> stellar_xdr.SCVal:
+ """Creates a :class:`stellar_sdk.xdr.SCVal` XDR object corresponding to the Enum in the Rust SDK.
+
+ .. warning::
+ Please note that this API is experimental and may be removed at any time. I recommend using the
+ :meth:`from_vec` to implement it.
+
+ :param key: The key of the Enum.
+ :param data: The data of the Enum.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object.
+ """
+ scv = [to_symbol(key)]
+ if data is not None:
+ scv.append(data)
+ return to_vec(scv)
+
+
+def from_enum(sc_val: stellar_xdr.SCVal) -> Tuple[str, Optional[stellar_xdr.SCVal]]:
+ """Creates a tuple corresponding to the Enum in the Rust SDK.
+
+ .. warning::
+ Please note that this API is experimental and may be removed at any time. I recommend using the
+ :meth:`from_vec` and :meth:`from_symbol` to implement it.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: A tuple corresponding to the Enum in the Rust SDK.
+ """
+ vec = from_vec(sc_val)
+ if len(vec) < 1 or len(vec) > 2:
+ raise ValueError(
+ f"Invalid sc_val, can not parse enum, sc_val: {sc_val.to_xdr()}"
+ )
+ key = from_symbol(vec[0])
+ value = None
+ if len(vec) == 2:
+ value = vec[1]
+ return key, value
+
+
+def to_tuple_struct(data: Sequence[stellar_xdr.SCVal]) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object corresponding to the Tuple Struct in the Rust SDK.
+
+ .. warning::
+ Please note that this API is experimental and may be removed at any time. I recommend using the
+ :meth:`to_vec` to implement it.
+
+ :param data: The fields of the Tuple Struct.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object.
+ """
+ return to_vec(list(data))
+
+
+def from_tuple_struct(sc_val: stellar_xdr.SCVal) -> List[stellar_xdr.SCVal]:
+ """Creates a list corresponding to the Tuple Struct in the Rust SDK.
+
+ .. warning::
+ Please note that this API is experimental and may be removed at any time. I recommend using the
+ :meth:`from_vec` to implement it.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: A list corresponding to the Tuple Struct in the Rust SDK.
+ """
+ return from_vec(sc_val)
+
+
+def to_struct(data: Dict[str, stellar_xdr.SCVal]) -> stellar_xdr.SCVal:
+ """Creates a new :class:`stellar_sdk.xdr.SCVal` XDR object corresponding to the Struct in the Rust SDK.
+
+ .. warning::
+ Please note that this API is experimental and may be removed at any time. I recommend using the
+ :meth:`to_map` and :meth:`to_symbol` to implement it.
+
+ :param data: The dict value to convert.
+ :return: A new :class:`stellar_sdk.xdr.SCVal` XDR object.
+ """
+ v = dict()
+ for key, val in data.items():
+ v[to_symbol(key)] = val
+ return to_map(v)
+
+
+def from_struct(sc_val: stellar_xdr.SCVal) -> Dict[str, stellar_xdr.SCVal]:
+ """Creates a dict corresponding to the Struct in the Rust SDK.
+
+ .. warning::
+ Please note that this API is experimental and may be removed at any time. I recommend using the
+ :meth:`from_map` and :meth:`from_symbol` to implement it.
+
+ :param sc_val: The :class:`stellar_sdk.xdr.SCVal` XDR object to convert.
+ :return: A dict corresponding to the Struct in the Rust SDK.
+ """
+ v = from_map(sc_val)
+ return dict([(from_symbol(key), val) for key, val in v.items()])
diff --git a/stellar_sdk/sep/ed25519_public_key_signer.py b/stellar_sdk/sep/ed25519_public_key_signer.py
index e208a12af..ee6ed31ac 100644
--- a/stellar_sdk/sep/ed25519_public_key_signer.py
+++ b/stellar_sdk/sep/ed25519_public_key_signer.py
@@ -1,10 +1,6 @@
-from ..type_checked import type_checked
-
-
-@type_checked
class Ed25519PublicKeySigner:
def __init__(self, account_id: str, weight: int = 0) -> None:
- """The :class:`Signer` object, which represents represents the signer for the client account.
+ """The :class:`Signer` object, which represents the signer for the client account.
:param account_id: Account ID (ex. ``"GBYNR2QJXLBCBTRN44MRORCMI4YO7FZPFBCNOKTOBCAAFC7KC3LNPRYS"``)
:param weight: The signer's weight.
@@ -12,6 +8,9 @@ def __init__(self, account_id: str, weight: int = 0) -> None:
self.account_id = account_id
self.weight = weight
+ def __hash__(self):
+ return hash((self.account_id, self.weight))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/sep/federation.py b/stellar_sdk/sep/federation.py
index 82bdfaceb..6b8e46fce 100644
--- a/stellar_sdk/sep/federation.py
+++ b/stellar_sdk/sep/federation.py
@@ -9,13 +9,11 @@
"""
from typing import Dict, Optional
-from .. import AiohttpClient
+from ..client.aiohttp_client import AiohttpClient
from ..client.base_async_client import BaseAsyncClient
from ..client.base_sync_client import BaseSyncClient
from ..client.requests_client import RequestsClient
from ..client.response import Response
-from ..exceptions import ValueError
-from ..type_checked import type_checked
from .exceptions import (
BadFederationResponseError,
FederationServerNotFoundError,
@@ -35,7 +33,6 @@
]
-@type_checked
class FederationRecord:
def __init__(
self,
@@ -58,6 +55,9 @@ def __init__(
self.memo_type: Optional[str] = memo_type
self.memo: Optional[str] = memo
+ def __hash__(self):
+ return hash((self.account_id, self.stellar_address, self.memo_type, self.memo))
+
def __str__(self):
return (
f" bool:
)
-@type_checked
def resolve_stellar_address(
stellar_address: str,
client: BaseSyncClient = None,
@@ -89,7 +88,7 @@ def resolve_stellar_address(
:param federation_url: The federation server URL (ex. ``"https://stellar.org/federation"``),
if you don't set this value, we will try to get it from `stellar_address`.
:param use_http: Specifies whether the request should go over plain HTTP vs HTTPS.
- Note it is recommend that you **always** use HTTPS.
+ Note it is recommended that you **always** use HTTPS.
:return: Federation record.
"""
if not client:
@@ -108,7 +107,6 @@ def resolve_stellar_address(
return _handle_raw_response(raw_resp, stellar_address=stellar_address)
-@type_checked
async def resolve_stellar_address_async(
stellar_address: str,
client: BaseAsyncClient = None,
@@ -122,7 +120,7 @@ async def resolve_stellar_address_async(
:param federation_url: The federation server URL (ex. ``"https://stellar.org/federation"``),
if you don't set this value, we will try to get it from `stellar_address`.
:param use_http: Specifies whether the request should go over plain HTTP vs HTTPS.
- Note it is recommend that you **always** use HTTPS.
+ Note it is recommended that you **always** use HTTPS.
:return: Federation record.
"""
if not client:
@@ -141,7 +139,6 @@ async def resolve_stellar_address_async(
return _handle_raw_response(raw_resp, stellar_address=stellar_address)
-@type_checked
def resolve_account_id(
account_id: str,
domain: str = None,
@@ -156,7 +153,7 @@ def resolve_account_id(
:param federation_url: The federation server URL (ex. ``"https://stellar.org/federation"``).
:param client: Http Client used to send the request.
:param use_http: Specifies whether the request should go over plain HTTP vs HTTPS.
- Note it is recommend that you **always** use HTTPS.
+ Note it is recommended that you **always** use HTTPS.
:return: Federation record.
"""
if domain is None and federation_url is None:
@@ -177,7 +174,6 @@ def resolve_account_id(
return _handle_raw_response(raw_resp, account_id=account_id)
-@type_checked
async def resolve_account_id_async(
account_id: str,
domain: str = None,
@@ -192,7 +188,7 @@ async def resolve_account_id_async(
:param federation_url: The federation server URL (ex. ``"https://stellar.org/federation"``).
:param client: Http Client used to send the request.
:param use_http: Specifies whether the request should go over plain HTTP vs HTTPS.
- Note it is recommend that you **always** use HTTPS.
+ Note it is recommended that you **always** use HTTPS.
:return: Federation record.
"""
if domain is None and federation_url is None:
@@ -213,7 +209,6 @@ async def resolve_account_id_async(
return _handle_raw_response(raw_resp, account_id=account_id)
-@type_checked
def _handle_raw_response(
raw_resp: Response, stellar_address=None, account_id=None
) -> FederationRecord:
@@ -232,7 +227,6 @@ def _handle_raw_response(
)
-@type_checked
def _split_stellar_address(address: str) -> Dict[str, str]:
parts = address.split(SEPARATOR)
if len(parts) != 2:
diff --git a/stellar_sdk/sep/mnemonic.py b/stellar_sdk/sep/mnemonic.py
index d608c6d29..699446cc9 100644
--- a/stellar_sdk/sep/mnemonic.py
+++ b/stellar_sdk/sep/mnemonic.py
@@ -13,9 +13,6 @@
from mnemonic import Mnemonic
from mnemonic.mnemonic import PBKDF2_ROUNDS
-from ..exceptions import ValueError
-from ..type_checked import type_checked
-
@unique
class Language(Enum):
@@ -31,7 +28,6 @@ class Language(Enum):
CHINESE_TRADITIONAL = "chinese_traditional"
-@type_checked
class StellarMnemonic(Mnemonic):
"""Please use :func:`stellar_sdk.keypair.Keypair.generate_mnemonic_phrase`
and :func:`stellar_sdk.keypair.Keypair.from_mnemonic_phrase`
diff --git a/stellar_sdk/sep/stellar_toml.py b/stellar_sdk/sep/stellar_toml.py
index 3181232d4..68a3b64f4 100644
--- a/stellar_sdk/sep/stellar_toml.py
+++ b/stellar_sdk/sep/stellar_toml.py
@@ -16,13 +16,11 @@
from ..client.base_sync_client import BaseSyncClient
from ..client.requests_client import RequestsClient
from ..client.response import Response
-from ..type_checked import type_checked
from .exceptions import StellarTomlNotFoundError
__all__ = ["fetch_stellar_toml", "fetch_stellar_toml_async"]
-@type_checked
def fetch_stellar_toml(
domain: str,
client: BaseSyncClient = None,
@@ -36,11 +34,11 @@ def fetch_stellar_toml(
:param domain: The domain the .toml file is hosted at.
:param use_http: Specifies whether the request should go over plain HTTP vs HTTPS.
- Note it is recommend that you **always** use HTTPS.
+ Note it is recommended that you **always** use HTTPS.
:param client: Http Client used to send the request.
:return: The stellar.toml file as an object via :func:`toml.loads`.
:raises: :exc:`StellarTomlNotFoundError `:
- if the Stellar toml file could not not be found.
+ if the Stellar toml file could not be found.
"""
if not client:
client = RequestsClient()
@@ -49,7 +47,6 @@ def fetch_stellar_toml(
return _handle_raw_response(raw_resp)
-@type_checked
async def fetch_stellar_toml_async(
domain: str,
client: BaseAsyncClient = None,
@@ -63,11 +60,11 @@ async def fetch_stellar_toml_async(
:param domain: The domain the .toml file is hosted at.
:param use_http: Specifies whether the request should go over plain HTTP vs HTTPS.
- Note it is recommend that you **always** use HTTPS.
+ Note it is recommended that you **always** use HTTPS.
:param client: Http Client used to send the request.
:return: The stellar.toml file as an object via :func:`toml.loads`.
:raises: :exc:`StellarTomlNotFoundError `:
- if the Stellar toml file could not not be found.
+ if the Stellar toml file could not be found.
"""
if not client:
diff --git a/stellar_sdk/sep/stellar_uri.py b/stellar_sdk/sep/stellar_uri.py
index 104bd4b15..bc3e8af3b 100644
--- a/stellar_sdk/sep/stellar_uri.py
+++ b/stellar_sdk/sep/stellar_uri.py
@@ -15,19 +15,16 @@
from urllib import parse
from ..asset import Asset
-from ..exceptions import ValueError
from ..fee_bump_transaction_envelope import FeeBumpTransactionEnvelope
from ..keypair import Keypair
from ..memo import HashMemo, IdMemo, Memo, NoneMemo, ReturnHashMemo, TextMemo
from ..transaction_envelope import TransactionEnvelope
-from ..type_checked import type_checked
__all__ = ["PayStellarUri", "TransactionStellarUri", "Replacement"]
STELLAR_SCHEME: str = "web+stellar"
-@type_checked
class StellarUri(object, metaclass=abc.ABCMeta):
def __init__(self, signature: Optional[str] = None):
self.signature = signature
@@ -69,7 +66,6 @@ def _parse_callback(callback: Optional[str]) -> Optional[str]:
return callback[4:]
-@type_checked
class PayStellarUri(StellarUri):
"""A request for a payment to be signed.
@@ -254,6 +250,23 @@ def __str__(self):
f"origin_domain={self.origin_domain}, signature={self.signature}]>"
)
+ def __hash__(self):
+ return hash(
+ (
+ self.destination,
+ self.amount,
+ self.asset_code,
+ self.asset_issuer,
+ self.memo,
+ self.memo_type,
+ self.callback,
+ self.msg,
+ self.network_passphrase,
+ self.origin_domain,
+ self.signature,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -272,7 +285,6 @@ def __eq__(self, other: object) -> bool:
)
-@type_checked
class Replacement:
"""Used to represent a single replacement.
@@ -304,6 +316,9 @@ def __str__(self):
f"hint={self.hint}]>"
)
+ def __hash__(self):
+ return hash((self.txrep_tx_field_name, self.reference_identifier, self.hint))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -314,7 +329,6 @@ def __eq__(self, other: object) -> bool:
)
-@type_checked
class TransactionStellarUri(StellarUri):
"""A request for a transaction to be signed.
@@ -473,6 +487,20 @@ def __str__(self):
f"origin_domain={self.origin_domain}, signature={self.signature}]>"
)
+ def __hash__(self):
+ return hash(
+ (
+ self.transaction_envelope,
+ self.replace,
+ self.callback,
+ self.pubkey,
+ self.msg,
+ self.network_passphrase,
+ self.origin_domain,
+ self.signature,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/sep/stellar_web_authentication.py b/stellar_sdk/sep/stellar_web_authentication.py
index d7ef67f31..f6442a75d 100644
--- a/stellar_sdk/sep/stellar_web_authentication.py
+++ b/stellar_sdk/sep/stellar_web_authentication.py
@@ -10,18 +10,17 @@
import base64
import os
import time
-from typing import Iterable, List, Optional, Union
+from typing import Iterable, List, Optional, Sequence, Union
from .. import xdr as stellar_xdr
from ..account import Account
-from ..exceptions import BadSignatureError, ValueError
+from ..exceptions import BadSignatureError
from ..keypair import Keypair
from ..memo import IdMemo, NoneMemo
from ..muxed_account import MuxedAccount
from ..operation.manage_data import ManageData
from ..transaction_builder import TransactionBuilder
from ..transaction_envelope import TransactionEnvelope
-from ..type_checked import type_checked
from .ed25519_public_key_signer import Ed25519PublicKeySigner
from .exceptions import InvalidSep10ChallengeError
@@ -34,11 +33,9 @@
"verify_challenge_transaction",
]
-
MUXED_ACCOUNT_STARTING_LETTER: str = "M"
-@type_checked
class ChallengeTransaction:
"""Used to store the results produced
by :func:`stellar_sdk.sep.stellar_web_authentication.read_challenge_transaction`.
@@ -61,6 +58,16 @@ def __init__(
self.matched_home_domain = matched_home_domain
self.memo = memo
+ def __hash__(self):
+ return hash(
+ (
+ self.transaction,
+ self.client_account_id,
+ self.matched_home_domain,
+ self.memo,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -75,7 +82,6 @@ def __str__(self):
return f""
-@type_checked
def build_challenge_transaction(
server_secret: str,
client_account_id: str,
@@ -142,7 +148,6 @@ def build_challenge_transaction(
return transaction.to_xdr()
-@type_checked
def read_challenge_transaction(
challenge_transaction: str,
server_account_id: str,
@@ -323,14 +328,13 @@ def read_challenge_transaction(
)
-@type_checked
def verify_challenge_transaction_signers(
challenge_transaction: str,
server_account_id: str,
home_domains: Union[str, Iterable[str]],
web_auth_domain: str,
network_passphrase: str,
- signers: List[Ed25519PublicKeySigner],
+ signers: Sequence[Ed25519PublicKeySigner],
) -> List[Ed25519PublicKeySigner]:
"""Verifies that for a SEP 10 challenge transaction
all signatures on the transaction are accounted for. A transaction is
@@ -436,7 +440,6 @@ def verify_challenge_transaction_signers(
return signers_found
-@type_checked
def verify_challenge_transaction_signed_by_client_master_key(
challenge_transaction: str,
server_account_id: str,
@@ -468,7 +471,6 @@ def verify_challenge_transaction_signed_by_client_master_key(
)
-@type_checked
def verify_challenge_transaction_threshold(
challenge_transaction: str,
server_account_id: str,
@@ -476,7 +478,7 @@ def verify_challenge_transaction_threshold(
web_auth_domain: str,
network_passphrase: str,
threshold: int,
- signers: List[Ed25519PublicKeySigner],
+ signers: Sequence[Ed25519PublicKeySigner],
) -> List[Ed25519PublicKeySigner]:
"""Verifies that for a SEP 10 challenge transaction
all signatures on the transaction are accounted for and that the signatures
@@ -519,7 +521,6 @@ def verify_challenge_transaction_threshold(
return signers_found
-@type_checked
def verify_challenge_transaction(
challenge_transaction: str,
server_account_id: str,
@@ -574,7 +575,7 @@ def verify_challenge_transaction(
def _verify_transaction_signatures(
- transaction_envelope: TransactionEnvelope, signers: List[Ed25519PublicKeySigner]
+ transaction_envelope: TransactionEnvelope, signers: Sequence[Ed25519PublicKeySigner]
) -> List[Ed25519PublicKeySigner]:
"""Checks if a transaction has been signed by one or more of
the signers, returning a list of signers that were found to have signed the
@@ -622,7 +623,7 @@ def _verify_te_signed_by_account_id(
def _signer_in_signers(
- signer: Ed25519PublicKeySigner, signers: List[Ed25519PublicKeySigner]
+ signer: Ed25519PublicKeySigner, signers: Sequence[Ed25519PublicKeySigner]
) -> bool:
for s in signers:
if s.account_id == signer.account_id:
diff --git a/stellar_sdk/sep/toid.py b/stellar_sdk/sep/toid.py
index 5d6c91603..0c0f08b4d 100644
--- a/stellar_sdk/sep/toid.py
+++ b/stellar_sdk/sep/toid.py
@@ -99,9 +99,14 @@ def after_ledger(cls, ledger_sequence: int) -> "TOID":
@staticmethod
def ledger_range_inclusive(start: int, end: int) -> Tuple[int, int]:
- """:return: The inclusive range representation between two
- ledgers inclusive. The second value points at the `end`+1 ledger so when using
- this value make sure < order is used."""
+ """The inclusive range representation between two
+ ledgers inclusive. The second value points at the end+1 ledger so when using
+ this value make sure < order is used.
+
+ :param start: The start ledger sequence.
+ :param end: The end ledger sequence.
+ :return: The inclusive range representation between two ledgers.
+ """
if start > end:
raise ValueError(
"Invalid `start` and `end` values, `start` must be less than or equal to `end`."
@@ -112,6 +117,11 @@ def ledger_range_inclusive(start: int, end: int) -> Tuple[int, int]:
toid_end = TOID(end + 1, 0, 0).to_int64()
return toid_start, toid_end
+ def __hash__(self):
+ return hash(
+ (self.ledger_sequence, self.transaction_order, self.operation_order)
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/sep/txrep.py b/stellar_sdk/sep/txrep.py
index 9ffdf0cfc..77fda36e7 100644
--- a/stellar_sdk/sep/txrep.py
+++ b/stellar_sdk/sep/txrep.py
@@ -10,7 +10,7 @@
from datetime import datetime
from decimal import Decimal
from enum import Enum
-from typing import Dict, List, Optional, Union
+from typing import Dict, List, Optional, Sequence, Union
from .. import xdr as stellar_xdr
from ..asset import Asset
@@ -33,7 +33,6 @@
from ..time_bounds import TimeBounds
from ..transaction import Transaction
from ..transaction_envelope import TransactionEnvelope
-from ..type_checked import type_checked
__all__ = ["to_txrep", "from_txrep"]
@@ -47,7 +46,6 @@ class _EnvelopeType(Enum):
ENVELOPE_TYPE_TX_FEE_BUMP = "ENVELOPE_TYPE_TX_FEE_BUMP"
-@type_checked
def to_txrep(
transaction_envelope: Union[TransactionEnvelope, FeeBumpTransactionEnvelope],
) -> str:
@@ -127,7 +125,8 @@ def to_txrep(
# Setting to ignore pass in .coveragerc will cause this function to not be counted by pytest.
-@type_checked
+
+
def from_txrep(
txrep: str, network_passphrase: str
) -> Union[TransactionEnvelope, FeeBumpTransactionEnvelope]:
@@ -1142,7 +1141,7 @@ def _add_signer_key(prefix: str, signer_key: SignerKey, lines: List[str]) -> Non
def _add_extra_signers(
- prefix: str, extra_signers: Optional[List[SignerKey]], lines: List[str]
+ prefix: str, extra_signers: Optional[Sequence[SignerKey]], lines: List[str]
) -> None:
if extra_signers is None:
extra_signers = []
@@ -1211,7 +1210,9 @@ def _add_memo(memo: Memo, prefix: str, lines: List[str]) -> None:
_add_line(f"{prefix}memo.retHash", _to_opaque(memo.memo_return), lines)
-def _add_operations(operations: List[Operation], prefix: str, lines: List[str]) -> None:
+def _add_operations(
+ operations: Sequence[Operation], prefix: str, lines: List[str]
+) -> None:
_add_line(f"{prefix}operations.len", len(operations), lines)
for index, operation in enumerate(operations):
_add_operation(index, operation, prefix, lines)
@@ -1645,7 +1646,7 @@ def add_claim_predicate(prefix: str, claimant_predicate: ClaimPredicate):
def _add_signatures(
- signatures: List[DecoratedSignature], prefix: str, lines: List[str]
+ signatures: Sequence[DecoratedSignature], prefix: str, lines: List[str]
) -> None:
_add_line(f"{prefix}signatures.len", len(signatures), lines)
for index, signature in enumerate(signatures):
diff --git a/stellar_sdk/server.py b/stellar_sdk/server.py
index 142a2f9c4..c60d64b61 100644
--- a/stellar_sdk/server.py
+++ b/stellar_sdk/server.py
@@ -16,13 +16,11 @@
from .muxed_account import MuxedAccount
from .transaction import Transaction
from .transaction_envelope import TransactionEnvelope
-from .type_checked import type_checked
from .utils import MUXED_ACCOUNT_STARTING_LETTER, urljoin_with_query
__all__ = ["Server"]
-@type_checked
class Server(BaseServer):
"""Server handles the network connection to a `Horizon `_
instance and exposes an interface for requests to that instance.
diff --git a/stellar_sdk/signer.py b/stellar_sdk/signer.py
index 3f1127242..8aa372f99 100644
--- a/stellar_sdk/signer.py
+++ b/stellar_sdk/signer.py
@@ -2,12 +2,10 @@
from . import xdr as stellar_xdr
from .signer_key import SignerKey
-from .type_checked import type_checked
__all__ = ["Signer"]
-@type_checked
class Signer:
"""The :class:`Signer` object, which represents an account signer on Stellar's network.
@@ -89,6 +87,9 @@ def from_xdr_object(cls, xdr_object: stellar_xdr.Signer) -> "Signer":
signer_key = SignerKey.from_xdr_object(xdr_object.key)
return cls(signer_key, weight)
+ def __hash__(self):
+ return hash((self.signer_key, self.weight))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/signer_key.py b/stellar_sdk/signer_key.py
index c045337a2..50d61407c 100644
--- a/stellar_sdk/signer_key.py
+++ b/stellar_sdk/signer_key.py
@@ -3,9 +3,7 @@
from . import xdr as stellar_xdr
from .__version__ import __issues__
-from .exceptions import ValueError
from .strkey import StrKey, _get_version_byte_for_prefix, _VersionByte
-from .type_checked import type_checked
__all__ = ["SignerKey", "SignerKeyType", "SignedPayloadSigner"]
@@ -17,7 +15,6 @@ class SignerKeyType(IntEnum):
SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3
-@type_checked
class SignedPayloadSigner:
"""The :class:`SignedPayloadSigner` object, which represents a signed payload signer.
@@ -29,6 +26,9 @@ def __init__(self, account_id: str, payload: bytes) -> None:
self.account_id: str = account_id
self.payload: bytes = payload
+ def __hash__(self):
+ return hash((self.account_id, self.payload))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -38,7 +38,6 @@ def __str__(self):
return f""
-@type_checked
class SignerKey:
"""The :class:`SignerKey` object, which represents an account signer key on Stellar's network.
@@ -243,6 +242,9 @@ def from_xdr_object(cls, xdr_object: stellar_xdr.SignerKey) -> "SignerKey":
f"This is an unknown signer key type, please consider creating an issuer at {__issues__}."
)
+ def __hash__(self):
+ return hash((self.signer_key, self.signer_key_type))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/soroban_data_builder.py b/stellar_sdk/soroban_data_builder.py
new file mode 100644
index 000000000..15e4d6e8d
--- /dev/null
+++ b/stellar_sdk/soroban_data_builder.py
@@ -0,0 +1,107 @@
+from __future__ import annotations
+
+from typing import List, Union
+
+from . import xdr as stellar_xdr
+
+__all__ = ["SorobanDataBuilder"]
+
+
+class SorobanDataBuilder:
+ """Supports building :class:`Memo ` structures
+ with various items set to specific values.
+
+ This is recommended for when you are building :class:`RestoreFootprint `,
+ :class:`BumpFootprintExpiration ` operations to avoid (re)building
+ the entire data structure from scratch.
+
+ By default, an empty instance will be created.
+ """
+
+ def __init__(self):
+ self._data = stellar_xdr.SorobanTransactionData(
+ ext=stellar_xdr.ExtensionPoint(0),
+ refundable_fee=stellar_xdr.Int64(0),
+ resources=stellar_xdr.SorobanResources(
+ footprint=stellar_xdr.LedgerFootprint(
+ read_only=[],
+ read_write=[],
+ ),
+ read_bytes=stellar_xdr.Uint32(0),
+ write_bytes=stellar_xdr.Uint32(0),
+ instructions=stellar_xdr.Uint32(0),
+ ),
+ )
+
+ @classmethod
+ def from_xdr(
+ cls, soroban_data: Union[str, stellar_xdr.SorobanTransactionData]
+ ) -> SorobanDataBuilder:
+ """Create a new :class:`SorobanDataBuilder` object from an XDR object.
+
+ :param soroban_data: The XDR object that represents a SorobanTransactionData.
+ :return: This builder.
+ """
+ data = cls()
+ if isinstance(soroban_data, str):
+ data._data = stellar_xdr.SorobanTransactionData.from_xdr(soroban_data)
+ else:
+ data._data = stellar_xdr.SorobanTransactionData.from_xdr_bytes(
+ soroban_data.to_xdr_bytes()
+ )
+ return data
+
+ def set_refundable_fee(self, fee: int) -> SorobanDataBuilder:
+ """Sets the "refundable" fee portion of the Soroban data.
+
+ :param fee: The refundable fee to set (int64)
+ :return: This builder.
+ """
+ self._data.refundable_fee = stellar_xdr.Int64(fee)
+ return self
+
+ def set_read_only(
+ self, read_only: List[stellar_xdr.LedgerKey]
+ ) -> SorobanDataBuilder:
+ """Sets the read-only portion of the storage access footprint to be a certain set of ledger keys.
+
+ :param read_only: The read-only ledger keys to set.
+ :return: This builder.
+ """
+ self._data.resources.footprint.read_only = read_only or []
+ return self
+
+ def set_read_write(
+ self, read_write: List[stellar_xdr.LedgerKey]
+ ) -> SorobanDataBuilder:
+ """Sets the read-write portion of the storage access footprint to be a certain set of ledger keys.
+
+ :param read_write: The read-write ledger keys to set.
+ :return: This builder.
+ """
+ self._data.resources.footprint.read_write = read_write or []
+ return self
+
+ def set_resources(
+ self, instructions: int, read_bytes: int, write_bytes: int
+ ) -> SorobanDataBuilder:
+ """Sets up the resource metrics.
+
+ You should almost NEVER need this, as its often generated / provided to you
+ by transaction simulation/preflight from a Soroban RPC server.
+
+ :param instructions: Number of CPU instructions (uint32)
+ :param read_bytes: Number of bytes being read (uint32)
+ :param write_bytes: Number of bytes being written (uint32)
+ :return: This builder.
+ """
+ self._data.resources.instructions = stellar_xdr.Uint32(instructions)
+ self._data.resources.read_bytes = stellar_xdr.Uint32(read_bytes)
+ self._data.resources.write_bytes = stellar_xdr.Uint32(write_bytes)
+ return self
+
+ def build(self):
+ """:return: a copy of the final data structure."""
+ return stellar_xdr.SorobanTransactionData.from_xdr_bytes(
+ self._data.to_xdr_bytes()
+ )
diff --git a/stellar_sdk/soroban_rpc.py b/stellar_sdk/soroban_rpc.py
new file mode 100644
index 000000000..a79f5d1b6
--- /dev/null
+++ b/stellar_sdk/soroban_rpc.py
@@ -0,0 +1,303 @@
+from datetime import datetime
+from enum import Enum
+from typing import Any, Dict, Generic, List, Optional, Sequence, TypeVar, Union
+
+from pydantic import BaseModel, ConfigDict, Field
+
+T = TypeVar("T")
+
+Id = Union[str, int]
+
+
+# JSON-RPC 2.0 definitions
+class Request(BaseModel, Generic[T]):
+ """Represent the request sent to Soroban-RPC.
+
+ See `JSON-RPC 2.0 Specification - Request object `__ for more information.
+ """
+
+ jsonrpc: str = "2.0"
+ id: Id
+ method: str
+ params: Optional[T] = None
+
+
+class Error(BaseModel):
+ code: int
+ message: Optional[str] = None
+ data: Optional[str] = None
+
+
+class Response(BaseModel, Generic[T]):
+ """Represent the response returned from Soroban-RPC.
+
+ See `JSON-RPC 2.0 Specification - Response object `__ for more information.
+ """
+
+ jsonrpc: str
+ id: Id
+ result: Optional[T] = None
+ error: Optional[Error] = None
+
+
+# get_events
+class EventFilterType(Enum):
+ SYSTEM = "system"
+ CONTRACT = "contract"
+ DIAGNOSTIC = "diagnostic"
+
+
+class EventFilter(BaseModel):
+ event_type: Optional[EventFilterType] = Field(alias="type", default=None)
+ contract_ids: Optional[Sequence[str]] = Field(alias="contractIds", default=None)
+ topics: Optional[Sequence[Sequence[str]]] = None
+ model_config = ConfigDict(populate_by_name=True)
+
+
+class EventInfoValue(BaseModel):
+ xdr: str
+
+
+class EventInfo(BaseModel):
+ event_type: str = Field(alias="type")
+ ledger: int = Field(alias="ledger")
+ ledger_close_at: datetime = Field(alias="ledgerClosedAt")
+ contract_id: str = Field(alias="contractId")
+ id: str = Field(alias="id")
+ paging_token: str = Field(alias="pagingToken")
+ topic: List[str] = Field(alias="topic")
+ value: EventInfoValue = Field(alias="value")
+ in_successful_contract_call: bool = Field(alias="inSuccessfulContractCall")
+
+
+class PaginationOptions(BaseModel):
+ cursor: Optional[str] = None
+ limit: Optional[int] = None
+
+
+class GetEventsRequest(BaseModel):
+ """Response for JSON-RPC method getEvents.
+
+ See `getEvents documentation `__ for
+ more information.
+ """
+
+ start_ledger: str = Field(alias="startLedger")
+ filters: Optional[Sequence[EventFilter]] = None
+ pagination: Optional[PaginationOptions] = None
+
+
+class GetEventsResponse(BaseModel):
+ """Response for JSON-RPC method getEvents.
+
+ See `getEvents documentation `__ for
+ more information.
+ """
+
+ events: List[EventInfo] = Field(alias="events")
+ latest_ledger: int = Field(alias="latestLedger")
+
+
+# get_ledger_entries
+class GetLedgerEntriesRequest(BaseModel):
+ """Response for JSON-RPC method getLedgerEntries.
+
+ See `getLedgerEntries documentation `__ for
+ more information."""
+
+ keys: Sequence[str]
+
+
+class LedgerEntryResult(BaseModel):
+ key: str
+ xdr: str
+ last_modified_ledger_seq: int = Field(alias="lastModifiedLedgerSeq")
+
+
+class GetLedgerEntriesResponse(BaseModel):
+ """Response for JSON-RPC method getLedgerEntries.
+
+ See `getLedgerEntries documentation `__ for
+ more information."""
+
+ entries: Optional[List[LedgerEntryResult]] = None
+ latest_ledger: int = Field(alias="latestLedger")
+
+
+# get_network
+class GetNetworkResponse(BaseModel):
+ """Response for JSON-RPC method getNetwork.
+
+ See `getNetwork documentation `__ for
+ more information."""
+
+ friendbot_url: Optional[str] = Field(alias="friendbotUrl", default=None)
+ passphrase: str
+ protocol_version: int = Field(alias="protocolVersion")
+
+
+# health
+class GetHealthResponse(BaseModel):
+ """Response for JSON-RPC method getHealth.
+
+ See `getHealth documentation `__ for
+ more information.
+ """
+
+ status: str
+
+
+# simulate_transaction
+class SimulateTransactionRequest(BaseModel):
+ """Response for JSON-RPC method simulateTransaction.
+
+ See `simulateTransaction documentation `__ for
+ more information.
+ """
+
+ transaction: str
+
+
+class SimulateTransactionCost(BaseModel):
+ cpu_insns: int = Field(alias="cpuInsns")
+ mem_bytes: int = Field(alias="memBytes")
+
+
+class SimulateTransactionResult(BaseModel):
+ auth: Optional[List[str]] = None
+ events: Optional[List[str]] = None
+ footprint: str
+ xdr: str
+
+
+class SimulateHostFunctionResult(BaseModel):
+ auth: Optional[List[str]] = None
+ xdr: str
+
+
+class RestorePreamble(BaseModel):
+ transaction_data: str = Field(alias="transactionData")
+ min_resource_fee: int = Field(alias="minResourceFee")
+
+
+class SimulateTransactionResponse(BaseModel):
+ """Response for JSON-RPC method simulateTransaction.
+
+ See `simulateTransaction documentation `__ for
+ more information."""
+
+ error: Optional[str] = None
+ transaction_data: Optional[str] = Field(alias="transactionData", default=None)
+ # SorobanTransactionData XDR in base64
+ min_resource_fee: Optional[int] = Field(alias="minResourceFee", default=None)
+ events: Optional[List[str]] = None
+ # DiagnosticEvent XDR in base64
+ results: Optional[List[SimulateHostFunctionResult]] = None
+ # an array of the individual host function call results.
+ # This will only contain a single element if present, because only a single invokeHostFunctionOperation
+ # is supported per transaction.
+ cost: Optional[SimulateTransactionCost] = None
+ # the effective cpu and memory cost of the invoked transaction execution.
+ restore_preamble: Optional[RestorePreamble] = Field(
+ alias="restorePreamble", default=None
+ )
+ # If present, it indicates that a prior RestoreFootprint is required
+ latest_ledger: int = Field(alias="latestLedger")
+
+
+# get_transaction_status
+class GetTransactionStatus(Enum):
+ SUCCESS = "SUCCESS"
+ """indicates the transaction was included in the ledger and it was executed without errors."""
+ NOT_FOUND = "NOT_FOUND"
+ """indicates the transaction was not found in Soroban-RPC's transaction store."""
+ FAILED = "FAILED"
+ """TransactionStatusFailed indicates the transaction was included in the ledger and it was executed with an error."""
+
+
+class TransactionResponseError(BaseModel):
+ code: str
+ message: str
+ data: Dict[str, Any]
+
+
+class GetTransactionRequest(BaseModel):
+ """Response for JSON-RPC method getTransaction.
+
+ See `getTransaction documentation `__ for
+ more information."""
+
+ hash: str
+
+
+class GetTransactionResponse(BaseModel):
+ """Response for JSON-RPC method getTransaction.
+
+ See `getTransaction documentation `__ for
+ more information."""
+
+ status: GetTransactionStatus
+ latest_ledger: int = Field(alias="latestLedger")
+ latest_ledger_close_time: int = Field(alias="latestLedgerCloseTime")
+ oldest_ledger: int = Field(alias="oldestLedger")
+ oldest_ledger_close_time: int = Field(alias="oldestLedgerCloseTime")
+ # The fields below are only present if Status is not TransactionStatus.NOT_FOUND.
+ application_order: Optional[int] = Field(alias="applicationOrder", default=None)
+ fee_bump: Optional[bool] = Field(alias="feeBump", default=None)
+ envelope_xdr: Optional[str] = Field(
+ alias="envelopeXdr", default=None
+ ) # stellar_sdk.xdr.TransactionEnvelope
+ result_xdr: Optional[str] = Field(
+ alias="resultXdr", default=None
+ ) # stellar_sdk.xdr.TransactionResult
+ result_meta_xdr: Optional[str] = Field(
+ alias="resultMetaXdr", default=None
+ ) # stellar_sdk.xdr.TransactionMeta
+ ledger: Optional[int] = Field(alias="ledger", default=None)
+ ledger_close_time: Optional[int] = Field(alias="ledgerCloseTime", default=None)
+
+
+# send_transaction
+class SendTransactionStatus(Enum):
+ ERROR = "ERROR"
+ """represents the status value returned by stellar-core when an error occurred from submitting a transaction"""
+ PENDING = "PENDING"
+ """represents the status value returned by stellar-core when a transaction has been accepted for processing"""
+ DUPLICATE = "DUPLICATE"
+ """represents the status value returned by stellar-core when a submitted transaction is a duplicate"""
+ TRY_AGAIN_LATER = "TRY_AGAIN_LATER"
+ """represents the status value returned by stellar-core when a submitted transaction was not included in the previous 4 ledgers and get banned for being added in the next few ledgers."""
+
+
+class SendTransactionRequest(BaseModel):
+ """Response for JSON-RPC method sendTransaction.
+
+ See `sendTransaction documentation `__ for
+ more information."""
+
+ transaction: str
+
+
+class SendTransactionResponse(BaseModel):
+ """Response for JSON-RPC method sendTransaction.
+
+ See `sendTransaction documentation `__ for
+ more information."""
+
+ error_result_xdr: Optional[str] = Field(alias="errorResultXdr", default=None)
+ status: SendTransactionStatus = Field(alias="status")
+ hash: str = Field(alias="hash")
+ latest_ledger: int = Field(alias="latestLedger")
+ latest_ledger_close_time: int = Field(alias="latestLedgerCloseTime")
+
+
+# get_latest_ledger
+class GetLatestLedgerResponse(BaseModel):
+ """Response for JSON-RPC method getLatestLedger.
+
+ See `getLatestLedger documentation `__ for
+ more information."""
+
+ id: str
+ protocol_version: int = Field(alias="protocolVersion")
+ sequence: int
diff --git a/stellar_sdk/soroban_server.py b/stellar_sdk/soroban_server.py
new file mode 100644
index 000000000..560b855fe
--- /dev/null
+++ b/stellar_sdk/soroban_server.py
@@ -0,0 +1,378 @@
+from __future__ import annotations
+
+import copy
+import json
+import uuid
+from typing import TYPE_CHECKING, Sequence, Type
+
+from . import Keypair
+from . import xdr as stellar_xdr
+from .account import Account
+from .address import Address
+from .client.requests_client import RequestsClient
+from .exceptions import (
+ AccountNotFoundException,
+ PrepareTransactionException,
+ SorobanRpcErrorResponse,
+)
+from .operation import InvokeHostFunction
+from .soroban_rpc import *
+
+if TYPE_CHECKING:
+ from .client.base_sync_client import BaseSyncClient
+ from .transaction_envelope import TransactionEnvelope
+
+__all__ = ["SorobanServer"]
+
+V = TypeVar("V")
+
+
+class Durability(Enum):
+ TEMPORARY = "temporary"
+ PERSISTENT = "persistent"
+
+
+class SorobanServer:
+ """Server handles the network connection to a Soroban RPC instance and
+ exposes an interface for requests to that instance.
+
+ :param server_url: Soroban RPC server URL. (ex. ``https://rpc-futurenet.stellar.org:443/``)
+ :param client: A client instance that will be used to make requests.
+ """
+
+ def __init__(
+ self,
+ server_url: str = "https://rpc-futurenet.stellar.org:443/",
+ client: Optional[BaseSyncClient] = None,
+ ) -> None:
+ self.server_url: str = server_url
+
+ if not client:
+ client = RequestsClient()
+ self._client: BaseSyncClient = client
+
+ def get_health(self) -> GetHealthResponse:
+ """General node health check.
+
+ See `Soroban Documentation - getHealth `_
+
+ :return: A :class:`GetHealthResponse ` object.
+ :raises: :exc:`SorobanRpcErrorResponse ` - If the Soroban-RPC instance returns an error response.
+ """
+ request: Request = Request(
+ id=_generate_unique_request_id(),
+ method="getHealth",
+ params=None,
+ )
+ return self._post(request, GetHealthResponse)
+
+ def get_events(
+ self,
+ start_ledger: int,
+ filters: Sequence[EventFilter] = None,
+ cursor: str = None,
+ limit: int = None,
+ ) -> GetEventsResponse:
+ """Fetch a list of events that occurred in the ledger range.
+
+ See `Soroban Documentation - getEvents `_
+
+ :param start_ledger: The first ledger to include in the results.
+ :param filters: A list of filters to apply to the results.
+ :param cursor: A cursor value for use in pagination.
+ :param limit: The maximum number of records to return.
+ :return: A :class:`GetEventsResponse ` object.
+ :raises: :exc:`SorobanRpcErrorResponse ` - If the Soroban-RPC instance returns an error response.
+ """
+ pagination = PaginationOptions(cursor=cursor, limit=limit)
+ data = GetEventsRequest(
+ startLedger=str(start_ledger),
+ filters=filters,
+ pagination=pagination,
+ )
+ request: Request = Request[GetEventsRequest](
+ id=_generate_unique_request_id(), method="getEvents", params=data
+ )
+ return self._post(request, GetEventsResponse)
+
+ def get_network(self) -> GetNetworkResponse:
+ """General info about the currently configured network.
+
+ :return: A :class:`GetNetworkResponse ` object.
+ :raises: :exc:`SorobanRpcErrorResponse ` - If the Soroban-RPC instance returns an error response.
+ """
+ request: Request = Request(
+ id=_generate_unique_request_id(),
+ method="getNetwork",
+ params=None,
+ )
+ return self._post(request, GetNetworkResponse)
+
+ def get_latest_ledger(self) -> GetLatestLedgerResponse:
+ """Fetches the latest ledger meta info from network which Soroban-RPC is connected to.
+
+ :return: A :class:`GetLatestLedgerResponse ` object.
+ :raises: :exc:`SorobanRpcErrorResponse ` - If the Soroban-RPC instance returns an error response.
+ """
+ request: Request = Request(
+ id=_generate_unique_request_id(),
+ method="getLatestLedger",
+ params=None,
+ )
+ return self._post(request, GetLatestLedgerResponse)
+
+ def get_ledger_entries(
+ self, keys: List[stellar_xdr.LedgerKey]
+ ) -> GetLedgerEntriesResponse:
+ """For reading the current value of ledger entries directly.
+
+ Allows you to directly inspect the current state of a contract, a contract's code,
+ or any other ledger entry. This is a backup way to access your contract data
+ which may not be available via events or simulateTransaction.
+
+ See `Soroban Documentation - getLedgerEntries `_
+
+ :param keys: The ledger keys to fetch.
+ :return: A :class:`GetLedgerEntriesResponse ` object.
+ :raises: :exc:`SorobanRpcErrorResponse ` - If the Soroban-RPC instance returns an error response.
+ """
+ request = Request[GetLedgerEntriesRequest](
+ id=_generate_unique_request_id(),
+ method="getLedgerEntries",
+ params=GetLedgerEntriesRequest(keys=[key.to_xdr() for key in keys]),
+ )
+ return self._post(request, GetLedgerEntriesResponse)
+
+ def get_transaction(self, transaction_hash: str) -> GetTransactionResponse:
+ """Fetch the specified transaction.
+
+ See `Soroban Documentation - getTransaction `_
+
+ :param transaction_hash: The hash of the transaction to fetch.
+ :return: A :class:`GetTransactionResponse ` object.
+ :raises: :exc:`SorobanRpcErrorResponse ` - If the Soroban-RPC instance returns an error response.
+ """
+ request = Request[GetTransactionRequest](
+ id=_generate_unique_request_id(),
+ method="getTransaction",
+ params=GetTransactionRequest(hash=transaction_hash),
+ )
+ return self._post(request, GetTransactionResponse)
+
+ def simulate_transaction(
+ self, transaction_envelope: TransactionEnvelope
+ ) -> SimulateTransactionResponse:
+ """Submit a trial contract invocation to get back return values, expected ledger footprint, and expected costs.
+
+ See `Soroban Documentation - simulateTransaction `_
+
+ :param transaction_envelope: The transaction to simulate. It should include exactly one operation,
+ which must be one of :class:`RestoreFootprint `,
+ :class:`InvokeHostFunction ` or
+ :class:`BumpFootprintExpiration ` operation.
+ Any provided footprint will be ignored.
+ :return: A :class:`SimulateTransactionResponse ` object
+ contains the cost, footprint, result/auth requirements (if applicable), and error of the transaction.
+ """
+ xdr = (
+ transaction_envelope
+ if isinstance(transaction_envelope, str)
+ else transaction_envelope.to_xdr()
+ )
+ request = Request[SimulateTransactionRequest](
+ id=_generate_unique_request_id(),
+ method="simulateTransaction",
+ params=SimulateTransactionRequest(transaction=xdr),
+ )
+ return self._post(request, SimulateTransactionResponse)
+
+ def send_transaction(
+ self, transaction_envelope: Union[TransactionEnvelope, str]
+ ) -> SendTransactionResponse:
+ """Submit a real transaction to the Stellar network. This is the only way to make changes "on-chain".
+
+ See `Soroban Documentation - sendTransaction `_
+
+ :param transaction_envelope: The transaction to send.
+ :return: A :class:`SendTransactionResponse ` object.
+ :raises: :exc:`SorobanRpcErrorResponse ` - If the Soroban-RPC instance returns an error response.
+ """
+ xdr = (
+ transaction_envelope
+ if isinstance(transaction_envelope, str)
+ else transaction_envelope.to_xdr()
+ )
+ request = Request[SendTransactionRequest](
+ id=_generate_unique_request_id(),
+ method="sendTransaction",
+ params=SendTransactionRequest(transaction=xdr),
+ )
+ return self._post(request, SendTransactionResponse)
+
+ def load_account(self, account_id: str) -> Account:
+ """Load an account from the server, you can use the returned account
+ object as source account for transactions.
+
+ :param account_id: The account ID.
+ :return: An :class:`Account ` object.
+ :raises: :exc:`AccountNotFoundException ` - If the account is not found on the network.
+ :raises: :exc:`SorobanRpcErrorResponse ` - If the Soroban-RPC instance returns an error response.
+ """
+ account_id_xdr = Keypair.from_public_key(account_id).xdr_account_id()
+ key = stellar_xdr.LedgerKey(
+ stellar_xdr.LedgerEntryType.ACCOUNT,
+ account=stellar_xdr.LedgerKeyAccount(account_id=account_id_xdr),
+ )
+
+ resp = self.get_ledger_entries([key])
+ if not resp.entries:
+ raise AccountNotFoundException(account_id)
+ assert len(resp.entries) == 1
+ data = stellar_xdr.LedgerEntryData.from_xdr(resp.entries[0].xdr)
+ assert data.account is not None
+ return Account(account_id, data.account.seq_num.sequence_number.int64)
+
+ def get_contract_data(
+ self,
+ contract_id: str,
+ key: stellar_xdr.SCVal,
+ durability: Durability = Durability.PERSISTENT,
+ ) -> Optional[LedgerEntryResult]:
+ """Reads the current value of contract data ledger entries directly.
+
+ :param contract_id: The contract ID containing the data to load. Encoded as Stellar Contract Address,
+ for example: ``"CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5"``
+ :param key: The key of the contract data to load.
+ :param durability: The "durability keyspace" that this ledger key belongs to, which is either
+ :class:`Durability.TEMPORARY` or :class:`Durability.PERSISTENT`. Defaults to :class:`Durability.PERSISTENT`.
+ :return: A :class:`LedgerEntryResult ` object contains the ledger entry result or ``None`` if not found.
+ :raises: :exc:`SorobanRpcErrorResponse ` - If the Soroban-RPC instance returns an error response.
+ """
+ sc_address = Address(contract_id).to_xdr_sc_address()
+ xdr_durability = (
+ stellar_xdr.ContractDataDurability.PERSISTENT
+ if durability == Durability.PERSISTENT
+ else stellar_xdr.ContractDataDurability.TEMPORARY
+ )
+ contract_key = stellar_xdr.LedgerKey(
+ stellar_xdr.LedgerEntryType.CONTRACT_DATA,
+ contract_data=stellar_xdr.LedgerKeyContractData(
+ contract=sc_address,
+ key=key,
+ durability=xdr_durability,
+ ),
+ )
+ resp = self.get_ledger_entries([contract_key])
+ entries = resp.entries
+ if not entries:
+ return None
+ return entries[0]
+
+ def prepare_transaction(
+ self,
+ transaction_envelope: TransactionEnvelope,
+ ) -> TransactionEnvelope:
+ """Submit a trial contract invocation, first run a simulation of the contract
+ invocation as defined on the incoming transaction, and apply the results to
+ a new copy of the transaction which is then returned. Setting the ledger
+ footprint and authorization, so the resulting transaction is ready for signing
+ and sending.
+
+ The returned transaction will also have an updated fee that is the sum of fee
+ set on incoming transaction with the contract resource fees estimated from
+ simulation. It is advisable to check the fee on returned transaction and validate
+ or take appropriate measures for interaction with user to confirm it is acceptable.
+
+ You can call the :meth:`simulate_transaction` method directly first if you
+ want to inspect estimated fees for a given transaction in detail first if that is
+ of importance.
+
+ :param transaction_envelope: The transaction to prepare. It should include exactly one operation, which
+ must be one of :py:class:`RestoreFootprint `,
+ :py:class:`BumpFootprintExpiration `,
+ or :py:class:`InvokeHostFunction `. Any provided
+ footprint will be ignored. You can use :meth:`stellar_sdk.Transaction.is_soroban_transaction` to check
+ if a transaction is a Soroban transaction. Any provided footprint will be overwritten.
+ However, if your operation has existing auth entries, they will be preferred over ALL auth
+ entries from the simulation. In other words, if you include auth entries, you don't care
+ about the auth returned from the simulation. Other fields (footprint, etc.) will be filled
+ as normal.
+ :return: A copy of the :class:`TransactionEnvelope `,
+ with the expected authorizations (in the case of invocation) and ledger footprint added.
+ The transaction fee will also automatically be padded with the contract's minimum resource fees
+ discovered from the simulation.
+ """
+ resp = self.simulate_transaction(transaction_envelope)
+ if resp.error:
+ raise PrepareTransactionException(
+ "Simulation transaction failed, the response contains error information.",
+ resp,
+ )
+ te = _assemble_transaction(transaction_envelope, resp)
+ return te
+
+ def close(self) -> None:
+ """Close underlying connector, and release all acquired resources."""
+ self._client.close()
+
+ def _post(self, request_body: Request, response_body_type: Type[V]) -> V:
+ json_data = request_body.model_dump_json(by_alias=True)
+ data = self._client.post(
+ self.server_url,
+ json_data=json.loads(json_data),
+ )
+ response = Response[response_body_type].model_validate(data.json()) # type: ignore[valid-type]
+ if response.error:
+ raise SorobanRpcErrorResponse(
+ response.error.code, response.error.message, response.error.data
+ )
+ return response.result # type: ignore[return-value]
+
+ def __enter__(self) -> "SorobanServer":
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self.close()
+
+ def __str__(self):
+ return f""
+
+
+def _generate_unique_request_id() -> str:
+ return uuid.uuid4().hex
+
+
+def _assemble_transaction(
+ transaction_envelope: TransactionEnvelope,
+ simulation: SimulateTransactionResponse,
+) -> TransactionEnvelope:
+ # TODO: add support for FeeBumpTransactionEnvelope
+ if not transaction_envelope.transaction.is_soroban_transaction():
+ raise ValueError(
+ "Unsupported transaction: must contain exactly one operation of "
+ "type RestoreFootprint, InvokeHostFunction or BumpFootprintExpiration"
+ )
+
+ min_resource_fee = simulation.min_resource_fee
+ assert simulation.transaction_data is not None
+ soroban_data = stellar_xdr.SorobanTransactionData.from_xdr(
+ simulation.transaction_data
+ )
+ te = copy.deepcopy(transaction_envelope)
+ te.signatures = []
+ assert min_resource_fee is not None
+ te.transaction.fee += min_resource_fee
+ te.transaction.soroban_data = soroban_data
+
+ op = te.transaction.operations[0]
+
+ if isinstance(op, InvokeHostFunction):
+ if not simulation.results or len(simulation.results) != 1:
+ raise ValueError(f"Simulation results invalid: {simulation.results}")
+
+ if not op.auth and simulation.results[0].auth:
+ op.auth = [
+ stellar_xdr.SorobanAuthorizationEntry.from_xdr(xdr)
+ for xdr in simulation.results[0].auth
+ ]
+ return te
diff --git a/stellar_sdk/strkey.py b/stellar_sdk/strkey.py
index 877d11783..2b3ebfcb3 100644
--- a/stellar_sdk/strkey.py
+++ b/stellar_sdk/strkey.py
@@ -2,6 +2,7 @@
import binascii
import struct
from enum import Enum
+
from xdrlib3 import Packer, Unpacker
from . import xdr as stellar_xdr
@@ -9,10 +10,7 @@
Ed25519PublicKeyInvalidError,
Ed25519SecretSeedInvalidError,
MuxedEd25519AccountInvalidError,
- TypeError,
- ValueError,
)
-from .type_checked import type_checked
__all__ = ["StrKey"]
@@ -24,9 +22,9 @@ class _VersionByte(Enum):
SHA256_HASH = binascii.a2b_hex("b8") # X 184 23 << 3
MUXED_ACCOUNT = binascii.a2b_hex("60") # M 96 12 << 3
ED25519_SIGNED_PAYLOAD = binascii.a2b_hex("78") # P 120 15 << 3
+ CONTRACT = binascii.a2b_hex("10") # C 16 2 << 3
-@type_checked
class StrKey:
"""StrKey is a helper class that allows encoding and decoding strkey."""
@@ -257,8 +255,41 @@ def is_valid_ed25519_signed_payload(ed25519_signed_payload: str) -> bool:
"""
return _is_valid(_VersionByte.ED25519_SIGNED_PAYLOAD, ed25519_signed_payload)
+ @staticmethod
+ def encode_contract(data: bytes) -> str:
+ """Encodes data to encoded contract strkey.
+
+ :param data: data to encode
+ :return: encoded contract strkey
+ :raises:
+ :exc:`ValueError `
+ """
+ return _encode_check(_VersionByte.CONTRACT, data)
+
+ @staticmethod
+ def decode_contract(data: str) -> bytes:
+ """Decodes encoded contract strkey to raw data.
+
+ :param data: encoded contract strkey
+ :return: raw bytes
+ :raises:
+ :exc:`ValueError `
+ """
+ try:
+ return _decode_check(_VersionByte.CONTRACT, data)
+ except Exception as e:
+ raise ValueError(f"Invalid Pre Auth Tx Key: {data}") from e
+
+ @staticmethod
+ def is_valid_contract(contract: str) -> bool:
+ """Returns ``True`` if the given `contract` is a valid encoded contract strkey.
+
+ :param pre_auth_tx: encoded contract strkey
+ :return: ``True`` if the given key is valid
+ """
+ return _is_valid(_VersionByte.CONTRACT, contract)
+
-@type_checked
def _decode_check(version_byte: _VersionByte, encoded: str) -> bytes:
encoded_data = encoded.encode("ascii")
encoded_data = encoded_data + b"=" * ((8 - len(encoded_data) % 8) % 8)
@@ -305,14 +336,12 @@ def _decode_check(version_byte: _VersionByte, encoded: str) -> bytes:
return data
-@type_checked
def _encode_check(version_byte: _VersionByte, data: bytes) -> str:
payload = version_byte.value + data
crc = _calculate_checksum(payload)
return base64.b32encode(payload + crc).decode("utf-8").rstrip("=")
-@type_checked
def _is_valid(version_byte: _VersionByte, encoded: str) -> bool:
try:
_decode_check(version_byte, encoded)
@@ -321,14 +350,12 @@ def _is_valid(version_byte: _VersionByte, encoded: str) -> bool:
return True
-@type_checked
def _get_version_byte_for_prefix(encoded: str) -> _VersionByte:
prefix = encoded[0]
_version_byte = ((ord(prefix) - ord("A")) << 3).to_bytes(1, byteorder="big")
return _VersionByte(_version_byte)
-@type_checked
def _calculate_checksum(payload: bytes) -> bytes:
# memo note: https://gist.github.com/manran/a8357808ef71415d266dc64f0079f298
# This code calculates CRC16-XModem checksum of payload
diff --git a/stellar_sdk/time_bounds.py b/stellar_sdk/time_bounds.py
index 9b251c83f..398af54a9 100644
--- a/stellar_sdk/time_bounds.py
+++ b/stellar_sdk/time_bounds.py
@@ -1,11 +1,8 @@
from . import xdr as stellar_xdr
-from .exceptions import ValueError
-from .type_checked import type_checked
__all__ = ["TimeBounds"]
-@type_checked
class TimeBounds:
"""TimeBounds represents the time interval that a transaction is valid.
@@ -59,6 +56,9 @@ def from_xdr_object(cls, xdr_object: stellar_xdr.TimeBounds) -> "TimeBounds":
max_time=xdr_object.max_time.time_point.uint64,
)
+ def __hash__(self):
+ return hash((self.min_time, self.max_time))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/transaction.py b/stellar_sdk/transaction.py
index 7e9a13b02..95a8c8e94 100644
--- a/stellar_sdk/transaction.py
+++ b/stellar_sdk/transaction.py
@@ -1,21 +1,21 @@
-from typing import List, Optional, Union
+from typing import List, Optional, Sequence, Union
from . import xdr as stellar_xdr
from .keypair import Keypair
from .memo import Memo, NoneMemo
from .muxed_account import MuxedAccount
+from .operation import BumpFootprintExpiration, InvokeHostFunction, RestoreFootprint
from .operation.create_claimable_balance import CreateClaimableBalance
from .operation.operation import Operation
from .preconditions import Preconditions
+from .soroban_data_builder import SorobanDataBuilder
from .strkey import StrKey
from .time_bounds import TimeBounds
-from .type_checked import type_checked
from .utils import sha256
__all__ = ["Transaction"]
-@type_checked
class Transaction:
"""The :class:`Transaction` object, which represents a transaction(Transaction or TransactionV0)
on Stellar's network.
@@ -48,6 +48,8 @@ class Transaction:
:param memo: The memo being sent with the transaction, being
represented as one of the subclasses of the
:class:`Memo ` object.
+ :param soroban_data: The soroban data being sent with the transaction, being represented as
+ :class:`SorobanTransactionData `.
:param v1: When this value is set to ``True``, V1 transactions will be generated,
otherwise V0 transactions will be generated.
See `CAP-0015 `__ for more information.
@@ -58,12 +60,12 @@ def __init__(
source: Union[MuxedAccount, Keypair, str],
sequence: int,
fee: int,
- operations: List[Operation],
+ operations: Sequence[Operation],
memo: Memo = None,
preconditions: Preconditions = None,
+ soroban_data: stellar_xdr.SorobanTransactionData = None,
v1: bool = True,
) -> None:
-
# if not operations:
# raise ValueError("At least one operation required.")
@@ -81,10 +83,13 @@ def __init__(
self.source: MuxedAccount = source
self.sequence: int = sequence
- self.operations: List[Operation] = operations
+ self.operations: List[Operation] = list(operations) if operations else []
self.memo: Memo = memo
self.fee: int = fee
self.preconditions: Optional[Preconditions] = preconditions
+ self.soroban_data: Optional[stellar_xdr.SorobanTransactionData] = (
+ SorobanDataBuilder.from_xdr(soroban_data).build() if soroban_data else None
+ )
self.v1: bool = v1
def get_claimable_balance_id(self, operation_index: int) -> str:
@@ -160,7 +165,14 @@ def to_xdr_object(
else Preconditions().to_xdr_object()
)
source_xdr = self.source.to_xdr_object()
- ext = stellar_xdr.TransactionExt(0)
+ if self.soroban_data:
+ ext = stellar_xdr.TransactionExt(
+ 1,
+ self.soroban_data,
+ )
+ else:
+ ext = stellar_xdr.TransactionExt(0)
+
return stellar_xdr.Transaction(
source_xdr,
fee,
@@ -187,6 +199,7 @@ def from_xdr_object(
:return: A new :class:`Transaction` object from the given XDR Transaction object.
"""
+ soroban_data = None
if v1:
assert isinstance(xdr_object, stellar_xdr.Transaction)
source = MuxedAccount.from_xdr_object(xdr_object.source_account)
@@ -194,6 +207,8 @@ def from_xdr_object(
preconditions = None
else:
preconditions = Preconditions.from_xdr_object(xdr_object.cond)
+ if xdr_object.ext.v == 1:
+ soroban_data = xdr_object.ext.soroban_data
else:
assert isinstance(xdr_object, stellar_xdr.TransactionV0)
ed25519_key = StrKey.encode_ed25519_public_key(
@@ -210,6 +225,7 @@ def from_xdr_object(
fee = xdr_object.fee.uint32
memo = Memo.from_xdr_object(xdr_object.memo)
operations = list(map(Operation.from_xdr_object, xdr_object.operations))
+
tx = cls(
source=source,
sequence=sequence,
@@ -217,6 +233,7 @@ def from_xdr_object(
fee=fee,
operations=operations,
preconditions=preconditions,
+ soroban_data=soroban_data,
v1=v1,
)
return tx
@@ -239,14 +256,47 @@ def from_xdr(cls, xdr: str, v1: bool = True) -> "Transaction":
xdr_object_v0 = stellar_xdr.TransactionV0.from_xdr(xdr)
return cls.from_xdr_object(xdr_object_v0, v1)
+ def is_soroban_transaction(self) -> bool:
+ if len(self.operations) != 1:
+ return False
+ if not isinstance(
+ self.operations[0],
+ (RestoreFootprint, InvokeHostFunction, BumpFootprintExpiration),
+ ):
+ return False
+ return True
+
+ def __hash__(self):
+ return hash(
+ (
+ self.source,
+ self.sequence,
+ self.fee,
+ self.operations,
+ self.memo,
+ self.preconditions,
+ self.soroban_data,
+ self.v1,
+ )
+ )
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
- return self.to_xdr_object() == other.to_xdr_object()
+ return (
+ self.source == other.source
+ and self.sequence == other.sequence
+ and self.fee == other.fee
+ and self.operations == other.operations
+ and self.memo == other.memo
+ and self.preconditions == other.preconditions
+ and self.soroban_data == other.soroban_data
+ and self.v1 == other.v1
+ )
def __str__(self):
return (
f""
+ f"preconditions={self.preconditions}, soroban_data={self.soroban_data}, v1={self.v1}]>"
)
diff --git a/stellar_sdk/transaction_builder.py b/stellar_sdk/transaction_builder.py
index 137f0bb0c..edee54466 100644
--- a/stellar_sdk/transaction_builder.py
+++ b/stellar_sdk/transaction_builder.py
@@ -1,12 +1,15 @@
+import binascii
+import os
import time
import warnings
from decimal import Decimal
-from typing import List, Optional, Union
+from typing import List, Optional, Sequence, Union
+from . import StrKey
from . import xdr as stellar_xdr
from .account import Account
+from .address import Address
from .asset import Asset
-from .exceptions import ValueError
from .fee_bump_transaction import FeeBumpTransaction
from .fee_bump_transaction_envelope import FeeBumpTransactionEnvelope
from .keypair import Keypair
@@ -21,16 +24,15 @@
from .price import Price
from .signer import Signer
from .signer_key import SignedPayloadSigner, SignerKey
+from .soroban_data_builder import SorobanDataBuilder
from .time_bounds import TimeBounds
from .transaction import Transaction
from .transaction_envelope import TransactionEnvelope
-from .type_checked import type_checked
from .utils import hex_to_bytes, is_valid_hash
__all__ = ["TransactionBuilder"]
-@type_checked
class TransactionBuilder:
"""Transaction builder helps constructs a new :class:`TransactionEnvelope
` using the given
@@ -110,6 +112,8 @@ def __init__(
self.memo: Memo = NoneMemo()
self.v1: bool = v1
+ self.soroban_data: Optional[stellar_xdr.SorobanTransactionData] = None
+
def build(self) -> TransactionEnvelope:
"""This will build the transaction envelope.
It will also increment the source account's sequence number by 1.
@@ -123,6 +127,7 @@ def build(self) -> TransactionEnvelope:
"You can learn why you should set it up through this link: "
"https://www.stellar.org/developers-blog/transaction-submission-timeouts-and-dynamic-fees-faq"
)
+
source = self.source_account.account
sequence = self.source_account.sequence + 1
preconditions = Preconditions(
@@ -140,6 +145,7 @@ def build(self) -> TransactionEnvelope:
operations=self.operations,
memo=self.memo,
preconditions=preconditions,
+ soroban_data=self.soroban_data,
v1=self.v1,
)
transaction_envelope = TransactionEnvelope(
@@ -234,6 +240,7 @@ def from_xdr(
)
transaction_builder.operations = transaction_envelope.transaction.operations
transaction_builder.memo = transaction_envelope.transaction.memo
+ transaction_builder.soroban_data = transaction_envelope.transaction.soroban_data
return transaction_builder
def add_time_bounds(self, min_time: int, max_time: int) -> "TransactionBuilder":
@@ -342,6 +349,22 @@ def set_min_sequence_ledger_gap(
self.min_sequence_ledger_gap = min_sequence_ledger_gap
return self
+ def set_soroban_data(
+ self, soroban_data: Union[stellar_xdr.SorobanTransactionData, str]
+ ) -> "TransactionBuilder":
+ """Set the SorobanTransactionData. For non-contract(non-Soroban) transactions, this setting has no effect.
+
+ In the case of Soroban transactions, set to an instance of
+ SorobanTransactionData. This can typically be obtained from the simulation
+ response based on a transaction with a InvokeHostFunctionOp.
+ It provides necessary resource estimations for contract invocation.
+
+ :param soroban_data: The SorobanTransactionData as XDR object or base64 encoded string.
+ :return: This builder instance.
+ """
+ self.soroban_data = SorobanDataBuilder.from_xdr(soroban_data).build()
+ return self
+
def add_extra_signer(
self, signer_key: Union[SignerKey, SignedPayloadSigner, str]
) -> "TransactionBuilder":
@@ -502,7 +525,7 @@ def append_path_payment_strict_receive_op(
send_max: Union[str, Decimal],
dest_asset: Asset,
dest_amount: Union[str, Decimal],
- path: List[Asset],
+ path: Sequence[Asset],
source: Optional[Union[MuxedAccount, str]] = None,
) -> "TransactionBuilder":
"""Append a :class:`PathPaymentStrictReceive `
@@ -537,7 +560,7 @@ def append_path_payment_strict_send_op(
send_amount: Union[str, Decimal],
dest_asset: Asset,
dest_min: Union[str, Decimal],
- path: List[Asset],
+ path: Sequence[Asset],
source: Optional[Union[MuxedAccount, str]] = None,
) -> "TransactionBuilder":
"""Append a :class:`PathPaymentStrictSend `
@@ -886,7 +909,7 @@ def append_create_claimable_balance_op(
self,
asset: Asset,
amount: Union[str, Decimal],
- claimants: List[Claimant],
+ claimants: Sequence[Claimant],
source: Optional[Union[MuxedAccount, str]] = None,
) -> "TransactionBuilder":
"""Append a :class:`CreateClaimableBalance `
@@ -1042,7 +1065,7 @@ def append_revoke_ed25519_public_key_signer_sponsorship_op(
source: Optional[Union[MuxedAccount, str]] = None,
) -> "TransactionBuilder":
"""Append a :class:`RevokeSponsorship ` operation
- for a ed25519_public_key signer to the list of operations.
+ for an ed25519_public_key signer to the list of operations.
:param account_id: The account ID where the signer sponsorship is being removed from.
:param signer_key: The account id of the ed25519_public_key signer.
@@ -1203,6 +1226,218 @@ def append_liquidity_pool_withdraw_op(
)
return self.append_operation(op)
+ def append_invoke_contract_function_op(
+ self,
+ contract_id: str,
+ function_name: str,
+ parameters: Sequence[stellar_xdr.SCVal],
+ auth: Sequence[stellar_xdr.SorobanAuthorizationEntry] = None,
+ source: Optional[Union[MuxedAccount, str]] = None,
+ ) -> "TransactionBuilder":
+ """Append an :class:`HostFunction ` operation to the list of operations.
+
+ You can use this method to invoke a contract function.
+
+ :param contract_id: The ID of the contract to invoke.
+ :param function_name: The name of the function to invoke.
+ :param parameters: The parameters to pass to the method.
+ :param auth: The authorizations required to execute the host function.
+ :param source: The source account for the operation. Defaults to the
+ transaction's source account.
+ :return: This builder instance.
+ """
+ if not StrKey.is_valid_contract(contract_id):
+ raise ValueError("`contract_id` is invalid.")
+
+ host_function = stellar_xdr.HostFunction(
+ stellar_xdr.HostFunctionType.HOST_FUNCTION_TYPE_INVOKE_CONTRACT,
+ invoke_contract=stellar_xdr.InvokeContractArgs(
+ contract_address=Address(contract_id).to_xdr_sc_address(),
+ function_name=stellar_xdr.SCSymbol(
+ sc_symbol=function_name.encode("utf-8")
+ ),
+ args=list(parameters),
+ ),
+ )
+ op = InvokeHostFunction(host_function=host_function, auth=auth, source=source)
+ return self.append_operation(op)
+
+ def append_upload_contract_wasm_op(
+ self,
+ contract: Union[bytes, str],
+ source: Optional[Union[MuxedAccount, str]] = None,
+ ) -> "TransactionBuilder":
+ """Append an :class:`HostFunction ` operation to the list of operations.
+
+ You can use this method to install a contract code,
+ and then use :func:`append_create_contract_op` to create a contract.
+
+ :param contract: The contract code to install, path to a file or bytes.
+ :param source: The source account for the operation. Defaults to the
+ transaction's source account.
+ :return: This builder instance.
+ """
+
+ if isinstance(contract, str):
+ with open(contract, "rb") as f:
+ contract = f.read()
+
+ host_function = stellar_xdr.HostFunction(
+ stellar_xdr.HostFunctionType.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM,
+ wasm=contract,
+ )
+ op = InvokeHostFunction(host_function=host_function, auth=[], source=source)
+ return self.append_operation(op)
+
+ def append_create_contract_op(
+ self,
+ wasm_id: Union[bytes, str],
+ address: Union[str, Address],
+ salt: Optional[bytes] = None,
+ auth: Sequence[stellar_xdr.SorobanAuthorizationEntry] = None,
+ source: Optional[Union[MuxedAccount, str]] = None,
+ ) -> "TransactionBuilder":
+ """Append an :class:`HostFunction ` operation to the list of operations.
+
+ You can use this method to create a contract.
+
+ :param wasm_id: The ID of the contract code to install.
+ :param address: The address using to derive the contract ID.
+ :param salt: The 32-byte salt to use to derive the contract ID.
+ :param auth: The authorizations required to execute the host function.
+ :param source: The source account for the operation. Defaults to the
+ transaction's source account.
+ :return: This builder instance.
+ """
+ if isinstance(wasm_id, str):
+ wasm_id = binascii.unhexlify(wasm_id)
+
+ if salt is None:
+ salt = os.urandom(32)
+ else:
+ if len(salt) != 32:
+ raise ValueError("`salt` must be 32 bytes long")
+
+ if isinstance(address, str):
+ address = Address(address)
+
+ create_contract = stellar_xdr.CreateContractArgs(
+ contract_id_preimage=stellar_xdr.ContractIDPreimage(
+ stellar_xdr.ContractIDPreimageType.CONTRACT_ID_PREIMAGE_FROM_ADDRESS,
+ from_address=stellar_xdr.ContractIDPreimageFromAddress(
+ address=address.to_xdr_sc_address(),
+ salt=stellar_xdr.Uint256(salt),
+ ),
+ ),
+ executable=stellar_xdr.ContractExecutable(
+ stellar_xdr.ContractExecutableType.CONTRACT_EXECUTABLE_WASM,
+ stellar_xdr.Hash(wasm_id),
+ ),
+ )
+
+ host_function = stellar_xdr.HostFunction(
+ stellar_xdr.HostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT,
+ create_contract=create_contract,
+ )
+
+ op = InvokeHostFunction(host_function=host_function, auth=auth, source=source)
+ return self.append_operation(op)
+
+ def append_create_token_contract_from_asset_op(
+ self,
+ asset: Asset,
+ source: Optional[Union[MuxedAccount, str]] = None,
+ ) -> "TransactionBuilder":
+ """Append an :class:`HostFunction ` operation to the list of operations.
+
+ You can use this method to deploy a contract that wraps a classic asset.
+
+ :param asset: The asset to wrap.
+ :param source: The source account for the operation. Defaults to the
+ transaction's source account.
+ :return: This builder instance.
+ """
+ asset_param = asset.to_xdr_object()
+
+ create_contract = stellar_xdr.CreateContractArgs(
+ contract_id_preimage=stellar_xdr.ContractIDPreimage(
+ stellar_xdr.ContractIDPreimageType.CONTRACT_ID_PREIMAGE_FROM_ASSET,
+ from_asset=asset_param,
+ ),
+ executable=stellar_xdr.ContractExecutable(
+ stellar_xdr.ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN,
+ ),
+ )
+
+ host_function = stellar_xdr.HostFunction(
+ stellar_xdr.HostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT,
+ create_contract=create_contract,
+ )
+
+ op = InvokeHostFunction(host_function=host_function, auth=[], source=source)
+ return self.append_operation(op)
+
+ def append_create_token_contract_from_address_op(
+ self,
+ address: Union[str, Address],
+ salt: Optional[bytes] = None,
+ auth: Sequence[stellar_xdr.SorobanAuthorizationEntry] = None,
+ source: Optional[Union[MuxedAccount, str]] = None,
+ ) -> "TransactionBuilder":
+ """Append an :class:`HostFunction ` operation to the list of operations.
+
+ You can use this method to create a new Soroban token contract.
+
+ I do not recommend using this method, please check
+ `the documentation `__ for more information.
+
+ :param address: The address using to derive the contract ID.
+ :param salt: The 32-byte salt to use to derive the contract ID.
+ :param auth: The authorizations required to execute the host function.
+ :param source: The source account for the operation. Defaults to the
+ transaction's source account.
+ :return: This builder instance.
+ """
+ if salt is None:
+ salt = os.urandom(32)
+ else:
+ if len(salt) != 32:
+ raise ValueError("`salt` must be 32 bytes long")
+
+ if isinstance(address, str):
+ address = Address(address)
+
+ create_contract = stellar_xdr.CreateContractArgs(
+ contract_id_preimage=stellar_xdr.ContractIDPreimage(
+ stellar_xdr.ContractIDPreimageType.CONTRACT_ID_PREIMAGE_FROM_ADDRESS,
+ from_address=stellar_xdr.ContractIDPreimageFromAddress(
+ address=address.to_xdr_sc_address(),
+ salt=stellar_xdr.Uint256(salt),
+ ),
+ ),
+ executable=stellar_xdr.ContractExecutable(
+ stellar_xdr.ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN,
+ ),
+ )
+
+ host_function = stellar_xdr.HostFunction(
+ stellar_xdr.HostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT,
+ create_contract=create_contract,
+ )
+
+ op = InvokeHostFunction(host_function=host_function, auth=auth, source=source)
+ return self.append_operation(op)
+
+ def append_bump_footprint_expiration_op(
+ self, ledgers_to_expire: int, source: Optional[Union[MuxedAccount, str]] = None
+ ) -> "TransactionBuilder":
+ op = BumpFootprintExpiration(ledgers_to_expire=ledgers_to_expire, source=source)
+ return self.append_operation(op)
+
+ def append_restore_footprint_op(self):
+ op = RestoreFootprint()
+ return self.append_operation(op)
+
def __str__(self):
return (
f""
)
diff --git a/stellar_sdk/transaction_envelope.py b/stellar_sdk/transaction_envelope.py
index 628f6d360..9d342065c 100644
--- a/stellar_sdk/transaction_envelope.py
+++ b/stellar_sdk/transaction_envelope.py
@@ -1,5 +1,6 @@
import copy
-from typing import List, Union
+from typing import Sequence, Union
+
from xdrlib3 import Packer
from . import xdr as stellar_xdr
@@ -9,12 +10,10 @@
from .keypair import Keypair
from .signer_key import SignerKeyType
from .transaction import Transaction
-from .type_checked import type_checked
__all__ = ["TransactionEnvelope"]
-@type_checked
class TransactionEnvelope(BaseTransactionEnvelope["TransactionEnvelope"]):
"""The :class:`TransactionEnvelope` object, which represents a transaction
envelope ready to sign and submit to send over the network.
@@ -35,7 +34,7 @@ def __init__(
self,
transaction: Transaction,
network_passphrase: str,
- signatures: List[DecoratedSignature] = None,
+ signatures: Sequence[DecoratedSignature] = None,
) -> None:
super().__init__(network_passphrase, signatures)
self.transaction: Transaction = transaction
@@ -152,10 +151,17 @@ def from_xdr_object(
te = cls(tx, network_passphrase=network_passphrase, signatures=signatures)
return te
+ def __hash__(self):
+ return hash((self.transaction, self.network_passphrase, self.signatures))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
- return self.to_xdr_object() == other.to_xdr_object()
+ return (
+ self.transaction == other.transaction
+ and self.network_passphrase == other.network_passphrase
+ and self.signatures == other.signatures
+ )
def __str__(self):
return (
diff --git a/stellar_sdk/type_checked.py b/stellar_sdk/type_checked.py
deleted file mode 100644
index 1ac17e1f5..000000000
--- a/stellar_sdk/type_checked.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import os
-from typing import Callable, overload
-
-from typeguard import T_CallableOrType
-from typeguard import typechecked as _typechecked
-
-_STELLAR_SDK_RUNTIME_TYPE_CHECKING_FLAG: str = "STELLAR_SDK_RUNTIME_TYPE_CHECKING"
-_STELLAR_SDK_RUNTIME_TYPE_CHECKING: bool = os.getenv(
- _STELLAR_SDK_RUNTIME_TYPE_CHECKING_FLAG, "True"
-).lower() in ("true", "1", "t")
-
-
-@overload
-def type_checked() -> Callable[[T_CallableOrType], T_CallableOrType]:
- ...
-
-
-@overload
-def type_checked(func: T_CallableOrType) -> T_CallableOrType:
- ...
-
-
-def type_checked(
- func=None,
-):
- if _STELLAR_SDK_RUNTIME_TYPE_CHECKING:
- return _typechecked(func=func)
- else:
- return func
diff --git a/stellar_sdk/utils.py b/stellar_sdk/utils.py
index 8684b58c0..eeb467c81 100644
--- a/stellar_sdk/utils.py
+++ b/stellar_sdk/utils.py
@@ -5,13 +5,12 @@
import os
import re
from decimal import ROUND_FLOOR, Context, Decimal, Inexact
-from typing import Dict, List, Optional, Union
+from typing import Dict, Optional, Sequence, Union
from urllib.parse import urlsplit, urlunsplit
from .asset import Asset
-from .exceptions import Ed25519PublicKeyInvalidError, NoApproximationError, ValueError
+from .exceptions import Ed25519PublicKeyInvalidError, NoApproximationError
from .strkey import StrKey
-from .type_checked import type_checked
MUXED_ACCOUNT_STARTING_LETTER: str = "M"
ED25519_PUBLIC_KEY_STARTING_LETTER: str = "G"
@@ -21,12 +20,10 @@
_ONE = Decimal(10**7)
-@type_checked
def sha256(data: bytes) -> bytes:
return hashlib.sha256(data).digest()
-@type_checked
def best_rational_approximation(x) -> Dict[str, int]:
x = Decimal(x)
int32_max = Decimal(2147483647)
@@ -53,15 +50,13 @@ def best_rational_approximation(x) -> Dict[str, int]:
return {"n": int(n), "d": int(d)}
-@type_checked
def hex_to_bytes(hex_string: Union[str, bytes]) -> bytes:
if isinstance(hex_string, str):
return bytes.fromhex(hex_string)
return hex_string
-@type_checked
-def convert_assets_to_horizon_param(assets: List[Asset]) -> str:
+def convert_assets_to_horizon_param(assets: Sequence[Asset]) -> str:
assets_string = []
for asset in assets:
if asset.is_native():
@@ -71,7 +66,6 @@ def convert_assets_to_horizon_param(assets: List[Asset]) -> str:
return ",".join(assets_string)
-@type_checked
def urljoin_with_query(base: str, path: Optional[str]) -> str:
split_url = urlsplit(base)
query = split_url.query
@@ -84,7 +78,6 @@ def urljoin_with_query(base: str, path: Optional[str]) -> str:
return url
-@type_checked
def is_valid_hash(data: str) -> bool:
if not data:
return False
@@ -92,7 +85,6 @@ def is_valid_hash(data: str) -> bool:
return bool(asset_code_re.match(data))
-@type_checked
def raise_if_not_valid_ed25519_public_key(value: str, argument_name: str) -> None:
try:
StrKey.decode_ed25519_public_key(value)
@@ -102,7 +94,6 @@ def raise_if_not_valid_ed25519_public_key(value: str, argument_name: str) -> Non
) from e
-@type_checked
def raise_if_not_valid_amount(value: str, argument_name: str) -> None:
amount = Decimal(value)
exponent = amount.as_tuple().exponent
@@ -117,7 +108,6 @@ def raise_if_not_valid_amount(value: str, argument_name: str) -> None:
)
-@type_checked
def raise_if_not_valid_hash(value: str, argument_name: str) -> None:
if not is_valid_hash(value):
raise ValueError(
@@ -125,7 +115,6 @@ def raise_if_not_valid_hash(value: str, argument_name: str) -> None:
)
-@type_checked
def raise_if_not_valid_balance_id(value: str, argument_name: str) -> None:
if len(value) != 72 or value[:8] != "00000000" or not is_valid_hash(value[8:]):
raise ValueError(
@@ -176,7 +165,7 @@ def to_xdr_amount(value: Union[str, Decimal]) -> int:
def from_xdr_amount(value: int) -> str:
- """Converts an str amount from an XDR amount object
+ """Converts a str amount from an XDR amount object
:param value: The amount to convert to a string from an XDR int64
amount.
diff --git a/stellar_sdk/xdr/__init__.py b/stellar_sdk/xdr/__init__.py
index 56d485bee..c3015fd6d 100644
--- a/stellar_sdk/xdr/__init__.py
+++ b/stellar_sdk/xdr/__init__.py
@@ -35,6 +35,9 @@
from .bucket_entry_type import BucketEntryType
from .bucket_metadata import BucketMetadata
from .bucket_metadata_ext import BucketMetadataExt
+from .bump_footprint_expiration_op import BumpFootprintExpirationOp
+from .bump_footprint_expiration_result import BumpFootprintExpirationResult
+from .bump_footprint_expiration_result_code import BumpFootprintExpirationResultCode
from .bump_sequence_op import BumpSequenceOp
from .bump_sequence_result import BumpSequenceResult
from .bump_sequence_result_code import BumpSequenceResultCode
@@ -70,13 +73,43 @@
from .clawback_op import ClawbackOp
from .clawback_result import ClawbackResult
from .clawback_result_code import ClawbackResultCode
+from .config_setting_contract_bandwidth_v0 import ConfigSettingContractBandwidthV0
+from .config_setting_contract_compute_v0 import ConfigSettingContractComputeV0
+from .config_setting_contract_events_v0 import ConfigSettingContractEventsV0
+from .config_setting_contract_execution_lanes_v0 import (
+ ConfigSettingContractExecutionLanesV0,
+)
+from .config_setting_contract_historical_data_v0 import (
+ ConfigSettingContractHistoricalDataV0,
+)
+from .config_setting_contract_ledger_cost_v0 import ConfigSettingContractLedgerCostV0
+from .config_setting_entry import ConfigSettingEntry
+from .config_setting_id import ConfigSettingID
+from .config_upgrade_set import ConfigUpgradeSet
+from .config_upgrade_set_key import ConfigUpgradeSetKey
from .constants import *
+from .contract_code_entry import ContractCodeEntry
+from .contract_cost_param_entry import ContractCostParamEntry
+from .contract_cost_params import ContractCostParams
+from .contract_cost_type import ContractCostType
+from .contract_data_durability import ContractDataDurability
+from .contract_data_entry import ContractDataEntry
+from .contract_event import ContractEvent
+from .contract_event_body import ContractEventBody
+from .contract_event_type import ContractEventType
+from .contract_event_v0 import ContractEventV0
+from .contract_executable import ContractExecutable
+from .contract_executable_type import ContractExecutableType
+from .contract_id_preimage import ContractIDPreimage
+from .contract_id_preimage_from_address import ContractIDPreimageFromAddress
+from .contract_id_preimage_type import ContractIDPreimageType
from .create_account_op import CreateAccountOp
from .create_account_result import CreateAccountResult
from .create_account_result_code import CreateAccountResultCode
from .create_claimable_balance_op import CreateClaimableBalanceOp
from .create_claimable_balance_result import CreateClaimableBalanceResult
from .create_claimable_balance_result_code import CreateClaimableBalanceResultCode
+from .create_contract_args import CreateContractArgs
from .create_passive_sell_offer_op import CreatePassiveSellOfferOp
from .crypto_key_type import CryptoKeyType
from .curve25519_public import Curve25519Public
@@ -85,6 +118,7 @@
from .data_entry_ext import DataEntryExt
from .data_value import DataValue
from .decorated_signature import DecoratedSignature
+from .diagnostic_event import DiagnosticEvent
from .dont_have import DontHave
from .duration import Duration
from .encrypted_body import EncryptedBody
@@ -95,18 +129,27 @@
from .envelope_type import EnvelopeType
from .error import Error
from .error_code import ErrorCode
+from .eviction_iterator import EvictionIterator
+from .expiration_entry import ExpirationEntry
from .extension_point import ExtensionPoint
from .fee_bump_transaction import FeeBumpTransaction
from .fee_bump_transaction_envelope import FeeBumpTransactionEnvelope
from .fee_bump_transaction_ext import FeeBumpTransactionExt
from .fee_bump_transaction_inner_tx import FeeBumpTransactionInnerTx
+from .flood_advert import FloodAdvert
+from .flood_demand import FloodDemand
+from .generalized_transaction_set import GeneralizedTransactionSet
from .hash import Hash
from .hash_id_preimage import HashIDPreimage
+from .hash_id_preimage_contract_id import HashIDPreimageContractID
from .hash_id_preimage_operation_id import HashIDPreimageOperationID
from .hash_id_preimage_revoke_id import HashIDPreimageRevokeID
+from .hash_id_preimage_soroban_authorization import HashIDPreimageSorobanAuthorization
from .hello import Hello
from .hmac_sha256_key import HmacSha256Key
from .hmac_sha256_mac import HmacSha256Mac
+from .host_function import HostFunction
+from .host_function_type import HostFunctionType
from .inflation_payout import InflationPayout
from .inflation_result import InflationResult
from .inflation_result_code import InflationResultCode
@@ -116,10 +159,19 @@
from .inner_transaction_result_result import InnerTransactionResultResult
from .int32 import Int32
from .int64 import Int64
+from .int128_parts import Int128Parts
+from .int256_parts import Int256Parts
+from .invoke_contract_args import InvokeContractArgs
+from .invoke_host_function_op import InvokeHostFunctionOp
+from .invoke_host_function_result import InvokeHostFunctionResult
+from .invoke_host_function_result_code import InvokeHostFunctionResultCode
+from .invoke_host_function_success_pre_image import InvokeHostFunctionSuccessPreImage
from .ip_addr_type import IPAddrType
from .ledger_bounds import LedgerBounds
from .ledger_close_meta import LedgerCloseMeta
from .ledger_close_meta_v0 import LedgerCloseMetaV0
+from .ledger_close_meta_v1 import LedgerCloseMetaV1
+from .ledger_close_meta_v2 import LedgerCloseMetaV2
from .ledger_close_value_signature import LedgerCloseValueSignature
from .ledger_entry import LedgerEntry
from .ledger_entry_change import LedgerEntryChange
@@ -130,6 +182,7 @@
from .ledger_entry_extension_v1 import LedgerEntryExtensionV1
from .ledger_entry_extension_v1_ext import LedgerEntryExtensionV1Ext
from .ledger_entry_type import LedgerEntryType
+from .ledger_footprint import LedgerFootprint
from .ledger_header import LedgerHeader
from .ledger_header_ext import LedgerHeaderExt
from .ledger_header_extension_v1 import LedgerHeaderExtensionV1
@@ -140,7 +193,11 @@
from .ledger_key import LedgerKey
from .ledger_key_account import LedgerKeyAccount
from .ledger_key_claimable_balance import LedgerKeyClaimableBalance
+from .ledger_key_config_setting import LedgerKeyConfigSetting
+from .ledger_key_contract_code import LedgerKeyContractCode
+from .ledger_key_contract_data import LedgerKeyContractData
from .ledger_key_data import LedgerKeyData
+from .ledger_key_expiration import LedgerKeyExpiration
from .ledger_key_liquidity_pool import LedgerKeyLiquidityPool
from .ledger_key_offer import LedgerKeyOffer
from .ledger_key_trust_line import LedgerKeyTrustLine
@@ -207,6 +264,9 @@
from .peer_address_ip import PeerAddressIp
from .peer_stat_list import PeerStatList
from .peer_stats import PeerStats
+from .persisted_scp_state import PersistedSCPState
+from .persisted_scp_state_v0 import PersistedSCPStateV0
+from .persisted_scp_state_v1 import PersistedSCPStateV1
from .pool_id import PoolID
from .precondition_type import PreconditionType
from .preconditions import Preconditions
@@ -214,11 +274,58 @@
from .price import Price
from .public_key import PublicKey
from .public_key_type import PublicKeyType
+from .restore_footprint_op import RestoreFootprintOp
+from .restore_footprint_result import RestoreFootprintResult
+from .restore_footprint_result_code import RestoreFootprintResultCode
from .revoke_sponsorship_op import RevokeSponsorshipOp
from .revoke_sponsorship_op_signer import RevokeSponsorshipOpSigner
from .revoke_sponsorship_result import RevokeSponsorshipResult
from .revoke_sponsorship_result_code import RevokeSponsorshipResultCode
from .revoke_sponsorship_type import RevokeSponsorshipType
+from .sc_address import SCAddress
+from .sc_address_type import SCAddressType
+from .sc_bytes import SCBytes
+from .sc_contract_instance import SCContractInstance
+from .sc_env_meta_entry import SCEnvMetaEntry
+from .sc_env_meta_kind import SCEnvMetaKind
+from .sc_error import SCError
+from .sc_error_code import SCErrorCode
+from .sc_error_type import SCErrorType
+from .sc_map import SCMap
+from .sc_map_entry import SCMapEntry
+from .sc_meta_entry import SCMetaEntry
+from .sc_meta_kind import SCMetaKind
+from .sc_meta_v0 import SCMetaV0
+from .sc_nonce_key import SCNonceKey
+from .sc_spec_entry import SCSpecEntry
+from .sc_spec_entry_kind import SCSpecEntryKind
+from .sc_spec_function_input_v0 import SCSpecFunctionInputV0
+from .sc_spec_function_v0 import SCSpecFunctionV0
+from .sc_spec_type import SCSpecType
+from .sc_spec_type_bytes_n import SCSpecTypeBytesN
+from .sc_spec_type_def import SCSpecTypeDef
+from .sc_spec_type_map import SCSpecTypeMap
+from .sc_spec_type_option import SCSpecTypeOption
+from .sc_spec_type_result import SCSpecTypeResult
+from .sc_spec_type_tuple import SCSpecTypeTuple
+from .sc_spec_type_udt import SCSpecTypeUDT
+from .sc_spec_type_vec import SCSpecTypeVec
+from .sc_spec_udt_enum_case_v0 import SCSpecUDTEnumCaseV0
+from .sc_spec_udt_enum_v0 import SCSpecUDTEnumV0
+from .sc_spec_udt_error_enum_case_v0 import SCSpecUDTErrorEnumCaseV0
+from .sc_spec_udt_error_enum_v0 import SCSpecUDTErrorEnumV0
+from .sc_spec_udt_struct_field_v0 import SCSpecUDTStructFieldV0
+from .sc_spec_udt_struct_v0 import SCSpecUDTStructV0
+from .sc_spec_udt_union_case_tuple_v0 import SCSpecUDTUnionCaseTupleV0
+from .sc_spec_udt_union_case_v0 import SCSpecUDTUnionCaseV0
+from .sc_spec_udt_union_case_v0_kind import SCSpecUDTUnionCaseV0Kind
+from .sc_spec_udt_union_case_void_v0 import SCSpecUDTUnionCaseVoidV0
+from .sc_spec_udt_union_v0 import SCSpecUDTUnionV0
+from .sc_string import SCString
+from .sc_symbol import SCSymbol
+from .sc_val import SCVal
+from .sc_val_type import SCValType
+from .sc_vec import SCVec
from .scp_ballot import SCPBallot
from .scp_envelope import SCPEnvelope
from .scp_history_entry import SCPHistoryEntry
@@ -232,6 +339,7 @@
from .scp_statement_prepare import SCPStatementPrepare
from .scp_statement_type import SCPStatementType
from .send_more import SendMore
+from .send_more_extended import SendMoreExtended
from .sequence_number import SequenceNumber
from .set_options_op import SetOptionsOp
from .set_options_result import SetOptionsResult
@@ -248,14 +356,27 @@
from .signer_key_ed25519_signed_payload import SignerKeyEd25519SignedPayload
from .signer_key_type import SignerKeyType
from .simple_payment_result import SimplePaymentResult
+from .soroban_address_credentials import SorobanAddressCredentials
+from .soroban_authorization_entry import SorobanAuthorizationEntry
+from .soroban_authorized_function import SorobanAuthorizedFunction
+from .soroban_authorized_function_type import SorobanAuthorizedFunctionType
+from .soroban_authorized_invocation import SorobanAuthorizedInvocation
+from .soroban_credentials import SorobanCredentials
+from .soroban_credentials_type import SorobanCredentialsType
+from .soroban_resources import SorobanResources
+from .soroban_transaction_data import SorobanTransactionData
+from .soroban_transaction_meta import SorobanTransactionMeta
from .sponsorship_descriptor import SponsorshipDescriptor
+from .state_expiration_settings import StateExpirationSettings
from .stellar_message import StellarMessage
from .stellar_value import StellarValue
from .stellar_value_ext import StellarValueExt
from .stellar_value_type import StellarValueType
+from .stored_transaction_set import StoredTransactionSet
from .string32 import String32
from .string64 import String64
from .survey_message_command_type import SurveyMessageCommandType
+from .survey_message_response_type import SurveyMessageResponseType
from .survey_request_message import SurveyRequestMessage
from .survey_response_body import SurveyResponseBody
from .survey_response_message import SurveyResponseMessage
@@ -263,7 +384,8 @@
from .thresholds import Thresholds
from .time_bounds import TimeBounds
from .time_point import TimePoint
-from .topology_response_body import TopologyResponseBody
+from .topology_response_body_v0 import TopologyResponseBodyV0
+from .topology_response_body_v1 import TopologyResponseBodyV1
from .transaction import Transaction
from .transaction_envelope import TransactionEnvelope
from .transaction_ext import TransactionExt
@@ -274,6 +396,8 @@
from .transaction_meta import TransactionMeta
from .transaction_meta_v1 import TransactionMetaV1
from .transaction_meta_v2 import TransactionMetaV2
+from .transaction_meta_v3 import TransactionMetaV3
+from .transaction_phase import TransactionPhase
from .transaction_result import TransactionResult
from .transaction_result_code import TransactionResultCode
from .transaction_result_ext import TransactionResultExt
@@ -282,6 +406,7 @@
from .transaction_result_result import TransactionResultResult
from .transaction_result_set import TransactionResultSet
from .transaction_set import TransactionSet
+from .transaction_set_v1 import TransactionSetV1
from .transaction_signature_payload import TransactionSignaturePayload
from .transaction_signature_payload_tagged_transaction import (
TransactionSignaturePayloadTaggedTransaction,
@@ -298,6 +423,15 @@
from .trust_line_entry_v1 import TrustLineEntryV1
from .trust_line_entry_v1_ext import TrustLineEntryV1Ext
from .trust_line_flags import TrustLineFlags
+from .tx_advert_vector import TxAdvertVector
+from .tx_demand_vector import TxDemandVector
+from .tx_set_component import TxSetComponent
+from .tx_set_component_txs_maybe_discounted_fee import (
+ TxSetComponentTxsMaybeDiscountedFee,
+)
+from .tx_set_component_type import TxSetComponentType
+from .u_int128_parts import UInt128Parts
+from .u_int256_parts import UInt256Parts
from .uint32 import Uint32
from .uint64 import Uint64
from .uint256 import Uint256
diff --git a/stellar_sdk/xdr/account_entry.py b/stellar_sdk/xdr/account_entry.py
index baef71b86..5dcb08e75 100644
--- a/stellar_sdk/xdr/account_entry.py
+++ b/stellar_sdk/xdr/account_entry.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List, Optional
+
from xdrlib3 import Packer, Unpacker
from .account_entry_ext import AccountEntryExt
@@ -99,7 +102,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountEntry":
+ def unpack(cls, unpacker: Unpacker) -> AccountEntry:
account_id = AccountID.unpack(unpacker)
balance = Int64.unpack(unpacker)
seq_num = SequenceNumber.unpack(unpacker)
@@ -132,7 +135,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountEntry":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountEntry:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -141,10 +144,26 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountEntry":
+ def from_xdr(cls, xdr: str) -> AccountEntry:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.account_id,
+ self.balance,
+ self.seq_num,
+ self.num_sub_entries,
+ self.inflation_dest,
+ self.flags,
+ self.home_domain,
+ self.thresholds,
+ self.signers,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/account_entry_ext.py b/stellar_sdk/xdr/account_entry_ext.py
index 93cf1d3e8..f88df9324 100644
--- a/stellar_sdk/xdr/account_entry_ext.py
+++ b/stellar_sdk/xdr/account_entry_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_entry_extension_v1 import AccountEntryExtensionV1
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountEntryExt":
+ def unpack(cls, unpacker: Unpacker) -> AccountEntryExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -56,7 +59,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountEntryExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountEntryExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,10 +68,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountEntryExt":
+ def from_xdr(cls, xdr: str) -> AccountEntryExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v1,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/account_entry_extension_v1.py b/stellar_sdk/xdr/account_entry_extension_v1.py
index 8cc6dd398..e0d3ce5c3 100644
--- a/stellar_sdk/xdr/account_entry_extension_v1.py
+++ b/stellar_sdk/xdr/account_entry_extension_v1.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_entry_extension_v1_ext import AccountEntryExtensionV1Ext
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountEntryExtensionV1":
+ def unpack(cls, unpacker: Unpacker) -> AccountEntryExtensionV1:
liabilities = Liabilities.unpack(unpacker)
ext = AccountEntryExtensionV1Ext.unpack(unpacker)
return cls(
@@ -55,7 +58,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountEntryExtensionV1":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountEntryExtensionV1:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -64,10 +67,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountEntryExtensionV1":
+ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV1:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.liabilities,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/account_entry_extension_v1_ext.py b/stellar_sdk/xdr/account_entry_extension_v1_ext.py
index fb9812d8b..fb9244b83 100644
--- a/stellar_sdk/xdr/account_entry_extension_v1_ext.py
+++ b/stellar_sdk/xdr/account_entry_extension_v1_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_entry_extension_v2 import AccountEntryExtensionV2
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountEntryExtensionV1Ext":
+ def unpack(cls, unpacker: Unpacker) -> AccountEntryExtensionV1Ext:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -56,7 +59,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountEntryExtensionV1Ext":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountEntryExtensionV1Ext:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,10 +68,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountEntryExtensionV1Ext":
+ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV1Ext:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v2,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/account_entry_extension_v2.py b/stellar_sdk/xdr/account_entry_extension_v2.py
index 5aa6b7a17..d1097a81d 100644
--- a/stellar_sdk/xdr/account_entry_extension_v2.py
+++ b/stellar_sdk/xdr/account_entry_extension_v2.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .account_entry_extension_v2_ext import AccountEntryExtensionV2Ext
@@ -59,7 +62,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountEntryExtensionV2":
+ def unpack(cls, unpacker: Unpacker) -> AccountEntryExtensionV2:
num_sponsored = Uint32.unpack(unpacker)
num_sponsoring = Uint32.unpack(unpacker)
length = unpacker.unpack_uint()
@@ -80,7 +83,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountEntryExtensionV2":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountEntryExtensionV2:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -89,10 +92,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountEntryExtensionV2":
+ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV2:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.num_sponsored,
+ self.num_sponsoring,
+ self.signer_sponsoring_i_ds,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/account_entry_extension_v2_ext.py b/stellar_sdk/xdr/account_entry_extension_v2_ext.py
index ed49ba78e..4fc18ea02 100644
--- a/stellar_sdk/xdr/account_entry_extension_v2_ext.py
+++ b/stellar_sdk/xdr/account_entry_extension_v2_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_entry_extension_v3 import AccountEntryExtensionV3
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountEntryExtensionV2Ext":
+ def unpack(cls, unpacker: Unpacker) -> AccountEntryExtensionV2Ext:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -56,7 +59,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountEntryExtensionV2Ext":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountEntryExtensionV2Ext:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,10 +68,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountEntryExtensionV2Ext":
+ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV2Ext:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v3,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/account_entry_extension_v3.py b/stellar_sdk/xdr/account_entry_extension_v3.py
index abe0ed78c..94b6579d4 100644
--- a/stellar_sdk/xdr/account_entry_extension_v3.py
+++ b/stellar_sdk/xdr/account_entry_extension_v3.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .extension_point import ExtensionPoint
@@ -44,7 +47,7 @@ def pack(self, packer: Packer) -> None:
self.seq_time.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountEntryExtensionV3":
+ def unpack(cls, unpacker: Unpacker) -> AccountEntryExtensionV3:
ext = ExtensionPoint.unpack(unpacker)
seq_ledger = Uint32.unpack(unpacker)
seq_time = TimePoint.unpack(unpacker)
@@ -60,7 +63,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountEntryExtensionV3":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountEntryExtensionV3:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -69,10 +72,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountEntryExtensionV3":
+ def from_xdr(cls, xdr: str) -> AccountEntryExtensionV3:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.seq_ledger,
+ self.seq_time,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/account_flags.py b/stellar_sdk/xdr/account_flags.py
index b0e2634a2..a2a72fa04 100644
--- a/stellar_sdk/xdr/account_flags.py
+++ b/stellar_sdk/xdr/account_flags.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["AccountFlags"]
@@ -39,7 +42,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountFlags":
+ def unpack(cls, unpacker: Unpacker) -> AccountFlags:
value = unpacker.unpack_int()
return cls(value)
@@ -49,7 +52,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountFlags":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountFlags:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -58,6 +61,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountFlags":
+ def from_xdr(cls, xdr: str) -> AccountFlags:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/account_id.py b/stellar_sdk/xdr/account_id.py
index f23d88786..eddbbfada 100644
--- a/stellar_sdk/xdr/account_id.py
+++ b/stellar_sdk/xdr/account_id.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .public_key import PublicKey
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
self.account_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountID":
+ def unpack(cls, unpacker: Unpacker) -> AccountID:
account_id = PublicKey.unpack(unpacker)
return cls(account_id)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountID":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountID:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountID":
+ def from_xdr(cls, xdr: str) -> AccountID:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.account_id)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/account_merge_result.py b/stellar_sdk/xdr/account_merge_result.py
index ed5766241..c81a4f1ba 100644
--- a/stellar_sdk/xdr/account_merge_result.py
+++ b/stellar_sdk/xdr/account_merge_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_merge_result_code import AccountMergeResultCode
@@ -17,7 +20,13 @@ class AccountMergeResult:
{
case ACCOUNT_MERGE_SUCCESS:
int64 sourceAccountBalance; // how much got transferred from source account
- default:
+ case ACCOUNT_MERGE_MALFORMED:
+ case ACCOUNT_MERGE_NO_ACCOUNT:
+ case ACCOUNT_MERGE_IMMUTABLE_SET:
+ case ACCOUNT_MERGE_HAS_SUB_ENTRIES:
+ case ACCOUNT_MERGE_SEQNUM_TOO_FAR:
+ case ACCOUNT_MERGE_DEST_FULL:
+ case ACCOUNT_MERGE_IS_SPONSOR:
void;
};
"""
@@ -37,13 +46,41 @@ def pack(self, packer: Packer) -> None:
raise ValueError("source_account_balance should not be None.")
self.source_account_balance.pack(packer)
return
+ if self.code == AccountMergeResultCode.ACCOUNT_MERGE_MALFORMED:
+ return
+ if self.code == AccountMergeResultCode.ACCOUNT_MERGE_NO_ACCOUNT:
+ return
+ if self.code == AccountMergeResultCode.ACCOUNT_MERGE_IMMUTABLE_SET:
+ return
+ if self.code == AccountMergeResultCode.ACCOUNT_MERGE_HAS_SUB_ENTRIES:
+ return
+ if self.code == AccountMergeResultCode.ACCOUNT_MERGE_SEQNUM_TOO_FAR:
+ return
+ if self.code == AccountMergeResultCode.ACCOUNT_MERGE_DEST_FULL:
+ return
+ if self.code == AccountMergeResultCode.ACCOUNT_MERGE_IS_SPONSOR:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountMergeResult":
+ def unpack(cls, unpacker: Unpacker) -> AccountMergeResult:
code = AccountMergeResultCode.unpack(unpacker)
if code == AccountMergeResultCode.ACCOUNT_MERGE_SUCCESS:
source_account_balance = Int64.unpack(unpacker)
return cls(code=code, source_account_balance=source_account_balance)
+ if code == AccountMergeResultCode.ACCOUNT_MERGE_MALFORMED:
+ return cls(code=code)
+ if code == AccountMergeResultCode.ACCOUNT_MERGE_NO_ACCOUNT:
+ return cls(code=code)
+ if code == AccountMergeResultCode.ACCOUNT_MERGE_IMMUTABLE_SET:
+ return cls(code=code)
+ if code == AccountMergeResultCode.ACCOUNT_MERGE_HAS_SUB_ENTRIES:
+ return cls(code=code)
+ if code == AccountMergeResultCode.ACCOUNT_MERGE_SEQNUM_TOO_FAR:
+ return cls(code=code)
+ if code == AccountMergeResultCode.ACCOUNT_MERGE_DEST_FULL:
+ return cls(code=code)
+ if code == AccountMergeResultCode.ACCOUNT_MERGE_IS_SPONSOR:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -52,7 +89,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountMergeResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountMergeResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -61,10 +98,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountMergeResult":
+ def from_xdr(cls, xdr: str) -> AccountMergeResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.source_account_balance,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/account_merge_result_code.py b/stellar_sdk/xdr/account_merge_result_code.py
index 943fc6d8c..44f20e1bd 100644
--- a/stellar_sdk/xdr/account_merge_result_code.py
+++ b/stellar_sdk/xdr/account_merge_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["AccountMergeResultCode"]
@@ -40,7 +43,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AccountMergeResultCode":
+ def unpack(cls, unpacker: Unpacker) -> AccountMergeResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -50,7 +53,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AccountMergeResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> AccountMergeResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -59,6 +62,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AccountMergeResultCode":
+ def from_xdr(cls, xdr: str) -> AccountMergeResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/allow_trust_op.py b/stellar_sdk/xdr/allow_trust_op.py
index 80437815c..2c46d32ea 100644
--- a/stellar_sdk/xdr/allow_trust_op.py
+++ b/stellar_sdk/xdr/allow_trust_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -40,7 +43,7 @@ def pack(self, packer: Packer) -> None:
self.authorize.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AllowTrustOp":
+ def unpack(cls, unpacker: Unpacker) -> AllowTrustOp:
trustor = AccountID.unpack(unpacker)
asset = AssetCode.unpack(unpacker)
authorize = Uint32.unpack(unpacker)
@@ -56,7 +59,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AllowTrustOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> AllowTrustOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,10 +68,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AllowTrustOp":
+ def from_xdr(cls, xdr: str) -> AllowTrustOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.trustor,
+ self.asset,
+ self.authorize,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/allow_trust_result.py b/stellar_sdk/xdr/allow_trust_result.py
index 508752de5..c07c88a25 100644
--- a/stellar_sdk/xdr/allow_trust_result.py
+++ b/stellar_sdk/xdr/allow_trust_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .allow_trust_result_code import AllowTrustResultCode
@@ -16,7 +19,12 @@ class AllowTrustResult:
{
case ALLOW_TRUST_SUCCESS:
void;
- default:
+ case ALLOW_TRUST_MALFORMED:
+ case ALLOW_TRUST_NO_TRUST_LINE:
+ case ALLOW_TRUST_TRUST_NOT_REQUIRED:
+ case ALLOW_TRUST_CANT_REVOKE:
+ case ALLOW_TRUST_SELF_NOT_ALLOWED:
+ case ALLOW_TRUST_LOW_RESERVE:
void;
};
"""
@@ -31,12 +39,36 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == AllowTrustResultCode.ALLOW_TRUST_SUCCESS:
return
+ if self.code == AllowTrustResultCode.ALLOW_TRUST_MALFORMED:
+ return
+ if self.code == AllowTrustResultCode.ALLOW_TRUST_NO_TRUST_LINE:
+ return
+ if self.code == AllowTrustResultCode.ALLOW_TRUST_TRUST_NOT_REQUIRED:
+ return
+ if self.code == AllowTrustResultCode.ALLOW_TRUST_CANT_REVOKE:
+ return
+ if self.code == AllowTrustResultCode.ALLOW_TRUST_SELF_NOT_ALLOWED:
+ return
+ if self.code == AllowTrustResultCode.ALLOW_TRUST_LOW_RESERVE:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AllowTrustResult":
+ def unpack(cls, unpacker: Unpacker) -> AllowTrustResult:
code = AllowTrustResultCode.unpack(unpacker)
if code == AllowTrustResultCode.ALLOW_TRUST_SUCCESS:
return cls(code=code)
+ if code == AllowTrustResultCode.ALLOW_TRUST_MALFORMED:
+ return cls(code=code)
+ if code == AllowTrustResultCode.ALLOW_TRUST_NO_TRUST_LINE:
+ return cls(code=code)
+ if code == AllowTrustResultCode.ALLOW_TRUST_TRUST_NOT_REQUIRED:
+ return cls(code=code)
+ if code == AllowTrustResultCode.ALLOW_TRUST_CANT_REVOKE:
+ return cls(code=code)
+ if code == AllowTrustResultCode.ALLOW_TRUST_SELF_NOT_ALLOWED:
+ return cls(code=code)
+ if code == AllowTrustResultCode.ALLOW_TRUST_LOW_RESERVE:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +77,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AllowTrustResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> AllowTrustResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +86,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AllowTrustResult":
+ def from_xdr(cls, xdr: str) -> AllowTrustResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/allow_trust_result_code.py b/stellar_sdk/xdr/allow_trust_result_code.py
index 2015dfcaa..00746bf84 100644
--- a/stellar_sdk/xdr/allow_trust_result_code.py
+++ b/stellar_sdk/xdr/allow_trust_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["AllowTrustResultCode"]
@@ -20,10 +23,10 @@ class AllowTrustResultCode(IntEnum):
ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
// source account does not require trust
ALLOW_TRUST_TRUST_NOT_REQUIRED = -3,
- ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust,
+ ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust,
ALLOW_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
- ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created
- // on revoke due to low reserves
+ ALLOW_TRUST_LOW_RESERVE = -6 // claimable balances can't be created
+ // on revoke due to low reserves
};
"""
@@ -39,7 +42,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AllowTrustResultCode":
+ def unpack(cls, unpacker: Unpacker) -> AllowTrustResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -49,7 +52,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AllowTrustResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> AllowTrustResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -58,6 +61,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AllowTrustResultCode":
+ def from_xdr(cls, xdr: str) -> AllowTrustResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/alpha_num12.py b/stellar_sdk/xdr/alpha_num12.py
index 41eec3bd5..ec5192f8e 100644
--- a/stellar_sdk/xdr/alpha_num12.py
+++ b/stellar_sdk/xdr/alpha_num12.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.issuer.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AlphaNum12":
+ def unpack(cls, unpacker: Unpacker) -> AlphaNum12:
asset_code = AssetCode12.unpack(unpacker)
issuer = AccountID.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AlphaNum12":
+ def from_xdr_bytes(cls, xdr: bytes) -> AlphaNum12:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AlphaNum12":
+ def from_xdr(cls, xdr: str) -> AlphaNum12:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.asset_code,
+ self.issuer,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/alpha_num4.py b/stellar_sdk/xdr/alpha_num4.py
index bf9c465f1..6ee0afb2d 100644
--- a/stellar_sdk/xdr/alpha_num4.py
+++ b/stellar_sdk/xdr/alpha_num4.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.issuer.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AlphaNum4":
+ def unpack(cls, unpacker: Unpacker) -> AlphaNum4:
asset_code = AssetCode4.unpack(unpacker)
issuer = AccountID.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AlphaNum4":
+ def from_xdr_bytes(cls, xdr: bytes) -> AlphaNum4:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AlphaNum4":
+ def from_xdr(cls, xdr: str) -> AlphaNum4:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.asset_code,
+ self.issuer,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/asset.py b/stellar_sdk/xdr/asset.py
index 3ac9fe71a..71412b583 100644
--- a/stellar_sdk/xdr/asset.py
+++ b/stellar_sdk/xdr/asset.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .alpha_num4 import AlphaNum4
@@ -55,7 +58,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Asset":
+ def unpack(cls, unpacker: Unpacker) -> Asset:
type = AssetType.unpack(unpacker)
if type == AssetType.ASSET_TYPE_NATIVE:
return cls(type=type)
@@ -73,7 +76,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Asset":
+ def from_xdr_bytes(cls, xdr: bytes) -> Asset:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -82,10 +85,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Asset":
+ def from_xdr(cls, xdr: str) -> Asset:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.alpha_num4,
+ self.alpha_num12,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/asset_code.py b/stellar_sdk/xdr/asset_code.py
index 824e8aff9..015cd2d2b 100644
--- a/stellar_sdk/xdr/asset_code.py
+++ b/stellar_sdk/xdr/asset_code.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset_code4 import AssetCode4
@@ -50,7 +53,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AssetCode":
+ def unpack(cls, unpacker: Unpacker) -> AssetCode:
type = AssetType.unpack(unpacker)
if type == AssetType.ASSET_TYPE_CREDIT_ALPHANUM4:
asset_code4 = AssetCode4.unpack(unpacker)
@@ -66,7 +69,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AssetCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> AssetCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -75,10 +78,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AssetCode":
+ def from_xdr(cls, xdr: str) -> AssetCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.asset_code4,
+ self.asset_code12,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/asset_code12.py b/stellar_sdk/xdr/asset_code12.py
index c5a50aa5f..f90d0fb36 100644
--- a/stellar_sdk/xdr/asset_code12.py
+++ b/stellar_sdk/xdr/asset_code12.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.asset_code12, 12, True).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AssetCode12":
+ def unpack(cls, unpacker: Unpacker) -> AssetCode12:
asset_code12 = Opaque.unpack(unpacker, 12, True)
return cls(asset_code12)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AssetCode12":
+ def from_xdr_bytes(cls, xdr: bytes) -> AssetCode12:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AssetCode12":
+ def from_xdr(cls, xdr: str) -> AssetCode12:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.asset_code12)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/asset_code4.py b/stellar_sdk/xdr/asset_code4.py
index 829f6d8d4..fc439031d 100644
--- a/stellar_sdk/xdr/asset_code4.py
+++ b/stellar_sdk/xdr/asset_code4.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.asset_code4, 4, True).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AssetCode4":
+ def unpack(cls, unpacker: Unpacker) -> AssetCode4:
asset_code4 = Opaque.unpack(unpacker, 4, True)
return cls(asset_code4)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AssetCode4":
+ def from_xdr_bytes(cls, xdr: bytes) -> AssetCode4:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AssetCode4":
+ def from_xdr(cls, xdr: str) -> AssetCode4:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.asset_code4)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/asset_type.py b/stellar_sdk/xdr/asset_type.py
index a4ed1dc97..ae030ae5f 100644
--- a/stellar_sdk/xdr/asset_type.py
+++ b/stellar_sdk/xdr/asset_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["AssetType"]
@@ -29,7 +32,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AssetType":
+ def unpack(cls, unpacker: Unpacker) -> AssetType:
value = unpacker.unpack_int()
return cls(value)
@@ -39,7 +42,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AssetType":
+ def from_xdr_bytes(cls, xdr: bytes) -> AssetType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -48,6 +51,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AssetType":
+ def from_xdr(cls, xdr: str) -> AssetType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/auth.py b/stellar_sdk/xdr/auth.py
index fe834d301..26e395102 100644
--- a/stellar_sdk/xdr/auth.py
+++ b/stellar_sdk/xdr/auth.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -14,26 +17,24 @@ class Auth:
struct Auth
{
- // Empty message, just to confirm
- // establishment of MAC keys.
- int unused;
+ int flags;
};
"""
def __init__(
self,
- unused: int,
+ flags: int,
) -> None:
- self.unused = unused
+ self.flags = flags
def pack(self, packer: Packer) -> None:
- Integer(self.unused).pack(packer)
+ Integer(self.flags).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Auth":
- unused = Integer.unpack(unpacker)
+ def unpack(cls, unpacker: Unpacker) -> Auth:
+ flags = Integer.unpack(unpacker)
return cls(
- unused=unused,
+ flags=flags,
)
def to_xdr_bytes(self) -> bytes:
@@ -42,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Auth":
+ def from_xdr_bytes(cls, xdr: bytes) -> Auth:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -51,17 +52,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Auth":
+ def from_xdr(cls, xdr: str) -> Auth:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.flags,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
- return self.unused == other.unused
+ return self.flags == other.flags
def __str__(self):
out = [
- f"unused={self.unused}",
+ f"flags={self.flags}",
]
return f""
diff --git a/stellar_sdk/xdr/auth_cert.py b/stellar_sdk/xdr/auth_cert.py
index f9387ab55..85c3e55d1 100644
--- a/stellar_sdk/xdr/auth_cert.py
+++ b/stellar_sdk/xdr/auth_cert.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .curve25519_public import Curve25519Public
@@ -38,7 +41,7 @@ def pack(self, packer: Packer) -> None:
self.sig.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AuthCert":
+ def unpack(cls, unpacker: Unpacker) -> AuthCert:
pubkey = Curve25519Public.unpack(unpacker)
expiration = Uint64.unpack(unpacker)
sig = Signature.unpack(unpacker)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AuthCert":
+ def from_xdr_bytes(cls, xdr: bytes) -> AuthCert:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +66,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AuthCert":
+ def from_xdr(cls, xdr: str) -> AuthCert:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.pubkey,
+ self.expiration,
+ self.sig,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/authenticated_message.py b/stellar_sdk/xdr/authenticated_message.py
index fe78a8e46..8f5c26771 100644
--- a/stellar_sdk/xdr/authenticated_message.py
+++ b/stellar_sdk/xdr/authenticated_message.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .authenticated_message_v0 import AuthenticatedMessageV0
@@ -42,7 +45,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AuthenticatedMessage":
+ def unpack(cls, unpacker: Unpacker) -> AuthenticatedMessage:
v = Uint32.unpack(unpacker)
if v == 0:
v0 = AuthenticatedMessageV0.unpack(unpacker)
@@ -55,7 +58,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AuthenticatedMessage":
+ def from_xdr_bytes(cls, xdr: bytes) -> AuthenticatedMessage:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -64,10 +67,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AuthenticatedMessage":
+ def from_xdr(cls, xdr: str) -> AuthenticatedMessage:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v0,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/authenticated_message_v0.py b/stellar_sdk/xdr/authenticated_message_v0.py
index 868eef5f2..db99e6e04 100644
--- a/stellar_sdk/xdr/authenticated_message_v0.py
+++ b/stellar_sdk/xdr/authenticated_message_v0.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .hmac_sha256_mac import HmacSha256Mac
@@ -38,7 +41,7 @@ def pack(self, packer: Packer) -> None:
self.mac.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "AuthenticatedMessageV0":
+ def unpack(cls, unpacker: Unpacker) -> AuthenticatedMessageV0:
sequence = Uint64.unpack(unpacker)
message = StellarMessage.unpack(unpacker)
mac = HmacSha256Mac.unpack(unpacker)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "AuthenticatedMessageV0":
+ def from_xdr_bytes(cls, xdr: bytes) -> AuthenticatedMessageV0:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +66,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "AuthenticatedMessageV0":
+ def from_xdr(cls, xdr: str) -> AuthenticatedMessageV0:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.sequence,
+ self.message,
+ self.mac,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/base.py b/stellar_sdk/xdr/base.py
index f31614994..65179b8f3 100644
--- a/stellar_sdk/xdr/base.py
+++ b/stellar_sdk/xdr/base.py
@@ -24,6 +24,9 @@ def pack(self, packer: Packer) -> None:
def unpack(unpacker: Unpacker) -> int:
return unpacker.unpack_int()
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -44,6 +47,9 @@ def pack(self, packer: Packer) -> None:
def unpack(unpacker: Unpacker) -> int:
return unpacker.unpack_uint()
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -64,6 +70,9 @@ def pack(self, packer: Packer) -> None:
def unpack(unpacker: Unpacker) -> float:
return unpacker.unpack_float()
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -84,6 +93,9 @@ def pack(self, packer: Packer) -> None:
def unpack(unpacker: Unpacker) -> float:
return unpacker.unpack_double()
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -104,6 +116,9 @@ def pack(self, packer: Packer) -> None:
def unpack(unpacker: Unpacker) -> int:
return unpacker.unpack_hyper()
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -124,6 +139,9 @@ def pack(self, packer: Packer) -> None:
def unpack(unpacker: Unpacker) -> int:
return unpacker.unpack_uhyper()
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -144,6 +162,9 @@ def pack(self, packer: Packer) -> None:
def unpack(unpacker: Unpacker) -> bool:
return unpacker.unpack_bool()
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -172,6 +193,9 @@ def unpack(unpacker: Unpacker) -> bytes:
size = unpacker.unpack_uint()
return unpacker.unpack_fopaque(size)
+ def __hash__(self):
+ return hash((self.value, self.size))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
@@ -212,6 +236,9 @@ def unpack(unpacker: Unpacker, size: int, fixed: bool) -> bytes:
size = unpacker.unpack_uint()
return unpacker.unpack_fopaque(size)
+ def __hash__(self):
+ return hash((self.value, self.size, self.fixed))
+
def __eq__(self, other: object) -> bool:
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/begin_sponsoring_future_reserves_op.py b/stellar_sdk/xdr/begin_sponsoring_future_reserves_op.py
index 9757b09bb..f05a5d2ae 100644
--- a/stellar_sdk/xdr/begin_sponsoring_future_reserves_op.py
+++ b/stellar_sdk/xdr/begin_sponsoring_future_reserves_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
self.sponsored_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BeginSponsoringFutureReservesOp":
+ def unpack(cls, unpacker: Unpacker) -> BeginSponsoringFutureReservesOp:
sponsored_id = AccountID.unpack(unpacker)
return cls(
sponsored_id=sponsored_id,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BeginSponsoringFutureReservesOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> BeginSponsoringFutureReservesOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BeginSponsoringFutureReservesOp":
+ def from_xdr(cls, xdr: str) -> BeginSponsoringFutureReservesOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.sponsored_id,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/begin_sponsoring_future_reserves_result.py b/stellar_sdk/xdr/begin_sponsoring_future_reserves_result.py
index 96c15ee99..6dd976d3f 100644
--- a/stellar_sdk/xdr/begin_sponsoring_future_reserves_result.py
+++ b/stellar_sdk/xdr/begin_sponsoring_future_reserves_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .begin_sponsoring_future_reserves_result_code import (
@@ -19,7 +22,9 @@ class BeginSponsoringFutureReservesResult:
{
case BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS:
void;
- default:
+ case BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED:
+ case BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED:
+ case BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE:
void;
};
"""
@@ -37,15 +42,45 @@ def pack(self, packer: Packer) -> None:
== BeginSponsoringFutureReservesResultCode.BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS
):
return
+ if (
+ self.code
+ == BeginSponsoringFutureReservesResultCode.BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED
+ ):
+ return
+ if (
+ self.code
+ == BeginSponsoringFutureReservesResultCode.BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED
+ ):
+ return
+ if (
+ self.code
+ == BeginSponsoringFutureReservesResultCode.BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE
+ ):
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BeginSponsoringFutureReservesResult":
+ def unpack(cls, unpacker: Unpacker) -> BeginSponsoringFutureReservesResult:
code = BeginSponsoringFutureReservesResultCode.unpack(unpacker)
if (
code
== BeginSponsoringFutureReservesResultCode.BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS
):
return cls(code=code)
+ if (
+ code
+ == BeginSponsoringFutureReservesResultCode.BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == BeginSponsoringFutureReservesResultCode.BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == BeginSponsoringFutureReservesResultCode.BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE
+ ):
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -54,7 +89,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BeginSponsoringFutureReservesResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> BeginSponsoringFutureReservesResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +98,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BeginSponsoringFutureReservesResult":
+ def from_xdr(cls, xdr: str) -> BeginSponsoringFutureReservesResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/begin_sponsoring_future_reserves_result_code.py b/stellar_sdk/xdr/begin_sponsoring_future_reserves_result_code.py
index 6407d7dfb..465b34349 100644
--- a/stellar_sdk/xdr/begin_sponsoring_future_reserves_result_code.py
+++ b/stellar_sdk/xdr/begin_sponsoring_future_reserves_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["BeginSponsoringFutureReservesResultCode"]
@@ -32,7 +35,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BeginSponsoringFutureReservesResultCode":
+ def unpack(cls, unpacker: Unpacker) -> BeginSponsoringFutureReservesResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -42,7 +45,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BeginSponsoringFutureReservesResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> BeginSponsoringFutureReservesResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -51,6 +54,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BeginSponsoringFutureReservesResultCode":
+ def from_xdr(cls, xdr: str) -> BeginSponsoringFutureReservesResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/bucket_entry.py b/stellar_sdk/xdr/bucket_entry.py
index e7256fe44..f8f1af40c 100644
--- a/stellar_sdk/xdr/bucket_entry.py
+++ b/stellar_sdk/xdr/bucket_entry.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .bucket_entry_type import BucketEntryType
@@ -64,7 +67,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BucketEntry":
+ def unpack(cls, unpacker: Unpacker) -> BucketEntry:
type = BucketEntryType.unpack(unpacker)
if type == BucketEntryType.LIVEENTRY:
live_entry = LedgerEntry.unpack(unpacker)
@@ -86,7 +89,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BucketEntry":
+ def from_xdr_bytes(cls, xdr: bytes) -> BucketEntry:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -95,10 +98,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BucketEntry":
+ def from_xdr(cls, xdr: str) -> BucketEntry:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.live_entry,
+ self.dead_entry,
+ self.meta_entry,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/bucket_entry_type.py b/stellar_sdk/xdr/bucket_entry_type.py
index 7a22aaeab..63d1507a1 100644
--- a/stellar_sdk/xdr/bucket_entry_type.py
+++ b/stellar_sdk/xdr/bucket_entry_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["BucketEntryType"]
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BucketEntryType":
+ def unpack(cls, unpacker: Unpacker) -> BucketEntryType:
value = unpacker.unpack_int()
return cls(value)
@@ -41,7 +44,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BucketEntryType":
+ def from_xdr_bytes(cls, xdr: bytes) -> BucketEntryType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -50,6 +53,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BucketEntryType":
+ def from_xdr(cls, xdr: str) -> BucketEntryType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/bucket_metadata.py b/stellar_sdk/xdr/bucket_metadata.py
index 14b9ec53b..a3a004314 100644
--- a/stellar_sdk/xdr/bucket_metadata.py
+++ b/stellar_sdk/xdr/bucket_metadata.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .bucket_metadata_ext import BucketMetadataExt
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BucketMetadata":
+ def unpack(cls, unpacker: Unpacker) -> BucketMetadata:
ledger_version = Uint32.unpack(unpacker)
ext = BucketMetadataExt.unpack(unpacker)
return cls(
@@ -55,7 +58,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BucketMetadata":
+ def from_xdr_bytes(cls, xdr: bytes) -> BucketMetadata:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -64,10 +67,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BucketMetadata":
+ def from_xdr(cls, xdr: str) -> BucketMetadata:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ledger_version,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/bucket_metadata_ext.py b/stellar_sdk/xdr/bucket_metadata_ext.py
index 659583409..c102c5326 100644
--- a/stellar_sdk/xdr/bucket_metadata_ext.py
+++ b/stellar_sdk/xdr/bucket_metadata_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BucketMetadataExt":
+ def unpack(cls, unpacker: Unpacker) -> BucketMetadataExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BucketMetadataExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> BucketMetadataExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BucketMetadataExt":
+ def from_xdr(cls, xdr: str) -> BucketMetadataExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/bump_footprint_expiration_op.py b/stellar_sdk/xdr/bump_footprint_expiration_op.py
new file mode 100644
index 000000000..b3c48ef18
--- /dev/null
+++ b/stellar_sdk/xdr/bump_footprint_expiration_op.py
@@ -0,0 +1,86 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .extension_point import ExtensionPoint
+from .uint32 import Uint32
+
+__all__ = ["BumpFootprintExpirationOp"]
+
+
+class BumpFootprintExpirationOp:
+ """
+ XDR Source Code::
+
+ struct BumpFootprintExpirationOp
+ {
+ ExtensionPoint ext;
+ uint32 ledgersToExpire;
+ };
+ """
+
+ def __init__(
+ self,
+ ext: ExtensionPoint,
+ ledgers_to_expire: Uint32,
+ ) -> None:
+ self.ext = ext
+ self.ledgers_to_expire = ledgers_to_expire
+
+ def pack(self, packer: Packer) -> None:
+ self.ext.pack(packer)
+ self.ledgers_to_expire.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> BumpFootprintExpirationOp:
+ ext = ExtensionPoint.unpack(unpacker)
+ ledgers_to_expire = Uint32.unpack(unpacker)
+ return cls(
+ ext=ext,
+ ledgers_to_expire=ledgers_to_expire,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> BumpFootprintExpirationOp:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> BumpFootprintExpirationOp:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.ledgers_to_expire,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ext == other.ext and self.ledgers_to_expire == other.ledgers_to_expire
+ )
+
+ def __str__(self):
+ out = [
+ f"ext={self.ext}",
+ f"ledgers_to_expire={self.ledgers_to_expire}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/bump_footprint_expiration_result.py b/stellar_sdk/xdr/bump_footprint_expiration_result.py
new file mode 100644
index 000000000..1606bbd99
--- /dev/null
+++ b/stellar_sdk/xdr/bump_footprint_expiration_result.py
@@ -0,0 +1,110 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .bump_footprint_expiration_result_code import BumpFootprintExpirationResultCode
+
+__all__ = ["BumpFootprintExpirationResult"]
+
+
+class BumpFootprintExpirationResult:
+ """
+ XDR Source Code::
+
+ union BumpFootprintExpirationResult switch (BumpFootprintExpirationResultCode code)
+ {
+ case BUMP_FOOTPRINT_EXPIRATION_SUCCESS:
+ void;
+ case BUMP_FOOTPRINT_EXPIRATION_MALFORMED:
+ case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED:
+ case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE:
+ void;
+ };
+ """
+
+ def __init__(
+ self,
+ code: BumpFootprintExpirationResultCode,
+ ) -> None:
+ self.code = code
+
+ def pack(self, packer: Packer) -> None:
+ self.code.pack(packer)
+ if (
+ self.code
+ == BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_SUCCESS
+ ):
+ return
+ if (
+ self.code
+ == BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_MALFORMED
+ ):
+ return
+ if (
+ self.code
+ == BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED
+ ):
+ return
+ if (
+ self.code
+ == BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE
+ ):
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> BumpFootprintExpirationResult:
+ code = BumpFootprintExpirationResultCode.unpack(unpacker)
+ if code == BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_SUCCESS:
+ return cls(code=code)
+ if (
+ code
+ == BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_MALFORMED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE
+ ):
+ return cls(code=code)
+ return cls(code=code)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> BumpFootprintExpirationResult:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> BumpFootprintExpirationResult:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.code,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.code == other.code
+
+ def __str__(self):
+ out = []
+ out.append(f"code={self.code}")
+ return f""
diff --git a/stellar_sdk/xdr/bump_footprint_expiration_result_code.py b/stellar_sdk/xdr/bump_footprint_expiration_result_code.py
new file mode 100644
index 000000000..52330e97a
--- /dev/null
+++ b/stellar_sdk/xdr/bump_footprint_expiration_result_code.py
@@ -0,0 +1,59 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["BumpFootprintExpirationResultCode"]
+
+
+class BumpFootprintExpirationResultCode(IntEnum):
+ """
+ XDR Source Code::
+
+ enum BumpFootprintExpirationResultCode
+ {
+ // codes considered as "success" for the operation
+ BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0,
+
+ // codes considered as "failure" for the operation
+ BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1,
+ BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2,
+ BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3
+ };
+ """
+
+ BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0
+ BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1
+ BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2
+ BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> BumpFootprintExpirationResultCode:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> BumpFootprintExpirationResultCode:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> BumpFootprintExpirationResultCode:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/bump_sequence_op.py b/stellar_sdk/xdr/bump_sequence_op.py
index 6876d3b4c..ea331d5b4 100644
--- a/stellar_sdk/xdr/bump_sequence_op.py
+++ b/stellar_sdk/xdr/bump_sequence_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .sequence_number import SequenceNumber
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
self.bump_to.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BumpSequenceOp":
+ def unpack(cls, unpacker: Unpacker) -> BumpSequenceOp:
bump_to = SequenceNumber.unpack(unpacker)
return cls(
bump_to=bump_to,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BumpSequenceOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> BumpSequenceOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BumpSequenceOp":
+ def from_xdr(cls, xdr: str) -> BumpSequenceOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.bump_to,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/bump_sequence_result.py b/stellar_sdk/xdr/bump_sequence_result.py
index 7bec21906..8cbfca832 100644
--- a/stellar_sdk/xdr/bump_sequence_result.py
+++ b/stellar_sdk/xdr/bump_sequence_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .bump_sequence_result_code import BumpSequenceResultCode
@@ -16,7 +19,7 @@ class BumpSequenceResult:
{
case BUMP_SEQUENCE_SUCCESS:
void;
- default:
+ case BUMP_SEQUENCE_BAD_SEQ:
void;
};
"""
@@ -31,12 +34,16 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == BumpSequenceResultCode.BUMP_SEQUENCE_SUCCESS:
return
+ if self.code == BumpSequenceResultCode.BUMP_SEQUENCE_BAD_SEQ:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BumpSequenceResult":
+ def unpack(cls, unpacker: Unpacker) -> BumpSequenceResult:
code = BumpSequenceResultCode.unpack(unpacker)
if code == BumpSequenceResultCode.BUMP_SEQUENCE_SUCCESS:
return cls(code=code)
+ if code == BumpSequenceResultCode.BUMP_SEQUENCE_BAD_SEQ:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +52,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BumpSequenceResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> BumpSequenceResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +61,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BumpSequenceResult":
+ def from_xdr(cls, xdr: str) -> BumpSequenceResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/bump_sequence_result_code.py b/stellar_sdk/xdr/bump_sequence_result_code.py
index cbb4598e6..de1721ec2 100644
--- a/stellar_sdk/xdr/bump_sequence_result_code.py
+++ b/stellar_sdk/xdr/bump_sequence_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["BumpSequenceResultCode"]
@@ -27,7 +30,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "BumpSequenceResultCode":
+ def unpack(cls, unpacker: Unpacker) -> BumpSequenceResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -37,7 +40,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "BumpSequenceResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> BumpSequenceResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -46,6 +49,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "BumpSequenceResultCode":
+ def from_xdr(cls, xdr: str) -> BumpSequenceResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/change_trust_asset.py b/stellar_sdk/xdr/change_trust_asset.py
index cbc982704..2d964fd81 100644
--- a/stellar_sdk/xdr/change_trust_asset.py
+++ b/stellar_sdk/xdr/change_trust_asset.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .alpha_num4 import AlphaNum4
@@ -66,7 +69,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ChangeTrustAsset":
+ def unpack(cls, unpacker: Unpacker) -> ChangeTrustAsset:
type = AssetType.unpack(unpacker)
if type == AssetType.ASSET_TYPE_NATIVE:
return cls(type=type)
@@ -87,7 +90,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ChangeTrustAsset":
+ def from_xdr_bytes(cls, xdr: bytes) -> ChangeTrustAsset:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -96,10 +99,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ChangeTrustAsset":
+ def from_xdr(cls, xdr: str) -> ChangeTrustAsset:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.alpha_num4,
+ self.alpha_num12,
+ self.liquidity_pool,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/change_trust_op.py b/stellar_sdk/xdr/change_trust_op.py
index 264cef90e..21f4cd351 100644
--- a/stellar_sdk/xdr/change_trust_op.py
+++ b/stellar_sdk/xdr/change_trust_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .change_trust_asset import ChangeTrustAsset
@@ -35,7 +38,7 @@ def pack(self, packer: Packer) -> None:
self.limit.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ChangeTrustOp":
+ def unpack(cls, unpacker: Unpacker) -> ChangeTrustOp:
line = ChangeTrustAsset.unpack(unpacker)
limit = Int64.unpack(unpacker)
return cls(
@@ -49,7 +52,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ChangeTrustOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> ChangeTrustOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -58,10 +61,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ChangeTrustOp":
+ def from_xdr(cls, xdr: str) -> ChangeTrustOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.line,
+ self.limit,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/change_trust_result.py b/stellar_sdk/xdr/change_trust_result.py
index db8a30b14..be5983916 100644
--- a/stellar_sdk/xdr/change_trust_result.py
+++ b/stellar_sdk/xdr/change_trust_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .change_trust_result_code import ChangeTrustResultCode
@@ -16,7 +19,14 @@ class ChangeTrustResult:
{
case CHANGE_TRUST_SUCCESS:
void;
- default:
+ case CHANGE_TRUST_MALFORMED:
+ case CHANGE_TRUST_NO_ISSUER:
+ case CHANGE_TRUST_INVALID_LIMIT:
+ case CHANGE_TRUST_LOW_RESERVE:
+ case CHANGE_TRUST_SELF_NOT_ALLOWED:
+ case CHANGE_TRUST_TRUST_LINE_MISSING:
+ case CHANGE_TRUST_CANNOT_DELETE:
+ case CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES:
void;
};
"""
@@ -31,12 +41,47 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == ChangeTrustResultCode.CHANGE_TRUST_SUCCESS:
return
+ if self.code == ChangeTrustResultCode.CHANGE_TRUST_MALFORMED:
+ return
+ if self.code == ChangeTrustResultCode.CHANGE_TRUST_NO_ISSUER:
+ return
+ if self.code == ChangeTrustResultCode.CHANGE_TRUST_INVALID_LIMIT:
+ return
+ if self.code == ChangeTrustResultCode.CHANGE_TRUST_LOW_RESERVE:
+ return
+ if self.code == ChangeTrustResultCode.CHANGE_TRUST_SELF_NOT_ALLOWED:
+ return
+ if self.code == ChangeTrustResultCode.CHANGE_TRUST_TRUST_LINE_MISSING:
+ return
+ if self.code == ChangeTrustResultCode.CHANGE_TRUST_CANNOT_DELETE:
+ return
+ if (
+ self.code
+ == ChangeTrustResultCode.CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES
+ ):
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ChangeTrustResult":
+ def unpack(cls, unpacker: Unpacker) -> ChangeTrustResult:
code = ChangeTrustResultCode.unpack(unpacker)
if code == ChangeTrustResultCode.CHANGE_TRUST_SUCCESS:
return cls(code=code)
+ if code == ChangeTrustResultCode.CHANGE_TRUST_MALFORMED:
+ return cls(code=code)
+ if code == ChangeTrustResultCode.CHANGE_TRUST_NO_ISSUER:
+ return cls(code=code)
+ if code == ChangeTrustResultCode.CHANGE_TRUST_INVALID_LIMIT:
+ return cls(code=code)
+ if code == ChangeTrustResultCode.CHANGE_TRUST_LOW_RESERVE:
+ return cls(code=code)
+ if code == ChangeTrustResultCode.CHANGE_TRUST_SELF_NOT_ALLOWED:
+ return cls(code=code)
+ if code == ChangeTrustResultCode.CHANGE_TRUST_TRUST_LINE_MISSING:
+ return cls(code=code)
+ if code == ChangeTrustResultCode.CHANGE_TRUST_CANNOT_DELETE:
+ return cls(code=code)
+ if code == ChangeTrustResultCode.CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +90,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ChangeTrustResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> ChangeTrustResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +99,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ChangeTrustResult":
+ def from_xdr(cls, xdr: str) -> ChangeTrustResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/change_trust_result_code.py b/stellar_sdk/xdr/change_trust_result_code.py
index a82492759..fe9c26462 100644
--- a/stellar_sdk/xdr/change_trust_result_code.py
+++ b/stellar_sdk/xdr/change_trust_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ChangeTrustResultCode"]
@@ -22,10 +25,12 @@ class ChangeTrustResultCode(IntEnum):
// cannot create with a limit of 0
CHANGE_TRUST_LOW_RESERVE =
-4, // not enough funds to create a new trust line,
- CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
+ CHANGE_TRUST_SELF_NOT_ALLOWED = -5, // trusting self is not allowed
CHANGE_TRUST_TRUST_LINE_MISSING = -6, // Asset trustline is missing for pool
- CHANGE_TRUST_CANNOT_DELETE = -7, // Asset trustline is still referenced in a pool
- CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES = -8 // Asset trustline is deauthorized
+ CHANGE_TRUST_CANNOT_DELETE =
+ -7, // Asset trustline is still referenced in a pool
+ CHANGE_TRUST_NOT_AUTH_MAINTAIN_LIABILITIES =
+ -8 // Asset trustline is deauthorized
};
"""
@@ -43,7 +48,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ChangeTrustResultCode":
+ def unpack(cls, unpacker: Unpacker) -> ChangeTrustResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -53,7 +58,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ChangeTrustResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> ChangeTrustResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -62,6 +67,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ChangeTrustResultCode":
+ def from_xdr(cls, xdr: str) -> ChangeTrustResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/claim_atom.py b/stellar_sdk/xdr/claim_atom.py
index f6f8dda44..df865d637 100644
--- a/stellar_sdk/xdr/claim_atom.py
+++ b/stellar_sdk/xdr/claim_atom.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .claim_atom_type import ClaimAtomType
@@ -57,7 +60,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimAtom":
+ def unpack(cls, unpacker: Unpacker) -> ClaimAtom:
type = ClaimAtomType.unpack(unpacker)
if type == ClaimAtomType.CLAIM_ATOM_TYPE_V0:
v0 = ClaimOfferAtomV0.unpack(unpacker)
@@ -76,7 +79,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimAtom":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimAtom:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -85,10 +88,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimAtom":
+ def from_xdr(cls, xdr: str) -> ClaimAtom:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.v0,
+ self.order_book,
+ self.liquidity_pool,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claim_atom_type.py b/stellar_sdk/xdr/claim_atom_type.py
index 459f9081d..d8ff4cd1a 100644
--- a/stellar_sdk/xdr/claim_atom_type.py
+++ b/stellar_sdk/xdr/claim_atom_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ClaimAtomType"]
@@ -27,7 +30,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimAtomType":
+ def unpack(cls, unpacker: Unpacker) -> ClaimAtomType:
value = unpacker.unpack_int()
return cls(value)
@@ -37,7 +40,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimAtomType":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimAtomType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -46,6 +49,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimAtomType":
+ def from_xdr(cls, xdr: str) -> ClaimAtomType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/claim_claimable_balance_op.py b/stellar_sdk/xdr/claim_claimable_balance_op.py
index 64cbf58e3..b624af65c 100644
--- a/stellar_sdk/xdr/claim_claimable_balance_op.py
+++ b/stellar_sdk/xdr/claim_claimable_balance_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .claimable_balance_id import ClaimableBalanceID
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
self.balance_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimClaimableBalanceOp":
+ def unpack(cls, unpacker: Unpacker) -> ClaimClaimableBalanceOp:
balance_id = ClaimableBalanceID.unpack(unpacker)
return cls(
balance_id=balance_id,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimClaimableBalanceOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimClaimableBalanceOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimClaimableBalanceOp":
+ def from_xdr(cls, xdr: str) -> ClaimClaimableBalanceOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.balance_id,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claim_claimable_balance_result.py b/stellar_sdk/xdr/claim_claimable_balance_result.py
index 4bad327da..38085c6fa 100644
--- a/stellar_sdk/xdr/claim_claimable_balance_result.py
+++ b/stellar_sdk/xdr/claim_claimable_balance_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .claim_claimable_balance_result_code import ClaimClaimableBalanceResultCode
@@ -16,7 +19,11 @@ class ClaimClaimableBalanceResult:
{
case CLAIM_CLAIMABLE_BALANCE_SUCCESS:
void;
- default:
+ case CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST:
+ case CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM:
+ case CLAIM_CLAIMABLE_BALANCE_LINE_FULL:
+ case CLAIM_CLAIMABLE_BALANCE_NO_TRUST:
+ case CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED:
void;
};
"""
@@ -31,12 +38,53 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_SUCCESS:
return
+ if (
+ self.code
+ == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST
+ ):
+ return
+ if (
+ self.code
+ == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM
+ ):
+ return
+ if (
+ self.code
+ == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_LINE_FULL
+ ):
+ return
+ if (
+ self.code
+ == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_NO_TRUST
+ ):
+ return
+ if (
+ self.code
+ == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED
+ ):
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimClaimableBalanceResult":
+ def unpack(cls, unpacker: Unpacker) -> ClaimClaimableBalanceResult:
code = ClaimClaimableBalanceResultCode.unpack(unpacker)
if code == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_SUCCESS:
return cls(code=code)
+ if (
+ code
+ == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST
+ ):
+ return cls(code=code)
+ if code == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM:
+ return cls(code=code)
+ if code == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_LINE_FULL:
+ return cls(code=code)
+ if code == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_NO_TRUST:
+ return cls(code=code)
+ if (
+ code
+ == ClaimClaimableBalanceResultCode.CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED
+ ):
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +93,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimClaimableBalanceResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimClaimableBalanceResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +102,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimClaimableBalanceResult":
+ def from_xdr(cls, xdr: str) -> ClaimClaimableBalanceResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claim_claimable_balance_result_code.py b/stellar_sdk/xdr/claim_claimable_balance_result_code.py
index 7fd0c58e2..7627d0269 100644
--- a/stellar_sdk/xdr/claim_claimable_balance_result_code.py
+++ b/stellar_sdk/xdr/claim_claimable_balance_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ClaimClaimableBalanceResultCode"]
@@ -19,7 +22,6 @@ class ClaimClaimableBalanceResultCode(IntEnum):
CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3,
CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4,
CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5
-
};
"""
@@ -34,7 +36,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimClaimableBalanceResultCode":
+ def unpack(cls, unpacker: Unpacker) -> ClaimClaimableBalanceResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -44,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimClaimableBalanceResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimClaimableBalanceResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -53,6 +55,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimClaimableBalanceResultCode":
+ def from_xdr(cls, xdr: str) -> ClaimClaimableBalanceResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/claim_liquidity_atom.py b/stellar_sdk/xdr/claim_liquidity_atom.py
index 27a8d97a8..26649dc73 100644
--- a/stellar_sdk/xdr/claim_liquidity_atom.py
+++ b/stellar_sdk/xdr/claim_liquidity_atom.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -50,7 +53,7 @@ def pack(self, packer: Packer) -> None:
self.amount_bought.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimLiquidityAtom":
+ def unpack(cls, unpacker: Unpacker) -> ClaimLiquidityAtom:
liquidity_pool_id = PoolID.unpack(unpacker)
asset_sold = Asset.unpack(unpacker)
amount_sold = Int64.unpack(unpacker)
@@ -70,7 +73,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimLiquidityAtom":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimLiquidityAtom:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -79,10 +82,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimLiquidityAtom":
+ def from_xdr(cls, xdr: str) -> ClaimLiquidityAtom:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.liquidity_pool_id,
+ self.asset_sold,
+ self.amount_sold,
+ self.asset_bought,
+ self.amount_bought,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claim_offer_atom.py b/stellar_sdk/xdr/claim_offer_atom.py
index 2e17ffecf..72cabc810 100644
--- a/stellar_sdk/xdr/claim_offer_atom.py
+++ b/stellar_sdk/xdr/claim_offer_atom.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -55,7 +58,7 @@ def pack(self, packer: Packer) -> None:
self.amount_bought.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimOfferAtom":
+ def unpack(cls, unpacker: Unpacker) -> ClaimOfferAtom:
seller_id = AccountID.unpack(unpacker)
offer_id = Int64.unpack(unpacker)
asset_sold = Asset.unpack(unpacker)
@@ -77,7 +80,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimOfferAtom":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimOfferAtom:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -86,10 +89,22 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimOfferAtom":
+ def from_xdr(cls, xdr: str) -> ClaimOfferAtom:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.seller_id,
+ self.offer_id,
+ self.asset_sold,
+ self.amount_sold,
+ self.asset_bought,
+ self.amount_bought,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claim_offer_atom_v0.py b/stellar_sdk/xdr/claim_offer_atom_v0.py
index 54e97fb23..ce6efbb4f 100644
--- a/stellar_sdk/xdr/claim_offer_atom_v0.py
+++ b/stellar_sdk/xdr/claim_offer_atom_v0.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -55,7 +58,7 @@ def pack(self, packer: Packer) -> None:
self.amount_bought.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimOfferAtomV0":
+ def unpack(cls, unpacker: Unpacker) -> ClaimOfferAtomV0:
seller_ed25519 = Uint256.unpack(unpacker)
offer_id = Int64.unpack(unpacker)
asset_sold = Asset.unpack(unpacker)
@@ -77,7 +80,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimOfferAtomV0":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimOfferAtomV0:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -86,10 +89,22 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimOfferAtomV0":
+ def from_xdr(cls, xdr: str) -> ClaimOfferAtomV0:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.seller_ed25519,
+ self.offer_id,
+ self.asset_sold,
+ self.amount_sold,
+ self.asset_bought,
+ self.amount_bought,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claim_predicate.py b/stellar_sdk/xdr/claim_predicate.py
index 53c0b2bb3..1e3193973 100644
--- a/stellar_sdk/xdr/claim_predicate.py
+++ b/stellar_sdk/xdr/claim_predicate.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List, Optional
+
from xdrlib3 import Packer, Unpacker
from .claim_predicate_type import ClaimPredicateType
@@ -28,7 +31,7 @@ class ClaimPredicate:
int64 absBefore; // Predicate will be true if closeTime < absBefore
case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME:
int64 relBefore; // Seconds since closeTime of the ledger in which the
- // ClaimableBalanceEntry was created
+ // ClaimableBalanceEntry was created
};
"""
@@ -97,7 +100,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimPredicate":
+ def unpack(cls, unpacker: Unpacker) -> ClaimPredicate:
type = ClaimPredicateType.unpack(unpacker)
if type == ClaimPredicateType.CLAIM_PREDICATE_UNCONDITIONAL:
return cls(type=type)
@@ -132,7 +135,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimPredicate":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimPredicate:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -141,10 +144,22 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimPredicate":
+ def from_xdr(cls, xdr: str) -> ClaimPredicate:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.and_predicates,
+ self.or_predicates,
+ self.not_predicate,
+ self.abs_before,
+ self.rel_before,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claim_predicate_type.py b/stellar_sdk/xdr/claim_predicate_type.py
index c21a91dd4..6e4bf25b6 100644
--- a/stellar_sdk/xdr/claim_predicate_type.py
+++ b/stellar_sdk/xdr/claim_predicate_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ClaimPredicateType"]
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimPredicateType":
+ def unpack(cls, unpacker: Unpacker) -> ClaimPredicateType:
value = unpacker.unpack_int()
return cls(value)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimPredicateType":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimPredicateType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,6 +55,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimPredicateType":
+ def from_xdr(cls, xdr: str) -> ClaimPredicateType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/claimable_balance_entry.py b/stellar_sdk/xdr/claimable_balance_entry.py
index 82a9eb9c2..6897e14f2 100644
--- a/stellar_sdk/xdr/claimable_balance_entry.py
+++ b/stellar_sdk/xdr/claimable_balance_entry.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -72,7 +75,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimableBalanceEntry":
+ def unpack(cls, unpacker: Unpacker) -> ClaimableBalanceEntry:
balance_id = ClaimableBalanceID.unpack(unpacker)
length = unpacker.unpack_uint()
claimants = []
@@ -95,7 +98,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimableBalanceEntry":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimableBalanceEntry:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -104,10 +107,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimableBalanceEntry":
+ def from_xdr(cls, xdr: str) -> ClaimableBalanceEntry:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.balance_id,
+ self.claimants,
+ self.asset,
+ self.amount,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claimable_balance_entry_ext.py b/stellar_sdk/xdr/claimable_balance_entry_ext.py
index f50b8f1ab..f11d05561 100644
--- a/stellar_sdk/xdr/claimable_balance_entry_ext.py
+++ b/stellar_sdk/xdr/claimable_balance_entry_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimableBalanceEntryExt":
+ def unpack(cls, unpacker: Unpacker) -> ClaimableBalanceEntryExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -56,7 +59,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimableBalanceEntryExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimableBalanceEntryExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,10 +68,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimableBalanceEntryExt":
+ def from_xdr(cls, xdr: str) -> ClaimableBalanceEntryExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v1,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claimable_balance_entry_extension_v1.py b/stellar_sdk/xdr/claimable_balance_entry_extension_v1.py
index 3d81ac98e..7f79abbde 100644
--- a/stellar_sdk/xdr/claimable_balance_entry_extension_v1.py
+++ b/stellar_sdk/xdr/claimable_balance_entry_extension_v1.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .claimable_balance_entry_extension_v1_ext import (
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
self.flags.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimableBalanceEntryExtensionV1":
+ def unpack(cls, unpacker: Unpacker) -> ClaimableBalanceEntryExtensionV1:
ext = ClaimableBalanceEntryExtensionV1Ext.unpack(unpacker)
flags = Uint32.unpack(unpacker)
return cls(
@@ -55,7 +58,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimableBalanceEntryExtensionV1":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimableBalanceEntryExtensionV1:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -64,10 +67,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimableBalanceEntryExtensionV1":
+ def from_xdr(cls, xdr: str) -> ClaimableBalanceEntryExtensionV1:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.flags,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claimable_balance_entry_extension_v1_ext.py b/stellar_sdk/xdr/claimable_balance_entry_extension_v1_ext.py
index ad0451478..f4886533a 100644
--- a/stellar_sdk/xdr/claimable_balance_entry_extension_v1_ext.py
+++ b/stellar_sdk/xdr/claimable_balance_entry_extension_v1_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimableBalanceEntryExtensionV1Ext":
+ def unpack(cls, unpacker: Unpacker) -> ClaimableBalanceEntryExtensionV1Ext:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimableBalanceEntryExtensionV1Ext":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimableBalanceEntryExtensionV1Ext:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimableBalanceEntryExtensionV1Ext":
+ def from_xdr(cls, xdr: str) -> ClaimableBalanceEntryExtensionV1Ext:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claimable_balance_flags.py b/stellar_sdk/xdr/claimable_balance_flags.py
index dc6049d1b..3f03f7d7d 100644
--- a/stellar_sdk/xdr/claimable_balance_flags.py
+++ b/stellar_sdk/xdr/claimable_balance_flags.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ClaimableBalanceFlags"]
@@ -25,7 +28,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimableBalanceFlags":
+ def unpack(cls, unpacker: Unpacker) -> ClaimableBalanceFlags:
value = unpacker.unpack_int()
return cls(value)
@@ -35,7 +38,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimableBalanceFlags":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimableBalanceFlags:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -44,6 +47,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimableBalanceFlags":
+ def from_xdr(cls, xdr: str) -> ClaimableBalanceFlags:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/claimable_balance_id.py b/stellar_sdk/xdr/claimable_balance_id.py
index abb0b991b..1ab22c7b5 100644
--- a/stellar_sdk/xdr/claimable_balance_id.py
+++ b/stellar_sdk/xdr/claimable_balance_id.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .claimable_balance_id_type import ClaimableBalanceIDType
@@ -37,7 +40,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimableBalanceID":
+ def unpack(cls, unpacker: Unpacker) -> ClaimableBalanceID:
type = ClaimableBalanceIDType.unpack(unpacker)
if type == ClaimableBalanceIDType.CLAIMABLE_BALANCE_ID_TYPE_V0:
v0 = Hash.unpack(unpacker)
@@ -50,7 +53,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimableBalanceID":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimableBalanceID:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -59,10 +62,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimableBalanceID":
+ def from_xdr(cls, xdr: str) -> ClaimableBalanceID:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.v0,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claimable_balance_id_type.py b/stellar_sdk/xdr/claimable_balance_id_type.py
index 98bc233ca..5cb684ed5 100644
--- a/stellar_sdk/xdr/claimable_balance_id_type.py
+++ b/stellar_sdk/xdr/claimable_balance_id_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ClaimableBalanceIDType"]
@@ -23,7 +26,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimableBalanceIDType":
+ def unpack(cls, unpacker: Unpacker) -> ClaimableBalanceIDType:
value = unpacker.unpack_int()
return cls(value)
@@ -33,7 +36,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimableBalanceIDType":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimableBalanceIDType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -42,6 +45,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimableBalanceIDType":
+ def from_xdr(cls, xdr: str) -> ClaimableBalanceIDType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/claimant.py b/stellar_sdk/xdr/claimant.py
index 8328a1221..ee1bdd127 100644
--- a/stellar_sdk/xdr/claimant.py
+++ b/stellar_sdk/xdr/claimant.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .claimant_type import ClaimantType
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Claimant":
+ def unpack(cls, unpacker: Unpacker) -> Claimant:
type = ClaimantType.unpack(unpacker)
if type == ClaimantType.CLAIMANT_TYPE_V0:
v0 = ClaimantV0.unpack(unpacker)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Claimant":
+ def from_xdr_bytes(cls, xdr: bytes) -> Claimant:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +66,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Claimant":
+ def from_xdr(cls, xdr: str) -> Claimant:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.v0,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/claimant_type.py b/stellar_sdk/xdr/claimant_type.py
index a94a7388d..f090fd0b3 100644
--- a/stellar_sdk/xdr/claimant_type.py
+++ b/stellar_sdk/xdr/claimant_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ClaimantType"]
@@ -23,7 +26,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimantType":
+ def unpack(cls, unpacker: Unpacker) -> ClaimantType:
value = unpacker.unpack_int()
return cls(value)
@@ -33,7 +36,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimantType":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimantType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -42,6 +45,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimantType":
+ def from_xdr(cls, xdr: str) -> ClaimantType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/claimant_v0.py b/stellar_sdk/xdr/claimant_v0.py
index c179d2f88..35fb46b99 100644
--- a/stellar_sdk/xdr/claimant_v0.py
+++ b/stellar_sdk/xdr/claimant_v0.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.predicate.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClaimantV0":
+ def unpack(cls, unpacker: Unpacker) -> ClaimantV0:
destination = AccountID.unpack(unpacker)
predicate = ClaimPredicate.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClaimantV0":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClaimantV0:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClaimantV0":
+ def from_xdr(cls, xdr: str) -> ClaimantV0:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.destination,
+ self.predicate,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/clawback_claimable_balance_op.py b/stellar_sdk/xdr/clawback_claimable_balance_op.py
index 66426c07e..c498628ef 100644
--- a/stellar_sdk/xdr/clawback_claimable_balance_op.py
+++ b/stellar_sdk/xdr/clawback_claimable_balance_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .claimable_balance_id import ClaimableBalanceID
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
self.balance_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClawbackClaimableBalanceOp":
+ def unpack(cls, unpacker: Unpacker) -> ClawbackClaimableBalanceOp:
balance_id = ClaimableBalanceID.unpack(unpacker)
return cls(
balance_id=balance_id,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClawbackClaimableBalanceOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClawbackClaimableBalanceOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClawbackClaimableBalanceOp":
+ def from_xdr(cls, xdr: str) -> ClawbackClaimableBalanceOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.balance_id,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/clawback_claimable_balance_result.py b/stellar_sdk/xdr/clawback_claimable_balance_result.py
index 6bfed5aba..accf7b02d 100644
--- a/stellar_sdk/xdr/clawback_claimable_balance_result.py
+++ b/stellar_sdk/xdr/clawback_claimable_balance_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .clawback_claimable_balance_result_code import ClawbackClaimableBalanceResultCode
@@ -17,7 +20,9 @@ class ClawbackClaimableBalanceResult:
{
case CLAWBACK_CLAIMABLE_BALANCE_SUCCESS:
void;
- default:
+ case CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST:
+ case CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER:
+ case CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED:
void;
};
"""
@@ -35,15 +40,45 @@ def pack(self, packer: Packer) -> None:
== ClawbackClaimableBalanceResultCode.CLAWBACK_CLAIMABLE_BALANCE_SUCCESS
):
return
+ if (
+ self.code
+ == ClawbackClaimableBalanceResultCode.CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST
+ ):
+ return
+ if (
+ self.code
+ == ClawbackClaimableBalanceResultCode.CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER
+ ):
+ return
+ if (
+ self.code
+ == ClawbackClaimableBalanceResultCode.CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED
+ ):
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClawbackClaimableBalanceResult":
+ def unpack(cls, unpacker: Unpacker) -> ClawbackClaimableBalanceResult:
code = ClawbackClaimableBalanceResultCode.unpack(unpacker)
if (
code
== ClawbackClaimableBalanceResultCode.CLAWBACK_CLAIMABLE_BALANCE_SUCCESS
):
return cls(code=code)
+ if (
+ code
+ == ClawbackClaimableBalanceResultCode.CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST
+ ):
+ return cls(code=code)
+ if (
+ code
+ == ClawbackClaimableBalanceResultCode.CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER
+ ):
+ return cls(code=code)
+ if (
+ code
+ == ClawbackClaimableBalanceResultCode.CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED
+ ):
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -52,7 +87,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClawbackClaimableBalanceResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClawbackClaimableBalanceResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -61,10 +96,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClawbackClaimableBalanceResult":
+ def from_xdr(cls, xdr: str) -> ClawbackClaimableBalanceResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/clawback_claimable_balance_result_code.py b/stellar_sdk/xdr/clawback_claimable_balance_result_code.py
index 28b84d4b0..2623575be 100644
--- a/stellar_sdk/xdr/clawback_claimable_balance_result_code.py
+++ b/stellar_sdk/xdr/clawback_claimable_balance_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ClawbackClaimableBalanceResultCode"]
@@ -32,7 +35,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClawbackClaimableBalanceResultCode":
+ def unpack(cls, unpacker: Unpacker) -> ClawbackClaimableBalanceResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -42,7 +45,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClawbackClaimableBalanceResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClawbackClaimableBalanceResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -51,6 +54,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClawbackClaimableBalanceResultCode":
+ def from_xdr(cls, xdr: str) -> ClawbackClaimableBalanceResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/clawback_op.py b/stellar_sdk/xdr/clawback_op.py
index 6a0358b52..f202878ef 100644
--- a/stellar_sdk/xdr/clawback_op.py
+++ b/stellar_sdk/xdr/clawback_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -38,7 +41,7 @@ def pack(self, packer: Packer) -> None:
self.amount.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClawbackOp":
+ def unpack(cls, unpacker: Unpacker) -> ClawbackOp:
asset = Asset.unpack(unpacker)
from_ = MuxedAccount.unpack(unpacker)
amount = Int64.unpack(unpacker)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClawbackOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClawbackOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +66,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClawbackOp":
+ def from_xdr(cls, xdr: str) -> ClawbackOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.asset,
+ self.from_,
+ self.amount,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/clawback_result.py b/stellar_sdk/xdr/clawback_result.py
index 74ca6efdc..6c447ded9 100644
--- a/stellar_sdk/xdr/clawback_result.py
+++ b/stellar_sdk/xdr/clawback_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .clawback_result_code import ClawbackResultCode
@@ -16,7 +19,10 @@ class ClawbackResult:
{
case CLAWBACK_SUCCESS:
void;
- default:
+ case CLAWBACK_MALFORMED:
+ case CLAWBACK_NOT_CLAWBACK_ENABLED:
+ case CLAWBACK_NO_TRUST:
+ case CLAWBACK_UNDERFUNDED:
void;
};
"""
@@ -31,12 +37,28 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == ClawbackResultCode.CLAWBACK_SUCCESS:
return
+ if self.code == ClawbackResultCode.CLAWBACK_MALFORMED:
+ return
+ if self.code == ClawbackResultCode.CLAWBACK_NOT_CLAWBACK_ENABLED:
+ return
+ if self.code == ClawbackResultCode.CLAWBACK_NO_TRUST:
+ return
+ if self.code == ClawbackResultCode.CLAWBACK_UNDERFUNDED:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClawbackResult":
+ def unpack(cls, unpacker: Unpacker) -> ClawbackResult:
code = ClawbackResultCode.unpack(unpacker)
if code == ClawbackResultCode.CLAWBACK_SUCCESS:
return cls(code=code)
+ if code == ClawbackResultCode.CLAWBACK_MALFORMED:
+ return cls(code=code)
+ if code == ClawbackResultCode.CLAWBACK_NOT_CLAWBACK_ENABLED:
+ return cls(code=code)
+ if code == ClawbackResultCode.CLAWBACK_NO_TRUST:
+ return cls(code=code)
+ if code == ClawbackResultCode.CLAWBACK_UNDERFUNDED:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +67,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClawbackResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClawbackResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +76,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClawbackResult":
+ def from_xdr(cls, xdr: str) -> ClawbackResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/clawback_result_code.py b/stellar_sdk/xdr/clawback_result_code.py
index 1a87cca58..d5b916896 100644
--- a/stellar_sdk/xdr/clawback_result_code.py
+++ b/stellar_sdk/xdr/clawback_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ClawbackResultCode"]
@@ -34,7 +37,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ClawbackResultCode":
+ def unpack(cls, unpacker: Unpacker) -> ClawbackResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -44,7 +47,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ClawbackResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> ClawbackResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -53,6 +56,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ClawbackResultCode":
+ def from_xdr(cls, xdr: str) -> ClawbackResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/config_setting_contract_bandwidth_v0.py b/stellar_sdk/xdr/config_setting_contract_bandwidth_v0.py
new file mode 100644
index 000000000..0b907612a
--- /dev/null
+++ b/stellar_sdk/xdr/config_setting_contract_bandwidth_v0.py
@@ -0,0 +1,100 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+from .uint32 import Uint32
+
+__all__ = ["ConfigSettingContractBandwidthV0"]
+
+
+class ConfigSettingContractBandwidthV0:
+ """
+ XDR Source Code::
+
+ struct ConfigSettingContractBandwidthV0
+ {
+ // Maximum sum of all transaction sizes in the ledger in bytes
+ uint32 ledgerMaxTxsSizeBytes;
+ // Maximum size in bytes for a transaction
+ uint32 txMaxSizeBytes;
+
+ // Fee for 1 KB of transaction size
+ int64 feeTxSize1KB;
+ };
+ """
+
+ def __init__(
+ self,
+ ledger_max_txs_size_bytes: Uint32,
+ tx_max_size_bytes: Uint32,
+ fee_tx_size1_kb: Int64,
+ ) -> None:
+ self.ledger_max_txs_size_bytes = ledger_max_txs_size_bytes
+ self.tx_max_size_bytes = tx_max_size_bytes
+ self.fee_tx_size1_kb = fee_tx_size1_kb
+
+ def pack(self, packer: Packer) -> None:
+ self.ledger_max_txs_size_bytes.pack(packer)
+ self.tx_max_size_bytes.pack(packer)
+ self.fee_tx_size1_kb.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractBandwidthV0:
+ ledger_max_txs_size_bytes = Uint32.unpack(unpacker)
+ tx_max_size_bytes = Uint32.unpack(unpacker)
+ fee_tx_size1_kb = Int64.unpack(unpacker)
+ return cls(
+ ledger_max_txs_size_bytes=ledger_max_txs_size_bytes,
+ tx_max_size_bytes=tx_max_size_bytes,
+ fee_tx_size1_kb=fee_tx_size1_kb,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigSettingContractBandwidthV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigSettingContractBandwidthV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ledger_max_txs_size_bytes,
+ self.tx_max_size_bytes,
+ self.fee_tx_size1_kb,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ledger_max_txs_size_bytes == other.ledger_max_txs_size_bytes
+ and self.tx_max_size_bytes == other.tx_max_size_bytes
+ and self.fee_tx_size1_kb == other.fee_tx_size1_kb
+ )
+
+ def __str__(self):
+ out = [
+ f"ledger_max_txs_size_bytes={self.ledger_max_txs_size_bytes}",
+ f"tx_max_size_bytes={self.tx_max_size_bytes}",
+ f"fee_tx_size1_kb={self.fee_tx_size1_kb}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/config_setting_contract_compute_v0.py b/stellar_sdk/xdr/config_setting_contract_compute_v0.py
new file mode 100644
index 000000000..40c0490c3
--- /dev/null
+++ b/stellar_sdk/xdr/config_setting_contract_compute_v0.py
@@ -0,0 +1,112 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+from .uint32 import Uint32
+
+__all__ = ["ConfigSettingContractComputeV0"]
+
+
+class ConfigSettingContractComputeV0:
+ """
+ XDR Source Code::
+
+ struct ConfigSettingContractComputeV0
+ {
+ // Maximum instructions per ledger
+ int64 ledgerMaxInstructions;
+ // Maximum instructions per transaction
+ int64 txMaxInstructions;
+ // Cost of 10000 instructions
+ int64 feeRatePerInstructionsIncrement;
+
+ // Memory limit per transaction. Unlike instructions, there is no fee
+ // for memory, just the limit.
+ uint32 txMemoryLimit;
+ };
+ """
+
+ def __init__(
+ self,
+ ledger_max_instructions: Int64,
+ tx_max_instructions: Int64,
+ fee_rate_per_instructions_increment: Int64,
+ tx_memory_limit: Uint32,
+ ) -> None:
+ self.ledger_max_instructions = ledger_max_instructions
+ self.tx_max_instructions = tx_max_instructions
+ self.fee_rate_per_instructions_increment = fee_rate_per_instructions_increment
+ self.tx_memory_limit = tx_memory_limit
+
+ def pack(self, packer: Packer) -> None:
+ self.ledger_max_instructions.pack(packer)
+ self.tx_max_instructions.pack(packer)
+ self.fee_rate_per_instructions_increment.pack(packer)
+ self.tx_memory_limit.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractComputeV0:
+ ledger_max_instructions = Int64.unpack(unpacker)
+ tx_max_instructions = Int64.unpack(unpacker)
+ fee_rate_per_instructions_increment = Int64.unpack(unpacker)
+ tx_memory_limit = Uint32.unpack(unpacker)
+ return cls(
+ ledger_max_instructions=ledger_max_instructions,
+ tx_max_instructions=tx_max_instructions,
+ fee_rate_per_instructions_increment=fee_rate_per_instructions_increment,
+ tx_memory_limit=tx_memory_limit,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigSettingContractComputeV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigSettingContractComputeV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ledger_max_instructions,
+ self.tx_max_instructions,
+ self.fee_rate_per_instructions_increment,
+ self.tx_memory_limit,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ledger_max_instructions == other.ledger_max_instructions
+ and self.tx_max_instructions == other.tx_max_instructions
+ and self.fee_rate_per_instructions_increment
+ == other.fee_rate_per_instructions_increment
+ and self.tx_memory_limit == other.tx_memory_limit
+ )
+
+ def __str__(self):
+ out = [
+ f"ledger_max_instructions={self.ledger_max_instructions}",
+ f"tx_max_instructions={self.tx_max_instructions}",
+ f"fee_rate_per_instructions_increment={self.fee_rate_per_instructions_increment}",
+ f"tx_memory_limit={self.tx_memory_limit}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/config_setting_contract_events_v0.py b/stellar_sdk/xdr/config_setting_contract_events_v0.py
new file mode 100644
index 000000000..8705cd439
--- /dev/null
+++ b/stellar_sdk/xdr/config_setting_contract_events_v0.py
@@ -0,0 +1,90 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+from .uint32 import Uint32
+
+__all__ = ["ConfigSettingContractEventsV0"]
+
+
+class ConfigSettingContractEventsV0:
+ """
+ XDR Source Code::
+
+ struct ConfigSettingContractEventsV0
+ {
+ // Maximum size of events that a contract call can emit.
+ uint32 txMaxContractEventsSizeBytes;
+ // Fee for generating 1KB of contract events.
+ int64 feeContractEvents1KB;
+ };
+ """
+
+ def __init__(
+ self,
+ tx_max_contract_events_size_bytes: Uint32,
+ fee_contract_events1_kb: Int64,
+ ) -> None:
+ self.tx_max_contract_events_size_bytes = tx_max_contract_events_size_bytes
+ self.fee_contract_events1_kb = fee_contract_events1_kb
+
+ def pack(self, packer: Packer) -> None:
+ self.tx_max_contract_events_size_bytes.pack(packer)
+ self.fee_contract_events1_kb.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractEventsV0:
+ tx_max_contract_events_size_bytes = Uint32.unpack(unpacker)
+ fee_contract_events1_kb = Int64.unpack(unpacker)
+ return cls(
+ tx_max_contract_events_size_bytes=tx_max_contract_events_size_bytes,
+ fee_contract_events1_kb=fee_contract_events1_kb,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigSettingContractEventsV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigSettingContractEventsV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.tx_max_contract_events_size_bytes,
+ self.fee_contract_events1_kb,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.tx_max_contract_events_size_bytes
+ == other.tx_max_contract_events_size_bytes
+ and self.fee_contract_events1_kb == other.fee_contract_events1_kb
+ )
+
+ def __str__(self):
+ out = [
+ f"tx_max_contract_events_size_bytes={self.tx_max_contract_events_size_bytes}",
+ f"fee_contract_events1_kb={self.fee_contract_events1_kb}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/config_setting_contract_execution_lanes_v0.py b/stellar_sdk/xdr/config_setting_contract_execution_lanes_v0.py
new file mode 100644
index 000000000..49c3f79cd
--- /dev/null
+++ b/stellar_sdk/xdr/config_setting_contract_execution_lanes_v0.py
@@ -0,0 +1,72 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .uint32 import Uint32
+
+__all__ = ["ConfigSettingContractExecutionLanesV0"]
+
+
+class ConfigSettingContractExecutionLanesV0:
+ """
+ XDR Source Code::
+
+ struct ConfigSettingContractExecutionLanesV0
+ {
+ // maximum number of Soroban transactions per ledger
+ uint32 ledgerMaxTxCount;
+ };
+ """
+
+ def __init__(
+ self,
+ ledger_max_tx_count: Uint32,
+ ) -> None:
+ self.ledger_max_tx_count = ledger_max_tx_count
+
+ def pack(self, packer: Packer) -> None:
+ self.ledger_max_tx_count.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractExecutionLanesV0:
+ ledger_max_tx_count = Uint32.unpack(unpacker)
+ return cls(
+ ledger_max_tx_count=ledger_max_tx_count,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigSettingContractExecutionLanesV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigSettingContractExecutionLanesV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.ledger_max_tx_count,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.ledger_max_tx_count == other.ledger_max_tx_count
+
+ def __str__(self):
+ out = [
+ f"ledger_max_tx_count={self.ledger_max_tx_count}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/config_setting_contract_historical_data_v0.py b/stellar_sdk/xdr/config_setting_contract_historical_data_v0.py
new file mode 100644
index 000000000..5dbe49243
--- /dev/null
+++ b/stellar_sdk/xdr/config_setting_contract_historical_data_v0.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+
+__all__ = ["ConfigSettingContractHistoricalDataV0"]
+
+
+class ConfigSettingContractHistoricalDataV0:
+ """
+ XDR Source Code::
+
+ struct ConfigSettingContractHistoricalDataV0
+ {
+ int64 feeHistorical1KB; // Fee for storing 1KB in archives
+ };
+ """
+
+ def __init__(
+ self,
+ fee_historical1_kb: Int64,
+ ) -> None:
+ self.fee_historical1_kb = fee_historical1_kb
+
+ def pack(self, packer: Packer) -> None:
+ self.fee_historical1_kb.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractHistoricalDataV0:
+ fee_historical1_kb = Int64.unpack(unpacker)
+ return cls(
+ fee_historical1_kb=fee_historical1_kb,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigSettingContractHistoricalDataV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigSettingContractHistoricalDataV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.fee_historical1_kb,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.fee_historical1_kb == other.fee_historical1_kb
+
+ def __str__(self):
+ out = [
+ f"fee_historical1_kb={self.fee_historical1_kb}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/config_setting_contract_ledger_cost_v0.py b/stellar_sdk/xdr/config_setting_contract_ledger_cost_v0.py
new file mode 100644
index 000000000..4ad0ee141
--- /dev/null
+++ b/stellar_sdk/xdr/config_setting_contract_ledger_cost_v0.py
@@ -0,0 +1,226 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+from .uint32 import Uint32
+
+__all__ = ["ConfigSettingContractLedgerCostV0"]
+
+
+class ConfigSettingContractLedgerCostV0:
+ """
+ XDR Source Code::
+
+ struct ConfigSettingContractLedgerCostV0
+ {
+ // Maximum number of ledger entry read operations per ledger
+ uint32 ledgerMaxReadLedgerEntries;
+ // Maximum number of bytes that can be read per ledger
+ uint32 ledgerMaxReadBytes;
+ // Maximum number of ledger entry write operations per ledger
+ uint32 ledgerMaxWriteLedgerEntries;
+ // Maximum number of bytes that can be written per ledger
+ uint32 ledgerMaxWriteBytes;
+
+ // Maximum number of ledger entry read operations per transaction
+ uint32 txMaxReadLedgerEntries;
+ // Maximum number of bytes that can be read per transaction
+ uint32 txMaxReadBytes;
+ // Maximum number of ledger entry write operations per transaction
+ uint32 txMaxWriteLedgerEntries;
+ // Maximum number of bytes that can be written per transaction
+ uint32 txMaxWriteBytes;
+
+ int64 feeReadLedgerEntry; // Fee per ledger entry read
+ int64 feeWriteLedgerEntry; // Fee per ledger entry write
+
+ int64 feeRead1KB; // Fee for reading 1KB
+
+ // The following parameters determine the write fee per 1KB.
+ // Write fee grows linearly until bucket list reaches this size
+ int64 bucketListTargetSizeBytes;
+ // Fee per 1KB write when the bucket list is empty
+ int64 writeFee1KBBucketListLow;
+ // Fee per 1KB write when the bucket list has reached `bucketListTargetSizeBytes`
+ int64 writeFee1KBBucketListHigh;
+ // Write fee multiplier for any additional data past the first `bucketListTargetSizeBytes`
+ uint32 bucketListWriteFeeGrowthFactor;
+ };
+ """
+
+ def __init__(
+ self,
+ ledger_max_read_ledger_entries: Uint32,
+ ledger_max_read_bytes: Uint32,
+ ledger_max_write_ledger_entries: Uint32,
+ ledger_max_write_bytes: Uint32,
+ tx_max_read_ledger_entries: Uint32,
+ tx_max_read_bytes: Uint32,
+ tx_max_write_ledger_entries: Uint32,
+ tx_max_write_bytes: Uint32,
+ fee_read_ledger_entry: Int64,
+ fee_write_ledger_entry: Int64,
+ fee_read1_kb: Int64,
+ bucket_list_target_size_bytes: Int64,
+ write_fee1_kb_bucket_list_low: Int64,
+ write_fee1_kb_bucket_list_high: Int64,
+ bucket_list_write_fee_growth_factor: Uint32,
+ ) -> None:
+ self.ledger_max_read_ledger_entries = ledger_max_read_ledger_entries
+ self.ledger_max_read_bytes = ledger_max_read_bytes
+ self.ledger_max_write_ledger_entries = ledger_max_write_ledger_entries
+ self.ledger_max_write_bytes = ledger_max_write_bytes
+ self.tx_max_read_ledger_entries = tx_max_read_ledger_entries
+ self.tx_max_read_bytes = tx_max_read_bytes
+ self.tx_max_write_ledger_entries = tx_max_write_ledger_entries
+ self.tx_max_write_bytes = tx_max_write_bytes
+ self.fee_read_ledger_entry = fee_read_ledger_entry
+ self.fee_write_ledger_entry = fee_write_ledger_entry
+ self.fee_read1_kb = fee_read1_kb
+ self.bucket_list_target_size_bytes = bucket_list_target_size_bytes
+ self.write_fee1_kb_bucket_list_low = write_fee1_kb_bucket_list_low
+ self.write_fee1_kb_bucket_list_high = write_fee1_kb_bucket_list_high
+ self.bucket_list_write_fee_growth_factor = bucket_list_write_fee_growth_factor
+
+ def pack(self, packer: Packer) -> None:
+ self.ledger_max_read_ledger_entries.pack(packer)
+ self.ledger_max_read_bytes.pack(packer)
+ self.ledger_max_write_ledger_entries.pack(packer)
+ self.ledger_max_write_bytes.pack(packer)
+ self.tx_max_read_ledger_entries.pack(packer)
+ self.tx_max_read_bytes.pack(packer)
+ self.tx_max_write_ledger_entries.pack(packer)
+ self.tx_max_write_bytes.pack(packer)
+ self.fee_read_ledger_entry.pack(packer)
+ self.fee_write_ledger_entry.pack(packer)
+ self.fee_read1_kb.pack(packer)
+ self.bucket_list_target_size_bytes.pack(packer)
+ self.write_fee1_kb_bucket_list_low.pack(packer)
+ self.write_fee1_kb_bucket_list_high.pack(packer)
+ self.bucket_list_write_fee_growth_factor.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractLedgerCostV0:
+ ledger_max_read_ledger_entries = Uint32.unpack(unpacker)
+ ledger_max_read_bytes = Uint32.unpack(unpacker)
+ ledger_max_write_ledger_entries = Uint32.unpack(unpacker)
+ ledger_max_write_bytes = Uint32.unpack(unpacker)
+ tx_max_read_ledger_entries = Uint32.unpack(unpacker)
+ tx_max_read_bytes = Uint32.unpack(unpacker)
+ tx_max_write_ledger_entries = Uint32.unpack(unpacker)
+ tx_max_write_bytes = Uint32.unpack(unpacker)
+ fee_read_ledger_entry = Int64.unpack(unpacker)
+ fee_write_ledger_entry = Int64.unpack(unpacker)
+ fee_read1_kb = Int64.unpack(unpacker)
+ bucket_list_target_size_bytes = Int64.unpack(unpacker)
+ write_fee1_kb_bucket_list_low = Int64.unpack(unpacker)
+ write_fee1_kb_bucket_list_high = Int64.unpack(unpacker)
+ bucket_list_write_fee_growth_factor = Uint32.unpack(unpacker)
+ return cls(
+ ledger_max_read_ledger_entries=ledger_max_read_ledger_entries,
+ ledger_max_read_bytes=ledger_max_read_bytes,
+ ledger_max_write_ledger_entries=ledger_max_write_ledger_entries,
+ ledger_max_write_bytes=ledger_max_write_bytes,
+ tx_max_read_ledger_entries=tx_max_read_ledger_entries,
+ tx_max_read_bytes=tx_max_read_bytes,
+ tx_max_write_ledger_entries=tx_max_write_ledger_entries,
+ tx_max_write_bytes=tx_max_write_bytes,
+ fee_read_ledger_entry=fee_read_ledger_entry,
+ fee_write_ledger_entry=fee_write_ledger_entry,
+ fee_read1_kb=fee_read1_kb,
+ bucket_list_target_size_bytes=bucket_list_target_size_bytes,
+ write_fee1_kb_bucket_list_low=write_fee1_kb_bucket_list_low,
+ write_fee1_kb_bucket_list_high=write_fee1_kb_bucket_list_high,
+ bucket_list_write_fee_growth_factor=bucket_list_write_fee_growth_factor,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigSettingContractLedgerCostV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigSettingContractLedgerCostV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ledger_max_read_ledger_entries,
+ self.ledger_max_read_bytes,
+ self.ledger_max_write_ledger_entries,
+ self.ledger_max_write_bytes,
+ self.tx_max_read_ledger_entries,
+ self.tx_max_read_bytes,
+ self.tx_max_write_ledger_entries,
+ self.tx_max_write_bytes,
+ self.fee_read_ledger_entry,
+ self.fee_write_ledger_entry,
+ self.fee_read1_kb,
+ self.bucket_list_target_size_bytes,
+ self.write_fee1_kb_bucket_list_low,
+ self.write_fee1_kb_bucket_list_high,
+ self.bucket_list_write_fee_growth_factor,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ledger_max_read_ledger_entries == other.ledger_max_read_ledger_entries
+ and self.ledger_max_read_bytes == other.ledger_max_read_bytes
+ and self.ledger_max_write_ledger_entries
+ == other.ledger_max_write_ledger_entries
+ and self.ledger_max_write_bytes == other.ledger_max_write_bytes
+ and self.tx_max_read_ledger_entries == other.tx_max_read_ledger_entries
+ and self.tx_max_read_bytes == other.tx_max_read_bytes
+ and self.tx_max_write_ledger_entries == other.tx_max_write_ledger_entries
+ and self.tx_max_write_bytes == other.tx_max_write_bytes
+ and self.fee_read_ledger_entry == other.fee_read_ledger_entry
+ and self.fee_write_ledger_entry == other.fee_write_ledger_entry
+ and self.fee_read1_kb == other.fee_read1_kb
+ and self.bucket_list_target_size_bytes
+ == other.bucket_list_target_size_bytes
+ and self.write_fee1_kb_bucket_list_low
+ == other.write_fee1_kb_bucket_list_low
+ and self.write_fee1_kb_bucket_list_high
+ == other.write_fee1_kb_bucket_list_high
+ and self.bucket_list_write_fee_growth_factor
+ == other.bucket_list_write_fee_growth_factor
+ )
+
+ def __str__(self):
+ out = [
+ f"ledger_max_read_ledger_entries={self.ledger_max_read_ledger_entries}",
+ f"ledger_max_read_bytes={self.ledger_max_read_bytes}",
+ f"ledger_max_write_ledger_entries={self.ledger_max_write_ledger_entries}",
+ f"ledger_max_write_bytes={self.ledger_max_write_bytes}",
+ f"tx_max_read_ledger_entries={self.tx_max_read_ledger_entries}",
+ f"tx_max_read_bytes={self.tx_max_read_bytes}",
+ f"tx_max_write_ledger_entries={self.tx_max_write_ledger_entries}",
+ f"tx_max_write_bytes={self.tx_max_write_bytes}",
+ f"fee_read_ledger_entry={self.fee_read_ledger_entry}",
+ f"fee_write_ledger_entry={self.fee_write_ledger_entry}",
+ f"fee_read1_kb={self.fee_read1_kb}",
+ f"bucket_list_target_size_bytes={self.bucket_list_target_size_bytes}",
+ f"write_fee1_kb_bucket_list_low={self.write_fee1_kb_bucket_list_low}",
+ f"write_fee1_kb_bucket_list_high={self.write_fee1_kb_bucket_list_high}",
+ f"bucket_list_write_fee_growth_factor={self.bucket_list_write_fee_growth_factor}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/config_setting_entry.py b/stellar_sdk/xdr/config_setting_entry.py
new file mode 100644
index 000000000..59e77d1fe
--- /dev/null
+++ b/stellar_sdk/xdr/config_setting_entry.py
@@ -0,0 +1,431 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .config_setting_contract_bandwidth_v0 import ConfigSettingContractBandwidthV0
+from .config_setting_contract_compute_v0 import ConfigSettingContractComputeV0
+from .config_setting_contract_events_v0 import ConfigSettingContractEventsV0
+from .config_setting_contract_execution_lanes_v0 import (
+ ConfigSettingContractExecutionLanesV0,
+)
+from .config_setting_contract_historical_data_v0 import (
+ ConfigSettingContractHistoricalDataV0,
+)
+from .config_setting_contract_ledger_cost_v0 import ConfigSettingContractLedgerCostV0
+from .config_setting_id import ConfigSettingID
+from .contract_cost_params import ContractCostParams
+from .eviction_iterator import EvictionIterator
+from .state_expiration_settings import StateExpirationSettings
+from .uint32 import Uint32
+from .uint64 import Uint64
+
+__all__ = ["ConfigSettingEntry"]
+
+
+class ConfigSettingEntry:
+ """
+ XDR Source Code::
+
+ union ConfigSettingEntry switch (ConfigSettingID configSettingID)
+ {
+ case CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES:
+ uint32 contractMaxSizeBytes;
+ case CONFIG_SETTING_CONTRACT_COMPUTE_V0:
+ ConfigSettingContractComputeV0 contractCompute;
+ case CONFIG_SETTING_CONTRACT_LEDGER_COST_V0:
+ ConfigSettingContractLedgerCostV0 contractLedgerCost;
+ case CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0:
+ ConfigSettingContractHistoricalDataV0 contractHistoricalData;
+ case CONFIG_SETTING_CONTRACT_EVENTS_V0:
+ ConfigSettingContractEventsV0 contractEvents;
+ case CONFIG_SETTING_CONTRACT_BANDWIDTH_V0:
+ ConfigSettingContractBandwidthV0 contractBandwidth;
+ case CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS:
+ ContractCostParams contractCostParamsCpuInsns;
+ case CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES:
+ ContractCostParams contractCostParamsMemBytes;
+ case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES:
+ uint32 contractDataKeySizeBytes;
+ case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES:
+ uint32 contractDataEntrySizeBytes;
+ case CONFIG_SETTING_STATE_EXPIRATION:
+ StateExpirationSettings stateExpirationSettings;
+ case CONFIG_SETTING_CONTRACT_EXECUTION_LANES:
+ ConfigSettingContractExecutionLanesV0 contractExecutionLanes;
+ case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW:
+ uint64 bucketListSizeWindow<>;
+ case CONFIG_SETTING_EVICTION_ITERATOR:
+ EvictionIterator evictionIterator;
+ };
+ """
+
+ def __init__(
+ self,
+ config_setting_id: ConfigSettingID,
+ contract_max_size_bytes: Uint32 = None,
+ contract_compute: ConfigSettingContractComputeV0 = None,
+ contract_ledger_cost: ConfigSettingContractLedgerCostV0 = None,
+ contract_historical_data: ConfigSettingContractHistoricalDataV0 = None,
+ contract_events: ConfigSettingContractEventsV0 = None,
+ contract_bandwidth: ConfigSettingContractBandwidthV0 = None,
+ contract_cost_params_cpu_insns: ContractCostParams = None,
+ contract_cost_params_mem_bytes: ContractCostParams = None,
+ contract_data_key_size_bytes: Uint32 = None,
+ contract_data_entry_size_bytes: Uint32 = None,
+ state_expiration_settings: StateExpirationSettings = None,
+ contract_execution_lanes: ConfigSettingContractExecutionLanesV0 = None,
+ bucket_list_size_window: List[Uint64] = None,
+ eviction_iterator: EvictionIterator = None,
+ ) -> None:
+ _expect_max_length = 4294967295
+ if (
+ bucket_list_size_window
+ and len(bucket_list_size_window) > _expect_max_length
+ ):
+ raise ValueError(
+ f"The maximum length of `bucket_list_size_window` should be {_expect_max_length}, but got {len(bucket_list_size_window)}."
+ )
+ self.config_setting_id = config_setting_id
+ self.contract_max_size_bytes = contract_max_size_bytes
+ self.contract_compute = contract_compute
+ self.contract_ledger_cost = contract_ledger_cost
+ self.contract_historical_data = contract_historical_data
+ self.contract_events = contract_events
+ self.contract_bandwidth = contract_bandwidth
+ self.contract_cost_params_cpu_insns = contract_cost_params_cpu_insns
+ self.contract_cost_params_mem_bytes = contract_cost_params_mem_bytes
+ self.contract_data_key_size_bytes = contract_data_key_size_bytes
+ self.contract_data_entry_size_bytes = contract_data_entry_size_bytes
+ self.state_expiration_settings = state_expiration_settings
+ self.contract_execution_lanes = contract_execution_lanes
+ self.bucket_list_size_window = bucket_list_size_window
+ self.eviction_iterator = eviction_iterator
+
+ def pack(self, packer: Packer) -> None:
+ self.config_setting_id.pack(packer)
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES
+ ):
+ if self.contract_max_size_bytes is None:
+ raise ValueError("contract_max_size_bytes should not be None.")
+ self.contract_max_size_bytes.pack(packer)
+ return
+ if self.config_setting_id == ConfigSettingID.CONFIG_SETTING_CONTRACT_COMPUTE_V0:
+ if self.contract_compute is None:
+ raise ValueError("contract_compute should not be None.")
+ self.contract_compute.pack(packer)
+ return
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_LEDGER_COST_V0
+ ):
+ if self.contract_ledger_cost is None:
+ raise ValueError("contract_ledger_cost should not be None.")
+ self.contract_ledger_cost.pack(packer)
+ return
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0
+ ):
+ if self.contract_historical_data is None:
+ raise ValueError("contract_historical_data should not be None.")
+ self.contract_historical_data.pack(packer)
+ return
+ if self.config_setting_id == ConfigSettingID.CONFIG_SETTING_CONTRACT_EVENTS_V0:
+ if self.contract_events is None:
+ raise ValueError("contract_events should not be None.")
+ self.contract_events.pack(packer)
+ return
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_BANDWIDTH_V0
+ ):
+ if self.contract_bandwidth is None:
+ raise ValueError("contract_bandwidth should not be None.")
+ self.contract_bandwidth.pack(packer)
+ return
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS
+ ):
+ if self.contract_cost_params_cpu_insns is None:
+ raise ValueError("contract_cost_params_cpu_insns should not be None.")
+ self.contract_cost_params_cpu_insns.pack(packer)
+ return
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES
+ ):
+ if self.contract_cost_params_mem_bytes is None:
+ raise ValueError("contract_cost_params_mem_bytes should not be None.")
+ self.contract_cost_params_mem_bytes.pack(packer)
+ return
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES
+ ):
+ if self.contract_data_key_size_bytes is None:
+ raise ValueError("contract_data_key_size_bytes should not be None.")
+ self.contract_data_key_size_bytes.pack(packer)
+ return
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES
+ ):
+ if self.contract_data_entry_size_bytes is None:
+ raise ValueError("contract_data_entry_size_bytes should not be None.")
+ self.contract_data_entry_size_bytes.pack(packer)
+ return
+ if self.config_setting_id == ConfigSettingID.CONFIG_SETTING_STATE_EXPIRATION:
+ if self.state_expiration_settings is None:
+ raise ValueError("state_expiration_settings should not be None.")
+ self.state_expiration_settings.pack(packer)
+ return
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_EXECUTION_LANES
+ ):
+ if self.contract_execution_lanes is None:
+ raise ValueError("contract_execution_lanes should not be None.")
+ self.contract_execution_lanes.pack(packer)
+ return
+ if (
+ self.config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW
+ ):
+ if self.bucket_list_size_window is None:
+ raise ValueError("bucket_list_size_window should not be None.")
+ packer.pack_uint(len(self.bucket_list_size_window))
+ for bucket_list_size_window_item in self.bucket_list_size_window:
+ bucket_list_size_window_item.pack(packer)
+ return
+ if self.config_setting_id == ConfigSettingID.CONFIG_SETTING_EVICTION_ITERATOR:
+ if self.eviction_iterator is None:
+ raise ValueError("eviction_iterator should not be None.")
+ self.eviction_iterator.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigSettingEntry:
+ config_setting_id = ConfigSettingID.unpack(unpacker)
+ if config_setting_id == ConfigSettingID.CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES:
+ contract_max_size_bytes = Uint32.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id,
+ contract_max_size_bytes=contract_max_size_bytes,
+ )
+ if config_setting_id == ConfigSettingID.CONFIG_SETTING_CONTRACT_COMPUTE_V0:
+ contract_compute = ConfigSettingContractComputeV0.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id, contract_compute=contract_compute
+ )
+ if config_setting_id == ConfigSettingID.CONFIG_SETTING_CONTRACT_LEDGER_COST_V0:
+ contract_ledger_cost = ConfigSettingContractLedgerCostV0.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id,
+ contract_ledger_cost=contract_ledger_cost,
+ )
+ if (
+ config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0
+ ):
+ contract_historical_data = ConfigSettingContractHistoricalDataV0.unpack(
+ unpacker
+ )
+ return cls(
+ config_setting_id=config_setting_id,
+ contract_historical_data=contract_historical_data,
+ )
+ if config_setting_id == ConfigSettingID.CONFIG_SETTING_CONTRACT_EVENTS_V0:
+ contract_events = ConfigSettingContractEventsV0.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id, contract_events=contract_events
+ )
+ if config_setting_id == ConfigSettingID.CONFIG_SETTING_CONTRACT_BANDWIDTH_V0:
+ contract_bandwidth = ConfigSettingContractBandwidthV0.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id,
+ contract_bandwidth=contract_bandwidth,
+ )
+ if (
+ config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS
+ ):
+ contract_cost_params_cpu_insns = ContractCostParams.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id,
+ contract_cost_params_cpu_insns=contract_cost_params_cpu_insns,
+ )
+ if (
+ config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES
+ ):
+ contract_cost_params_mem_bytes = ContractCostParams.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id,
+ contract_cost_params_mem_bytes=contract_cost_params_mem_bytes,
+ )
+ if (
+ config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES
+ ):
+ contract_data_key_size_bytes = Uint32.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id,
+ contract_data_key_size_bytes=contract_data_key_size_bytes,
+ )
+ if (
+ config_setting_id
+ == ConfigSettingID.CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES
+ ):
+ contract_data_entry_size_bytes = Uint32.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id,
+ contract_data_entry_size_bytes=contract_data_entry_size_bytes,
+ )
+ if config_setting_id == ConfigSettingID.CONFIG_SETTING_STATE_EXPIRATION:
+ state_expiration_settings = StateExpirationSettings.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id,
+ state_expiration_settings=state_expiration_settings,
+ )
+ if config_setting_id == ConfigSettingID.CONFIG_SETTING_CONTRACT_EXECUTION_LANES:
+ contract_execution_lanes = ConfigSettingContractExecutionLanesV0.unpack(
+ unpacker
+ )
+ return cls(
+ config_setting_id=config_setting_id,
+ contract_execution_lanes=contract_execution_lanes,
+ )
+ if config_setting_id == ConfigSettingID.CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW:
+ length = unpacker.unpack_uint()
+ bucket_list_size_window = []
+ for _ in range(length):
+ bucket_list_size_window.append(Uint64.unpack(unpacker))
+ return cls(
+ config_setting_id=config_setting_id,
+ bucket_list_size_window=bucket_list_size_window,
+ )
+ if config_setting_id == ConfigSettingID.CONFIG_SETTING_EVICTION_ITERATOR:
+ eviction_iterator = EvictionIterator.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id, eviction_iterator=eviction_iterator
+ )
+ return cls(config_setting_id=config_setting_id)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigSettingEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigSettingEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.config_setting_id,
+ self.contract_max_size_bytes,
+ self.contract_compute,
+ self.contract_ledger_cost,
+ self.contract_historical_data,
+ self.contract_events,
+ self.contract_bandwidth,
+ self.contract_cost_params_cpu_insns,
+ self.contract_cost_params_mem_bytes,
+ self.contract_data_key_size_bytes,
+ self.contract_data_entry_size_bytes,
+ self.state_expiration_settings,
+ self.contract_execution_lanes,
+ self.bucket_list_size_window,
+ self.eviction_iterator,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.config_setting_id == other.config_setting_id
+ and self.contract_max_size_bytes == other.contract_max_size_bytes
+ and self.contract_compute == other.contract_compute
+ and self.contract_ledger_cost == other.contract_ledger_cost
+ and self.contract_historical_data == other.contract_historical_data
+ and self.contract_events == other.contract_events
+ and self.contract_bandwidth == other.contract_bandwidth
+ and self.contract_cost_params_cpu_insns
+ == other.contract_cost_params_cpu_insns
+ and self.contract_cost_params_mem_bytes
+ == other.contract_cost_params_mem_bytes
+ and self.contract_data_key_size_bytes == other.contract_data_key_size_bytes
+ and self.contract_data_entry_size_bytes
+ == other.contract_data_entry_size_bytes
+ and self.state_expiration_settings == other.state_expiration_settings
+ and self.contract_execution_lanes == other.contract_execution_lanes
+ and self.bucket_list_size_window == other.bucket_list_size_window
+ and self.eviction_iterator == other.eviction_iterator
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"config_setting_id={self.config_setting_id}")
+ out.append(
+ f"contract_max_size_bytes={self.contract_max_size_bytes}"
+ ) if self.contract_max_size_bytes is not None else None
+ out.append(
+ f"contract_compute={self.contract_compute}"
+ ) if self.contract_compute is not None else None
+ out.append(
+ f"contract_ledger_cost={self.contract_ledger_cost}"
+ ) if self.contract_ledger_cost is not None else None
+ out.append(
+ f"contract_historical_data={self.contract_historical_data}"
+ ) if self.contract_historical_data is not None else None
+ out.append(
+ f"contract_events={self.contract_events}"
+ ) if self.contract_events is not None else None
+ out.append(
+ f"contract_bandwidth={self.contract_bandwidth}"
+ ) if self.contract_bandwidth is not None else None
+ out.append(
+ f"contract_cost_params_cpu_insns={self.contract_cost_params_cpu_insns}"
+ ) if self.contract_cost_params_cpu_insns is not None else None
+ out.append(
+ f"contract_cost_params_mem_bytes={self.contract_cost_params_mem_bytes}"
+ ) if self.contract_cost_params_mem_bytes is not None else None
+ out.append(
+ f"contract_data_key_size_bytes={self.contract_data_key_size_bytes}"
+ ) if self.contract_data_key_size_bytes is not None else None
+ out.append(
+ f"contract_data_entry_size_bytes={self.contract_data_entry_size_bytes}"
+ ) if self.contract_data_entry_size_bytes is not None else None
+ out.append(
+ f"state_expiration_settings={self.state_expiration_settings}"
+ ) if self.state_expiration_settings is not None else None
+ out.append(
+ f"contract_execution_lanes={self.contract_execution_lanes}"
+ ) if self.contract_execution_lanes is not None else None
+ out.append(
+ f"bucket_list_size_window={self.bucket_list_size_window}"
+ ) if self.bucket_list_size_window is not None else None
+ out.append(
+ f"eviction_iterator={self.eviction_iterator}"
+ ) if self.eviction_iterator is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/config_setting_id.py b/stellar_sdk/xdr/config_setting_id.py
new file mode 100644
index 000000000..c176dc4b6
--- /dev/null
+++ b/stellar_sdk/xdr/config_setting_id.py
@@ -0,0 +1,76 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["ConfigSettingID"]
+
+
+class ConfigSettingID(IntEnum):
+ """
+ XDR Source Code::
+
+ enum ConfigSettingID
+ {
+ CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES = 0,
+ CONFIG_SETTING_CONTRACT_COMPUTE_V0 = 1,
+ CONFIG_SETTING_CONTRACT_LEDGER_COST_V0 = 2,
+ CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0 = 3,
+ CONFIG_SETTING_CONTRACT_EVENTS_V0 = 4,
+ CONFIG_SETTING_CONTRACT_BANDWIDTH_V0 = 5,
+ CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS = 6,
+ CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7,
+ CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8,
+ CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9,
+ CONFIG_SETTING_STATE_EXPIRATION = 10,
+ CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11,
+ CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12,
+ CONFIG_SETTING_EVICTION_ITERATOR = 13
+ };
+ """
+
+ CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES = 0
+ CONFIG_SETTING_CONTRACT_COMPUTE_V0 = 1
+ CONFIG_SETTING_CONTRACT_LEDGER_COST_V0 = 2
+ CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0 = 3
+ CONFIG_SETTING_CONTRACT_EVENTS_V0 = 4
+ CONFIG_SETTING_CONTRACT_BANDWIDTH_V0 = 5
+ CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS = 6
+ CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7
+ CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8
+ CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9
+ CONFIG_SETTING_STATE_EXPIRATION = 10
+ CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11
+ CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12
+ CONFIG_SETTING_EVICTION_ITERATOR = 13
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigSettingID:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigSettingID:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigSettingID:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/config_upgrade_set.py b/stellar_sdk/xdr/config_upgrade_set.py
new file mode 100644
index 000000000..a0e0b35ee
--- /dev/null
+++ b/stellar_sdk/xdr/config_upgrade_set.py
@@ -0,0 +1,81 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .config_setting_entry import ConfigSettingEntry
+
+__all__ = ["ConfigUpgradeSet"]
+
+
+class ConfigUpgradeSet:
+ """
+ XDR Source Code::
+
+ struct ConfigUpgradeSet {
+ ConfigSettingEntry updatedEntry<>;
+ };
+ """
+
+ def __init__(
+ self,
+ updated_entry: List[ConfigSettingEntry],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if updated_entry and len(updated_entry) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `updated_entry` should be {_expect_max_length}, but got {len(updated_entry)}."
+ )
+ self.updated_entry = updated_entry
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_uint(len(self.updated_entry))
+ for updated_entry_item in self.updated_entry:
+ updated_entry_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigUpgradeSet:
+ length = unpacker.unpack_uint()
+ updated_entry = []
+ for _ in range(length):
+ updated_entry.append(ConfigSettingEntry.unpack(unpacker))
+ return cls(
+ updated_entry=updated_entry,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigUpgradeSet:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigUpgradeSet:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.updated_entry,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.updated_entry == other.updated_entry
+
+ def __str__(self):
+ out = [
+ f"updated_entry={self.updated_entry}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/config_upgrade_set_key.py b/stellar_sdk/xdr/config_upgrade_set_key.py
new file mode 100644
index 000000000..c1eb49b76
--- /dev/null
+++ b/stellar_sdk/xdr/config_upgrade_set_key.py
@@ -0,0 +1,85 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .hash import Hash
+
+__all__ = ["ConfigUpgradeSetKey"]
+
+
+class ConfigUpgradeSetKey:
+ """
+ XDR Source Code::
+
+ struct ConfigUpgradeSetKey {
+ Hash contractID;
+ Hash contentHash;
+ };
+ """
+
+ def __init__(
+ self,
+ contract_id: Hash,
+ content_hash: Hash,
+ ) -> None:
+ self.contract_id = contract_id
+ self.content_hash = content_hash
+
+ def pack(self, packer: Packer) -> None:
+ self.contract_id.pack(packer)
+ self.content_hash.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ConfigUpgradeSetKey:
+ contract_id = Hash.unpack(unpacker)
+ content_hash = Hash.unpack(unpacker)
+ return cls(
+ contract_id=contract_id,
+ content_hash=content_hash,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ConfigUpgradeSetKey:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ConfigUpgradeSetKey:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.contract_id,
+ self.content_hash,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.contract_id == other.contract_id
+ and self.content_hash == other.content_hash
+ )
+
+ def __str__(self):
+ out = [
+ f"contract_id={self.contract_id}",
+ f"content_hash={self.content_hash}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/constants.py b/stellar_sdk/xdr/constants.py
index 25fe3fa5d..6b9e14dd3 100644
--- a/stellar_sdk/xdr/constants.py
+++ b/stellar_sdk/xdr/constants.py
@@ -18,7 +18,19 @@
MASK_CLAIMABLE_BALANCE_FLAGS: int = 0x1
#: const MASK_LEDGER_HEADER_FLAGS = 0x7;
MASK_LEDGER_HEADER_FLAGS: int = 0x7
-#: const LIQUIDITY_POOL_FEE_V18 = 30;
-LIQUIDITY_POOL_FEE_V18: int = 30
+#: const AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED = 200;
+AUTH_MSG_FLAG_FLOW_CONTROL_BYTES_REQUESTED: int = 200
+#: const TX_ADVERT_VECTOR_MAX_SIZE = 1000;
+TX_ADVERT_VECTOR_MAX_SIZE: int = 1000
+#: const TX_DEMAND_VECTOR_MAX_SIZE = 1000;
+TX_DEMAND_VECTOR_MAX_SIZE: int = 1000
#: const MAX_OPS_PER_TX = 100;
MAX_OPS_PER_TX: int = 100
+#: const LIQUIDITY_POOL_FEE_V18 = 30;
+LIQUIDITY_POOL_FEE_V18: int = 30
+#: const SC_SPEC_DOC_LIMIT = 1024;
+SC_SPEC_DOC_LIMIT: int = 1024
+#: const SCSYMBOL_LIMIT = 32;
+SCSYMBOL_LIMIT: int = 32
+#: const CONTRACT_COST_COUNT_LIMIT = 1024;
+CONTRACT_COST_COUNT_LIMIT: int = 1024
diff --git a/stellar_sdk/xdr/contract_code_entry.py b/stellar_sdk/xdr/contract_code_entry.py
new file mode 100644
index 000000000..f2ea28b3e
--- /dev/null
+++ b/stellar_sdk/xdr/contract_code_entry.py
@@ -0,0 +1,97 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Opaque
+from .extension_point import ExtensionPoint
+from .hash import Hash
+
+__all__ = ["ContractCodeEntry"]
+
+
+class ContractCodeEntry:
+ """
+ XDR Source Code::
+
+ struct ContractCodeEntry {
+ ExtensionPoint ext;
+
+ Hash hash;
+ opaque code<>;
+ };
+ """
+
+ def __init__(
+ self,
+ ext: ExtensionPoint,
+ hash: Hash,
+ code: bytes,
+ ) -> None:
+ self.ext = ext
+ self.hash = hash
+ self.code = code
+
+ def pack(self, packer: Packer) -> None:
+ self.ext.pack(packer)
+ self.hash.pack(packer)
+ Opaque(self.code, 4294967295, False).pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractCodeEntry:
+ ext = ExtensionPoint.unpack(unpacker)
+ hash = Hash.unpack(unpacker)
+ code = Opaque.unpack(unpacker, 4294967295, False)
+ return cls(
+ ext=ext,
+ hash=hash,
+ code=code,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractCodeEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractCodeEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.hash,
+ self.code,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ext == other.ext
+ and self.hash == other.hash
+ and self.code == other.code
+ )
+
+ def __str__(self):
+ out = [
+ f"ext={self.ext}",
+ f"hash={self.hash}",
+ f"code={self.code}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/contract_cost_param_entry.py b/stellar_sdk/xdr/contract_cost_param_entry.py
new file mode 100644
index 000000000..2d3a68a41
--- /dev/null
+++ b/stellar_sdk/xdr/contract_cost_param_entry.py
@@ -0,0 +1,97 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .extension_point import ExtensionPoint
+from .int64 import Int64
+
+__all__ = ["ContractCostParamEntry"]
+
+
+class ContractCostParamEntry:
+ """
+ XDR Source Code::
+
+ struct ContractCostParamEntry {
+ // use `ext` to add more terms (e.g. higher order polynomials) in the future
+ ExtensionPoint ext;
+
+ int64 constTerm;
+ int64 linearTerm;
+ };
+ """
+
+ def __init__(
+ self,
+ ext: ExtensionPoint,
+ const_term: Int64,
+ linear_term: Int64,
+ ) -> None:
+ self.ext = ext
+ self.const_term = const_term
+ self.linear_term = linear_term
+
+ def pack(self, packer: Packer) -> None:
+ self.ext.pack(packer)
+ self.const_term.pack(packer)
+ self.linear_term.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractCostParamEntry:
+ ext = ExtensionPoint.unpack(unpacker)
+ const_term = Int64.unpack(unpacker)
+ linear_term = Int64.unpack(unpacker)
+ return cls(
+ ext=ext,
+ const_term=const_term,
+ linear_term=linear_term,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractCostParamEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractCostParamEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.const_term,
+ self.linear_term,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ext == other.ext
+ and self.const_term == other.const_term
+ and self.linear_term == other.linear_term
+ )
+
+ def __str__(self):
+ out = [
+ f"ext={self.ext}",
+ f"const_term={self.const_term}",
+ f"linear_term={self.linear_term}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/contract_cost_params.py b/stellar_sdk/xdr/contract_cost_params.py
new file mode 100644
index 000000000..e7411691c
--- /dev/null
+++ b/stellar_sdk/xdr/contract_cost_params.py
@@ -0,0 +1,74 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .constants import *
+from .contract_cost_param_entry import ContractCostParamEntry
+
+__all__ = ["ContractCostParams"]
+
+
+class ContractCostParams:
+ """
+ XDR Source Code::
+
+ typedef ContractCostParamEntry ContractCostParams;
+ """
+
+ def __init__(self, contract_cost_params: List[ContractCostParamEntry]) -> None:
+ _expect_max_length = CONTRACT_COST_COUNT_LIMIT
+ if contract_cost_params and len(contract_cost_params) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `contract_cost_params` should be {_expect_max_length}, but got {len(contract_cost_params)}."
+ )
+ self.contract_cost_params = contract_cost_params
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_uint(len(self.contract_cost_params))
+ for contract_cost_params_item in self.contract_cost_params:
+ contract_cost_params_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractCostParams:
+ length = unpacker.unpack_uint()
+ contract_cost_params = []
+ for _ in range(length):
+ contract_cost_params.append(ContractCostParamEntry.unpack(unpacker))
+ return cls(contract_cost_params)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractCostParams:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractCostParams:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(self.contract_cost_params)
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.contract_cost_params == other.contract_cost_params
+
+ def __str__(self):
+ return (
+ f""
+ )
diff --git a/stellar_sdk/xdr/contract_cost_type.py b/stellar_sdk/xdr/contract_cost_type.py
new file mode 100644
index 000000000..afbb30e18
--- /dev/null
+++ b/stellar_sdk/xdr/contract_cost_type.py
@@ -0,0 +1,135 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["ContractCostType"]
+
+
+class ContractCostType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum ContractCostType {
+ // Cost of running 1 wasm instruction
+ WasmInsnExec = 0,
+ // Cost of growing wasm linear memory by 1 page
+ WasmMemAlloc = 1,
+ // Cost of allocating a chuck of host memory (in bytes)
+ HostMemAlloc = 2,
+ // Cost of copying a chuck of bytes into a pre-allocated host memory
+ HostMemCpy = 3,
+ // Cost of comparing two slices of host memory
+ HostMemCmp = 4,
+ // Cost of a host function dispatch, not including the actual work done by
+ // the function nor the cost of VM invocation machinary
+ DispatchHostFunction = 5,
+ // Cost of visiting a host object from the host object storage. Exists to
+ // make sure some baseline cost coverage, i.e. repeatly visiting objects
+ // by the guest will always incur some charges.
+ VisitObject = 6,
+ // Cost of serializing an xdr object to bytes
+ ValSer = 7,
+ // Cost of deserializing an xdr object from bytes
+ ValDeser = 8,
+ // Cost of computing the sha256 hash from bytes
+ ComputeSha256Hash = 9,
+ // Cost of computing the ed25519 pubkey from bytes
+ ComputeEd25519PubKey = 10,
+ // Cost of accessing an entry in a Map.
+ MapEntry = 11,
+ // Cost of accessing an entry in a Vec
+ VecEntry = 12,
+ // Cost of verifying ed25519 signature of a payload.
+ VerifyEd25519Sig = 13,
+ // Cost of reading a slice of vm linear memory
+ VmMemRead = 14,
+ // Cost of writing to a slice of vm linear memory
+ VmMemWrite = 15,
+ // Cost of instantiation a VM from wasm bytes code.
+ VmInstantiation = 16,
+ // Cost of instantiation a VM from a cached state.
+ VmCachedInstantiation = 17,
+ // Cost of invoking a function on the VM. If the function is a host function,
+ // additional cost will be covered by `DispatchHostFunction`.
+ InvokeVmFunction = 18,
+ // Cost of computing a keccak256 hash from bytes.
+ ComputeKeccak256Hash = 19,
+ // Cost of computing an ECDSA secp256k1 pubkey from bytes.
+ ComputeEcdsaSecp256k1Key = 20,
+ // Cost of computing an ECDSA secp256k1 signature from bytes.
+ ComputeEcdsaSecp256k1Sig = 21,
+ // Cost of recovering an ECDSA secp256k1 key from a signature.
+ RecoverEcdsaSecp256k1Key = 22,
+ // Cost of int256 addition (`+`) and subtraction (`-`) operations
+ Int256AddSub = 23,
+ // Cost of int256 multiplication (`*`) operation
+ Int256Mul = 24,
+ // Cost of int256 division (`/`) operation
+ Int256Div = 25,
+ // Cost of int256 power (`exp`) operation
+ Int256Pow = 26,
+ // Cost of int256 shift (`shl`, `shr`) operation
+ Int256Shift = 27
+ };
+ """
+
+ WasmInsnExec = 0
+ WasmMemAlloc = 1
+ HostMemAlloc = 2
+ HostMemCpy = 3
+ HostMemCmp = 4
+ DispatchHostFunction = 5
+ VisitObject = 6
+ ValSer = 7
+ ValDeser = 8
+ ComputeSha256Hash = 9
+ ComputeEd25519PubKey = 10
+ MapEntry = 11
+ VecEntry = 12
+ VerifyEd25519Sig = 13
+ VmMemRead = 14
+ VmMemWrite = 15
+ VmInstantiation = 16
+ VmCachedInstantiation = 17
+ InvokeVmFunction = 18
+ ComputeKeccak256Hash = 19
+ ComputeEcdsaSecp256k1Key = 20
+ ComputeEcdsaSecp256k1Sig = 21
+ RecoverEcdsaSecp256k1Key = 22
+ Int256AddSub = 23
+ Int256Mul = 24
+ Int256Div = 25
+ Int256Pow = 26
+ Int256Shift = 27
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractCostType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractCostType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractCostType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/contract_data_durability.py b/stellar_sdk/xdr/contract_data_durability.py
new file mode 100644
index 000000000..b741716b9
--- /dev/null
+++ b/stellar_sdk/xdr/contract_data_durability.py
@@ -0,0 +1,51 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["ContractDataDurability"]
+
+
+class ContractDataDurability(IntEnum):
+ """
+ XDR Source Code::
+
+ enum ContractDataDurability {
+ TEMPORARY = 0,
+ PERSISTENT = 1
+ };
+ """
+
+ TEMPORARY = 0
+ PERSISTENT = 1
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractDataDurability:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractDataDurability:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractDataDurability:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/contract_data_entry.py b/stellar_sdk/xdr/contract_data_entry.py
new file mode 100644
index 000000000..11ef3a869
--- /dev/null
+++ b/stellar_sdk/xdr/contract_data_entry.py
@@ -0,0 +1,116 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .contract_data_durability import ContractDataDurability
+from .extension_point import ExtensionPoint
+from .sc_address import SCAddress
+from .sc_val import SCVal
+
+__all__ = ["ContractDataEntry"]
+
+
+class ContractDataEntry:
+ """
+ XDR Source Code::
+
+ struct ContractDataEntry {
+ ExtensionPoint ext;
+
+ SCAddress contract;
+ SCVal key;
+ ContractDataDurability durability;
+ SCVal val;
+ };
+ """
+
+ def __init__(
+ self,
+ ext: ExtensionPoint,
+ contract: SCAddress,
+ key: SCVal,
+ durability: ContractDataDurability,
+ val: SCVal,
+ ) -> None:
+ self.ext = ext
+ self.contract = contract
+ self.key = key
+ self.durability = durability
+ self.val = val
+
+ def pack(self, packer: Packer) -> None:
+ self.ext.pack(packer)
+ self.contract.pack(packer)
+ self.key.pack(packer)
+ self.durability.pack(packer)
+ self.val.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractDataEntry:
+ ext = ExtensionPoint.unpack(unpacker)
+ contract = SCAddress.unpack(unpacker)
+ key = SCVal.unpack(unpacker)
+ durability = ContractDataDurability.unpack(unpacker)
+ val = SCVal.unpack(unpacker)
+ return cls(
+ ext=ext,
+ contract=contract,
+ key=key,
+ durability=durability,
+ val=val,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractDataEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractDataEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.contract,
+ self.key,
+ self.durability,
+ self.val,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ext == other.ext
+ and self.contract == other.contract
+ and self.key == other.key
+ and self.durability == other.durability
+ and self.val == other.val
+ )
+
+ def __str__(self):
+ out = [
+ f"ext={self.ext}",
+ f"contract={self.contract}",
+ f"key={self.key}",
+ f"durability={self.durability}",
+ f"val={self.val}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/contract_event.py b/stellar_sdk/xdr/contract_event.py
new file mode 100644
index 000000000..fd1c92f79
--- /dev/null
+++ b/stellar_sdk/xdr/contract_event.py
@@ -0,0 +1,125 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import Optional
+
+from xdrlib3 import Packer, Unpacker
+
+from .contract_event_body import ContractEventBody
+from .contract_event_type import ContractEventType
+from .extension_point import ExtensionPoint
+from .hash import Hash
+
+__all__ = ["ContractEvent"]
+
+
+class ContractEvent:
+ """
+ XDR Source Code::
+
+ struct ContractEvent
+ {
+ // We can use this to add more fields, or because it
+ // is first, to change ContractEvent into a union.
+ ExtensionPoint ext;
+
+ Hash* contractID;
+ ContractEventType type;
+
+ union switch (int v)
+ {
+ case 0:
+ struct
+ {
+ SCVal topics<>;
+ SCVal data;
+ } v0;
+ }
+ body;
+ };
+ """
+
+ def __init__(
+ self,
+ ext: ExtensionPoint,
+ contract_id: Optional[Hash],
+ type: ContractEventType,
+ body: ContractEventBody,
+ ) -> None:
+ self.ext = ext
+ self.contract_id = contract_id
+ self.type = type
+ self.body = body
+
+ def pack(self, packer: Packer) -> None:
+ self.ext.pack(packer)
+ if self.contract_id is None:
+ packer.pack_uint(0)
+ else:
+ packer.pack_uint(1)
+ self.contract_id.pack(packer)
+ self.type.pack(packer)
+ self.body.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractEvent:
+ ext = ExtensionPoint.unpack(unpacker)
+ contract_id = Hash.unpack(unpacker) if unpacker.unpack_uint() else None
+ type = ContractEventType.unpack(unpacker)
+ body = ContractEventBody.unpack(unpacker)
+ return cls(
+ ext=ext,
+ contract_id=contract_id,
+ type=type,
+ body=body,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractEvent:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractEvent:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.contract_id,
+ self.type,
+ self.body,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ext == other.ext
+ and self.contract_id == other.contract_id
+ and self.type == other.type
+ and self.body == other.body
+ )
+
+ def __str__(self):
+ out = [
+ f"ext={self.ext}",
+ f"contract_id={self.contract_id}",
+ f"type={self.type}",
+ f"body={self.body}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/contract_event_body.py b/stellar_sdk/xdr/contract_event_body.py
new file mode 100644
index 000000000..378ad283e
--- /dev/null
+++ b/stellar_sdk/xdr/contract_event_body.py
@@ -0,0 +1,90 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Integer
+from .contract_event_v0 import ContractEventV0
+
+__all__ = ["ContractEventBody"]
+
+
+class ContractEventBody:
+ """
+ XDR Source Code::
+
+ union switch (int v)
+ {
+ case 0:
+ struct
+ {
+ SCVal topics<>;
+ SCVal data;
+ } v0;
+ }
+ """
+
+ def __init__(
+ self,
+ v: int,
+ v0: ContractEventV0 = None,
+ ) -> None:
+ self.v = v
+ self.v0 = v0
+
+ def pack(self, packer: Packer) -> None:
+ Integer(self.v).pack(packer)
+ if self.v == 0:
+ if self.v0 is None:
+ raise ValueError("v0 should not be None.")
+ self.v0.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractEventBody:
+ v = Integer.unpack(unpacker)
+ if v == 0:
+ v0 = ContractEventV0.unpack(unpacker)
+ return cls(v=v, v0=v0)
+ return cls(v=v)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractEventBody:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractEventBody:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v0,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.v == other.v and self.v0 == other.v0
+
+ def __str__(self):
+ out = []
+ out.append(f"v={self.v}")
+ out.append(f"v0={self.v0}") if self.v0 is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/contract_event_type.py b/stellar_sdk/xdr/contract_event_type.py
new file mode 100644
index 000000000..2175ba44a
--- /dev/null
+++ b/stellar_sdk/xdr/contract_event_type.py
@@ -0,0 +1,54 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["ContractEventType"]
+
+
+class ContractEventType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum ContractEventType
+ {
+ SYSTEM = 0,
+ CONTRACT = 1,
+ DIAGNOSTIC = 2
+ };
+ """
+
+ SYSTEM = 0
+ CONTRACT = 1
+ DIAGNOSTIC = 2
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractEventType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractEventType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractEventType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/contract_event_v0.py b/stellar_sdk/xdr/contract_event_v0.py
new file mode 100644
index 000000000..37da76f66
--- /dev/null
+++ b/stellar_sdk/xdr/contract_event_v0.py
@@ -0,0 +1,94 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_val import SCVal
+
+__all__ = ["ContractEventV0"]
+
+
+class ContractEventV0:
+ """
+ XDR Source Code::
+
+ struct
+ {
+ SCVal topics<>;
+ SCVal data;
+ }
+ """
+
+ def __init__(
+ self,
+ topics: List[SCVal],
+ data: SCVal,
+ ) -> None:
+ _expect_max_length = 4294967295
+ if topics and len(topics) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `topics` should be {_expect_max_length}, but got {len(topics)}."
+ )
+ self.topics = topics
+ self.data = data
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_uint(len(self.topics))
+ for topics_item in self.topics:
+ topics_item.pack(packer)
+ self.data.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractEventV0:
+ length = unpacker.unpack_uint()
+ topics = []
+ for _ in range(length):
+ topics.append(SCVal.unpack(unpacker))
+ data = SCVal.unpack(unpacker)
+ return cls(
+ topics=topics,
+ data=data,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractEventV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractEventV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.topics,
+ self.data,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.topics == other.topics and self.data == other.data
+
+ def __str__(self):
+ out = [
+ f"topics={self.topics}",
+ f"data={self.data}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/contract_executable.py b/stellar_sdk/xdr/contract_executable.py
new file mode 100644
index 000000000..f324c4915
--- /dev/null
+++ b/stellar_sdk/xdr/contract_executable.py
@@ -0,0 +1,94 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .contract_executable_type import ContractExecutableType
+from .hash import Hash
+
+__all__ = ["ContractExecutable"]
+
+
+class ContractExecutable:
+ """
+ XDR Source Code::
+
+ union ContractExecutable switch (ContractExecutableType type)
+ {
+ case CONTRACT_EXECUTABLE_WASM:
+ Hash wasm_hash;
+ case CONTRACT_EXECUTABLE_TOKEN:
+ void;
+ };
+ """
+
+ def __init__(
+ self,
+ type: ContractExecutableType,
+ wasm_hash: Hash = None,
+ ) -> None:
+ self.type = type
+ self.wasm_hash = wasm_hash
+
+ def pack(self, packer: Packer) -> None:
+ self.type.pack(packer)
+ if self.type == ContractExecutableType.CONTRACT_EXECUTABLE_WASM:
+ if self.wasm_hash is None:
+ raise ValueError("wasm_hash should not be None.")
+ self.wasm_hash.pack(packer)
+ return
+ if self.type == ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN:
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractExecutable:
+ type = ContractExecutableType.unpack(unpacker)
+ if type == ContractExecutableType.CONTRACT_EXECUTABLE_WASM:
+ wasm_hash = Hash.unpack(unpacker)
+ return cls(type=type, wasm_hash=wasm_hash)
+ if type == ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN:
+ return cls(type=type)
+ return cls(type=type)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractExecutable:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractExecutable:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.wasm_hash,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.type == other.type and self.wasm_hash == other.wasm_hash
+
+ def __str__(self):
+ out = []
+ out.append(f"type={self.type}")
+ out.append(
+ f"wasm_hash={self.wasm_hash}"
+ ) if self.wasm_hash is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/contract_executable_type.py b/stellar_sdk/xdr/contract_executable_type.py
new file mode 100644
index 000000000..7619af81f
--- /dev/null
+++ b/stellar_sdk/xdr/contract_executable_type.py
@@ -0,0 +1,52 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["ContractExecutableType"]
+
+
+class ContractExecutableType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum ContractExecutableType
+ {
+ CONTRACT_EXECUTABLE_WASM = 0,
+ CONTRACT_EXECUTABLE_TOKEN = 1
+ };
+ """
+
+ CONTRACT_EXECUTABLE_WASM = 0
+ CONTRACT_EXECUTABLE_TOKEN = 1
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractExecutableType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractExecutableType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractExecutableType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/contract_id_preimage.py b/stellar_sdk/xdr/contract_id_preimage.py
new file mode 100644
index 000000000..24f2031aa
--- /dev/null
+++ b/stellar_sdk/xdr/contract_id_preimage.py
@@ -0,0 +1,113 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .asset import Asset
+from .contract_id_preimage_from_address import ContractIDPreimageFromAddress
+from .contract_id_preimage_type import ContractIDPreimageType
+
+__all__ = ["ContractIDPreimage"]
+
+
+class ContractIDPreimage:
+ """
+ XDR Source Code::
+
+ union ContractIDPreimage switch (ContractIDPreimageType type)
+ {
+ case CONTRACT_ID_PREIMAGE_FROM_ADDRESS:
+ struct
+ {
+ SCAddress address;
+ uint256 salt;
+ } fromAddress;
+ case CONTRACT_ID_PREIMAGE_FROM_ASSET:
+ Asset fromAsset;
+ };
+ """
+
+ def __init__(
+ self,
+ type: ContractIDPreimageType,
+ from_address: ContractIDPreimageFromAddress = None,
+ from_asset: Asset = None,
+ ) -> None:
+ self.type = type
+ self.from_address = from_address
+ self.from_asset = from_asset
+
+ def pack(self, packer: Packer) -> None:
+ self.type.pack(packer)
+ if self.type == ContractIDPreimageType.CONTRACT_ID_PREIMAGE_FROM_ADDRESS:
+ if self.from_address is None:
+ raise ValueError("from_address should not be None.")
+ self.from_address.pack(packer)
+ return
+ if self.type == ContractIDPreimageType.CONTRACT_ID_PREIMAGE_FROM_ASSET:
+ if self.from_asset is None:
+ raise ValueError("from_asset should not be None.")
+ self.from_asset.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractIDPreimage:
+ type = ContractIDPreimageType.unpack(unpacker)
+ if type == ContractIDPreimageType.CONTRACT_ID_PREIMAGE_FROM_ADDRESS:
+ from_address = ContractIDPreimageFromAddress.unpack(unpacker)
+ return cls(type=type, from_address=from_address)
+ if type == ContractIDPreimageType.CONTRACT_ID_PREIMAGE_FROM_ASSET:
+ from_asset = Asset.unpack(unpacker)
+ return cls(type=type, from_asset=from_asset)
+ return cls(type=type)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractIDPreimage:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractIDPreimage:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.from_address,
+ self.from_asset,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.type == other.type
+ and self.from_address == other.from_address
+ and self.from_asset == other.from_asset
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"type={self.type}")
+ out.append(
+ f"from_address={self.from_address}"
+ ) if self.from_address is not None else None
+ out.append(
+ f"from_asset={self.from_asset}"
+ ) if self.from_asset is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/contract_id_preimage_from_address.py b/stellar_sdk/xdr/contract_id_preimage_from_address.py
new file mode 100644
index 000000000..2a06df0ba
--- /dev/null
+++ b/stellar_sdk/xdr/contract_id_preimage_from_address.py
@@ -0,0 +1,84 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_address import SCAddress
+from .uint256 import Uint256
+
+__all__ = ["ContractIDPreimageFromAddress"]
+
+
+class ContractIDPreimageFromAddress:
+ """
+ XDR Source Code::
+
+ struct
+ {
+ SCAddress address;
+ uint256 salt;
+ }
+ """
+
+ def __init__(
+ self,
+ address: SCAddress,
+ salt: Uint256,
+ ) -> None:
+ self.address = address
+ self.salt = salt
+
+ def pack(self, packer: Packer) -> None:
+ self.address.pack(packer)
+ self.salt.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractIDPreimageFromAddress:
+ address = SCAddress.unpack(unpacker)
+ salt = Uint256.unpack(unpacker)
+ return cls(
+ address=address,
+ salt=salt,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractIDPreimageFromAddress:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractIDPreimageFromAddress:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.address,
+ self.salt,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.address == other.address and self.salt == other.salt
+
+ def __str__(self):
+ out = [
+ f"address={self.address}",
+ f"salt={self.salt}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/contract_id_preimage_type.py b/stellar_sdk/xdr/contract_id_preimage_type.py
new file mode 100644
index 000000000..415eabf73
--- /dev/null
+++ b/stellar_sdk/xdr/contract_id_preimage_type.py
@@ -0,0 +1,52 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["ContractIDPreimageType"]
+
+
+class ContractIDPreimageType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum ContractIDPreimageType
+ {
+ CONTRACT_ID_PREIMAGE_FROM_ADDRESS = 0,
+ CONTRACT_ID_PREIMAGE_FROM_ASSET = 1
+ };
+ """
+
+ CONTRACT_ID_PREIMAGE_FROM_ADDRESS = 0
+ CONTRACT_ID_PREIMAGE_FROM_ASSET = 1
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ContractIDPreimageType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ContractIDPreimageType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ContractIDPreimageType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/create_account_op.py b/stellar_sdk/xdr/create_account_op.py
index cf57199f0..fa9df0df0 100644
--- a/stellar_sdk/xdr/create_account_op.py
+++ b/stellar_sdk/xdr/create_account_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.starting_balance.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "CreateAccountOp":
+ def unpack(cls, unpacker: Unpacker) -> CreateAccountOp:
destination = AccountID.unpack(unpacker)
starting_balance = Int64.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "CreateAccountOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> CreateAccountOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "CreateAccountOp":
+ def from_xdr(cls, xdr: str) -> CreateAccountOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.destination,
+ self.starting_balance,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/create_account_result.py b/stellar_sdk/xdr/create_account_result.py
index 5277a77a8..38f46f2f1 100644
--- a/stellar_sdk/xdr/create_account_result.py
+++ b/stellar_sdk/xdr/create_account_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .create_account_result_code import CreateAccountResultCode
@@ -16,7 +19,10 @@ class CreateAccountResult:
{
case CREATE_ACCOUNT_SUCCESS:
void;
- default:
+ case CREATE_ACCOUNT_MALFORMED:
+ case CREATE_ACCOUNT_UNDERFUNDED:
+ case CREATE_ACCOUNT_LOW_RESERVE:
+ case CREATE_ACCOUNT_ALREADY_EXIST:
void;
};
"""
@@ -31,12 +37,28 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == CreateAccountResultCode.CREATE_ACCOUNT_SUCCESS:
return
+ if self.code == CreateAccountResultCode.CREATE_ACCOUNT_MALFORMED:
+ return
+ if self.code == CreateAccountResultCode.CREATE_ACCOUNT_UNDERFUNDED:
+ return
+ if self.code == CreateAccountResultCode.CREATE_ACCOUNT_LOW_RESERVE:
+ return
+ if self.code == CreateAccountResultCode.CREATE_ACCOUNT_ALREADY_EXIST:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "CreateAccountResult":
+ def unpack(cls, unpacker: Unpacker) -> CreateAccountResult:
code = CreateAccountResultCode.unpack(unpacker)
if code == CreateAccountResultCode.CREATE_ACCOUNT_SUCCESS:
return cls(code=code)
+ if code == CreateAccountResultCode.CREATE_ACCOUNT_MALFORMED:
+ return cls(code=code)
+ if code == CreateAccountResultCode.CREATE_ACCOUNT_UNDERFUNDED:
+ return cls(code=code)
+ if code == CreateAccountResultCode.CREATE_ACCOUNT_LOW_RESERVE:
+ return cls(code=code)
+ if code == CreateAccountResultCode.CREATE_ACCOUNT_ALREADY_EXIST:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +67,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "CreateAccountResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> CreateAccountResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +76,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "CreateAccountResult":
+ def from_xdr(cls, xdr: str) -> CreateAccountResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/create_account_result_code.py b/stellar_sdk/xdr/create_account_result_code.py
index adcdd0c69..1b1cb2cfa 100644
--- a/stellar_sdk/xdr/create_account_result_code.py
+++ b/stellar_sdk/xdr/create_account_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["CreateAccountResultCode"]
@@ -35,7 +38,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "CreateAccountResultCode":
+ def unpack(cls, unpacker: Unpacker) -> CreateAccountResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -45,7 +48,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "CreateAccountResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> CreateAccountResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,6 +57,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "CreateAccountResultCode":
+ def from_xdr(cls, xdr: str) -> CreateAccountResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/create_claimable_balance_op.py b/stellar_sdk/xdr/create_claimable_balance_op.py
index 85da66307..78ee4a824 100644
--- a/stellar_sdk/xdr/create_claimable_balance_op.py
+++ b/stellar_sdk/xdr/create_claimable_balance_op.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -46,7 +49,7 @@ def pack(self, packer: Packer) -> None:
claimants_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "CreateClaimableBalanceOp":
+ def unpack(cls, unpacker: Unpacker) -> CreateClaimableBalanceOp:
asset = Asset.unpack(unpacker)
amount = Int64.unpack(unpacker)
length = unpacker.unpack_uint()
@@ -65,7 +68,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "CreateClaimableBalanceOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> CreateClaimableBalanceOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -74,10 +77,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "CreateClaimableBalanceOp":
+ def from_xdr(cls, xdr: str) -> CreateClaimableBalanceOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.asset,
+ self.amount,
+ self.claimants,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/create_claimable_balance_result.py b/stellar_sdk/xdr/create_claimable_balance_result.py
index 40d889da0..18a838e14 100644
--- a/stellar_sdk/xdr/create_claimable_balance_result.py
+++ b/stellar_sdk/xdr/create_claimable_balance_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .claimable_balance_id import ClaimableBalanceID
@@ -18,7 +21,11 @@ class CreateClaimableBalanceResult:
{
case CREATE_CLAIMABLE_BALANCE_SUCCESS:
ClaimableBalanceID balanceID;
- default:
+ case CREATE_CLAIMABLE_BALANCE_MALFORMED:
+ case CREATE_CLAIMABLE_BALANCE_LOW_RESERVE:
+ case CREATE_CLAIMABLE_BALANCE_NO_TRUST:
+ case CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED:
+ case CREATE_CLAIMABLE_BALANCE_UNDERFUNDED:
void;
};
"""
@@ -41,13 +48,57 @@ def pack(self, packer: Packer) -> None:
raise ValueError("balance_id should not be None.")
self.balance_id.pack(packer)
return
+ if (
+ self.code
+ == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_MALFORMED
+ ):
+ return
+ if (
+ self.code
+ == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_LOW_RESERVE
+ ):
+ return
+ if (
+ self.code
+ == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_NO_TRUST
+ ):
+ return
+ if (
+ self.code
+ == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED
+ ):
+ return
+ if (
+ self.code
+ == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_UNDERFUNDED
+ ):
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "CreateClaimableBalanceResult":
+ def unpack(cls, unpacker: Unpacker) -> CreateClaimableBalanceResult:
code = CreateClaimableBalanceResultCode.unpack(unpacker)
if code == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_SUCCESS:
balance_id = ClaimableBalanceID.unpack(unpacker)
return cls(code=code, balance_id=balance_id)
+ if code == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_MALFORMED:
+ return cls(code=code)
+ if (
+ code
+ == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_LOW_RESERVE
+ ):
+ return cls(code=code)
+ if code == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_NO_TRUST:
+ return cls(code=code)
+ if (
+ code
+ == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == CreateClaimableBalanceResultCode.CREATE_CLAIMABLE_BALANCE_UNDERFUNDED
+ ):
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -56,7 +107,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "CreateClaimableBalanceResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> CreateClaimableBalanceResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,10 +116,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "CreateClaimableBalanceResult":
+ def from_xdr(cls, xdr: str) -> CreateClaimableBalanceResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.balance_id,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/create_claimable_balance_result_code.py b/stellar_sdk/xdr/create_claimable_balance_result_code.py
index 1e2bf9dd1..bfcc233a0 100644
--- a/stellar_sdk/xdr/create_claimable_balance_result_code.py
+++ b/stellar_sdk/xdr/create_claimable_balance_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["CreateClaimableBalanceResultCode"]
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "CreateClaimableBalanceResultCode":
+ def unpack(cls, unpacker: Unpacker) -> CreateClaimableBalanceResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "CreateClaimableBalanceResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> CreateClaimableBalanceResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,6 +55,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "CreateClaimableBalanceResultCode":
+ def from_xdr(cls, xdr: str) -> CreateClaimableBalanceResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/create_contract_args.py b/stellar_sdk/xdr/create_contract_args.py
new file mode 100644
index 000000000..df8cd36ee
--- /dev/null
+++ b/stellar_sdk/xdr/create_contract_args.py
@@ -0,0 +1,87 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .contract_executable import ContractExecutable
+from .contract_id_preimage import ContractIDPreimage
+
+__all__ = ["CreateContractArgs"]
+
+
+class CreateContractArgs:
+ """
+ XDR Source Code::
+
+ struct CreateContractArgs
+ {
+ ContractIDPreimage contractIDPreimage;
+ ContractExecutable executable;
+ };
+ """
+
+ def __init__(
+ self,
+ contract_id_preimage: ContractIDPreimage,
+ executable: ContractExecutable,
+ ) -> None:
+ self.contract_id_preimage = contract_id_preimage
+ self.executable = executable
+
+ def pack(self, packer: Packer) -> None:
+ self.contract_id_preimage.pack(packer)
+ self.executable.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> CreateContractArgs:
+ contract_id_preimage = ContractIDPreimage.unpack(unpacker)
+ executable = ContractExecutable.unpack(unpacker)
+ return cls(
+ contract_id_preimage=contract_id_preimage,
+ executable=executable,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> CreateContractArgs:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> CreateContractArgs:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.contract_id_preimage,
+ self.executable,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.contract_id_preimage == other.contract_id_preimage
+ and self.executable == other.executable
+ )
+
+ def __str__(self):
+ out = [
+ f"contract_id_preimage={self.contract_id_preimage}",
+ f"executable={self.executable}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/create_passive_sell_offer_op.py b/stellar_sdk/xdr/create_passive_sell_offer_op.py
index 66ebc48cc..fcfadf618 100644
--- a/stellar_sdk/xdr/create_passive_sell_offer_op.py
+++ b/stellar_sdk/xdr/create_passive_sell_offer_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -42,7 +45,7 @@ def pack(self, packer: Packer) -> None:
self.price.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "CreatePassiveSellOfferOp":
+ def unpack(cls, unpacker: Unpacker) -> CreatePassiveSellOfferOp:
selling = Asset.unpack(unpacker)
buying = Asset.unpack(unpacker)
amount = Int64.unpack(unpacker)
@@ -60,7 +63,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "CreatePassiveSellOfferOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> CreatePassiveSellOfferOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -69,10 +72,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "CreatePassiveSellOfferOp":
+ def from_xdr(cls, xdr: str) -> CreatePassiveSellOfferOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.selling,
+ self.buying,
+ self.amount,
+ self.price,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/crypto_key_type.py b/stellar_sdk/xdr/crypto_key_type.py
index 7a3065ed5..47b8dd3bc 100644
--- a/stellar_sdk/xdr/crypto_key_type.py
+++ b/stellar_sdk/xdr/crypto_key_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["CryptoKeyType"]
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "CryptoKeyType":
+ def unpack(cls, unpacker: Unpacker) -> CryptoKeyType:
value = unpacker.unpack_int()
return cls(value)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "CryptoKeyType":
+ def from_xdr_bytes(cls, xdr: bytes) -> CryptoKeyType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,6 +55,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "CryptoKeyType":
+ def from_xdr(cls, xdr: str) -> CryptoKeyType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/curve25519_public.py b/stellar_sdk/xdr/curve25519_public.py
index 67bc26619..c8b902e0a 100644
--- a/stellar_sdk/xdr/curve25519_public.py
+++ b/stellar_sdk/xdr/curve25519_public.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.key, 32, True).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Curve25519Public":
+ def unpack(cls, unpacker: Unpacker) -> Curve25519Public:
key = Opaque.unpack(unpacker, 32, True)
return cls(
key=key,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Curve25519Public":
+ def from_xdr_bytes(cls, xdr: bytes) -> Curve25519Public:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Curve25519Public":
+ def from_xdr(cls, xdr: str) -> Curve25519Public:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.key,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/curve25519_secret.py b/stellar_sdk/xdr/curve25519_secret.py
index fde5d1924..53087b60a 100644
--- a/stellar_sdk/xdr/curve25519_secret.py
+++ b/stellar_sdk/xdr/curve25519_secret.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.key, 32, True).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Curve25519Secret":
+ def unpack(cls, unpacker: Unpacker) -> Curve25519Secret:
key = Opaque.unpack(unpacker, 32, True)
return cls(
key=key,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Curve25519Secret":
+ def from_xdr_bytes(cls, xdr: bytes) -> Curve25519Secret:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Curve25519Secret":
+ def from_xdr(cls, xdr: str) -> Curve25519Secret:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.key,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/data_entry.py b/stellar_sdk/xdr/data_entry.py
index 9758f21ae..8ba863ca9 100644
--- a/stellar_sdk/xdr/data_entry.py
+++ b/stellar_sdk/xdr/data_entry.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -50,7 +53,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "DataEntry":
+ def unpack(cls, unpacker: Unpacker) -> DataEntry:
account_id = AccountID.unpack(unpacker)
data_name = String64.unpack(unpacker)
data_value = DataValue.unpack(unpacker)
@@ -68,7 +71,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "DataEntry":
+ def from_xdr_bytes(cls, xdr: bytes) -> DataEntry:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -77,10 +80,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "DataEntry":
+ def from_xdr(cls, xdr: str) -> DataEntry:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.account_id,
+ self.data_name,
+ self.data_value,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/data_entry_ext.py b/stellar_sdk/xdr/data_entry_ext.py
index c018affa3..d2e86e66a 100644
--- a/stellar_sdk/xdr/data_entry_ext.py
+++ b/stellar_sdk/xdr/data_entry_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "DataEntryExt":
+ def unpack(cls, unpacker: Unpacker) -> DataEntryExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "DataEntryExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> DataEntryExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "DataEntryExt":
+ def from_xdr(cls, xdr: str) -> DataEntryExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/data_value.py b/stellar_sdk/xdr/data_value.py
index 5dbf9b69d..64d2cef75 100644
--- a/stellar_sdk/xdr/data_value.py
+++ b/stellar_sdk/xdr/data_value.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.data_value, 64, False).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "DataValue":
+ def unpack(cls, unpacker: Unpacker) -> DataValue:
data_value = Opaque.unpack(unpacker, 64, False)
return cls(data_value)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "DataValue":
+ def from_xdr_bytes(cls, xdr: bytes) -> DataValue:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "DataValue":
+ def from_xdr(cls, xdr: str) -> DataValue:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.data_value)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/decorated_signature.py b/stellar_sdk/xdr/decorated_signature.py
index 7a0093238..b997b36ae 100644
--- a/stellar_sdk/xdr/decorated_signature.py
+++ b/stellar_sdk/xdr/decorated_signature.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .signature import Signature
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.signature.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "DecoratedSignature":
+ def unpack(cls, unpacker: Unpacker) -> DecoratedSignature:
hint = SignatureHint.unpack(unpacker)
signature = Signature.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "DecoratedSignature":
+ def from_xdr_bytes(cls, xdr: bytes) -> DecoratedSignature:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "DecoratedSignature":
+ def from_xdr(cls, xdr: str) -> DecoratedSignature:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.hint,
+ self.signature,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/diagnostic_event.py b/stellar_sdk/xdr/diagnostic_event.py
new file mode 100644
index 000000000..dd1accf8d
--- /dev/null
+++ b/stellar_sdk/xdr/diagnostic_event.py
@@ -0,0 +1,87 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Boolean
+from .contract_event import ContractEvent
+
+__all__ = ["DiagnosticEvent"]
+
+
+class DiagnosticEvent:
+ """
+ XDR Source Code::
+
+ struct DiagnosticEvent
+ {
+ bool inSuccessfulContractCall;
+ ContractEvent event;
+ };
+ """
+
+ def __init__(
+ self,
+ in_successful_contract_call: bool,
+ event: ContractEvent,
+ ) -> None:
+ self.in_successful_contract_call = in_successful_contract_call
+ self.event = event
+
+ def pack(self, packer: Packer) -> None:
+ Boolean(self.in_successful_contract_call).pack(packer)
+ self.event.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> DiagnosticEvent:
+ in_successful_contract_call = Boolean.unpack(unpacker)
+ event = ContractEvent.unpack(unpacker)
+ return cls(
+ in_successful_contract_call=in_successful_contract_call,
+ event=event,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> DiagnosticEvent:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> DiagnosticEvent:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.in_successful_contract_call,
+ self.event,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.in_successful_contract_call == other.in_successful_contract_call
+ and self.event == other.event
+ )
+
+ def __str__(self):
+ out = [
+ f"in_successful_contract_call={self.in_successful_contract_call}",
+ f"event={self.event}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/dont_have.py b/stellar_sdk/xdr/dont_have.py
index 305f92178..c420b5c07 100644
--- a/stellar_sdk/xdr/dont_have.py
+++ b/stellar_sdk/xdr/dont_have.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .message_type import MessageType
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.req_hash.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "DontHave":
+ def unpack(cls, unpacker: Unpacker) -> DontHave:
type = MessageType.unpack(unpacker)
req_hash = Uint256.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "DontHave":
+ def from_xdr_bytes(cls, xdr: bytes) -> DontHave:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "DontHave":
+ def from_xdr(cls, xdr: str) -> DontHave:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.req_hash,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/duration.py b/stellar_sdk/xdr/duration.py
index e22a6be70..4ea0bdd01 100644
--- a/stellar_sdk/xdr/duration.py
+++ b/stellar_sdk/xdr/duration.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .uint64 import Uint64
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
self.duration.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Duration":
+ def unpack(cls, unpacker: Unpacker) -> Duration:
duration = Uint64.unpack(unpacker)
return cls(duration)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Duration":
+ def from_xdr_bytes(cls, xdr: bytes) -> Duration:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Duration":
+ def from_xdr(cls, xdr: str) -> Duration:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.duration)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/encrypted_body.py b/stellar_sdk/xdr/encrypted_body.py
index 7d963a497..95aa7101d 100644
--- a/stellar_sdk/xdr/encrypted_body.py
+++ b/stellar_sdk/xdr/encrypted_body.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.encrypted_body, 64000, False).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "EncryptedBody":
+ def unpack(cls, unpacker: Unpacker) -> EncryptedBody:
encrypted_body = Opaque.unpack(unpacker, 64000, False)
return cls(encrypted_body)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "EncryptedBody":
+ def from_xdr_bytes(cls, xdr: bytes) -> EncryptedBody:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "EncryptedBody":
+ def from_xdr(cls, xdr: str) -> EncryptedBody:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.encrypted_body)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/end_sponsoring_future_reserves_result.py b/stellar_sdk/xdr/end_sponsoring_future_reserves_result.py
index 76fd54758..cb01d73b2 100644
--- a/stellar_sdk/xdr/end_sponsoring_future_reserves_result.py
+++ b/stellar_sdk/xdr/end_sponsoring_future_reserves_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .end_sponsoring_future_reserves_result_code import (
@@ -19,7 +22,7 @@ class EndSponsoringFutureReservesResult:
{
case END_SPONSORING_FUTURE_RESERVES_SUCCESS:
void;
- default:
+ case END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED:
void;
};
"""
@@ -37,15 +40,25 @@ def pack(self, packer: Packer) -> None:
== EndSponsoringFutureReservesResultCode.END_SPONSORING_FUTURE_RESERVES_SUCCESS
):
return
+ if (
+ self.code
+ == EndSponsoringFutureReservesResultCode.END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED
+ ):
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "EndSponsoringFutureReservesResult":
+ def unpack(cls, unpacker: Unpacker) -> EndSponsoringFutureReservesResult:
code = EndSponsoringFutureReservesResultCode.unpack(unpacker)
if (
code
== EndSponsoringFutureReservesResultCode.END_SPONSORING_FUTURE_RESERVES_SUCCESS
):
return cls(code=code)
+ if (
+ code
+ == EndSponsoringFutureReservesResultCode.END_SPONSORING_FUTURE_RESERVES_NOT_SPONSORED
+ ):
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -54,7 +67,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "EndSponsoringFutureReservesResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> EndSponsoringFutureReservesResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +76,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "EndSponsoringFutureReservesResult":
+ def from_xdr(cls, xdr: str) -> EndSponsoringFutureReservesResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/end_sponsoring_future_reserves_result_code.py b/stellar_sdk/xdr/end_sponsoring_future_reserves_result_code.py
index 15cf809ee..4d07a0c47 100644
--- a/stellar_sdk/xdr/end_sponsoring_future_reserves_result_code.py
+++ b/stellar_sdk/xdr/end_sponsoring_future_reserves_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["EndSponsoringFutureReservesResultCode"]
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "EndSponsoringFutureReservesResultCode":
+ def unpack(cls, unpacker: Unpacker) -> EndSponsoringFutureReservesResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -38,7 +41,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "EndSponsoringFutureReservesResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> EndSponsoringFutureReservesResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -47,6 +50,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "EndSponsoringFutureReservesResultCode":
+ def from_xdr(cls, xdr: str) -> EndSponsoringFutureReservesResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/envelope_type.py b/stellar_sdk/xdr/envelope_type.py
index e0529ec53..9959ead1d 100644
--- a/stellar_sdk/xdr/envelope_type.py
+++ b/stellar_sdk/xdr/envelope_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["EnvelopeType"]
@@ -20,7 +23,9 @@ class EnvelopeType(IntEnum):
ENVELOPE_TYPE_SCPVALUE = 4,
ENVELOPE_TYPE_TX_FEE_BUMP = 5,
ENVELOPE_TYPE_OP_ID = 6,
- ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7
+ ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7,
+ ENVELOPE_TYPE_CONTRACT_ID = 8,
+ ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9
};
"""
@@ -32,12 +37,14 @@ class EnvelopeType(IntEnum):
ENVELOPE_TYPE_TX_FEE_BUMP = 5
ENVELOPE_TYPE_OP_ID = 6
ENVELOPE_TYPE_POOL_REVOKE_OP_ID = 7
+ ENVELOPE_TYPE_CONTRACT_ID = 8
+ ENVELOPE_TYPE_SOROBAN_AUTHORIZATION = 9
def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "EnvelopeType":
+ def unpack(cls, unpacker: Unpacker) -> EnvelopeType:
value = unpacker.unpack_int()
return cls(value)
@@ -47,7 +54,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "EnvelopeType":
+ def from_xdr_bytes(cls, xdr: bytes) -> EnvelopeType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,6 +63,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "EnvelopeType":
+ def from_xdr(cls, xdr: str) -> EnvelopeType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/error.py b/stellar_sdk/xdr/error.py
index 697f74174..8e29da1bf 100644
--- a/stellar_sdk/xdr/error.py
+++ b/stellar_sdk/xdr/error.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import String
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
String(self.msg, 100).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Error":
+ def unpack(cls, unpacker: Unpacker) -> Error:
code = ErrorCode.unpack(unpacker)
msg = String.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Error":
+ def from_xdr_bytes(cls, xdr: bytes) -> Error:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Error":
+ def from_xdr(cls, xdr: str) -> Error:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.msg,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/error_code.py b/stellar_sdk/xdr/error_code.py
index e7e760ad7..90962330c 100644
--- a/stellar_sdk/xdr/error_code.py
+++ b/stellar_sdk/xdr/error_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ErrorCode"]
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ErrorCode":
+ def unpack(cls, unpacker: Unpacker) -> ErrorCode:
value = unpacker.unpack_int()
return cls(value)
@@ -41,7 +44,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ErrorCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> ErrorCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -50,6 +53,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ErrorCode":
+ def from_xdr(cls, xdr: str) -> ErrorCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/eviction_iterator.py b/stellar_sdk/xdr/eviction_iterator.py
new file mode 100644
index 000000000..e47ca840f
--- /dev/null
+++ b/stellar_sdk/xdr/eviction_iterator.py
@@ -0,0 +1,96 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Boolean
+from .uint32 import Uint32
+from .uint64 import Uint64
+
+__all__ = ["EvictionIterator"]
+
+
+class EvictionIterator:
+ """
+ XDR Source Code::
+
+ struct EvictionIterator {
+ uint32 bucketListLevel;
+ bool isCurrBucket;
+ uint64 bucketFileOffset;
+ };
+ """
+
+ def __init__(
+ self,
+ bucket_list_level: Uint32,
+ is_curr_bucket: bool,
+ bucket_file_offset: Uint64,
+ ) -> None:
+ self.bucket_list_level = bucket_list_level
+ self.is_curr_bucket = is_curr_bucket
+ self.bucket_file_offset = bucket_file_offset
+
+ def pack(self, packer: Packer) -> None:
+ self.bucket_list_level.pack(packer)
+ Boolean(self.is_curr_bucket).pack(packer)
+ self.bucket_file_offset.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> EvictionIterator:
+ bucket_list_level = Uint32.unpack(unpacker)
+ is_curr_bucket = Boolean.unpack(unpacker)
+ bucket_file_offset = Uint64.unpack(unpacker)
+ return cls(
+ bucket_list_level=bucket_list_level,
+ is_curr_bucket=is_curr_bucket,
+ bucket_file_offset=bucket_file_offset,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> EvictionIterator:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> EvictionIterator:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.bucket_list_level,
+ self.is_curr_bucket,
+ self.bucket_file_offset,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.bucket_list_level == other.bucket_list_level
+ and self.is_curr_bucket == other.is_curr_bucket
+ and self.bucket_file_offset == other.bucket_file_offset
+ )
+
+ def __str__(self):
+ out = [
+ f"bucket_list_level={self.bucket_list_level}",
+ f"is_curr_bucket={self.is_curr_bucket}",
+ f"bucket_file_offset={self.bucket_file_offset}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/expiration_entry.py b/stellar_sdk/xdr/expiration_entry.py
new file mode 100644
index 000000000..ee4c3a852
--- /dev/null
+++ b/stellar_sdk/xdr/expiration_entry.py
@@ -0,0 +1,87 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .hash import Hash
+from .uint32 import Uint32
+
+__all__ = ["ExpirationEntry"]
+
+
+class ExpirationEntry:
+ """
+ XDR Source Code::
+
+ struct ExpirationEntry {
+ // Hash of the LedgerKey that is associated with this ExpirationEntry
+ Hash keyHash;
+ uint32 expirationLedgerSeq;
+ };
+ """
+
+ def __init__(
+ self,
+ key_hash: Hash,
+ expiration_ledger_seq: Uint32,
+ ) -> None:
+ self.key_hash = key_hash
+ self.expiration_ledger_seq = expiration_ledger_seq
+
+ def pack(self, packer: Packer) -> None:
+ self.key_hash.pack(packer)
+ self.expiration_ledger_seq.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> ExpirationEntry:
+ key_hash = Hash.unpack(unpacker)
+ expiration_ledger_seq = Uint32.unpack(unpacker)
+ return cls(
+ key_hash=key_hash,
+ expiration_ledger_seq=expiration_ledger_seq,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> ExpirationEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> ExpirationEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.key_hash,
+ self.expiration_ledger_seq,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.key_hash == other.key_hash
+ and self.expiration_ledger_seq == other.expiration_ledger_seq
+ )
+
+ def __str__(self):
+ out = [
+ f"key_hash={self.key_hash}",
+ f"expiration_ledger_seq={self.expiration_ledger_seq}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/extension_point.py b/stellar_sdk/xdr/extension_point.py
index 476c09b17..be4a343ef 100644
--- a/stellar_sdk/xdr/extension_point.py
+++ b/stellar_sdk/xdr/extension_point.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -12,9 +15,10 @@ class ExtensionPoint:
"""
XDR Source Code::
- union ExtensionPoint switch (int v) {
+ union ExtensionPoint switch (int v)
+ {
case 0:
- void;
+ void;
};
"""
@@ -30,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ExtensionPoint":
+ def unpack(cls, unpacker: Unpacker) -> ExtensionPoint:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -42,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ExtensionPoint":
+ def from_xdr_bytes(cls, xdr: bytes) -> ExtensionPoint:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -51,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ExtensionPoint":
+ def from_xdr(cls, xdr: str) -> ExtensionPoint:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/fee_bump_transaction.py b/stellar_sdk/xdr/fee_bump_transaction.py
index f200493d4..bebc8b723 100644
--- a/stellar_sdk/xdr/fee_bump_transaction.py
+++ b/stellar_sdk/xdr/fee_bump_transaction.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .fee_bump_transaction_ext import FeeBumpTransactionExt
@@ -53,7 +56,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "FeeBumpTransaction":
+ def unpack(cls, unpacker: Unpacker) -> FeeBumpTransaction:
fee_source = MuxedAccount.unpack(unpacker)
fee = Int64.unpack(unpacker)
inner_tx = FeeBumpTransactionInnerTx.unpack(unpacker)
@@ -71,7 +74,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "FeeBumpTransaction":
+ def from_xdr_bytes(cls, xdr: bytes) -> FeeBumpTransaction:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -80,10 +83,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "FeeBumpTransaction":
+ def from_xdr(cls, xdr: str) -> FeeBumpTransaction:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.fee_source,
+ self.fee,
+ self.inner_tx,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/fee_bump_transaction_envelope.py b/stellar_sdk/xdr/fee_bump_transaction_envelope.py
index de1243db9..892c7ff24 100644
--- a/stellar_sdk/xdr/fee_bump_transaction_envelope.py
+++ b/stellar_sdk/xdr/fee_bump_transaction_envelope.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .decorated_signature import DecoratedSignature
@@ -43,7 +46,7 @@ def pack(self, packer: Packer) -> None:
signatures_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "FeeBumpTransactionEnvelope":
+ def unpack(cls, unpacker: Unpacker) -> FeeBumpTransactionEnvelope:
tx = FeeBumpTransaction.unpack(unpacker)
length = unpacker.unpack_uint()
signatures = []
@@ -60,7 +63,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "FeeBumpTransactionEnvelope":
+ def from_xdr_bytes(cls, xdr: bytes) -> FeeBumpTransactionEnvelope:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -69,10 +72,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "FeeBumpTransactionEnvelope":
+ def from_xdr(cls, xdr: str) -> FeeBumpTransactionEnvelope:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.tx,
+ self.signatures,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/fee_bump_transaction_ext.py b/stellar_sdk/xdr/fee_bump_transaction_ext.py
index cd6bf0e3d..5bbb70794 100644
--- a/stellar_sdk/xdr/fee_bump_transaction_ext.py
+++ b/stellar_sdk/xdr/fee_bump_transaction_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "FeeBumpTransactionExt":
+ def unpack(cls, unpacker: Unpacker) -> FeeBumpTransactionExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "FeeBumpTransactionExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> FeeBumpTransactionExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "FeeBumpTransactionExt":
+ def from_xdr(cls, xdr: str) -> FeeBumpTransactionExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/fee_bump_transaction_inner_tx.py b/stellar_sdk/xdr/fee_bump_transaction_inner_tx.py
index 4abb4221c..af0d9151e 100644
--- a/stellar_sdk/xdr/fee_bump_transaction_inner_tx.py
+++ b/stellar_sdk/xdr/fee_bump_transaction_inner_tx.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .envelope_type import EnvelopeType
@@ -37,7 +40,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "FeeBumpTransactionInnerTx":
+ def unpack(cls, unpacker: Unpacker) -> FeeBumpTransactionInnerTx:
type = EnvelopeType.unpack(unpacker)
if type == EnvelopeType.ENVELOPE_TYPE_TX:
v1 = TransactionV1Envelope.unpack(unpacker)
@@ -50,7 +53,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "FeeBumpTransactionInnerTx":
+ def from_xdr_bytes(cls, xdr: bytes) -> FeeBumpTransactionInnerTx:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -59,10 +62,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "FeeBumpTransactionInnerTx":
+ def from_xdr(cls, xdr: str) -> FeeBumpTransactionInnerTx:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.v1,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/flood_advert.py b/stellar_sdk/xdr/flood_advert.py
new file mode 100644
index 000000000..ece034b98
--- /dev/null
+++ b/stellar_sdk/xdr/flood_advert.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .tx_advert_vector import TxAdvertVector
+
+__all__ = ["FloodAdvert"]
+
+
+class FloodAdvert:
+ """
+ XDR Source Code::
+
+ struct FloodAdvert
+ {
+ TxAdvertVector txHashes;
+ };
+ """
+
+ def __init__(
+ self,
+ tx_hashes: TxAdvertVector,
+ ) -> None:
+ self.tx_hashes = tx_hashes
+
+ def pack(self, packer: Packer) -> None:
+ self.tx_hashes.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> FloodAdvert:
+ tx_hashes = TxAdvertVector.unpack(unpacker)
+ return cls(
+ tx_hashes=tx_hashes,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> FloodAdvert:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> FloodAdvert:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.tx_hashes,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.tx_hashes == other.tx_hashes
+
+ def __str__(self):
+ out = [
+ f"tx_hashes={self.tx_hashes}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/flood_demand.py b/stellar_sdk/xdr/flood_demand.py
new file mode 100644
index 000000000..0d9f1b66b
--- /dev/null
+++ b/stellar_sdk/xdr/flood_demand.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .tx_demand_vector import TxDemandVector
+
+__all__ = ["FloodDemand"]
+
+
+class FloodDemand:
+ """
+ XDR Source Code::
+
+ struct FloodDemand
+ {
+ TxDemandVector txHashes;
+ };
+ """
+
+ def __init__(
+ self,
+ tx_hashes: TxDemandVector,
+ ) -> None:
+ self.tx_hashes = tx_hashes
+
+ def pack(self, packer: Packer) -> None:
+ self.tx_hashes.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> FloodDemand:
+ tx_hashes = TxDemandVector.unpack(unpacker)
+ return cls(
+ tx_hashes=tx_hashes,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> FloodDemand:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> FloodDemand:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.tx_hashes,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.tx_hashes == other.tx_hashes
+
+ def __str__(self):
+ out = [
+ f"tx_hashes={self.tx_hashes}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/generalized_transaction_set.py b/stellar_sdk/xdr/generalized_transaction_set.py
new file mode 100644
index 000000000..c19087980
--- /dev/null
+++ b/stellar_sdk/xdr/generalized_transaction_set.py
@@ -0,0 +1,89 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Integer
+from .transaction_set_v1 import TransactionSetV1
+
+__all__ = ["GeneralizedTransactionSet"]
+
+
+class GeneralizedTransactionSet:
+ """
+ XDR Source Code::
+
+ union GeneralizedTransactionSet switch (int v)
+ {
+ // We consider the legacy TransactionSet to be v0.
+ case 1:
+ TransactionSetV1 v1TxSet;
+ };
+ """
+
+ def __init__(
+ self,
+ v: int,
+ v1_tx_set: TransactionSetV1 = None,
+ ) -> None:
+ self.v = v
+ self.v1_tx_set = v1_tx_set
+
+ def pack(self, packer: Packer) -> None:
+ Integer(self.v).pack(packer)
+ if self.v == 1:
+ if self.v1_tx_set is None:
+ raise ValueError("v1_tx_set should not be None.")
+ self.v1_tx_set.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> GeneralizedTransactionSet:
+ v = Integer.unpack(unpacker)
+ if v == 1:
+ v1_tx_set = TransactionSetV1.unpack(unpacker)
+ return cls(v=v, v1_tx_set=v1_tx_set)
+ return cls(v=v)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> GeneralizedTransactionSet:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> GeneralizedTransactionSet:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v1_tx_set,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.v == other.v and self.v1_tx_set == other.v1_tx_set
+
+ def __str__(self):
+ out = []
+ out.append(f"v={self.v}")
+ out.append(
+ f"v1_tx_set={self.v1_tx_set}"
+ ) if self.v1_tx_set is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/hash.py b/stellar_sdk/xdr/hash.py
index b2cfeaabd..f7e172156 100644
--- a/stellar_sdk/xdr/hash.py
+++ b/stellar_sdk/xdr/hash.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.hash, 32, True).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Hash":
+ def unpack(cls, unpacker: Unpacker) -> Hash:
hash = Opaque.unpack(unpacker, 32, True)
return cls(hash)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Hash":
+ def from_xdr_bytes(cls, xdr: bytes) -> Hash:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Hash":
+ def from_xdr(cls, xdr: str) -> Hash:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.hash)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/hash_id_preimage.py b/stellar_sdk/xdr/hash_id_preimage.py
index ec3c25b20..8ba0d626c 100644
--- a/stellar_sdk/xdr/hash_id_preimage.py
+++ b/stellar_sdk/xdr/hash_id_preimage.py
@@ -1,11 +1,16 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .envelope_type import EnvelopeType
+from .hash_id_preimage_contract_id import HashIDPreimageContractID
from .hash_id_preimage_operation_id import HashIDPreimageOperationID
from .hash_id_preimage_revoke_id import HashIDPreimageRevokeID
+from .hash_id_preimage_soroban_authorization import HashIDPreimageSorobanAuthorization
__all__ = ["HashIDPreimage"]
@@ -32,6 +37,20 @@ class HashIDPreimage:
PoolID liquidityPoolID;
Asset asset;
} revokeID;
+ case ENVELOPE_TYPE_CONTRACT_ID:
+ struct
+ {
+ Hash networkID;
+ ContractIDPreimage contractIDPreimage;
+ } contractID;
+ case ENVELOPE_TYPE_SOROBAN_AUTHORIZATION:
+ struct
+ {
+ Hash networkID;
+ int64 nonce;
+ uint32 signatureExpirationLedger;
+ SorobanAuthorizedInvocation invocation;
+ } sorobanAuthorization;
};
"""
@@ -40,10 +59,14 @@ def __init__(
type: EnvelopeType,
operation_id: HashIDPreimageOperationID = None,
revoke_id: HashIDPreimageRevokeID = None,
+ contract_id: HashIDPreimageContractID = None,
+ soroban_authorization: HashIDPreimageSorobanAuthorization = None,
) -> None:
self.type = type
self.operation_id = operation_id
self.revoke_id = revoke_id
+ self.contract_id = contract_id
+ self.soroban_authorization = soroban_authorization
def pack(self, packer: Packer) -> None:
self.type.pack(packer)
@@ -57,9 +80,19 @@ def pack(self, packer: Packer) -> None:
raise ValueError("revoke_id should not be None.")
self.revoke_id.pack(packer)
return
+ if self.type == EnvelopeType.ENVELOPE_TYPE_CONTRACT_ID:
+ if self.contract_id is None:
+ raise ValueError("contract_id should not be None.")
+ self.contract_id.pack(packer)
+ return
+ if self.type == EnvelopeType.ENVELOPE_TYPE_SOROBAN_AUTHORIZATION:
+ if self.soroban_authorization is None:
+ raise ValueError("soroban_authorization should not be None.")
+ self.soroban_authorization.pack(packer)
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "HashIDPreimage":
+ def unpack(cls, unpacker: Unpacker) -> HashIDPreimage:
type = EnvelopeType.unpack(unpacker)
if type == EnvelopeType.ENVELOPE_TYPE_OP_ID:
operation_id = HashIDPreimageOperationID.unpack(unpacker)
@@ -67,6 +100,12 @@ def unpack(cls, unpacker: Unpacker) -> "HashIDPreimage":
if type == EnvelopeType.ENVELOPE_TYPE_POOL_REVOKE_OP_ID:
revoke_id = HashIDPreimageRevokeID.unpack(unpacker)
return cls(type=type, revoke_id=revoke_id)
+ if type == EnvelopeType.ENVELOPE_TYPE_CONTRACT_ID:
+ contract_id = HashIDPreimageContractID.unpack(unpacker)
+ return cls(type=type, contract_id=contract_id)
+ if type == EnvelopeType.ENVELOPE_TYPE_SOROBAN_AUTHORIZATION:
+ soroban_authorization = HashIDPreimageSorobanAuthorization.unpack(unpacker)
+ return cls(type=type, soroban_authorization=soroban_authorization)
return cls(type=type)
def to_xdr_bytes(self) -> bytes:
@@ -75,7 +114,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "HashIDPreimage":
+ def from_xdr_bytes(cls, xdr: bytes) -> HashIDPreimage:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -84,10 +123,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "HashIDPreimage":
+ def from_xdr(cls, xdr: str) -> HashIDPreimage:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.operation_id,
+ self.revoke_id,
+ self.contract_id,
+ self.soroban_authorization,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -95,6 +145,8 @@ def __eq__(self, other: object):
self.type == other.type
and self.operation_id == other.operation_id
and self.revoke_id == other.revoke_id
+ and self.contract_id == other.contract_id
+ and self.soroban_authorization == other.soroban_authorization
)
def __str__(self):
@@ -106,4 +158,10 @@ def __str__(self):
out.append(
f"revoke_id={self.revoke_id}"
) if self.revoke_id is not None else None
+ out.append(
+ f"contract_id={self.contract_id}"
+ ) if self.contract_id is not None else None
+ out.append(
+ f"soroban_authorization={self.soroban_authorization}"
+ ) if self.soroban_authorization is not None else None
return f""
diff --git a/stellar_sdk/xdr/hash_id_preimage_contract_id.py b/stellar_sdk/xdr/hash_id_preimage_contract_id.py
new file mode 100644
index 000000000..45c4203a7
--- /dev/null
+++ b/stellar_sdk/xdr/hash_id_preimage_contract_id.py
@@ -0,0 +1,87 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .contract_id_preimage import ContractIDPreimage
+from .hash import Hash
+
+__all__ = ["HashIDPreimageContractID"]
+
+
+class HashIDPreimageContractID:
+ """
+ XDR Source Code::
+
+ struct
+ {
+ Hash networkID;
+ ContractIDPreimage contractIDPreimage;
+ }
+ """
+
+ def __init__(
+ self,
+ network_id: Hash,
+ contract_id_preimage: ContractIDPreimage,
+ ) -> None:
+ self.network_id = network_id
+ self.contract_id_preimage = contract_id_preimage
+
+ def pack(self, packer: Packer) -> None:
+ self.network_id.pack(packer)
+ self.contract_id_preimage.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> HashIDPreimageContractID:
+ network_id = Hash.unpack(unpacker)
+ contract_id_preimage = ContractIDPreimage.unpack(unpacker)
+ return cls(
+ network_id=network_id,
+ contract_id_preimage=contract_id_preimage,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> HashIDPreimageContractID:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> HashIDPreimageContractID:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.network_id,
+ self.contract_id_preimage,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.network_id == other.network_id
+ and self.contract_id_preimage == other.contract_id_preimage
+ )
+
+ def __str__(self):
+ out = [
+ f"network_id={self.network_id}",
+ f"contract_id_preimage={self.contract_id_preimage}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/hash_id_preimage_operation_id.py b/stellar_sdk/xdr/hash_id_preimage_operation_id.py
index 4feaabdb3..19c4301e0 100644
--- a/stellar_sdk/xdr/hash_id_preimage_operation_id.py
+++ b/stellar_sdk/xdr/hash_id_preimage_operation_id.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -38,7 +41,7 @@ def pack(self, packer: Packer) -> None:
self.op_num.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "HashIDPreimageOperationID":
+ def unpack(cls, unpacker: Unpacker) -> HashIDPreimageOperationID:
source_account = AccountID.unpack(unpacker)
seq_num = SequenceNumber.unpack(unpacker)
op_num = Uint32.unpack(unpacker)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "HashIDPreimageOperationID":
+ def from_xdr_bytes(cls, xdr: bytes) -> HashIDPreimageOperationID:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +66,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "HashIDPreimageOperationID":
+ def from_xdr(cls, xdr: str) -> HashIDPreimageOperationID:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.source_account,
+ self.seq_num,
+ self.op_num,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/hash_id_preimage_revoke_id.py b/stellar_sdk/xdr/hash_id_preimage_revoke_id.py
index cde90d91c..e265db0e9 100644
--- a/stellar_sdk/xdr/hash_id_preimage_revoke_id.py
+++ b/stellar_sdk/xdr/hash_id_preimage_revoke_id.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -48,7 +51,7 @@ def pack(self, packer: Packer) -> None:
self.asset.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "HashIDPreimageRevokeID":
+ def unpack(cls, unpacker: Unpacker) -> HashIDPreimageRevokeID:
source_account = AccountID.unpack(unpacker)
seq_num = SequenceNumber.unpack(unpacker)
op_num = Uint32.unpack(unpacker)
@@ -68,7 +71,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "HashIDPreimageRevokeID":
+ def from_xdr_bytes(cls, xdr: bytes) -> HashIDPreimageRevokeID:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -77,10 +80,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "HashIDPreimageRevokeID":
+ def from_xdr(cls, xdr: str) -> HashIDPreimageRevokeID:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.source_account,
+ self.seq_num,
+ self.op_num,
+ self.liquidity_pool_id,
+ self.asset,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/hash_id_preimage_soroban_authorization.py b/stellar_sdk/xdr/hash_id_preimage_soroban_authorization.py
new file mode 100644
index 000000000..30587a849
--- /dev/null
+++ b/stellar_sdk/xdr/hash_id_preimage_soroban_authorization.py
@@ -0,0 +1,107 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .hash import Hash
+from .int64 import Int64
+from .soroban_authorized_invocation import SorobanAuthorizedInvocation
+from .uint32 import Uint32
+
+__all__ = ["HashIDPreimageSorobanAuthorization"]
+
+
+class HashIDPreimageSorobanAuthorization:
+ """
+ XDR Source Code::
+
+ struct
+ {
+ Hash networkID;
+ int64 nonce;
+ uint32 signatureExpirationLedger;
+ SorobanAuthorizedInvocation invocation;
+ }
+ """
+
+ def __init__(
+ self,
+ network_id: Hash,
+ nonce: Int64,
+ signature_expiration_ledger: Uint32,
+ invocation: SorobanAuthorizedInvocation,
+ ) -> None:
+ self.network_id = network_id
+ self.nonce = nonce
+ self.signature_expiration_ledger = signature_expiration_ledger
+ self.invocation = invocation
+
+ def pack(self, packer: Packer) -> None:
+ self.network_id.pack(packer)
+ self.nonce.pack(packer)
+ self.signature_expiration_ledger.pack(packer)
+ self.invocation.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> HashIDPreimageSorobanAuthorization:
+ network_id = Hash.unpack(unpacker)
+ nonce = Int64.unpack(unpacker)
+ signature_expiration_ledger = Uint32.unpack(unpacker)
+ invocation = SorobanAuthorizedInvocation.unpack(unpacker)
+ return cls(
+ network_id=network_id,
+ nonce=nonce,
+ signature_expiration_ledger=signature_expiration_ledger,
+ invocation=invocation,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> HashIDPreimageSorobanAuthorization:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> HashIDPreimageSorobanAuthorization:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.network_id,
+ self.nonce,
+ self.signature_expiration_ledger,
+ self.invocation,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.network_id == other.network_id
+ and self.nonce == other.nonce
+ and self.signature_expiration_ledger == other.signature_expiration_ledger
+ and self.invocation == other.invocation
+ )
+
+ def __str__(self):
+ out = [
+ f"network_id={self.network_id}",
+ f"nonce={self.nonce}",
+ f"signature_expiration_ledger={self.signature_expiration_ledger}",
+ f"invocation={self.invocation}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/hello.py b/stellar_sdk/xdr/hello.py
index c7f25b9cd..8f771f6a0 100644
--- a/stellar_sdk/xdr/hello.py
+++ b/stellar_sdk/xdr/hello.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .auth_cert import AuthCert
@@ -65,7 +68,7 @@ def pack(self, packer: Packer) -> None:
self.nonce.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Hello":
+ def unpack(cls, unpacker: Unpacker) -> Hello:
ledger_version = Uint32.unpack(unpacker)
overlay_version = Uint32.unpack(unpacker)
overlay_min_version = Uint32.unpack(unpacker)
@@ -93,7 +96,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Hello":
+ def from_xdr_bytes(cls, xdr: bytes) -> Hello:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -102,10 +105,25 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Hello":
+ def from_xdr(cls, xdr: str) -> Hello:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ledger_version,
+ self.overlay_version,
+ self.overlay_min_version,
+ self.network_id,
+ self.version_str,
+ self.listening_port,
+ self.peer_id,
+ self.cert,
+ self.nonce,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/hmac_sha256_key.py b/stellar_sdk/xdr/hmac_sha256_key.py
index 7dcae03a5..9e39459ae 100644
--- a/stellar_sdk/xdr/hmac_sha256_key.py
+++ b/stellar_sdk/xdr/hmac_sha256_key.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.key, 32, True).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "HmacSha256Key":
+ def unpack(cls, unpacker: Unpacker) -> HmacSha256Key:
key = Opaque.unpack(unpacker, 32, True)
return cls(
key=key,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "HmacSha256Key":
+ def from_xdr_bytes(cls, xdr: bytes) -> HmacSha256Key:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "HmacSha256Key":
+ def from_xdr(cls, xdr: str) -> HmacSha256Key:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.key,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/hmac_sha256_mac.py b/stellar_sdk/xdr/hmac_sha256_mac.py
index cc5a44bf4..548868c11 100644
--- a/stellar_sdk/xdr/hmac_sha256_mac.py
+++ b/stellar_sdk/xdr/hmac_sha256_mac.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.mac, 32, True).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "HmacSha256Mac":
+ def unpack(cls, unpacker: Unpacker) -> HmacSha256Mac:
mac = Opaque.unpack(unpacker, 32, True)
return cls(
mac=mac,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "HmacSha256Mac":
+ def from_xdr_bytes(cls, xdr: bytes) -> HmacSha256Mac:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "HmacSha256Mac":
+ def from_xdr(cls, xdr: str) -> HmacSha256Mac:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.mac,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/host_function.py b/stellar_sdk/xdr/host_function.py
new file mode 100644
index 000000000..c4436bea1
--- /dev/null
+++ b/stellar_sdk/xdr/host_function.py
@@ -0,0 +1,125 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Opaque
+from .create_contract_args import CreateContractArgs
+from .host_function_type import HostFunctionType
+from .invoke_contract_args import InvokeContractArgs
+
+__all__ = ["HostFunction"]
+
+
+class HostFunction:
+ """
+ XDR Source Code::
+
+ union HostFunction switch (HostFunctionType type)
+ {
+ case HOST_FUNCTION_TYPE_INVOKE_CONTRACT:
+ InvokeContractArgs invokeContract;
+ case HOST_FUNCTION_TYPE_CREATE_CONTRACT:
+ CreateContractArgs createContract;
+ case HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM:
+ opaque wasm<>;
+ };
+ """
+
+ def __init__(
+ self,
+ type: HostFunctionType,
+ invoke_contract: InvokeContractArgs = None,
+ create_contract: CreateContractArgs = None,
+ wasm: bytes = None,
+ ) -> None:
+ self.type = type
+ self.invoke_contract = invoke_contract
+ self.create_contract = create_contract
+ self.wasm = wasm
+
+ def pack(self, packer: Packer) -> None:
+ self.type.pack(packer)
+ if self.type == HostFunctionType.HOST_FUNCTION_TYPE_INVOKE_CONTRACT:
+ if self.invoke_contract is None:
+ raise ValueError("invoke_contract should not be None.")
+ self.invoke_contract.pack(packer)
+ return
+ if self.type == HostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT:
+ if self.create_contract is None:
+ raise ValueError("create_contract should not be None.")
+ self.create_contract.pack(packer)
+ return
+ if self.type == HostFunctionType.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM:
+ if self.wasm is None:
+ raise ValueError("wasm should not be None.")
+ Opaque(self.wasm, 4294967295, False).pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> HostFunction:
+ type = HostFunctionType.unpack(unpacker)
+ if type == HostFunctionType.HOST_FUNCTION_TYPE_INVOKE_CONTRACT:
+ invoke_contract = InvokeContractArgs.unpack(unpacker)
+ return cls(type=type, invoke_contract=invoke_contract)
+ if type == HostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT:
+ create_contract = CreateContractArgs.unpack(unpacker)
+ return cls(type=type, create_contract=create_contract)
+ if type == HostFunctionType.HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM:
+ wasm = Opaque.unpack(unpacker, 4294967295, False)
+ return cls(type=type, wasm=wasm)
+ return cls(type=type)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> HostFunction:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> HostFunction:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.invoke_contract,
+ self.create_contract,
+ self.wasm,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.type == other.type
+ and self.invoke_contract == other.invoke_contract
+ and self.create_contract == other.create_contract
+ and self.wasm == other.wasm
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"type={self.type}")
+ out.append(
+ f"invoke_contract={self.invoke_contract}"
+ ) if self.invoke_contract is not None else None
+ out.append(
+ f"create_contract={self.create_contract}"
+ ) if self.create_contract is not None else None
+ out.append(f"wasm={self.wasm}") if self.wasm is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/host_function_type.py b/stellar_sdk/xdr/host_function_type.py
new file mode 100644
index 000000000..ca84bf9af
--- /dev/null
+++ b/stellar_sdk/xdr/host_function_type.py
@@ -0,0 +1,54 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["HostFunctionType"]
+
+
+class HostFunctionType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum HostFunctionType
+ {
+ HOST_FUNCTION_TYPE_INVOKE_CONTRACT = 0,
+ HOST_FUNCTION_TYPE_CREATE_CONTRACT = 1,
+ HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2
+ };
+ """
+
+ HOST_FUNCTION_TYPE_INVOKE_CONTRACT = 0
+ HOST_FUNCTION_TYPE_CREATE_CONTRACT = 1
+ HOST_FUNCTION_TYPE_UPLOAD_CONTRACT_WASM = 2
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> HostFunctionType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> HostFunctionType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> HostFunctionType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/inflation_payout.py b/stellar_sdk/xdr/inflation_payout.py
index 9ba28ef9f..0d9dcf4a5 100644
--- a/stellar_sdk/xdr/inflation_payout.py
+++ b/stellar_sdk/xdr/inflation_payout.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.amount.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "InflationPayout":
+ def unpack(cls, unpacker: Unpacker) -> InflationPayout:
destination = AccountID.unpack(unpacker)
amount = Int64.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "InflationPayout":
+ def from_xdr_bytes(cls, xdr: bytes) -> InflationPayout:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "InflationPayout":
+ def from_xdr(cls, xdr: str) -> InflationPayout:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.destination,
+ self.amount,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/inflation_result.py b/stellar_sdk/xdr/inflation_result.py
index f9fca004e..99930507a 100644
--- a/stellar_sdk/xdr/inflation_result.py
+++ b/stellar_sdk/xdr/inflation_result.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .inflation_payout import InflationPayout
@@ -18,7 +21,7 @@ class InflationResult:
{
case INFLATION_SUCCESS:
InflationPayout payouts<>;
- default:
+ case INFLATION_NOT_TIME:
void;
};
"""
@@ -45,9 +48,11 @@ def pack(self, packer: Packer) -> None:
for payouts_item in self.payouts:
payouts_item.pack(packer)
return
+ if self.code == InflationResultCode.INFLATION_NOT_TIME:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "InflationResult":
+ def unpack(cls, unpacker: Unpacker) -> InflationResult:
code = InflationResultCode.unpack(unpacker)
if code == InflationResultCode.INFLATION_SUCCESS:
length = unpacker.unpack_uint()
@@ -55,6 +60,8 @@ def unpack(cls, unpacker: Unpacker) -> "InflationResult":
for _ in range(length):
payouts.append(InflationPayout.unpack(unpacker))
return cls(code=code, payouts=payouts)
+ if code == InflationResultCode.INFLATION_NOT_TIME:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -63,7 +70,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "InflationResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> InflationResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -72,10 +79,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "InflationResult":
+ def from_xdr(cls, xdr: str) -> InflationResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.payouts,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/inflation_result_code.py b/stellar_sdk/xdr/inflation_result_code.py
index b8a2ac4ad..c81c0bdf6 100644
--- a/stellar_sdk/xdr/inflation_result_code.py
+++ b/stellar_sdk/xdr/inflation_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["InflationResultCode"]
@@ -27,7 +30,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "InflationResultCode":
+ def unpack(cls, unpacker: Unpacker) -> InflationResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -37,7 +40,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "InflationResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> InflationResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -46,6 +49,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "InflationResultCode":
+ def from_xdr(cls, xdr: str) -> InflationResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/inner_transaction_result.py b/stellar_sdk/xdr/inner_transaction_result.py
index dd7cae5fd..ac6e4fc5e 100644
--- a/stellar_sdk/xdr/inner_transaction_result.py
+++ b/stellar_sdk/xdr/inner_transaction_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .inner_transaction_result_ext import InnerTransactionResultExt
@@ -39,6 +42,8 @@ class InnerTransactionResult:
// txFEE_BUMP_INNER_FAILED is not included
case txBAD_SPONSORSHIP:
case txBAD_MIN_SEQ_AGE_OR_GAP:
+ case txMALFORMED:
+ case txSOROBAN_INVALID:
void;
}
result;
@@ -69,7 +74,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "InnerTransactionResult":
+ def unpack(cls, unpacker: Unpacker) -> InnerTransactionResult:
fee_charged = Int64.unpack(unpacker)
result = InnerTransactionResultResult.unpack(unpacker)
ext = InnerTransactionResultExt.unpack(unpacker)
@@ -85,7 +90,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "InnerTransactionResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> InnerTransactionResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -94,10 +99,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "InnerTransactionResult":
+ def from_xdr(cls, xdr: str) -> InnerTransactionResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.fee_charged,
+ self.result,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/inner_transaction_result_ext.py b/stellar_sdk/xdr/inner_transaction_result_ext.py
index 9c0682a61..810134acc 100644
--- a/stellar_sdk/xdr/inner_transaction_result_ext.py
+++ b/stellar_sdk/xdr/inner_transaction_result_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "InnerTransactionResultExt":
+ def unpack(cls, unpacker: Unpacker) -> InnerTransactionResultExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "InnerTransactionResultExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> InnerTransactionResultExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "InnerTransactionResultExt":
+ def from_xdr(cls, xdr: str) -> InnerTransactionResultExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/inner_transaction_result_pair.py b/stellar_sdk/xdr/inner_transaction_result_pair.py
index c249b0e9e..b36c05bab 100644
--- a/stellar_sdk/xdr/inner_transaction_result_pair.py
+++ b/stellar_sdk/xdr/inner_transaction_result_pair.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .hash import Hash
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.result.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "InnerTransactionResultPair":
+ def unpack(cls, unpacker: Unpacker) -> InnerTransactionResultPair:
transaction_hash = Hash.unpack(unpacker)
result = InnerTransactionResult.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "InnerTransactionResultPair":
+ def from_xdr_bytes(cls, xdr: bytes) -> InnerTransactionResultPair:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "InnerTransactionResultPair":
+ def from_xdr(cls, xdr: str) -> InnerTransactionResultPair:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.transaction_hash,
+ self.result,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/inner_transaction_result_result.py b/stellar_sdk/xdr/inner_transaction_result_result.py
index 9348ddeda..1f065ca08 100644
--- a/stellar_sdk/xdr/inner_transaction_result_result.py
+++ b/stellar_sdk/xdr/inner_transaction_result_result.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .operation_result import OperationResult
@@ -34,6 +37,8 @@ class InnerTransactionResultResult:
// txFEE_BUMP_INNER_FAILED is not included
case txBAD_SPONSORSHIP:
case txBAD_MIN_SEQ_AGE_OR_GAP:
+ case txMALFORMED:
+ case txSOROBAN_INVALID:
void;
}
"""
@@ -93,9 +98,13 @@ def pack(self, packer: Packer) -> None:
return
if self.code == TransactionResultCode.txBAD_MIN_SEQ_AGE_OR_GAP:
return
+ if self.code == TransactionResultCode.txMALFORMED:
+ return
+ if self.code == TransactionResultCode.txSOROBAN_INVALID:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "InnerTransactionResultResult":
+ def unpack(cls, unpacker: Unpacker) -> InnerTransactionResultResult:
code = TransactionResultCode.unpack(unpacker)
if code == TransactionResultCode.txSUCCESS:
length = unpacker.unpack_uint()
@@ -135,6 +144,10 @@ def unpack(cls, unpacker: Unpacker) -> "InnerTransactionResultResult":
return cls(code=code)
if code == TransactionResultCode.txBAD_MIN_SEQ_AGE_OR_GAP:
return cls(code=code)
+ if code == TransactionResultCode.txMALFORMED:
+ return cls(code=code)
+ if code == TransactionResultCode.txSOROBAN_INVALID:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -143,7 +156,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "InnerTransactionResultResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> InnerTransactionResultResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -152,10 +165,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "InnerTransactionResultResult":
+ def from_xdr(cls, xdr: str) -> InnerTransactionResultResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.results,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/int128_parts.py b/stellar_sdk/xdr/int128_parts.py
new file mode 100644
index 000000000..e63eaef06
--- /dev/null
+++ b/stellar_sdk/xdr/int128_parts.py
@@ -0,0 +1,83 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+from .uint64 import Uint64
+
+__all__ = ["Int128Parts"]
+
+
+class Int128Parts:
+ """
+ XDR Source Code::
+
+ struct Int128Parts {
+ int64 hi;
+ uint64 lo;
+ };
+ """
+
+ def __init__(
+ self,
+ hi: Int64,
+ lo: Uint64,
+ ) -> None:
+ self.hi = hi
+ self.lo = lo
+
+ def pack(self, packer: Packer) -> None:
+ self.hi.pack(packer)
+ self.lo.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> Int128Parts:
+ hi = Int64.unpack(unpacker)
+ lo = Uint64.unpack(unpacker)
+ return cls(
+ hi=hi,
+ lo=lo,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> Int128Parts:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> Int128Parts:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.hi,
+ self.lo,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.hi == other.hi and self.lo == other.lo
+
+ def __str__(self):
+ out = [
+ f"hi={self.hi}",
+ f"lo={self.lo}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/int256_parts.py b/stellar_sdk/xdr/int256_parts.py
new file mode 100644
index 000000000..4500ec35b
--- /dev/null
+++ b/stellar_sdk/xdr/int256_parts.py
@@ -0,0 +1,104 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+from .uint64 import Uint64
+
+__all__ = ["Int256Parts"]
+
+
+class Int256Parts:
+ """
+ XDR Source Code::
+
+ struct Int256Parts {
+ int64 hi_hi;
+ uint64 hi_lo;
+ uint64 lo_hi;
+ uint64 lo_lo;
+ };
+ """
+
+ def __init__(
+ self,
+ hi_hi: Int64,
+ hi_lo: Uint64,
+ lo_hi: Uint64,
+ lo_lo: Uint64,
+ ) -> None:
+ self.hi_hi = hi_hi
+ self.hi_lo = hi_lo
+ self.lo_hi = lo_hi
+ self.lo_lo = lo_lo
+
+ def pack(self, packer: Packer) -> None:
+ self.hi_hi.pack(packer)
+ self.hi_lo.pack(packer)
+ self.lo_hi.pack(packer)
+ self.lo_lo.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> Int256Parts:
+ hi_hi = Int64.unpack(unpacker)
+ hi_lo = Uint64.unpack(unpacker)
+ lo_hi = Uint64.unpack(unpacker)
+ lo_lo = Uint64.unpack(unpacker)
+ return cls(
+ hi_hi=hi_hi,
+ hi_lo=hi_lo,
+ lo_hi=lo_hi,
+ lo_lo=lo_lo,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> Int256Parts:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> Int256Parts:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.hi_hi,
+ self.hi_lo,
+ self.lo_hi,
+ self.lo_lo,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.hi_hi == other.hi_hi
+ and self.hi_lo == other.hi_lo
+ and self.lo_hi == other.lo_hi
+ and self.lo_lo == other.lo_lo
+ )
+
+ def __str__(self):
+ out = [
+ f"hi_hi={self.hi_hi}",
+ f"hi_lo={self.hi_lo}",
+ f"lo_hi={self.lo_hi}",
+ f"lo_lo={self.lo_lo}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/int32.py b/stellar_sdk/xdr/int32.py
index ae55a1fa1..b19d5dac3 100644
--- a/stellar_sdk/xdr/int32.py
+++ b/stellar_sdk/xdr/int32.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Integer(self.int32).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Int32":
+ def unpack(cls, unpacker: Unpacker) -> Int32:
int32 = Integer.unpack(unpacker)
return cls(int32)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Int32":
+ def from_xdr_bytes(cls, xdr: bytes) -> Int32:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Int32":
+ def from_xdr(cls, xdr: str) -> Int32:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.int32)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/int64.py b/stellar_sdk/xdr/int64.py
index cac92b474..78352c579 100644
--- a/stellar_sdk/xdr/int64.py
+++ b/stellar_sdk/xdr/int64.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Hyper
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Hyper(self.int64).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Int64":
+ def unpack(cls, unpacker: Unpacker) -> Int64:
int64 = Hyper.unpack(unpacker)
return cls(int64)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Int64":
+ def from_xdr_bytes(cls, xdr: bytes) -> Int64:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Int64":
+ def from_xdr(cls, xdr: str) -> Int64:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.int64)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/invoke_contract_args.py b/stellar_sdk/xdr/invoke_contract_args.py
new file mode 100644
index 000000000..f57811c1b
--- /dev/null
+++ b/stellar_sdk/xdr/invoke_contract_args.py
@@ -0,0 +1,107 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_address import SCAddress
+from .sc_symbol import SCSymbol
+from .sc_val import SCVal
+
+__all__ = ["InvokeContractArgs"]
+
+
+class InvokeContractArgs:
+ """
+ XDR Source Code::
+
+ struct InvokeContractArgs {
+ SCAddress contractAddress;
+ SCSymbol functionName;
+ SCVal args<>;
+ };
+ """
+
+ def __init__(
+ self,
+ contract_address: SCAddress,
+ function_name: SCSymbol,
+ args: List[SCVal],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if args and len(args) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `args` should be {_expect_max_length}, but got {len(args)}."
+ )
+ self.contract_address = contract_address
+ self.function_name = function_name
+ self.args = args
+
+ def pack(self, packer: Packer) -> None:
+ self.contract_address.pack(packer)
+ self.function_name.pack(packer)
+ packer.pack_uint(len(self.args))
+ for args_item in self.args:
+ args_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> InvokeContractArgs:
+ contract_address = SCAddress.unpack(unpacker)
+ function_name = SCSymbol.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ args = []
+ for _ in range(length):
+ args.append(SCVal.unpack(unpacker))
+ return cls(
+ contract_address=contract_address,
+ function_name=function_name,
+ args=args,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> InvokeContractArgs:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> InvokeContractArgs:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.contract_address,
+ self.function_name,
+ self.args,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.contract_address == other.contract_address
+ and self.function_name == other.function_name
+ and self.args == other.args
+ )
+
+ def __str__(self):
+ out = [
+ f"contract_address={self.contract_address}",
+ f"function_name={self.function_name}",
+ f"args={self.args}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/invoke_host_function_op.py b/stellar_sdk/xdr/invoke_host_function_op.py
new file mode 100644
index 000000000..7bf8165ae
--- /dev/null
+++ b/stellar_sdk/xdr/invoke_host_function_op.py
@@ -0,0 +1,97 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .host_function import HostFunction
+from .soroban_authorization_entry import SorobanAuthorizationEntry
+
+__all__ = ["InvokeHostFunctionOp"]
+
+
+class InvokeHostFunctionOp:
+ """
+ XDR Source Code::
+
+ struct InvokeHostFunctionOp
+ {
+ // Host function to invoke.
+ HostFunction hostFunction;
+ // Per-address authorizations for this host function.
+ SorobanAuthorizationEntry auth<>;
+ };
+ """
+
+ def __init__(
+ self,
+ host_function: HostFunction,
+ auth: List[SorobanAuthorizationEntry],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if auth and len(auth) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `auth` should be {_expect_max_length}, but got {len(auth)}."
+ )
+ self.host_function = host_function
+ self.auth = auth
+
+ def pack(self, packer: Packer) -> None:
+ self.host_function.pack(packer)
+ packer.pack_uint(len(self.auth))
+ for auth_item in self.auth:
+ auth_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> InvokeHostFunctionOp:
+ host_function = HostFunction.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ auth = []
+ for _ in range(length):
+ auth.append(SorobanAuthorizationEntry.unpack(unpacker))
+ return cls(
+ host_function=host_function,
+ auth=auth,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> InvokeHostFunctionOp:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> InvokeHostFunctionOp:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.host_function,
+ self.auth,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.host_function == other.host_function and self.auth == other.auth
+
+ def __str__(self):
+ out = [
+ f"host_function={self.host_function}",
+ f"auth={self.auth}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/invoke_host_function_result.py b/stellar_sdk/xdr/invoke_host_function_result.py
new file mode 100644
index 000000000..5449d9e70
--- /dev/null
+++ b/stellar_sdk/xdr/invoke_host_function_result.py
@@ -0,0 +1,124 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .hash import Hash
+from .invoke_host_function_result_code import InvokeHostFunctionResultCode
+
+__all__ = ["InvokeHostFunctionResult"]
+
+
+class InvokeHostFunctionResult:
+ """
+ XDR Source Code::
+
+ union InvokeHostFunctionResult switch (InvokeHostFunctionResultCode code)
+ {
+ case INVOKE_HOST_FUNCTION_SUCCESS:
+ Hash success; // sha256(InvokeHostFunctionSuccessPreImage)
+ case INVOKE_HOST_FUNCTION_MALFORMED:
+ case INVOKE_HOST_FUNCTION_TRAPPED:
+ case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED:
+ case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED:
+ case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE:
+ void;
+ };
+ """
+
+ def __init__(
+ self,
+ code: InvokeHostFunctionResultCode,
+ success: Hash = None,
+ ) -> None:
+ self.code = code
+ self.success = success
+
+ def pack(self, packer: Packer) -> None:
+ self.code.pack(packer)
+ if self.code == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_SUCCESS:
+ if self.success is None:
+ raise ValueError("success should not be None.")
+ self.success.pack(packer)
+ return
+ if self.code == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_MALFORMED:
+ return
+ if self.code == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_TRAPPED:
+ return
+ if (
+ self.code
+ == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED
+ ):
+ return
+ if self.code == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_ENTRY_EXPIRED:
+ return
+ if (
+ self.code
+ == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE
+ ):
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> InvokeHostFunctionResult:
+ code = InvokeHostFunctionResultCode.unpack(unpacker)
+ if code == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_SUCCESS:
+ success = Hash.unpack(unpacker)
+ return cls(code=code, success=success)
+ if code == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_MALFORMED:
+ return cls(code=code)
+ if code == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_TRAPPED:
+ return cls(code=code)
+ if (
+ code
+ == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED
+ ):
+ return cls(code=code)
+ if code == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_ENTRY_EXPIRED:
+ return cls(code=code)
+ if (
+ code
+ == InvokeHostFunctionResultCode.INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE
+ ):
+ return cls(code=code)
+ return cls(code=code)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> InvokeHostFunctionResult:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> InvokeHostFunctionResult:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.success,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.code == other.code and self.success == other.success
+
+ def __str__(self):
+ out = []
+ out.append(f"code={self.code}")
+ out.append(f"success={self.success}") if self.success is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/invoke_host_function_result_code.py b/stellar_sdk/xdr/invoke_host_function_result_code.py
new file mode 100644
index 000000000..0989d21c8
--- /dev/null
+++ b/stellar_sdk/xdr/invoke_host_function_result_code.py
@@ -0,0 +1,63 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["InvokeHostFunctionResultCode"]
+
+
+class InvokeHostFunctionResultCode(IntEnum):
+ """
+ XDR Source Code::
+
+ enum InvokeHostFunctionResultCode
+ {
+ // codes considered as "success" for the operation
+ INVOKE_HOST_FUNCTION_SUCCESS = 0,
+
+ // codes considered as "failure" for the operation
+ INVOKE_HOST_FUNCTION_MALFORMED = -1,
+ INVOKE_HOST_FUNCTION_TRAPPED = -2,
+ INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3,
+ INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4,
+ INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5
+ };
+ """
+
+ INVOKE_HOST_FUNCTION_SUCCESS = 0
+ INVOKE_HOST_FUNCTION_MALFORMED = -1
+ INVOKE_HOST_FUNCTION_TRAPPED = -2
+ INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3
+ INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4
+ INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> InvokeHostFunctionResultCode:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> InvokeHostFunctionResultCode:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> InvokeHostFunctionResultCode:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/invoke_host_function_success_pre_image.py b/stellar_sdk/xdr/invoke_host_function_success_pre_image.py
new file mode 100644
index 000000000..db533ea43
--- /dev/null
+++ b/stellar_sdk/xdr/invoke_host_function_success_pre_image.py
@@ -0,0 +1,95 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .contract_event import ContractEvent
+from .sc_val import SCVal
+
+__all__ = ["InvokeHostFunctionSuccessPreImage"]
+
+
+class InvokeHostFunctionSuccessPreImage:
+ """
+ XDR Source Code::
+
+ struct InvokeHostFunctionSuccessPreImage
+ {
+ SCVal returnValue;
+ ContractEvent events<>;
+ };
+ """
+
+ def __init__(
+ self,
+ return_value: SCVal,
+ events: List[ContractEvent],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if events and len(events) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `events` should be {_expect_max_length}, but got {len(events)}."
+ )
+ self.return_value = return_value
+ self.events = events
+
+ def pack(self, packer: Packer) -> None:
+ self.return_value.pack(packer)
+ packer.pack_uint(len(self.events))
+ for events_item in self.events:
+ events_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> InvokeHostFunctionSuccessPreImage:
+ return_value = SCVal.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ events = []
+ for _ in range(length):
+ events.append(ContractEvent.unpack(unpacker))
+ return cls(
+ return_value=return_value,
+ events=events,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> InvokeHostFunctionSuccessPreImage:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> InvokeHostFunctionSuccessPreImage:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.return_value,
+ self.events,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.return_value == other.return_value and self.events == other.events
+
+ def __str__(self):
+ out = [
+ f"return_value={self.return_value}",
+ f"events={self.events}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/ip_addr_type.py b/stellar_sdk/xdr/ip_addr_type.py
index a0ec3cd7a..04da85eaf 100644
--- a/stellar_sdk/xdr/ip_addr_type.py
+++ b/stellar_sdk/xdr/ip_addr_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["IPAddrType"]
@@ -25,7 +28,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "IPAddrType":
+ def unpack(cls, unpacker: Unpacker) -> IPAddrType:
value = unpacker.unpack_int()
return cls(value)
@@ -35,7 +38,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "IPAddrType":
+ def from_xdr_bytes(cls, xdr: bytes) -> IPAddrType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -44,6 +47,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "IPAddrType":
+ def from_xdr(cls, xdr: str) -> IPAddrType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/ledger_bounds.py b/stellar_sdk/xdr/ledger_bounds.py
index a5636de36..81fe0e118 100644
--- a/stellar_sdk/xdr/ledger_bounds.py
+++ b/stellar_sdk/xdr/ledger_bounds.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .uint32 import Uint32
@@ -32,7 +35,7 @@ def pack(self, packer: Packer) -> None:
self.max_ledger.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerBounds":
+ def unpack(cls, unpacker: Unpacker) -> LedgerBounds:
min_ledger = Uint32.unpack(unpacker)
max_ledger = Uint32.unpack(unpacker)
return cls(
@@ -46,7 +49,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerBounds":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerBounds:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -55,10 +58,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerBounds":
+ def from_xdr(cls, xdr: str) -> LedgerBounds:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.min_ledger,
+ self.max_ledger,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_close_meta.py b/stellar_sdk/xdr/ledger_close_meta.py
index 86e3f625b..6424cee9b 100644
--- a/stellar_sdk/xdr/ledger_close_meta.py
+++ b/stellar_sdk/xdr/ledger_close_meta.py
@@ -1,10 +1,15 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
from .ledger_close_meta_v0 import LedgerCloseMetaV0
+from .ledger_close_meta_v1 import LedgerCloseMetaV1
+from .ledger_close_meta_v2 import LedgerCloseMetaV2
__all__ = ["LedgerCloseMeta"]
@@ -17,6 +22,10 @@ class LedgerCloseMeta:
{
case 0:
LedgerCloseMetaV0 v0;
+ case 1:
+ LedgerCloseMetaV1 v1;
+ case 2:
+ LedgerCloseMetaV2 v2;
};
"""
@@ -24,9 +33,13 @@ def __init__(
self,
v: int,
v0: LedgerCloseMetaV0 = None,
+ v1: LedgerCloseMetaV1 = None,
+ v2: LedgerCloseMetaV2 = None,
) -> None:
self.v = v
self.v0 = v0
+ self.v1 = v1
+ self.v2 = v2
def pack(self, packer: Packer) -> None:
Integer(self.v).pack(packer)
@@ -35,13 +48,29 @@ def pack(self, packer: Packer) -> None:
raise ValueError("v0 should not be None.")
self.v0.pack(packer)
return
+ if self.v == 1:
+ if self.v1 is None:
+ raise ValueError("v1 should not be None.")
+ self.v1.pack(packer)
+ return
+ if self.v == 2:
+ if self.v2 is None:
+ raise ValueError("v2 should not be None.")
+ self.v2.pack(packer)
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerCloseMeta":
+ def unpack(cls, unpacker: Unpacker) -> LedgerCloseMeta:
v = Integer.unpack(unpacker)
if v == 0:
v0 = LedgerCloseMetaV0.unpack(unpacker)
return cls(v=v, v0=v0)
+ if v == 1:
+ v1 = LedgerCloseMetaV1.unpack(unpacker)
+ return cls(v=v, v1=v1)
+ if v == 2:
+ v2 = LedgerCloseMetaV2.unpack(unpacker)
+ return cls(v=v, v2=v2)
return cls(v=v)
def to_xdr_bytes(self) -> bytes:
@@ -50,7 +79,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerCloseMeta":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerCloseMeta:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -59,17 +88,34 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerCloseMeta":
+ def from_xdr(cls, xdr: str) -> LedgerCloseMeta:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v0,
+ self.v1,
+ self.v2,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
- return self.v == other.v and self.v0 == other.v0
+ return (
+ self.v == other.v
+ and self.v0 == other.v0
+ and self.v1 == other.v1
+ and self.v2 == other.v2
+ )
def __str__(self):
out = []
out.append(f"v={self.v}")
out.append(f"v0={self.v0}") if self.v0 is not None else None
+ out.append(f"v1={self.v1}") if self.v1 is not None else None
+ out.append(f"v2={self.v2}") if self.v2 is not None else None
return f""
diff --git a/stellar_sdk/xdr/ledger_close_meta_v0.py b/stellar_sdk/xdr/ledger_close_meta_v0.py
index 0e3108e82..c199861a7 100644
--- a/stellar_sdk/xdr/ledger_close_meta_v0.py
+++ b/stellar_sdk/xdr/ledger_close_meta_v0.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .ledger_header_history_entry import LedgerHeaderHistoryEntry
@@ -79,7 +82,7 @@ def pack(self, packer: Packer) -> None:
scp_info_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerCloseMetaV0":
+ def unpack(cls, unpacker: Unpacker) -> LedgerCloseMetaV0:
ledger_header = LedgerHeaderHistoryEntry.unpack(unpacker)
tx_set = TransactionSet.unpack(unpacker)
length = unpacker.unpack_uint()
@@ -108,7 +111,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerCloseMetaV0":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerCloseMetaV0:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -117,10 +120,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerCloseMetaV0":
+ def from_xdr(cls, xdr: str) -> LedgerCloseMetaV0:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ledger_header,
+ self.tx_set,
+ self.tx_processing,
+ self.upgrades_processing,
+ self.scp_info,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_close_meta_v1.py b/stellar_sdk/xdr/ledger_close_meta_v1.py
new file mode 100644
index 000000000..91fc79b9f
--- /dev/null
+++ b/stellar_sdk/xdr/ledger_close_meta_v1.py
@@ -0,0 +1,157 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .generalized_transaction_set import GeneralizedTransactionSet
+from .ledger_header_history_entry import LedgerHeaderHistoryEntry
+from .scp_history_entry import SCPHistoryEntry
+from .transaction_result_meta import TransactionResultMeta
+from .upgrade_entry_meta import UpgradeEntryMeta
+
+__all__ = ["LedgerCloseMetaV1"]
+
+
+class LedgerCloseMetaV1:
+ """
+ XDR Source Code::
+
+ struct LedgerCloseMetaV1
+ {
+ LedgerHeaderHistoryEntry ledgerHeader;
+
+ GeneralizedTransactionSet txSet;
+
+ // NB: transactions are sorted in apply order here
+ // fees for all transactions are processed first
+ // followed by applying transactions
+ TransactionResultMeta txProcessing<>;
+
+ // upgrades are applied last
+ UpgradeEntryMeta upgradesProcessing<>;
+
+ // other misc information attached to the ledger close
+ SCPHistoryEntry scpInfo<>;
+ };
+ """
+
+ def __init__(
+ self,
+ ledger_header: LedgerHeaderHistoryEntry,
+ tx_set: GeneralizedTransactionSet,
+ tx_processing: List[TransactionResultMeta],
+ upgrades_processing: List[UpgradeEntryMeta],
+ scp_info: List[SCPHistoryEntry],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if tx_processing and len(tx_processing) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `tx_processing` should be {_expect_max_length}, but got {len(tx_processing)}."
+ )
+ _expect_max_length = 4294967295
+ if upgrades_processing and len(upgrades_processing) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `upgrades_processing` should be {_expect_max_length}, but got {len(upgrades_processing)}."
+ )
+ _expect_max_length = 4294967295
+ if scp_info and len(scp_info) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `scp_info` should be {_expect_max_length}, but got {len(scp_info)}."
+ )
+ self.ledger_header = ledger_header
+ self.tx_set = tx_set
+ self.tx_processing = tx_processing
+ self.upgrades_processing = upgrades_processing
+ self.scp_info = scp_info
+
+ def pack(self, packer: Packer) -> None:
+ self.ledger_header.pack(packer)
+ self.tx_set.pack(packer)
+ packer.pack_uint(len(self.tx_processing))
+ for tx_processing_item in self.tx_processing:
+ tx_processing_item.pack(packer)
+ packer.pack_uint(len(self.upgrades_processing))
+ for upgrades_processing_item in self.upgrades_processing:
+ upgrades_processing_item.pack(packer)
+ packer.pack_uint(len(self.scp_info))
+ for scp_info_item in self.scp_info:
+ scp_info_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> LedgerCloseMetaV1:
+ ledger_header = LedgerHeaderHistoryEntry.unpack(unpacker)
+ tx_set = GeneralizedTransactionSet.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ tx_processing = []
+ for _ in range(length):
+ tx_processing.append(TransactionResultMeta.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ upgrades_processing = []
+ for _ in range(length):
+ upgrades_processing.append(UpgradeEntryMeta.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ scp_info = []
+ for _ in range(length):
+ scp_info.append(SCPHistoryEntry.unpack(unpacker))
+ return cls(
+ ledger_header=ledger_header,
+ tx_set=tx_set,
+ tx_processing=tx_processing,
+ upgrades_processing=upgrades_processing,
+ scp_info=scp_info,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerCloseMetaV1:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> LedgerCloseMetaV1:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ledger_header,
+ self.tx_set,
+ self.tx_processing,
+ self.upgrades_processing,
+ self.scp_info,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ledger_header == other.ledger_header
+ and self.tx_set == other.tx_set
+ and self.tx_processing == other.tx_processing
+ and self.upgrades_processing == other.upgrades_processing
+ and self.scp_info == other.scp_info
+ )
+
+ def __str__(self):
+ out = [
+ f"ledger_header={self.ledger_header}",
+ f"tx_set={self.tx_set}",
+ f"tx_processing={self.tx_processing}",
+ f"upgrades_processing={self.upgrades_processing}",
+ f"scp_info={self.scp_info}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/ledger_close_meta_v2.py b/stellar_sdk/xdr/ledger_close_meta_v2.py
new file mode 100644
index 000000000..8eafb67ce
--- /dev/null
+++ b/stellar_sdk/xdr/ledger_close_meta_v2.py
@@ -0,0 +1,239 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .extension_point import ExtensionPoint
+from .generalized_transaction_set import GeneralizedTransactionSet
+from .ledger_entry import LedgerEntry
+from .ledger_header_history_entry import LedgerHeaderHistoryEntry
+from .ledger_key import LedgerKey
+from .scp_history_entry import SCPHistoryEntry
+from .transaction_result_meta import TransactionResultMeta
+from .uint64 import Uint64
+from .upgrade_entry_meta import UpgradeEntryMeta
+
+__all__ = ["LedgerCloseMetaV2"]
+
+
+class LedgerCloseMetaV2:
+ """
+ XDR Source Code::
+
+ struct LedgerCloseMetaV2
+ {
+ // We forgot to add an ExtensionPoint in v1 but at least
+ // we can add one now in v2.
+ ExtensionPoint ext;
+
+ LedgerHeaderHistoryEntry ledgerHeader;
+
+ GeneralizedTransactionSet txSet;
+
+ // NB: transactions are sorted in apply order here
+ // fees for all transactions are processed first
+ // followed by applying transactions
+ TransactionResultMeta txProcessing<>;
+
+ // upgrades are applied last
+ UpgradeEntryMeta upgradesProcessing<>;
+
+ // other misc information attached to the ledger close
+ SCPHistoryEntry scpInfo<>;
+
+ // Size in bytes of BucketList, to support downstream
+ // systems calculating storage fees correctly.
+ uint64 totalByteSizeOfBucketList;
+
+ // Expired temp keys that are being evicted at this ledger.
+ LedgerKey evictedTemporaryLedgerKeys<>;
+
+ // Expired restorable ledger entries that are being
+ // evicted at this ledger.
+ LedgerEntry evictedPersistentLedgerEntries<>;
+ };
+ """
+
+ def __init__(
+ self,
+ ext: ExtensionPoint,
+ ledger_header: LedgerHeaderHistoryEntry,
+ tx_set: GeneralizedTransactionSet,
+ tx_processing: List[TransactionResultMeta],
+ upgrades_processing: List[UpgradeEntryMeta],
+ scp_info: List[SCPHistoryEntry],
+ total_byte_size_of_bucket_list: Uint64,
+ evicted_temporary_ledger_keys: List[LedgerKey],
+ evicted_persistent_ledger_entries: List[LedgerEntry],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if tx_processing and len(tx_processing) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `tx_processing` should be {_expect_max_length}, but got {len(tx_processing)}."
+ )
+ _expect_max_length = 4294967295
+ if upgrades_processing and len(upgrades_processing) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `upgrades_processing` should be {_expect_max_length}, but got {len(upgrades_processing)}."
+ )
+ _expect_max_length = 4294967295
+ if scp_info and len(scp_info) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `scp_info` should be {_expect_max_length}, but got {len(scp_info)}."
+ )
+ _expect_max_length = 4294967295
+ if (
+ evicted_temporary_ledger_keys
+ and len(evicted_temporary_ledger_keys) > _expect_max_length
+ ):
+ raise ValueError(
+ f"The maximum length of `evicted_temporary_ledger_keys` should be {_expect_max_length}, but got {len(evicted_temporary_ledger_keys)}."
+ )
+ _expect_max_length = 4294967295
+ if (
+ evicted_persistent_ledger_entries
+ and len(evicted_persistent_ledger_entries) > _expect_max_length
+ ):
+ raise ValueError(
+ f"The maximum length of `evicted_persistent_ledger_entries` should be {_expect_max_length}, but got {len(evicted_persistent_ledger_entries)}."
+ )
+ self.ext = ext
+ self.ledger_header = ledger_header
+ self.tx_set = tx_set
+ self.tx_processing = tx_processing
+ self.upgrades_processing = upgrades_processing
+ self.scp_info = scp_info
+ self.total_byte_size_of_bucket_list = total_byte_size_of_bucket_list
+ self.evicted_temporary_ledger_keys = evicted_temporary_ledger_keys
+ self.evicted_persistent_ledger_entries = evicted_persistent_ledger_entries
+
+ def pack(self, packer: Packer) -> None:
+ self.ext.pack(packer)
+ self.ledger_header.pack(packer)
+ self.tx_set.pack(packer)
+ packer.pack_uint(len(self.tx_processing))
+ for tx_processing_item in self.tx_processing:
+ tx_processing_item.pack(packer)
+ packer.pack_uint(len(self.upgrades_processing))
+ for upgrades_processing_item in self.upgrades_processing:
+ upgrades_processing_item.pack(packer)
+ packer.pack_uint(len(self.scp_info))
+ for scp_info_item in self.scp_info:
+ scp_info_item.pack(packer)
+ self.total_byte_size_of_bucket_list.pack(packer)
+ packer.pack_uint(len(self.evicted_temporary_ledger_keys))
+ for evicted_temporary_ledger_keys_item in self.evicted_temporary_ledger_keys:
+ evicted_temporary_ledger_keys_item.pack(packer)
+ packer.pack_uint(len(self.evicted_persistent_ledger_entries))
+ for (
+ evicted_persistent_ledger_entries_item
+ ) in self.evicted_persistent_ledger_entries:
+ evicted_persistent_ledger_entries_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> LedgerCloseMetaV2:
+ ext = ExtensionPoint.unpack(unpacker)
+ ledger_header = LedgerHeaderHistoryEntry.unpack(unpacker)
+ tx_set = GeneralizedTransactionSet.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ tx_processing = []
+ for _ in range(length):
+ tx_processing.append(TransactionResultMeta.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ upgrades_processing = []
+ for _ in range(length):
+ upgrades_processing.append(UpgradeEntryMeta.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ scp_info = []
+ for _ in range(length):
+ scp_info.append(SCPHistoryEntry.unpack(unpacker))
+ total_byte_size_of_bucket_list = Uint64.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ evicted_temporary_ledger_keys = []
+ for _ in range(length):
+ evicted_temporary_ledger_keys.append(LedgerKey.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ evicted_persistent_ledger_entries = []
+ for _ in range(length):
+ evicted_persistent_ledger_entries.append(LedgerEntry.unpack(unpacker))
+ return cls(
+ ext=ext,
+ ledger_header=ledger_header,
+ tx_set=tx_set,
+ tx_processing=tx_processing,
+ upgrades_processing=upgrades_processing,
+ scp_info=scp_info,
+ total_byte_size_of_bucket_list=total_byte_size_of_bucket_list,
+ evicted_temporary_ledger_keys=evicted_temporary_ledger_keys,
+ evicted_persistent_ledger_entries=evicted_persistent_ledger_entries,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerCloseMetaV2:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> LedgerCloseMetaV2:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.ledger_header,
+ self.tx_set,
+ self.tx_processing,
+ self.upgrades_processing,
+ self.scp_info,
+ self.total_byte_size_of_bucket_list,
+ self.evicted_temporary_ledger_keys,
+ self.evicted_persistent_ledger_entries,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ext == other.ext
+ and self.ledger_header == other.ledger_header
+ and self.tx_set == other.tx_set
+ and self.tx_processing == other.tx_processing
+ and self.upgrades_processing == other.upgrades_processing
+ and self.scp_info == other.scp_info
+ and self.total_byte_size_of_bucket_list
+ == other.total_byte_size_of_bucket_list
+ and self.evicted_temporary_ledger_keys
+ == other.evicted_temporary_ledger_keys
+ and self.evicted_persistent_ledger_entries
+ == other.evicted_persistent_ledger_entries
+ )
+
+ def __str__(self):
+ out = [
+ f"ext={self.ext}",
+ f"ledger_header={self.ledger_header}",
+ f"tx_set={self.tx_set}",
+ f"tx_processing={self.tx_processing}",
+ f"upgrades_processing={self.upgrades_processing}",
+ f"scp_info={self.scp_info}",
+ f"total_byte_size_of_bucket_list={self.total_byte_size_of_bucket_list}",
+ f"evicted_temporary_ledger_keys={self.evicted_temporary_ledger_keys}",
+ f"evicted_persistent_ledger_entries={self.evicted_persistent_ledger_entries}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/ledger_close_value_signature.py b/stellar_sdk/xdr/ledger_close_value_signature.py
index 9c05dcb52..5de4c0b19 100644
--- a/stellar_sdk/xdr/ledger_close_value_signature.py
+++ b/stellar_sdk/xdr/ledger_close_value_signature.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .node_id import NodeID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.signature.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerCloseValueSignature":
+ def unpack(cls, unpacker: Unpacker) -> LedgerCloseValueSignature:
node_id = NodeID.unpack(unpacker)
signature = Signature.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerCloseValueSignature":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerCloseValueSignature:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerCloseValueSignature":
+ def from_xdr(cls, xdr: str) -> LedgerCloseValueSignature:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.node_id,
+ self.signature,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_entry.py b/stellar_sdk/xdr/ledger_entry.py
index 64482b802..22240fcc8 100644
--- a/stellar_sdk/xdr/ledger_entry.py
+++ b/stellar_sdk/xdr/ledger_entry.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .ledger_entry_data import LedgerEntryData
@@ -32,6 +35,14 @@ class LedgerEntry:
ClaimableBalanceEntry claimableBalance;
case LIQUIDITY_POOL:
LiquidityPoolEntry liquidityPool;
+ case CONTRACT_DATA:
+ ContractDataEntry contractData;
+ case CONTRACT_CODE:
+ ContractCodeEntry contractCode;
+ case CONFIG_SETTING:
+ ConfigSettingEntry configSetting;
+ case EXPIRATION:
+ ExpirationEntry expiration;
}
data;
@@ -63,7 +74,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerEntry":
+ def unpack(cls, unpacker: Unpacker) -> LedgerEntry:
last_modified_ledger_seq = Uint32.unpack(unpacker)
data = LedgerEntryData.unpack(unpacker)
ext = LedgerEntryExt.unpack(unpacker)
@@ -79,7 +90,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerEntry":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerEntry:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -88,10 +99,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerEntry":
+ def from_xdr(cls, xdr: str) -> LedgerEntry:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.last_modified_ledger_seq,
+ self.data,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_entry_change.py b/stellar_sdk/xdr/ledger_entry_change.py
index aae4e877e..823287b47 100644
--- a/stellar_sdk/xdr/ledger_entry_change.py
+++ b/stellar_sdk/xdr/ledger_entry_change.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .ledger_entry import LedgerEntry
@@ -65,7 +68,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerEntryChange":
+ def unpack(cls, unpacker: Unpacker) -> LedgerEntryChange:
type = LedgerEntryChangeType.unpack(unpacker)
if type == LedgerEntryChangeType.LEDGER_ENTRY_CREATED:
created = LedgerEntry.unpack(unpacker)
@@ -87,7 +90,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerEntryChange":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerEntryChange:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -96,10 +99,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerEntryChange":
+ def from_xdr(cls, xdr: str) -> LedgerEntryChange:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.created,
+ self.updated,
+ self.removed,
+ self.state,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_entry_change_type.py b/stellar_sdk/xdr/ledger_entry_change_type.py
index 0197455d6..cae8980d0 100644
--- a/stellar_sdk/xdr/ledger_entry_change_type.py
+++ b/stellar_sdk/xdr/ledger_entry_change_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["LedgerEntryChangeType"]
@@ -29,7 +32,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerEntryChangeType":
+ def unpack(cls, unpacker: Unpacker) -> LedgerEntryChangeType:
value = unpacker.unpack_int()
return cls(value)
@@ -39,7 +42,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerEntryChangeType":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerEntryChangeType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -48,6 +51,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerEntryChangeType":
+ def from_xdr(cls, xdr: str) -> LedgerEntryChangeType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/ledger_entry_changes.py b/stellar_sdk/xdr/ledger_entry_changes.py
index 2e501ad8c..6b9630090 100644
--- a/stellar_sdk/xdr/ledger_entry_changes.py
+++ b/stellar_sdk/xdr/ledger_entry_changes.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .ledger_entry_change import LedgerEntryChange
@@ -30,7 +33,7 @@ def pack(self, packer: Packer) -> None:
ledger_entry_changes_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerEntryChanges":
+ def unpack(cls, unpacker: Unpacker) -> LedgerEntryChanges:
length = unpacker.unpack_uint()
ledger_entry_changes = []
for _ in range(length):
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerEntryChanges":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerEntryChanges:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerEntryChanges":
+ def from_xdr(cls, xdr: str) -> LedgerEntryChanges:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.ledger_entry_changes)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_entry_data.py b/stellar_sdk/xdr/ledger_entry_data.py
index a2e2c38db..004e70c34 100644
--- a/stellar_sdk/xdr/ledger_entry_data.py
+++ b/stellar_sdk/xdr/ledger_entry_data.py
@@ -1,11 +1,18 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_entry import AccountEntry
from .claimable_balance_entry import ClaimableBalanceEntry
+from .config_setting_entry import ConfigSettingEntry
+from .contract_code_entry import ContractCodeEntry
+from .contract_data_entry import ContractDataEntry
from .data_entry import DataEntry
+from .expiration_entry import ExpirationEntry
from .ledger_entry_type import LedgerEntryType
from .liquidity_pool_entry import LiquidityPoolEntry
from .offer_entry import OfferEntry
@@ -32,6 +39,14 @@ class LedgerEntryData:
ClaimableBalanceEntry claimableBalance;
case LIQUIDITY_POOL:
LiquidityPoolEntry liquidityPool;
+ case CONTRACT_DATA:
+ ContractDataEntry contractData;
+ case CONTRACT_CODE:
+ ContractCodeEntry contractCode;
+ case CONFIG_SETTING:
+ ConfigSettingEntry configSetting;
+ case EXPIRATION:
+ ExpirationEntry expiration;
}
"""
@@ -44,6 +59,10 @@ def __init__(
data: DataEntry = None,
claimable_balance: ClaimableBalanceEntry = None,
liquidity_pool: LiquidityPoolEntry = None,
+ contract_data: ContractDataEntry = None,
+ contract_code: ContractCodeEntry = None,
+ config_setting: ConfigSettingEntry = None,
+ expiration: ExpirationEntry = None,
) -> None:
self.type = type
self.account = account
@@ -52,6 +71,10 @@ def __init__(
self.data = data
self.claimable_balance = claimable_balance
self.liquidity_pool = liquidity_pool
+ self.contract_data = contract_data
+ self.contract_code = contract_code
+ self.config_setting = config_setting
+ self.expiration = expiration
def pack(self, packer: Packer) -> None:
self.type.pack(packer)
@@ -85,9 +108,29 @@ def pack(self, packer: Packer) -> None:
raise ValueError("liquidity_pool should not be None.")
self.liquidity_pool.pack(packer)
return
+ if self.type == LedgerEntryType.CONTRACT_DATA:
+ if self.contract_data is None:
+ raise ValueError("contract_data should not be None.")
+ self.contract_data.pack(packer)
+ return
+ if self.type == LedgerEntryType.CONTRACT_CODE:
+ if self.contract_code is None:
+ raise ValueError("contract_code should not be None.")
+ self.contract_code.pack(packer)
+ return
+ if self.type == LedgerEntryType.CONFIG_SETTING:
+ if self.config_setting is None:
+ raise ValueError("config_setting should not be None.")
+ self.config_setting.pack(packer)
+ return
+ if self.type == LedgerEntryType.EXPIRATION:
+ if self.expiration is None:
+ raise ValueError("expiration should not be None.")
+ self.expiration.pack(packer)
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerEntryData":
+ def unpack(cls, unpacker: Unpacker) -> LedgerEntryData:
type = LedgerEntryType.unpack(unpacker)
if type == LedgerEntryType.ACCOUNT:
account = AccountEntry.unpack(unpacker)
@@ -107,6 +150,18 @@ def unpack(cls, unpacker: Unpacker) -> "LedgerEntryData":
if type == LedgerEntryType.LIQUIDITY_POOL:
liquidity_pool = LiquidityPoolEntry.unpack(unpacker)
return cls(type=type, liquidity_pool=liquidity_pool)
+ if type == LedgerEntryType.CONTRACT_DATA:
+ contract_data = ContractDataEntry.unpack(unpacker)
+ return cls(type=type, contract_data=contract_data)
+ if type == LedgerEntryType.CONTRACT_CODE:
+ contract_code = ContractCodeEntry.unpack(unpacker)
+ return cls(type=type, contract_code=contract_code)
+ if type == LedgerEntryType.CONFIG_SETTING:
+ config_setting = ConfigSettingEntry.unpack(unpacker)
+ return cls(type=type, config_setting=config_setting)
+ if type == LedgerEntryType.EXPIRATION:
+ expiration = ExpirationEntry.unpack(unpacker)
+ return cls(type=type, expiration=expiration)
return cls(type=type)
def to_xdr_bytes(self) -> bytes:
@@ -115,7 +170,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerEntryData":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerEntryData:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -124,10 +179,27 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerEntryData":
+ def from_xdr(cls, xdr: str) -> LedgerEntryData:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.account,
+ self.trust_line,
+ self.offer,
+ self.data,
+ self.claimable_balance,
+ self.liquidity_pool,
+ self.contract_data,
+ self.contract_code,
+ self.config_setting,
+ self.expiration,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -139,6 +211,10 @@ def __eq__(self, other: object):
and self.data == other.data
and self.claimable_balance == other.claimable_balance
and self.liquidity_pool == other.liquidity_pool
+ and self.contract_data == other.contract_data
+ and self.contract_code == other.contract_code
+ and self.config_setting == other.config_setting
+ and self.expiration == other.expiration
)
def __str__(self):
@@ -156,4 +232,16 @@ def __str__(self):
out.append(
f"liquidity_pool={self.liquidity_pool}"
) if self.liquidity_pool is not None else None
+ out.append(
+ f"contract_data={self.contract_data}"
+ ) if self.contract_data is not None else None
+ out.append(
+ f"contract_code={self.contract_code}"
+ ) if self.contract_code is not None else None
+ out.append(
+ f"config_setting={self.config_setting}"
+ ) if self.config_setting is not None else None
+ out.append(
+ f"expiration={self.expiration}"
+ ) if self.expiration is not None else None
return f""
diff --git a/stellar_sdk/xdr/ledger_entry_ext.py b/stellar_sdk/xdr/ledger_entry_ext.py
index eda70d51c..1cdf5eafb 100644
--- a/stellar_sdk/xdr/ledger_entry_ext.py
+++ b/stellar_sdk/xdr/ledger_entry_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerEntryExt":
+ def unpack(cls, unpacker: Unpacker) -> LedgerEntryExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -56,7 +59,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerEntryExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerEntryExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,10 +68,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerEntryExt":
+ def from_xdr(cls, xdr: str) -> LedgerEntryExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v1,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_entry_extension_v1.py b/stellar_sdk/xdr/ledger_entry_extension_v1.py
index 2151b1cd1..60537421e 100644
--- a/stellar_sdk/xdr/ledger_entry_extension_v1.py
+++ b/stellar_sdk/xdr/ledger_entry_extension_v1.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .ledger_entry_extension_v1_ext import LedgerEntryExtensionV1Ext
@@ -39,7 +42,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerEntryExtensionV1":
+ def unpack(cls, unpacker: Unpacker) -> LedgerEntryExtensionV1:
sponsoring_id = SponsorshipDescriptor.unpack(unpacker)
ext = LedgerEntryExtensionV1Ext.unpack(unpacker)
return cls(
@@ -53,7 +56,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerEntryExtensionV1":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerEntryExtensionV1:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -62,10 +65,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerEntryExtensionV1":
+ def from_xdr(cls, xdr: str) -> LedgerEntryExtensionV1:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.sponsoring_id,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_entry_extension_v1_ext.py b/stellar_sdk/xdr/ledger_entry_extension_v1_ext.py
index ebfbdfe34..d1d067604 100644
--- a/stellar_sdk/xdr/ledger_entry_extension_v1_ext.py
+++ b/stellar_sdk/xdr/ledger_entry_extension_v1_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerEntryExtensionV1Ext":
+ def unpack(cls, unpacker: Unpacker) -> LedgerEntryExtensionV1Ext:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerEntryExtensionV1Ext":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerEntryExtensionV1Ext:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerEntryExtensionV1Ext":
+ def from_xdr(cls, xdr: str) -> LedgerEntryExtensionV1Ext:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_entry_type.py b/stellar_sdk/xdr/ledger_entry_type.py
index dd46db6b5..19b1a0fd4 100644
--- a/stellar_sdk/xdr/ledger_entry_type.py
+++ b/stellar_sdk/xdr/ledger_entry_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["LedgerEntryType"]
@@ -18,7 +21,11 @@ class LedgerEntryType(IntEnum):
OFFER = 2,
DATA = 3,
CLAIMABLE_BALANCE = 4,
- LIQUIDITY_POOL = 5
+ LIQUIDITY_POOL = 5,
+ CONTRACT_DATA = 6,
+ CONTRACT_CODE = 7,
+ CONFIG_SETTING = 8,
+ EXPIRATION = 9
};
"""
@@ -28,12 +35,16 @@ class LedgerEntryType(IntEnum):
DATA = 3
CLAIMABLE_BALANCE = 4
LIQUIDITY_POOL = 5
+ CONTRACT_DATA = 6
+ CONTRACT_CODE = 7
+ CONFIG_SETTING = 8
+ EXPIRATION = 9
def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerEntryType":
+ def unpack(cls, unpacker: Unpacker) -> LedgerEntryType:
value = unpacker.unpack_int()
return cls(value)
@@ -43,7 +54,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerEntryType":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerEntryType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,6 +63,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerEntryType":
+ def from_xdr(cls, xdr: str) -> LedgerEntryType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/ledger_footprint.py b/stellar_sdk/xdr/ledger_footprint.py
new file mode 100644
index 000000000..67de4c5c2
--- /dev/null
+++ b/stellar_sdk/xdr/ledger_footprint.py
@@ -0,0 +1,104 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .ledger_key import LedgerKey
+
+__all__ = ["LedgerFootprint"]
+
+
+class LedgerFootprint:
+ """
+ XDR Source Code::
+
+ struct LedgerFootprint
+ {
+ LedgerKey readOnly<>;
+ LedgerKey readWrite<>;
+ };
+ """
+
+ def __init__(
+ self,
+ read_only: List[LedgerKey],
+ read_write: List[LedgerKey],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if read_only and len(read_only) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `read_only` should be {_expect_max_length}, but got {len(read_only)}."
+ )
+ _expect_max_length = 4294967295
+ if read_write and len(read_write) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `read_write` should be {_expect_max_length}, but got {len(read_write)}."
+ )
+ self.read_only = read_only
+ self.read_write = read_write
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_uint(len(self.read_only))
+ for read_only_item in self.read_only:
+ read_only_item.pack(packer)
+ packer.pack_uint(len(self.read_write))
+ for read_write_item in self.read_write:
+ read_write_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> LedgerFootprint:
+ length = unpacker.unpack_uint()
+ read_only = []
+ for _ in range(length):
+ read_only.append(LedgerKey.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ read_write = []
+ for _ in range(length):
+ read_write.append(LedgerKey.unpack(unpacker))
+ return cls(
+ read_only=read_only,
+ read_write=read_write,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerFootprint:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> LedgerFootprint:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.read_only,
+ self.read_write,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.read_only == other.read_only and self.read_write == other.read_write
+
+ def __str__(self):
+ out = [
+ f"read_only={self.read_only}",
+ f"read_write={self.read_write}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/ledger_header.py b/stellar_sdk/xdr/ledger_header.py
index a969abb46..0c1384e23 100644
--- a/stellar_sdk/xdr/ledger_header.py
+++ b/stellar_sdk/xdr/ledger_header.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .hash import Hash
@@ -117,7 +120,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerHeader":
+ def unpack(cls, unpacker: Unpacker) -> LedgerHeader:
ledger_version = Uint32.unpack(unpacker)
previous_ledger_hash = Hash.unpack(unpacker)
scp_value = StellarValue.unpack(unpacker)
@@ -160,7 +163,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerHeader":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerHeader:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -169,10 +172,31 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerHeader":
+ def from_xdr(cls, xdr: str) -> LedgerHeader:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ledger_version,
+ self.previous_ledger_hash,
+ self.scp_value,
+ self.tx_set_result_hash,
+ self.bucket_list_hash,
+ self.ledger_seq,
+ self.total_coins,
+ self.fee_pool,
+ self.inflation_seq,
+ self.id_pool,
+ self.base_fee,
+ self.base_reserve,
+ self.max_tx_set_size,
+ self.skip_list,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_header_ext.py b/stellar_sdk/xdr/ledger_header_ext.py
index 8cb57e9b6..9cb13e4e4 100644
--- a/stellar_sdk/xdr/ledger_header_ext.py
+++ b/stellar_sdk/xdr/ledger_header_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerHeaderExt":
+ def unpack(cls, unpacker: Unpacker) -> LedgerHeaderExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -56,7 +59,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerHeaderExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerHeaderExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,10 +68,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerHeaderExt":
+ def from_xdr(cls, xdr: str) -> LedgerHeaderExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v1,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_header_extension_v1.py b/stellar_sdk/xdr/ledger_header_extension_v1.py
index c8a518f82..f2432013a 100644
--- a/stellar_sdk/xdr/ledger_header_extension_v1.py
+++ b/stellar_sdk/xdr/ledger_header_extension_v1.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .ledger_header_extension_v1_ext import LedgerHeaderExtensionV1Ext
@@ -39,7 +42,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerHeaderExtensionV1":
+ def unpack(cls, unpacker: Unpacker) -> LedgerHeaderExtensionV1:
flags = Uint32.unpack(unpacker)
ext = LedgerHeaderExtensionV1Ext.unpack(unpacker)
return cls(
@@ -53,7 +56,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerHeaderExtensionV1":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerHeaderExtensionV1:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -62,10 +65,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerHeaderExtensionV1":
+ def from_xdr(cls, xdr: str) -> LedgerHeaderExtensionV1:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.flags,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_header_extension_v1_ext.py b/stellar_sdk/xdr/ledger_header_extension_v1_ext.py
index 5f3909fa3..af7b4d02f 100644
--- a/stellar_sdk/xdr/ledger_header_extension_v1_ext.py
+++ b/stellar_sdk/xdr/ledger_header_extension_v1_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerHeaderExtensionV1Ext":
+ def unpack(cls, unpacker: Unpacker) -> LedgerHeaderExtensionV1Ext:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerHeaderExtensionV1Ext":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerHeaderExtensionV1Ext:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerHeaderExtensionV1Ext":
+ def from_xdr(cls, xdr: str) -> LedgerHeaderExtensionV1Ext:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_header_flags.py b/stellar_sdk/xdr/ledger_header_flags.py
index 35f5e1623..22e69a3bd 100644
--- a/stellar_sdk/xdr/ledger_header_flags.py
+++ b/stellar_sdk/xdr/ledger_header_flags.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["LedgerHeaderFlags"]
@@ -27,7 +30,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerHeaderFlags":
+ def unpack(cls, unpacker: Unpacker) -> LedgerHeaderFlags:
value = unpacker.unpack_int()
return cls(value)
@@ -37,7 +40,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerHeaderFlags":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerHeaderFlags:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -46,6 +49,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerHeaderFlags":
+ def from_xdr(cls, xdr: str) -> LedgerHeaderFlags:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/ledger_header_history_entry.py b/stellar_sdk/xdr/ledger_header_history_entry.py
index 750797815..de3b60085 100644
--- a/stellar_sdk/xdr/ledger_header_history_entry.py
+++ b/stellar_sdk/xdr/ledger_header_history_entry.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .hash import Hash
@@ -45,7 +48,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerHeaderHistoryEntry":
+ def unpack(cls, unpacker: Unpacker) -> LedgerHeaderHistoryEntry:
hash = Hash.unpack(unpacker)
header = LedgerHeader.unpack(unpacker)
ext = LedgerHeaderHistoryEntryExt.unpack(unpacker)
@@ -61,7 +64,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerHeaderHistoryEntry":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerHeaderHistoryEntry:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -70,10 +73,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerHeaderHistoryEntry":
+ def from_xdr(cls, xdr: str) -> LedgerHeaderHistoryEntry:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.hash,
+ self.header,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_header_history_entry_ext.py b/stellar_sdk/xdr/ledger_header_history_entry_ext.py
index c8c2547ec..e73d62e45 100644
--- a/stellar_sdk/xdr/ledger_header_history_entry_ext.py
+++ b/stellar_sdk/xdr/ledger_header_history_entry_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerHeaderHistoryEntryExt":
+ def unpack(cls, unpacker: Unpacker) -> LedgerHeaderHistoryEntryExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerHeaderHistoryEntryExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerHeaderHistoryEntryExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerHeaderHistoryEntryExt":
+ def from_xdr(cls, xdr: str) -> LedgerHeaderHistoryEntryExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_key.py b/stellar_sdk/xdr/ledger_key.py
index 1f8192102..be9750044 100644
--- a/stellar_sdk/xdr/ledger_key.py
+++ b/stellar_sdk/xdr/ledger_key.py
@@ -1,12 +1,19 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .ledger_entry_type import LedgerEntryType
from .ledger_key_account import LedgerKeyAccount
from .ledger_key_claimable_balance import LedgerKeyClaimableBalance
+from .ledger_key_config_setting import LedgerKeyConfigSetting
+from .ledger_key_contract_code import LedgerKeyContractCode
+from .ledger_key_contract_data import LedgerKeyContractData
from .ledger_key_data import LedgerKeyData
+from .ledger_key_expiration import LedgerKeyExpiration
from .ledger_key_liquidity_pool import LedgerKeyLiquidityPool
from .ledger_key_offer import LedgerKeyOffer
from .ledger_key_trust_line import LedgerKeyTrustLine
@@ -58,6 +65,29 @@ class LedgerKey:
{
PoolID liquidityPoolID;
} liquidityPool;
+ case CONTRACT_DATA:
+ struct
+ {
+ SCAddress contract;
+ SCVal key;
+ ContractDataDurability durability;
+ } contractData;
+ case CONTRACT_CODE:
+ struct
+ {
+ Hash hash;
+ } contractCode;
+ case CONFIG_SETTING:
+ struct
+ {
+ ConfigSettingID configSettingID;
+ } configSetting;
+ case EXPIRATION:
+ struct
+ {
+ // Hash of the LedgerKey that is associated with this ExpirationEntry
+ Hash keyHash;
+ } expiration;
};
"""
@@ -70,6 +100,10 @@ def __init__(
data: LedgerKeyData = None,
claimable_balance: LedgerKeyClaimableBalance = None,
liquidity_pool: LedgerKeyLiquidityPool = None,
+ contract_data: LedgerKeyContractData = None,
+ contract_code: LedgerKeyContractCode = None,
+ config_setting: LedgerKeyConfigSetting = None,
+ expiration: LedgerKeyExpiration = None,
) -> None:
self.type = type
self.account = account
@@ -78,6 +112,10 @@ def __init__(
self.data = data
self.claimable_balance = claimable_balance
self.liquidity_pool = liquidity_pool
+ self.contract_data = contract_data
+ self.contract_code = contract_code
+ self.config_setting = config_setting
+ self.expiration = expiration
def pack(self, packer: Packer) -> None:
self.type.pack(packer)
@@ -111,9 +149,29 @@ def pack(self, packer: Packer) -> None:
raise ValueError("liquidity_pool should not be None.")
self.liquidity_pool.pack(packer)
return
+ if self.type == LedgerEntryType.CONTRACT_DATA:
+ if self.contract_data is None:
+ raise ValueError("contract_data should not be None.")
+ self.contract_data.pack(packer)
+ return
+ if self.type == LedgerEntryType.CONTRACT_CODE:
+ if self.contract_code is None:
+ raise ValueError("contract_code should not be None.")
+ self.contract_code.pack(packer)
+ return
+ if self.type == LedgerEntryType.CONFIG_SETTING:
+ if self.config_setting is None:
+ raise ValueError("config_setting should not be None.")
+ self.config_setting.pack(packer)
+ return
+ if self.type == LedgerEntryType.EXPIRATION:
+ if self.expiration is None:
+ raise ValueError("expiration should not be None.")
+ self.expiration.pack(packer)
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerKey":
+ def unpack(cls, unpacker: Unpacker) -> LedgerKey:
type = LedgerEntryType.unpack(unpacker)
if type == LedgerEntryType.ACCOUNT:
account = LedgerKeyAccount.unpack(unpacker)
@@ -133,6 +191,18 @@ def unpack(cls, unpacker: Unpacker) -> "LedgerKey":
if type == LedgerEntryType.LIQUIDITY_POOL:
liquidity_pool = LedgerKeyLiquidityPool.unpack(unpacker)
return cls(type=type, liquidity_pool=liquidity_pool)
+ if type == LedgerEntryType.CONTRACT_DATA:
+ contract_data = LedgerKeyContractData.unpack(unpacker)
+ return cls(type=type, contract_data=contract_data)
+ if type == LedgerEntryType.CONTRACT_CODE:
+ contract_code = LedgerKeyContractCode.unpack(unpacker)
+ return cls(type=type, contract_code=contract_code)
+ if type == LedgerEntryType.CONFIG_SETTING:
+ config_setting = LedgerKeyConfigSetting.unpack(unpacker)
+ return cls(type=type, config_setting=config_setting)
+ if type == LedgerEntryType.EXPIRATION:
+ expiration = LedgerKeyExpiration.unpack(unpacker)
+ return cls(type=type, expiration=expiration)
return cls(type=type)
def to_xdr_bytes(self) -> bytes:
@@ -141,7 +211,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerKey":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKey:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -150,10 +220,27 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerKey":
+ def from_xdr(cls, xdr: str) -> LedgerKey:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.account,
+ self.trust_line,
+ self.offer,
+ self.data,
+ self.claimable_balance,
+ self.liquidity_pool,
+ self.contract_data,
+ self.contract_code,
+ self.config_setting,
+ self.expiration,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -165,6 +252,10 @@ def __eq__(self, other: object):
and self.data == other.data
and self.claimable_balance == other.claimable_balance
and self.liquidity_pool == other.liquidity_pool
+ and self.contract_data == other.contract_data
+ and self.contract_code == other.contract_code
+ and self.config_setting == other.config_setting
+ and self.expiration == other.expiration
)
def __str__(self):
@@ -182,4 +273,16 @@ def __str__(self):
out.append(
f"liquidity_pool={self.liquidity_pool}"
) if self.liquidity_pool is not None else None
+ out.append(
+ f"contract_data={self.contract_data}"
+ ) if self.contract_data is not None else None
+ out.append(
+ f"contract_code={self.contract_code}"
+ ) if self.contract_code is not None else None
+ out.append(
+ f"config_setting={self.config_setting}"
+ ) if self.config_setting is not None else None
+ out.append(
+ f"expiration={self.expiration}"
+ ) if self.expiration is not None else None
return f""
diff --git a/stellar_sdk/xdr/ledger_key_account.py b/stellar_sdk/xdr/ledger_key_account.py
index e192098f8..f45fdda6b 100644
--- a/stellar_sdk/xdr/ledger_key_account.py
+++ b/stellar_sdk/xdr/ledger_key_account.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
self.account_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerKeyAccount":
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyAccount:
account_id = AccountID.unpack(unpacker)
return cls(
account_id=account_id,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerKeyAccount":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyAccount:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerKeyAccount":
+ def from_xdr(cls, xdr: str) -> LedgerKeyAccount:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.account_id,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_key_claimable_balance.py b/stellar_sdk/xdr/ledger_key_claimable_balance.py
index 40194a921..8eb9c8353 100644
--- a/stellar_sdk/xdr/ledger_key_claimable_balance.py
+++ b/stellar_sdk/xdr/ledger_key_claimable_balance.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .claimable_balance_id import ClaimableBalanceID
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
self.balance_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerKeyClaimableBalance":
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyClaimableBalance:
balance_id = ClaimableBalanceID.unpack(unpacker)
return cls(
balance_id=balance_id,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerKeyClaimableBalance":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyClaimableBalance:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerKeyClaimableBalance":
+ def from_xdr(cls, xdr: str) -> LedgerKeyClaimableBalance:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.balance_id,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_key_config_setting.py b/stellar_sdk/xdr/ledger_key_config_setting.py
new file mode 100644
index 000000000..ee0f61812
--- /dev/null
+++ b/stellar_sdk/xdr/ledger_key_config_setting.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .config_setting_id import ConfigSettingID
+
+__all__ = ["LedgerKeyConfigSetting"]
+
+
+class LedgerKeyConfigSetting:
+ """
+ XDR Source Code::
+
+ struct
+ {
+ ConfigSettingID configSettingID;
+ }
+ """
+
+ def __init__(
+ self,
+ config_setting_id: ConfigSettingID,
+ ) -> None:
+ self.config_setting_id = config_setting_id
+
+ def pack(self, packer: Packer) -> None:
+ self.config_setting_id.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyConfigSetting:
+ config_setting_id = ConfigSettingID.unpack(unpacker)
+ return cls(
+ config_setting_id=config_setting_id,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyConfigSetting:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> LedgerKeyConfigSetting:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.config_setting_id,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.config_setting_id == other.config_setting_id
+
+ def __str__(self):
+ out = [
+ f"config_setting_id={self.config_setting_id}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/ledger_key_contract_code.py b/stellar_sdk/xdr/ledger_key_contract_code.py
new file mode 100644
index 000000000..71f0a1b77
--- /dev/null
+++ b/stellar_sdk/xdr/ledger_key_contract_code.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .hash import Hash
+
+__all__ = ["LedgerKeyContractCode"]
+
+
+class LedgerKeyContractCode:
+ """
+ XDR Source Code::
+
+ struct
+ {
+ Hash hash;
+ }
+ """
+
+ def __init__(
+ self,
+ hash: Hash,
+ ) -> None:
+ self.hash = hash
+
+ def pack(self, packer: Packer) -> None:
+ self.hash.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyContractCode:
+ hash = Hash.unpack(unpacker)
+ return cls(
+ hash=hash,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyContractCode:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> LedgerKeyContractCode:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.hash,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.hash == other.hash
+
+ def __str__(self):
+ out = [
+ f"hash={self.hash}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/ledger_key_contract_data.py b/stellar_sdk/xdr/ledger_key_contract_data.py
new file mode 100644
index 000000000..7f3c25ba2
--- /dev/null
+++ b/stellar_sdk/xdr/ledger_key_contract_data.py
@@ -0,0 +1,97 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .contract_data_durability import ContractDataDurability
+from .sc_address import SCAddress
+from .sc_val import SCVal
+
+__all__ = ["LedgerKeyContractData"]
+
+
+class LedgerKeyContractData:
+ """
+ XDR Source Code::
+
+ struct
+ {
+ SCAddress contract;
+ SCVal key;
+ ContractDataDurability durability;
+ }
+ """
+
+ def __init__(
+ self,
+ contract: SCAddress,
+ key: SCVal,
+ durability: ContractDataDurability,
+ ) -> None:
+ self.contract = contract
+ self.key = key
+ self.durability = durability
+
+ def pack(self, packer: Packer) -> None:
+ self.contract.pack(packer)
+ self.key.pack(packer)
+ self.durability.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyContractData:
+ contract = SCAddress.unpack(unpacker)
+ key = SCVal.unpack(unpacker)
+ durability = ContractDataDurability.unpack(unpacker)
+ return cls(
+ contract=contract,
+ key=key,
+ durability=durability,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyContractData:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> LedgerKeyContractData:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.contract,
+ self.key,
+ self.durability,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.contract == other.contract
+ and self.key == other.key
+ and self.durability == other.durability
+ )
+
+ def __str__(self):
+ out = [
+ f"contract={self.contract}",
+ f"key={self.key}",
+ f"durability={self.durability}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/ledger_key_data.py b/stellar_sdk/xdr/ledger_key_data.py
index 98285f046..8e311b422 100644
--- a/stellar_sdk/xdr/ledger_key_data.py
+++ b/stellar_sdk/xdr/ledger_key_data.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.data_name.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerKeyData":
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyData:
account_id = AccountID.unpack(unpacker)
data_name = String64.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerKeyData":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyData:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerKeyData":
+ def from_xdr(cls, xdr: str) -> LedgerKeyData:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.account_id,
+ self.data_name,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_key_expiration.py b/stellar_sdk/xdr/ledger_key_expiration.py
new file mode 100644
index 000000000..fead22d1e
--- /dev/null
+++ b/stellar_sdk/xdr/ledger_key_expiration.py
@@ -0,0 +1,72 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .hash import Hash
+
+__all__ = ["LedgerKeyExpiration"]
+
+
+class LedgerKeyExpiration:
+ """
+ XDR Source Code::
+
+ struct
+ {
+ // Hash of the LedgerKey that is associated with this ExpirationEntry
+ Hash keyHash;
+ }
+ """
+
+ def __init__(
+ self,
+ key_hash: Hash,
+ ) -> None:
+ self.key_hash = key_hash
+
+ def pack(self, packer: Packer) -> None:
+ self.key_hash.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyExpiration:
+ key_hash = Hash.unpack(unpacker)
+ return cls(
+ key_hash=key_hash,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyExpiration:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> LedgerKeyExpiration:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.key_hash,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.key_hash == other.key_hash
+
+ def __str__(self):
+ out = [
+ f"key_hash={self.key_hash}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/ledger_key_liquidity_pool.py b/stellar_sdk/xdr/ledger_key_liquidity_pool.py
index b08119cf4..b3a33a8b3 100644
--- a/stellar_sdk/xdr/ledger_key_liquidity_pool.py
+++ b/stellar_sdk/xdr/ledger_key_liquidity_pool.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .pool_id import PoolID
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
self.liquidity_pool_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerKeyLiquidityPool":
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyLiquidityPool:
liquidity_pool_id = PoolID.unpack(unpacker)
return cls(
liquidity_pool_id=liquidity_pool_id,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerKeyLiquidityPool":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyLiquidityPool:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerKeyLiquidityPool":
+ def from_xdr(cls, xdr: str) -> LedgerKeyLiquidityPool:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.liquidity_pool_id,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_key_offer.py b/stellar_sdk/xdr/ledger_key_offer.py
index 82e76a000..849038570 100644
--- a/stellar_sdk/xdr/ledger_key_offer.py
+++ b/stellar_sdk/xdr/ledger_key_offer.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.offer_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerKeyOffer":
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyOffer:
seller_id = AccountID.unpack(unpacker)
offer_id = Int64.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerKeyOffer":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyOffer:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerKeyOffer":
+ def from_xdr(cls, xdr: str) -> LedgerKeyOffer:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.seller_id,
+ self.offer_id,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_key_trust_line.py b/stellar_sdk/xdr/ledger_key_trust_line.py
index c82518ae2..2774c1712 100644
--- a/stellar_sdk/xdr/ledger_key_trust_line.py
+++ b/stellar_sdk/xdr/ledger_key_trust_line.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.asset.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerKeyTrustLine":
+ def unpack(cls, unpacker: Unpacker) -> LedgerKeyTrustLine:
account_id = AccountID.unpack(unpacker)
asset = TrustLineAsset.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerKeyTrustLine":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerKeyTrustLine:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerKeyTrustLine":
+ def from_xdr(cls, xdr: str) -> LedgerKeyTrustLine:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.account_id,
+ self.asset,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_scp_messages.py b/stellar_sdk/xdr/ledger_scp_messages.py
index 405715e50..6aba5de65 100644
--- a/stellar_sdk/xdr/ledger_scp_messages.py
+++ b/stellar_sdk/xdr/ledger_scp_messages.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .scp_envelope import SCPEnvelope
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
messages_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerSCPMessages":
+ def unpack(cls, unpacker: Unpacker) -> LedgerSCPMessages:
ledger_seq = Uint32.unpack(unpacker)
length = unpacker.unpack_uint()
messages = []
@@ -58,7 +61,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerSCPMessages":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerSCPMessages:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -67,10 +70,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerSCPMessages":
+ def from_xdr(cls, xdr: str) -> LedgerSCPMessages:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ledger_seq,
+ self.messages,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/ledger_upgrade.py b/stellar_sdk/xdr/ledger_upgrade.py
index 0250094e4..092b70f78 100644
--- a/stellar_sdk/xdr/ledger_upgrade.py
+++ b/stellar_sdk/xdr/ledger_upgrade.py
@@ -1,8 +1,12 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
+from .config_upgrade_set_key import ConfigUpgradeSetKey
from .ledger_upgrade_type import LedgerUpgradeType
from .uint32 import Uint32
@@ -25,6 +29,13 @@ class LedgerUpgrade:
uint32 newBaseReserve; // update baseReserve
case LEDGER_UPGRADE_FLAGS:
uint32 newFlags; // update flags
+ case LEDGER_UPGRADE_CONFIG:
+ // Update arbitrary `ConfigSetting` entries identified by the key.
+ ConfigUpgradeSetKey newConfig;
+ case LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE:
+ // Update ConfigSettingContractExecutionLanesV0.ledgerMaxTxCount without
+ // using `LEDGER_UPGRADE_CONFIG`.
+ uint32 newMaxSorobanTxSetSize;
};
"""
@@ -36,6 +47,8 @@ def __init__(
new_max_tx_set_size: Uint32 = None,
new_base_reserve: Uint32 = None,
new_flags: Uint32 = None,
+ new_config: ConfigUpgradeSetKey = None,
+ new_max_soroban_tx_set_size: Uint32 = None,
) -> None:
self.type = type
self.new_ledger_version = new_ledger_version
@@ -43,6 +56,8 @@ def __init__(
self.new_max_tx_set_size = new_max_tx_set_size
self.new_base_reserve = new_base_reserve
self.new_flags = new_flags
+ self.new_config = new_config
+ self.new_max_soroban_tx_set_size = new_max_soroban_tx_set_size
def pack(self, packer: Packer) -> None:
self.type.pack(packer)
@@ -71,9 +86,19 @@ def pack(self, packer: Packer) -> None:
raise ValueError("new_flags should not be None.")
self.new_flags.pack(packer)
return
+ if self.type == LedgerUpgradeType.LEDGER_UPGRADE_CONFIG:
+ if self.new_config is None:
+ raise ValueError("new_config should not be None.")
+ self.new_config.pack(packer)
+ return
+ if self.type == LedgerUpgradeType.LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE:
+ if self.new_max_soroban_tx_set_size is None:
+ raise ValueError("new_max_soroban_tx_set_size should not be None.")
+ self.new_max_soroban_tx_set_size.pack(packer)
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerUpgrade":
+ def unpack(cls, unpacker: Unpacker) -> LedgerUpgrade:
type = LedgerUpgradeType.unpack(unpacker)
if type == LedgerUpgradeType.LEDGER_UPGRADE_VERSION:
new_ledger_version = Uint32.unpack(unpacker)
@@ -90,6 +115,14 @@ def unpack(cls, unpacker: Unpacker) -> "LedgerUpgrade":
if type == LedgerUpgradeType.LEDGER_UPGRADE_FLAGS:
new_flags = Uint32.unpack(unpacker)
return cls(type=type, new_flags=new_flags)
+ if type == LedgerUpgradeType.LEDGER_UPGRADE_CONFIG:
+ new_config = ConfigUpgradeSetKey.unpack(unpacker)
+ return cls(type=type, new_config=new_config)
+ if type == LedgerUpgradeType.LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE:
+ new_max_soroban_tx_set_size = Uint32.unpack(unpacker)
+ return cls(
+ type=type, new_max_soroban_tx_set_size=new_max_soroban_tx_set_size
+ )
return cls(type=type)
def to_xdr_bytes(self) -> bytes:
@@ -98,7 +131,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerUpgrade":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerUpgrade:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -107,10 +140,24 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerUpgrade":
+ def from_xdr(cls, xdr: str) -> LedgerUpgrade:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.new_ledger_version,
+ self.new_base_fee,
+ self.new_max_tx_set_size,
+ self.new_base_reserve,
+ self.new_flags,
+ self.new_config,
+ self.new_max_soroban_tx_set_size,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -121,6 +168,8 @@ def __eq__(self, other: object):
and self.new_max_tx_set_size == other.new_max_tx_set_size
and self.new_base_reserve == other.new_base_reserve
and self.new_flags == other.new_flags
+ and self.new_config == other.new_config
+ and self.new_max_soroban_tx_set_size == other.new_max_soroban_tx_set_size
)
def __str__(self):
@@ -141,4 +190,10 @@ def __str__(self):
out.append(
f"new_flags={self.new_flags}"
) if self.new_flags is not None else None
+ out.append(
+ f"new_config={self.new_config}"
+ ) if self.new_config is not None else None
+ out.append(
+ f"new_max_soroban_tx_set_size={self.new_max_soroban_tx_set_size}"
+ ) if self.new_max_soroban_tx_set_size is not None else None
return f""
diff --git a/stellar_sdk/xdr/ledger_upgrade_type.py b/stellar_sdk/xdr/ledger_upgrade_type.py
index 85ab3c4ff..5441d7a8b 100644
--- a/stellar_sdk/xdr/ledger_upgrade_type.py
+++ b/stellar_sdk/xdr/ledger_upgrade_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["LedgerUpgradeType"]
@@ -17,7 +20,9 @@ class LedgerUpgradeType(IntEnum):
LEDGER_UPGRADE_BASE_FEE = 2,
LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3,
LEDGER_UPGRADE_BASE_RESERVE = 4,
- LEDGER_UPGRADE_FLAGS = 5
+ LEDGER_UPGRADE_FLAGS = 5,
+ LEDGER_UPGRADE_CONFIG = 6,
+ LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7
};
"""
@@ -26,12 +31,14 @@ class LedgerUpgradeType(IntEnum):
LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3
LEDGER_UPGRADE_BASE_RESERVE = 4
LEDGER_UPGRADE_FLAGS = 5
+ LEDGER_UPGRADE_CONFIG = 6
+ LEDGER_UPGRADE_MAX_SOROBAN_TX_SET_SIZE = 7
def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LedgerUpgradeType":
+ def unpack(cls, unpacker: Unpacker) -> LedgerUpgradeType:
value = unpacker.unpack_int()
return cls(value)
@@ -41,7 +48,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LedgerUpgradeType":
+ def from_xdr_bytes(cls, xdr: bytes) -> LedgerUpgradeType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -50,6 +57,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LedgerUpgradeType":
+ def from_xdr(cls, xdr: str) -> LedgerUpgradeType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/liabilities.py b/stellar_sdk/xdr/liabilities.py
index 7547a8f9a..bcf862b4c 100644
--- a/stellar_sdk/xdr/liabilities.py
+++ b/stellar_sdk/xdr/liabilities.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .int64 import Int64
@@ -32,7 +35,7 @@ def pack(self, packer: Packer) -> None:
self.selling.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Liabilities":
+ def unpack(cls, unpacker: Unpacker) -> Liabilities:
buying = Int64.unpack(unpacker)
selling = Int64.unpack(unpacker)
return cls(
@@ -46,7 +49,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Liabilities":
+ def from_xdr_bytes(cls, xdr: bytes) -> Liabilities:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -55,10 +58,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Liabilities":
+ def from_xdr(cls, xdr: str) -> Liabilities:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.buying,
+ self.selling,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_constant_product_parameters.py b/stellar_sdk/xdr/liquidity_pool_constant_product_parameters.py
index 9eca04243..38e37302e 100644
--- a/stellar_sdk/xdr/liquidity_pool_constant_product_parameters.py
+++ b/stellar_sdk/xdr/liquidity_pool_constant_product_parameters.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -17,7 +20,7 @@ class LiquidityPoolConstantProductParameters:
{
Asset assetA; // assetA < assetB
Asset assetB;
- int32 fee; // Fee is in basis points, so the actual rate is (fee/100)%
+ int32 fee; // Fee is in basis points, so the actual rate is (fee/100)%
};
"""
@@ -37,7 +40,7 @@ def pack(self, packer: Packer) -> None:
self.fee.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolConstantProductParameters":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolConstantProductParameters:
asset_a = Asset.unpack(unpacker)
asset_b = Asset.unpack(unpacker)
fee = Int32.unpack(unpacker)
@@ -53,7 +56,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolConstantProductParameters":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolConstantProductParameters:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -62,10 +65,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolConstantProductParameters":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolConstantProductParameters:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.asset_a,
+ self.asset_b,
+ self.fee,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_deposit_op.py b/stellar_sdk/xdr/liquidity_pool_deposit_op.py
index 324392f4e..820313ad6 100644
--- a/stellar_sdk/xdr/liquidity_pool_deposit_op.py
+++ b/stellar_sdk/xdr/liquidity_pool_deposit_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .int64 import Int64
@@ -17,10 +20,10 @@ class LiquidityPoolDepositOp:
struct LiquidityPoolDepositOp
{
PoolID liquidityPoolID;
- int64 maxAmountA; // maximum amount of first asset to deposit
- int64 maxAmountB; // maximum amount of second asset to deposit
- Price minPrice; // minimum depositA/depositB
- Price maxPrice; // maximum depositA/depositB
+ int64 maxAmountA; // maximum amount of first asset to deposit
+ int64 maxAmountB; // maximum amount of second asset to deposit
+ Price minPrice; // minimum depositA/depositB
+ Price maxPrice; // maximum depositA/depositB
};
"""
@@ -46,7 +49,7 @@ def pack(self, packer: Packer) -> None:
self.max_price.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolDepositOp":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolDepositOp:
liquidity_pool_id = PoolID.unpack(unpacker)
max_amount_a = Int64.unpack(unpacker)
max_amount_b = Int64.unpack(unpacker)
@@ -66,7 +69,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolDepositOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolDepositOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -75,10 +78,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolDepositOp":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolDepositOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.liquidity_pool_id,
+ self.max_amount_a,
+ self.max_amount_b,
+ self.min_price,
+ self.max_price,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_deposit_result.py b/stellar_sdk/xdr/liquidity_pool_deposit_result.py
index 50bf1ec7f..10c858eb5 100644
--- a/stellar_sdk/xdr/liquidity_pool_deposit_result.py
+++ b/stellar_sdk/xdr/liquidity_pool_deposit_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .liquidity_pool_deposit_result_code import LiquidityPoolDepositResultCode
@@ -12,12 +15,17 @@ class LiquidityPoolDepositResult:
"""
XDR Source Code::
- union LiquidityPoolDepositResult switch (
- LiquidityPoolDepositResultCode code)
+ union LiquidityPoolDepositResult switch (LiquidityPoolDepositResultCode code)
{
case LIQUIDITY_POOL_DEPOSIT_SUCCESS:
void;
- default:
+ case LIQUIDITY_POOL_DEPOSIT_MALFORMED:
+ case LIQUIDITY_POOL_DEPOSIT_NO_TRUST:
+ case LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED:
+ case LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED:
+ case LIQUIDITY_POOL_DEPOSIT_LINE_FULL:
+ case LIQUIDITY_POOL_DEPOSIT_BAD_PRICE:
+ case LIQUIDITY_POOL_DEPOSIT_POOL_FULL:
void;
};
"""
@@ -32,12 +40,46 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_SUCCESS:
return
+ if self.code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_MALFORMED:
+ return
+ if self.code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_NO_TRUST:
+ return
+ if (
+ self.code
+ == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED
+ ):
+ return
+ if (
+ self.code
+ == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED
+ ):
+ return
+ if self.code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_LINE_FULL:
+ return
+ if self.code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_BAD_PRICE:
+ return
+ if self.code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_POOL_FULL:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolDepositResult":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolDepositResult:
code = LiquidityPoolDepositResultCode.unpack(unpacker)
if code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_SUCCESS:
return cls(code=code)
+ if code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_MALFORMED:
+ return cls(code=code)
+ if code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_NO_TRUST:
+ return cls(code=code)
+ if code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_NOT_AUTHORIZED:
+ return cls(code=code)
+ if code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_UNDERFUNDED:
+ return cls(code=code)
+ if code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_LINE_FULL:
+ return cls(code=code)
+ if code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_BAD_PRICE:
+ return cls(code=code)
+ if code == LiquidityPoolDepositResultCode.LIQUIDITY_POOL_DEPOSIT_POOL_FULL:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -46,7 +88,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolDepositResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolDepositResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -55,10 +97,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolDepositResult":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolDepositResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_deposit_result_code.py b/stellar_sdk/xdr/liquidity_pool_deposit_result_code.py
index 117a65549..492901540 100644
--- a/stellar_sdk/xdr/liquidity_pool_deposit_result_code.py
+++ b/stellar_sdk/xdr/liquidity_pool_deposit_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["LiquidityPoolDepositResultCode"]
@@ -44,7 +47,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolDepositResultCode":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolDepositResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolDepositResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolDepositResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,6 +66,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolDepositResultCode":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolDepositResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/liquidity_pool_entry.py b/stellar_sdk/xdr/liquidity_pool_entry.py
index 1e369c455..fbf0e7ca6 100644
--- a/stellar_sdk/xdr/liquidity_pool_entry.py
+++ b/stellar_sdk/xdr/liquidity_pool_entry.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .liquidity_pool_entry_body import LiquidityPoolEntryBody
@@ -27,7 +30,8 @@ class LiquidityPoolEntry:
int64 reserveA; // amount of A in the pool
int64 reserveB; // amount of B in the pool
int64 totalPoolShares; // total number of pool shares issued
- int64 poolSharesTrustLineCount; // number of trust lines for the associated pool shares
+ int64 poolSharesTrustLineCount; // number of trust lines for the
+ // associated pool shares
} constantProduct;
}
body;
@@ -47,7 +51,7 @@ def pack(self, packer: Packer) -> None:
self.body.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolEntry":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolEntry:
liquidity_pool_id = PoolID.unpack(unpacker)
body = LiquidityPoolEntryBody.unpack(unpacker)
return cls(
@@ -61,7 +65,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolEntry":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolEntry:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -70,10 +74,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolEntry":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolEntry:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.liquidity_pool_id,
+ self.body,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_entry_body.py b/stellar_sdk/xdr/liquidity_pool_entry_body.py
index 9945a2e34..312d1ce67 100644
--- a/stellar_sdk/xdr/liquidity_pool_entry_body.py
+++ b/stellar_sdk/xdr/liquidity_pool_entry_body.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .liquidity_pool_entry_constant_product import LiquidityPoolEntryConstantProduct
@@ -23,7 +26,8 @@ class LiquidityPoolEntryBody:
int64 reserveA; // amount of A in the pool
int64 reserveB; // amount of B in the pool
int64 totalPoolShares; // total number of pool shares issued
- int64 poolSharesTrustLineCount; // number of trust lines for the associated pool shares
+ int64 poolSharesTrustLineCount; // number of trust lines for the
+ // associated pool shares
} constantProduct;
}
"""
@@ -45,7 +49,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolEntryBody":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolEntryBody:
type = LiquidityPoolType.unpack(unpacker)
if type == LiquidityPoolType.LIQUIDITY_POOL_CONSTANT_PRODUCT:
constant_product = LiquidityPoolEntryConstantProduct.unpack(unpacker)
@@ -58,7 +62,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolEntryBody":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolEntryBody:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -67,10 +71,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolEntryBody":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolEntryBody:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.constant_product,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_entry_constant_product.py b/stellar_sdk/xdr/liquidity_pool_entry_constant_product.py
index 2ac20548a..0e57f1864 100644
--- a/stellar_sdk/xdr/liquidity_pool_entry_constant_product.py
+++ b/stellar_sdk/xdr/liquidity_pool_entry_constant_product.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .int64 import Int64
@@ -22,7 +25,8 @@ class LiquidityPoolEntryConstantProduct:
int64 reserveA; // amount of A in the pool
int64 reserveB; // amount of B in the pool
int64 totalPoolShares; // total number of pool shares issued
- int64 poolSharesTrustLineCount; // number of trust lines for the associated pool shares
+ int64 poolSharesTrustLineCount; // number of trust lines for the
+ // associated pool shares
}
"""
@@ -48,7 +52,7 @@ def pack(self, packer: Packer) -> None:
self.pool_shares_trust_line_count.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolEntryConstantProduct":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolEntryConstantProduct:
params = LiquidityPoolConstantProductParameters.unpack(unpacker)
reserve_a = Int64.unpack(unpacker)
reserve_b = Int64.unpack(unpacker)
@@ -68,7 +72,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolEntryConstantProduct":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolEntryConstantProduct:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -77,10 +81,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolEntryConstantProduct":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolEntryConstantProduct:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.params,
+ self.reserve_a,
+ self.reserve_b,
+ self.total_pool_shares,
+ self.pool_shares_trust_line_count,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_parameters.py b/stellar_sdk/xdr/liquidity_pool_parameters.py
index e0190473b..70f62c47d 100644
--- a/stellar_sdk/xdr/liquidity_pool_parameters.py
+++ b/stellar_sdk/xdr/liquidity_pool_parameters.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .liquidity_pool_constant_product_parameters import (
@@ -39,7 +42,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolParameters":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolParameters:
type = LiquidityPoolType.unpack(unpacker)
if type == LiquidityPoolType.LIQUIDITY_POOL_CONSTANT_PRODUCT:
constant_product = LiquidityPoolConstantProductParameters.unpack(unpacker)
@@ -52,7 +55,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolParameters":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolParameters:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -61,10 +64,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolParameters":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolParameters:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.constant_product,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_type.py b/stellar_sdk/xdr/liquidity_pool_type.py
index e88794459..86181ef66 100644
--- a/stellar_sdk/xdr/liquidity_pool_type.py
+++ b/stellar_sdk/xdr/liquidity_pool_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["LiquidityPoolType"]
@@ -23,7 +26,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolType":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolType:
value = unpacker.unpack_int()
return cls(value)
@@ -33,7 +36,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolType":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -42,6 +45,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolType":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/liquidity_pool_withdraw_op.py b/stellar_sdk/xdr/liquidity_pool_withdraw_op.py
index d20ae5a49..daf024518 100644
--- a/stellar_sdk/xdr/liquidity_pool_withdraw_op.py
+++ b/stellar_sdk/xdr/liquidity_pool_withdraw_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .int64 import Int64
@@ -16,9 +19,9 @@ class LiquidityPoolWithdrawOp:
struct LiquidityPoolWithdrawOp
{
PoolID liquidityPoolID;
- int64 amount; // amount of pool shares to withdraw
- int64 minAmountA; // minimum amount of first asset to withdraw
- int64 minAmountB; // minimum amount of second asset to withdraw
+ int64 amount; // amount of pool shares to withdraw
+ int64 minAmountA; // minimum amount of first asset to withdraw
+ int64 minAmountB; // minimum amount of second asset to withdraw
};
"""
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
self.min_amount_b.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolWithdrawOp":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolWithdrawOp:
liquidity_pool_id = PoolID.unpack(unpacker)
amount = Int64.unpack(unpacker)
min_amount_a = Int64.unpack(unpacker)
@@ -59,7 +62,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolWithdrawOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolWithdrawOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -68,10 +71,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolWithdrawOp":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolWithdrawOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.liquidity_pool_id,
+ self.amount,
+ self.min_amount_a,
+ self.min_amount_b,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_withdraw_result.py b/stellar_sdk/xdr/liquidity_pool_withdraw_result.py
index 89d7bd923..51da190fe 100644
--- a/stellar_sdk/xdr/liquidity_pool_withdraw_result.py
+++ b/stellar_sdk/xdr/liquidity_pool_withdraw_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .liquidity_pool_withdraw_result_code import LiquidityPoolWithdrawResultCode
@@ -12,12 +15,15 @@ class LiquidityPoolWithdrawResult:
"""
XDR Source Code::
- union LiquidityPoolWithdrawResult switch (
- LiquidityPoolWithdrawResultCode code)
+ union LiquidityPoolWithdrawResult switch (LiquidityPoolWithdrawResultCode code)
{
case LIQUIDITY_POOL_WITHDRAW_SUCCESS:
void;
- default:
+ case LIQUIDITY_POOL_WITHDRAW_MALFORMED:
+ case LIQUIDITY_POOL_WITHDRAW_NO_TRUST:
+ case LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED:
+ case LIQUIDITY_POOL_WITHDRAW_LINE_FULL:
+ case LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM:
void;
};
"""
@@ -32,12 +38,50 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_SUCCESS:
return
+ if (
+ self.code
+ == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_MALFORMED
+ ):
+ return
+ if (
+ self.code
+ == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_NO_TRUST
+ ):
+ return
+ if (
+ self.code
+ == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED
+ ):
+ return
+ if (
+ self.code
+ == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_LINE_FULL
+ ):
+ return
+ if (
+ self.code
+ == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM
+ ):
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolWithdrawResult":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolWithdrawResult:
code = LiquidityPoolWithdrawResultCode.unpack(unpacker)
if code == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_SUCCESS:
return cls(code=code)
+ if code == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_MALFORMED:
+ return cls(code=code)
+ if code == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_NO_TRUST:
+ return cls(code=code)
+ if code == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED:
+ return cls(code=code)
+ if code == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_LINE_FULL:
+ return cls(code=code)
+ if (
+ code
+ == LiquidityPoolWithdrawResultCode.LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM
+ ):
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -46,7 +90,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolWithdrawResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolWithdrawResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -55,10 +99,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolWithdrawResult":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolWithdrawResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/liquidity_pool_withdraw_result_code.py b/stellar_sdk/xdr/liquidity_pool_withdraw_result_code.py
index f72991b99..4c5a74b5e 100644
--- a/stellar_sdk/xdr/liquidity_pool_withdraw_result_code.py
+++ b/stellar_sdk/xdr/liquidity_pool_withdraw_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["LiquidityPoolWithdrawResultCode"]
@@ -17,14 +20,14 @@ class LiquidityPoolWithdrawResultCode(IntEnum):
LIQUIDITY_POOL_WITHDRAW_SUCCESS = 0,
// codes considered as "failure" for the operation
- LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input
- LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the
- // assets
- LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the
- // pool share
- LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one
- // of the assets
- LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough
+ LIQUIDITY_POOL_WITHDRAW_MALFORMED = -1, // bad input
+ LIQUIDITY_POOL_WITHDRAW_NO_TRUST = -2, // no trust line for one of the
+ // assets
+ LIQUIDITY_POOL_WITHDRAW_UNDERFUNDED = -3, // not enough balance of the
+ // pool share
+ LIQUIDITY_POOL_WITHDRAW_LINE_FULL = -4, // would go above limit for one
+ // of the assets
+ LIQUIDITY_POOL_WITHDRAW_UNDER_MINIMUM = -5 // didn't withdraw enough
};
"""
@@ -39,7 +42,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "LiquidityPoolWithdrawResultCode":
+ def unpack(cls, unpacker: Unpacker) -> LiquidityPoolWithdrawResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -49,7 +52,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "LiquidityPoolWithdrawResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> LiquidityPoolWithdrawResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -58,6 +61,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "LiquidityPoolWithdrawResultCode":
+ def from_xdr(cls, xdr: str) -> LiquidityPoolWithdrawResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/manage_buy_offer_op.py b/stellar_sdk/xdr/manage_buy_offer_op.py
index 33bfd223d..87a328dc0 100644
--- a/stellar_sdk/xdr/manage_buy_offer_op.py
+++ b/stellar_sdk/xdr/manage_buy_offer_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -49,7 +52,7 @@ def pack(self, packer: Packer) -> None:
self.offer_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageBuyOfferOp":
+ def unpack(cls, unpacker: Unpacker) -> ManageBuyOfferOp:
selling = Asset.unpack(unpacker)
buying = Asset.unpack(unpacker)
buy_amount = Int64.unpack(unpacker)
@@ -69,7 +72,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageBuyOfferOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageBuyOfferOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -78,10 +81,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageBuyOfferOp":
+ def from_xdr(cls, xdr: str) -> ManageBuyOfferOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.selling,
+ self.buying,
+ self.buy_amount,
+ self.price,
+ self.offer_id,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/manage_buy_offer_result.py b/stellar_sdk/xdr/manage_buy_offer_result.py
index 6ecb39cca..856c997a8 100644
--- a/stellar_sdk/xdr/manage_buy_offer_result.py
+++ b/stellar_sdk/xdr/manage_buy_offer_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .manage_buy_offer_result_code import ManageBuyOfferResultCode
@@ -17,7 +20,18 @@ class ManageBuyOfferResult:
{
case MANAGE_BUY_OFFER_SUCCESS:
ManageOfferSuccessResult success;
- default:
+ case MANAGE_BUY_OFFER_MALFORMED:
+ case MANAGE_BUY_OFFER_SELL_NO_TRUST:
+ case MANAGE_BUY_OFFER_BUY_NO_TRUST:
+ case MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED:
+ case MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED:
+ case MANAGE_BUY_OFFER_LINE_FULL:
+ case MANAGE_BUY_OFFER_UNDERFUNDED:
+ case MANAGE_BUY_OFFER_CROSS_SELF:
+ case MANAGE_BUY_OFFER_SELL_NO_ISSUER:
+ case MANAGE_BUY_OFFER_BUY_NO_ISSUER:
+ case MANAGE_BUY_OFFER_NOT_FOUND:
+ case MANAGE_BUY_OFFER_LOW_RESERVE:
void;
};
"""
@@ -37,13 +51,61 @@ def pack(self, packer: Packer) -> None:
raise ValueError("success should not be None.")
self.success.pack(packer)
return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_MALFORMED:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_SELL_NO_TRUST:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_BUY_NO_TRUST:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_LINE_FULL:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_UNDERFUNDED:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_CROSS_SELF:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_SELL_NO_ISSUER:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_BUY_NO_ISSUER:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_NOT_FOUND:
+ return
+ if self.code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_LOW_RESERVE:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageBuyOfferResult":
+ def unpack(cls, unpacker: Unpacker) -> ManageBuyOfferResult:
code = ManageBuyOfferResultCode.unpack(unpacker)
if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_SUCCESS:
success = ManageOfferSuccessResult.unpack(unpacker)
return cls(code=code, success=success)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_MALFORMED:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_SELL_NO_TRUST:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_BUY_NO_TRUST:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_LINE_FULL:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_UNDERFUNDED:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_CROSS_SELF:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_SELL_NO_ISSUER:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_BUY_NO_ISSUER:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_NOT_FOUND:
+ return cls(code=code)
+ if code == ManageBuyOfferResultCode.MANAGE_BUY_OFFER_LOW_RESERVE:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -52,7 +114,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageBuyOfferResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageBuyOfferResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -61,10 +123,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageBuyOfferResult":
+ def from_xdr(cls, xdr: str) -> ManageBuyOfferResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.success,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/manage_buy_offer_result_code.py b/stellar_sdk/xdr/manage_buy_offer_result_code.py
index 7dc2998d5..0608e1fa1 100644
--- a/stellar_sdk/xdr/manage_buy_offer_result_code.py
+++ b/stellar_sdk/xdr/manage_buy_offer_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ManageBuyOfferResultCode"]
@@ -54,7 +57,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageBuyOfferResultCode":
+ def unpack(cls, unpacker: Unpacker) -> ManageBuyOfferResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -64,7 +67,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageBuyOfferResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageBuyOfferResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -73,6 +76,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageBuyOfferResultCode":
+ def from_xdr(cls, xdr: str) -> ManageBuyOfferResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/manage_data_op.py b/stellar_sdk/xdr/manage_data_op.py
index 856ea32ad..092861b7a 100644
--- a/stellar_sdk/xdr/manage_data_op.py
+++ b/stellar_sdk/xdr/manage_data_op.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import Optional
+
from xdrlib3 import Packer, Unpacker
from .data_value import DataValue
@@ -38,7 +41,7 @@ def pack(self, packer: Packer) -> None:
self.data_value.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageDataOp":
+ def unpack(cls, unpacker: Unpacker) -> ManageDataOp:
data_name = String64.unpack(unpacker)
data_value = DataValue.unpack(unpacker) if unpacker.unpack_uint() else None
return cls(
@@ -52,7 +55,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageDataOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageDataOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -61,10 +64,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageDataOp":
+ def from_xdr(cls, xdr: str) -> ManageDataOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.data_name,
+ self.data_value,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/manage_data_result.py b/stellar_sdk/xdr/manage_data_result.py
index c60fc2f2e..9f8747b1d 100644
--- a/stellar_sdk/xdr/manage_data_result.py
+++ b/stellar_sdk/xdr/manage_data_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .manage_data_result_code import ManageDataResultCode
@@ -16,7 +19,10 @@ class ManageDataResult:
{
case MANAGE_DATA_SUCCESS:
void;
- default:
+ case MANAGE_DATA_NOT_SUPPORTED_YET:
+ case MANAGE_DATA_NAME_NOT_FOUND:
+ case MANAGE_DATA_LOW_RESERVE:
+ case MANAGE_DATA_INVALID_NAME:
void;
};
"""
@@ -31,12 +37,28 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == ManageDataResultCode.MANAGE_DATA_SUCCESS:
return
+ if self.code == ManageDataResultCode.MANAGE_DATA_NOT_SUPPORTED_YET:
+ return
+ if self.code == ManageDataResultCode.MANAGE_DATA_NAME_NOT_FOUND:
+ return
+ if self.code == ManageDataResultCode.MANAGE_DATA_LOW_RESERVE:
+ return
+ if self.code == ManageDataResultCode.MANAGE_DATA_INVALID_NAME:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageDataResult":
+ def unpack(cls, unpacker: Unpacker) -> ManageDataResult:
code = ManageDataResultCode.unpack(unpacker)
if code == ManageDataResultCode.MANAGE_DATA_SUCCESS:
return cls(code=code)
+ if code == ManageDataResultCode.MANAGE_DATA_NOT_SUPPORTED_YET:
+ return cls(code=code)
+ if code == ManageDataResultCode.MANAGE_DATA_NAME_NOT_FOUND:
+ return cls(code=code)
+ if code == ManageDataResultCode.MANAGE_DATA_LOW_RESERVE:
+ return cls(code=code)
+ if code == ManageDataResultCode.MANAGE_DATA_INVALID_NAME:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +67,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageDataResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageDataResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +76,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageDataResult":
+ def from_xdr(cls, xdr: str) -> ManageDataResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/manage_data_result_code.py b/stellar_sdk/xdr/manage_data_result_code.py
index a76fd6d5b..e02e0a08f 100644
--- a/stellar_sdk/xdr/manage_data_result_code.py
+++ b/stellar_sdk/xdr/manage_data_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ManageDataResultCode"]
@@ -35,7 +38,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageDataResultCode":
+ def unpack(cls, unpacker: Unpacker) -> ManageDataResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -45,7 +48,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageDataResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageDataResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,6 +57,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageDataResultCode":
+ def from_xdr(cls, xdr: str) -> ManageDataResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/manage_offer_effect.py b/stellar_sdk/xdr/manage_offer_effect.py
index 52010f69c..2c19e1239 100644
--- a/stellar_sdk/xdr/manage_offer_effect.py
+++ b/stellar_sdk/xdr/manage_offer_effect.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ManageOfferEffect"]
@@ -27,7 +30,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageOfferEffect":
+ def unpack(cls, unpacker: Unpacker) -> ManageOfferEffect:
value = unpacker.unpack_int()
return cls(value)
@@ -37,7 +40,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageOfferEffect":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageOfferEffect:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -46,6 +49,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageOfferEffect":
+ def from_xdr(cls, xdr: str) -> ManageOfferEffect:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/manage_offer_success_result.py b/stellar_sdk/xdr/manage_offer_success_result.py
index 191ce8a62..b337a1aa3 100644
--- a/stellar_sdk/xdr/manage_offer_success_result.py
+++ b/stellar_sdk/xdr/manage_offer_success_result.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .claim_atom import ClaimAtom
@@ -24,7 +27,7 @@ class ManageOfferSuccessResult:
case MANAGE_OFFER_CREATED:
case MANAGE_OFFER_UPDATED:
OfferEntry offer;
- default:
+ case MANAGE_OFFER_DELETED:
void;
}
offer;
@@ -51,7 +54,7 @@ def pack(self, packer: Packer) -> None:
self.offer.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageOfferSuccessResult":
+ def unpack(cls, unpacker: Unpacker) -> ManageOfferSuccessResult:
length = unpacker.unpack_uint()
offers_claimed = []
for _ in range(length):
@@ -68,7 +71,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageOfferSuccessResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageOfferSuccessResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -77,10 +80,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageOfferSuccessResult":
+ def from_xdr(cls, xdr: str) -> ManageOfferSuccessResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.offers_claimed,
+ self.offer,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/manage_offer_success_result_offer.py b/stellar_sdk/xdr/manage_offer_success_result_offer.py
index e681f2e47..78f4a07b8 100644
--- a/stellar_sdk/xdr/manage_offer_success_result_offer.py
+++ b/stellar_sdk/xdr/manage_offer_success_result_offer.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .manage_offer_effect import ManageOfferEffect
@@ -18,7 +21,7 @@ class ManageOfferSuccessResultOffer:
case MANAGE_OFFER_CREATED:
case MANAGE_OFFER_UPDATED:
OfferEntry offer;
- default:
+ case MANAGE_OFFER_DELETED:
void;
}
"""
@@ -43,9 +46,11 @@ def pack(self, packer: Packer) -> None:
raise ValueError("offer should not be None.")
self.offer.pack(packer)
return
+ if self.effect == ManageOfferEffect.MANAGE_OFFER_DELETED:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageOfferSuccessResultOffer":
+ def unpack(cls, unpacker: Unpacker) -> ManageOfferSuccessResultOffer:
effect = ManageOfferEffect.unpack(unpacker)
if effect == ManageOfferEffect.MANAGE_OFFER_CREATED:
offer = OfferEntry.unpack(unpacker)
@@ -53,6 +58,8 @@ def unpack(cls, unpacker: Unpacker) -> "ManageOfferSuccessResultOffer":
if effect == ManageOfferEffect.MANAGE_OFFER_UPDATED:
offer = OfferEntry.unpack(unpacker)
return cls(effect=effect, offer=offer)
+ if effect == ManageOfferEffect.MANAGE_OFFER_DELETED:
+ return cls(effect=effect)
return cls(effect=effect)
def to_xdr_bytes(self) -> bytes:
@@ -61,7 +68,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageOfferSuccessResultOffer":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageOfferSuccessResultOffer:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -70,10 +77,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageOfferSuccessResultOffer":
+ def from_xdr(cls, xdr: str) -> ManageOfferSuccessResultOffer:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.effect,
+ self.offer,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/manage_sell_offer_op.py b/stellar_sdk/xdr/manage_sell_offer_op.py
index efb559a9d..6a8e2d550 100644
--- a/stellar_sdk/xdr/manage_sell_offer_op.py
+++ b/stellar_sdk/xdr/manage_sell_offer_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -48,7 +51,7 @@ def pack(self, packer: Packer) -> None:
self.offer_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageSellOfferOp":
+ def unpack(cls, unpacker: Unpacker) -> ManageSellOfferOp:
selling = Asset.unpack(unpacker)
buying = Asset.unpack(unpacker)
amount = Int64.unpack(unpacker)
@@ -68,7 +71,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageSellOfferOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageSellOfferOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -77,10 +80,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageSellOfferOp":
+ def from_xdr(cls, xdr: str) -> ManageSellOfferOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.selling,
+ self.buying,
+ self.amount,
+ self.price,
+ self.offer_id,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/manage_sell_offer_result.py b/stellar_sdk/xdr/manage_sell_offer_result.py
index 34c4add14..08ef715e5 100644
--- a/stellar_sdk/xdr/manage_sell_offer_result.py
+++ b/stellar_sdk/xdr/manage_sell_offer_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .manage_offer_success_result import ManageOfferSuccessResult
@@ -17,7 +20,18 @@ class ManageSellOfferResult:
{
case MANAGE_SELL_OFFER_SUCCESS:
ManageOfferSuccessResult success;
- default:
+ case MANAGE_SELL_OFFER_MALFORMED:
+ case MANAGE_SELL_OFFER_SELL_NO_TRUST:
+ case MANAGE_SELL_OFFER_BUY_NO_TRUST:
+ case MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED:
+ case MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED:
+ case MANAGE_SELL_OFFER_LINE_FULL:
+ case MANAGE_SELL_OFFER_UNDERFUNDED:
+ case MANAGE_SELL_OFFER_CROSS_SELF:
+ case MANAGE_SELL_OFFER_SELL_NO_ISSUER:
+ case MANAGE_SELL_OFFER_BUY_NO_ISSUER:
+ case MANAGE_SELL_OFFER_NOT_FOUND:
+ case MANAGE_SELL_OFFER_LOW_RESERVE:
void;
};
"""
@@ -37,13 +51,61 @@ def pack(self, packer: Packer) -> None:
raise ValueError("success should not be None.")
self.success.pack(packer)
return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_MALFORMED:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_SELL_NO_TRUST:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_BUY_NO_TRUST:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_LINE_FULL:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_UNDERFUNDED:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_CROSS_SELF:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_SELL_NO_ISSUER:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_BUY_NO_ISSUER:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_NOT_FOUND:
+ return
+ if self.code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_LOW_RESERVE:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageSellOfferResult":
+ def unpack(cls, unpacker: Unpacker) -> ManageSellOfferResult:
code = ManageSellOfferResultCode.unpack(unpacker)
if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_SUCCESS:
success = ManageOfferSuccessResult.unpack(unpacker)
return cls(code=code, success=success)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_MALFORMED:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_SELL_NO_TRUST:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_BUY_NO_TRUST:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_LINE_FULL:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_UNDERFUNDED:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_CROSS_SELF:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_SELL_NO_ISSUER:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_BUY_NO_ISSUER:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_NOT_FOUND:
+ return cls(code=code)
+ if code == ManageSellOfferResultCode.MANAGE_SELL_OFFER_LOW_RESERVE:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -52,7 +114,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageSellOfferResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageSellOfferResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -61,10 +123,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageSellOfferResult":
+ def from_xdr(cls, xdr: str) -> ManageSellOfferResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.success,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/manage_sell_offer_result_code.py b/stellar_sdk/xdr/manage_sell_offer_result_code.py
index 2bef1b465..95b6801e4 100644
--- a/stellar_sdk/xdr/manage_sell_offer_result_code.py
+++ b/stellar_sdk/xdr/manage_sell_offer_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ManageSellOfferResultCode"]
@@ -57,7 +60,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ManageSellOfferResultCode":
+ def unpack(cls, unpacker: Unpacker) -> ManageSellOfferResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -67,7 +70,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ManageSellOfferResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> ManageSellOfferResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -76,6 +79,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ManageSellOfferResultCode":
+ def from_xdr(cls, xdr: str) -> ManageSellOfferResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/memo.py b/stellar_sdk/xdr/memo.py
index 0b1e87453..0f332d427 100644
--- a/stellar_sdk/xdr/memo.py
+++ b/stellar_sdk/xdr/memo.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import String
@@ -70,7 +73,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Memo":
+ def unpack(cls, unpacker: Unpacker) -> Memo:
type = MemoType.unpack(unpacker)
if type == MemoType.MEMO_NONE:
return cls(type=type)
@@ -94,7 +97,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Memo":
+ def from_xdr_bytes(cls, xdr: bytes) -> Memo:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -103,10 +106,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Memo":
+ def from_xdr(cls, xdr: str) -> Memo:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.text,
+ self.id,
+ self.hash,
+ self.ret_hash,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/memo_type.py b/stellar_sdk/xdr/memo_type.py
index ce1a37912..c279e79b4 100644
--- a/stellar_sdk/xdr/memo_type.py
+++ b/stellar_sdk/xdr/memo_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["MemoType"]
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "MemoType":
+ def unpack(cls, unpacker: Unpacker) -> MemoType:
value = unpacker.unpack_int()
return cls(value)
@@ -41,7 +44,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "MemoType":
+ def from_xdr_bytes(cls, xdr: bytes) -> MemoType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -50,6 +53,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "MemoType":
+ def from_xdr(cls, xdr: str) -> MemoType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/message_type.py b/stellar_sdk/xdr/message_type.py
index ac0b933ec..20c603931 100644
--- a/stellar_sdk/xdr/message_type.py
+++ b/stellar_sdk/xdr/message_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["MessageType"]
@@ -22,6 +25,7 @@ class MessageType(IntEnum):
GET_TX_SET = 6, // gets a particular txset by hash
TX_SET = 7,
+ GENERALIZED_TX_SET = 17,
TRANSACTION = 8, // pass on a tx you have heard about
@@ -37,7 +41,11 @@ class MessageType(IntEnum):
SURVEY_REQUEST = 14,
SURVEY_RESPONSE = 15,
- SEND_MORE = 16
+ SEND_MORE = 16,
+ SEND_MORE_EXTENDED = 20,
+
+ FLOOD_ADVERT = 18,
+ FLOOD_DEMAND = 19
};
"""
@@ -48,6 +56,7 @@ class MessageType(IntEnum):
PEERS = 5
GET_TX_SET = 6
TX_SET = 7
+ GENERALIZED_TX_SET = 17
TRANSACTION = 8
GET_SCP_QUORUMSET = 9
SCP_QUORUMSET = 10
@@ -57,12 +66,15 @@ class MessageType(IntEnum):
SURVEY_REQUEST = 14
SURVEY_RESPONSE = 15
SEND_MORE = 16
+ SEND_MORE_EXTENDED = 20
+ FLOOD_ADVERT = 18
+ FLOOD_DEMAND = 19
def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "MessageType":
+ def unpack(cls, unpacker: Unpacker) -> MessageType:
value = unpacker.unpack_int()
return cls(value)
@@ -72,7 +84,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "MessageType":
+ def from_xdr_bytes(cls, xdr: bytes) -> MessageType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -81,6 +93,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "MessageType":
+ def from_xdr(cls, xdr: str) -> MessageType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/muxed_account.py b/stellar_sdk/xdr/muxed_account.py
index 42ad4a5e5..44a172e39 100644
--- a/stellar_sdk/xdr/muxed_account.py
+++ b/stellar_sdk/xdr/muxed_account.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .crypto_key_type import CryptoKeyType
@@ -51,7 +54,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "MuxedAccount":
+ def unpack(cls, unpacker: Unpacker) -> MuxedAccount:
type = CryptoKeyType.unpack(unpacker)
if type == CryptoKeyType.KEY_TYPE_ED25519:
ed25519 = Uint256.unpack(unpacker)
@@ -67,7 +70,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "MuxedAccount":
+ def from_xdr_bytes(cls, xdr: bytes) -> MuxedAccount:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -76,10 +79,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "MuxedAccount":
+ def from_xdr(cls, xdr: str) -> MuxedAccount:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.ed25519,
+ self.med25519,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/muxed_account_med25519.py b/stellar_sdk/xdr/muxed_account_med25519.py
index 702432422..f3cb085bf 100644
--- a/stellar_sdk/xdr/muxed_account_med25519.py
+++ b/stellar_sdk/xdr/muxed_account_med25519.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .uint64 import Uint64
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.ed25519.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "MuxedAccountMed25519":
+ def unpack(cls, unpacker: Unpacker) -> MuxedAccountMed25519:
id = Uint64.unpack(unpacker)
ed25519 = Uint256.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "MuxedAccountMed25519":
+ def from_xdr_bytes(cls, xdr: bytes) -> MuxedAccountMed25519:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "MuxedAccountMed25519":
+ def from_xdr(cls, xdr: str) -> MuxedAccountMed25519:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.id,
+ self.ed25519,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/node_id.py b/stellar_sdk/xdr/node_id.py
index dfb23625f..65c60eb11 100644
--- a/stellar_sdk/xdr/node_id.py
+++ b/stellar_sdk/xdr/node_id.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .public_key import PublicKey
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
self.node_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "NodeID":
+ def unpack(cls, unpacker: Unpacker) -> NodeID:
node_id = PublicKey.unpack(unpacker)
return cls(node_id)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "NodeID":
+ def from_xdr_bytes(cls, xdr: bytes) -> NodeID:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "NodeID":
+ def from_xdr(cls, xdr: str) -> NodeID:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.node_id)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/offer_entry.py b/stellar_sdk/xdr/offer_entry.py
index cf96ace1c..96808d15a 100644
--- a/stellar_sdk/xdr/offer_entry.py
+++ b/stellar_sdk/xdr/offer_entry.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -74,7 +77,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "OfferEntry":
+ def unpack(cls, unpacker: Unpacker) -> OfferEntry:
seller_id = AccountID.unpack(unpacker)
offer_id = Int64.unpack(unpacker)
selling = Asset.unpack(unpacker)
@@ -100,7 +103,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "OfferEntry":
+ def from_xdr_bytes(cls, xdr: bytes) -> OfferEntry:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -109,10 +112,24 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "OfferEntry":
+ def from_xdr(cls, xdr: str) -> OfferEntry:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.seller_id,
+ self.offer_id,
+ self.selling,
+ self.buying,
+ self.amount,
+ self.price,
+ self.flags,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/offer_entry_ext.py b/stellar_sdk/xdr/offer_entry_ext.py
index 622fba806..985d02d9f 100644
--- a/stellar_sdk/xdr/offer_entry_ext.py
+++ b/stellar_sdk/xdr/offer_entry_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -31,7 +34,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "OfferEntryExt":
+ def unpack(cls, unpacker: Unpacker) -> OfferEntryExt:
v = Integer.unpack(unpacker)
if v == 0:
return cls(v=v)
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "OfferEntryExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> OfferEntryExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "OfferEntryExt":
+ def from_xdr(cls, xdr: str) -> OfferEntryExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.v,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/offer_entry_flags.py b/stellar_sdk/xdr/offer_entry_flags.py
index 226483ae3..1fcc100da 100644
--- a/stellar_sdk/xdr/offer_entry_flags.py
+++ b/stellar_sdk/xdr/offer_entry_flags.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["OfferEntryFlags"]
@@ -13,7 +16,8 @@ class OfferEntryFlags(IntEnum):
enum OfferEntryFlags
{
- // an offer with this flag will not act on and take a reverse offer of equal price
+ // an offer with this flag will not act on and take a reverse offer of equal
+ // price
PASSIVE_FLAG = 1
};
"""
@@ -24,7 +28,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "OfferEntryFlags":
+ def unpack(cls, unpacker: Unpacker) -> OfferEntryFlags:
value = unpacker.unpack_int()
return cls(value)
@@ -34,7 +38,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "OfferEntryFlags":
+ def from_xdr_bytes(cls, xdr: bytes) -> OfferEntryFlags:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -43,6 +47,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "OfferEntryFlags":
+ def from_xdr(cls, xdr: str) -> OfferEntryFlags:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/operation.py b/stellar_sdk/xdr/operation.py
index f0bb8f54d..f6331ea77 100644
--- a/stellar_sdk/xdr/operation.py
+++ b/stellar_sdk/xdr/operation.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import Optional
+
from xdrlib3 import Packer, Unpacker
from .muxed_account import MuxedAccount
@@ -71,6 +74,12 @@ class Operation:
LiquidityPoolDepositOp liquidityPoolDepositOp;
case LIQUIDITY_POOL_WITHDRAW:
LiquidityPoolWithdrawOp liquidityPoolWithdrawOp;
+ case INVOKE_HOST_FUNCTION:
+ InvokeHostFunctionOp invokeHostFunctionOp;
+ case BUMP_FOOTPRINT_EXPIRATION:
+ BumpFootprintExpirationOp bumpFootprintExpirationOp;
+ case RESTORE_FOOTPRINT:
+ RestoreFootprintOp restoreFootprintOp;
}
body;
};
@@ -93,7 +102,7 @@ def pack(self, packer: Packer) -> None:
self.body.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Operation":
+ def unpack(cls, unpacker: Unpacker) -> Operation:
source_account = (
MuxedAccount.unpack(unpacker) if unpacker.unpack_uint() else None
)
@@ -109,7 +118,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Operation":
+ def from_xdr_bytes(cls, xdr: bytes) -> Operation:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -118,10 +127,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Operation":
+ def from_xdr(cls, xdr: str) -> Operation:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.source_account,
+ self.body,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/operation_body.py b/stellar_sdk/xdr/operation_body.py
index a564fb309..e590a0f72 100644
--- a/stellar_sdk/xdr/operation_body.py
+++ b/stellar_sdk/xdr/operation_body.py
@@ -1,10 +1,14 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .allow_trust_op import AllowTrustOp
from .begin_sponsoring_future_reserves_op import BeginSponsoringFutureReservesOp
+from .bump_footprint_expiration_op import BumpFootprintExpirationOp
from .bump_sequence_op import BumpSequenceOp
from .change_trust_op import ChangeTrustOp
from .claim_claimable_balance_op import ClaimClaimableBalanceOp
@@ -13,6 +17,7 @@
from .create_account_op import CreateAccountOp
from .create_claimable_balance_op import CreateClaimableBalanceOp
from .create_passive_sell_offer_op import CreatePassiveSellOfferOp
+from .invoke_host_function_op import InvokeHostFunctionOp
from .liquidity_pool_deposit_op import LiquidityPoolDepositOp
from .liquidity_pool_withdraw_op import LiquidityPoolWithdrawOp
from .manage_buy_offer_op import ManageBuyOfferOp
@@ -23,6 +28,7 @@
from .path_payment_strict_receive_op import PathPaymentStrictReceiveOp
from .path_payment_strict_send_op import PathPaymentStrictSendOp
from .payment_op import PaymentOp
+from .restore_footprint_op import RestoreFootprintOp
from .revoke_sponsorship_op import RevokeSponsorshipOp
from .set_options_op import SetOptionsOp
from .set_trust_line_flags_op import SetTrustLineFlagsOp
@@ -84,6 +90,12 @@ class OperationBody:
LiquidityPoolDepositOp liquidityPoolDepositOp;
case LIQUIDITY_POOL_WITHDRAW:
LiquidityPoolWithdrawOp liquidityPoolWithdrawOp;
+ case INVOKE_HOST_FUNCTION:
+ InvokeHostFunctionOp invokeHostFunctionOp;
+ case BUMP_FOOTPRINT_EXPIRATION:
+ BumpFootprintExpirationOp bumpFootprintExpirationOp;
+ case RESTORE_FOOTPRINT:
+ RestoreFootprintOp restoreFootprintOp;
}
"""
@@ -112,6 +124,9 @@ def __init__(
set_trust_line_flags_op: SetTrustLineFlagsOp = None,
liquidity_pool_deposit_op: LiquidityPoolDepositOp = None,
liquidity_pool_withdraw_op: LiquidityPoolWithdrawOp = None,
+ invoke_host_function_op: InvokeHostFunctionOp = None,
+ bump_footprint_expiration_op: BumpFootprintExpirationOp = None,
+ restore_footprint_op: RestoreFootprintOp = None,
) -> None:
self.type = type
self.create_account_op = create_account_op
@@ -136,6 +151,9 @@ def __init__(
self.set_trust_line_flags_op = set_trust_line_flags_op
self.liquidity_pool_deposit_op = liquidity_pool_deposit_op
self.liquidity_pool_withdraw_op = liquidity_pool_withdraw_op
+ self.invoke_host_function_op = invoke_host_function_op
+ self.bump_footprint_expiration_op = bump_footprint_expiration_op
+ self.restore_footprint_op = restore_footprint_op
def pack(self, packer: Packer) -> None:
self.type.pack(packer)
@@ -255,9 +273,24 @@ def pack(self, packer: Packer) -> None:
raise ValueError("liquidity_pool_withdraw_op should not be None.")
self.liquidity_pool_withdraw_op.pack(packer)
return
+ if self.type == OperationType.INVOKE_HOST_FUNCTION:
+ if self.invoke_host_function_op is None:
+ raise ValueError("invoke_host_function_op should not be None.")
+ self.invoke_host_function_op.pack(packer)
+ return
+ if self.type == OperationType.BUMP_FOOTPRINT_EXPIRATION:
+ if self.bump_footprint_expiration_op is None:
+ raise ValueError("bump_footprint_expiration_op should not be None.")
+ self.bump_footprint_expiration_op.pack(packer)
+ return
+ if self.type == OperationType.RESTORE_FOOTPRINT:
+ if self.restore_footprint_op is None:
+ raise ValueError("restore_footprint_op should not be None.")
+ self.restore_footprint_op.pack(packer)
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "OperationBody":
+ def unpack(cls, unpacker: Unpacker) -> OperationBody:
type = OperationType.unpack(unpacker)
if type == OperationType.CREATE_ACCOUNT:
create_account_op = CreateAccountOp.unpack(unpacker)
@@ -344,6 +377,17 @@ def unpack(cls, unpacker: Unpacker) -> "OperationBody":
if type == OperationType.LIQUIDITY_POOL_WITHDRAW:
liquidity_pool_withdraw_op = LiquidityPoolWithdrawOp.unpack(unpacker)
return cls(type=type, liquidity_pool_withdraw_op=liquidity_pool_withdraw_op)
+ if type == OperationType.INVOKE_HOST_FUNCTION:
+ invoke_host_function_op = InvokeHostFunctionOp.unpack(unpacker)
+ return cls(type=type, invoke_host_function_op=invoke_host_function_op)
+ if type == OperationType.BUMP_FOOTPRINT_EXPIRATION:
+ bump_footprint_expiration_op = BumpFootprintExpirationOp.unpack(unpacker)
+ return cls(
+ type=type, bump_footprint_expiration_op=bump_footprint_expiration_op
+ )
+ if type == OperationType.RESTORE_FOOTPRINT:
+ restore_footprint_op = RestoreFootprintOp.unpack(unpacker)
+ return cls(type=type, restore_footprint_op=restore_footprint_op)
return cls(type=type)
def to_xdr_bytes(self) -> bytes:
@@ -352,7 +396,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "OperationBody":
+ def from_xdr_bytes(cls, xdr: bytes) -> OperationBody:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -361,10 +405,42 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "OperationBody":
+ def from_xdr(cls, xdr: str) -> OperationBody:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.create_account_op,
+ self.payment_op,
+ self.path_payment_strict_receive_op,
+ self.manage_sell_offer_op,
+ self.create_passive_sell_offer_op,
+ self.set_options_op,
+ self.change_trust_op,
+ self.allow_trust_op,
+ self.destination,
+ self.manage_data_op,
+ self.bump_sequence_op,
+ self.manage_buy_offer_op,
+ self.path_payment_strict_send_op,
+ self.create_claimable_balance_op,
+ self.claim_claimable_balance_op,
+ self.begin_sponsoring_future_reserves_op,
+ self.revoke_sponsorship_op,
+ self.clawback_op,
+ self.clawback_claimable_balance_op,
+ self.set_trust_line_flags_op,
+ self.liquidity_pool_deposit_op,
+ self.liquidity_pool_withdraw_op,
+ self.invoke_host_function_op,
+ self.bump_footprint_expiration_op,
+ self.restore_footprint_op,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -395,6 +471,9 @@ def __eq__(self, other: object):
and self.set_trust_line_flags_op == other.set_trust_line_flags_op
and self.liquidity_pool_deposit_op == other.liquidity_pool_deposit_op
and self.liquidity_pool_withdraw_op == other.liquidity_pool_withdraw_op
+ and self.invoke_host_function_op == other.invoke_host_function_op
+ and self.bump_footprint_expiration_op == other.bump_footprint_expiration_op
+ and self.restore_footprint_op == other.restore_footprint_op
)
def __str__(self):
@@ -466,4 +545,13 @@ def __str__(self):
out.append(
f"liquidity_pool_withdraw_op={self.liquidity_pool_withdraw_op}"
) if self.liquidity_pool_withdraw_op is not None else None
+ out.append(
+ f"invoke_host_function_op={self.invoke_host_function_op}"
+ ) if self.invoke_host_function_op is not None else None
+ out.append(
+ f"bump_footprint_expiration_op={self.bump_footprint_expiration_op}"
+ ) if self.bump_footprint_expiration_op is not None else None
+ out.append(
+ f"restore_footprint_op={self.restore_footprint_op}"
+ ) if self.restore_footprint_op is not None else None
return f""
diff --git a/stellar_sdk/xdr/operation_meta.py b/stellar_sdk/xdr/operation_meta.py
index 9db96b9ce..eb2074517 100644
--- a/stellar_sdk/xdr/operation_meta.py
+++ b/stellar_sdk/xdr/operation_meta.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .ledger_entry_changes import LedgerEntryChanges
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
self.changes.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "OperationMeta":
+ def unpack(cls, unpacker: Unpacker) -> OperationMeta:
changes = LedgerEntryChanges.unpack(unpacker)
return cls(
changes=changes,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "OperationMeta":
+ def from_xdr_bytes(cls, xdr: bytes) -> OperationMeta:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "OperationMeta":
+ def from_xdr(cls, xdr: str) -> OperationMeta:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.changes,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/operation_result.py b/stellar_sdk/xdr/operation_result.py
index 894a4f591..b475d85c6 100644
--- a/stellar_sdk/xdr/operation_result.py
+++ b/stellar_sdk/xdr/operation_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .operation_result_code import OperationResultCode
@@ -66,9 +69,20 @@ class OperationResult:
LiquidityPoolDepositResult liquidityPoolDepositResult;
case LIQUIDITY_POOL_WITHDRAW:
LiquidityPoolWithdrawResult liquidityPoolWithdrawResult;
+ case INVOKE_HOST_FUNCTION:
+ InvokeHostFunctionResult invokeHostFunctionResult;
+ case BUMP_FOOTPRINT_EXPIRATION:
+ BumpFootprintExpirationResult bumpFootprintExpirationResult;
+ case RESTORE_FOOTPRINT:
+ RestoreFootprintResult restoreFootprintResult;
}
tr;
- default:
+ case opBAD_AUTH:
+ case opNO_ACCOUNT:
+ case opNOT_SUPPORTED:
+ case opTOO_MANY_SUBENTRIES:
+ case opEXCEEDED_WORK_LIMIT:
+ case opTOO_MANY_SPONSORING:
void;
};
"""
@@ -88,13 +102,37 @@ def pack(self, packer: Packer) -> None:
raise ValueError("tr should not be None.")
self.tr.pack(packer)
return
+ if self.code == OperationResultCode.opBAD_AUTH:
+ return
+ if self.code == OperationResultCode.opNO_ACCOUNT:
+ return
+ if self.code == OperationResultCode.opNOT_SUPPORTED:
+ return
+ if self.code == OperationResultCode.opTOO_MANY_SUBENTRIES:
+ return
+ if self.code == OperationResultCode.opEXCEEDED_WORK_LIMIT:
+ return
+ if self.code == OperationResultCode.opTOO_MANY_SPONSORING:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "OperationResult":
+ def unpack(cls, unpacker: Unpacker) -> OperationResult:
code = OperationResultCode.unpack(unpacker)
if code == OperationResultCode.opINNER:
tr = OperationResultTr.unpack(unpacker)
return cls(code=code, tr=tr)
+ if code == OperationResultCode.opBAD_AUTH:
+ return cls(code=code)
+ if code == OperationResultCode.opNO_ACCOUNT:
+ return cls(code=code)
+ if code == OperationResultCode.opNOT_SUPPORTED:
+ return cls(code=code)
+ if code == OperationResultCode.opTOO_MANY_SUBENTRIES:
+ return cls(code=code)
+ if code == OperationResultCode.opEXCEEDED_WORK_LIMIT:
+ return cls(code=code)
+ if code == OperationResultCode.opTOO_MANY_SPONSORING:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -103,7 +141,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "OperationResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> OperationResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -112,10 +150,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "OperationResult":
+ def from_xdr(cls, xdr: str) -> OperationResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.tr,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/operation_result_code.py b/stellar_sdk/xdr/operation_result_code.py
index 6dc5b544b..a21c79ff3 100644
--- a/stellar_sdk/xdr/operation_result_code.py
+++ b/stellar_sdk/xdr/operation_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["OperationResultCode"]
@@ -36,7 +39,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "OperationResultCode":
+ def unpack(cls, unpacker: Unpacker) -> OperationResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -46,7 +49,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "OperationResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> OperationResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -55,6 +58,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "OperationResultCode":
+ def from_xdr(cls, xdr: str) -> OperationResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/operation_result_tr.py b/stellar_sdk/xdr/operation_result_tr.py
index 190f00005..351d5c236 100644
--- a/stellar_sdk/xdr/operation_result_tr.py
+++ b/stellar_sdk/xdr/operation_result_tr.py
@@ -1,11 +1,15 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_merge_result import AccountMergeResult
from .allow_trust_result import AllowTrustResult
from .begin_sponsoring_future_reserves_result import BeginSponsoringFutureReservesResult
+from .bump_footprint_expiration_result import BumpFootprintExpirationResult
from .bump_sequence_result import BumpSequenceResult
from .change_trust_result import ChangeTrustResult
from .claim_claimable_balance_result import ClaimClaimableBalanceResult
@@ -15,6 +19,7 @@
from .create_claimable_balance_result import CreateClaimableBalanceResult
from .end_sponsoring_future_reserves_result import EndSponsoringFutureReservesResult
from .inflation_result import InflationResult
+from .invoke_host_function_result import InvokeHostFunctionResult
from .liquidity_pool_deposit_result import LiquidityPoolDepositResult
from .liquidity_pool_withdraw_result import LiquidityPoolWithdrawResult
from .manage_buy_offer_result import ManageBuyOfferResult
@@ -24,6 +29,7 @@
from .path_payment_strict_receive_result import PathPaymentStrictReceiveResult
from .path_payment_strict_send_result import PathPaymentStrictSendResult
from .payment_result import PaymentResult
+from .restore_footprint_result import RestoreFootprintResult
from .revoke_sponsorship_result import RevokeSponsorshipResult
from .set_options_result import SetOptionsResult
from .set_trust_line_flags_result import SetTrustLineFlagsResult
@@ -85,6 +91,12 @@ class OperationResultTr:
LiquidityPoolDepositResult liquidityPoolDepositResult;
case LIQUIDITY_POOL_WITHDRAW:
LiquidityPoolWithdrawResult liquidityPoolWithdrawResult;
+ case INVOKE_HOST_FUNCTION:
+ InvokeHostFunctionResult invokeHostFunctionResult;
+ case BUMP_FOOTPRINT_EXPIRATION:
+ BumpFootprintExpirationResult bumpFootprintExpirationResult;
+ case RESTORE_FOOTPRINT:
+ RestoreFootprintResult restoreFootprintResult;
}
"""
@@ -115,6 +127,9 @@ def __init__(
set_trust_line_flags_result: SetTrustLineFlagsResult = None,
liquidity_pool_deposit_result: LiquidityPoolDepositResult = None,
liquidity_pool_withdraw_result: LiquidityPoolWithdrawResult = None,
+ invoke_host_function_result: InvokeHostFunctionResult = None,
+ bump_footprint_expiration_result: BumpFootprintExpirationResult = None,
+ restore_footprint_result: RestoreFootprintResult = None,
) -> None:
self.type = type
self.create_account_result = create_account_result
@@ -145,6 +160,9 @@ def __init__(
self.set_trust_line_flags_result = set_trust_line_flags_result
self.liquidity_pool_deposit_result = liquidity_pool_deposit_result
self.liquidity_pool_withdraw_result = liquidity_pool_withdraw_result
+ self.invoke_host_function_result = invoke_host_function_result
+ self.bump_footprint_expiration_result = bump_footprint_expiration_result
+ self.restore_footprint_result = restore_footprint_result
def pack(self, packer: Packer) -> None:
self.type.pack(packer)
@@ -276,9 +294,24 @@ def pack(self, packer: Packer) -> None:
raise ValueError("liquidity_pool_withdraw_result should not be None.")
self.liquidity_pool_withdraw_result.pack(packer)
return
+ if self.type == OperationType.INVOKE_HOST_FUNCTION:
+ if self.invoke_host_function_result is None:
+ raise ValueError("invoke_host_function_result should not be None.")
+ self.invoke_host_function_result.pack(packer)
+ return
+ if self.type == OperationType.BUMP_FOOTPRINT_EXPIRATION:
+ if self.bump_footprint_expiration_result is None:
+ raise ValueError("bump_footprint_expiration_result should not be None.")
+ self.bump_footprint_expiration_result.pack(packer)
+ return
+ if self.type == OperationType.RESTORE_FOOTPRINT:
+ if self.restore_footprint_result is None:
+ raise ValueError("restore_footprint_result should not be None.")
+ self.restore_footprint_result.pack(packer)
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "OperationResultTr":
+ def unpack(cls, unpacker: Unpacker) -> OperationResultTr:
type = OperationType.unpack(unpacker)
if type == OperationType.CREATE_ACCOUNT:
create_account_result = CreateAccountResult.unpack(unpacker)
@@ -397,6 +430,22 @@ def unpack(cls, unpacker: Unpacker) -> "OperationResultTr":
return cls(
type=type, liquidity_pool_withdraw_result=liquidity_pool_withdraw_result
)
+ if type == OperationType.INVOKE_HOST_FUNCTION:
+ invoke_host_function_result = InvokeHostFunctionResult.unpack(unpacker)
+ return cls(
+ type=type, invoke_host_function_result=invoke_host_function_result
+ )
+ if type == OperationType.BUMP_FOOTPRINT_EXPIRATION:
+ bump_footprint_expiration_result = BumpFootprintExpirationResult.unpack(
+ unpacker
+ )
+ return cls(
+ type=type,
+ bump_footprint_expiration_result=bump_footprint_expiration_result,
+ )
+ if type == OperationType.RESTORE_FOOTPRINT:
+ restore_footprint_result = RestoreFootprintResult.unpack(unpacker)
+ return cls(type=type, restore_footprint_result=restore_footprint_result)
return cls(type=type)
def to_xdr_bytes(self) -> bytes:
@@ -405,7 +454,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "OperationResultTr":
+ def from_xdr_bytes(cls, xdr: bytes) -> OperationResultTr:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -414,10 +463,44 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "OperationResultTr":
+ def from_xdr(cls, xdr: str) -> OperationResultTr:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.create_account_result,
+ self.payment_result,
+ self.path_payment_strict_receive_result,
+ self.manage_sell_offer_result,
+ self.create_passive_sell_offer_result,
+ self.set_options_result,
+ self.change_trust_result,
+ self.allow_trust_result,
+ self.account_merge_result,
+ self.inflation_result,
+ self.manage_data_result,
+ self.bump_seq_result,
+ self.manage_buy_offer_result,
+ self.path_payment_strict_send_result,
+ self.create_claimable_balance_result,
+ self.claim_claimable_balance_result,
+ self.begin_sponsoring_future_reserves_result,
+ self.end_sponsoring_future_reserves_result,
+ self.revoke_sponsorship_result,
+ self.clawback_result,
+ self.clawback_claimable_balance_result,
+ self.set_trust_line_flags_result,
+ self.liquidity_pool_deposit_result,
+ self.liquidity_pool_withdraw_result,
+ self.invoke_host_function_result,
+ self.bump_footprint_expiration_result,
+ self.restore_footprint_result,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -457,6 +540,10 @@ def __eq__(self, other: object):
== other.liquidity_pool_deposit_result
and self.liquidity_pool_withdraw_result
== other.liquidity_pool_withdraw_result
+ and self.invoke_host_function_result == other.invoke_host_function_result
+ and self.bump_footprint_expiration_result
+ == other.bump_footprint_expiration_result
+ and self.restore_footprint_result == other.restore_footprint_result
)
def __str__(self):
@@ -534,4 +621,13 @@ def __str__(self):
out.append(
f"liquidity_pool_withdraw_result={self.liquidity_pool_withdraw_result}"
) if self.liquidity_pool_withdraw_result is not None else None
+ out.append(
+ f"invoke_host_function_result={self.invoke_host_function_result}"
+ ) if self.invoke_host_function_result is not None else None
+ out.append(
+ f"bump_footprint_expiration_result={self.bump_footprint_expiration_result}"
+ ) if self.bump_footprint_expiration_result is not None else None
+ out.append(
+ f"restore_footprint_result={self.restore_footprint_result}"
+ ) if self.restore_footprint_result is not None else None
return f""
diff --git a/stellar_sdk/xdr/operation_type.py b/stellar_sdk/xdr/operation_type.py
index fefd2a0c6..cc8810e68 100644
--- a/stellar_sdk/xdr/operation_type.py
+++ b/stellar_sdk/xdr/operation_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["OperationType"]
@@ -36,7 +39,10 @@ class OperationType(IntEnum):
CLAWBACK_CLAIMABLE_BALANCE = 20,
SET_TRUST_LINE_FLAGS = 21,
LIQUIDITY_POOL_DEPOSIT = 22,
- LIQUIDITY_POOL_WITHDRAW = 23
+ LIQUIDITY_POOL_WITHDRAW = 23,
+ INVOKE_HOST_FUNCTION = 24,
+ BUMP_FOOTPRINT_EXPIRATION = 25,
+ RESTORE_FOOTPRINT = 26
};
"""
@@ -64,12 +70,15 @@ class OperationType(IntEnum):
SET_TRUST_LINE_FLAGS = 21
LIQUIDITY_POOL_DEPOSIT = 22
LIQUIDITY_POOL_WITHDRAW = 23
+ INVOKE_HOST_FUNCTION = 24
+ BUMP_FOOTPRINT_EXPIRATION = 25
+ RESTORE_FOOTPRINT = 26
def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "OperationType":
+ def unpack(cls, unpacker: Unpacker) -> OperationType:
value = unpacker.unpack_int()
return cls(value)
@@ -79,7 +88,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "OperationType":
+ def from_xdr_bytes(cls, xdr: bytes) -> OperationType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -88,6 +97,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "OperationType":
+ def from_xdr(cls, xdr: str) -> OperationType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/path_payment_strict_receive_op.py b/stellar_sdk/xdr/path_payment_strict_receive_op.py
index 0baf2e29d..ed7a90483 100644
--- a/stellar_sdk/xdr/path_payment_strict_receive_op.py
+++ b/stellar_sdk/xdr/path_payment_strict_receive_op.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -62,7 +65,7 @@ def pack(self, packer: Packer) -> None:
path_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PathPaymentStrictReceiveOp":
+ def unpack(cls, unpacker: Unpacker) -> PathPaymentStrictReceiveOp:
send_asset = Asset.unpack(unpacker)
send_max = Int64.unpack(unpacker)
destination = MuxedAccount.unpack(unpacker)
@@ -87,7 +90,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PathPaymentStrictReceiveOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> PathPaymentStrictReceiveOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -96,10 +99,22 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PathPaymentStrictReceiveOp":
+ def from_xdr(cls, xdr: str) -> PathPaymentStrictReceiveOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.send_asset,
+ self.send_max,
+ self.destination,
+ self.dest_asset,
+ self.dest_amount,
+ self.path,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/path_payment_strict_receive_result.py b/stellar_sdk/xdr/path_payment_strict_receive_result.py
index 90a9956b7..56fbd91b6 100644
--- a/stellar_sdk/xdr/path_payment_strict_receive_result.py
+++ b/stellar_sdk/xdr/path_payment_strict_receive_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -25,9 +28,20 @@ class PathPaymentStrictReceiveResult:
ClaimAtom offers<>;
SimplePaymentResult last;
} success;
+ case PATH_PAYMENT_STRICT_RECEIVE_MALFORMED:
+ case PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED:
+ case PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST:
+ case PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED:
+ case PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION:
+ case PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST:
+ case PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED:
+ case PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL:
+ void;
case PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER:
Asset noIssuer; // the asset that caused the error
- default:
+ case PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS:
+ case PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF:
+ case PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX:
void;
};
"""
@@ -52,6 +66,46 @@ def pack(self, packer: Packer) -> None:
raise ValueError("success should not be None.")
self.success.pack(packer)
return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_MALFORMED
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL
+ ):
+ return
if (
self.code
== PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER
@@ -60,9 +114,24 @@ def pack(self, packer: Packer) -> None:
raise ValueError("no_issuer should not be None.")
self.no_issuer.pack(packer)
return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX
+ ):
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PathPaymentStrictReceiveResult":
+ def unpack(cls, unpacker: Unpacker) -> PathPaymentStrictReceiveResult:
code = PathPaymentStrictReceiveResultCode.unpack(unpacker)
if (
code
@@ -70,12 +139,67 @@ def unpack(cls, unpacker: Unpacker) -> "PathPaymentStrictReceiveResult":
):
success = PathPaymentStrictReceiveResultSuccess.unpack(unpacker)
return cls(code=code, success=success)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_MALFORMED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_UNDERFUNDED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_SRC_NO_TRUST
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_SRC_NOT_AUTHORIZED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NO_DESTINATION
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NO_TRUST
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NOT_AUTHORIZED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_LINE_FULL
+ ):
+ return cls(code=code)
if (
code
== PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER
):
no_issuer = Asset.unpack(unpacker)
return cls(code=code, no_issuer=no_issuer)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_TOO_FEW_OFFERS
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_OFFER_CROSS_SELF
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictReceiveResultCode.PATH_PAYMENT_STRICT_RECEIVE_OVER_SENDMAX
+ ):
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -84,7 +208,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PathPaymentStrictReceiveResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> PathPaymentStrictReceiveResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -93,10 +217,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PathPaymentStrictReceiveResult":
+ def from_xdr(cls, xdr: str) -> PathPaymentStrictReceiveResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.success,
+ self.no_issuer,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/path_payment_strict_receive_result_code.py b/stellar_sdk/xdr/path_payment_strict_receive_result_code.py
index d2de51d50..4b2091564 100644
--- a/stellar_sdk/xdr/path_payment_strict_receive_result_code.py
+++ b/stellar_sdk/xdr/path_payment_strict_receive_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["PathPaymentStrictReceiveResultCode"]
@@ -59,7 +62,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PathPaymentStrictReceiveResultCode":
+ def unpack(cls, unpacker: Unpacker) -> PathPaymentStrictReceiveResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -69,7 +72,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PathPaymentStrictReceiveResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> PathPaymentStrictReceiveResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -78,6 +81,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PathPaymentStrictReceiveResultCode":
+ def from_xdr(cls, xdr: str) -> PathPaymentStrictReceiveResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/path_payment_strict_receive_result_success.py b/stellar_sdk/xdr/path_payment_strict_receive_result_success.py
index 7642f6cca..69dc965bf 100644
--- a/stellar_sdk/xdr/path_payment_strict_receive_result_success.py
+++ b/stellar_sdk/xdr/path_payment_strict_receive_result_success.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .claim_atom import ClaimAtom
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
self.last.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PathPaymentStrictReceiveResultSuccess":
+ def unpack(cls, unpacker: Unpacker) -> PathPaymentStrictReceiveResultSuccess:
length = unpacker.unpack_uint()
offers = []
for _ in range(length):
@@ -58,7 +61,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PathPaymentStrictReceiveResultSuccess":
+ def from_xdr_bytes(cls, xdr: bytes) -> PathPaymentStrictReceiveResultSuccess:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -67,10 +70,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PathPaymentStrictReceiveResultSuccess":
+ def from_xdr(cls, xdr: str) -> PathPaymentStrictReceiveResultSuccess:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.offers,
+ self.last,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/path_payment_strict_send_op.py b/stellar_sdk/xdr/path_payment_strict_send_op.py
index 77ca01814..8234e5ae4 100644
--- a/stellar_sdk/xdr/path_payment_strict_send_op.py
+++ b/stellar_sdk/xdr/path_payment_strict_send_op.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -62,7 +65,7 @@ def pack(self, packer: Packer) -> None:
path_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PathPaymentStrictSendOp":
+ def unpack(cls, unpacker: Unpacker) -> PathPaymentStrictSendOp:
send_asset = Asset.unpack(unpacker)
send_amount = Int64.unpack(unpacker)
destination = MuxedAccount.unpack(unpacker)
@@ -87,7 +90,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PathPaymentStrictSendOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> PathPaymentStrictSendOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -96,10 +99,22 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PathPaymentStrictSendOp":
+ def from_xdr(cls, xdr: str) -> PathPaymentStrictSendOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.send_asset,
+ self.send_amount,
+ self.destination,
+ self.dest_asset,
+ self.dest_min,
+ self.path,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/path_payment_strict_send_result.py b/stellar_sdk/xdr/path_payment_strict_send_result.py
index e004deb4f..354c70038 100644
--- a/stellar_sdk/xdr/path_payment_strict_send_result.py
+++ b/stellar_sdk/xdr/path_payment_strict_send_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -22,9 +25,20 @@ class PathPaymentStrictSendResult:
ClaimAtom offers<>;
SimplePaymentResult last;
} success;
+ case PATH_PAYMENT_STRICT_SEND_MALFORMED:
+ case PATH_PAYMENT_STRICT_SEND_UNDERFUNDED:
+ case PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST:
+ case PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED:
+ case PATH_PAYMENT_STRICT_SEND_NO_DESTINATION:
+ case PATH_PAYMENT_STRICT_SEND_NO_TRUST:
+ case PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED:
+ case PATH_PAYMENT_STRICT_SEND_LINE_FULL:
+ void;
case PATH_PAYMENT_STRICT_SEND_NO_ISSUER:
Asset noIssuer; // the asset that caused the error
- default:
+ case PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS:
+ case PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF:
+ case PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN:
void;
};
"""
@@ -49,6 +63,46 @@ def pack(self, packer: Packer) -> None:
raise ValueError("success should not be None.")
self.success.pack(packer)
return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_MALFORMED
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_UNDERFUNDED
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NO_DESTINATION
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NO_TRUST
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_LINE_FULL
+ ):
+ return
if (
self.code
== PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NO_ISSUER
@@ -57,16 +111,74 @@ def pack(self, packer: Packer) -> None:
raise ValueError("no_issuer should not be None.")
self.no_issuer.pack(packer)
return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF
+ ):
+ return
+ if (
+ self.code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN
+ ):
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PathPaymentStrictSendResult":
+ def unpack(cls, unpacker: Unpacker) -> PathPaymentStrictSendResult:
code = PathPaymentStrictSendResultCode.unpack(unpacker)
if code == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_SUCCESS:
success = PathPaymentStrictSendResultSuccess.unpack(unpacker)
return cls(code=code, success=success)
+ if code == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_MALFORMED:
+ return cls(code=code)
+ if code == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_UNDERFUNDED:
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_SRC_NO_TRUST
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_SRC_NOT_AUTHORIZED
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NO_DESTINATION
+ ):
+ return cls(code=code)
+ if code == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NO_TRUST:
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NOT_AUTHORIZED
+ ):
+ return cls(code=code)
+ if code == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_LINE_FULL:
+ return cls(code=code)
if code == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_NO_ISSUER:
no_issuer = Asset.unpack(unpacker)
return cls(code=code, no_issuer=no_issuer)
+ if (
+ code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_TOO_FEW_OFFERS
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_OFFER_CROSS_SELF
+ ):
+ return cls(code=code)
+ if (
+ code
+ == PathPaymentStrictSendResultCode.PATH_PAYMENT_STRICT_SEND_UNDER_DESTMIN
+ ):
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -75,7 +187,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PathPaymentStrictSendResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> PathPaymentStrictSendResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -84,10 +196,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PathPaymentStrictSendResult":
+ def from_xdr(cls, xdr: str) -> PathPaymentStrictSendResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.code,
+ self.success,
+ self.no_issuer,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/path_payment_strict_send_result_code.py b/stellar_sdk/xdr/path_payment_strict_send_result_code.py
index 5c4d8a0c7..0a370b92f 100644
--- a/stellar_sdk/xdr/path_payment_strict_send_result_code.py
+++ b/stellar_sdk/xdr/path_payment_strict_send_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["PathPaymentStrictSendResultCode"]
@@ -58,7 +61,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PathPaymentStrictSendResultCode":
+ def unpack(cls, unpacker: Unpacker) -> PathPaymentStrictSendResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -68,7 +71,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PathPaymentStrictSendResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> PathPaymentStrictSendResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -77,6 +80,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PathPaymentStrictSendResultCode":
+ def from_xdr(cls, xdr: str) -> PathPaymentStrictSendResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/path_payment_strict_send_result_success.py b/stellar_sdk/xdr/path_payment_strict_send_result_success.py
index 0bf170ac7..51d70d77f 100644
--- a/stellar_sdk/xdr/path_payment_strict_send_result_success.py
+++ b/stellar_sdk/xdr/path_payment_strict_send_result_success.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .claim_atom import ClaimAtom
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
self.last.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PathPaymentStrictSendResultSuccess":
+ def unpack(cls, unpacker: Unpacker) -> PathPaymentStrictSendResultSuccess:
length = unpacker.unpack_uint()
offers = []
for _ in range(length):
@@ -58,7 +61,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PathPaymentStrictSendResultSuccess":
+ def from_xdr_bytes(cls, xdr: bytes) -> PathPaymentStrictSendResultSuccess:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -67,10 +70,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PathPaymentStrictSendResultSuccess":
+ def from_xdr(cls, xdr: str) -> PathPaymentStrictSendResultSuccess:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.offers,
+ self.last,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/payment_op.py b/stellar_sdk/xdr/payment_op.py
index 00e28732c..aea398ff2 100644
--- a/stellar_sdk/xdr/payment_op.py
+++ b/stellar_sdk/xdr/payment_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .asset import Asset
@@ -38,7 +41,7 @@ def pack(self, packer: Packer) -> None:
self.amount.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PaymentOp":
+ def unpack(cls, unpacker: Unpacker) -> PaymentOp:
destination = MuxedAccount.unpack(unpacker)
asset = Asset.unpack(unpacker)
amount = Int64.unpack(unpacker)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PaymentOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> PaymentOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +66,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PaymentOp":
+ def from_xdr(cls, xdr: str) -> PaymentOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.destination,
+ self.asset,
+ self.amount,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/payment_result.py b/stellar_sdk/xdr/payment_result.py
index bd3425ba2..fc881bdb5 100644
--- a/stellar_sdk/xdr/payment_result.py
+++ b/stellar_sdk/xdr/payment_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .payment_result_code import PaymentResultCode
@@ -16,7 +19,15 @@ class PaymentResult:
{
case PAYMENT_SUCCESS:
void;
- default:
+ case PAYMENT_MALFORMED:
+ case PAYMENT_UNDERFUNDED:
+ case PAYMENT_SRC_NO_TRUST:
+ case PAYMENT_SRC_NOT_AUTHORIZED:
+ case PAYMENT_NO_DESTINATION:
+ case PAYMENT_NO_TRUST:
+ case PAYMENT_NOT_AUTHORIZED:
+ case PAYMENT_LINE_FULL:
+ case PAYMENT_NO_ISSUER:
void;
};
"""
@@ -31,12 +42,48 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == PaymentResultCode.PAYMENT_SUCCESS:
return
+ if self.code == PaymentResultCode.PAYMENT_MALFORMED:
+ return
+ if self.code == PaymentResultCode.PAYMENT_UNDERFUNDED:
+ return
+ if self.code == PaymentResultCode.PAYMENT_SRC_NO_TRUST:
+ return
+ if self.code == PaymentResultCode.PAYMENT_SRC_NOT_AUTHORIZED:
+ return
+ if self.code == PaymentResultCode.PAYMENT_NO_DESTINATION:
+ return
+ if self.code == PaymentResultCode.PAYMENT_NO_TRUST:
+ return
+ if self.code == PaymentResultCode.PAYMENT_NOT_AUTHORIZED:
+ return
+ if self.code == PaymentResultCode.PAYMENT_LINE_FULL:
+ return
+ if self.code == PaymentResultCode.PAYMENT_NO_ISSUER:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PaymentResult":
+ def unpack(cls, unpacker: Unpacker) -> PaymentResult:
code = PaymentResultCode.unpack(unpacker)
if code == PaymentResultCode.PAYMENT_SUCCESS:
return cls(code=code)
+ if code == PaymentResultCode.PAYMENT_MALFORMED:
+ return cls(code=code)
+ if code == PaymentResultCode.PAYMENT_UNDERFUNDED:
+ return cls(code=code)
+ if code == PaymentResultCode.PAYMENT_SRC_NO_TRUST:
+ return cls(code=code)
+ if code == PaymentResultCode.PAYMENT_SRC_NOT_AUTHORIZED:
+ return cls(code=code)
+ if code == PaymentResultCode.PAYMENT_NO_DESTINATION:
+ return cls(code=code)
+ if code == PaymentResultCode.PAYMENT_NO_TRUST:
+ return cls(code=code)
+ if code == PaymentResultCode.PAYMENT_NOT_AUTHORIZED:
+ return cls(code=code)
+ if code == PaymentResultCode.PAYMENT_LINE_FULL:
+ return cls(code=code)
+ if code == PaymentResultCode.PAYMENT_NO_ISSUER:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +92,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PaymentResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> PaymentResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +101,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PaymentResult":
+ def from_xdr(cls, xdr: str) -> PaymentResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/payment_result_code.py b/stellar_sdk/xdr/payment_result_code.py
index d2e45ef7f..dc42e0500 100644
--- a/stellar_sdk/xdr/payment_result_code.py
+++ b/stellar_sdk/xdr/payment_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["PaymentResultCode"]
@@ -44,7 +47,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PaymentResultCode":
+ def unpack(cls, unpacker: Unpacker) -> PaymentResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PaymentResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> PaymentResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,6 +66,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PaymentResultCode":
+ def from_xdr(cls, xdr: str) -> PaymentResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/peer_address.py b/stellar_sdk/xdr/peer_address.py
index b66e03560..21a223f35 100644
--- a/stellar_sdk/xdr/peer_address.py
+++ b/stellar_sdk/xdr/peer_address.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .peer_address_ip import PeerAddressIp
@@ -44,7 +47,7 @@ def pack(self, packer: Packer) -> None:
self.num_failures.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PeerAddress":
+ def unpack(cls, unpacker: Unpacker) -> PeerAddress:
ip = PeerAddressIp.unpack(unpacker)
port = Uint32.unpack(unpacker)
num_failures = Uint32.unpack(unpacker)
@@ -60,7 +63,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PeerAddress":
+ def from_xdr_bytes(cls, xdr: bytes) -> PeerAddress:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -69,10 +72,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PeerAddress":
+ def from_xdr(cls, xdr: str) -> PeerAddress:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ip,
+ self.port,
+ self.num_failures,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/peer_address_ip.py b/stellar_sdk/xdr/peer_address_ip.py
index d963d1fc7..70d69f47f 100644
--- a/stellar_sdk/xdr/peer_address_ip.py
+++ b/stellar_sdk/xdr/peer_address_ip.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -46,7 +49,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PeerAddressIp":
+ def unpack(cls, unpacker: Unpacker) -> PeerAddressIp:
type = IPAddrType.unpack(unpacker)
if type == IPAddrType.IPv4:
ipv4 = Opaque.unpack(unpacker, 4, True)
@@ -62,7 +65,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PeerAddressIp":
+ def from_xdr_bytes(cls, xdr: bytes) -> PeerAddressIp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -71,10 +74,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PeerAddressIp":
+ def from_xdr(cls, xdr: str) -> PeerAddressIp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.ipv4,
+ self.ipv6,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/peer_stat_list.py b/stellar_sdk/xdr/peer_stat_list.py
index 0ead38eaa..b07c35f92 100644
--- a/stellar_sdk/xdr/peer_stat_list.py
+++ b/stellar_sdk/xdr/peer_stat_list.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .peer_stats import PeerStats
@@ -30,7 +33,7 @@ def pack(self, packer: Packer) -> None:
peer_stat_list_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PeerStatList":
+ def unpack(cls, unpacker: Unpacker) -> PeerStatList:
length = unpacker.unpack_uint()
peer_stat_list = []
for _ in range(length):
@@ -43,7 +46,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PeerStatList":
+ def from_xdr_bytes(cls, xdr: bytes) -> PeerStatList:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -52,10 +55,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PeerStatList":
+ def from_xdr(cls, xdr: str) -> PeerStatList:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.peer_stat_list)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/peer_stats.py b/stellar_sdk/xdr/peer_stats.py
index 288a55979..21d1183cc 100644
--- a/stellar_sdk/xdr/peer_stats.py
+++ b/stellar_sdk/xdr/peer_stats.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import String
@@ -88,7 +91,7 @@ def pack(self, packer: Packer) -> None:
self.duplicate_fetch_message_recv.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PeerStats":
+ def unpack(cls, unpacker: Unpacker) -> PeerStats:
id = NodeID.unpack(unpacker)
version_str = String.unpack(unpacker)
messages_read = Uint64.unpack(unpacker)
@@ -128,7 +131,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PeerStats":
+ def from_xdr_bytes(cls, xdr: bytes) -> PeerStats:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -137,10 +140,31 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PeerStats":
+ def from_xdr(cls, xdr: str) -> PeerStats:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.id,
+ self.version_str,
+ self.messages_read,
+ self.messages_written,
+ self.bytes_read,
+ self.bytes_written,
+ self.seconds_connected,
+ self.unique_flood_bytes_recv,
+ self.duplicate_flood_bytes_recv,
+ self.unique_fetch_bytes_recv,
+ self.duplicate_fetch_bytes_recv,
+ self.unique_flood_message_recv,
+ self.duplicate_flood_message_recv,
+ self.unique_fetch_message_recv,
+ self.duplicate_fetch_message_recv,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/persisted_scp_state.py b/stellar_sdk/xdr/persisted_scp_state.py
new file mode 100644
index 000000000..df6006424
--- /dev/null
+++ b/stellar_sdk/xdr/persisted_scp_state.py
@@ -0,0 +1,101 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Integer
+from .persisted_scp_state_v0 import PersistedSCPStateV0
+from .persisted_scp_state_v1 import PersistedSCPStateV1
+
+__all__ = ["PersistedSCPState"]
+
+
+class PersistedSCPState:
+ """
+ XDR Source Code::
+
+ union PersistedSCPState switch (int v)
+ {
+ case 0:
+ PersistedSCPStateV0 v0;
+ case 1:
+ PersistedSCPStateV1 v1;
+ };
+ """
+
+ def __init__(
+ self,
+ v: int,
+ v0: PersistedSCPStateV0 = None,
+ v1: PersistedSCPStateV1 = None,
+ ) -> None:
+ self.v = v
+ self.v0 = v0
+ self.v1 = v1
+
+ def pack(self, packer: Packer) -> None:
+ Integer(self.v).pack(packer)
+ if self.v == 0:
+ if self.v0 is None:
+ raise ValueError("v0 should not be None.")
+ self.v0.pack(packer)
+ return
+ if self.v == 1:
+ if self.v1 is None:
+ raise ValueError("v1 should not be None.")
+ self.v1.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> PersistedSCPState:
+ v = Integer.unpack(unpacker)
+ if v == 0:
+ v0 = PersistedSCPStateV0.unpack(unpacker)
+ return cls(v=v, v0=v0)
+ if v == 1:
+ v1 = PersistedSCPStateV1.unpack(unpacker)
+ return cls(v=v, v1=v1)
+ return cls(v=v)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> PersistedSCPState:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> PersistedSCPState:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v0,
+ self.v1,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.v == other.v and self.v0 == other.v0 and self.v1 == other.v1
+
+ def __str__(self):
+ out = []
+ out.append(f"v={self.v}")
+ out.append(f"v0={self.v0}") if self.v0 is not None else None
+ out.append(f"v1={self.v1}") if self.v1 is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/persisted_scp_state_v0.py b/stellar_sdk/xdr/persisted_scp_state_v0.py
new file mode 100644
index 000000000..e676d7db1
--- /dev/null
+++ b/stellar_sdk/xdr/persisted_scp_state_v0.py
@@ -0,0 +1,128 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .scp_envelope import SCPEnvelope
+from .scp_quorum_set import SCPQuorumSet
+from .stored_transaction_set import StoredTransactionSet
+
+__all__ = ["PersistedSCPStateV0"]
+
+
+class PersistedSCPStateV0:
+ """
+ XDR Source Code::
+
+ struct PersistedSCPStateV0
+ {
+ SCPEnvelope scpEnvelopes<>;
+ SCPQuorumSet quorumSets<>;
+ StoredTransactionSet txSets<>;
+ };
+ """
+
+ def __init__(
+ self,
+ scp_envelopes: List[SCPEnvelope],
+ quorum_sets: List[SCPQuorumSet],
+ tx_sets: List[StoredTransactionSet],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if scp_envelopes and len(scp_envelopes) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `scp_envelopes` should be {_expect_max_length}, but got {len(scp_envelopes)}."
+ )
+ _expect_max_length = 4294967295
+ if quorum_sets and len(quorum_sets) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `quorum_sets` should be {_expect_max_length}, but got {len(quorum_sets)}."
+ )
+ _expect_max_length = 4294967295
+ if tx_sets and len(tx_sets) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `tx_sets` should be {_expect_max_length}, but got {len(tx_sets)}."
+ )
+ self.scp_envelopes = scp_envelopes
+ self.quorum_sets = quorum_sets
+ self.tx_sets = tx_sets
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_uint(len(self.scp_envelopes))
+ for scp_envelopes_item in self.scp_envelopes:
+ scp_envelopes_item.pack(packer)
+ packer.pack_uint(len(self.quorum_sets))
+ for quorum_sets_item in self.quorum_sets:
+ quorum_sets_item.pack(packer)
+ packer.pack_uint(len(self.tx_sets))
+ for tx_sets_item in self.tx_sets:
+ tx_sets_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> PersistedSCPStateV0:
+ length = unpacker.unpack_uint()
+ scp_envelopes = []
+ for _ in range(length):
+ scp_envelopes.append(SCPEnvelope.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ quorum_sets = []
+ for _ in range(length):
+ quorum_sets.append(SCPQuorumSet.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ tx_sets = []
+ for _ in range(length):
+ tx_sets.append(StoredTransactionSet.unpack(unpacker))
+ return cls(
+ scp_envelopes=scp_envelopes,
+ quorum_sets=quorum_sets,
+ tx_sets=tx_sets,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> PersistedSCPStateV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> PersistedSCPStateV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.scp_envelopes,
+ self.quorum_sets,
+ self.tx_sets,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.scp_envelopes == other.scp_envelopes
+ and self.quorum_sets == other.quorum_sets
+ and self.tx_sets == other.tx_sets
+ )
+
+ def __str__(self):
+ out = [
+ f"scp_envelopes={self.scp_envelopes}",
+ f"quorum_sets={self.quorum_sets}",
+ f"tx_sets={self.tx_sets}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/persisted_scp_state_v1.py b/stellar_sdk/xdr/persisted_scp_state_v1.py
new file mode 100644
index 000000000..41a2f4117
--- /dev/null
+++ b/stellar_sdk/xdr/persisted_scp_state_v1.py
@@ -0,0 +1,109 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .scp_envelope import SCPEnvelope
+from .scp_quorum_set import SCPQuorumSet
+
+__all__ = ["PersistedSCPStateV1"]
+
+
+class PersistedSCPStateV1:
+ """
+ XDR Source Code::
+
+ struct PersistedSCPStateV1
+ {
+ // Tx sets are saved separately
+ SCPEnvelope scpEnvelopes<>;
+ SCPQuorumSet quorumSets<>;
+ };
+ """
+
+ def __init__(
+ self,
+ scp_envelopes: List[SCPEnvelope],
+ quorum_sets: List[SCPQuorumSet],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if scp_envelopes and len(scp_envelopes) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `scp_envelopes` should be {_expect_max_length}, but got {len(scp_envelopes)}."
+ )
+ _expect_max_length = 4294967295
+ if quorum_sets and len(quorum_sets) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `quorum_sets` should be {_expect_max_length}, but got {len(quorum_sets)}."
+ )
+ self.scp_envelopes = scp_envelopes
+ self.quorum_sets = quorum_sets
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_uint(len(self.scp_envelopes))
+ for scp_envelopes_item in self.scp_envelopes:
+ scp_envelopes_item.pack(packer)
+ packer.pack_uint(len(self.quorum_sets))
+ for quorum_sets_item in self.quorum_sets:
+ quorum_sets_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> PersistedSCPStateV1:
+ length = unpacker.unpack_uint()
+ scp_envelopes = []
+ for _ in range(length):
+ scp_envelopes.append(SCPEnvelope.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ quorum_sets = []
+ for _ in range(length):
+ quorum_sets.append(SCPQuorumSet.unpack(unpacker))
+ return cls(
+ scp_envelopes=scp_envelopes,
+ quorum_sets=quorum_sets,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> PersistedSCPStateV1:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> PersistedSCPStateV1:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.scp_envelopes,
+ self.quorum_sets,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.scp_envelopes == other.scp_envelopes
+ and self.quorum_sets == other.quorum_sets
+ )
+
+ def __str__(self):
+ out = [
+ f"scp_envelopes={self.scp_envelopes}",
+ f"quorum_sets={self.quorum_sets}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/pool_id.py b/stellar_sdk/xdr/pool_id.py
index 4cf0fb4db..20986ca7b 100644
--- a/stellar_sdk/xdr/pool_id.py
+++ b/stellar_sdk/xdr/pool_id.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .hash import Hash
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
self.pool_id.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PoolID":
+ def unpack(cls, unpacker: Unpacker) -> PoolID:
pool_id = Hash.unpack(unpacker)
return cls(pool_id)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PoolID":
+ def from_xdr_bytes(cls, xdr: bytes) -> PoolID:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PoolID":
+ def from_xdr(cls, xdr: str) -> PoolID:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.pool_id)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/precondition_type.py b/stellar_sdk/xdr/precondition_type.py
index 389d05105..187cde236 100644
--- a/stellar_sdk/xdr/precondition_type.py
+++ b/stellar_sdk/xdr/precondition_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["PreconditionType"]
@@ -11,7 +14,8 @@ class PreconditionType(IntEnum):
"""
XDR Source Code::
- enum PreconditionType {
+ enum PreconditionType
+ {
PRECOND_NONE = 0,
PRECOND_TIME = 1,
PRECOND_V2 = 2
@@ -26,7 +30,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PreconditionType":
+ def unpack(cls, unpacker: Unpacker) -> PreconditionType:
value = unpacker.unpack_int()
return cls(value)
@@ -36,7 +40,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PreconditionType":
+ def from_xdr_bytes(cls, xdr: bytes) -> PreconditionType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -45,6 +49,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PreconditionType":
+ def from_xdr(cls, xdr: str) -> PreconditionType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/preconditions.py b/stellar_sdk/xdr/preconditions.py
index f10929c66..266801529 100644
--- a/stellar_sdk/xdr/preconditions.py
+++ b/stellar_sdk/xdr/preconditions.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .precondition_type import PreconditionType
@@ -14,13 +17,14 @@ class Preconditions:
"""
XDR Source Code::
- union Preconditions switch (PreconditionType type) {
- case PRECOND_NONE:
- void;
- case PRECOND_TIME:
- TimeBounds timeBounds;
- case PRECOND_V2:
- PreconditionsV2 v2;
+ union Preconditions switch (PreconditionType type)
+ {
+ case PRECOND_NONE:
+ void;
+ case PRECOND_TIME:
+ TimeBounds timeBounds;
+ case PRECOND_V2:
+ PreconditionsV2 v2;
};
"""
@@ -50,7 +54,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Preconditions":
+ def unpack(cls, unpacker: Unpacker) -> Preconditions:
type = PreconditionType.unpack(unpacker)
if type == PreconditionType.PRECOND_NONE:
return cls(type=type)
@@ -68,7 +72,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Preconditions":
+ def from_xdr_bytes(cls, xdr: bytes) -> Preconditions:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -77,10 +81,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Preconditions":
+ def from_xdr(cls, xdr: str) -> Preconditions:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.time_bounds,
+ self.v2,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/preconditions_v2.py b/stellar_sdk/xdr/preconditions_v2.py
index 4f6ff486b..04a17b339 100644
--- a/stellar_sdk/xdr/preconditions_v2.py
+++ b/stellar_sdk/xdr/preconditions_v2.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List, Optional
+
from xdrlib3 import Packer, Unpacker
from .duration import Duration
@@ -18,13 +21,14 @@ class PreconditionsV2:
"""
XDR Source Code::
- struct PreconditionsV2 {
- TimeBounds *timeBounds;
+ struct PreconditionsV2
+ {
+ TimeBounds* timeBounds;
// Transaction only valid for ledger numbers n such that
// minLedger <= n < maxLedger (if maxLedger == 0, then
// only minLedger is checked)
- LedgerBounds *ledgerBounds;
+ LedgerBounds* ledgerBounds;
// If NULL, only valid when sourceAccount's sequence number
// is seqNum - 1. Otherwise, valid when sourceAccount's
@@ -32,7 +36,7 @@ class PreconditionsV2:
// Note that after execution the account's sequence number
// is always raised to tx.seqNum, and a transaction is not
// valid if tx.seqNum is too high to ensure replay protection.
- SequenceNumber *minSeqNum;
+ SequenceNumber* minSeqNum;
// For the transaction to be valid, the current ledger time must
// be at least minSeqAge greater than sourceAccount's seqTime.
@@ -95,7 +99,7 @@ def pack(self, packer: Packer) -> None:
extra_signers_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PreconditionsV2":
+ def unpack(cls, unpacker: Unpacker) -> PreconditionsV2:
time_bounds = TimeBounds.unpack(unpacker) if unpacker.unpack_uint() else None
ledger_bounds = (
LedgerBounds.unpack(unpacker) if unpacker.unpack_uint() else None
@@ -124,7 +128,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PreconditionsV2":
+ def from_xdr_bytes(cls, xdr: bytes) -> PreconditionsV2:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -133,10 +137,22 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PreconditionsV2":
+ def from_xdr(cls, xdr: str) -> PreconditionsV2:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.time_bounds,
+ self.ledger_bounds,
+ self.min_seq_num,
+ self.min_seq_age,
+ self.min_seq_ledger_gap,
+ self.extra_signers,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/price.py b/stellar_sdk/xdr/price.py
index 5b3ced286..a1a478bc4 100644
--- a/stellar_sdk/xdr/price.py
+++ b/stellar_sdk/xdr/price.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .int32 import Int32
@@ -32,7 +35,7 @@ def pack(self, packer: Packer) -> None:
self.d.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Price":
+ def unpack(cls, unpacker: Unpacker) -> Price:
n = Int32.unpack(unpacker)
d = Int32.unpack(unpacker)
return cls(
@@ -46,7 +49,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Price":
+ def from_xdr_bytes(cls, xdr: bytes) -> Price:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -55,10 +58,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Price":
+ def from_xdr(cls, xdr: str) -> Price:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.n,
+ self.d,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/public_key.py b/stellar_sdk/xdr/public_key.py
index 054f37413..621a66d05 100644
--- a/stellar_sdk/xdr/public_key.py
+++ b/stellar_sdk/xdr/public_key.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .public_key_type import PublicKeyType
@@ -37,7 +40,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PublicKey":
+ def unpack(cls, unpacker: Unpacker) -> PublicKey:
type = PublicKeyType.unpack(unpacker)
if type == PublicKeyType.PUBLIC_KEY_TYPE_ED25519:
ed25519 = Uint256.unpack(unpacker)
@@ -50,7 +53,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PublicKey":
+ def from_xdr_bytes(cls, xdr: bytes) -> PublicKey:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -59,10 +62,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PublicKey":
+ def from_xdr(cls, xdr: str) -> PublicKey:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.ed25519,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/public_key_type.py b/stellar_sdk/xdr/public_key_type.py
index d95ddba47..35230df85 100644
--- a/stellar_sdk/xdr/public_key_type.py
+++ b/stellar_sdk/xdr/public_key_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["PublicKeyType"]
@@ -23,7 +26,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "PublicKeyType":
+ def unpack(cls, unpacker: Unpacker) -> PublicKeyType:
value = unpacker.unpack_int()
return cls(value)
@@ -33,7 +36,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "PublicKeyType":
+ def from_xdr_bytes(cls, xdr: bytes) -> PublicKeyType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -42,6 +45,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "PublicKeyType":
+ def from_xdr(cls, xdr: str) -> PublicKeyType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/restore_footprint_op.py b/stellar_sdk/xdr/restore_footprint_op.py
new file mode 100644
index 000000000..6b20bc7a8
--- /dev/null
+++ b/stellar_sdk/xdr/restore_footprint_op.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .extension_point import ExtensionPoint
+
+__all__ = ["RestoreFootprintOp"]
+
+
+class RestoreFootprintOp:
+ """
+ XDR Source Code::
+
+ struct RestoreFootprintOp
+ {
+ ExtensionPoint ext;
+ };
+ """
+
+ def __init__(
+ self,
+ ext: ExtensionPoint,
+ ) -> None:
+ self.ext = ext
+
+ def pack(self, packer: Packer) -> None:
+ self.ext.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> RestoreFootprintOp:
+ ext = ExtensionPoint.unpack(unpacker)
+ return cls(
+ ext=ext,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> RestoreFootprintOp:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> RestoreFootprintOp:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.ext,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.ext == other.ext
+
+ def __str__(self):
+ out = [
+ f"ext={self.ext}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/restore_footprint_result.py b/stellar_sdk/xdr/restore_footprint_result.py
new file mode 100644
index 000000000..4ba6c7ae8
--- /dev/null
+++ b/stellar_sdk/xdr/restore_footprint_result.py
@@ -0,0 +1,98 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .restore_footprint_result_code import RestoreFootprintResultCode
+
+__all__ = ["RestoreFootprintResult"]
+
+
+class RestoreFootprintResult:
+ """
+ XDR Source Code::
+
+ union RestoreFootprintResult switch (RestoreFootprintResultCode code)
+ {
+ case RESTORE_FOOTPRINT_SUCCESS:
+ void;
+ case RESTORE_FOOTPRINT_MALFORMED:
+ case RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED:
+ case RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE:
+ void;
+ };
+ """
+
+ def __init__(
+ self,
+ code: RestoreFootprintResultCode,
+ ) -> None:
+ self.code = code
+
+ def pack(self, packer: Packer) -> None:
+ self.code.pack(packer)
+ if self.code == RestoreFootprintResultCode.RESTORE_FOOTPRINT_SUCCESS:
+ return
+ if self.code == RestoreFootprintResultCode.RESTORE_FOOTPRINT_MALFORMED:
+ return
+ if (
+ self.code
+ == RestoreFootprintResultCode.RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED
+ ):
+ return
+ if (
+ self.code
+ == RestoreFootprintResultCode.RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE
+ ):
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> RestoreFootprintResult:
+ code = RestoreFootprintResultCode.unpack(unpacker)
+ if code == RestoreFootprintResultCode.RESTORE_FOOTPRINT_SUCCESS:
+ return cls(code=code)
+ if code == RestoreFootprintResultCode.RESTORE_FOOTPRINT_MALFORMED:
+ return cls(code=code)
+ if code == RestoreFootprintResultCode.RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED:
+ return cls(code=code)
+ if (
+ code
+ == RestoreFootprintResultCode.RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE
+ ):
+ return cls(code=code)
+ return cls(code=code)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> RestoreFootprintResult:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> RestoreFootprintResult:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.code,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.code == other.code
+
+ def __str__(self):
+ out = []
+ out.append(f"code={self.code}")
+ return f""
diff --git a/stellar_sdk/xdr/restore_footprint_result_code.py b/stellar_sdk/xdr/restore_footprint_result_code.py
new file mode 100644
index 000000000..783e14e89
--- /dev/null
+++ b/stellar_sdk/xdr/restore_footprint_result_code.py
@@ -0,0 +1,59 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["RestoreFootprintResultCode"]
+
+
+class RestoreFootprintResultCode(IntEnum):
+ """
+ XDR Source Code::
+
+ enum RestoreFootprintResultCode
+ {
+ // codes considered as "success" for the operation
+ RESTORE_FOOTPRINT_SUCCESS = 0,
+
+ // codes considered as "failure" for the operation
+ RESTORE_FOOTPRINT_MALFORMED = -1,
+ RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2,
+ RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3
+ };
+ """
+
+ RESTORE_FOOTPRINT_SUCCESS = 0
+ RESTORE_FOOTPRINT_MALFORMED = -1
+ RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED = -2
+ RESTORE_FOOTPRINT_INSUFFICIENT_REFUNDABLE_FEE = -3
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> RestoreFootprintResultCode:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> RestoreFootprintResultCode:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> RestoreFootprintResultCode:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/revoke_sponsorship_op.py b/stellar_sdk/xdr/revoke_sponsorship_op.py
index f3b9f76fd..b11149384 100644
--- a/stellar_sdk/xdr/revoke_sponsorship_op.py
+++ b/stellar_sdk/xdr/revoke_sponsorship_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .ledger_key import LedgerKey
@@ -51,7 +54,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "RevokeSponsorshipOp":
+ def unpack(cls, unpacker: Unpacker) -> RevokeSponsorshipOp:
type = RevokeSponsorshipType.unpack(unpacker)
if type == RevokeSponsorshipType.REVOKE_SPONSORSHIP_LEDGER_ENTRY:
ledger_key = LedgerKey.unpack(unpacker)
@@ -67,7 +70,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "RevokeSponsorshipOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> RevokeSponsorshipOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -76,10 +79,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "RevokeSponsorshipOp":
+ def from_xdr(cls, xdr: str) -> RevokeSponsorshipOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.ledger_key,
+ self.signer,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/revoke_sponsorship_op_signer.py b/stellar_sdk/xdr/revoke_sponsorship_op_signer.py
index a28531449..a9a8996de 100644
--- a/stellar_sdk/xdr/revoke_sponsorship_op_signer.py
+++ b/stellar_sdk/xdr/revoke_sponsorship_op_signer.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.signer_key.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "RevokeSponsorshipOpSigner":
+ def unpack(cls, unpacker: Unpacker) -> RevokeSponsorshipOpSigner:
account_id = AccountID.unpack(unpacker)
signer_key = SignerKey.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "RevokeSponsorshipOpSigner":
+ def from_xdr_bytes(cls, xdr: bytes) -> RevokeSponsorshipOpSigner:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "RevokeSponsorshipOpSigner":
+ def from_xdr(cls, xdr: str) -> RevokeSponsorshipOpSigner:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.account_id,
+ self.signer_key,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/revoke_sponsorship_result.py b/stellar_sdk/xdr/revoke_sponsorship_result.py
index 1108e48b5..8cf6ac778 100644
--- a/stellar_sdk/xdr/revoke_sponsorship_result.py
+++ b/stellar_sdk/xdr/revoke_sponsorship_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .revoke_sponsorship_result_code import RevokeSponsorshipResultCode
@@ -16,7 +19,11 @@ class RevokeSponsorshipResult:
{
case REVOKE_SPONSORSHIP_SUCCESS:
void;
- default:
+ case REVOKE_SPONSORSHIP_DOES_NOT_EXIST:
+ case REVOKE_SPONSORSHIP_NOT_SPONSOR:
+ case REVOKE_SPONSORSHIP_LOW_RESERVE:
+ case REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE:
+ case REVOKE_SPONSORSHIP_MALFORMED:
void;
};
"""
@@ -31,12 +38,35 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_SUCCESS:
return
+ if self.code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_DOES_NOT_EXIST:
+ return
+ if self.code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_NOT_SPONSOR:
+ return
+ if self.code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_LOW_RESERVE:
+ return
+ if (
+ self.code
+ == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE
+ ):
+ return
+ if self.code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_MALFORMED:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "RevokeSponsorshipResult":
+ def unpack(cls, unpacker: Unpacker) -> RevokeSponsorshipResult:
code = RevokeSponsorshipResultCode.unpack(unpacker)
if code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_SUCCESS:
return cls(code=code)
+ if code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_DOES_NOT_EXIST:
+ return cls(code=code)
+ if code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_NOT_SPONSOR:
+ return cls(code=code)
+ if code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_LOW_RESERVE:
+ return cls(code=code)
+ if code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_ONLY_TRANSFERABLE:
+ return cls(code=code)
+ if code == RevokeSponsorshipResultCode.REVOKE_SPONSORSHIP_MALFORMED:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +75,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "RevokeSponsorshipResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> RevokeSponsorshipResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +84,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "RevokeSponsorshipResult":
+ def from_xdr(cls, xdr: str) -> RevokeSponsorshipResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/revoke_sponsorship_result_code.py b/stellar_sdk/xdr/revoke_sponsorship_result_code.py
index f6364fbbf..73657695e 100644
--- a/stellar_sdk/xdr/revoke_sponsorship_result_code.py
+++ b/stellar_sdk/xdr/revoke_sponsorship_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["RevokeSponsorshipResultCode"]
@@ -36,7 +39,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "RevokeSponsorshipResultCode":
+ def unpack(cls, unpacker: Unpacker) -> RevokeSponsorshipResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -46,7 +49,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "RevokeSponsorshipResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> RevokeSponsorshipResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -55,6 +58,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "RevokeSponsorshipResultCode":
+ def from_xdr(cls, xdr: str) -> RevokeSponsorshipResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/revoke_sponsorship_type.py b/stellar_sdk/xdr/revoke_sponsorship_type.py
index 479054bea..f4f16b721 100644
--- a/stellar_sdk/xdr/revoke_sponsorship_type.py
+++ b/stellar_sdk/xdr/revoke_sponsorship_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["RevokeSponsorshipType"]
@@ -25,7 +28,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "RevokeSponsorshipType":
+ def unpack(cls, unpacker: Unpacker) -> RevokeSponsorshipType:
value = unpacker.unpack_int()
return cls(value)
@@ -35,7 +38,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "RevokeSponsorshipType":
+ def from_xdr_bytes(cls, xdr: bytes) -> RevokeSponsorshipType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -44,6 +47,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "RevokeSponsorshipType":
+ def from_xdr(cls, xdr: str) -> RevokeSponsorshipType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_address.py b/stellar_sdk/xdr/sc_address.py
new file mode 100644
index 000000000..6008e9567
--- /dev/null
+++ b/stellar_sdk/xdr/sc_address.py
@@ -0,0 +1,109 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .account_id import AccountID
+from .hash import Hash
+from .sc_address_type import SCAddressType
+
+__all__ = ["SCAddress"]
+
+
+class SCAddress:
+ """
+ XDR Source Code::
+
+ union SCAddress switch (SCAddressType type)
+ {
+ case SC_ADDRESS_TYPE_ACCOUNT:
+ AccountID accountId;
+ case SC_ADDRESS_TYPE_CONTRACT:
+ Hash contractId;
+ };
+ """
+
+ def __init__(
+ self,
+ type: SCAddressType,
+ account_id: AccountID = None,
+ contract_id: Hash = None,
+ ) -> None:
+ self.type = type
+ self.account_id = account_id
+ self.contract_id = contract_id
+
+ def pack(self, packer: Packer) -> None:
+ self.type.pack(packer)
+ if self.type == SCAddressType.SC_ADDRESS_TYPE_ACCOUNT:
+ if self.account_id is None:
+ raise ValueError("account_id should not be None.")
+ self.account_id.pack(packer)
+ return
+ if self.type == SCAddressType.SC_ADDRESS_TYPE_CONTRACT:
+ if self.contract_id is None:
+ raise ValueError("contract_id should not be None.")
+ self.contract_id.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCAddress:
+ type = SCAddressType.unpack(unpacker)
+ if type == SCAddressType.SC_ADDRESS_TYPE_ACCOUNT:
+ account_id = AccountID.unpack(unpacker)
+ return cls(type=type, account_id=account_id)
+ if type == SCAddressType.SC_ADDRESS_TYPE_CONTRACT:
+ contract_id = Hash.unpack(unpacker)
+ return cls(type=type, contract_id=contract_id)
+ return cls(type=type)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCAddress:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCAddress:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.account_id,
+ self.contract_id,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.type == other.type
+ and self.account_id == other.account_id
+ and self.contract_id == other.contract_id
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"type={self.type}")
+ out.append(
+ f"account_id={self.account_id}"
+ ) if self.account_id is not None else None
+ out.append(
+ f"contract_id={self.contract_id}"
+ ) if self.contract_id is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/sc_address_type.py b/stellar_sdk/xdr/sc_address_type.py
new file mode 100644
index 000000000..d210541a3
--- /dev/null
+++ b/stellar_sdk/xdr/sc_address_type.py
@@ -0,0 +1,52 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SCAddressType"]
+
+
+class SCAddressType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SCAddressType
+ {
+ SC_ADDRESS_TYPE_ACCOUNT = 0,
+ SC_ADDRESS_TYPE_CONTRACT = 1
+ };
+ """
+
+ SC_ADDRESS_TYPE_ACCOUNT = 0
+ SC_ADDRESS_TYPE_CONTRACT = 1
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCAddressType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCAddressType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCAddressType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_bytes.py b/stellar_sdk/xdr/sc_bytes.py
new file mode 100644
index 000000000..ea12b406a
--- /dev/null
+++ b/stellar_sdk/xdr/sc_bytes.py
@@ -0,0 +1,60 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Opaque
+
+__all__ = ["SCBytes"]
+
+
+class SCBytes:
+ """
+ XDR Source Code::
+
+ typedef opaque SCBytes<>;
+ """
+
+ def __init__(self, sc_bytes: bytes) -> None:
+ self.sc_bytes = sc_bytes
+
+ def pack(self, packer: Packer) -> None:
+ Opaque(self.sc_bytes, 4294967295, False).pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCBytes:
+ sc_bytes = Opaque.unpack(unpacker, 4294967295, False)
+ return cls(sc_bytes)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCBytes:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCBytes:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(self.sc_bytes)
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.sc_bytes == other.sc_bytes
+
+ def __str__(self):
+ return f""
diff --git a/stellar_sdk/xdr/sc_contract_instance.py b/stellar_sdk/xdr/sc_contract_instance.py
new file mode 100644
index 000000000..13f61960a
--- /dev/null
+++ b/stellar_sdk/xdr/sc_contract_instance.py
@@ -0,0 +1,88 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import Optional
+
+from xdrlib3 import Packer, Unpacker
+
+from .contract_executable import ContractExecutable
+from .sc_map import SCMap
+
+__all__ = ["SCContractInstance"]
+
+
+class SCContractInstance:
+ """
+ XDR Source Code::
+
+ struct SCContractInstance {
+ ContractExecutable executable;
+ SCMap* storage;
+ };
+ """
+
+ def __init__(
+ self,
+ executable: ContractExecutable,
+ storage: Optional[SCMap],
+ ) -> None:
+ self.executable = executable
+ self.storage = storage
+
+ def pack(self, packer: Packer) -> None:
+ self.executable.pack(packer)
+ if self.storage is None:
+ packer.pack_uint(0)
+ else:
+ packer.pack_uint(1)
+ self.storage.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCContractInstance:
+ executable = ContractExecutable.unpack(unpacker)
+ storage = SCMap.unpack(unpacker) if unpacker.unpack_uint() else None
+ return cls(
+ executable=executable,
+ storage=storage,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCContractInstance:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCContractInstance:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.executable,
+ self.storage,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.executable == other.executable and self.storage == other.storage
+
+ def __str__(self):
+ out = [
+ f"executable={self.executable}",
+ f"storage={self.storage}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_env_meta_entry.py b/stellar_sdk/xdr/sc_env_meta_entry.py
new file mode 100644
index 000000000..77c98e092
--- /dev/null
+++ b/stellar_sdk/xdr/sc_env_meta_entry.py
@@ -0,0 +1,91 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_env_meta_kind import SCEnvMetaKind
+from .uint64 import Uint64
+
+__all__ = ["SCEnvMetaEntry"]
+
+
+class SCEnvMetaEntry:
+ """
+ XDR Source Code::
+
+ union SCEnvMetaEntry switch (SCEnvMetaKind kind)
+ {
+ case SC_ENV_META_KIND_INTERFACE_VERSION:
+ uint64 interfaceVersion;
+ };
+ """
+
+ def __init__(
+ self,
+ kind: SCEnvMetaKind,
+ interface_version: Uint64 = None,
+ ) -> None:
+ self.kind = kind
+ self.interface_version = interface_version
+
+ def pack(self, packer: Packer) -> None:
+ self.kind.pack(packer)
+ if self.kind == SCEnvMetaKind.SC_ENV_META_KIND_INTERFACE_VERSION:
+ if self.interface_version is None:
+ raise ValueError("interface_version should not be None.")
+ self.interface_version.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCEnvMetaEntry:
+ kind = SCEnvMetaKind.unpack(unpacker)
+ if kind == SCEnvMetaKind.SC_ENV_META_KIND_INTERFACE_VERSION:
+ interface_version = Uint64.unpack(unpacker)
+ return cls(kind=kind, interface_version=interface_version)
+ return cls(kind=kind)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCEnvMetaEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCEnvMetaEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.kind,
+ self.interface_version,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.kind == other.kind
+ and self.interface_version == other.interface_version
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"kind={self.kind}")
+ out.append(
+ f"interface_version={self.interface_version}"
+ ) if self.interface_version is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/sc_env_meta_kind.py b/stellar_sdk/xdr/sc_env_meta_kind.py
new file mode 100644
index 000000000..d60536391
--- /dev/null
+++ b/stellar_sdk/xdr/sc_env_meta_kind.py
@@ -0,0 +1,50 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SCEnvMetaKind"]
+
+
+class SCEnvMetaKind(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SCEnvMetaKind
+ {
+ SC_ENV_META_KIND_INTERFACE_VERSION = 0
+ };
+ """
+
+ SC_ENV_META_KIND_INTERFACE_VERSION = 0
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCEnvMetaKind:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCEnvMetaKind:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCEnvMetaKind:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_error.py b/stellar_sdk/xdr/sc_error.py
new file mode 100644
index 000000000..f8d6b8d78
--- /dev/null
+++ b/stellar_sdk/xdr/sc_error.py
@@ -0,0 +1,179 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_error_code import SCErrorCode
+from .sc_error_type import SCErrorType
+from .uint32 import Uint32
+
+__all__ = ["SCError"]
+
+
+class SCError:
+ """
+ XDR Source Code::
+
+ union SCError switch (SCErrorType type)
+ {
+ case SCE_CONTRACT:
+ uint32 contractCode;
+ case SCE_WASM_VM:
+ case SCE_CONTEXT:
+ case SCE_STORAGE:
+ case SCE_OBJECT:
+ case SCE_CRYPTO:
+ case SCE_EVENTS:
+ case SCE_BUDGET:
+ case SCE_VALUE:
+ case SCE_AUTH:
+ SCErrorCode code;
+ };
+ """
+
+ def __init__(
+ self,
+ type: SCErrorType,
+ contract_code: Uint32 = None,
+ code: SCErrorCode = None,
+ ) -> None:
+ self.type = type
+ self.contract_code = contract_code
+ self.code = code
+
+ def pack(self, packer: Packer) -> None:
+ self.type.pack(packer)
+ if self.type == SCErrorType.SCE_CONTRACT:
+ if self.contract_code is None:
+ raise ValueError("contract_code should not be None.")
+ self.contract_code.pack(packer)
+ return
+ if self.type == SCErrorType.SCE_WASM_VM:
+ if self.code is None:
+ raise ValueError("code should not be None.")
+ self.code.pack(packer)
+ return
+ if self.type == SCErrorType.SCE_CONTEXT:
+ if self.code is None:
+ raise ValueError("code should not be None.")
+ self.code.pack(packer)
+ return
+ if self.type == SCErrorType.SCE_STORAGE:
+ if self.code is None:
+ raise ValueError("code should not be None.")
+ self.code.pack(packer)
+ return
+ if self.type == SCErrorType.SCE_OBJECT:
+ if self.code is None:
+ raise ValueError("code should not be None.")
+ self.code.pack(packer)
+ return
+ if self.type == SCErrorType.SCE_CRYPTO:
+ if self.code is None:
+ raise ValueError("code should not be None.")
+ self.code.pack(packer)
+ return
+ if self.type == SCErrorType.SCE_EVENTS:
+ if self.code is None:
+ raise ValueError("code should not be None.")
+ self.code.pack(packer)
+ return
+ if self.type == SCErrorType.SCE_BUDGET:
+ if self.code is None:
+ raise ValueError("code should not be None.")
+ self.code.pack(packer)
+ return
+ if self.type == SCErrorType.SCE_VALUE:
+ if self.code is None:
+ raise ValueError("code should not be None.")
+ self.code.pack(packer)
+ return
+ if self.type == SCErrorType.SCE_AUTH:
+ if self.code is None:
+ raise ValueError("code should not be None.")
+ self.code.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCError:
+ type = SCErrorType.unpack(unpacker)
+ if type == SCErrorType.SCE_CONTRACT:
+ contract_code = Uint32.unpack(unpacker)
+ return cls(type=type, contract_code=contract_code)
+ if type == SCErrorType.SCE_WASM_VM:
+ code = SCErrorCode.unpack(unpacker)
+ return cls(type=type, code=code)
+ if type == SCErrorType.SCE_CONTEXT:
+ code = SCErrorCode.unpack(unpacker)
+ return cls(type=type, code=code)
+ if type == SCErrorType.SCE_STORAGE:
+ code = SCErrorCode.unpack(unpacker)
+ return cls(type=type, code=code)
+ if type == SCErrorType.SCE_OBJECT:
+ code = SCErrorCode.unpack(unpacker)
+ return cls(type=type, code=code)
+ if type == SCErrorType.SCE_CRYPTO:
+ code = SCErrorCode.unpack(unpacker)
+ return cls(type=type, code=code)
+ if type == SCErrorType.SCE_EVENTS:
+ code = SCErrorCode.unpack(unpacker)
+ return cls(type=type, code=code)
+ if type == SCErrorType.SCE_BUDGET:
+ code = SCErrorCode.unpack(unpacker)
+ return cls(type=type, code=code)
+ if type == SCErrorType.SCE_VALUE:
+ code = SCErrorCode.unpack(unpacker)
+ return cls(type=type, code=code)
+ if type == SCErrorType.SCE_AUTH:
+ code = SCErrorCode.unpack(unpacker)
+ return cls(type=type, code=code)
+ return cls(type=type)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCError:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCError:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.contract_code,
+ self.code,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.type == other.type
+ and self.contract_code == other.contract_code
+ and self.code == other.code
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"type={self.type}")
+ out.append(
+ f"contract_code={self.contract_code}"
+ ) if self.contract_code is not None else None
+ out.append(f"code={self.code}") if self.code is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/sc_error_code.py b/stellar_sdk/xdr/sc_error_code.py
new file mode 100644
index 000000000..d2593af1e
--- /dev/null
+++ b/stellar_sdk/xdr/sc_error_code.py
@@ -0,0 +1,68 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SCErrorCode"]
+
+
+class SCErrorCode(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SCErrorCode
+ {
+ SCEC_ARITH_DOMAIN = 0, // Some arithmetic was undefined (overflow, divide-by-zero).
+ SCEC_INDEX_BOUNDS = 1, // Something was indexed beyond its bounds.
+ SCEC_INVALID_INPUT = 2, // User provided some otherwise-bad data.
+ SCEC_MISSING_VALUE = 3, // Some value was required but not provided.
+ SCEC_EXISTING_VALUE = 4, // Some value was provided where not allowed.
+ SCEC_EXCEEDED_LIMIT = 5, // Some arbitrary limit -- gas or otherwise -- was hit.
+ SCEC_INVALID_ACTION = 6, // Data was valid but action requested was not.
+ SCEC_INTERNAL_ERROR = 7, // The host detected an error in its own logic.
+ SCEC_UNEXPECTED_TYPE = 8, // Some type wasn't as expected.
+ SCEC_UNEXPECTED_SIZE = 9 // Something's size wasn't as expected.
+ };
+ """
+
+ SCEC_ARITH_DOMAIN = 0
+ SCEC_INDEX_BOUNDS = 1
+ SCEC_INVALID_INPUT = 2
+ SCEC_MISSING_VALUE = 3
+ SCEC_EXISTING_VALUE = 4
+ SCEC_EXCEEDED_LIMIT = 5
+ SCEC_INVALID_ACTION = 6
+ SCEC_INTERNAL_ERROR = 7
+ SCEC_UNEXPECTED_TYPE = 8
+ SCEC_UNEXPECTED_SIZE = 9
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCErrorCode:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCErrorCode:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCErrorCode:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_error_type.py b/stellar_sdk/xdr/sc_error_type.py
new file mode 100644
index 000000000..e1016eb09
--- /dev/null
+++ b/stellar_sdk/xdr/sc_error_type.py
@@ -0,0 +1,68 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SCErrorType"]
+
+
+class SCErrorType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SCErrorType
+ {
+ SCE_CONTRACT = 0, // Contract-specific, user-defined codes.
+ SCE_WASM_VM = 1, // Errors while interpreting WASM bytecode.
+ SCE_CONTEXT = 2, // Errors in the contract's host context.
+ SCE_STORAGE = 3, // Errors accessing host storage.
+ SCE_OBJECT = 4, // Errors working with host objects.
+ SCE_CRYPTO = 5, // Errors in cryptographic operations.
+ SCE_EVENTS = 6, // Errors while emitting events.
+ SCE_BUDGET = 7, // Errors relating to budget limits.
+ SCE_VALUE = 8, // Errors working with host values or SCVals.
+ SCE_AUTH = 9 // Errors from the authentication subsystem.
+ };
+ """
+
+ SCE_CONTRACT = 0
+ SCE_WASM_VM = 1
+ SCE_CONTEXT = 2
+ SCE_STORAGE = 3
+ SCE_OBJECT = 4
+ SCE_CRYPTO = 5
+ SCE_EVENTS = 6
+ SCE_BUDGET = 7
+ SCE_VALUE = 8
+ SCE_AUTH = 9
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCErrorType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCErrorType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCErrorType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_map.py b/stellar_sdk/xdr/sc_map.py
new file mode 100644
index 000000000..bae37e968
--- /dev/null
+++ b/stellar_sdk/xdr/sc_map.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_map_entry import SCMapEntry
+
+__all__ = ["SCMap"]
+
+
+class SCMap:
+ """
+ XDR Source Code::
+
+ typedef SCMapEntry SCMap<>;
+ """
+
+ def __init__(self, sc_map: List[SCMapEntry]) -> None:
+ _expect_max_length = 4294967295
+ if sc_map and len(sc_map) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `sc_map` should be {_expect_max_length}, but got {len(sc_map)}."
+ )
+ self.sc_map = sc_map
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_uint(len(self.sc_map))
+ for sc_map_item in self.sc_map:
+ sc_map_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCMap:
+ length = unpacker.unpack_uint()
+ sc_map = []
+ for _ in range(length):
+ sc_map.append(SCMapEntry.unpack(unpacker))
+ return cls(sc_map)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCMap:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCMap:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(self.sc_map)
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.sc_map == other.sc_map
+
+ def __str__(self):
+ return f""
diff --git a/stellar_sdk/xdr/sc_map_entry.py b/stellar_sdk/xdr/sc_map_entry.py
new file mode 100644
index 000000000..d8fb15ae2
--- /dev/null
+++ b/stellar_sdk/xdr/sc_map_entry.py
@@ -0,0 +1,83 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_val import SCVal
+
+__all__ = ["SCMapEntry"]
+
+
+class SCMapEntry:
+ """
+ XDR Source Code::
+
+ struct SCMapEntry
+ {
+ SCVal key;
+ SCVal val;
+ };
+ """
+
+ def __init__(
+ self,
+ key: SCVal,
+ val: SCVal,
+ ) -> None:
+ self.key = key
+ self.val = val
+
+ def pack(self, packer: Packer) -> None:
+ self.key.pack(packer)
+ self.val.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCMapEntry:
+ key = SCVal.unpack(unpacker)
+ val = SCVal.unpack(unpacker)
+ return cls(
+ key=key,
+ val=val,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCMapEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCMapEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.key,
+ self.val,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.key == other.key and self.val == other.val
+
+ def __str__(self):
+ out = [
+ f"key={self.key}",
+ f"val={self.val}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_meta_entry.py b/stellar_sdk/xdr/sc_meta_entry.py
new file mode 100644
index 000000000..b79182bc1
--- /dev/null
+++ b/stellar_sdk/xdr/sc_meta_entry.py
@@ -0,0 +1,86 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_meta_kind import SCMetaKind
+from .sc_meta_v0 import SCMetaV0
+
+__all__ = ["SCMetaEntry"]
+
+
+class SCMetaEntry:
+ """
+ XDR Source Code::
+
+ union SCMetaEntry switch (SCMetaKind kind)
+ {
+ case SC_META_V0:
+ SCMetaV0 v0;
+ };
+ """
+
+ def __init__(
+ self,
+ kind: SCMetaKind,
+ v0: SCMetaV0 = None,
+ ) -> None:
+ self.kind = kind
+ self.v0 = v0
+
+ def pack(self, packer: Packer) -> None:
+ self.kind.pack(packer)
+ if self.kind == SCMetaKind.SC_META_V0:
+ if self.v0 is None:
+ raise ValueError("v0 should not be None.")
+ self.v0.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCMetaEntry:
+ kind = SCMetaKind.unpack(unpacker)
+ if kind == SCMetaKind.SC_META_V0:
+ v0 = SCMetaV0.unpack(unpacker)
+ return cls(kind=kind, v0=v0)
+ return cls(kind=kind)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCMetaEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCMetaEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.kind,
+ self.v0,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.kind == other.kind and self.v0 == other.v0
+
+ def __str__(self):
+ out = []
+ out.append(f"kind={self.kind}")
+ out.append(f"v0={self.v0}") if self.v0 is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/sc_meta_kind.py b/stellar_sdk/xdr/sc_meta_kind.py
new file mode 100644
index 000000000..41e1a9319
--- /dev/null
+++ b/stellar_sdk/xdr/sc_meta_kind.py
@@ -0,0 +1,50 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SCMetaKind"]
+
+
+class SCMetaKind(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SCMetaKind
+ {
+ SC_META_V0 = 0
+ };
+ """
+
+ SC_META_V0 = 0
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCMetaKind:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCMetaKind:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCMetaKind:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_meta_v0.py b/stellar_sdk/xdr/sc_meta_v0.py
new file mode 100644
index 000000000..ed1a9e491
--- /dev/null
+++ b/stellar_sdk/xdr/sc_meta_v0.py
@@ -0,0 +1,83 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+
+__all__ = ["SCMetaV0"]
+
+
+class SCMetaV0:
+ """
+ XDR Source Code::
+
+ struct SCMetaV0
+ {
+ string key<>;
+ string val<>;
+ };
+ """
+
+ def __init__(
+ self,
+ key: bytes,
+ val: bytes,
+ ) -> None:
+ self.key = key
+ self.val = val
+
+ def pack(self, packer: Packer) -> None:
+ String(self.key, 4294967295).pack(packer)
+ String(self.val, 4294967295).pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCMetaV0:
+ key = String.unpack(unpacker)
+ val = String.unpack(unpacker)
+ return cls(
+ key=key,
+ val=val,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCMetaV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCMetaV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.key,
+ self.val,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.key == other.key and self.val == other.val
+
+ def __str__(self):
+ out = [
+ f"key={self.key}",
+ f"val={self.val}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_nonce_key.py b/stellar_sdk/xdr/sc_nonce_key.py
new file mode 100644
index 000000000..da3ca6acf
--- /dev/null
+++ b/stellar_sdk/xdr/sc_nonce_key.py
@@ -0,0 +1,70 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+
+__all__ = ["SCNonceKey"]
+
+
+class SCNonceKey:
+ """
+ XDR Source Code::
+
+ struct SCNonceKey {
+ int64 nonce;
+ };
+ """
+
+ def __init__(
+ self,
+ nonce: Int64,
+ ) -> None:
+ self.nonce = nonce
+
+ def pack(self, packer: Packer) -> None:
+ self.nonce.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCNonceKey:
+ nonce = Int64.unpack(unpacker)
+ return cls(
+ nonce=nonce,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCNonceKey:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCNonceKey:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.nonce,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.nonce == other.nonce
+
+ def __str__(self):
+ out = [
+ f"nonce={self.nonce}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_entry.py b/stellar_sdk/xdr/sc_spec_entry.py
new file mode 100644
index 000000000..cc63cd835
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_entry.py
@@ -0,0 +1,163 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_spec_entry_kind import SCSpecEntryKind
+from .sc_spec_function_v0 import SCSpecFunctionV0
+from .sc_spec_udt_enum_v0 import SCSpecUDTEnumV0
+from .sc_spec_udt_error_enum_v0 import SCSpecUDTErrorEnumV0
+from .sc_spec_udt_struct_v0 import SCSpecUDTStructV0
+from .sc_spec_udt_union_v0 import SCSpecUDTUnionV0
+
+__all__ = ["SCSpecEntry"]
+
+
+class SCSpecEntry:
+ """
+ XDR Source Code::
+
+ union SCSpecEntry switch (SCSpecEntryKind kind)
+ {
+ case SC_SPEC_ENTRY_FUNCTION_V0:
+ SCSpecFunctionV0 functionV0;
+ case SC_SPEC_ENTRY_UDT_STRUCT_V0:
+ SCSpecUDTStructV0 udtStructV0;
+ case SC_SPEC_ENTRY_UDT_UNION_V0:
+ SCSpecUDTUnionV0 udtUnionV0;
+ case SC_SPEC_ENTRY_UDT_ENUM_V0:
+ SCSpecUDTEnumV0 udtEnumV0;
+ case SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0:
+ SCSpecUDTErrorEnumV0 udtErrorEnumV0;
+ };
+ """
+
+ def __init__(
+ self,
+ kind: SCSpecEntryKind,
+ function_v0: SCSpecFunctionV0 = None,
+ udt_struct_v0: SCSpecUDTStructV0 = None,
+ udt_union_v0: SCSpecUDTUnionV0 = None,
+ udt_enum_v0: SCSpecUDTEnumV0 = None,
+ udt_error_enum_v0: SCSpecUDTErrorEnumV0 = None,
+ ) -> None:
+ self.kind = kind
+ self.function_v0 = function_v0
+ self.udt_struct_v0 = udt_struct_v0
+ self.udt_union_v0 = udt_union_v0
+ self.udt_enum_v0 = udt_enum_v0
+ self.udt_error_enum_v0 = udt_error_enum_v0
+
+ def pack(self, packer: Packer) -> None:
+ self.kind.pack(packer)
+ if self.kind == SCSpecEntryKind.SC_SPEC_ENTRY_FUNCTION_V0:
+ if self.function_v0 is None:
+ raise ValueError("function_v0 should not be None.")
+ self.function_v0.pack(packer)
+ return
+ if self.kind == SCSpecEntryKind.SC_SPEC_ENTRY_UDT_STRUCT_V0:
+ if self.udt_struct_v0 is None:
+ raise ValueError("udt_struct_v0 should not be None.")
+ self.udt_struct_v0.pack(packer)
+ return
+ if self.kind == SCSpecEntryKind.SC_SPEC_ENTRY_UDT_UNION_V0:
+ if self.udt_union_v0 is None:
+ raise ValueError("udt_union_v0 should not be None.")
+ self.udt_union_v0.pack(packer)
+ return
+ if self.kind == SCSpecEntryKind.SC_SPEC_ENTRY_UDT_ENUM_V0:
+ if self.udt_enum_v0 is None:
+ raise ValueError("udt_enum_v0 should not be None.")
+ self.udt_enum_v0.pack(packer)
+ return
+ if self.kind == SCSpecEntryKind.SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0:
+ if self.udt_error_enum_v0 is None:
+ raise ValueError("udt_error_enum_v0 should not be None.")
+ self.udt_error_enum_v0.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecEntry:
+ kind = SCSpecEntryKind.unpack(unpacker)
+ if kind == SCSpecEntryKind.SC_SPEC_ENTRY_FUNCTION_V0:
+ function_v0 = SCSpecFunctionV0.unpack(unpacker)
+ return cls(kind=kind, function_v0=function_v0)
+ if kind == SCSpecEntryKind.SC_SPEC_ENTRY_UDT_STRUCT_V0:
+ udt_struct_v0 = SCSpecUDTStructV0.unpack(unpacker)
+ return cls(kind=kind, udt_struct_v0=udt_struct_v0)
+ if kind == SCSpecEntryKind.SC_SPEC_ENTRY_UDT_UNION_V0:
+ udt_union_v0 = SCSpecUDTUnionV0.unpack(unpacker)
+ return cls(kind=kind, udt_union_v0=udt_union_v0)
+ if kind == SCSpecEntryKind.SC_SPEC_ENTRY_UDT_ENUM_V0:
+ udt_enum_v0 = SCSpecUDTEnumV0.unpack(unpacker)
+ return cls(kind=kind, udt_enum_v0=udt_enum_v0)
+ if kind == SCSpecEntryKind.SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0:
+ udt_error_enum_v0 = SCSpecUDTErrorEnumV0.unpack(unpacker)
+ return cls(kind=kind, udt_error_enum_v0=udt_error_enum_v0)
+ return cls(kind=kind)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.kind,
+ self.function_v0,
+ self.udt_struct_v0,
+ self.udt_union_v0,
+ self.udt_enum_v0,
+ self.udt_error_enum_v0,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.kind == other.kind
+ and self.function_v0 == other.function_v0
+ and self.udt_struct_v0 == other.udt_struct_v0
+ and self.udt_union_v0 == other.udt_union_v0
+ and self.udt_enum_v0 == other.udt_enum_v0
+ and self.udt_error_enum_v0 == other.udt_error_enum_v0
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"kind={self.kind}")
+ out.append(
+ f"function_v0={self.function_v0}"
+ ) if self.function_v0 is not None else None
+ out.append(
+ f"udt_struct_v0={self.udt_struct_v0}"
+ ) if self.udt_struct_v0 is not None else None
+ out.append(
+ f"udt_union_v0={self.udt_union_v0}"
+ ) if self.udt_union_v0 is not None else None
+ out.append(
+ f"udt_enum_v0={self.udt_enum_v0}"
+ ) if self.udt_enum_v0 is not None else None
+ out.append(
+ f"udt_error_enum_v0={self.udt_error_enum_v0}"
+ ) if self.udt_error_enum_v0 is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_entry_kind.py b/stellar_sdk/xdr/sc_spec_entry_kind.py
new file mode 100644
index 000000000..4fbe9b36d
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_entry_kind.py
@@ -0,0 +1,58 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SCSpecEntryKind"]
+
+
+class SCSpecEntryKind(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SCSpecEntryKind
+ {
+ SC_SPEC_ENTRY_FUNCTION_V0 = 0,
+ SC_SPEC_ENTRY_UDT_STRUCT_V0 = 1,
+ SC_SPEC_ENTRY_UDT_UNION_V0 = 2,
+ SC_SPEC_ENTRY_UDT_ENUM_V0 = 3,
+ SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0 = 4
+ };
+ """
+
+ SC_SPEC_ENTRY_FUNCTION_V0 = 0
+ SC_SPEC_ENTRY_UDT_STRUCT_V0 = 1
+ SC_SPEC_ENTRY_UDT_UNION_V0 = 2
+ SC_SPEC_ENTRY_UDT_ENUM_V0 = 3
+ SC_SPEC_ENTRY_UDT_ERROR_ENUM_V0 = 4
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecEntryKind:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecEntryKind:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecEntryKind:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_spec_function_input_v0.py b/stellar_sdk/xdr/sc_spec_function_input_v0.py
new file mode 100644
index 000000000..ab2e36f58
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_function_input_v0.py
@@ -0,0 +1,97 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .sc_spec_type_def import SCSpecTypeDef
+
+__all__ = ["SCSpecFunctionInputV0"]
+
+
+class SCSpecFunctionInputV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecFunctionInputV0
+ {
+ string doc;
+ string name<30>;
+ SCSpecTypeDef type;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ name: bytes,
+ type: SCSpecTypeDef,
+ ) -> None:
+ self.doc = doc
+ self.name = name
+ self.type = type
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.name, 30).pack(packer)
+ self.type.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecFunctionInputV0:
+ doc = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ type = SCSpecTypeDef.unpack(unpacker)
+ return cls(
+ doc=doc,
+ name=name,
+ type=type,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecFunctionInputV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecFunctionInputV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.name,
+ self.type,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.name == other.name
+ and self.type == other.type
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"name={self.name}",
+ f"type={self.type}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_function_v0.py b/stellar_sdk/xdr/sc_spec_function_v0.py
new file mode 100644
index 000000000..fd370fa48
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_function_v0.py
@@ -0,0 +1,129 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .sc_spec_function_input_v0 import SCSpecFunctionInputV0
+from .sc_spec_type_def import SCSpecTypeDef
+from .sc_symbol import SCSymbol
+
+__all__ = ["SCSpecFunctionV0"]
+
+
+class SCSpecFunctionV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecFunctionV0
+ {
+ string doc;
+ SCSymbol name;
+ SCSpecFunctionInputV0 inputs<10>;
+ SCSpecTypeDef outputs<1>;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ name: SCSymbol,
+ inputs: List[SCSpecFunctionInputV0],
+ outputs: List[SCSpecTypeDef],
+ ) -> None:
+ _expect_max_length = 10
+ if inputs and len(inputs) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `inputs` should be {_expect_max_length}, but got {len(inputs)}."
+ )
+ _expect_max_length = 1
+ if outputs and len(outputs) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `outputs` should be {_expect_max_length}, but got {len(outputs)}."
+ )
+ self.doc = doc
+ self.name = name
+ self.inputs = inputs
+ self.outputs = outputs
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ self.name.pack(packer)
+ packer.pack_uint(len(self.inputs))
+ for inputs_item in self.inputs:
+ inputs_item.pack(packer)
+ packer.pack_uint(len(self.outputs))
+ for outputs_item in self.outputs:
+ outputs_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecFunctionV0:
+ doc = String.unpack(unpacker)
+ name = SCSymbol.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ inputs = []
+ for _ in range(length):
+ inputs.append(SCSpecFunctionInputV0.unpack(unpacker))
+ length = unpacker.unpack_uint()
+ outputs = []
+ for _ in range(length):
+ outputs.append(SCSpecTypeDef.unpack(unpacker))
+ return cls(
+ doc=doc,
+ name=name,
+ inputs=inputs,
+ outputs=outputs,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecFunctionV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecFunctionV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.name,
+ self.inputs,
+ self.outputs,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.name == other.name
+ and self.inputs == other.inputs
+ and self.outputs == other.outputs
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"name={self.name}",
+ f"inputs={self.inputs}",
+ f"outputs={self.outputs}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_type.py b/stellar_sdk/xdr/sc_spec_type.py
new file mode 100644
index 000000000..84a1525c1
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_type.py
@@ -0,0 +1,104 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SCSpecType"]
+
+
+class SCSpecType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SCSpecType
+ {
+ SC_SPEC_TYPE_VAL = 0,
+
+ // Types with no parameters.
+ SC_SPEC_TYPE_BOOL = 1,
+ SC_SPEC_TYPE_VOID = 2,
+ SC_SPEC_TYPE_ERROR = 3,
+ SC_SPEC_TYPE_U32 = 4,
+ SC_SPEC_TYPE_I32 = 5,
+ SC_SPEC_TYPE_U64 = 6,
+ SC_SPEC_TYPE_I64 = 7,
+ SC_SPEC_TYPE_TIMEPOINT = 8,
+ SC_SPEC_TYPE_DURATION = 9,
+ SC_SPEC_TYPE_U128 = 10,
+ SC_SPEC_TYPE_I128 = 11,
+ SC_SPEC_TYPE_U256 = 12,
+ SC_SPEC_TYPE_I256 = 13,
+ SC_SPEC_TYPE_BYTES = 14,
+ SC_SPEC_TYPE_STRING = 16,
+ SC_SPEC_TYPE_SYMBOL = 17,
+ SC_SPEC_TYPE_ADDRESS = 19,
+
+ // Types with parameters.
+ SC_SPEC_TYPE_OPTION = 1000,
+ SC_SPEC_TYPE_RESULT = 1001,
+ SC_SPEC_TYPE_VEC = 1002,
+ SC_SPEC_TYPE_MAP = 1004,
+ SC_SPEC_TYPE_TUPLE = 1005,
+ SC_SPEC_TYPE_BYTES_N = 1006,
+
+ // User defined types.
+ SC_SPEC_TYPE_UDT = 2000
+ };
+ """
+
+ SC_SPEC_TYPE_VAL = 0
+ SC_SPEC_TYPE_BOOL = 1
+ SC_SPEC_TYPE_VOID = 2
+ SC_SPEC_TYPE_ERROR = 3
+ SC_SPEC_TYPE_U32 = 4
+ SC_SPEC_TYPE_I32 = 5
+ SC_SPEC_TYPE_U64 = 6
+ SC_SPEC_TYPE_I64 = 7
+ SC_SPEC_TYPE_TIMEPOINT = 8
+ SC_SPEC_TYPE_DURATION = 9
+ SC_SPEC_TYPE_U128 = 10
+ SC_SPEC_TYPE_I128 = 11
+ SC_SPEC_TYPE_U256 = 12
+ SC_SPEC_TYPE_I256 = 13
+ SC_SPEC_TYPE_BYTES = 14
+ SC_SPEC_TYPE_STRING = 16
+ SC_SPEC_TYPE_SYMBOL = 17
+ SC_SPEC_TYPE_ADDRESS = 19
+ SC_SPEC_TYPE_OPTION = 1000
+ SC_SPEC_TYPE_RESULT = 1001
+ SC_SPEC_TYPE_VEC = 1002
+ SC_SPEC_TYPE_MAP = 1004
+ SC_SPEC_TYPE_TUPLE = 1005
+ SC_SPEC_TYPE_BYTES_N = 1006
+ SC_SPEC_TYPE_UDT = 2000
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_spec_type_bytes_n.py b/stellar_sdk/xdr/sc_spec_type_bytes_n.py
new file mode 100644
index 000000000..3a65330fc
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_type_bytes_n.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .uint32 import Uint32
+
+__all__ = ["SCSpecTypeBytesN"]
+
+
+class SCSpecTypeBytesN:
+ """
+ XDR Source Code::
+
+ struct SCSpecTypeBytesN
+ {
+ uint32 n;
+ };
+ """
+
+ def __init__(
+ self,
+ n: Uint32,
+ ) -> None:
+ self.n = n
+
+ def pack(self, packer: Packer) -> None:
+ self.n.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecTypeBytesN:
+ n = Uint32.unpack(unpacker)
+ return cls(
+ n=n,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecTypeBytesN:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecTypeBytesN:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.n,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.n == other.n
+
+ def __str__(self):
+ out = [
+ f"n={self.n}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_type_def.py b/stellar_sdk/xdr/sc_spec_type_def.py
new file mode 100644
index 000000000..27d9f552d
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_type_def.py
@@ -0,0 +1,292 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import TYPE_CHECKING
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_spec_type import SCSpecType
+
+if TYPE_CHECKING:
+ from .sc_spec_type_bytes_n import SCSpecTypeBytesN
+ from .sc_spec_type_map import SCSpecTypeMap
+ from .sc_spec_type_option import SCSpecTypeOption
+ from .sc_spec_type_result import SCSpecTypeResult
+ from .sc_spec_type_tuple import SCSpecTypeTuple
+ from .sc_spec_type_udt import SCSpecTypeUDT
+ from .sc_spec_type_vec import SCSpecTypeVec
+__all__ = ["SCSpecTypeDef"]
+
+
+class SCSpecTypeDef:
+ """
+ XDR Source Code::
+
+ union SCSpecTypeDef switch (SCSpecType type)
+ {
+ case SC_SPEC_TYPE_VAL:
+ case SC_SPEC_TYPE_BOOL:
+ case SC_SPEC_TYPE_VOID:
+ case SC_SPEC_TYPE_ERROR:
+ case SC_SPEC_TYPE_U32:
+ case SC_SPEC_TYPE_I32:
+ case SC_SPEC_TYPE_U64:
+ case SC_SPEC_TYPE_I64:
+ case SC_SPEC_TYPE_TIMEPOINT:
+ case SC_SPEC_TYPE_DURATION:
+ case SC_SPEC_TYPE_U128:
+ case SC_SPEC_TYPE_I128:
+ case SC_SPEC_TYPE_U256:
+ case SC_SPEC_TYPE_I256:
+ case SC_SPEC_TYPE_BYTES:
+ case SC_SPEC_TYPE_STRING:
+ case SC_SPEC_TYPE_SYMBOL:
+ case SC_SPEC_TYPE_ADDRESS:
+ void;
+ case SC_SPEC_TYPE_OPTION:
+ SCSpecTypeOption option;
+ case SC_SPEC_TYPE_RESULT:
+ SCSpecTypeResult result;
+ case SC_SPEC_TYPE_VEC:
+ SCSpecTypeVec vec;
+ case SC_SPEC_TYPE_MAP:
+ SCSpecTypeMap map;
+ case SC_SPEC_TYPE_TUPLE:
+ SCSpecTypeTuple tuple;
+ case SC_SPEC_TYPE_BYTES_N:
+ SCSpecTypeBytesN bytesN;
+ case SC_SPEC_TYPE_UDT:
+ SCSpecTypeUDT udt;
+ };
+ """
+
+ def __init__(
+ self,
+ type: SCSpecType,
+ option: SCSpecTypeOption = None,
+ result: SCSpecTypeResult = None,
+ vec: SCSpecTypeVec = None,
+ map: SCSpecTypeMap = None,
+ tuple: SCSpecTypeTuple = None,
+ bytes_n: SCSpecTypeBytesN = None,
+ udt: SCSpecTypeUDT = None,
+ ) -> None:
+ self.type = type
+ self.option = option
+ self.result = result
+ self.vec = vec
+ self.map = map
+ self.tuple = tuple
+ self.bytes_n = bytes_n
+ self.udt = udt
+
+ def pack(self, packer: Packer) -> None:
+ self.type.pack(packer)
+ if self.type == SCSpecType.SC_SPEC_TYPE_VAL:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_BOOL:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_VOID:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_ERROR:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_U32:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_I32:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_U64:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_I64:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_TIMEPOINT:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_DURATION:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_U128:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_I128:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_U256:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_I256:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_BYTES:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_STRING:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_SYMBOL:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_ADDRESS:
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_OPTION:
+ if self.option is None:
+ raise ValueError("option should not be None.")
+ self.option.pack(packer)
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_RESULT:
+ if self.result is None:
+ raise ValueError("result should not be None.")
+ self.result.pack(packer)
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_VEC:
+ if self.vec is None:
+ raise ValueError("vec should not be None.")
+ self.vec.pack(packer)
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_MAP:
+ if self.map is None:
+ raise ValueError("map should not be None.")
+ self.map.pack(packer)
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_TUPLE:
+ if self.tuple is None:
+ raise ValueError("tuple should not be None.")
+ self.tuple.pack(packer)
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_BYTES_N:
+ if self.bytes_n is None:
+ raise ValueError("bytes_n should not be None.")
+ self.bytes_n.pack(packer)
+ return
+ if self.type == SCSpecType.SC_SPEC_TYPE_UDT:
+ if self.udt is None:
+ raise ValueError("udt should not be None.")
+ self.udt.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecTypeDef:
+ type = SCSpecType.unpack(unpacker)
+ if type == SCSpecType.SC_SPEC_TYPE_VAL:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_BOOL:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_VOID:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_ERROR:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_U32:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_I32:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_U64:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_I64:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_TIMEPOINT:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_DURATION:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_U128:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_I128:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_U256:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_I256:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_BYTES:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_STRING:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_SYMBOL:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_ADDRESS:
+ return cls(type=type)
+ if type == SCSpecType.SC_SPEC_TYPE_OPTION:
+ from .sc_spec_type_option import SCSpecTypeOption
+
+ option = SCSpecTypeOption.unpack(unpacker)
+ return cls(type=type, option=option)
+ if type == SCSpecType.SC_SPEC_TYPE_RESULT:
+ from .sc_spec_type_result import SCSpecTypeResult
+
+ result = SCSpecTypeResult.unpack(unpacker)
+ return cls(type=type, result=result)
+ if type == SCSpecType.SC_SPEC_TYPE_VEC:
+ from .sc_spec_type_vec import SCSpecTypeVec
+
+ vec = SCSpecTypeVec.unpack(unpacker)
+ return cls(type=type, vec=vec)
+ if type == SCSpecType.SC_SPEC_TYPE_MAP:
+ from .sc_spec_type_map import SCSpecTypeMap
+
+ map = SCSpecTypeMap.unpack(unpacker)
+ return cls(type=type, map=map)
+ if type == SCSpecType.SC_SPEC_TYPE_TUPLE:
+ from .sc_spec_type_tuple import SCSpecTypeTuple
+
+ tuple = SCSpecTypeTuple.unpack(unpacker)
+ return cls(type=type, tuple=tuple)
+ if type == SCSpecType.SC_SPEC_TYPE_BYTES_N:
+ from .sc_spec_type_bytes_n import SCSpecTypeBytesN
+
+ bytes_n = SCSpecTypeBytesN.unpack(unpacker)
+ return cls(type=type, bytes_n=bytes_n)
+ if type == SCSpecType.SC_SPEC_TYPE_UDT:
+ from .sc_spec_type_udt import SCSpecTypeUDT
+
+ udt = SCSpecTypeUDT.unpack(unpacker)
+ return cls(type=type, udt=udt)
+ return cls(type=type)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecTypeDef:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecTypeDef:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.option,
+ self.result,
+ self.vec,
+ self.map,
+ self.tuple,
+ self.bytes_n,
+ self.udt,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.type == other.type
+ and self.option == other.option
+ and self.result == other.result
+ and self.vec == other.vec
+ and self.map == other.map
+ and self.tuple == other.tuple
+ and self.bytes_n == other.bytes_n
+ and self.udt == other.udt
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"type={self.type}")
+ out.append(f"option={self.option}") if self.option is not None else None
+ out.append(f"result={self.result}") if self.result is not None else None
+ out.append(f"vec={self.vec}") if self.vec is not None else None
+ out.append(f"map={self.map}") if self.map is not None else None
+ out.append(f"tuple={self.tuple}") if self.tuple is not None else None
+ out.append(f"bytes_n={self.bytes_n}") if self.bytes_n is not None else None
+ out.append(f"udt={self.udt}") if self.udt is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_type_map.py b/stellar_sdk/xdr/sc_spec_type_map.py
new file mode 100644
index 000000000..cb1265775
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_type_map.py
@@ -0,0 +1,83 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_spec_type_def import SCSpecTypeDef
+
+__all__ = ["SCSpecTypeMap"]
+
+
+class SCSpecTypeMap:
+ """
+ XDR Source Code::
+
+ struct SCSpecTypeMap
+ {
+ SCSpecTypeDef keyType;
+ SCSpecTypeDef valueType;
+ };
+ """
+
+ def __init__(
+ self,
+ key_type: SCSpecTypeDef,
+ value_type: SCSpecTypeDef,
+ ) -> None:
+ self.key_type = key_type
+ self.value_type = value_type
+
+ def pack(self, packer: Packer) -> None:
+ self.key_type.pack(packer)
+ self.value_type.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecTypeMap:
+ key_type = SCSpecTypeDef.unpack(unpacker)
+ value_type = SCSpecTypeDef.unpack(unpacker)
+ return cls(
+ key_type=key_type,
+ value_type=value_type,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecTypeMap:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecTypeMap:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.key_type,
+ self.value_type,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.key_type == other.key_type and self.value_type == other.value_type
+
+ def __str__(self):
+ out = [
+ f"key_type={self.key_type}",
+ f"value_type={self.value_type}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_type_option.py b/stellar_sdk/xdr/sc_spec_type_option.py
new file mode 100644
index 000000000..29a68bca1
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_type_option.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_spec_type_def import SCSpecTypeDef
+
+__all__ = ["SCSpecTypeOption"]
+
+
+class SCSpecTypeOption:
+ """
+ XDR Source Code::
+
+ struct SCSpecTypeOption
+ {
+ SCSpecTypeDef valueType;
+ };
+ """
+
+ def __init__(
+ self,
+ value_type: SCSpecTypeDef,
+ ) -> None:
+ self.value_type = value_type
+
+ def pack(self, packer: Packer) -> None:
+ self.value_type.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecTypeOption:
+ value_type = SCSpecTypeDef.unpack(unpacker)
+ return cls(
+ value_type=value_type,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecTypeOption:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecTypeOption:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.value_type,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.value_type == other.value_type
+
+ def __str__(self):
+ out = [
+ f"value_type={self.value_type}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_type_result.py b/stellar_sdk/xdr/sc_spec_type_result.py
new file mode 100644
index 000000000..94fdc985a
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_type_result.py
@@ -0,0 +1,83 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_spec_type_def import SCSpecTypeDef
+
+__all__ = ["SCSpecTypeResult"]
+
+
+class SCSpecTypeResult:
+ """
+ XDR Source Code::
+
+ struct SCSpecTypeResult
+ {
+ SCSpecTypeDef okType;
+ SCSpecTypeDef errorType;
+ };
+ """
+
+ def __init__(
+ self,
+ ok_type: SCSpecTypeDef,
+ error_type: SCSpecTypeDef,
+ ) -> None:
+ self.ok_type = ok_type
+ self.error_type = error_type
+
+ def pack(self, packer: Packer) -> None:
+ self.ok_type.pack(packer)
+ self.error_type.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecTypeResult:
+ ok_type = SCSpecTypeDef.unpack(unpacker)
+ error_type = SCSpecTypeDef.unpack(unpacker)
+ return cls(
+ ok_type=ok_type,
+ error_type=error_type,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecTypeResult:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecTypeResult:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ok_type,
+ self.error_type,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.ok_type == other.ok_type and self.error_type == other.error_type
+
+ def __str__(self):
+ out = [
+ f"ok_type={self.ok_type}",
+ f"error_type={self.error_type}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_type_tuple.py b/stellar_sdk/xdr/sc_spec_type_tuple.py
new file mode 100644
index 000000000..4e4c14d50
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_type_tuple.py
@@ -0,0 +1,82 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_spec_type_def import SCSpecTypeDef
+
+__all__ = ["SCSpecTypeTuple"]
+
+
+class SCSpecTypeTuple:
+ """
+ XDR Source Code::
+
+ struct SCSpecTypeTuple
+ {
+ SCSpecTypeDef valueTypes<12>;
+ };
+ """
+
+ def __init__(
+ self,
+ value_types: List[SCSpecTypeDef],
+ ) -> None:
+ _expect_max_length = 12
+ if value_types and len(value_types) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `value_types` should be {_expect_max_length}, but got {len(value_types)}."
+ )
+ self.value_types = value_types
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_uint(len(self.value_types))
+ for value_types_item in self.value_types:
+ value_types_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecTypeTuple:
+ length = unpacker.unpack_uint()
+ value_types = []
+ for _ in range(length):
+ value_types.append(SCSpecTypeDef.unpack(unpacker))
+ return cls(
+ value_types=value_types,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecTypeTuple:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecTypeTuple:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.value_types,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.value_types == other.value_types
+
+ def __str__(self):
+ out = [
+ f"value_types={self.value_types}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_type_udt.py b/stellar_sdk/xdr/sc_spec_type_udt.py
new file mode 100644
index 000000000..e67a19ed6
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_type_udt.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+
+__all__ = ["SCSpecTypeUDT"]
+
+
+class SCSpecTypeUDT:
+ """
+ XDR Source Code::
+
+ struct SCSpecTypeUDT
+ {
+ string name<60>;
+ };
+ """
+
+ def __init__(
+ self,
+ name: bytes,
+ ) -> None:
+ self.name = name
+
+ def pack(self, packer: Packer) -> None:
+ String(self.name, 60).pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecTypeUDT:
+ name = String.unpack(unpacker)
+ return cls(
+ name=name,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecTypeUDT:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecTypeUDT:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.name,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.name == other.name
+
+ def __str__(self):
+ out = [
+ f"name={self.name}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_type_vec.py b/stellar_sdk/xdr/sc_spec_type_vec.py
new file mode 100644
index 000000000..4dbbb4432
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_type_vec.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_spec_type_def import SCSpecTypeDef
+
+__all__ = ["SCSpecTypeVec"]
+
+
+class SCSpecTypeVec:
+ """
+ XDR Source Code::
+
+ struct SCSpecTypeVec
+ {
+ SCSpecTypeDef elementType;
+ };
+ """
+
+ def __init__(
+ self,
+ element_type: SCSpecTypeDef,
+ ) -> None:
+ self.element_type = element_type
+
+ def pack(self, packer: Packer) -> None:
+ self.element_type.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecTypeVec:
+ element_type = SCSpecTypeDef.unpack(unpacker)
+ return cls(
+ element_type=element_type,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecTypeVec:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecTypeVec:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash((self.element_type,))
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.element_type == other.element_type
+
+ def __str__(self):
+ out = [
+ f"element_type={self.element_type}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_enum_case_v0.py b/stellar_sdk/xdr/sc_spec_udt_enum_case_v0.py
new file mode 100644
index 000000000..730f4e1d5
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_enum_case_v0.py
@@ -0,0 +1,97 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .uint32 import Uint32
+
+__all__ = ["SCSpecUDTEnumCaseV0"]
+
+
+class SCSpecUDTEnumCaseV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecUDTEnumCaseV0
+ {
+ string doc;
+ string name<60>;
+ uint32 value;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ name: bytes,
+ value: Uint32,
+ ) -> None:
+ self.doc = doc
+ self.name = name
+ self.value = value
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.name, 60).pack(packer)
+ self.value.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTEnumCaseV0:
+ doc = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ value = Uint32.unpack(unpacker)
+ return cls(
+ doc=doc,
+ name=name,
+ value=value,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTEnumCaseV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTEnumCaseV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.name,
+ self.value,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.name == other.name
+ and self.value == other.value
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"name={self.name}",
+ f"value={self.value}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_enum_v0.py b/stellar_sdk/xdr/sc_spec_udt_enum_v0.py
new file mode 100644
index 000000000..86ef63934
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_enum_v0.py
@@ -0,0 +1,117 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .sc_spec_udt_enum_case_v0 import SCSpecUDTEnumCaseV0
+
+__all__ = ["SCSpecUDTEnumV0"]
+
+
+class SCSpecUDTEnumV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecUDTEnumV0
+ {
+ string doc;
+ string lib<80>;
+ string name<60>;
+ SCSpecUDTEnumCaseV0 cases<50>;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ lib: bytes,
+ name: bytes,
+ cases: List[SCSpecUDTEnumCaseV0],
+ ) -> None:
+ _expect_max_length = 50
+ if cases and len(cases) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `cases` should be {_expect_max_length}, but got {len(cases)}."
+ )
+ self.doc = doc
+ self.lib = lib
+ self.name = name
+ self.cases = cases
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.lib, 80).pack(packer)
+ String(self.name, 60).pack(packer)
+ packer.pack_uint(len(self.cases))
+ for cases_item in self.cases:
+ cases_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTEnumV0:
+ doc = String.unpack(unpacker)
+ lib = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ cases = []
+ for _ in range(length):
+ cases.append(SCSpecUDTEnumCaseV0.unpack(unpacker))
+ return cls(
+ doc=doc,
+ lib=lib,
+ name=name,
+ cases=cases,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTEnumV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTEnumV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.lib,
+ self.name,
+ self.cases,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.lib == other.lib
+ and self.name == other.name
+ and self.cases == other.cases
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"lib={self.lib}",
+ f"name={self.name}",
+ f"cases={self.cases}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_error_enum_case_v0.py b/stellar_sdk/xdr/sc_spec_udt_error_enum_case_v0.py
new file mode 100644
index 000000000..e2df585a4
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_error_enum_case_v0.py
@@ -0,0 +1,97 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .uint32 import Uint32
+
+__all__ = ["SCSpecUDTErrorEnumCaseV0"]
+
+
+class SCSpecUDTErrorEnumCaseV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecUDTErrorEnumCaseV0
+ {
+ string doc;
+ string name<60>;
+ uint32 value;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ name: bytes,
+ value: Uint32,
+ ) -> None:
+ self.doc = doc
+ self.name = name
+ self.value = value
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.name, 60).pack(packer)
+ self.value.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTErrorEnumCaseV0:
+ doc = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ value = Uint32.unpack(unpacker)
+ return cls(
+ doc=doc,
+ name=name,
+ value=value,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTErrorEnumCaseV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTErrorEnumCaseV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.name,
+ self.value,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.name == other.name
+ and self.value == other.value
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"name={self.name}",
+ f"value={self.value}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_error_enum_v0.py b/stellar_sdk/xdr/sc_spec_udt_error_enum_v0.py
new file mode 100644
index 000000000..fe1d8e25d
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_error_enum_v0.py
@@ -0,0 +1,117 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .sc_spec_udt_error_enum_case_v0 import SCSpecUDTErrorEnumCaseV0
+
+__all__ = ["SCSpecUDTErrorEnumV0"]
+
+
+class SCSpecUDTErrorEnumV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecUDTErrorEnumV0
+ {
+ string doc;
+ string lib<80>;
+ string name<60>;
+ SCSpecUDTErrorEnumCaseV0 cases<50>;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ lib: bytes,
+ name: bytes,
+ cases: List[SCSpecUDTErrorEnumCaseV0],
+ ) -> None:
+ _expect_max_length = 50
+ if cases and len(cases) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `cases` should be {_expect_max_length}, but got {len(cases)}."
+ )
+ self.doc = doc
+ self.lib = lib
+ self.name = name
+ self.cases = cases
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.lib, 80).pack(packer)
+ String(self.name, 60).pack(packer)
+ packer.pack_uint(len(self.cases))
+ for cases_item in self.cases:
+ cases_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTErrorEnumV0:
+ doc = String.unpack(unpacker)
+ lib = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ cases = []
+ for _ in range(length):
+ cases.append(SCSpecUDTErrorEnumCaseV0.unpack(unpacker))
+ return cls(
+ doc=doc,
+ lib=lib,
+ name=name,
+ cases=cases,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTErrorEnumV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTErrorEnumV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.lib,
+ self.name,
+ self.cases,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.lib == other.lib
+ and self.name == other.name
+ and self.cases == other.cases
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"lib={self.lib}",
+ f"name={self.name}",
+ f"cases={self.cases}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_struct_field_v0.py b/stellar_sdk/xdr/sc_spec_udt_struct_field_v0.py
new file mode 100644
index 000000000..c23621d60
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_struct_field_v0.py
@@ -0,0 +1,97 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .sc_spec_type_def import SCSpecTypeDef
+
+__all__ = ["SCSpecUDTStructFieldV0"]
+
+
+class SCSpecUDTStructFieldV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecUDTStructFieldV0
+ {
+ string doc;
+ string name<30>;
+ SCSpecTypeDef type;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ name: bytes,
+ type: SCSpecTypeDef,
+ ) -> None:
+ self.doc = doc
+ self.name = name
+ self.type = type
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.name, 30).pack(packer)
+ self.type.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTStructFieldV0:
+ doc = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ type = SCSpecTypeDef.unpack(unpacker)
+ return cls(
+ doc=doc,
+ name=name,
+ type=type,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTStructFieldV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTStructFieldV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.name,
+ self.type,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.name == other.name
+ and self.type == other.type
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"name={self.name}",
+ f"type={self.type}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_struct_v0.py b/stellar_sdk/xdr/sc_spec_udt_struct_v0.py
new file mode 100644
index 000000000..223f174ba
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_struct_v0.py
@@ -0,0 +1,117 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .sc_spec_udt_struct_field_v0 import SCSpecUDTStructFieldV0
+
+__all__ = ["SCSpecUDTStructV0"]
+
+
+class SCSpecUDTStructV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecUDTStructV0
+ {
+ string doc;
+ string lib<80>;
+ string name<60>;
+ SCSpecUDTStructFieldV0 fields<40>;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ lib: bytes,
+ name: bytes,
+ fields: List[SCSpecUDTStructFieldV0],
+ ) -> None:
+ _expect_max_length = 40
+ if fields and len(fields) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `fields` should be {_expect_max_length}, but got {len(fields)}."
+ )
+ self.doc = doc
+ self.lib = lib
+ self.name = name
+ self.fields = fields
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.lib, 80).pack(packer)
+ String(self.name, 60).pack(packer)
+ packer.pack_uint(len(self.fields))
+ for fields_item in self.fields:
+ fields_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTStructV0:
+ doc = String.unpack(unpacker)
+ lib = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ fields = []
+ for _ in range(length):
+ fields.append(SCSpecUDTStructFieldV0.unpack(unpacker))
+ return cls(
+ doc=doc,
+ lib=lib,
+ name=name,
+ fields=fields,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTStructV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTStructV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.lib,
+ self.name,
+ self.fields,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.lib == other.lib
+ and self.name == other.name
+ and self.fields == other.fields
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"lib={self.lib}",
+ f"name={self.name}",
+ f"fields={self.fields}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_union_case_tuple_v0.py b/stellar_sdk/xdr/sc_spec_udt_union_case_tuple_v0.py
new file mode 100644
index 000000000..262966349
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_union_case_tuple_v0.py
@@ -0,0 +1,108 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .sc_spec_type_def import SCSpecTypeDef
+
+__all__ = ["SCSpecUDTUnionCaseTupleV0"]
+
+
+class SCSpecUDTUnionCaseTupleV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecUDTUnionCaseTupleV0
+ {
+ string doc;
+ string name<60>;
+ SCSpecTypeDef type<12>;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ name: bytes,
+ type: List[SCSpecTypeDef],
+ ) -> None:
+ _expect_max_length = 12
+ if type and len(type) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `type` should be {_expect_max_length}, but got {len(type)}."
+ )
+ self.doc = doc
+ self.name = name
+ self.type = type
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.name, 60).pack(packer)
+ packer.pack_uint(len(self.type))
+ for type_item in self.type:
+ type_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTUnionCaseTupleV0:
+ doc = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ type = []
+ for _ in range(length):
+ type.append(SCSpecTypeDef.unpack(unpacker))
+ return cls(
+ doc=doc,
+ name=name,
+ type=type,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTUnionCaseTupleV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTUnionCaseTupleV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.name,
+ self.type,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.name == other.name
+ and self.type == other.type
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"name={self.name}",
+ f"type={self.type}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_union_case_v0.py b/stellar_sdk/xdr/sc_spec_udt_union_case_v0.py
new file mode 100644
index 000000000..bb8014cb2
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_union_case_v0.py
@@ -0,0 +1,109 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_spec_udt_union_case_tuple_v0 import SCSpecUDTUnionCaseTupleV0
+from .sc_spec_udt_union_case_v0_kind import SCSpecUDTUnionCaseV0Kind
+from .sc_spec_udt_union_case_void_v0 import SCSpecUDTUnionCaseVoidV0
+
+__all__ = ["SCSpecUDTUnionCaseV0"]
+
+
+class SCSpecUDTUnionCaseV0:
+ """
+ XDR Source Code::
+
+ union SCSpecUDTUnionCaseV0 switch (SCSpecUDTUnionCaseV0Kind kind)
+ {
+ case SC_SPEC_UDT_UNION_CASE_VOID_V0:
+ SCSpecUDTUnionCaseVoidV0 voidCase;
+ case SC_SPEC_UDT_UNION_CASE_TUPLE_V0:
+ SCSpecUDTUnionCaseTupleV0 tupleCase;
+ };
+ """
+
+ def __init__(
+ self,
+ kind: SCSpecUDTUnionCaseV0Kind,
+ void_case: SCSpecUDTUnionCaseVoidV0 = None,
+ tuple_case: SCSpecUDTUnionCaseTupleV0 = None,
+ ) -> None:
+ self.kind = kind
+ self.void_case = void_case
+ self.tuple_case = tuple_case
+
+ def pack(self, packer: Packer) -> None:
+ self.kind.pack(packer)
+ if self.kind == SCSpecUDTUnionCaseV0Kind.SC_SPEC_UDT_UNION_CASE_VOID_V0:
+ if self.void_case is None:
+ raise ValueError("void_case should not be None.")
+ self.void_case.pack(packer)
+ return
+ if self.kind == SCSpecUDTUnionCaseV0Kind.SC_SPEC_UDT_UNION_CASE_TUPLE_V0:
+ if self.tuple_case is None:
+ raise ValueError("tuple_case should not be None.")
+ self.tuple_case.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTUnionCaseV0:
+ kind = SCSpecUDTUnionCaseV0Kind.unpack(unpacker)
+ if kind == SCSpecUDTUnionCaseV0Kind.SC_SPEC_UDT_UNION_CASE_VOID_V0:
+ void_case = SCSpecUDTUnionCaseVoidV0.unpack(unpacker)
+ return cls(kind=kind, void_case=void_case)
+ if kind == SCSpecUDTUnionCaseV0Kind.SC_SPEC_UDT_UNION_CASE_TUPLE_V0:
+ tuple_case = SCSpecUDTUnionCaseTupleV0.unpack(unpacker)
+ return cls(kind=kind, tuple_case=tuple_case)
+ return cls(kind=kind)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTUnionCaseV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTUnionCaseV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.kind,
+ self.void_case,
+ self.tuple_case,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.kind == other.kind
+ and self.void_case == other.void_case
+ and self.tuple_case == other.tuple_case
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"kind={self.kind}")
+ out.append(
+ f"void_case={self.void_case}"
+ ) if self.void_case is not None else None
+ out.append(
+ f"tuple_case={self.tuple_case}"
+ ) if self.tuple_case is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_union_case_v0_kind.py b/stellar_sdk/xdr/sc_spec_udt_union_case_v0_kind.py
new file mode 100644
index 000000000..53ac28bfb
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_union_case_v0_kind.py
@@ -0,0 +1,52 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SCSpecUDTUnionCaseV0Kind"]
+
+
+class SCSpecUDTUnionCaseV0Kind(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SCSpecUDTUnionCaseV0Kind
+ {
+ SC_SPEC_UDT_UNION_CASE_VOID_V0 = 0,
+ SC_SPEC_UDT_UNION_CASE_TUPLE_V0 = 1
+ };
+ """
+
+ SC_SPEC_UDT_UNION_CASE_VOID_V0 = 0
+ SC_SPEC_UDT_UNION_CASE_TUPLE_V0 = 1
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTUnionCaseV0Kind:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTUnionCaseV0Kind:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTUnionCaseV0Kind:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_spec_udt_union_case_void_v0.py b/stellar_sdk/xdr/sc_spec_udt_union_case_void_v0.py
new file mode 100644
index 000000000..4439a16e2
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_union_case_void_v0.py
@@ -0,0 +1,84 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+
+__all__ = ["SCSpecUDTUnionCaseVoidV0"]
+
+
+class SCSpecUDTUnionCaseVoidV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecUDTUnionCaseVoidV0
+ {
+ string doc;
+ string name<60>;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ name: bytes,
+ ) -> None:
+ self.doc = doc
+ self.name = name
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.name, 60).pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTUnionCaseVoidV0:
+ doc = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ return cls(
+ doc=doc,
+ name=name,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTUnionCaseVoidV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTUnionCaseVoidV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.name,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.doc == other.doc and self.name == other.name
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"name={self.name}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_spec_udt_union_v0.py b/stellar_sdk/xdr/sc_spec_udt_union_v0.py
new file mode 100644
index 000000000..e7b6b3a79
--- /dev/null
+++ b/stellar_sdk/xdr/sc_spec_udt_union_v0.py
@@ -0,0 +1,117 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+from .sc_spec_udt_union_case_v0 import SCSpecUDTUnionCaseV0
+
+__all__ = ["SCSpecUDTUnionV0"]
+
+
+class SCSpecUDTUnionV0:
+ """
+ XDR Source Code::
+
+ struct SCSpecUDTUnionV0
+ {
+ string doc;
+ string lib<80>;
+ string name<60>;
+ SCSpecUDTUnionCaseV0 cases<50>;
+ };
+ """
+
+ def __init__(
+ self,
+ doc: bytes,
+ lib: bytes,
+ name: bytes,
+ cases: List[SCSpecUDTUnionCaseV0],
+ ) -> None:
+ _expect_max_length = 50
+ if cases and len(cases) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `cases` should be {_expect_max_length}, but got {len(cases)}."
+ )
+ self.doc = doc
+ self.lib = lib
+ self.name = name
+ self.cases = cases
+
+ def pack(self, packer: Packer) -> None:
+ String(self.doc, SC_SPEC_DOC_LIMIT).pack(packer)
+ String(self.lib, 80).pack(packer)
+ String(self.name, 60).pack(packer)
+ packer.pack_uint(len(self.cases))
+ for cases_item in self.cases:
+ cases_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSpecUDTUnionV0:
+ doc = String.unpack(unpacker)
+ lib = String.unpack(unpacker)
+ name = String.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ cases = []
+ for _ in range(length):
+ cases.append(SCSpecUDTUnionCaseV0.unpack(unpacker))
+ return cls(
+ doc=doc,
+ lib=lib,
+ name=name,
+ cases=cases,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSpecUDTUnionV0:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSpecUDTUnionV0:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.doc,
+ self.lib,
+ self.name,
+ self.cases,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.doc == other.doc
+ and self.lib == other.lib
+ and self.name == other.name
+ and self.cases == other.cases
+ )
+
+ def __str__(self):
+ out = [
+ f"doc={self.doc}",
+ f"lib={self.lib}",
+ f"name={self.name}",
+ f"cases={self.cases}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sc_string.py b/stellar_sdk/xdr/sc_string.py
new file mode 100644
index 000000000..300a94aeb
--- /dev/null
+++ b/stellar_sdk/xdr/sc_string.py
@@ -0,0 +1,60 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+
+__all__ = ["SCString"]
+
+
+class SCString:
+ """
+ XDR Source Code::
+
+ typedef string SCString<>;
+ """
+
+ def __init__(self, sc_string: bytes) -> None:
+ self.sc_string = sc_string
+
+ def pack(self, packer: Packer) -> None:
+ String(self.sc_string, 4294967295).pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCString:
+ sc_string = String.unpack(unpacker)
+ return cls(sc_string)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCString:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCString:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(self.sc_string)
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.sc_string == other.sc_string
+
+ def __str__(self):
+ return f""
diff --git a/stellar_sdk/xdr/sc_symbol.py b/stellar_sdk/xdr/sc_symbol.py
new file mode 100644
index 000000000..44ca5574d
--- /dev/null
+++ b/stellar_sdk/xdr/sc_symbol.py
@@ -0,0 +1,61 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import String
+from .constants import *
+
+__all__ = ["SCSymbol"]
+
+
+class SCSymbol:
+ """
+ XDR Source Code::
+
+ typedef string SCSymbol;
+ """
+
+ def __init__(self, sc_symbol: bytes) -> None:
+ self.sc_symbol = sc_symbol
+
+ def pack(self, packer: Packer) -> None:
+ String(self.sc_symbol, SCSYMBOL_LIMIT).pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCSymbol:
+ sc_symbol = String.unpack(unpacker)
+ return cls(sc_symbol)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCSymbol:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCSymbol:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(self.sc_symbol)
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.sc_symbol == other.sc_symbol
+
+ def __str__(self):
+ return f""
diff --git a/stellar_sdk/xdr/sc_val.py b/stellar_sdk/xdr/sc_val.py
new file mode 100644
index 000000000..e868a6893
--- /dev/null
+++ b/stellar_sdk/xdr/sc_val.py
@@ -0,0 +1,471 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import TYPE_CHECKING, Optional
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Boolean
+from .sc_val_type import SCValType
+
+if TYPE_CHECKING:
+ from .duration import Duration
+ from .int32 import Int32
+ from .int64 import Int64
+ from .int128_parts import Int128Parts
+ from .int256_parts import Int256Parts
+ from .sc_address import SCAddress
+ from .sc_bytes import SCBytes
+ from .sc_contract_instance import SCContractInstance
+ from .sc_error import SCError
+ from .sc_map import SCMap
+ from .sc_nonce_key import SCNonceKey
+ from .sc_string import SCString
+ from .sc_symbol import SCSymbol
+ from .sc_vec import SCVec
+ from .time_point import TimePoint
+ from .u_int128_parts import UInt128Parts
+ from .u_int256_parts import UInt256Parts
+ from .uint32 import Uint32
+ from .uint64 import Uint64
+__all__ = ["SCVal"]
+
+
+class SCVal:
+ """
+ XDR Source Code::
+
+ union SCVal switch (SCValType type)
+ {
+
+ case SCV_BOOL:
+ bool b;
+ case SCV_VOID:
+ void;
+ case SCV_ERROR:
+ SCError error;
+
+ case SCV_U32:
+ uint32 u32;
+ case SCV_I32:
+ int32 i32;
+
+ case SCV_U64:
+ uint64 u64;
+ case SCV_I64:
+ int64 i64;
+ case SCV_TIMEPOINT:
+ TimePoint timepoint;
+ case SCV_DURATION:
+ Duration duration;
+
+ case SCV_U128:
+ UInt128Parts u128;
+ case SCV_I128:
+ Int128Parts i128;
+
+ case SCV_U256:
+ UInt256Parts u256;
+ case SCV_I256:
+ Int256Parts i256;
+
+ case SCV_BYTES:
+ SCBytes bytes;
+ case SCV_STRING:
+ SCString str;
+ case SCV_SYMBOL:
+ SCSymbol sym;
+
+ // Vec and Map are recursive so need to live
+ // behind an option, due to xdrpp limitations.
+ case SCV_VEC:
+ SCVec *vec;
+ case SCV_MAP:
+ SCMap *map;
+
+ case SCV_ADDRESS:
+ SCAddress address;
+
+ // Special SCVals reserved for system-constructed contract-data
+ // ledger keys, not generally usable elsewhere.
+ case SCV_LEDGER_KEY_CONTRACT_INSTANCE:
+ void;
+ case SCV_LEDGER_KEY_NONCE:
+ SCNonceKey nonce_key;
+
+ case SCV_CONTRACT_INSTANCE:
+ SCContractInstance instance;
+ };
+ """
+
+ def __init__(
+ self,
+ type: SCValType,
+ b: bool = None,
+ error: SCError = None,
+ u32: Uint32 = None,
+ i32: Int32 = None,
+ u64: Uint64 = None,
+ i64: Int64 = None,
+ timepoint: TimePoint = None,
+ duration: Duration = None,
+ u128: UInt128Parts = None,
+ i128: Int128Parts = None,
+ u256: UInt256Parts = None,
+ i256: Int256Parts = None,
+ bytes: SCBytes = None,
+ str: SCString = None,
+ sym: SCSymbol = None,
+ vec: Optional[SCVec] = None,
+ map: Optional[SCMap] = None,
+ address: SCAddress = None,
+ nonce_key: SCNonceKey = None,
+ instance: SCContractInstance = None,
+ ) -> None:
+ self.type = type
+ self.b = b
+ self.error = error
+ self.u32 = u32
+ self.i32 = i32
+ self.u64 = u64
+ self.i64 = i64
+ self.timepoint = timepoint
+ self.duration = duration
+ self.u128 = u128
+ self.i128 = i128
+ self.u256 = u256
+ self.i256 = i256
+ self.bytes = bytes
+ self.str = str
+ self.sym = sym
+ self.vec = vec
+ self.map = map
+ self.address = address
+ self.nonce_key = nonce_key
+ self.instance = instance
+
+ def pack(self, packer: Packer) -> None:
+ self.type.pack(packer)
+ if self.type == SCValType.SCV_BOOL:
+ if self.b is None:
+ raise ValueError("b should not be None.")
+ Boolean(self.b).pack(packer)
+ return
+ if self.type == SCValType.SCV_VOID:
+ return
+ if self.type == SCValType.SCV_ERROR:
+ if self.error is None:
+ raise ValueError("error should not be None.")
+ self.error.pack(packer)
+ return
+ if self.type == SCValType.SCV_U32:
+ if self.u32 is None:
+ raise ValueError("u32 should not be None.")
+ self.u32.pack(packer)
+ return
+ if self.type == SCValType.SCV_I32:
+ if self.i32 is None:
+ raise ValueError("i32 should not be None.")
+ self.i32.pack(packer)
+ return
+ if self.type == SCValType.SCV_U64:
+ if self.u64 is None:
+ raise ValueError("u64 should not be None.")
+ self.u64.pack(packer)
+ return
+ if self.type == SCValType.SCV_I64:
+ if self.i64 is None:
+ raise ValueError("i64 should not be None.")
+ self.i64.pack(packer)
+ return
+ if self.type == SCValType.SCV_TIMEPOINT:
+ if self.timepoint is None:
+ raise ValueError("timepoint should not be None.")
+ self.timepoint.pack(packer)
+ return
+ if self.type == SCValType.SCV_DURATION:
+ if self.duration is None:
+ raise ValueError("duration should not be None.")
+ self.duration.pack(packer)
+ return
+ if self.type == SCValType.SCV_U128:
+ if self.u128 is None:
+ raise ValueError("u128 should not be None.")
+ self.u128.pack(packer)
+ return
+ if self.type == SCValType.SCV_I128:
+ if self.i128 is None:
+ raise ValueError("i128 should not be None.")
+ self.i128.pack(packer)
+ return
+ if self.type == SCValType.SCV_U256:
+ if self.u256 is None:
+ raise ValueError("u256 should not be None.")
+ self.u256.pack(packer)
+ return
+ if self.type == SCValType.SCV_I256:
+ if self.i256 is None:
+ raise ValueError("i256 should not be None.")
+ self.i256.pack(packer)
+ return
+ if self.type == SCValType.SCV_BYTES:
+ if self.bytes is None:
+ raise ValueError("bytes should not be None.")
+ self.bytes.pack(packer)
+ return
+ if self.type == SCValType.SCV_STRING:
+ if self.str is None:
+ raise ValueError("str should not be None.")
+ self.str.pack(packer)
+ return
+ if self.type == SCValType.SCV_SYMBOL:
+ if self.sym is None:
+ raise ValueError("sym should not be None.")
+ self.sym.pack(packer)
+ return
+ if self.type == SCValType.SCV_VEC:
+ if self.vec is None:
+ packer.pack_uint(0)
+ else:
+ packer.pack_uint(1)
+ if self.vec is None:
+ raise ValueError("vec should not be None.")
+ self.vec.pack(packer)
+ return
+ if self.type == SCValType.SCV_MAP:
+ if self.map is None:
+ packer.pack_uint(0)
+ else:
+ packer.pack_uint(1)
+ if self.map is None:
+ raise ValueError("map should not be None.")
+ self.map.pack(packer)
+ return
+ if self.type == SCValType.SCV_ADDRESS:
+ if self.address is None:
+ raise ValueError("address should not be None.")
+ self.address.pack(packer)
+ return
+ if self.type == SCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE:
+ return
+ if self.type == SCValType.SCV_LEDGER_KEY_NONCE:
+ if self.nonce_key is None:
+ raise ValueError("nonce_key should not be None.")
+ self.nonce_key.pack(packer)
+ return
+ if self.type == SCValType.SCV_CONTRACT_INSTANCE:
+ if self.instance is None:
+ raise ValueError("instance should not be None.")
+ self.instance.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCVal:
+ type = SCValType.unpack(unpacker)
+ if type == SCValType.SCV_BOOL:
+ b = Boolean.unpack(unpacker)
+ return cls(type=type, b=b)
+ if type == SCValType.SCV_VOID:
+ return cls(type=type)
+ if type == SCValType.SCV_ERROR:
+ from .sc_error import SCError
+
+ error = SCError.unpack(unpacker)
+ return cls(type=type, error=error)
+ if type == SCValType.SCV_U32:
+ from .uint32 import Uint32
+
+ u32 = Uint32.unpack(unpacker)
+ return cls(type=type, u32=u32)
+ if type == SCValType.SCV_I32:
+ from .int32 import Int32
+
+ i32 = Int32.unpack(unpacker)
+ return cls(type=type, i32=i32)
+ if type == SCValType.SCV_U64:
+ from .uint64 import Uint64
+
+ u64 = Uint64.unpack(unpacker)
+ return cls(type=type, u64=u64)
+ if type == SCValType.SCV_I64:
+ from .int64 import Int64
+
+ i64 = Int64.unpack(unpacker)
+ return cls(type=type, i64=i64)
+ if type == SCValType.SCV_TIMEPOINT:
+ from .time_point import TimePoint
+
+ timepoint = TimePoint.unpack(unpacker)
+ return cls(type=type, timepoint=timepoint)
+ if type == SCValType.SCV_DURATION:
+ from .duration import Duration
+
+ duration = Duration.unpack(unpacker)
+ return cls(type=type, duration=duration)
+ if type == SCValType.SCV_U128:
+ from .u_int128_parts import UInt128Parts
+
+ u128 = UInt128Parts.unpack(unpacker)
+ return cls(type=type, u128=u128)
+ if type == SCValType.SCV_I128:
+ from .int128_parts import Int128Parts
+
+ i128 = Int128Parts.unpack(unpacker)
+ return cls(type=type, i128=i128)
+ if type == SCValType.SCV_U256:
+ from .u_int256_parts import UInt256Parts
+
+ u256 = UInt256Parts.unpack(unpacker)
+ return cls(type=type, u256=u256)
+ if type == SCValType.SCV_I256:
+ from .int256_parts import Int256Parts
+
+ i256 = Int256Parts.unpack(unpacker)
+ return cls(type=type, i256=i256)
+ if type == SCValType.SCV_BYTES:
+ from .sc_bytes import SCBytes
+
+ bytes = SCBytes.unpack(unpacker)
+ return cls(type=type, bytes=bytes)
+ if type == SCValType.SCV_STRING:
+ from .sc_string import SCString
+
+ str = SCString.unpack(unpacker)
+ return cls(type=type, str=str)
+ if type == SCValType.SCV_SYMBOL:
+ from .sc_symbol import SCSymbol
+
+ sym = SCSymbol.unpack(unpacker)
+ return cls(type=type, sym=sym)
+ if type == SCValType.SCV_VEC:
+ from .sc_vec import SCVec
+
+ vec = SCVec.unpack(unpacker) if unpacker.unpack_uint() else None
+ return cls(type=type, vec=vec)
+ if type == SCValType.SCV_MAP:
+ from .sc_map import SCMap
+
+ map = SCMap.unpack(unpacker) if unpacker.unpack_uint() else None
+ return cls(type=type, map=map)
+ if type == SCValType.SCV_ADDRESS:
+ from .sc_address import SCAddress
+
+ address = SCAddress.unpack(unpacker)
+ return cls(type=type, address=address)
+ if type == SCValType.SCV_LEDGER_KEY_CONTRACT_INSTANCE:
+ return cls(type=type)
+ if type == SCValType.SCV_LEDGER_KEY_NONCE:
+ from .sc_nonce_key import SCNonceKey
+
+ nonce_key = SCNonceKey.unpack(unpacker)
+ return cls(type=type, nonce_key=nonce_key)
+ if type == SCValType.SCV_CONTRACT_INSTANCE:
+ from .sc_contract_instance import SCContractInstance
+
+ instance = SCContractInstance.unpack(unpacker)
+ return cls(type=type, instance=instance)
+ return cls(type=type)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCVal:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCVal:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.b,
+ self.error,
+ self.u32,
+ self.i32,
+ self.u64,
+ self.i64,
+ self.timepoint,
+ self.duration,
+ self.u128,
+ self.i128,
+ self.u256,
+ self.i256,
+ self.bytes,
+ self.str,
+ self.sym,
+ self.vec,
+ self.map,
+ self.address,
+ self.nonce_key,
+ self.instance,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.type == other.type
+ and self.b == other.b
+ and self.error == other.error
+ and self.u32 == other.u32
+ and self.i32 == other.i32
+ and self.u64 == other.u64
+ and self.i64 == other.i64
+ and self.timepoint == other.timepoint
+ and self.duration == other.duration
+ and self.u128 == other.u128
+ and self.i128 == other.i128
+ and self.u256 == other.u256
+ and self.i256 == other.i256
+ and self.bytes == other.bytes
+ and self.str == other.str
+ and self.sym == other.sym
+ and self.vec == other.vec
+ and self.map == other.map
+ and self.address == other.address
+ and self.nonce_key == other.nonce_key
+ and self.instance == other.instance
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"type={self.type}")
+ out.append(f"b={self.b}") if self.b is not None else None
+ out.append(f"error={self.error}") if self.error is not None else None
+ out.append(f"u32={self.u32}") if self.u32 is not None else None
+ out.append(f"i32={self.i32}") if self.i32 is not None else None
+ out.append(f"u64={self.u64}") if self.u64 is not None else None
+ out.append(f"i64={self.i64}") if self.i64 is not None else None
+ out.append(
+ f"timepoint={self.timepoint}"
+ ) if self.timepoint is not None else None
+ out.append(f"duration={self.duration}") if self.duration is not None else None
+ out.append(f"u128={self.u128}") if self.u128 is not None else None
+ out.append(f"i128={self.i128}") if self.i128 is not None else None
+ out.append(f"u256={self.u256}") if self.u256 is not None else None
+ out.append(f"i256={self.i256}") if self.i256 is not None else None
+ out.append(f"bytes={self.bytes}") if self.bytes is not None else None
+ out.append(f"str={self.str}") if self.str is not None else None
+ out.append(f"sym={self.sym}") if self.sym is not None else None
+ out.append(f"vec={self.vec}") if self.vec is not None else None
+ out.append(f"map={self.map}") if self.map is not None else None
+ out.append(f"address={self.address}") if self.address is not None else None
+ out.append(
+ f"nonce_key={self.nonce_key}"
+ ) if self.nonce_key is not None else None
+ out.append(f"instance={self.instance}") if self.instance is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/sc_val_type.py b/stellar_sdk/xdr/sc_val_type.py
new file mode 100644
index 000000000..aef93dae1
--- /dev/null
+++ b/stellar_sdk/xdr/sc_val_type.py
@@ -0,0 +1,121 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SCValType"]
+
+
+class SCValType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SCValType
+ {
+ SCV_BOOL = 0,
+ SCV_VOID = 1,
+ SCV_ERROR = 2,
+
+ // 32 bits is the smallest type in WASM or XDR; no need for u8/u16.
+ SCV_U32 = 3,
+ SCV_I32 = 4,
+
+ // 64 bits is naturally supported by both WASM and XDR also.
+ SCV_U64 = 5,
+ SCV_I64 = 6,
+
+ // Time-related u64 subtypes with their own functions and formatting.
+ SCV_TIMEPOINT = 7,
+ SCV_DURATION = 8,
+
+ // 128 bits is naturally supported by Rust and we use it for Soroban
+ // fixed-point arithmetic prices / balances / similar "quantities". These
+ // are represented in XDR as a pair of 2 u64s.
+ SCV_U128 = 9,
+ SCV_I128 = 10,
+
+ // 256 bits is the size of sha256 output, ed25519 keys, and the EVM machine
+ // word, so for interop use we include this even though it requires a small
+ // amount of Rust guest and/or host library code.
+ SCV_U256 = 11,
+ SCV_I256 = 12,
+
+ // Bytes come in 3 flavors, 2 of which have meaningfully different
+ // formatting and validity-checking / domain-restriction.
+ SCV_BYTES = 13,
+ SCV_STRING = 14,
+ SCV_SYMBOL = 15,
+
+ // Vecs and maps are just polymorphic containers of other ScVals.
+ SCV_VEC = 16,
+ SCV_MAP = 17,
+
+ // Address is the universal identifier for contracts and classic
+ // accounts.
+ SCV_ADDRESS = 18,
+
+ // The following are the internal SCVal variants that are not
+ // exposed to the contracts.
+ SCV_CONTRACT_INSTANCE = 19,
+
+ // SCV_LEDGER_KEY_CONTRACT_INSTANCE and SCV_LEDGER_KEY_NONCE are unique
+ // symbolic SCVals used as the key for ledger entries for a contract's
+ // instance and an address' nonce, respectively.
+ SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20,
+ SCV_LEDGER_KEY_NONCE = 21
+ };
+ """
+
+ SCV_BOOL = 0
+ SCV_VOID = 1
+ SCV_ERROR = 2
+ SCV_U32 = 3
+ SCV_I32 = 4
+ SCV_U64 = 5
+ SCV_I64 = 6
+ SCV_TIMEPOINT = 7
+ SCV_DURATION = 8
+ SCV_U128 = 9
+ SCV_I128 = 10
+ SCV_U256 = 11
+ SCV_I256 = 12
+ SCV_BYTES = 13
+ SCV_STRING = 14
+ SCV_SYMBOL = 15
+ SCV_VEC = 16
+ SCV_MAP = 17
+ SCV_ADDRESS = 18
+ SCV_CONTRACT_INSTANCE = 19
+ SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20
+ SCV_LEDGER_KEY_NONCE = 21
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCValType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCValType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCValType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/sc_vec.py b/stellar_sdk/xdr/sc_vec.py
new file mode 100644
index 000000000..37390f086
--- /dev/null
+++ b/stellar_sdk/xdr/sc_vec.py
@@ -0,0 +1,71 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .sc_val import SCVal
+
+__all__ = ["SCVec"]
+
+
+class SCVec:
+ """
+ XDR Source Code::
+
+ typedef SCVal SCVec<>;
+ """
+
+ def __init__(self, sc_vec: List[SCVal]) -> None:
+ _expect_max_length = 4294967295
+ if sc_vec and len(sc_vec) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `sc_vec` should be {_expect_max_length}, but got {len(sc_vec)}."
+ )
+ self.sc_vec = sc_vec
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_uint(len(self.sc_vec))
+ for sc_vec_item in self.sc_vec:
+ sc_vec_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SCVec:
+ length = unpacker.unpack_uint()
+ sc_vec = []
+ for _ in range(length):
+ sc_vec.append(SCVal.unpack(unpacker))
+ return cls(sc_vec)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SCVec:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SCVec:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(self.sc_vec)
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.sc_vec == other.sc_vec
+
+ def __str__(self):
+ return f""
diff --git a/stellar_sdk/xdr/scp_ballot.py b/stellar_sdk/xdr/scp_ballot.py
index fc475ab3f..333b55908 100644
--- a/stellar_sdk/xdr/scp_ballot.py
+++ b/stellar_sdk/xdr/scp_ballot.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .uint32 import Uint32
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.value.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPBallot":
+ def unpack(cls, unpacker: Unpacker) -> SCPBallot:
counter = Uint32.unpack(unpacker)
value = Value.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPBallot":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPBallot:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPBallot":
+ def from_xdr(cls, xdr: str) -> SCPBallot:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.counter,
+ self.value,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_envelope.py b/stellar_sdk/xdr/scp_envelope.py
index fb67d2749..7460ddba2 100644
--- a/stellar_sdk/xdr/scp_envelope.py
+++ b/stellar_sdk/xdr/scp_envelope.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .scp_statement import SCPStatement
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.signature.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPEnvelope":
+ def unpack(cls, unpacker: Unpacker) -> SCPEnvelope:
statement = SCPStatement.unpack(unpacker)
signature = Signature.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPEnvelope":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPEnvelope:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPEnvelope":
+ def from_xdr(cls, xdr: str) -> SCPEnvelope:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.statement,
+ self.signature,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_history_entry.py b/stellar_sdk/xdr/scp_history_entry.py
index c6c80bdd9..69d2a89b4 100644
--- a/stellar_sdk/xdr/scp_history_entry.py
+++ b/stellar_sdk/xdr/scp_history_entry.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Integer
@@ -37,7 +40,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPHistoryEntry":
+ def unpack(cls, unpacker: Unpacker) -> SCPHistoryEntry:
v = Integer.unpack(unpacker)
if v == 0:
v0 = SCPHistoryEntryV0.unpack(unpacker)
@@ -50,7 +53,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPHistoryEntry":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPHistoryEntry:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -59,10 +62,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPHistoryEntry":
+ def from_xdr(cls, xdr: str) -> SCPHistoryEntry:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.v0,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_history_entry_v0.py b/stellar_sdk/xdr/scp_history_entry_v0.py
index ad96ffc09..a93e64bf7 100644
--- a/stellar_sdk/xdr/scp_history_entry_v0.py
+++ b/stellar_sdk/xdr/scp_history_entry_v0.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .ledger_scp_messages import LedgerSCPMessages
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
self.ledger_messages.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPHistoryEntryV0":
+ def unpack(cls, unpacker: Unpacker) -> SCPHistoryEntryV0:
length = unpacker.unpack_uint()
quorum_sets = []
for _ in range(length):
@@ -58,7 +61,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPHistoryEntryV0":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPHistoryEntryV0:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -67,10 +70,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPHistoryEntryV0":
+ def from_xdr(cls, xdr: str) -> SCPHistoryEntryV0:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.quorum_sets,
+ self.ledger_messages,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_nomination.py b/stellar_sdk/xdr/scp_nomination.py
index 067ecd84b..8147ec7d2 100644
--- a/stellar_sdk/xdr/scp_nomination.py
+++ b/stellar_sdk/xdr/scp_nomination.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .hash import Hash
@@ -52,7 +55,7 @@ def pack(self, packer: Packer) -> None:
accepted_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPNomination":
+ def unpack(cls, unpacker: Unpacker) -> SCPNomination:
quorum_set_hash = Hash.unpack(unpacker)
length = unpacker.unpack_uint()
votes = []
@@ -74,7 +77,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPNomination":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPNomination:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -83,10 +86,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPNomination":
+ def from_xdr(cls, xdr: str) -> SCPNomination:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.quorum_set_hash,
+ self.votes,
+ self.accepted,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_quorum_set.py b/stellar_sdk/xdr/scp_quorum_set.py
index b17a2e39f..87f6298b3 100644
--- a/stellar_sdk/xdr/scp_quorum_set.py
+++ b/stellar_sdk/xdr/scp_quorum_set.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .node_id import NodeID
@@ -52,7 +55,7 @@ def pack(self, packer: Packer) -> None:
inner_sets_item.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPQuorumSet":
+ def unpack(cls, unpacker: Unpacker) -> SCPQuorumSet:
threshold = Uint32.unpack(unpacker)
length = unpacker.unpack_uint()
validators = []
@@ -74,7 +77,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPQuorumSet":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPQuorumSet:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -83,10 +86,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPQuorumSet":
+ def from_xdr(cls, xdr: str) -> SCPQuorumSet:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.threshold,
+ self.validators,
+ self.inner_sets,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_statement.py b/stellar_sdk/xdr/scp_statement.py
index bf30e65f9..8316c1cf2 100644
--- a/stellar_sdk/xdr/scp_statement.py
+++ b/stellar_sdk/xdr/scp_statement.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .node_id import NodeID
@@ -70,7 +73,7 @@ def pack(self, packer: Packer) -> None:
self.pledges.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPStatement":
+ def unpack(cls, unpacker: Unpacker) -> SCPStatement:
node_id = NodeID.unpack(unpacker)
slot_index = Uint64.unpack(unpacker)
pledges = SCPStatementPledges.unpack(unpacker)
@@ -86,7 +89,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPStatement":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPStatement:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -95,10 +98,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPStatement":
+ def from_xdr(cls, xdr: str) -> SCPStatement:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.node_id,
+ self.slot_index,
+ self.pledges,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_statement_confirm.py b/stellar_sdk/xdr/scp_statement_confirm.py
index 62e2b92dc..001524a9a 100644
--- a/stellar_sdk/xdr/scp_statement_confirm.py
+++ b/stellar_sdk/xdr/scp_statement_confirm.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .hash import Hash
@@ -46,7 +49,7 @@ def pack(self, packer: Packer) -> None:
self.quorum_set_hash.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPStatementConfirm":
+ def unpack(cls, unpacker: Unpacker) -> SCPStatementConfirm:
ballot = SCPBallot.unpack(unpacker)
n_prepared = Uint32.unpack(unpacker)
n_commit = Uint32.unpack(unpacker)
@@ -66,7 +69,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPStatementConfirm":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPStatementConfirm:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -75,10 +78,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPStatementConfirm":
+ def from_xdr(cls, xdr: str) -> SCPStatementConfirm:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ballot,
+ self.n_prepared,
+ self.n_commit,
+ self.n_h,
+ self.quorum_set_hash,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_statement_externalize.py b/stellar_sdk/xdr/scp_statement_externalize.py
index 7783efc42..f2ab8a2c5 100644
--- a/stellar_sdk/xdr/scp_statement_externalize.py
+++ b/stellar_sdk/xdr/scp_statement_externalize.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .hash import Hash
@@ -38,7 +41,7 @@ def pack(self, packer: Packer) -> None:
self.commit_quorum_set_hash.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPStatementExternalize":
+ def unpack(cls, unpacker: Unpacker) -> SCPStatementExternalize:
commit = SCPBallot.unpack(unpacker)
n_h = Uint32.unpack(unpacker)
commit_quorum_set_hash = Hash.unpack(unpacker)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPStatementExternalize":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPStatementExternalize:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +66,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPStatementExternalize":
+ def from_xdr(cls, xdr: str) -> SCPStatementExternalize:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.commit,
+ self.n_h,
+ self.commit_quorum_set_hash,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_statement_pledges.py b/stellar_sdk/xdr/scp_statement_pledges.py
index a5a8107e9..6add9bede 100644
--- a/stellar_sdk/xdr/scp_statement_pledges.py
+++ b/stellar_sdk/xdr/scp_statement_pledges.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .scp_nomination import SCPNomination
@@ -87,7 +90,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPStatementPledges":
+ def unpack(cls, unpacker: Unpacker) -> SCPStatementPledges:
type = SCPStatementType.unpack(unpacker)
if type == SCPStatementType.SCP_ST_PREPARE:
prepare = SCPStatementPrepare.unpack(unpacker)
@@ -109,7 +112,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPStatementPledges":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPStatementPledges:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -118,10 +121,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPStatementPledges":
+ def from_xdr(cls, xdr: str) -> SCPStatementPledges:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.prepare,
+ self.confirm,
+ self.externalize,
+ self.nominate,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_statement_prepare.py b/stellar_sdk/xdr/scp_statement_prepare.py
index ab8c8e961..ef997f0f5 100644
--- a/stellar_sdk/xdr/scp_statement_prepare.py
+++ b/stellar_sdk/xdr/scp_statement_prepare.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import Optional
+
from xdrlib3 import Packer, Unpacker
from .hash import Hash
@@ -59,7 +62,7 @@ def pack(self, packer: Packer) -> None:
self.n_h.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPStatementPrepare":
+ def unpack(cls, unpacker: Unpacker) -> SCPStatementPrepare:
quorum_set_hash = Hash.unpack(unpacker)
ballot = SCPBallot.unpack(unpacker)
prepared = SCPBallot.unpack(unpacker) if unpacker.unpack_uint() else None
@@ -81,7 +84,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPStatementPrepare":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPStatementPrepare:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -90,10 +93,22 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPStatementPrepare":
+ def from_xdr(cls, xdr: str) -> SCPStatementPrepare:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.quorum_set_hash,
+ self.ballot,
+ self.prepared,
+ self.prepared_prime,
+ self.n_c,
+ self.n_h,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/scp_statement_type.py b/stellar_sdk/xdr/scp_statement_type.py
index 23858c253..ed005111d 100644
--- a/stellar_sdk/xdr/scp_statement_type.py
+++ b/stellar_sdk/xdr/scp_statement_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["SCPStatementType"]
@@ -29,7 +32,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SCPStatementType":
+ def unpack(cls, unpacker: Unpacker) -> SCPStatementType:
value = unpacker.unpack_int()
return cls(value)
@@ -39,7 +42,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SCPStatementType":
+ def from_xdr_bytes(cls, xdr: bytes) -> SCPStatementType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -48,6 +51,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SCPStatementType":
+ def from_xdr(cls, xdr: str) -> SCPStatementType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/send_more.py b/stellar_sdk/xdr/send_more.py
index 98fcf9840..58093dd7b 100644
--- a/stellar_sdk/xdr/send_more.py
+++ b/stellar_sdk/xdr/send_more.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .uint32 import Uint32
@@ -28,7 +31,7 @@ def pack(self, packer: Packer) -> None:
self.num_messages.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SendMore":
+ def unpack(cls, unpacker: Unpacker) -> SendMore:
num_messages = Uint32.unpack(unpacker)
return cls(
num_messages=num_messages,
@@ -40,7 +43,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SendMore":
+ def from_xdr_bytes(cls, xdr: bytes) -> SendMore:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -49,10 +52,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SendMore":
+ def from_xdr(cls, xdr: str) -> SendMore:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.num_messages,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/send_more_extended.py b/stellar_sdk/xdr/send_more_extended.py
new file mode 100644
index 000000000..8cd5b7ce6
--- /dev/null
+++ b/stellar_sdk/xdr/send_more_extended.py
@@ -0,0 +1,86 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .uint32 import Uint32
+
+__all__ = ["SendMoreExtended"]
+
+
+class SendMoreExtended:
+ """
+ XDR Source Code::
+
+ struct SendMoreExtended
+ {
+ uint32 numMessages;
+ uint32 numBytes;
+ };
+ """
+
+ def __init__(
+ self,
+ num_messages: Uint32,
+ num_bytes: Uint32,
+ ) -> None:
+ self.num_messages = num_messages
+ self.num_bytes = num_bytes
+
+ def pack(self, packer: Packer) -> None:
+ self.num_messages.pack(packer)
+ self.num_bytes.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SendMoreExtended:
+ num_messages = Uint32.unpack(unpacker)
+ num_bytes = Uint32.unpack(unpacker)
+ return cls(
+ num_messages=num_messages,
+ num_bytes=num_bytes,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SendMoreExtended:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SendMoreExtended:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.num_messages,
+ self.num_bytes,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.num_messages == other.num_messages
+ and self.num_bytes == other.num_bytes
+ )
+
+ def __str__(self):
+ out = [
+ f"num_messages={self.num_messages}",
+ f"num_bytes={self.num_bytes}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sequence_number.py b/stellar_sdk/xdr/sequence_number.py
index 7b68c8aff..e06b3f6d0 100644
--- a/stellar_sdk/xdr/sequence_number.py
+++ b/stellar_sdk/xdr/sequence_number.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .int64 import Int64
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
self.sequence_number.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SequenceNumber":
+ def unpack(cls, unpacker: Unpacker) -> SequenceNumber:
sequence_number = Int64.unpack(unpacker)
return cls(sequence_number)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SequenceNumber":
+ def from_xdr_bytes(cls, xdr: bytes) -> SequenceNumber:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SequenceNumber":
+ def from_xdr(cls, xdr: str) -> SequenceNumber:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.sequence_number)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/set_options_op.py b/stellar_sdk/xdr/set_options_op.py
index bea16cca6..84696d3fd 100644
--- a/stellar_sdk/xdr/set_options_op.py
+++ b/stellar_sdk/xdr/set_options_op.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import Optional
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -107,7 +110,7 @@ def pack(self, packer: Packer) -> None:
self.signer.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SetOptionsOp":
+ def unpack(cls, unpacker: Unpacker) -> SetOptionsOp:
inflation_dest = AccountID.unpack(unpacker) if unpacker.unpack_uint() else None
clear_flags = Uint32.unpack(unpacker) if unpacker.unpack_uint() else None
set_flags = Uint32.unpack(unpacker) if unpacker.unpack_uint() else None
@@ -135,7 +138,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SetOptionsOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> SetOptionsOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -144,10 +147,25 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SetOptionsOp":
+ def from_xdr(cls, xdr: str) -> SetOptionsOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.inflation_dest,
+ self.clear_flags,
+ self.set_flags,
+ self.master_weight,
+ self.low_threshold,
+ self.med_threshold,
+ self.high_threshold,
+ self.home_domain,
+ self.signer,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/set_options_result.py b/stellar_sdk/xdr/set_options_result.py
index 9ce897a0d..e32eb77d3 100644
--- a/stellar_sdk/xdr/set_options_result.py
+++ b/stellar_sdk/xdr/set_options_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .set_options_result_code import SetOptionsResultCode
@@ -16,7 +19,16 @@ class SetOptionsResult:
{
case SET_OPTIONS_SUCCESS:
void;
- default:
+ case SET_OPTIONS_LOW_RESERVE:
+ case SET_OPTIONS_TOO_MANY_SIGNERS:
+ case SET_OPTIONS_BAD_FLAGS:
+ case SET_OPTIONS_INVALID_INFLATION:
+ case SET_OPTIONS_CANT_CHANGE:
+ case SET_OPTIONS_UNKNOWN_FLAG:
+ case SET_OPTIONS_THRESHOLD_OUT_OF_RANGE:
+ case SET_OPTIONS_BAD_SIGNER:
+ case SET_OPTIONS_INVALID_HOME_DOMAIN:
+ case SET_OPTIONS_AUTH_REVOCABLE_REQUIRED:
void;
};
"""
@@ -31,12 +43,52 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == SetOptionsResultCode.SET_OPTIONS_SUCCESS:
return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_LOW_RESERVE:
+ return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_TOO_MANY_SIGNERS:
+ return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_BAD_FLAGS:
+ return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_INVALID_INFLATION:
+ return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_CANT_CHANGE:
+ return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_UNKNOWN_FLAG:
+ return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_THRESHOLD_OUT_OF_RANGE:
+ return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_BAD_SIGNER:
+ return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_INVALID_HOME_DOMAIN:
+ return
+ if self.code == SetOptionsResultCode.SET_OPTIONS_AUTH_REVOCABLE_REQUIRED:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SetOptionsResult":
+ def unpack(cls, unpacker: Unpacker) -> SetOptionsResult:
code = SetOptionsResultCode.unpack(unpacker)
if code == SetOptionsResultCode.SET_OPTIONS_SUCCESS:
return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_LOW_RESERVE:
+ return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_TOO_MANY_SIGNERS:
+ return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_BAD_FLAGS:
+ return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_INVALID_INFLATION:
+ return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_CANT_CHANGE:
+ return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_UNKNOWN_FLAG:
+ return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_THRESHOLD_OUT_OF_RANGE:
+ return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_BAD_SIGNER:
+ return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_INVALID_HOME_DOMAIN:
+ return cls(code=code)
+ if code == SetOptionsResultCode.SET_OPTIONS_AUTH_REVOCABLE_REQUIRED:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +97,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SetOptionsResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> SetOptionsResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +106,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SetOptionsResult":
+ def from_xdr(cls, xdr: str) -> SetOptionsResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/set_options_result_code.py b/stellar_sdk/xdr/set_options_result_code.py
index 42f4638cd..e89e8e192 100644
--- a/stellar_sdk/xdr/set_options_result_code.py
+++ b/stellar_sdk/xdr/set_options_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["SetOptionsResultCode"]
@@ -46,7 +49,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SetOptionsResultCode":
+ def unpack(cls, unpacker: Unpacker) -> SetOptionsResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -56,7 +59,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SetOptionsResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> SetOptionsResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,6 +68,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SetOptionsResultCode":
+ def from_xdr(cls, xdr: str) -> SetOptionsResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/set_trust_line_flags_op.py b/stellar_sdk/xdr/set_trust_line_flags_op.py
index c221f9b73..3ecac8517 100644
--- a/stellar_sdk/xdr/set_trust_line_flags_op.py
+++ b/stellar_sdk/xdr/set_trust_line_flags_op.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -43,7 +46,7 @@ def pack(self, packer: Packer) -> None:
self.set_flags.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SetTrustLineFlagsOp":
+ def unpack(cls, unpacker: Unpacker) -> SetTrustLineFlagsOp:
trustor = AccountID.unpack(unpacker)
asset = Asset.unpack(unpacker)
clear_flags = Uint32.unpack(unpacker)
@@ -61,7 +64,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SetTrustLineFlagsOp":
+ def from_xdr_bytes(cls, xdr: bytes) -> SetTrustLineFlagsOp:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -70,10 +73,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SetTrustLineFlagsOp":
+ def from_xdr(cls, xdr: str) -> SetTrustLineFlagsOp:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.trustor,
+ self.asset,
+ self.clear_flags,
+ self.set_flags,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/set_trust_line_flags_result.py b/stellar_sdk/xdr/set_trust_line_flags_result.py
index 8cea8f2a9..e38ab34b2 100644
--- a/stellar_sdk/xdr/set_trust_line_flags_result.py
+++ b/stellar_sdk/xdr/set_trust_line_flags_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .set_trust_line_flags_result_code import SetTrustLineFlagsResultCode
@@ -16,7 +19,11 @@ class SetTrustLineFlagsResult:
{
case SET_TRUST_LINE_FLAGS_SUCCESS:
void;
- default:
+ case SET_TRUST_LINE_FLAGS_MALFORMED:
+ case SET_TRUST_LINE_FLAGS_NO_TRUST_LINE:
+ case SET_TRUST_LINE_FLAGS_CANT_REVOKE:
+ case SET_TRUST_LINE_FLAGS_INVALID_STATE:
+ case SET_TRUST_LINE_FLAGS_LOW_RESERVE:
void;
};
"""
@@ -31,12 +38,32 @@ def pack(self, packer: Packer) -> None:
self.code.pack(packer)
if self.code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_SUCCESS:
return
+ if self.code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_MALFORMED:
+ return
+ if self.code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_NO_TRUST_LINE:
+ return
+ if self.code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_CANT_REVOKE:
+ return
+ if self.code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_INVALID_STATE:
+ return
+ if self.code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_LOW_RESERVE:
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SetTrustLineFlagsResult":
+ def unpack(cls, unpacker: Unpacker) -> SetTrustLineFlagsResult:
code = SetTrustLineFlagsResultCode.unpack(unpacker)
if code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_SUCCESS:
return cls(code=code)
+ if code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_MALFORMED:
+ return cls(code=code)
+ if code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_NO_TRUST_LINE:
+ return cls(code=code)
+ if code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_CANT_REVOKE:
+ return cls(code=code)
+ if code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_INVALID_STATE:
+ return cls(code=code)
+ if code == SetTrustLineFlagsResultCode.SET_TRUST_LINE_FLAGS_LOW_RESERVE:
+ return cls(code=code)
return cls(code=code)
def to_xdr_bytes(self) -> bytes:
@@ -45,7 +72,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SetTrustLineFlagsResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> SetTrustLineFlagsResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -54,10 +81,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SetTrustLineFlagsResult":
+ def from_xdr(cls, xdr: str) -> SetTrustLineFlagsResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash((self.code,))
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/set_trust_line_flags_result_code.py b/stellar_sdk/xdr/set_trust_line_flags_result_code.py
index 880600011..02b3a1fbd 100644
--- a/stellar_sdk/xdr/set_trust_line_flags_result_code.py
+++ b/stellar_sdk/xdr/set_trust_line_flags_result_code.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["SetTrustLineFlagsResultCode"]
@@ -37,7 +40,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SetTrustLineFlagsResultCode":
+ def unpack(cls, unpacker: Unpacker) -> SetTrustLineFlagsResultCode:
value = unpacker.unpack_int()
return cls(value)
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SetTrustLineFlagsResultCode":
+ def from_xdr_bytes(cls, xdr: bytes) -> SetTrustLineFlagsResultCode:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,6 +59,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SetTrustLineFlagsResultCode":
+ def from_xdr(cls, xdr: str) -> SetTrustLineFlagsResultCode:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/signature.py b/stellar_sdk/xdr/signature.py
index 1e12772d7..7a52fce81 100644
--- a/stellar_sdk/xdr/signature.py
+++ b/stellar_sdk/xdr/signature.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.signature, 64, False).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Signature":
+ def unpack(cls, unpacker: Unpacker) -> Signature:
signature = Opaque.unpack(unpacker, 64, False)
return cls(signature)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Signature":
+ def from_xdr_bytes(cls, xdr: bytes) -> Signature:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Signature":
+ def from_xdr(cls, xdr: str) -> Signature:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.signature)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/signature_hint.py b/stellar_sdk/xdr/signature_hint.py
index 14ec47f52..482db43b7 100644
--- a/stellar_sdk/xdr/signature_hint.py
+++ b/stellar_sdk/xdr/signature_hint.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.signature_hint, 4, True).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SignatureHint":
+ def unpack(cls, unpacker: Unpacker) -> SignatureHint:
signature_hint = Opaque.unpack(unpacker, 4, True)
return cls(signature_hint)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SignatureHint":
+ def from_xdr_bytes(cls, xdr: bytes) -> SignatureHint:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SignatureHint":
+ def from_xdr(cls, xdr: str) -> SignatureHint:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.signature_hint)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/signed_survey_request_message.py b/stellar_sdk/xdr/signed_survey_request_message.py
index b051bc22a..66d7cefbf 100644
--- a/stellar_sdk/xdr/signed_survey_request_message.py
+++ b/stellar_sdk/xdr/signed_survey_request_message.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .signature import Signature
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.request.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SignedSurveyRequestMessage":
+ def unpack(cls, unpacker: Unpacker) -> SignedSurveyRequestMessage:
request_signature = Signature.unpack(unpacker)
request = SurveyRequestMessage.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SignedSurveyRequestMessage":
+ def from_xdr_bytes(cls, xdr: bytes) -> SignedSurveyRequestMessage:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SignedSurveyRequestMessage":
+ def from_xdr(cls, xdr: str) -> SignedSurveyRequestMessage:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.request_signature,
+ self.request,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/signed_survey_response_message.py b/stellar_sdk/xdr/signed_survey_response_message.py
index a1192bafc..8a6fa9615 100644
--- a/stellar_sdk/xdr/signed_survey_response_message.py
+++ b/stellar_sdk/xdr/signed_survey_response_message.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .signature import Signature
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.response.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SignedSurveyResponseMessage":
+ def unpack(cls, unpacker: Unpacker) -> SignedSurveyResponseMessage:
response_signature = Signature.unpack(unpacker)
response = SurveyResponseMessage.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SignedSurveyResponseMessage":
+ def from_xdr_bytes(cls, xdr: bytes) -> SignedSurveyResponseMessage:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SignedSurveyResponseMessage":
+ def from_xdr(cls, xdr: str) -> SignedSurveyResponseMessage:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.response_signature,
+ self.response,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/signer.py b/stellar_sdk/xdr/signer.py
index 121cb42dd..66a0ca120 100644
--- a/stellar_sdk/xdr/signer.py
+++ b/stellar_sdk/xdr/signer.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .signer_key import SignerKey
@@ -33,7 +36,7 @@ def pack(self, packer: Packer) -> None:
self.weight.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Signer":
+ def unpack(cls, unpacker: Unpacker) -> Signer:
key = SignerKey.unpack(unpacker)
weight = Uint32.unpack(unpacker)
return cls(
@@ -47,7 +50,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Signer":
+ def from_xdr_bytes(cls, xdr: bytes) -> Signer:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -56,10 +59,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Signer":
+ def from_xdr(cls, xdr: str) -> Signer:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.key,
+ self.weight,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/signer_key.py b/stellar_sdk/xdr/signer_key.py
index 4ace8faa1..9ce1aac48 100644
--- a/stellar_sdk/xdr/signer_key.py
+++ b/stellar_sdk/xdr/signer_key.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .signer_key_ed25519_signed_payload import SignerKeyEd25519SignedPayload
@@ -25,7 +28,8 @@ class SignerKey:
/* Hash of random 256 bit preimage X */
uint256 hashX;
case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD:
- struct {
+ struct
+ {
/* Public key that must sign the payload. */
uint256 ed25519;
/* Payload to be raw signed by ed25519. */
@@ -72,7 +76,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SignerKey":
+ def unpack(cls, unpacker: Unpacker) -> SignerKey:
type = SignerKeyType.unpack(unpacker)
if type == SignerKeyType.SIGNER_KEY_TYPE_ED25519:
ed25519 = Uint256.unpack(unpacker)
@@ -94,7 +98,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SignerKey":
+ def from_xdr_bytes(cls, xdr: bytes) -> SignerKey:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -103,10 +107,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SignerKey":
+ def from_xdr(cls, xdr: str) -> SignerKey:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.ed25519,
+ self.pre_auth_tx,
+ self.hash_x,
+ self.ed25519_signed_payload,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/signer_key_ed25519_signed_payload.py b/stellar_sdk/xdr/signer_key_ed25519_signed_payload.py
index 2b283c143..219b31ee8 100644
--- a/stellar_sdk/xdr/signer_key_ed25519_signed_payload.py
+++ b/stellar_sdk/xdr/signer_key_ed25519_signed_payload.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -13,7 +16,8 @@ class SignerKeyEd25519SignedPayload:
"""
XDR Source Code::
- struct {
+ struct
+ {
/* Public key that must sign the payload. */
uint256 ed25519;
/* Payload to be raw signed by ed25519. */
@@ -34,7 +38,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.payload, 64, False).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SignerKeyEd25519SignedPayload":
+ def unpack(cls, unpacker: Unpacker) -> SignerKeyEd25519SignedPayload:
ed25519 = Uint256.unpack(unpacker)
payload = Opaque.unpack(unpacker, 64, False)
return cls(
@@ -48,7 +52,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SignerKeyEd25519SignedPayload":
+ def from_xdr_bytes(cls, xdr: bytes) -> SignerKeyEd25519SignedPayload:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -57,10 +61,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SignerKeyEd25519SignedPayload":
+ def from_xdr(cls, xdr: str) -> SignerKeyEd25519SignedPayload:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.ed25519,
+ self.payload,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/signer_key_type.py b/stellar_sdk/xdr/signer_key_type.py
index 13506378b..3486533e8 100644
--- a/stellar_sdk/xdr/signer_key_type.py
+++ b/stellar_sdk/xdr/signer_key_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["SignerKeyType"]
@@ -29,7 +32,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SignerKeyType":
+ def unpack(cls, unpacker: Unpacker) -> SignerKeyType:
value = unpacker.unpack_int()
return cls(value)
@@ -39,7 +42,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SignerKeyType":
+ def from_xdr_bytes(cls, xdr: bytes) -> SignerKeyType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -48,6 +51,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SignerKeyType":
+ def from_xdr(cls, xdr: str) -> SignerKeyType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/simple_payment_result.py b/stellar_sdk/xdr/simple_payment_result.py
index 6aa9f5816..075f948b1 100644
--- a/stellar_sdk/xdr/simple_payment_result.py
+++ b/stellar_sdk/xdr/simple_payment_result.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -38,7 +41,7 @@ def pack(self, packer: Packer) -> None:
self.amount.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SimplePaymentResult":
+ def unpack(cls, unpacker: Unpacker) -> SimplePaymentResult:
destination = AccountID.unpack(unpacker)
asset = Asset.unpack(unpacker)
amount = Int64.unpack(unpacker)
@@ -54,7 +57,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SimplePaymentResult":
+ def from_xdr_bytes(cls, xdr: bytes) -> SimplePaymentResult:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -63,10 +66,19 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SimplePaymentResult":
+ def from_xdr(cls, xdr: str) -> SimplePaymentResult:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.destination,
+ self.asset,
+ self.amount,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/soroban_address_credentials.py b/stellar_sdk/xdr/soroban_address_credentials.py
new file mode 100644
index 000000000..17a7c4457
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_address_credentials.py
@@ -0,0 +1,107 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+from .sc_address import SCAddress
+from .sc_val import SCVal
+from .uint32 import Uint32
+
+__all__ = ["SorobanAddressCredentials"]
+
+
+class SorobanAddressCredentials:
+ """
+ XDR Source Code::
+
+ struct SorobanAddressCredentials
+ {
+ SCAddress address;
+ int64 nonce;
+ uint32 signatureExpirationLedger;
+ SCVal signature;
+ };
+ """
+
+ def __init__(
+ self,
+ address: SCAddress,
+ nonce: Int64,
+ signature_expiration_ledger: Uint32,
+ signature: SCVal,
+ ) -> None:
+ self.address = address
+ self.nonce = nonce
+ self.signature_expiration_ledger = signature_expiration_ledger
+ self.signature = signature
+
+ def pack(self, packer: Packer) -> None:
+ self.address.pack(packer)
+ self.nonce.pack(packer)
+ self.signature_expiration_ledger.pack(packer)
+ self.signature.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanAddressCredentials:
+ address = SCAddress.unpack(unpacker)
+ nonce = Int64.unpack(unpacker)
+ signature_expiration_ledger = Uint32.unpack(unpacker)
+ signature = SCVal.unpack(unpacker)
+ return cls(
+ address=address,
+ nonce=nonce,
+ signature_expiration_ledger=signature_expiration_ledger,
+ signature=signature,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanAddressCredentials:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanAddressCredentials:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.address,
+ self.nonce,
+ self.signature_expiration_ledger,
+ self.signature,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.address == other.address
+ and self.nonce == other.nonce
+ and self.signature_expiration_ledger == other.signature_expiration_ledger
+ and self.signature == other.signature
+ )
+
+ def __str__(self):
+ out = [
+ f"address={self.address}",
+ f"nonce={self.nonce}",
+ f"signature_expiration_ledger={self.signature_expiration_ledger}",
+ f"signature={self.signature}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/soroban_authorization_entry.py b/stellar_sdk/xdr/soroban_authorization_entry.py
new file mode 100644
index 000000000..7ea04b554
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_authorization_entry.py
@@ -0,0 +1,87 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .soroban_authorized_invocation import SorobanAuthorizedInvocation
+from .soroban_credentials import SorobanCredentials
+
+__all__ = ["SorobanAuthorizationEntry"]
+
+
+class SorobanAuthorizationEntry:
+ """
+ XDR Source Code::
+
+ struct SorobanAuthorizationEntry
+ {
+ SorobanCredentials credentials;
+ SorobanAuthorizedInvocation rootInvocation;
+ };
+ """
+
+ def __init__(
+ self,
+ credentials: SorobanCredentials,
+ root_invocation: SorobanAuthorizedInvocation,
+ ) -> None:
+ self.credentials = credentials
+ self.root_invocation = root_invocation
+
+ def pack(self, packer: Packer) -> None:
+ self.credentials.pack(packer)
+ self.root_invocation.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanAuthorizationEntry:
+ credentials = SorobanCredentials.unpack(unpacker)
+ root_invocation = SorobanAuthorizedInvocation.unpack(unpacker)
+ return cls(
+ credentials=credentials,
+ root_invocation=root_invocation,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanAuthorizationEntry:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanAuthorizationEntry:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.credentials,
+ self.root_invocation,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.credentials == other.credentials
+ and self.root_invocation == other.root_invocation
+ )
+
+ def __str__(self):
+ out = [
+ f"credentials={self.credentials}",
+ f"root_invocation={self.root_invocation}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/soroban_authorized_function.py b/stellar_sdk/xdr/soroban_authorized_function.py
new file mode 100644
index 000000000..1cdbab2f1
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_authorized_function.py
@@ -0,0 +1,121 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .create_contract_args import CreateContractArgs
+from .invoke_contract_args import InvokeContractArgs
+from .soroban_authorized_function_type import SorobanAuthorizedFunctionType
+
+__all__ = ["SorobanAuthorizedFunction"]
+
+
+class SorobanAuthorizedFunction:
+ """
+ XDR Source Code::
+
+ union SorobanAuthorizedFunction switch (SorobanAuthorizedFunctionType type)
+ {
+ case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN:
+ InvokeContractArgs contractFn;
+ case SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN:
+ CreateContractArgs createContractHostFn;
+ };
+ """
+
+ def __init__(
+ self,
+ type: SorobanAuthorizedFunctionType,
+ contract_fn: InvokeContractArgs = None,
+ create_contract_host_fn: CreateContractArgs = None,
+ ) -> None:
+ self.type = type
+ self.contract_fn = contract_fn
+ self.create_contract_host_fn = create_contract_host_fn
+
+ def pack(self, packer: Packer) -> None:
+ self.type.pack(packer)
+ if (
+ self.type
+ == SorobanAuthorizedFunctionType.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN
+ ):
+ if self.contract_fn is None:
+ raise ValueError("contract_fn should not be None.")
+ self.contract_fn.pack(packer)
+ return
+ if (
+ self.type
+ == SorobanAuthorizedFunctionType.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN
+ ):
+ if self.create_contract_host_fn is None:
+ raise ValueError("create_contract_host_fn should not be None.")
+ self.create_contract_host_fn.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanAuthorizedFunction:
+ type = SorobanAuthorizedFunctionType.unpack(unpacker)
+ if (
+ type
+ == SorobanAuthorizedFunctionType.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN
+ ):
+ contract_fn = InvokeContractArgs.unpack(unpacker)
+ return cls(type=type, contract_fn=contract_fn)
+ if (
+ type
+ == SorobanAuthorizedFunctionType.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN
+ ):
+ create_contract_host_fn = CreateContractArgs.unpack(unpacker)
+ return cls(type=type, create_contract_host_fn=create_contract_host_fn)
+ return cls(type=type)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanAuthorizedFunction:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanAuthorizedFunction:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.contract_fn,
+ self.create_contract_host_fn,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.type == other.type
+ and self.contract_fn == other.contract_fn
+ and self.create_contract_host_fn == other.create_contract_host_fn
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"type={self.type}")
+ out.append(
+ f"contract_fn={self.contract_fn}"
+ ) if self.contract_fn is not None else None
+ out.append(
+ f"create_contract_host_fn={self.create_contract_host_fn}"
+ ) if self.create_contract_host_fn is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/soroban_authorized_function_type.py b/stellar_sdk/xdr/soroban_authorized_function_type.py
new file mode 100644
index 000000000..b52f11392
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_authorized_function_type.py
@@ -0,0 +1,52 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SorobanAuthorizedFunctionType"]
+
+
+class SorobanAuthorizedFunctionType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SorobanAuthorizedFunctionType
+ {
+ SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN = 0,
+ SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1
+ };
+ """
+
+ SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN = 0
+ SOROBAN_AUTHORIZED_FUNCTION_TYPE_CREATE_CONTRACT_HOST_FN = 1
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanAuthorizedFunctionType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanAuthorizedFunctionType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanAuthorizedFunctionType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/soroban_authorized_invocation.py b/stellar_sdk/xdr/soroban_authorized_invocation.py
new file mode 100644
index 000000000..9b90d64ee
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_authorized_invocation.py
@@ -0,0 +1,97 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .soroban_authorized_function import SorobanAuthorizedFunction
+
+__all__ = ["SorobanAuthorizedInvocation"]
+
+
+class SorobanAuthorizedInvocation:
+ """
+ XDR Source Code::
+
+ struct SorobanAuthorizedInvocation
+ {
+ SorobanAuthorizedFunction function;
+ SorobanAuthorizedInvocation subInvocations<>;
+ };
+ """
+
+ def __init__(
+ self,
+ function: SorobanAuthorizedFunction,
+ sub_invocations: List["SorobanAuthorizedInvocation"],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if sub_invocations and len(sub_invocations) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `sub_invocations` should be {_expect_max_length}, but got {len(sub_invocations)}."
+ )
+ self.function = function
+ self.sub_invocations = sub_invocations
+
+ def pack(self, packer: Packer) -> None:
+ self.function.pack(packer)
+ packer.pack_uint(len(self.sub_invocations))
+ for sub_invocations_item in self.sub_invocations:
+ sub_invocations_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanAuthorizedInvocation:
+ function = SorobanAuthorizedFunction.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ sub_invocations = []
+ for _ in range(length):
+ sub_invocations.append(SorobanAuthorizedInvocation.unpack(unpacker))
+ return cls(
+ function=function,
+ sub_invocations=sub_invocations,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanAuthorizedInvocation:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanAuthorizedInvocation:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.function,
+ self.sub_invocations,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.function == other.function
+ and self.sub_invocations == other.sub_invocations
+ )
+
+ def __str__(self):
+ out = [
+ f"function={self.function}",
+ f"sub_invocations={self.sub_invocations}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/soroban_credentials.py b/stellar_sdk/xdr/soroban_credentials.py
new file mode 100644
index 000000000..93822b368
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_credentials.py
@@ -0,0 +1,92 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .soroban_address_credentials import SorobanAddressCredentials
+from .soroban_credentials_type import SorobanCredentialsType
+
+__all__ = ["SorobanCredentials"]
+
+
+class SorobanCredentials:
+ """
+ XDR Source Code::
+
+ union SorobanCredentials switch (SorobanCredentialsType type)
+ {
+ case SOROBAN_CREDENTIALS_SOURCE_ACCOUNT:
+ void;
+ case SOROBAN_CREDENTIALS_ADDRESS:
+ SorobanAddressCredentials address;
+ };
+ """
+
+ def __init__(
+ self,
+ type: SorobanCredentialsType,
+ address: SorobanAddressCredentials = None,
+ ) -> None:
+ self.type = type
+ self.address = address
+
+ def pack(self, packer: Packer) -> None:
+ self.type.pack(packer)
+ if self.type == SorobanCredentialsType.SOROBAN_CREDENTIALS_SOURCE_ACCOUNT:
+ return
+ if self.type == SorobanCredentialsType.SOROBAN_CREDENTIALS_ADDRESS:
+ if self.address is None:
+ raise ValueError("address should not be None.")
+ self.address.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanCredentials:
+ type = SorobanCredentialsType.unpack(unpacker)
+ if type == SorobanCredentialsType.SOROBAN_CREDENTIALS_SOURCE_ACCOUNT:
+ return cls(type=type)
+ if type == SorobanCredentialsType.SOROBAN_CREDENTIALS_ADDRESS:
+ address = SorobanAddressCredentials.unpack(unpacker)
+ return cls(type=type, address=address)
+ return cls(type=type)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanCredentials:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanCredentials:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.address,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.type == other.type and self.address == other.address
+
+ def __str__(self):
+ out = []
+ out.append(f"type={self.type}")
+ out.append(f"address={self.address}") if self.address is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/soroban_credentials_type.py b/stellar_sdk/xdr/soroban_credentials_type.py
new file mode 100644
index 000000000..b07bf1a03
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_credentials_type.py
@@ -0,0 +1,52 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SorobanCredentialsType"]
+
+
+class SorobanCredentialsType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SorobanCredentialsType
+ {
+ SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0,
+ SOROBAN_CREDENTIALS_ADDRESS = 1
+ };
+ """
+
+ SOROBAN_CREDENTIALS_SOURCE_ACCOUNT = 0
+ SOROBAN_CREDENTIALS_ADDRESS = 1
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanCredentialsType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanCredentialsType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanCredentialsType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/soroban_resources.py b/stellar_sdk/xdr/soroban_resources.py
new file mode 100644
index 000000000..d74f4440d
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_resources.py
@@ -0,0 +1,110 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .ledger_footprint import LedgerFootprint
+from .uint32 import Uint32
+
+__all__ = ["SorobanResources"]
+
+
+class SorobanResources:
+ """
+ XDR Source Code::
+
+ struct SorobanResources
+ {
+ // The ledger footprint of the transaction.
+ LedgerFootprint footprint;
+ // The maximum number of instructions this transaction can use
+ uint32 instructions;
+
+ // The maximum number of bytes this transaction can read from ledger
+ uint32 readBytes;
+ // The maximum number of bytes this transaction can write to ledger
+ uint32 writeBytes;
+ };
+ """
+
+ def __init__(
+ self,
+ footprint: LedgerFootprint,
+ instructions: Uint32,
+ read_bytes: Uint32,
+ write_bytes: Uint32,
+ ) -> None:
+ self.footprint = footprint
+ self.instructions = instructions
+ self.read_bytes = read_bytes
+ self.write_bytes = write_bytes
+
+ def pack(self, packer: Packer) -> None:
+ self.footprint.pack(packer)
+ self.instructions.pack(packer)
+ self.read_bytes.pack(packer)
+ self.write_bytes.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanResources:
+ footprint = LedgerFootprint.unpack(unpacker)
+ instructions = Uint32.unpack(unpacker)
+ read_bytes = Uint32.unpack(unpacker)
+ write_bytes = Uint32.unpack(unpacker)
+ return cls(
+ footprint=footprint,
+ instructions=instructions,
+ read_bytes=read_bytes,
+ write_bytes=write_bytes,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanResources:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanResources:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.footprint,
+ self.instructions,
+ self.read_bytes,
+ self.write_bytes,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.footprint == other.footprint
+ and self.instructions == other.instructions
+ and self.read_bytes == other.read_bytes
+ and self.write_bytes == other.write_bytes
+ )
+
+ def __str__(self):
+ out = [
+ f"footprint={self.footprint}",
+ f"instructions={self.instructions}",
+ f"read_bytes={self.read_bytes}",
+ f"write_bytes={self.write_bytes}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/soroban_transaction_data.py b/stellar_sdk/xdr/soroban_transaction_data.py
new file mode 100644
index 000000000..2fd42875d
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_transaction_data.py
@@ -0,0 +1,98 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .extension_point import ExtensionPoint
+from .int64 import Int64
+from .soroban_resources import SorobanResources
+
+__all__ = ["SorobanTransactionData"]
+
+
+class SorobanTransactionData:
+ """
+ XDR Source Code::
+
+ struct SorobanTransactionData
+ {
+ ExtensionPoint ext;
+ SorobanResources resources;
+ // Portion of transaction `fee` allocated to refundable fees.
+ int64 refundableFee;
+ };
+ """
+
+ def __init__(
+ self,
+ ext: ExtensionPoint,
+ resources: SorobanResources,
+ refundable_fee: Int64,
+ ) -> None:
+ self.ext = ext
+ self.resources = resources
+ self.refundable_fee = refundable_fee
+
+ def pack(self, packer: Packer) -> None:
+ self.ext.pack(packer)
+ self.resources.pack(packer)
+ self.refundable_fee.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanTransactionData:
+ ext = ExtensionPoint.unpack(unpacker)
+ resources = SorobanResources.unpack(unpacker)
+ refundable_fee = Int64.unpack(unpacker)
+ return cls(
+ ext=ext,
+ resources=resources,
+ refundable_fee=refundable_fee,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanTransactionData:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanTransactionData:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.resources,
+ self.refundable_fee,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ext == other.ext
+ and self.resources == other.resources
+ and self.refundable_fee == other.refundable_fee
+ )
+
+ def __str__(self):
+ out = [
+ f"ext={self.ext}",
+ f"resources={self.resources}",
+ f"refundable_fee={self.refundable_fee}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/soroban_transaction_meta.py b/stellar_sdk/xdr/soroban_transaction_meta.py
new file mode 100644
index 000000000..307a06f91
--- /dev/null
+++ b/stellar_sdk/xdr/soroban_transaction_meta.py
@@ -0,0 +1,134 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from typing import List
+
+from xdrlib3 import Packer, Unpacker
+
+from .contract_event import ContractEvent
+from .diagnostic_event import DiagnosticEvent
+from .extension_point import ExtensionPoint
+from .sc_val import SCVal
+
+__all__ = ["SorobanTransactionMeta"]
+
+
+class SorobanTransactionMeta:
+ """
+ XDR Source Code::
+
+ struct SorobanTransactionMeta
+ {
+ ExtensionPoint ext;
+
+ ContractEvent events<>; // custom events populated by the
+ // contracts themselves.
+ SCVal returnValue; // return value of the host fn invocation
+
+ // Diagnostics events that are not hashed.
+ // This will contain all contract and diagnostic events. Even ones
+ // that were emitted in a failed contract call.
+ DiagnosticEvent diagnosticEvents<>;
+ };
+ """
+
+ def __init__(
+ self,
+ ext: ExtensionPoint,
+ events: List[ContractEvent],
+ return_value: SCVal,
+ diagnostic_events: List[DiagnosticEvent],
+ ) -> None:
+ _expect_max_length = 4294967295
+ if events and len(events) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `events` should be {_expect_max_length}, but got {len(events)}."
+ )
+ _expect_max_length = 4294967295
+ if diagnostic_events and len(diagnostic_events) > _expect_max_length:
+ raise ValueError(
+ f"The maximum length of `diagnostic_events` should be {_expect_max_length}, but got {len(diagnostic_events)}."
+ )
+ self.ext = ext
+ self.events = events
+ self.return_value = return_value
+ self.diagnostic_events = diagnostic_events
+
+ def pack(self, packer: Packer) -> None:
+ self.ext.pack(packer)
+ packer.pack_uint(len(self.events))
+ for events_item in self.events:
+ events_item.pack(packer)
+ self.return_value.pack(packer)
+ packer.pack_uint(len(self.diagnostic_events))
+ for diagnostic_events_item in self.diagnostic_events:
+ diagnostic_events_item.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SorobanTransactionMeta:
+ ext = ExtensionPoint.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ events = []
+ for _ in range(length):
+ events.append(ContractEvent.unpack(unpacker))
+ return_value = SCVal.unpack(unpacker)
+ length = unpacker.unpack_uint()
+ diagnostic_events = []
+ for _ in range(length):
+ diagnostic_events.append(DiagnosticEvent.unpack(unpacker))
+ return cls(
+ ext=ext,
+ events=events,
+ return_value=return_value,
+ diagnostic_events=diagnostic_events,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SorobanTransactionMeta:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SorobanTransactionMeta:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.ext,
+ self.events,
+ self.return_value,
+ self.diagnostic_events,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.ext == other.ext
+ and self.events == other.events
+ and self.return_value == other.return_value
+ and self.diagnostic_events == other.diagnostic_events
+ )
+
+ def __str__(self):
+ out = [
+ f"ext={self.ext}",
+ f"events={self.events}",
+ f"return_value={self.return_value}",
+ f"diagnostic_events={self.diagnostic_events}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/sponsorship_descriptor.py b/stellar_sdk/xdr/sponsorship_descriptor.py
index 2300def08..cd95c088c 100644
--- a/stellar_sdk/xdr/sponsorship_descriptor.py
+++ b/stellar_sdk/xdr/sponsorship_descriptor.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import Optional
+
from xdrlib3 import Packer, Unpacker
from .account_id import AccountID
@@ -27,7 +30,7 @@ def pack(self, packer: Packer) -> None:
self.sponsorship_descriptor.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SponsorshipDescriptor":
+ def unpack(cls, unpacker: Unpacker) -> SponsorshipDescriptor:
sponsorship_descriptor = (
AccountID.unpack(unpacker) if unpacker.unpack_uint() else None
)
@@ -39,7 +42,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SponsorshipDescriptor":
+ def from_xdr_bytes(cls, xdr: bytes) -> SponsorshipDescriptor:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -48,10 +51,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SponsorshipDescriptor":
+ def from_xdr(cls, xdr: str) -> SponsorshipDescriptor:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.sponsorship_descriptor)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/state_expiration_settings.py b/stellar_sdk/xdr/state_expiration_settings.py
new file mode 100644
index 000000000..0b4f67290
--- /dev/null
+++ b/stellar_sdk/xdr/state_expiration_settings.py
@@ -0,0 +1,163 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .int64 import Int64
+from .uint32 import Uint32
+from .uint64 import Uint64
+
+__all__ = ["StateExpirationSettings"]
+
+
+class StateExpirationSettings:
+ """
+ XDR Source Code::
+
+ struct StateExpirationSettings {
+ uint32 maxEntryExpiration;
+ uint32 minTempEntryExpiration;
+ uint32 minPersistentEntryExpiration;
+
+ // rent_fee = wfee_rate_average / rent_rate_denominator_for_type
+ int64 persistentRentRateDenominator;
+ int64 tempRentRateDenominator;
+
+ // max number of entries that emit expiration meta in a single ledger
+ uint32 maxEntriesToExpire;
+
+ // Number of snapshots to use when calculating average BucketList size
+ uint32 bucketListSizeWindowSampleSize;
+
+ // Maximum number of bytes that we scan for eviction per ledger
+ uint64 evictionScanSize;
+
+ // Lowest BucketList level to be scanned to evict entries
+ uint32 startingEvictionScanLevel;
+ };
+ """
+
+ def __init__(
+ self,
+ max_entry_expiration: Uint32,
+ min_temp_entry_expiration: Uint32,
+ min_persistent_entry_expiration: Uint32,
+ persistent_rent_rate_denominator: Int64,
+ temp_rent_rate_denominator: Int64,
+ max_entries_to_expire: Uint32,
+ bucket_list_size_window_sample_size: Uint32,
+ eviction_scan_size: Uint64,
+ starting_eviction_scan_level: Uint32,
+ ) -> None:
+ self.max_entry_expiration = max_entry_expiration
+ self.min_temp_entry_expiration = min_temp_entry_expiration
+ self.min_persistent_entry_expiration = min_persistent_entry_expiration
+ self.persistent_rent_rate_denominator = persistent_rent_rate_denominator
+ self.temp_rent_rate_denominator = temp_rent_rate_denominator
+ self.max_entries_to_expire = max_entries_to_expire
+ self.bucket_list_size_window_sample_size = bucket_list_size_window_sample_size
+ self.eviction_scan_size = eviction_scan_size
+ self.starting_eviction_scan_level = starting_eviction_scan_level
+
+ def pack(self, packer: Packer) -> None:
+ self.max_entry_expiration.pack(packer)
+ self.min_temp_entry_expiration.pack(packer)
+ self.min_persistent_entry_expiration.pack(packer)
+ self.persistent_rent_rate_denominator.pack(packer)
+ self.temp_rent_rate_denominator.pack(packer)
+ self.max_entries_to_expire.pack(packer)
+ self.bucket_list_size_window_sample_size.pack(packer)
+ self.eviction_scan_size.pack(packer)
+ self.starting_eviction_scan_level.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> StateExpirationSettings:
+ max_entry_expiration = Uint32.unpack(unpacker)
+ min_temp_entry_expiration = Uint32.unpack(unpacker)
+ min_persistent_entry_expiration = Uint32.unpack(unpacker)
+ persistent_rent_rate_denominator = Int64.unpack(unpacker)
+ temp_rent_rate_denominator = Int64.unpack(unpacker)
+ max_entries_to_expire = Uint32.unpack(unpacker)
+ bucket_list_size_window_sample_size = Uint32.unpack(unpacker)
+ eviction_scan_size = Uint64.unpack(unpacker)
+ starting_eviction_scan_level = Uint32.unpack(unpacker)
+ return cls(
+ max_entry_expiration=max_entry_expiration,
+ min_temp_entry_expiration=min_temp_entry_expiration,
+ min_persistent_entry_expiration=min_persistent_entry_expiration,
+ persistent_rent_rate_denominator=persistent_rent_rate_denominator,
+ temp_rent_rate_denominator=temp_rent_rate_denominator,
+ max_entries_to_expire=max_entries_to_expire,
+ bucket_list_size_window_sample_size=bucket_list_size_window_sample_size,
+ eviction_scan_size=eviction_scan_size,
+ starting_eviction_scan_level=starting_eviction_scan_level,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> StateExpirationSettings:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> StateExpirationSettings:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.max_entry_expiration,
+ self.min_temp_entry_expiration,
+ self.min_persistent_entry_expiration,
+ self.persistent_rent_rate_denominator,
+ self.temp_rent_rate_denominator,
+ self.max_entries_to_expire,
+ self.bucket_list_size_window_sample_size,
+ self.eviction_scan_size,
+ self.starting_eviction_scan_level,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.max_entry_expiration == other.max_entry_expiration
+ and self.min_temp_entry_expiration == other.min_temp_entry_expiration
+ and self.min_persistent_entry_expiration
+ == other.min_persistent_entry_expiration
+ and self.persistent_rent_rate_denominator
+ == other.persistent_rent_rate_denominator
+ and self.temp_rent_rate_denominator == other.temp_rent_rate_denominator
+ and self.max_entries_to_expire == other.max_entries_to_expire
+ and self.bucket_list_size_window_sample_size
+ == other.bucket_list_size_window_sample_size
+ and self.eviction_scan_size == other.eviction_scan_size
+ and self.starting_eviction_scan_level == other.starting_eviction_scan_level
+ )
+
+ def __str__(self):
+ out = [
+ f"max_entry_expiration={self.max_entry_expiration}",
+ f"min_temp_entry_expiration={self.min_temp_entry_expiration}",
+ f"min_persistent_entry_expiration={self.min_persistent_entry_expiration}",
+ f"persistent_rent_rate_denominator={self.persistent_rent_rate_denominator}",
+ f"temp_rent_rate_denominator={self.temp_rent_rate_denominator}",
+ f"max_entries_to_expire={self.max_entries_to_expire}",
+ f"bucket_list_size_window_sample_size={self.bucket_list_size_window_sample_size}",
+ f"eviction_scan_size={self.eviction_scan_size}",
+ f"starting_eviction_scan_level={self.starting_eviction_scan_level}",
+ ]
+ return f""
diff --git a/stellar_sdk/xdr/stellar_message.py b/stellar_sdk/xdr/stellar_message.py
index 5c1cf0579..c7c9e0a0a 100644
--- a/stellar_sdk/xdr/stellar_message.py
+++ b/stellar_sdk/xdr/stellar_message.py
@@ -1,18 +1,25 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .auth import Auth
from .dont_have import DontHave
from .error import Error
+from .flood_advert import FloodAdvert
+from .flood_demand import FloodDemand
+from .generalized_transaction_set import GeneralizedTransactionSet
from .hello import Hello
from .message_type import MessageType
from .peer_address import PeerAddress
from .scp_envelope import SCPEnvelope
from .scp_quorum_set import SCPQuorumSet
from .send_more import SendMore
+from .send_more_extended import SendMoreExtended
from .signed_survey_request_message import SignedSurveyRequestMessage
from .signed_survey_response_message import SignedSurveyResponseMessage
from .transaction_envelope import TransactionEnvelope
@@ -46,6 +53,8 @@ class StellarMessage:
uint256 txSetHash;
case TX_SET:
TransactionSet txSet;
+ case GENERALIZED_TX_SET:
+ GeneralizedTransactionSet generalizedTxSet;
case TRANSACTION:
TransactionEnvelope transaction;
@@ -67,6 +76,13 @@ class StellarMessage:
uint32 getSCPLedgerSeq; // ledger seq requested ; if 0, requests the latest
case SEND_MORE:
SendMore sendMoreMessage;
+ case SEND_MORE_EXTENDED:
+ SendMoreExtended sendMoreExtendedMessage;
+ // Pull mode
+ case FLOOD_ADVERT:
+ FloodAdvert floodAdvert;
+ case FLOOD_DEMAND:
+ FloodDemand floodDemand;
};
"""
@@ -80,6 +96,7 @@ def __init__(
peers: List[PeerAddress] = None,
tx_set_hash: Uint256 = None,
tx_set: TransactionSet = None,
+ generalized_tx_set: GeneralizedTransactionSet = None,
transaction: TransactionEnvelope = None,
signed_survey_request_message: SignedSurveyRequestMessage = None,
signed_survey_response_message: SignedSurveyResponseMessage = None,
@@ -88,6 +105,9 @@ def __init__(
envelope: SCPEnvelope = None,
get_scp_ledger_seq: Uint32 = None,
send_more_message: SendMore = None,
+ send_more_extended_message: SendMoreExtended = None,
+ flood_advert: FloodAdvert = None,
+ flood_demand: FloodDemand = None,
) -> None:
_expect_max_length = 100
if peers and len(peers) > _expect_max_length:
@@ -102,6 +122,7 @@ def __init__(
self.peers = peers
self.tx_set_hash = tx_set_hash
self.tx_set = tx_set
+ self.generalized_tx_set = generalized_tx_set
self.transaction = transaction
self.signed_survey_request_message = signed_survey_request_message
self.signed_survey_response_message = signed_survey_response_message
@@ -110,6 +131,9 @@ def __init__(
self.envelope = envelope
self.get_scp_ledger_seq = get_scp_ledger_seq
self.send_more_message = send_more_message
+ self.send_more_extended_message = send_more_extended_message
+ self.flood_advert = flood_advert
+ self.flood_demand = flood_demand
def pack(self, packer: Packer) -> None:
self.type.pack(packer)
@@ -152,6 +176,11 @@ def pack(self, packer: Packer) -> None:
raise ValueError("tx_set should not be None.")
self.tx_set.pack(packer)
return
+ if self.type == MessageType.GENERALIZED_TX_SET:
+ if self.generalized_tx_set is None:
+ raise ValueError("generalized_tx_set should not be None.")
+ self.generalized_tx_set.pack(packer)
+ return
if self.type == MessageType.TRANSACTION:
if self.transaction is None:
raise ValueError("transaction should not be None.")
@@ -192,9 +221,24 @@ def pack(self, packer: Packer) -> None:
raise ValueError("send_more_message should not be None.")
self.send_more_message.pack(packer)
return
+ if self.type == MessageType.SEND_MORE_EXTENDED:
+ if self.send_more_extended_message is None:
+ raise ValueError("send_more_extended_message should not be None.")
+ self.send_more_extended_message.pack(packer)
+ return
+ if self.type == MessageType.FLOOD_ADVERT:
+ if self.flood_advert is None:
+ raise ValueError("flood_advert should not be None.")
+ self.flood_advert.pack(packer)
+ return
+ if self.type == MessageType.FLOOD_DEMAND:
+ if self.flood_demand is None:
+ raise ValueError("flood_demand should not be None.")
+ self.flood_demand.pack(packer)
+ return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "StellarMessage":
+ def unpack(cls, unpacker: Unpacker) -> StellarMessage:
type = MessageType.unpack(unpacker)
if type == MessageType.ERROR_MSG:
error = Error.unpack(unpacker)
@@ -222,6 +266,9 @@ def unpack(cls, unpacker: Unpacker) -> "StellarMessage":
if type == MessageType.TX_SET:
tx_set = TransactionSet.unpack(unpacker)
return cls(type=type, tx_set=tx_set)
+ if type == MessageType.GENERALIZED_TX_SET:
+ generalized_tx_set = GeneralizedTransactionSet.unpack(unpacker)
+ return cls(type=type, generalized_tx_set=generalized_tx_set)
if type == MessageType.TRANSACTION:
transaction = TransactionEnvelope.unpack(unpacker)
return cls(type=type, transaction=transaction)
@@ -252,6 +299,15 @@ def unpack(cls, unpacker: Unpacker) -> "StellarMessage":
if type == MessageType.SEND_MORE:
send_more_message = SendMore.unpack(unpacker)
return cls(type=type, send_more_message=send_more_message)
+ if type == MessageType.SEND_MORE_EXTENDED:
+ send_more_extended_message = SendMoreExtended.unpack(unpacker)
+ return cls(type=type, send_more_extended_message=send_more_extended_message)
+ if type == MessageType.FLOOD_ADVERT:
+ flood_advert = FloodAdvert.unpack(unpacker)
+ return cls(type=type, flood_advert=flood_advert)
+ if type == MessageType.FLOOD_DEMAND:
+ flood_demand = FloodDemand.unpack(unpacker)
+ return cls(type=type, flood_demand=flood_demand)
return cls(type=type)
def to_xdr_bytes(self) -> bytes:
@@ -260,7 +316,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "StellarMessage":
+ def from_xdr_bytes(cls, xdr: bytes) -> StellarMessage:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -269,10 +325,36 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "StellarMessage":
+ def from_xdr(cls, xdr: str) -> StellarMessage:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.error,
+ self.hello,
+ self.auth,
+ self.dont_have,
+ self.peers,
+ self.tx_set_hash,
+ self.tx_set,
+ self.generalized_tx_set,
+ self.transaction,
+ self.signed_survey_request_message,
+ self.signed_survey_response_message,
+ self.q_set_hash,
+ self.q_set,
+ self.envelope,
+ self.get_scp_ledger_seq,
+ self.send_more_message,
+ self.send_more_extended_message,
+ self.flood_advert,
+ self.flood_demand,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -285,6 +367,7 @@ def __eq__(self, other: object):
and self.peers == other.peers
and self.tx_set_hash == other.tx_set_hash
and self.tx_set == other.tx_set
+ and self.generalized_tx_set == other.generalized_tx_set
and self.transaction == other.transaction
and self.signed_survey_request_message
== other.signed_survey_request_message
@@ -295,6 +378,9 @@ def __eq__(self, other: object):
and self.envelope == other.envelope
and self.get_scp_ledger_seq == other.get_scp_ledger_seq
and self.send_more_message == other.send_more_message
+ and self.send_more_extended_message == other.send_more_extended_message
+ and self.flood_advert == other.flood_advert
+ and self.flood_demand == other.flood_demand
)
def __str__(self):
@@ -311,6 +397,9 @@ def __str__(self):
f"tx_set_hash={self.tx_set_hash}"
) if self.tx_set_hash is not None else None
out.append(f"tx_set={self.tx_set}") if self.tx_set is not None else None
+ out.append(
+ f"generalized_tx_set={self.generalized_tx_set}"
+ ) if self.generalized_tx_set is not None else None
out.append(
f"transaction={self.transaction}"
) if self.transaction is not None else None
@@ -331,4 +420,13 @@ def __str__(self):
out.append(
f"send_more_message={self.send_more_message}"
) if self.send_more_message is not None else None
+ out.append(
+ f"send_more_extended_message={self.send_more_extended_message}"
+ ) if self.send_more_extended_message is not None else None
+ out.append(
+ f"flood_advert={self.flood_advert}"
+ ) if self.flood_advert is not None else None
+ out.append(
+ f"flood_demand={self.flood_demand}"
+ ) if self.flood_demand is not None else None
return f""
diff --git a/stellar_sdk/xdr/stellar_value.py b/stellar_sdk/xdr/stellar_value.py
index ac597983e..3f7b80ab7 100644
--- a/stellar_sdk/xdr/stellar_value.py
+++ b/stellar_sdk/xdr/stellar_value.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from typing import List
+
from xdrlib3 import Packer, Unpacker
from .hash import Hash
@@ -66,7 +69,7 @@ def pack(self, packer: Packer) -> None:
self.ext.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "StellarValue":
+ def unpack(cls, unpacker: Unpacker) -> StellarValue:
tx_set_hash = Hash.unpack(unpacker)
close_time = TimePoint.unpack(unpacker)
length = unpacker.unpack_uint()
@@ -87,7 +90,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "StellarValue":
+ def from_xdr_bytes(cls, xdr: bytes) -> StellarValue:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -96,10 +99,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "StellarValue":
+ def from_xdr(cls, xdr: str) -> StellarValue:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.tx_set_hash,
+ self.close_time,
+ self.upgrades,
+ self.ext,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/stellar_value_ext.py b/stellar_sdk/xdr/stellar_value_ext.py
index a45cc3246..9a6159d4b 100644
--- a/stellar_sdk/xdr/stellar_value_ext.py
+++ b/stellar_sdk/xdr/stellar_value_ext.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .ledger_close_value_signature import LedgerCloseValueSignature
@@ -41,7 +44,7 @@ def pack(self, packer: Packer) -> None:
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "StellarValueExt":
+ def unpack(cls, unpacker: Unpacker) -> StellarValueExt:
v = StellarValueType.unpack(unpacker)
if v == StellarValueType.STELLAR_VALUE_BASIC:
return cls(v=v)
@@ -56,7 +59,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "StellarValueExt":
+ def from_xdr_bytes(cls, xdr: bytes) -> StellarValueExt:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -65,10 +68,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "StellarValueExt":
+ def from_xdr(cls, xdr: str) -> StellarValueExt:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.lc_value_signature,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/stellar_value_type.py b/stellar_sdk/xdr/stellar_value_type.py
index 3b2cb056f..0004b7fe4 100644
--- a/stellar_sdk/xdr/stellar_value_type.py
+++ b/stellar_sdk/xdr/stellar_value_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["StellarValueType"]
@@ -25,7 +28,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "StellarValueType":
+ def unpack(cls, unpacker: Unpacker) -> StellarValueType:
value = unpacker.unpack_int()
return cls(value)
@@ -35,7 +38,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "StellarValueType":
+ def from_xdr_bytes(cls, xdr: bytes) -> StellarValueType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -44,6 +47,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "StellarValueType":
+ def from_xdr(cls, xdr: str) -> StellarValueType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/stored_transaction_set.py b/stellar_sdk/xdr/stored_transaction_set.py
new file mode 100644
index 000000000..680007261
--- /dev/null
+++ b/stellar_sdk/xdr/stored_transaction_set.py
@@ -0,0 +1,107 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .base import Integer
+from .generalized_transaction_set import GeneralizedTransactionSet
+from .transaction_set import TransactionSet
+
+__all__ = ["StoredTransactionSet"]
+
+
+class StoredTransactionSet:
+ """
+ XDR Source Code::
+
+ union StoredTransactionSet switch (int v)
+ {
+ case 0:
+ TransactionSet txSet;
+ case 1:
+ GeneralizedTransactionSet generalizedTxSet;
+ };
+ """
+
+ def __init__(
+ self,
+ v: int,
+ tx_set: TransactionSet = None,
+ generalized_tx_set: GeneralizedTransactionSet = None,
+ ) -> None:
+ self.v = v
+ self.tx_set = tx_set
+ self.generalized_tx_set = generalized_tx_set
+
+ def pack(self, packer: Packer) -> None:
+ Integer(self.v).pack(packer)
+ if self.v == 0:
+ if self.tx_set is None:
+ raise ValueError("tx_set should not be None.")
+ self.tx_set.pack(packer)
+ return
+ if self.v == 1:
+ if self.generalized_tx_set is None:
+ raise ValueError("generalized_tx_set should not be None.")
+ self.generalized_tx_set.pack(packer)
+ return
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> StoredTransactionSet:
+ v = Integer.unpack(unpacker)
+ if v == 0:
+ tx_set = TransactionSet.unpack(unpacker)
+ return cls(v=v, tx_set=tx_set)
+ if v == 1:
+ generalized_tx_set = GeneralizedTransactionSet.unpack(unpacker)
+ return cls(v=v, generalized_tx_set=generalized_tx_set)
+ return cls(v=v)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> StoredTransactionSet:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> StoredTransactionSet:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.v,
+ self.tx_set,
+ self.generalized_tx_set,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.v == other.v
+ and self.tx_set == other.tx_set
+ and self.generalized_tx_set == other.generalized_tx_set
+ )
+
+ def __str__(self):
+ out = []
+ out.append(f"v={self.v}")
+ out.append(f"tx_set={self.tx_set}") if self.tx_set is not None else None
+ out.append(
+ f"generalized_tx_set={self.generalized_tx_set}"
+ ) if self.generalized_tx_set is not None else None
+ return f""
diff --git a/stellar_sdk/xdr/string32.py b/stellar_sdk/xdr/string32.py
index 04e56e42b..386eb4685 100644
--- a/stellar_sdk/xdr/string32.py
+++ b/stellar_sdk/xdr/string32.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import String
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
String(self.string32, 32).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "String32":
+ def unpack(cls, unpacker: Unpacker) -> String32:
string32 = String.unpack(unpacker)
return cls(string32)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "String32":
+ def from_xdr_bytes(cls, xdr: bytes) -> String32:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "String32":
+ def from_xdr(cls, xdr: str) -> String32:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.string32)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/string64.py b/stellar_sdk/xdr/string64.py
index 062391803..06248e569 100644
--- a/stellar_sdk/xdr/string64.py
+++ b/stellar_sdk/xdr/string64.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import String
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
String(self.string64, 64).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "String64":
+ def unpack(cls, unpacker: Unpacker) -> String64:
string64 = String.unpack(unpacker)
return cls(string64)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "String64":
+ def from_xdr_bytes(cls, xdr: bytes) -> String64:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "String64":
+ def from_xdr(cls, xdr: str) -> String64:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.string64)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/survey_message_command_type.py b/stellar_sdk/xdr/survey_message_command_type.py
index 45edf4786..635c7650b 100644
--- a/stellar_sdk/xdr/survey_message_command_type.py
+++ b/stellar_sdk/xdr/survey_message_command_type.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["SurveyMessageCommandType"]
@@ -23,7 +26,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SurveyMessageCommandType":
+ def unpack(cls, unpacker: Unpacker) -> SurveyMessageCommandType:
value = unpacker.unpack_int()
return cls(value)
@@ -33,7 +36,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SurveyMessageCommandType":
+ def from_xdr_bytes(cls, xdr: bytes) -> SurveyMessageCommandType:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -42,6 +45,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SurveyMessageCommandType":
+ def from_xdr(cls, xdr: str) -> SurveyMessageCommandType:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/survey_message_response_type.py b/stellar_sdk/xdr/survey_message_response_type.py
new file mode 100644
index 000000000..404683c30
--- /dev/null
+++ b/stellar_sdk/xdr/survey_message_response_type.py
@@ -0,0 +1,52 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+from enum import IntEnum
+
+from xdrlib3 import Packer, Unpacker
+
+__all__ = ["SurveyMessageResponseType"]
+
+
+class SurveyMessageResponseType(IntEnum):
+ """
+ XDR Source Code::
+
+ enum SurveyMessageResponseType
+ {
+ SURVEY_TOPOLOGY_RESPONSE_V0 = 0,
+ SURVEY_TOPOLOGY_RESPONSE_V1 = 1
+ };
+ """
+
+ SURVEY_TOPOLOGY_RESPONSE_V0 = 0
+ SURVEY_TOPOLOGY_RESPONSE_V1 = 1
+
+ def pack(self, packer: Packer) -> None:
+ packer.pack_int(self.value)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> SurveyMessageResponseType:
+ value = unpacker.unpack_int()
+ return cls(value)
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> SurveyMessageResponseType:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> SurveyMessageResponseType:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/survey_request_message.py b/stellar_sdk/xdr/survey_request_message.py
index 55509b3e5..b5ddf1301 100644
--- a/stellar_sdk/xdr/survey_request_message.py
+++ b/stellar_sdk/xdr/survey_request_message.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .curve25519_public import Curve25519Public
@@ -47,7 +50,7 @@ def pack(self, packer: Packer) -> None:
self.command_type.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SurveyRequestMessage":
+ def unpack(cls, unpacker: Unpacker) -> SurveyRequestMessage:
surveyor_peer_id = NodeID.unpack(unpacker)
surveyed_peer_id = NodeID.unpack(unpacker)
ledger_num = Uint32.unpack(unpacker)
@@ -67,7 +70,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SurveyRequestMessage":
+ def from_xdr_bytes(cls, xdr: bytes) -> SurveyRequestMessage:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -76,10 +79,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SurveyRequestMessage":
+ def from_xdr(cls, xdr: str) -> SurveyRequestMessage:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.surveyor_peer_id,
+ self.surveyed_peer_id,
+ self.ledger_num,
+ self.encryption_key,
+ self.command_type,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/survey_response_body.py b/stellar_sdk/xdr/survey_response_body.py
index 763a9c576..42a15e0b4 100644
--- a/stellar_sdk/xdr/survey_response_body.py
+++ b/stellar_sdk/xdr/survey_response_body.py
@@ -1,10 +1,14 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
-from .survey_message_command_type import SurveyMessageCommandType
-from .topology_response_body import TopologyResponseBody
+from .survey_message_response_type import SurveyMessageResponseType
+from .topology_response_body_v0 import TopologyResponseBodyV0
+from .topology_response_body_v1 import TopologyResponseBodyV1
__all__ = ["SurveyResponseBody"]
@@ -13,35 +17,47 @@ class SurveyResponseBody:
"""
XDR Source Code::
- union SurveyResponseBody switch (SurveyMessageCommandType type)
+ union SurveyResponseBody switch (SurveyMessageResponseType type)
{
- case SURVEY_TOPOLOGY:
- TopologyResponseBody topologyResponseBody;
+ case SURVEY_TOPOLOGY_RESPONSE_V0:
+ TopologyResponseBodyV0 topologyResponseBodyV0;
+ case SURVEY_TOPOLOGY_RESPONSE_V1:
+ TopologyResponseBodyV1 topologyResponseBodyV1;
};
"""
def __init__(
self,
- type: SurveyMessageCommandType,
- topology_response_body: TopologyResponseBody = None,
+ type: SurveyMessageResponseType,
+ topology_response_body_v0: TopologyResponseBodyV0 = None,
+ topology_response_body_v1: TopologyResponseBodyV1 = None,
) -> None:
self.type = type
- self.topology_response_body = topology_response_body
+ self.topology_response_body_v0 = topology_response_body_v0
+ self.topology_response_body_v1 = topology_response_body_v1
def pack(self, packer: Packer) -> None:
self.type.pack(packer)
- if self.type == SurveyMessageCommandType.SURVEY_TOPOLOGY:
- if self.topology_response_body is None:
- raise ValueError("topology_response_body should not be None.")
- self.topology_response_body.pack(packer)
+ if self.type == SurveyMessageResponseType.SURVEY_TOPOLOGY_RESPONSE_V0:
+ if self.topology_response_body_v0 is None:
+ raise ValueError("topology_response_body_v0 should not be None.")
+ self.topology_response_body_v0.pack(packer)
+ return
+ if self.type == SurveyMessageResponseType.SURVEY_TOPOLOGY_RESPONSE_V1:
+ if self.topology_response_body_v1 is None:
+ raise ValueError("topology_response_body_v1 should not be None.")
+ self.topology_response_body_v1.pack(packer)
return
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SurveyResponseBody":
- type = SurveyMessageCommandType.unpack(unpacker)
- if type == SurveyMessageCommandType.SURVEY_TOPOLOGY:
- topology_response_body = TopologyResponseBody.unpack(unpacker)
- return cls(type=type, topology_response_body=topology_response_body)
+ def unpack(cls, unpacker: Unpacker) -> SurveyResponseBody:
+ type = SurveyMessageResponseType.unpack(unpacker)
+ if type == SurveyMessageResponseType.SURVEY_TOPOLOGY_RESPONSE_V0:
+ topology_response_body_v0 = TopologyResponseBodyV0.unpack(unpacker)
+ return cls(type=type, topology_response_body_v0=topology_response_body_v0)
+ if type == SurveyMessageResponseType.SURVEY_TOPOLOGY_RESPONSE_V1:
+ topology_response_body_v1 = TopologyResponseBodyV1.unpack(unpacker)
+ return cls(type=type, topology_response_body_v1=topology_response_body_v1)
return cls(type=type)
def to_xdr_bytes(self) -> bytes:
@@ -50,7 +66,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SurveyResponseBody":
+ def from_xdr_bytes(cls, xdr: bytes) -> SurveyResponseBody:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -59,22 +75,35 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SurveyResponseBody":
+ def from_xdr(cls, xdr: str) -> SurveyResponseBody:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.type,
+ self.topology_response_body_v0,
+ self.topology_response_body_v1,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
return (
self.type == other.type
- and self.topology_response_body == other.topology_response_body
+ and self.topology_response_body_v0 == other.topology_response_body_v0
+ and self.topology_response_body_v1 == other.topology_response_body_v1
)
def __str__(self):
out = []
out.append(f"type={self.type}")
out.append(
- f"topology_response_body={self.topology_response_body}"
- ) if self.topology_response_body is not None else None
+ f"topology_response_body_v0={self.topology_response_body_v0}"
+ ) if self.topology_response_body_v0 is not None else None
+ out.append(
+ f"topology_response_body_v1={self.topology_response_body_v1}"
+ ) if self.topology_response_body_v1 is not None else None
return f""
diff --git a/stellar_sdk/xdr/survey_response_message.py b/stellar_sdk/xdr/survey_response_message.py
index bcfbf87c0..b80b229ed 100644
--- a/stellar_sdk/xdr/survey_response_message.py
+++ b/stellar_sdk/xdr/survey_response_message.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .encrypted_body import EncryptedBody
@@ -47,7 +50,7 @@ def pack(self, packer: Packer) -> None:
self.encrypted_body.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "SurveyResponseMessage":
+ def unpack(cls, unpacker: Unpacker) -> SurveyResponseMessage:
surveyor_peer_id = NodeID.unpack(unpacker)
surveyed_peer_id = NodeID.unpack(unpacker)
ledger_num = Uint32.unpack(unpacker)
@@ -67,7 +70,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "SurveyResponseMessage":
+ def from_xdr_bytes(cls, xdr: bytes) -> SurveyResponseMessage:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -76,10 +79,21 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "SurveyResponseMessage":
+ def from_xdr(cls, xdr: str) -> SurveyResponseMessage:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.surveyor_peer_id,
+ self.surveyed_peer_id,
+ self.ledger_num,
+ self.command_type,
+ self.encrypted_body,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/threshold_indexes.py b/stellar_sdk/xdr/threshold_indexes.py
index 55ad2fc41..42858ac3d 100644
--- a/stellar_sdk/xdr/threshold_indexes.py
+++ b/stellar_sdk/xdr/threshold_indexes.py
@@ -1,7 +1,10 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
from enum import IntEnum
+
from xdrlib3 import Packer, Unpacker
__all__ = ["ThresholdIndexes"]
@@ -29,7 +32,7 @@ def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "ThresholdIndexes":
+ def unpack(cls, unpacker: Unpacker) -> ThresholdIndexes:
value = unpacker.unpack_int()
return cls(value)
@@ -39,7 +42,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "ThresholdIndexes":
+ def from_xdr_bytes(cls, xdr: bytes) -> ThresholdIndexes:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -48,6 +51,6 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "ThresholdIndexes":
+ def from_xdr(cls, xdr: str) -> ThresholdIndexes:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
diff --git a/stellar_sdk/xdr/thresholds.py b/stellar_sdk/xdr/thresholds.py
index 203c44f77..42860cf73 100644
--- a/stellar_sdk/xdr/thresholds.py
+++ b/stellar_sdk/xdr/thresholds.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .base import Opaque
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
Opaque(self.thresholds, 4, True).pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "Thresholds":
+ def unpack(cls, unpacker: Unpacker) -> Thresholds:
thresholds = Opaque.unpack(unpacker, 4, True)
return cls(thresholds)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "Thresholds":
+ def from_xdr_bytes(cls, xdr: bytes) -> Thresholds:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "Thresholds":
+ def from_xdr(cls, xdr: str) -> Thresholds:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.thresholds)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/time_bounds.py b/stellar_sdk/xdr/time_bounds.py
index 150f9a7b5..28238c599 100644
--- a/stellar_sdk/xdr/time_bounds.py
+++ b/stellar_sdk/xdr/time_bounds.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .time_point import TimePoint
@@ -32,7 +35,7 @@ def pack(self, packer: Packer) -> None:
self.max_time.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "TimeBounds":
+ def unpack(cls, unpacker: Unpacker) -> TimeBounds:
min_time = TimePoint.unpack(unpacker)
max_time = TimePoint.unpack(unpacker)
return cls(
@@ -46,7 +49,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "TimeBounds":
+ def from_xdr_bytes(cls, xdr: bytes) -> TimeBounds:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -55,10 +58,18 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "TimeBounds":
+ def from_xdr(cls, xdr: str) -> TimeBounds:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.min_time,
+ self.max_time,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/time_point.py b/stellar_sdk/xdr/time_point.py
index 6c6bce5ad..07c61291b 100644
--- a/stellar_sdk/xdr/time_point.py
+++ b/stellar_sdk/xdr/time_point.py
@@ -1,6 +1,9 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .uint64 import Uint64
@@ -22,7 +25,7 @@ def pack(self, packer: Packer) -> None:
self.time_point.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "TimePoint":
+ def unpack(cls, unpacker: Unpacker) -> TimePoint:
time_point = Uint64.unpack(unpacker)
return cls(time_point)
@@ -32,7 +35,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "TimePoint":
+ def from_xdr_bytes(cls, xdr: bytes) -> TimePoint:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -41,10 +44,13 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "TimePoint":
+ def from_xdr(cls, xdr: str) -> TimePoint:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(self.time_point)
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
diff --git a/stellar_sdk/xdr/topology_response_body.py b/stellar_sdk/xdr/topology_response_body_v0.py
similarity index 80%
rename from stellar_sdk/xdr/topology_response_body.py
rename to stellar_sdk/xdr/topology_response_body_v0.py
index 48338a2f3..bbdc38980 100644
--- a/stellar_sdk/xdr/topology_response_body.py
+++ b/stellar_sdk/xdr/topology_response_body_v0.py
@@ -1,19 +1,22 @@
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
import base64
+
from xdrlib3 import Packer, Unpacker
from .peer_stat_list import PeerStatList
from .uint32 import Uint32
-__all__ = ["TopologyResponseBody"]
+__all__ = ["TopologyResponseBodyV0"]
-class TopologyResponseBody:
+class TopologyResponseBodyV0:
"""
XDR Source Code::
- struct TopologyResponseBody
+ struct TopologyResponseBodyV0
{
PeerStatList inboundPeers;
PeerStatList outboundPeers;
@@ -42,7 +45,7 @@ def pack(self, packer: Packer) -> None:
self.total_outbound_peer_count.pack(packer)
@classmethod
- def unpack(cls, unpacker: Unpacker) -> "TopologyResponseBody":
+ def unpack(cls, unpacker: Unpacker) -> TopologyResponseBodyV0:
inbound_peers = PeerStatList.unpack(unpacker)
outbound_peers = PeerStatList.unpack(unpacker)
total_inbound_peer_count = Uint32.unpack(unpacker)
@@ -60,7 +63,7 @@ def to_xdr_bytes(self) -> bytes:
return packer.get_buffer()
@classmethod
- def from_xdr_bytes(cls, xdr: bytes) -> "TopologyResponseBody":
+ def from_xdr_bytes(cls, xdr: bytes) -> TopologyResponseBodyV0:
unpacker = Unpacker(xdr)
return cls.unpack(unpacker)
@@ -69,10 +72,20 @@ def to_xdr(self) -> str:
return base64.b64encode(xdr_bytes).decode()
@classmethod
- def from_xdr(cls, xdr: str) -> "TopologyResponseBody":
+ def from_xdr(cls, xdr: str) -> TopologyResponseBodyV0:
xdr_bytes = base64.b64decode(xdr.encode())
return cls.from_xdr_bytes(xdr_bytes)
+ def __hash__(self):
+ return hash(
+ (
+ self.inbound_peers,
+ self.outbound_peers,
+ self.total_inbound_peer_count,
+ self.total_outbound_peer_count,
+ )
+ )
+
def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -90,4 +103,4 @@ def __str__(self):
f"total_inbound_peer_count={self.total_inbound_peer_count}",
f"total_outbound_peer_count={self.total_outbound_peer_count}",
]
- return f""
+ return f""
diff --git a/stellar_sdk/xdr/topology_response_body_v1.py b/stellar_sdk/xdr/topology_response_body_v1.py
new file mode 100644
index 000000000..c9c72ffce
--- /dev/null
+++ b/stellar_sdk/xdr/topology_response_body_v1.py
@@ -0,0 +1,125 @@
+# This is an automatically generated file.
+# DO NOT EDIT or your changes may be overwritten
+from __future__ import annotations
+
+import base64
+
+from xdrlib3 import Packer, Unpacker
+
+from .peer_stat_list import PeerStatList
+from .uint32 import Uint32
+
+__all__ = ["TopologyResponseBodyV1"]
+
+
+class TopologyResponseBodyV1:
+ """
+ XDR Source Code::
+
+ struct TopologyResponseBodyV1
+ {
+ PeerStatList inboundPeers;
+ PeerStatList outboundPeers;
+
+ uint32 totalInboundPeerCount;
+ uint32 totalOutboundPeerCount;
+
+ uint32 maxInboundPeerCount;
+ uint32 maxOutboundPeerCount;
+ };
+ """
+
+ def __init__(
+ self,
+ inbound_peers: PeerStatList,
+ outbound_peers: PeerStatList,
+ total_inbound_peer_count: Uint32,
+ total_outbound_peer_count: Uint32,
+ max_inbound_peer_count: Uint32,
+ max_outbound_peer_count: Uint32,
+ ) -> None:
+ self.inbound_peers = inbound_peers
+ self.outbound_peers = outbound_peers
+ self.total_inbound_peer_count = total_inbound_peer_count
+ self.total_outbound_peer_count = total_outbound_peer_count
+ self.max_inbound_peer_count = max_inbound_peer_count
+ self.max_outbound_peer_count = max_outbound_peer_count
+
+ def pack(self, packer: Packer) -> None:
+ self.inbound_peers.pack(packer)
+ self.outbound_peers.pack(packer)
+ self.total_inbound_peer_count.pack(packer)
+ self.total_outbound_peer_count.pack(packer)
+ self.max_inbound_peer_count.pack(packer)
+ self.max_outbound_peer_count.pack(packer)
+
+ @classmethod
+ def unpack(cls, unpacker: Unpacker) -> TopologyResponseBodyV1:
+ inbound_peers = PeerStatList.unpack(unpacker)
+ outbound_peers = PeerStatList.unpack(unpacker)
+ total_inbound_peer_count = Uint32.unpack(unpacker)
+ total_outbound_peer_count = Uint32.unpack(unpacker)
+ max_inbound_peer_count = Uint32.unpack(unpacker)
+ max_outbound_peer_count = Uint32.unpack(unpacker)
+ return cls(
+ inbound_peers=inbound_peers,
+ outbound_peers=outbound_peers,
+ total_inbound_peer_count=total_inbound_peer_count,
+ total_outbound_peer_count=total_outbound_peer_count,
+ max_inbound_peer_count=max_inbound_peer_count,
+ max_outbound_peer_count=max_outbound_peer_count,
+ )
+
+ def to_xdr_bytes(self) -> bytes:
+ packer = Packer()
+ self.pack(packer)
+ return packer.get_buffer()
+
+ @classmethod
+ def from_xdr_bytes(cls, xdr: bytes) -> TopologyResponseBodyV1:
+ unpacker = Unpacker(xdr)
+ return cls.unpack(unpacker)
+
+ def to_xdr(self) -> str:
+ xdr_bytes = self.to_xdr_bytes()
+ return base64.b64encode(xdr_bytes).decode()
+
+ @classmethod
+ def from_xdr(cls, xdr: str) -> TopologyResponseBodyV1:
+ xdr_bytes = base64.b64decode(xdr.encode())
+ return cls.from_xdr_bytes(xdr_bytes)
+
+ def __hash__(self):
+ return hash(
+ (
+ self.inbound_peers,
+ self.outbound_peers,
+ self.total_inbound_peer_count,
+ self.total_outbound_peer_count,
+ self.max_inbound_peer_count,
+ self.max_outbound_peer_count,
+ )
+ )
+
+ def __eq__(self, other: object):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ self.inbound_peers == other.inbound_peers
+ and self.outbound_peers == other.outbound_peers
+ and self.total_inbound_peer_count == other.total_inbound_peer_count
+ and self.total_outbound_peer_count == other.total_outbound_peer_count
+ and self.max_inbound_peer_count == other.max_inbound_peer_count
+ and self.max_outbound_peer_count == other.max_outbound_peer_count
+ )
+
+ def __str__(self):
+ out = [
+ f"inbound_peers={self.inbound_peers}",
+ f"outbound_peers={self.outbound_peers}",
+ f"total_inbound_peer_count={self.total_inbound_peer_count}",
+ f"total_outbound_peer_count={self.total_outbound_peer_count}",
+ f"max_inbound_peer_count={self.max_inbound_peer_count}",
+ f"max_outbound_peer_count={self.max_outbound_peer_count}",
+ ]
+ return f"