Post
Share your knowledge.
How to send SUI to a wallet address in a smart contract?
I'm working on a smart contract and I'm struggling to send SUI tokens to a specific wallet address. I have used the transfer::public_transfer
function as suggested in the Sui framework but didn't succeed. Here's what I tried, but I encountered errors. What could be wrong and how can I fix it?
- Move CLI
Answers
2To send any object to a specific wallet address through your smart contract, use the transfer::public_transfer
function provided by the Sui framework. You can also refer to the Move book for detailed explanations and examples: https://move-book.com/storage/storage-functions.html#transfer
Make sure to use mutable coin types in your function parameters. Modify your function to include coin: &mut Coin<SUI>
. This modification should fix the problem where errors might be occurring due to immutable coin parameters.
Do you know the answer?
Please log in and share it.
Move is an executable bytecode language used to implement custom transactions and smart contracts.