5 Commits

6 changed files with 33 additions and 31 deletions

3
.gitignore vendored
View File

@@ -3,4 +3,5 @@ __pycache__
build/
*.pyc
.venv
.clicada
.clicada
dist/

View File

@@ -1,3 +1,5 @@
- 0.0.7
* fix: make store_path relative to the users home
- 0.0.6
* Add cache encryption, with AES-CTR-128
- 0.0.5

View File

@@ -1,27 +1,22 @@
# standard imports
import sys
import logging
import datetime
from pathlib import Path
import logging
import os
import sys
from pathlib import Path
from chainlib.encode import TxHexNormalizer
from chainlib.eth.address import is_address, to_checksum_address
# external imports
from cic_eth_registry import CICRegistry
from cic_eth_registry.lookup.tokenindex import TokenIndexLookup
from cic_types.models.person import Person
from chainlib.eth.address import to_checksum_address
from chainlib.encode import TxHexNormalizer
from hexathon import add_0x
# local imports
from clicada.tx import TxGetter
from clicada.user import FileUserStore
from clicada.token import (
FileTokenStore,
token_balance,
)
from clicada.tx import ResolvedTokenTx
from clicada.error import MetadataNotFoundError
from clicada.token import FileTokenStore, token_balance
# local imports
from clicada.tx import ResolvedTokenTx, TxGetter
from clicada.user import FileUserStore
from hexathon import add_0x
logg = logging.getLogger(__name__)
@@ -32,7 +27,7 @@ def process_args(argparser):
argparser.add_argument('-m', '--method', type=str, help='lookup method')
argparser.add_argument('--meta-url', dest='meta_url', type=str, help='Url to retrieve metadata from')
argparser.add_argument('-f', '--force-update', dest='force_update', action='store_true', help='Update records of mutable entries')
argparser.add_argument('identifier', type=str, help='user identifier')
argparser.add_argument('identifier', type=str, help='user identifier (phone_number or address)')
def extra_args():
@@ -60,18 +55,22 @@ def execute(ctrl):
user_phone_file_label = 'phone'
user_phone_store = FileUserStore(ctrl.opener('meta'), ctrl.chain(), user_phone_file_label, store_path, int(ctrl.get('FILESTORE_TTL')), encrypter=ctrl.encrypter)
ctrl.notify('resolving identifier {} to wallet address'.format(ctrl.get('_IDENTIFIER')))
user_address = user_phone_store.by_phone(ctrl.get('_IDENTIFIER'), update=ctrl.get('_FORCE'))
identifier = ctrl.get('_IDENTIFIER')
ctrl.notify('resolving identifier {} to wallet address'.format(identifier))
if is_address(identifier):
user_address = identifier
else:
user_address = user_phone_store.by_phone(identifier, update=ctrl.get('_FORCE'))
if user_address == None:
ctrl.ouch('unknown identifier: {}\n'.format(ctrl.get('_IDENTIFIER')))
ctrl.ouch('unknown identifier: {}\n'.format(identifier))
sys.exit(1)
try:
user_address = to_checksum_address(user_address)
except ValueError:
ctrl.ouch('invalid response "{}" for {}\n'.format(user_address, ctrl.get('_IDENTIFIER')))
ctrl.ouch('invalid response "{}" for {}\n'.format(user_address, identifier))
sys.exit(1)
logg.debug('loaded user address {} for {}'.format(user_address, ctrl.get('_IDENTIFIER')))
logg.debug('loaded user address {} for {}'.format(user_address, identifier))
user_address_normal = tx_normalizer.wallet_address(user_address)
ctrl.notify('retrieving txs for address {}'.format(user_address_normal))

View File

@@ -269,7 +269,7 @@ class FileUserStore:
except Exception as e:
logg.debug('no metadata found for {}: {}'.format(address, e))
if r == None:
if not r:
self.failed_entities[address] = True
raise MetadataNotFoundError()

View File

@@ -1,10 +1,10 @@
usumbufu~=0.3.5
confini~=0.5.3
cic-eth-registry~=0.6.1
cic-types~=0.2.1a8
usumbufu~=0.3.8
confini~=0.6.0
cic-eth-registry~=0.6.9
cic-types~=0.2.2
phonenumbers==8.12.12
eth-erc20~=0.1.2
eth-erc20~=0.3.0
hexathon~=0.1.0
pycryptodome~=3.10.1
chainlib-eth~=0.0.21
chainlib~=0.0.17
chainlib-eth~=0.1.0
chainlib~=0.1.0

View File

@@ -1,6 +1,6 @@
[metadata]
name = clicada
version = 0.0.6
version = 0.1.0
description = CLI CRM tool for the cic-stack custodial wallet system
author = Louis Holbrook
author_email = dev@holbrook.no