From aa155b05209982381268b81aba1fc130713c614d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sa=C5=82aban?= Date: Mon, 22 Jan 2018 03:21:25 +0100 Subject: [PATCH] Fix: use proper class; add comment on pending PR --- monero/backends/jsonrpc.py | 4 ++-- tests/wallet.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/monero/backends/jsonrpc.py b/monero/backends/jsonrpc.py index 9148536..304b6e7 100644 --- a/monero/backends/jsonrpc.py +++ b/monero/backends/jsonrpc.py @@ -170,13 +170,13 @@ class JSONRPCWallet(object): def get_transactions_in(self, account=0): _transfers = self.raw_request('get_transfers', {'account_index': account, 'in': True, 'out': False, 'pool': False}) - return [Transaction(**self._tx2dict(tx)) for tx in + return [Payment(**self._tx2dict(tx)) for tx in sorted(_transfers.get('in', []), key=operator.itemgetter('timestamp'))] def get_transactions_out(self, account=0): _transfers = self.raw_request('get_transfers', {'account_index': account, 'in': False, 'out': True, 'pool': False}) - return [Transaction(**self._tx2dict(tx)) for tx in + return [Transfer(**self._tx2dict(tx)) for tx in sorted(_transfers.get('out', []), key=operator.itemgetter('timestamp'))] def _tx2dict(self, tx): diff --git a/tests/wallet.py b/tests/wallet.py index fc22f2e..a1391f3 100644 --- a/tests/wallet.py +++ b/tests/wallet.py @@ -163,8 +163,9 @@ class SubaddrWalletTestCase(unittest.TestCase): pay_in = self.wallet.get_transactions_in() self.assertEqual(len(list(pay_in)), 3) for tx in pay_in: - self.assertIsInstance(tx, Transaction) -# self.assertIsInstance(tx.address, Address) + self.assertIsInstance(tx, Payment) +# Once PR#3010 has been merged to Monero, update the JSON and enable the following: +# self.assertIsInstance(tx.local_address, Address) self.assertIsInstance(tx.amount, Decimal) self.assertIsInstance(tx.fee, Decimal) @@ -257,8 +258,9 @@ class SubaddrWalletTestCase(unittest.TestCase): pay_out = self.wallet.get_transactions_out() self.assertEqual(len(list(pay_out)), 6) for tx in pay_out: - self.assertIsInstance(tx, Transaction) -# self.assertIsInstance(tx.address, Address) + self.assertIsInstance(tx, Transfer) +# Once PR#3010 has been merged to Monero, update the JSON and enable the following: +# self.assertIsInstance(tx.local_address, Address) self.assertIsInstance(tx.amount, Decimal) self.assertIsInstance(tx.fee, Decimal) self.assertIsInstance(tx.timestamp, datetime)