Move most of txToPairs into a new createTx func

That new function can be easily tested because it doesn't need a
Wallet instance.