paySui

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.

This is for SUI coin only and does not require a separate gas coin object. Specifically, what pay_sui does are: 1. debit each input_coin to create new coin following the order of amounts and assign it to the corresponding recipient. 2. accumulate all residual SUI from input coins left and deposit all SUI to the first input coin, then use the first input coin as the gas coin object. 3. the balance of the first input coin after tx is sum(input_coins) - sum(amounts) - actual_gas_cost 4. all other input coints other than the first one are deleted.

Return

TransactionBlockBytes The transaction block bytes after the publishing is completed.

Parameters

signer

The transaction signer's Sui address.

inputCoins

The Sui coins to be used in this transaction, including the coin for gas payment.

recipients

The recipients' addresses, the length of this vector must be the same as amounts.

amounts

The gas budget, the transaction will fail if the gas cost exceed the budget.

Throws

if there is an error during the publishing process.