Move.

Post

Share your knowledge.

tomek.
Jan 04, 2025
Expert Q&A

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
2
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

1
Best Answer
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.

1
Comments
.

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.

148Posts231Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

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