Skip to main content

Python SDK for SUI

This SDK is in alpha version, so there are possible errors. All functions can be viewed here: https://docs.sui.io/sui-jsonrpc

Author's additions:

  • Function to get the balance
  • Function for mint a NFT (example/wizard)
  • Function to generate a random wallet
  • Function to request test tokens from a faucet
  • Function to get public key as b64 string
  • Function to get transaction ID

Installation

Requires Python 3.10-3.11

pip install pysdk-sui

Example usage

from pysdk_sui import Client, Wallet, RpcDetails, WalletInfoParams, MoveCallParams, TransferObjectParams, GetTransactionsIDParams, MoveFunctionArgTypesParams

faucet_url_ = 'https://faucet.testnet.sui.io/gas'
rpc_url_ = 'https://fullnode.testnet.sui.io/'
test_mnemonic = 'trip offer end cloth patrol core pioneer debate cigar swarm patch tattoo'


client = Client(rpc_url=rpc_url_, faucet_url=faucet_url_, mnemonic=test_mnemonic)
wallet = Wallet(rpc_url=rpc_url_, faucet_url=faucet_url_, mnemonic=test_mnemonic)
rpc = RpcDetails(rpc_url=rpc_url_, faucet_url=faucet_url_, mnemonic=test_mnemonic)


def example_wallet():
    # get balance
    balance = wallet.get_balance()

    # generate wallet (return NamedTuple with mnemonic, private key, public key and address)
    wallet_data = wallet.generate_wallet()

    # get my wallet info (return NamedTuple with mnemonic, private key, public key and address)
    my_wallet_info = wallet.get_wallet_info()

    # get another wallet info (return NamedTuple with mnemonic, private key, public key and address)
    another_wallet_info = wallet.get_another_wallet_info(
        WalletInfoParams(
            'params'
        ))

    # request test tokens from faucet
    response_data = wallet.request_tokens_from_faucet()

    # get public key as b64 string
    public_b64_key = wallet.get_public_key_as_b64_string()

    '''ANOTHER FUNCTION USING SAME'''


def example_client(self):
    # get example NFT
    response_data = client.mint_example_nft()

    # move call
    response_data = client.move_call(
        MoveCallParams(
            'params'
    ))

    # transfer object
    response_data = client.transfer_object(
        TransferObjectParams(
            'params'
        ))

    '''ANOTHER FUNCTION USING SAME'''


def example_rpc(self):
    # get transaction ID (digest)
    transaction_id = rpc.get_transaction_id(
        GetTransactionsIDParams(
            params
        ))

    # get move function arg types
    data = rpc.get_move_function_arg_types(
        MoveFunctionArgTypesParams(
            params
        ))

    '''ANOTHER FUNCTION USING SAME'''


GOOD LUCK :D

Metadata

Release files for pysdk-sui 5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysdk-sui 5.1
File Size Uploaded Provenance Actions
pysdk_sui-5.1.tar.gz 8.7 kB Without provenance Details for pysdk_sui-5.1.tar.gz

Release files / pysdk_sui-5.1.tar.gz

Download URL pysdk_sui-5.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0a98a07916a7bc00a5b39690faedd29ebf386b480c863c9e5e4e46e4d9f90eb4
BLAKE2b-256 checksum
How to use checksums
a6f8dfe9dff19625ffe8dff36ef83ebf1405ddff97fbf6025334283861f4bc04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.0

Security for pysdk-sui 5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page