Skip to main content

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

digital_world_sdk-15.0.0.tar.gz (893.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

digital_world_sdk-15.0.0-py3-none-any.whl (986.4 kB view details)

Uploaded Python 3

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

Hashes for digital_world_sdk-15.0.0.tar.gz
Algorithm Hash digest
SHA256 5060206f7d53de68dc02264403a10c6493f24ac050ba8b199112ff1f9a6304d1
MD5 49ba1bad22cfa71c8e93bd03e2828a17
BLAKE2b-256 905cb7a97c044c37a55a00031824e9119c936b7be5526bc0801fe734894c1103

See more details on using hashes here.

File details

Details for the file digital_world_sdk-15.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for digital_world_sdk-15.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1944451f0f0510e2212f26a8732437dd04a6fee221ef562bf29dfb9b4d88e187
MD5 2aecc28442ab619a46e4cf0dbf8253c4
BLAKE2b-256 22afec5ba320413a2a13a6eec2ee9058c3bfe7fd4b38a18376f29ef80ab39aa3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page