Added tests for wallet model.

Fixed some bugs in wallet model.
Added tests for history model.