cic-internal-integration/apps/cic-eth/cic_eth/server/controllers/token_controller.py

38 lines
876 B
Python

import logging
import connexion
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 import Token
from cic_eth.server.models.token import Token # noqa: E501
log = logging.getLogger(__name__)
chain_spec = config.get('CHAIN_SPEC')
celery_queue = config.get('CELERY_QUEUE')
api = Api(
chain_spec,
queue=celery_queue,
)
def get_default_token(): # noqa: E501
"""get_default_token
Retrieve transactions # noqa: E501
:rtype: Token
"""
task = api.default_token()
data = task.get() # api call('balance', address, token_symbol, include_pending)
task = api.default_token()
data = task.get()
print(data)
log.debug(data)
return Token(address=data['address'], symbol=data['symbol'], decimals=data['decimals'], name=data['name'])