pysui.abstracts package
Submodules
pysui.abstracts.client_config module
Client Configuration Abstraction.
- class pysui.abstracts.client_config.CrefType(value)
Bases:
IntEnum
.
- ALIAS = 0
- KPAIR = 1
- PKEY = 2
- ADDY = 3
- INDEX = 4
- class pysui.abstracts.client_config.ClientConfiguration(config_path: str, keystore_file: str, alias_file: str | None = None)
Bases:
ABC
Base abstraction for managing a clients configuration.
Changed in version 0.41.0: Sui aliases configuration feature added
- __init__(config_path: str, keystore_file: str, alias_file: str | None = None)
__init__ ClientConfiguration initializer.
- Parameters:
config_path (str) – Fully qualified path to SUI client.yaml
keystore_file (str) – Fully qualified path to sui.keystore
alias_file (Optional[str], optional) – Fully qualified path to sui.aliases,default = None
- abstract property rpc_url: str
Return the URL the client configuration has.
- abstract property active_address: AbstractType
Return the active address from the client configuration.
- property keystore_file: str
Get the keystore filename.
- property alias_file: str
Get the alias filename.
Added in version 0.41.0: Supporting aliases
- property aliases: list[str]
Get aliases managed by wallet.
Added in version 0.41.0: Supporting aliases
- aliases_encode() list[dict]
Encodes aliases.
Added in version 0.41.0: Supporting aliases
- property keystrings: list[str]
Get keypair strings managed by wallet.
- property addresses_and_keys: dict
Get a copy of dictionary of address/keypair.
- property addresses: list[str]
Get all the addresses.
- keypair_for_address(addy: AbstractType) KeyPair
Get the keypair for a given address.
- keypair_for_publickey(pub_key: PublicKey) KeyPair | None
Return the keypair for the public key or None if no match.
- kp4add(addy: str) KeyPair
Get the keypair for a given address.
Added in version 0.54.0: Supporting aliases
- addr4al(alias: str) AbstractType
addr4al Returns an address for an alias
- Parameters:
alias (str) – alias name
- Returns:
The SuiAddress for alias
- Return type:
Added in version 0.41.0: Supporting aliases
- kp4al(alias: str) KeyPair | None
kp4al Returns the keypair associated with alias
- Parameters:
alias (str) – alias name
- Returns:
The KeyPair associated to alias
- Return type:
Union[KeyPair, None]
Added in version 0.41.0: Supporting aliases
- pk4al(alias: str) PublicKey | None
pk4al Returns the PublicKey associated with alias
- Parameters:
alias (str) – alias name
- Returns:
The PublicKey associated to alias
- Return type:
Union[PublicKey, None]
Added in version 0.41.0: Supporting aliases
- al4addr(addr: str | AbstractType) str
al4addr Returns an alias for an address
- Parameters:
addr – Address str or Address type
- Returns:
The alias name associated to address
- Return type:
str
Added in version 0.41.0: Supporting aliases
pysui.abstracts.client_keypair module
KeyPair abstraction.
- class pysui.abstracts.client_keypair.SignatureScheme(value)
Bases:
IntEnum
Key encoding scheme variations.
- ED25519 = 0
- SECP256K1 = 1
- SECP256R1 = 2
- MULTISIG = 3
- BLS12381 = 4
- ZKLOGINAUTHENTICATOR = 5
- as_str() str
Get scheme as string.
- property sig_scheme: str
As signature scheme string.
- class pysui.abstracts.client_keypair.Key(scheme: SignatureScheme, key_bytes: bytes)
Bases:
ABC
Base key abstract class.
- __init__(scheme: SignatureScheme, key_bytes: bytes) None
Init with byte array.
- property scheme: SignatureScheme
Get the keys scheme.
- property key_bytes: bytes
Get the keys bytes.
- to_b64() str
Convert key bytes to base64.
- class pysui.abstracts.client_keypair.PublicKey(scheme: SignatureScheme, key_bytes: bytes)
Bases:
Key
PublicKey construct.
- scheme_and_key() bytes
scheme_and_key returns bytes of key scheme + pubkey bytes.
- Returns:
pubkey bytes with scheme value prefix
- Return type:
bytes
- class pysui.abstracts.client_keypair.PrivateKey(scheme: SignatureScheme, key_bytes: bytes)
Bases:
Key
PrivateKey construct.
- abstract sign_secure(tx_data: str) list
Sign data securely, returning signature.
- class pysui.abstracts.client_keypair.KeyPair
Bases:
ABC
KeyPair construct.
- abstract property scheme: SignatureScheme
Get the keys scheme.
- abstract property private_key: PrivateKey | None
Get the keypair public key.
- abstract new_sign_secure(tx_data: str) AbstractType | str
Sign transactions securley.
- abstract sign_message(message: str) str
Sign arbitrary message, returning it’s base64 raw signature.
- abstract verify_signature(message: str, signature: str) bool
Verify message with signature, returning true/false.
- abstract to_bytes() bytes
Convert keypair to encoded bytes.
- abstract serialize() str
Serialize to platform keystring for persist.
- to_b64() str
Convert full key bytes (priv and pub) to base64.
pysui.abstracts.client_rpc module
RPC Client Abstractions.
- class pysui.abstracts.client_rpc.Builder
Bases:
ABC
Builder for RPC Calls.
- __init__()
Initialize abstract Builder.
- property data_dict: dict
data_dict Returns a copy of the _data portion of RPC call.
- Returns:
The class default _data specification
- Return type:
dict
- property header: dict
header Returns a copy of the _header portion of RPC call.
- Returns:
The class default _header specification
- Return type:
dict
- abstract property txn_required: bool
txn_required Abstraction method to return flag indicating if Builder is a complex transaction.
This is used by the RPC execute evaluation.
- Returns:
True if result Tx bytes of immediate call of method are auto submitted with sui_executeTransaction
- Return type:
bool
- abstract property method: str
method Abstract method to return the method name (e.g. sui_getObject).
- Returns:
The SUI RPC API method name.
- Return type:
str
- class pysui.abstracts.client_rpc.RpcResult
Bases:
ABC
Rpc Result for call returns.
- __init__() None
Initialize Result.
- abstract is_ok() bool
Return success indicator.
- abstract is_err() bool
Return failure indicator.
- abstract property result_data: Any
Get result data.
- abstract property result_string: str
Get result data.
- class pysui.abstracts.client_rpc.Provider(config: ClientConfiguration)
Bases:
ABC
Generic provider state.
- __init__(config: ClientConfiguration) None
__init__ Initialize provider with a configuration object.
- Parameters:
config (ClientConfiguration) – The configuration instance used for Provider implemenetation
- property config: ClientConfiguration
config Get the client configuration.
- Returns:
The configuration object that was provided in Provider initialization
- Return type:
pysui.abstracts.client_types module
Type Client Abstractions.
- class pysui.abstracts.client_types.AbstractType(identifier: AbstractType)
Bases:
ABC
Base most abstraction.
- __init__(identifier: AbstractType) None
Initialize type.
- property identifier: Any
Return underlying value.
- class pysui.abstracts.client_types.SuiBaseType(identifier: Any)
Bases:
AbstractType
Base most SUI object type.
- __init__(identifier: Any) None
__init__ Initialize type with identifier.
- Parameters:
identifier (Any) – A native python type
- class pysui.abstracts.client_types.SuiScalarType(identifier: Any)
Bases:
SuiBaseType
Base most SUI scalar type.
Module contents
Abstraction package.