Please help me. How to send several different coins at once using a smart contract to Aptos in one transaction if initially the number of coins and their types are unknown and will be indicated only by arguments? I realized that I should use vectors in the function arguments, but I can’t figure it out further.
I've tried to use vectors like in code below but i got errors.
public entry fun multisend(sender: &signer, receiver: address, types: vector<coin::Coin<T>>, amounts: vector<u64>)
This is not currently possible because:
Coin
, you must passCoinType
:coin::transfer<CoinType>(sender, receiver, amount);
CoinType
as type arguments is impossible. The best you can do ismultisend<CoinType1, CoinType2, ..., CoinTypeN>
but N is a bounded number.