passing in network to toWIF

Passing in the network to the toWIF function, otherwise the WIF is always bitcoin. I was testing and overriding the network variable to testnet and noticed incorrect private keys being generated even though correct testnet addresses were being generated.