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/'


class Example(Client):
    def __init__(self, faucet_url: str, rpc_url: str, mnemonic: str = True):  # mnemonic can be False
        super().__init__(faucet_url, rpc_url, mnemonic)
        self.wallet = Wallet(faucet_url, rpc_url, mnemonic)
        self.rpc = RpcDetails(faucet_url, rpc_url, mnemonic)

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

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

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

        # get another wallet info (return NamedTuple with mnemonic, private key, public key and address)
        another_wallet_info = self.wallet.get_another_wallet_info(self, WalletInfoParams(params))
        
        # request test tokens from faucet
        response_data = self.wallet.request_tokens_from_faucet()
        
        # get public key as b64 string
        public_b64_key = self.wallet.get_public_key_as_b64_string()
        
        
    def example_client(self):
        # get example NFT
        response_data = self.mint_example_nft()
        
        # move call
        response_data = self.move_call(self, MoveCallParams(params))
        
        # transfer object
        response_data = self.transfer_object(self, TransferObjectParams(params))
        
        '''ANOTHER FUNCTION USING SAME'''
        
    
    def example_rpc(self):
        # get transaction ID (digest)
        transaction_id = self.rpc.get_transaction_id(self, GetTransactionsIDParams(params))
        
        # get move function arg types
        data = self.rpc.get_move_function_arg_types(self, MoveFunctionArgTypesParams(params))

        '''ANOTHER FUNCTION USING SAME'''

GOOD LUCK :D

Metadata

Release files for pysdk-sui 5

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
File Size Uploaded
pysdk_sui-5.tar.gz 8.6 kB Details

Release files / pysdk_sui-5.tar.gz

Download URL pysdk_sui-5.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7e64ff62406bc3f2380e1f4246ddecc7648faa3431e2735c094f9c5431b4b125
BLAKE2b-256 checksum
How to use checksums
33bc7d8048f7d88f2cf4bf53512c0ae64583b52c5b85800be6a288cfb728bf42
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

5.1

1 release file

This release

5 This release

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