fn transfer_coins_to_output(coins: u64, asset_id: AssetId, recipient: Address) {
transfer_to_address(recipient, asset_id, coins);
}
transfer_coins_to_output
with the SDK, you can specify the number of variable outputs by chaining append_variable_outputs(amount)
to your call. Like this: let address = wallet.address();
let asset_id = contract_id.asset_id(&Bits256::zeroed());
// withdraw some tokens to wallet
let response = contract_methods
.transfer_coins_to_output(1_000_000, asset_id, address)
.append_variable_outputs(1)
.call()
.await?;
append_variable_outputs
effectively appends a given amount of Output::Variable
s to the transaction's list of outputs. This output type indicates that the amount and the owner may vary based on transaction execution. Note: that the Swaylib-std
functionmint_to_address
callstransfer_to_address
under the hood, so you need to callappend_variable_outputs
in the Rust SDK tests like you would fortransfer_to_address
.