Send a custom coin object that is owned by a object that I own

Suppose I own an object A and someone sends 2 custom coin objects B and C. So in move function call I want to unwrap the coin objects B and C and then merge them and send it to another object address. How can I achieve this in move syntax?

2 Likes

You will need to use functions that the framework exposes for the given coin.

For instance, if you have a Coin<T> you can call sui::coin::join<T>(b: &mut Coin<T>, c: Coin<T>) which will merge the two balances into coin b.

1 Like