import { TransactionObjectArgument } from "@mysten/sui/transactions"; import { BigNumberable, CoinStruct, Keypair, SuiAddress, SuiClient, SuiTransactionBlockResponse, TransactionBlock } from "../types"; import { IOnChainCallOptionalParams } from "../interfaces"; export declare class CoinUtils { /** * Returns all coins owned by the provided address of provided type * @param suiClient Sui Client * @param owner the owner of the coins * @param coinType The type (address::coin::Coin) of the coin * @param options optional {limit, cursor} * @returns CoinStruct */ static getCoins(suiClient: SuiClient, owner: string, coinType: string): Promise; /** * Returns the coin balance of the provided coin type for provided address * @param suiClient Sui Client * @param owner the owner of the coins * @param currencyType The type (address::coin::Coin) of the coin * @param options optional {limit, cursor} * @returns BigNumberable sum of all coin values */ static getCoinBalance(suiClient: SuiClient, owner: string, currencyType: string): Promise; /** * Returns the coins of provided type having the provided balance * @param suiClient Sui Client * @param amount the amount of coins we are looking for * @param owner The account address for which to find the coins * @param currencyType The type (address::coin::Coin) of the coin * @param options optional {limit, cursor} * @returns The coin struct of the coin and a boolean indicating if the coin has exact balance or more */ static getCoinHavingBalance(suiClient: SuiClient, amount: BigNumberable, owner: string, currencyType: string): Promise<[CoinStruct, boolean]>; /** * Creates a coin of provided quantity if possible * @param suiClient Sui Client * @param txb Transaction block * @param amount the amount of coins we are looking for * @param owner The account address for which to find the coins * @param coinType The type (address::coin::Coin) of the coin * @returns Txb and The new coin of provided amount */ static createCoinWithBalance(suiClient: SuiClient, txb: TransactionBlock, amount: BigNumberable, coinType: string, owner: string, options?: IOnChainCallOptionalParams): Promise<[any, any]>; /** * Transfers the amount of coin type to the receiver * @param suiClient Sui Client * @param amount The amount of * @param coinType The type (address::coin::Coin) of the coin * @param receiver The address of the receiver * @param signer The sender's singer | keypair * @param isUIWallet True if being used by UI wallet * @returns SuiTransactionBlockResponse */ static transferCoin(suiClient: SuiClient, amount: BigNumberable, coinType: string, receiver: string, signer: Keypair, isUIWallet?: boolean): Promise; /** * Transfers all the coins of provided type * @param suiClient Sui Client * @param coinType The type (address::coin::Coin) of the coin * @param receiver The address of the receiver * @param signer The sender's singer | keypair * @param isUIWallet True if being used by UI wallet * @returns SuiTransactionBlockResponse */ static transferAllCoins(suiClient: SuiClient, coinType: string, receiver: string, signer: Keypair, isUIWallet?: boolean): Promise; /** * Creates a transaction for transferring coin * @param txb Transaction Block * @param suiClient Sui Client * @param amount The amount of * @param coinType The type (address::coin::Coin) of the coin * @param receiver The address of the receiver * @param signer The sender's singer | keypair * @param isUIWallet True if being used by UI wallet * @returns SuiTransactionBlockResponse */ static createTransferCoinTransaction(txb: TransactionBlock, suiClient: SuiClient, amount: BigNumberable, coinType: string, receiver: string, sender: SuiAddress): Promise; /** * Creates a transaction for transferring all the coins of provided type * @param txb Transaction Block * @param suiClient Sui Client * @param coinType The type (address::coin::Coin) of the coin * @param receiver The address of the receiver * @param signer The sender's singer | keypair * @param isUIWallet True if being used by UI wallet * @returns SuiTransactionBlockResponse */ static createTransferAllTransaction(txb: TransactionBlock, suiClient: SuiClient, coinType: string, receiver: string, sender: SuiAddress): Promise; /** * Sums the balance of provided coins * @param coins Paginated coin array * @returns Sum of all coins */ static sumCoins(coins: CoinStruct[]): BigNumberable; /** * Finds the coin having the provided balance. If none then returns undefined * @param coins Paginated coin array * @param amount The amount of balance the coin must have * @returns CoinStruct of the coin and boolean indicating if the coin has exact balance or more */ static findCoinWithBalance(coins: CoinStruct[], amount: BigNumberable): [CoinStruct, boolean]; /** * Makes a zero coin of provided type * @param txb Transaction block * @param coinType Coin Type * @returns TransactionObjectArgument */ static zeroCoin(txb: TransactionBlock, coinType: string): TransactionObjectArgument; /** * Returns true if the provided is SUI * @param coinType * @returns true if the coin type is SUI */ static isSUI(coinType: string): boolean; /** * Sorts the provided coin structs in ascending order * @param coins The CoinStruct to sort * @returns The sorted CoinStruct objects. */ static sortAscending(coins: CoinStruct[]): CoinStruct[]; }