This is due to the wallet not dynamically providing fees in real time to the generate_psbt function. Thus when the user attempts to generate a transaction with their current wallet balance (or slightly below it), the application will throw an error as it attempts to use this amount as the total output and cannot afford to cover transaction fees.
Additionally, because real time fee estimates are not shown on the front end (as well as estimated tx size), it is not easy to estimate what amount of satoshis need to be left out of the transaction in order to cover fees.
In order to fix this, I will need to implement sendall linked below
This is due to the wallet not dynamically providing fees in real time to the generate_psbt function. Thus when the user attempts to generate a transaction with their current wallet balance (or slightly below it), the application will throw an error as it attempts to use this amount as the total output and cannot afford to cover transaction fees.
Additionally, because real time fee estimates are not shown on the front end (as well as estimated tx size), it is not easy to estimate what amount of satoshis need to be left out of the transaction in order to cover fees.
In order to fix this, I will need to implement sendall linked below
https://bitcoincore.org/en/doc/25.0.0/rpc/wallet/sendall/
If not sendall, then some permutation of deducting fees from inputs