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
pysdk_sui-5.1.tar.gz 8.7 kB Details

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

Release history Release notifications | RSS feed

This release

5.1 This release

1 release file

5

1 release file

4

1 release file

3

1 release file

2

1 release file

0.2

1 release file

0.1

1 release file

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