This repository was archived by the owner on Jan 19, 2026. It is now read-only.
[BFS-847] Add Support for Coin Module in SDK #79
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces comprehensive support for the Coin Module in the SDK, providing a set of utilities for managing SUI coins.
Key Changes
1. New Coin Interfaces (
src/sui_utils/sui_interfaces.py)Coin: Represents a SUI coin with properties like type, object ID, balanceCoinMetadata: Contains coin metadata (decimals, name, symbol)TransactionResult: Structured transaction response with effectsSuiGetResponse: Handles paginated responses for coin queries2. Coin Utilities (
src/sui_utils/coin_utils.py)CoinUtilsclass with methods for:create_coin_with_balance: Creates a new coin with specified balancemerge_coins: Merges multiple coins into a primary coinsplit_coin: Splits a coin into multiple coins of specified amountsfind_coin_with_balance: Finds a coin with exact or sufficient balancesort_ascending: Sorts coins by balancesum_coins: Calculates total balance of multiple coinsget_all_coins: Retrieves all coins for an address3. RPC Enhancements (
src/sui_utils/rpc.py)rpc_sui_createSplitCoinsTransaction: Creates transaction for splitting coinsrpc_sui_createMergeCoinsTransaction: Creates transaction for merging coinsrpc_sui_getTransactionBytes: Generic method for getting transaction bytesget_coin_metadata: Fetches metadata for coin typesget_coins_with_typewith pagination supportget_coin_balanceto use new response structuresget_coin_having_balanceto work with new interfaces4. Signer Improvements (
src/sui_utils/signer.py)Signerclass with new features:SuiWalletsign_and_execute_txmethod for one-step transaction signing and execution