Sui

class Sui(config: SuiConfig = SuiConfig(), makeDefault: Boolean = true) : Coin, Events, Governance, General, Transaction, Object, Sns, Move, Faucet

The primary entry point for interacting with the Sui network.

This class provides a unified API surface by delegating to various specialized API clients (e.g., Coin, Events, Transaction). This composition pattern allows for clean separation of concerns while offering a simple, cohesive interface.

Upon instantiation, this class can automatically configure a default, globally-accessible client instance via the SuiKit object. This enables the use of convenient top-level functions like ptb { ... } without needing to pass the client instance explicitly.

Parameters

config

The SuiConfig used to configure the connection and behavior of all underlying API clients.

makeDefault

If true, this instance will be set as the default client in SuiKit, making it available for global functions. This is useful for setting up a primary client at application startup. Set to false to create a temporary or secondary client without overwriting the default.

Constructors

Link copied to clipboard
constructor(config: SuiConfig = SuiConfig(), makeDefault: Boolean = true)

Properties

Link copied to clipboard
open override val config: SuiConfig

The SuiConfig object specifying the RPC endpoint and connection settings.

Functions

Link copied to clipboard
open suspend override fun devInspectTransactionBlock(txBytes: String, txMetaData: TransactionMetaData, options: ExecuteTransactionBlockResponseOptions): Result<DevInspectTransactionBlockQuery.Data?, SuiError>

Runs a special developer-focused inspection of a transaction block.

Link copied to clipboard
open suspend override fun dryRunTransactionBlock(txBytes: String, option: ExecuteTransactionBlockResponseOptions): Result<DryRunTransactionBlockQuery.Data?, SuiError>

Simulates the execution of a transaction block without committing it to the network.

Link copied to clipboard
open suspend override fun executeTransactionBlock(txBytes: String, signatures: List<String>, option: ExecuteTransactionBlockResponseOptions): Result<ExecuteTransactionBlockMutation.Data?, SuiError>

Submits a pre-signed transaction block to the Sui network for execution.

Link copied to clipboard
open suspend override fun getAllBalances(address: AccountAddress, limit: Int?, cursor: String?): Result<GetAllBalancesQuery.Data?, SuiError>

Fetches all coin balances for a given Sui address.

Link copied to clipboard
open suspend override fun getBalance(address: AccountAddress, coinType: String?): Result<GetBalanceQuery.Data?, SuiError>

Fetches the balance of a specific coin type for a given address.

Link copied to clipboard
open suspend override fun getChainIdentifier(): Result<GetChainIdentifierQuery.Data?, SuiError>

Fetches the first 4 bytes of the chain's genesis checkpoint digest.

Link copied to clipboard
open suspend override fun getCheckpoint(checkpointId: CheckpointId?): Result<GetCheckpointQuery.Data?, SuiError>

Fetches the details of a specific checkpoint.

Link copied to clipboard
open suspend override fun getCheckpoints(first: Int?, before: String?, last: Int?, after: String?): Result<GetCheckpointsQuery.Data?, SuiError>

Fetches a paginated list of checkpoints.

Link copied to clipboard
open suspend override fun getCoinMetadata(type: String): Result<GetCoinMetadataQuery.Data?, SuiError>

Fetches the metadata for a specific coin type.

Link copied to clipboard
open suspend override fun getCoins(address: AccountAddress, first: Int?, cursor: String?, type: String?): Result<GetCoinsQuery.Data?, SuiError>

Fetches coin objects owned by a given address.

Link copied to clipboard
open suspend override fun getCommitteeInfo(epochId: Long?, after: String?): Result<GetCommitteeInfoQuery.Data?, SuiError>

Fetches the committee of validators for a specific epoch.

Link copied to clipboard
open suspend override fun getCurrentEpoch(): Result<GetCurrentEpochQuery.Data?, SuiError>

Fetches details about the current epoch.

Link copied to clipboard
open suspend override fun getDynamicFieldObject(parentId: String, name: DynamicFieldName): Result<GetDynamicFieldObjectQuery.Data?, SuiError>

Fetches an object that is stored as a dynamic field on a parent object.

Link copied to clipboard
open suspend override fun getDynamicFields(parentId: String, limit: Int?, cursor: String?): Result<GetDynamicFieldsQuery.Data?, SuiError>

Fetches a paginated list of all dynamic fields owned by a parent object.

Link copied to clipboard
open suspend override fun getLatestCheckpointSequenceNumber(): Result<GetLatestCheckpointSequenceNumberQuery.Data?, SuiError>

Fetches the sequence number of the most recently processed checkpoint.

Link copied to clipboard
open suspend override fun getLatestSuiSystemState(): Result<GetLatestSuiSystemStateQuery.Data?, SuiError>

Fetches the most recent SuiSystemState object.

Link copied to clipboard
open suspend override fun getMoveFunctionArgTypes(id: String): Result<GetMoveFunctionArgTypesQuery.Data?, SuiError>

Fetches the argument types for a specific Move function.

Link copied to clipboard
open suspend override fun getNormalizedMoveFunction(id: String): Result<GetNormalizedMoveFunctionQuery.Data?, SuiError>

Fetches the normalized (desugared and with types expanded) representation of a Move function.

Link copied to clipboard
open suspend override fun getNormalizedMoveModule(packageId: String, module: String): Result<GetNormalizedMoveModuleQuery.Data?, SuiError>

Fetches the normalized representation of a specific module within a package.

Link copied to clipboard
open suspend override fun getNormalizedMoveModulesByPackage(packageId: String, cursor: String?): Result<GetNormalizedMoveModulesByPackageQuery.Data?, SuiError>

Fetches a paginated list of all normalized modules within a given package.

Link copied to clipboard
open suspend override fun getNormalizedMoveStruct(id: String): Result<GetNormalizedMoveStructQuery.Data?, SuiError>

Fetches the normalized representation of a Move struct.

Link copied to clipboard
open suspend override fun getObject(id: String, options: ObjectDataOptions): Result<GetObjectQuery.Data?, SuiError>

Fetches the details of a specific object by its ID.

Link copied to clipboard
open suspend override fun getOwnedObjects(owner: AccountAddress, limit: Int?, cursor: String?, options: ObjectDataOptions): Result<GetOwnedObjectsQuery.Data?, SuiError>

Fetches a paginated list of objects owned by a specific address.

Link copied to clipboard
open suspend override fun getProtocolConfig(protocolVersion: Int?): Result<GetProtocolConfigQuery.Data?, SuiError>

Fetches the protocol configuration for a specific version.

Link copied to clipboard
open suspend override fun getReferenceGasPrice(): Result<GetReferenceGasPriceQuery.Data?, SuiError>

Fetches the current reference gas price for the network.

Link copied to clipboard
open suspend override fun getStakes(owner: AccountAddress, limit: Int?, cursor: String?): Result<GetStakesQuery.Data?, SuiError>

Fetches all StakedSui objects owned by a specific address.

Link copied to clipboard
open suspend override fun getStakesByIds(ids: List<String>, limit: Int?, cursor: String?): Result<GetStakesByIdsQuery.Data?, SuiError>

Fetches a list of StakedSui objects by their unique IDs.

Link copied to clipboard
open suspend override fun getTotalSupply(type: String): Result<GetTotalSupplyQuery.Data?, SuiError>

Fetches the total supply for a given coin type.

Link copied to clipboard
open suspend override fun getTotalTransactionBlocks(): Result<GetTotalTransactionBlocksQuery.Data?, SuiError>

Fetches the total number of transaction blocks processed by the network.

Link copied to clipboard
open suspend override fun getTransactionBlock(digest: String, options: TransactionBlockResponseOptions): Result<GetTransactionBlockQuery.Data?, SuiError>

Fetches the details of a specific transaction block by its digest.

Link copied to clipboard
open suspend override fun getTypeLayout(type: String): Result<GetTypeLayoutQuery.Data?, SuiError>

Resolves the on-chain memory layout for a specified Move type.

Link copied to clipboard
open suspend override fun getValidatorApy(): Result<GetValidatorsApyQuery.Data?, SuiError>

Fetches the Annual Percentage Yield (APY) for all active validators.

Link copied to clipboard
open suspend override fun multiGetObjects(ids: List<String>, limit: Int?, cursor: String?, options: ObjectDataOptions): Result<MultiGetObjectsQuery.Data?, SuiError>

Fetches the details of multiple objects in a single batch request.

Link copied to clipboard
open suspend override fun paginateCheckpointTransactionBlocks(id: CheckpointId?, after: String?): Result<PaginateCheckpointTransactionBlocksQuery.Data?, SuiError>

Fetches a paginated list of transaction blocks for a given checkpoint.

Link copied to clipboard
open suspend override fun paginateEpochValidators(id: Long, after: String?): Result<PaginateEpochValidatorsQuery.Data?, SuiError>

Fetches a paginated list of validators for a specific epoch.

Link copied to clipboard
open suspend override fun paginateMoveModuleLists(packageId: String, module: String, hasMoreFriends: Boolean, hasMoreStructs: Boolean, hasMoreFunctions: Boolean, hasMoreEnums: Boolean, afterFriends: String?, afterStructs: String?, afterFunctions: String?, afterEnums: String?): Result<PaginateMoveModuleListsQuery.Data?, SuiError>

Fetches paginated lists of components within a Move module.

Link copied to clipboard
open suspend override fun paginateTransactionBlockLists(digest: String, hasMoreEvents: Boolean, hasMoreBalanceChanges: Boolean, hasMoreObjectChanges: Boolean, afterEvents: String?, afterBalanceChanges: String?, afterObjectChanges: String?): Result<PaginateTransactionBlockListsQuery.Data?, SuiError>

Fetches paginated lists of components within a specific transaction block.

Link copied to clipboard
inline suspend fun <T> General.query(query: GraphqlQuery): Nothing
Link copied to clipboard
open suspend override fun queryEvents(filter: EventFilter, before: String?, after: String?, first: Int?, last: Int?): Result<QueryEventsQuery.Data?, SuiError>

Queries for events on the Sui network based on a specified filter.

Link copied to clipboard
open suspend override fun queryTransactionBlocks(filter: TransactionBlockFilter, options: TransactionBlockResponseOptions): Result<QueryTransactionBlocksQuery.Data?, SuiError>

Fetches a paginated list of transaction blocks matching a specified filter.

Link copied to clipboard
open suspend override fun requestTestTokens(accountAddress: AccountAddress): Option<List<TransferredGasObject>>
Link copied to clipboard
open suspend override fun resolveNameServiceAddress(domain: String): Result<ResolveNameServiceAddressQuery.Data?, SuiError>

Resolves a .sui domain name to its corresponding Sui address.

Link copied to clipboard
open suspend override fun resolveNameServiceNames(address: AccountAddress, limit: Int?, cursor: String?): Result<ResolveNameServiceNamesQuery.Data?, SuiError>

Performs a reverse lookup to find all .sui domain names associated with a given address.

Link copied to clipboard
open suspend override fun signAndExecuteTransactionBlock(signer: Account, ptb: ProgrammableTransaction, gasBudget: ULong, options: ExecuteTransactionBlockResponseOptions): Result<ExecuteTransactionBlockMutation.Data?, SuiError>

A convenience method that signs and executes a transaction block in a single step.

Link copied to clipboard
open override fun signTransaction(message: ByteArray, signer: Account): ByteArray

Creates a cryptographic signature for a given message using a signer's private key.

Link copied to clipboard
open suspend override fun tryGetPastObject(id: String, version: Int?, options: ObjectDataOptions): Result<TryGetPastObjectQuery.Data?, SuiError>

Fetches a historical version of a specific object.

Link copied to clipboard
open suspend override fun waitForTransaction(digest: String, options: TransactionBlockResponseOptions, timeout: Long, pollInterval: Long): Result<GetTransactionBlockQuery.Data?, SuiError>