From 79ec47af101c8c0bbe35c56c2df9ada1ae358518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Sainl=C3=A9ger?= Date: Thu, 24 Oct 2024 15:00:10 +0200 Subject: [PATCH] [FIX] lcc_comchain/cyclos_base: add type check in get_wallet_balance --- lcc_comchain_base/models/wallet.py | 4 ++++ lcc_cyclos_base/models/wallet.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lcc_comchain_base/models/wallet.py b/lcc_comchain_base/models/wallet.py index 55dde76f..16f7591d 100644 --- a/lcc_comchain_base/models/wallet.py +++ b/lcc_comchain_base/models/wallet.py @@ -272,6 +272,10 @@ def get_wallet_data(self): def get_wallet_balance(self): self.ensure_one() + res = super(ResPartnerBackend, self).get_wallet_balance() + if self.type != "comchain": + return res + wallet = pyc3l.Wallet.from_json(self.comchain_wallet) try: balance = wallet.nantBalance diff --git a/lcc_cyclos_base/models/wallet.py b/lcc_cyclos_base/models/wallet.py index e63f9417..3d103b14 100644 --- a/lcc_cyclos_base/models/wallet.py +++ b/lcc_cyclos_base/models/wallet.py @@ -277,7 +277,9 @@ def get_wallet_data(self): def get_wallet_balance(self): self.ensure_one() - res = "" + res = super(ResPartnerBackend, self).get_wallet_balance() + if self.type != "cyclos": + return res try: res = self._cyclos_rest_call("GET", "/%s/accounts" % self.cyclos_id) _logger.debug("res: %s" % res)