Skip to main content
Have you ever wanted to send multiple assets to another wallet or totally evacuate a wallet because you think you’re at risk of a drainer? I haven’t come across a tool or wallet that allows you to do this, but it’s really useful, so why not build one on Sui now?

Building the Evacuation Package

Once you have your project setup, define the module at the top of your Move file like this:
[sui.move]
Now import the Coin module like this:
[sui.move]
Feel free to define custom errors:
[sui.move]
You’ll use this to catch cases where the user provides a mismatched number of coins and amounts. Here’s the function signature for the evacuation. The function takes in the recipient address, a vector of the coins and the amounts you want to send for each, and the transaction context.
[sui.move]
Now, you’d have to make sure the lengths of the vectors match like this:
[sui.move]
Now, the core evaluation functionality! You could go through each coin, split the amount to send, transfer both the split and leftover to the recipient, and clean up the original coin vector.
[sui.move]
You have to destroy the original coin vector because in Sui Move, a vector<Coin<T>> does not have the drop ability (since Coin<T> itself does not have drop). Now build the package to make sure everything works as expected:
[sui.move]
You can execute this command to publish the package to a Sui network.
[sui.move]
Execute this command to evacuate or send multiple coins to a wallet:
[sui.move]
Replace the placeholders:
  • <PACKAGE_ID> – your published package ID.
  • <RECIPIENT_ADDRESS> – the address you’re evacuating to.
  • <COIN_ID_1>... – the object IDs of the coins you’re transferring.
  • <AMOUNT_1>... – the exact amount to transfer from each coin.
  • <TOKEN_TYPE> – the type of the token (e.g., 0x2::sui::SUI or your custom coin).
Your tokens should all be sent in one transaction, and you’ll surely save on gas.

Conclusion

If you ever need to send out multiple assets from a single wallet, you know how to go around it. Up next is clients because you’re definitely not shipping CLI commands to users.