Move most of txToPairs into a new createTx func

Also changes it so that it adds new inputs incrementally as needed instead
of starting with an empty tx and adding all inputs again on each iteration.
It could still be a separate function, but just range over the outputs map once.  Have it return a new MsgTx with all of the outputs and the total output amount, plus an error in case any of the output amounts was negative.