Move.

Post

Share your knowledge.

tomek.
Jan 04, 2025
Discussion

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
0
2
Share
Comments
.

Answers

2
Elvin CLONE .
Jan 4 2025, 19:43

To 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

0
Comments
.
Bolke .
Jan 5 2025, 04:31

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.

0
Comments
.

Do you know the answer?

Please log in and share it.

We use cookies to ensure you get the best experience on our website.
More info