The Python Digital World SDK library provides APIs to build transactions and connect to the Gateway and DWSA-RPC server.
Project description
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
pip install --upgrade digital-world-sdk
If you need asynchronous support, install the required dependencies:
pip install --upgrade digital-world-sdk[aiohttp]
If you need Shamir backup support:
pip install --upgrade digital-world-sdk[shamir]
We follow Semantic Versioning 2.0.0, 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.
# 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file digital_world_sdk-15.0.0.tar.gz.
File metadata
- Download URL: digital_world_sdk-15.0.0.tar.gz
- Upload date:
- Size: 893.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.34.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5060206f7d53de68dc02264403a10c6493f24ac050ba8b199112ff1f9a6304d1
|
|
| MD5 |
49ba1bad22cfa71c8e93bd03e2828a17
|
|
| BLAKE2b-256 |
905cb7a97c044c37a55a00031824e9119c936b7be5526bc0801fe734894c1103
|
File details
Details for the file digital_world_sdk-15.0.0-py3-none-any.whl.
File metadata
- Download URL: digital_world_sdk-15.0.0-py3-none-any.whl
- Upload date:
- Size: 986.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.34.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1944451f0f0510e2212f26a8732437dd04a6fee221ef562bf29dfb9b4d88e187
|
|
| MD5 |
2aecc28442ab619a46e4cf0dbf8253c4
|
|
| BLAKE2b-256 |
22afec5ba320413a2a13a6eec2ee9058c3bfe7fd4b38a18376f29ef80ab39aa3
|