How to write PAB endpoint for Mint script to transfer left-over Ada back to address of input Utxo?

I just try week06, start PAB service and invoke ‘mint’ endpoint with parameter: policyId/tokenName/walletId/accountAddress .

It minted token successflly, but the left-over Ada was transfer to another address that belong to same wallet id, which is not my expected. What I want is: the left-over Ada transfer back to address of input Utxo.

Can any share a example on how to implement it? Suppose there rule is : only one input Utxo, two output Utxo: one contain minted Token, another contains the left-over Ada .

Thanks

Muesly swap released their DEX code with AMM, your can take a look here GitHub - MuesliSwapTeam/muesliswap-cardano-pool-contracts: Smart Contracts powering AMM Pool's for MuesliSwap on Cardano 🥣

Thanks, will have a look at it.