Metadata-Version: 2.4
Name: digital-world-sdk
Version: 15.0.0
Summary: The Python Digital World SDK library provides APIs to build transactions and connect to the Gateway and DWSA-RPC server.
Keywords: digital-world-sdk,digital-world,digitalworld.global,native,blockchain,distributed exchange,cryptocurrency,dex,gateway,dwsa,sdex,trading,dwsa-rpc
Author-email: Digital World Foundation <dev@digitalworld.global>
Maintainer-email: Digital World Foundation <dev@digitalworld.global>
Requires-Python: >=3.10,<4.0
Description-Content-Type: text/markdown
License-Expression: Apache-2.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
License-File: LICENSE
Requires-Dist: mnemonic>=0.20
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pynacl>=1.4.0
Requires-Dist: requests>=2.0.0
Requires-Dist: requests-sse>=0.3
Requires-Dist: toml>=0.10.2; python_version < '3.11'
Requires-Dist: typing-extensions>=4.0.0
Requires-Dist: xdrlib3>=0.1.1
Requires-Dist: aiohttp>=3.9.1 ; extra == "aiohttp"
Requires-Dist: aiohttp-sse-client>=0.2.1 ; extra == "aiohttp"
Requires-Dist: shamir-mnemonic>=0.3.0 ; extra == "shamir"
Project-URL: Documentation, https://docs.digitalworld.global/sdk/python
Project-URL: Homepage, https://gitlab.com/digitalworld/digital-world-py-sdk
Project-URL: Issues, https://gitlab.com/digitalworld/digital-world-py-sdk/-/issues
Project-URL: Repository, https://gitlab.com/digitalworld/digital-world-py-sdk
Provides-Extra: aiohttp
Provides-Extra: shamir

# Digital World Python SDK

The Python Digital World SDK library provides APIs to build transactions and connect to the Gateway and DWSA-RPC server on the Digital World Network.

It provides:

- a networking layer API for Gateway endpoints.
- a networking layer API for DWSA-RPC server methods.
- facilities for building and signing transactions, for communicating with a Digital World Gateway and DWSA-RPC instance, and for submitting transactions or querying network history.

Supports **Python 3.10+** as well as PyPy 3.11.

## Documentation

Documentation can be found at https://docs.digitalworld.global/sdk/python

## Installing

```text
pip install --upgrade digital-world-sdk
```

If you need asynchronous support, install the required dependencies:

```text
pip install --upgrade digital-world-sdk[aiohttp]
```

If you need [Shamir backup](https://trezor.io/learn/advanced/standards-proposals/what-is-shamir-backup) support:

```text
pip install --upgrade digital-world-sdk[shamir]
```

We follow [Semantic Versioning 2.0.0](https://semver.org/), and strongly recommend specifying the major version number in your dependency file to avoid breaking changes.

## A Simple Example

You can find more examples [here](./examples).

```python
# Alice pays 10.25 NATIVE to Bob
from digital_world_sdk import Asset, GatewayServer, Keypair, TransactionBuilder, Network

alice_keypair = Keypair.from_secret("SBFZCHU5645DOKRWYBXVOXY2ELGJKFRX6VGGPRYUWHQ7PMXXJNDZFMKD")
bob_address = "GA7YNBW5CBTJZ3ZZOWX3ZNBKD6OE7A7IHUQVWMY62W2ZBG2SGZVOOPVH"

server = GatewayServer("https://dex-testnet.digitalworld.global")
alice_account = 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, Digital World!")
    .append_payment_op(bob_address, Asset.native(), "10.25")
    .set_timeout(30)
    .build()
)
transaction.sign(alice_keypair)
response = server.submit_transaction(transaction)
print(response)
```

## Links

- Documentation: https://docs.digitalworld.global/sdk/python
- Repository: https://gitlab.com/digitalworld/digital-world-py-sdk
- Examples: https://gitlab.com/digitalworld/digital-world-py-sdk/-/tree/main/examples
- Issue tracker: https://gitlab.com/digitalworld/digital-world-py-sdk/-/issues
- License: [Apache License 2.0](./LICENSE)

