SuiHttpClient

class SuiHttpClient(val configContainer: ConfigContainer) : SuiClient

A Kotlin wrapper around the Sui JSON-RPC API for interacting with a Sui full node.

Constructors

Link copied to clipboard
constructor(configContainer: ConfigContainer)

Properties

Link copied to clipboard
open override val configContainer: ConfigContainer

Functions

Link copied to clipboard
suspend fun discover(): Discovery

Suspended function that retrieves the Discovery data from the JSON-RPC API service using the rpc.discover method. This method provides documentation describing the available JSON-RPC APIs.

Link copied to clipboard

Return transaction execution effects including the gas cost summary, while the effects are not committed to the chain.

Link copied to clipboard

Execute the transaction and wait for results if desired.

Link copied to clipboard
suspend fun getAllBalances(owner: SuiAddress): List<Balance>

Return the total coin balance for all coin type, owned by the address owner.

Link copied to clipboard
suspend fun getAllCoins(owner: SuiAddress, cursor: String? = null, limit: Long): CoinPage

Return all Coin objects owned by an address.

Link copied to clipboard
suspend fun getBalance(owner: SuiAddress, coinType: String = "0x2::sui::SUI"): Balance

Return the total coin balance for one coin type, owned by the address owner.

Link copied to clipboard
suspend fun getChainIdentifier(): String

Suspended function that retrieves the chain's identifier.

Link copied to clipboard
suspend fun getCheckpoint(checkpointId: CheckpointId): Checkpoint

Return a checkpoint

Link copied to clipboard
suspend fun getCheckpoints(cursor: Int? = null, limit: Long? = null, descendingOrder: Boolean = false): CheckpointPage

Fetches paginated list of checkpoints.

Link copied to clipboard
suspend fun getCoinMetadata(coinType: String): SuiCoinMetadata

Return metadata(e.g., symbol, decimals) for a coin

Link copied to clipboard
suspend fun getCoins(owner: SuiAddress, coinType: String? = null, cursor: Int? = null, limit: Int): CoinPage

Retrieves information about coins held by a given SUI address, with optional filtering by coin type and paging parameters.

Link copied to clipboard
suspend fun getCommitteeInfo(epoch: Long? = null): CommitteeInfo.SuiCommittee

Suspended function to retrieve information about the committee information for the asked epoch.

Link copied to clipboard
suspend fun <T> getCustom(function: String, vararg params: Any?): T

Suspended generic function that calls a custom JSON-RPC API method with the given name and parameters.

Link copied to clipboard
suspend fun getDynamicFieldObject(parentObjectId: ObjectId, name: DynamicFieldName): ObjectResponse

Retrieves the dynamic field object information for a specified object.

Link copied to clipboard
suspend fun getEvents(digest: TransactionDigest): List<Event>

Retrieves a list of events associated with a given transaction digest.

Link copied to clipboard

Return the sequence number of the latest checkpoint that has been executed

Link copied to clipboard

Return the latest SUI system state object on-chain.

Link copied to clipboard

Retrieves the loaded child objects for a given transaction digest.

Link copied to clipboard
suspend fun getMoveFunctionArgTypes(pakage: String, module: String, function: String): List<MoveFunctionArgType>

Retrieves the argument types for a Move function from the blockchain.

Link copied to clipboard

Retrieves the object data for a list of objects.

Link copied to clipboard

Retrieves multiple transaction blocks corresponding to the given digests and with the specified options.

Link copied to clipboard
suspend fun getNormalizedMoveFunction(pakage: String, module: String, function: String): MoveNormalizedFunction

Retrieves a normalized representation of a Move function from the blockchain.

Link copied to clipboard

Retrieves a normalized representation of a Move module from the blockchain.

Link copied to clipboard

Retrieves structured representations of all modules in the given package.

Link copied to clipboard

Asynchronously retrieves an object with the given objectId using the SUI API, with the specified options.

Link copied to clipboard
suspend fun getOwnedObjects(address: SuiAddress, query: ObjectResponseQuery, cursor: String? = null, limit: Int): ObjectsPage

Retrieves the owned objects based on the provided address, query, cursor, and limit.

Link copied to clipboard

Return the reference gas price for the network.

Link copied to clipboard
suspend fun getStakes(owner: SuiAddress): List<DelegatedStake>

Retrieves the list of delegated stakes for a specified owner.

Link copied to clipboard
suspend fun getStakesByIds(stakedSuiIds: List<ObjectId>): List<DelegatedStake>

Retrieves one or more DelegatedStake.

Link copied to clipboard
suspend fun getTotalSupply(coinType: String): Supply

Retrieves the total supply for a specified cryptocurrency.

Link copied to clipboard

Return the total number of transactions known to the server.

Link copied to clipboard

Retrieves the transaction block corresponding to the given digest and with the specified options.

Link copied to clipboard

Suspended function that retrieves the APYs (Annual Percentage Yields) for validators.

Link copied to clipboard
suspend fun isSuiAvailable(): Boolean

Pings Sui using the configured endpoint URL and HTTP client.

Link copied to clipboard
suspend fun mergeCoins(signer: SuiAddress, primaryCoin: ObjectId, coinToMerge: ObjectId, gas: ObjectId? = null, gasBudget: Long): TransactionBlockBytes

Create an unsigned transaction to merge multiple coins into one coin.

Link copied to clipboard
suspend fun moveCall(signer: SuiAddress, packageObjectId: ObjectId, module: String, function: String, typeArguments: List<TypeTag>, arguments: List<Any>, gas: ObjectId? = null, gasBudget: Long, executionMode: TransactionBlockBuilderMode? = null): TransactionBlockBytes

Create an unsigned transaction to execute a Move call on the network, by calling the specified function in the module of a given package.

Link copied to clipboard
suspend fun pay(signer: SuiAddress, inputCoins: List<ObjectId>, recipients: List<SuiAddress>, amounts: List<Long>, gas: ObjectId? = null, gasBudget: Long): TransactionBlockBytes

Send Coin<T> to a list of addresses, where T can be any coin type following a list of amounts.

Link copied to clipboard
suspend fun payAllSui(signer: SuiAddress, inputCoins: List<ObjectId>, recipient: SuiAddress, gasBudget: Long): TransactionBlockBytes

Send all SUI coins to one recipient.

Link copied to clipboard
suspend fun paySui(signer: SuiAddress, inputCoins: List<ObjectId>, recipients: List<SuiAddress>, amounts: List<Long>, gasBudget: Long): TransactionBlockBytes

Send SUI coins to a list of addresses, following a list of amounts.

Link copied to clipboard
suspend fun publish(sender: SuiAddress, compiledModules: List<String>, dependencies: List<ObjectId>, gas: ObjectId? = null, gasBudget: Long): TransactionBlockBytes

Create an unsigned transaction to publish a Move package.

Link copied to clipboard
suspend fun queryEvents(eventFilter: EventFilter, cursor: EventID? = null, limit: Int? = null, descendingOrder: Boolean? = null): EventPage

Queries events on the Sui blockchain matching the given eventFilter. d It optionally starts from the event with the specified cursor, returning at most limit events, otherwise QUERY_MAX_RESULT_LIMIT, and in either ascending or descending order based on descendingOrder. Returns an EventPage containing the matching events and pagination information.

Link copied to clipboard
suspend fun queryTransactionBlocks(query: TransactionBlockResponseQuery, cursor: String? = null, limit: Int? = null, descendingOrder: Boolean = false): TransactionBlocksPage

Queries the transaction blocks based on the given parameters.

Link copied to clipboard
suspend fun requestAddStake(signer: SuiAddress, coins: List<ObjectId>, amount: Long, validator: SuiAddress, gas: ObjectId? = null, gasBudget: Long): TransactionBlockBytes

Add stake to a validator's staking pool using multiple coins and amount.

Link copied to clipboard
Link copied to clipboard
suspend fun requestWithdrawStake(signer: SuiAddress, stakedSui: ObjectId, gas: ObjectId? = null, gasBudget: Long): TransactionBlockBytes

Withdraw stake from a validator's staking pool.

Link copied to clipboard

Resolves the address of a name service based on the provided name.

Link copied to clipboard
suspend fun resolveNameServiceNames(address: SuiAddress, cursor: ObjectId? = null, limit: Long? = null): NameServicePage

Return the resolved names given address, if multiple names are resolved, the first one is the primary name.

Link copied to clipboard
suspend fun splitCoin(signer: SuiAddress, coinObjectId: ObjectId, splitAmounts: List<Long>, gas: ObjectId? = null, gasBudget: Long): TransactionBlockBytes

Create an unsigned transaction to split a coin object into multiple coins.

Link copied to clipboard
suspend fun splitCoinEqual(signer: SuiAddress, coinObjectId: ObjectId, splitCount: Long, gas: ObjectId? = null, gasBudget: Long): TransactionBlockBytes

Create an unsigned transaction to split a coin object into multiple equal-size coins.

Link copied to clipboard
suspend fun transferObject(signer: SuiAddress, objectId: ObjectId, gas: ObjectId? = null, gasBudget: Long, recipient: SuiAddress): TransactionBlockBytes

Create an unsigned transaction to transfer an object from one address to another. The object's type must allow public transfers.

Link copied to clipboard
suspend fun transferSui(signer: SuiAddress, suiObjectId: ObjectId, gasBudget: Long, recipient: SuiAddress, amount: Long): TransactionBlockBytes

Create an unsigned transaction to send SUI coin object to a Sui address. The SUI object is also used as the gas object.

Link copied to clipboard

Tries to retrieve multiple past versions of objects based on the provided PastObjectRequest list and options.

Link copied to clipboard

Tries to retrieve a past version of an object based on its ID and version number.

Link copied to clipboard
open fun whichUrl(endPoint: EndPoint): String

Returns the current Sui end point.