diff --git a/lib/ucoinpy/api/bma/tx/__init__.py b/lib/ucoinpy/api/bma/tx/__init__.py index 384b7ff9f0b8827ae1ac2e400e1adc91efef2b48..10ea07a5ca4bf673286a3b4d36dbf76662e85d22 100644 --- a/lib/ucoinpy/api/bma/tx/__init__.py +++ b/lib/ucoinpy/api/bma/tx/__init__.py @@ -44,4 +44,4 @@ class Sources(Tx): def __get__(self, **kwargs): assert self.pubkey is not None - return self.requests_get('/sources/%d' % self.pubkey, **kwargs).json() + return self.requests_get('/sources/%s' % self.pubkey, **kwargs).json() diff --git a/lib/ucoinpy/documents/transaction.py b/lib/ucoinpy/documents/transaction.py index 2cbdb7000d6be0b16dafe15884968004470ee4c0..251c6b89b995d9af8c7733ff21b6aec8a23a2f2d 100644 --- a/lib/ucoinpy/documents/transaction.py +++ b/lib/ucoinpy/documents/transaction.py @@ -265,7 +265,7 @@ class InputSource(): @classmethod def from_bma(cls, bma_data): index = None - source = bma_data['source'] + source = bma_data['type'] number = bma_data['number'] txhash = bma_data['fingerprint'] amount = bma_data['amount'] diff --git a/src/cutecoin/models/community/__init__.py b/src/cutecoin/models/community/__init__.py index 287a0ae78b9baa1a0cbabf2afa51f37db0e66da3..3df20950557f9fc1418257a58ffefb99a29cfbcf 100644 --- a/src/cutecoin/models/community/__init__.py +++ b/src/cutecoin/models/community/__init__.py @@ -68,15 +68,20 @@ class Community(object): return members def request(self, request, req_args={}, get_args={}): + error = None + logging.debug("Nodes : {0}".format(self.nodes)) for node in self.nodes: logging.debug("Trying to connect to : " + node.get_text()) req = request(node.connection_handler(), **req_args) try: data = req.get(**get_args) return data - except: - continue - return None + except ValueError as e: + error = str(e) + logging.debug("Error : {0}".format(error)) + + logging.debug("Leaving on error...") + return error def post(self, request, req_args={}, post_args={}): error = None diff --git a/src/cutecoin/models/transaction/receivedListModel.py b/src/cutecoin/models/transaction/receivedListModel.py index 152a64c3e775feeabd5cb2ac45ecbe804a6b28bd..4c87de05e184d68b4e0aa03263110e3bf3275c4d 100644 --- a/src/cutecoin/models/transaction/receivedListModel.py +++ b/src/cutecoin/models/transaction/receivedListModel.py @@ -22,7 +22,7 @@ class ReceivedListModel(QAbstractListModel): self.sources = account.sources() def rowCount(self, parent): - return len(self.transactions) + return len(self.sources) def data(self, index, role): if role == Qt.DisplayRole: diff --git a/src/cutecoin/models/wallet/__init__.py b/src/cutecoin/models/wallet/__init__.py index 993f654c9630872525eade90f3d6d621b81ead79..dd94d5b1e311f4a246e56bcae08b47b798010e6c 100644 --- a/src/cutecoin/models/wallet/__init__.py +++ b/src/cutecoin/models/wallet/__init__.py @@ -67,10 +67,10 @@ class Wallet(object): def sources(self, community): data = community.request(bma.tx.Sources, req_args={'pubkey': self.pubkey}) - sources = [] - for s in data: - sources.append(InputSource.from_bma(s)) - return sources + tx = [] + for s in data['sources']: + tx.append(InputSource.from_bma(s)) + return tx #TODO: Build a cache of latest transactions def transactions_sent(self):