Apparently, it's not possible to do such a function in Move since it requires the witness (user who executes the transaction). So (I repeat, apparently) the only way is to have the user deploy a Coin bytecode in the frontend.
witness