From 56cd5155f7688451d11f2913d97e55533d598d10 Mon Sep 17 00:00:00 2001 From: William Luke Date: Tue, 16 Nov 2021 11:07:00 +0300 Subject: [PATCH] remove mocel0xAddress --- .../server/controllers/account_controller.py | 3 +- .../cic-eth/cic_eth/server/models/__init__.py | 1 - .../cic_eth/server/models/model0x_address.py | 37 ------------------- .../cic_eth/server/models/token_balance.py | 4 +- 4 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 apps/cic-eth/cic_eth/server/models/model0x_address.py diff --git a/apps/cic-eth/cic_eth/server/controllers/account_controller.py b/apps/cic-eth/cic_eth/server/controllers/account_controller.py index 6e85d520..9dc54629 100644 --- a/apps/cic-eth/cic_eth/server/controllers/account_controller.py +++ b/apps/cic-eth/cic_eth/server/controllers/account_controller.py @@ -9,7 +9,6 @@ import six from cic_eth.api.api_task import Api from cic_eth.graphql.config import config from cic_eth.server import util -from cic_eth.server.models.model0x_address import Model0xAddress # noqa: E501 from cic_eth.server.models.token import Token # noqa: E501 from cic_eth.server.models.token_balance import TokenBalance # noqa: E501 @@ -87,7 +86,7 @@ def account_balance(address, token_symbol, include_pending=True): # noqa: E501 data = task.get() # api call('balance', address, token_symbol, include_pending) log.debug(data) #[{'address': '3ff776b6f888980def9d4220858803f9dc5e341e', 'converters': [], 'balance_network': 0}] - return data + return list(map(lambda b : TokenBalance(**b), data)) def create_account_post(password, register): # noqa: E501 diff --git a/apps/cic-eth/cic_eth/server/models/__init__.py b/apps/cic-eth/cic_eth/server/models/__init__.py index 22e4b2a4..34bc97a1 100644 --- a/apps/cic-eth/cic_eth/server/models/__init__.py +++ b/apps/cic-eth/cic_eth/server/models/__init__.py @@ -3,6 +3,5 @@ # flake8: noqa from __future__ import absolute_import # import models into model package -from cic_eth.server.models.model0x_address import Model0xAddress from cic_eth.server.models.token import Token from cic_eth.server.models.token_balance import TokenBalance diff --git a/apps/cic-eth/cic_eth/server/models/model0x_address.py b/apps/cic-eth/cic_eth/server/models/model0x_address.py deleted file mode 100644 index 63f2ee24..00000000 --- a/apps/cic-eth/cic_eth/server/models/model0x_address.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding: utf-8 - -from __future__ import absolute_import -from datetime import date, datetime # noqa: F401 - -from typing import List, Dict # noqa: F401 - -from cic_eth.server.models.base_model_ import Model -from cic_eth.server import util - - -class Model0xAddress(Model): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - def __init__(self): # noqa: E501 - """Model0xAddress - a model defined in Swagger - - """ - self.swagger_types = { - } - - self.attribute_map = { - } - - @classmethod - def from_dict(cls, dikt) -> 'Model0xAddress': - """Returns the dict as a model - - :param dikt: A dict. - :type: dict - :return: The 0xAddress of this Model0xAddress. # noqa: E501 - :rtype: Model0xAddress - """ - return util.deserialize_model(dikt, cls) diff --git a/apps/cic-eth/cic_eth/server/models/token_balance.py b/apps/cic-eth/cic_eth/server/models/token_balance.py index 879370b1..234e2ffa 100644 --- a/apps/cic-eth/cic_eth/server/models/token_balance.py +++ b/apps/cic-eth/cic_eth/server/models/token_balance.py @@ -15,7 +15,7 @@ class TokenBalance(Model): Do not edit the class manually. """ - def __init__(self, address: str = None, converters: List[str] = None, balance_network: int = None, balance_incoming: int = None, balance_outgoing: int = None, balance_available: int = None): # noqa: E501 + def __init__(self, address: str = None, converters: List[str] = None, balance_network: int = None, balance_incoming: int = None, balance_outgoing: int = None): # noqa: E501 """TokenBalance - a model defined in Swagger :param address: The address of this TokenBalance. # noqa: E501 @@ -53,7 +53,7 @@ class TokenBalance(Model): self._balance_network = balance_network self._balance_incoming = balance_incoming self._balance_outgoing = balance_outgoing - self._balance_available = balance_available + self._balance_available = int(balance_network) + int(balance_incoming) - int(balance_outgoing) @classmethod def from_dict(cls, dikt) -> 'TokenBalance':