2021-02-20 10:47:01 +01:00
|
|
|
|
# standard imports
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
# external imports
|
|
|
|
|
from cic_eth.api.api_task import Api
|
|
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.WARNING)
|
|
|
|
|
logg = logging.getLogger()
|
|
|
|
|
|
|
|
|
|
queue = 'cic-eth'
|
|
|
|
|
name = 'account'
|
|
|
|
|
|
|
|
|
|
|
2021-02-20 19:17:08 +01:00
|
|
|
|
def do(token_pair, sender, recipient, sender_balance, aux, block_number, tx_index):
|
2021-02-21 13:52:20 +01:00
|
|
|
|
"""Triggers creation and registration of new account through the custodial cic-eth component.
|
2021-02-20 10:47:01 +01:00
|
|
|
|
|
2021-02-21 13:52:20 +01:00
|
|
|
|
It expects the following aux parameters to exist:
|
|
|
|
|
- redis_host_callback: Redis host name exposed to cic-eth, for callback
|
|
|
|
|
- redis_port_callback: Redis port exposed to cic-eth, for callback
|
|
|
|
|
- redis_db: Redis db, for callback
|
|
|
|
|
- redis_channel: Redis channel, for callback
|
|
|
|
|
- chain_spec: Chain specification for the chain to execute the transfer on
|
|
|
|
|
|
|
|
|
|
See local.noop.do for details on parameters and return values.
|
|
|
|
|
"""
|
2021-02-20 19:17:08 +01:00
|
|
|
|
logg.debug('running {} {} {}'.format(__name__, token_pair, sender, recipient))
|
2021-02-20 10:47:01 +01:00
|
|
|
|
api = Api(
|
|
|
|
|
str(aux['chain_spec']),
|
|
|
|
|
queue=queue,
|
|
|
|
|
callback_param='{}:{}:{}:{}'.format(aux['redis_host_callback'], aux['redis_port_callback'], aux['redis_db'], aux['redis_channel']),
|
|
|
|
|
callback_task='cic_eth.callbacks.redis.redis',
|
|
|
|
|
callback_queue=queue,
|
|
|
|
|
)
|
2021-02-20 19:17:08 +01:00
|
|
|
|
|
2021-02-20 10:47:01 +01:00
|
|
|
|
t = api.create_account(register=True)
|
2021-02-20 19:17:08 +01:00
|
|
|
|
|
2021-02-21 13:52:20 +01:00
|
|
|
|
return (None, t, sender_balance, )
|