You can forward coins to a contract using call_params()
. The call parameter options are:
- Amount
- Asset ID
- Gas forwarded
// Bytes representation of the asset ID of the base asset used for gas fees.
const BASE_ASSET_ID: AssetId = AssetId::new([0u8; 32]);
// call params to send the base asset
let call_params = CallParameters::new(Some(price), Some(BASE_ASSET_ID), None);
// call send_tokens method from wallet_1
let _resp = instance
.with_wallet(wallet_1.clone())
.unwrap()
.methods()
.send_tokens()
.call_params(call_params)
.call()
.await
.unwrap();
// check the balance of wallet_1 to verify the amount was sent
let balance_1: u64 = wallet_1.get_asset_balance(&BASE_ASSET_ID).await.unwrap();