Compare commits
8 Commits
sohail/doc
...
v0.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 1dba2d09d1 | |||
| 618aa7716e | |||
| 17ae29887f | |||
| fbb5168b40 | |||
| c269318528 | |||
| c3e8883f15 | |||
|
5f62287913
|
|||
| 28d7699a4a |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -3,4 +3,5 @@ __pycache__
|
|||||||
build/
|
build/
|
||||||
*.pyc
|
*.pyc
|
||||||
.venv
|
.venv
|
||||||
.clicada
|
.clicada
|
||||||
|
dist/
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
- 0.0.7
|
||||||
|
* fix: make store_path relative to the users home
|
||||||
- 0.0.6
|
- 0.0.6
|
||||||
* Add cache encryption, with AES-CTR-128
|
* Add cache encryption, with AES-CTR-128
|
||||||
- 0.0.5
|
- 0.0.5
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -28,6 +28,18 @@ pip install -r requirements.txt --extra-index-url=https://pip.grassrootseconomic
|
|||||||
pip3 install -UI --extra-index-url=https://pip.grassrootseconomics.net clicada
|
pip3 install -UI --extra-index-url=https://pip.grassrootseconomics.net clicada
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### GPG Keyring setup
|
||||||
|
|
||||||
|
PGP uses the default keyring, you can however pass in a custom keyring path.
|
||||||
|
|
||||||
|
To create a keyring from a specific key and get its path for `AUTH_KEYRING_PATH`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# In some dir
|
||||||
|
gpg --homedir .gnupg --import private.pgp
|
||||||
|
pwd
|
||||||
|
```
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -67,3 +79,9 @@ optional arguments:
|
|||||||
override fee limit
|
override fee limit
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```bash
|
||||||
|
AUTH_PASSPHRASE=queenmarlena AUTH_KEYRING_PATH=/home/kamikaze/grassroots/usumbufu/tests/testdata/pgp/.gnupg/ AUTH_KEY=CCE2E1D2D0E36ADE0405E2D0995BB21816313BD5 CHAIN_SPEC=evm:byzantium:8996:bloxberg CIC_REGISTRY_ADDRESS=0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299 RPC_PROVIDER=https://rpc.grassecon.net TX_CACHE_URL=https://cache.grassecon.net HTTP_CORS_ORIGIN=https://auth.grassecon.net META_HTTP_ORIGIN=https://auth.grassecon.net:443 PYTHONPATH=. python clicada/runnable/view.py u --meta-url https://auth.grassecon.net +254711000000
|
||||||
|
```
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import json
|
|||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
from clicada.user import FileUserStore
|
from clicada.user import FileUserStore
|
||||||
|
from pathlib import Path
|
||||||
|
import os
|
||||||
|
|
||||||
categories = [
|
categories = [
|
||||||
'phone',
|
'phone',
|
||||||
@@ -35,7 +36,7 @@ def validate(config, args):
|
|||||||
|
|
||||||
|
|
||||||
def execute(ctrl):
|
def execute(ctrl):
|
||||||
store_path = '.clicada'
|
store_path = os.path.join(str(Path.home()), '.clicada')
|
||||||
user_store = FileUserStore(None, ctrl.chain(), ctrl.get('_CATEGORY'), store_path, int(ctrl.get('FILESTORE_TTL')))
|
user_store = FileUserStore(None, ctrl.chain(), ctrl.get('_CATEGORY'), store_path, int(ctrl.get('FILESTORE_TTL')))
|
||||||
user_store.put(ctrl.get('_IDENTIFIER'), json.dumps(ctrl.get('_TAG')), force=True)
|
user_store.put(ctrl.get('_IDENTIFIER'), json.dumps(ctrl.get('_TAG')), force=True)
|
||||||
user_store.stick(ctrl.get('_IDENTIFIER'))
|
user_store.stick(ctrl.get('_IDENTIFIER'))
|
||||||
|
|||||||
@@ -1,25 +1,22 @@
|
|||||||
# standard imports
|
# standard imports
|
||||||
import sys
|
|
||||||
import logging
|
|
||||||
import datetime
|
import datetime
|
||||||
|
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
|
# external imports
|
||||||
from cic_eth_registry import CICRegistry
|
from cic_eth_registry import CICRegistry
|
||||||
from cic_eth_registry.lookup.tokenindex import TokenIndexLookup
|
from cic_eth_registry.lookup.tokenindex import TokenIndexLookup
|
||||||
from cic_types.models.person import Person
|
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.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__)
|
logg = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -30,7 +27,7 @@ def process_args(argparser):
|
|||||||
argparser.add_argument('-m', '--method', type=str, help='lookup method')
|
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('--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('-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():
|
def extra_args():
|
||||||
@@ -54,22 +51,26 @@ def validate(config, args):
|
|||||||
def execute(ctrl):
|
def execute(ctrl):
|
||||||
tx_getter = TxGetter(ctrl.get('TX_CACHE_URL'), 10)
|
tx_getter = TxGetter(ctrl.get('TX_CACHE_URL'), 10)
|
||||||
|
|
||||||
store_path = '.clicada'
|
store_path = os.path.join(str(Path.home()), '.clicada')
|
||||||
user_phone_file_label = 'phone'
|
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)
|
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')))
|
identifier = ctrl.get('_IDENTIFIER')
|
||||||
user_address = user_phone_store.by_phone(ctrl.get('_IDENTIFIER'), update=ctrl.get('_FORCE'))
|
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:
|
if user_address == None:
|
||||||
ctrl.ouch('unknown identifier: {}\n'.format(ctrl.get('_IDENTIFIER')))
|
ctrl.ouch('unknown identifier: {}\n'.format(identifier))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
try:
|
try:
|
||||||
user_address = to_checksum_address(user_address)
|
user_address = to_checksum_address(user_address)
|
||||||
except ValueError:
|
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)
|
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)
|
user_address_normal = tx_normalizer.wallet_address(user_address)
|
||||||
ctrl.notify('retrieving txs for address {}'.format(user_address_normal))
|
ctrl.notify('retrieving txs for address {}'.format(user_address_normal))
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ class FileUserStore:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logg.debug('no metadata found for {}: {}'.format(address, e))
|
logg.debug('no metadata found for {}: {}'.format(address, e))
|
||||||
|
|
||||||
if r == None:
|
if not r:
|
||||||
self.failed_entities[address] = True
|
self.failed_entities[address] = True
|
||||||
raise MetadataNotFoundError()
|
raise MetadataNotFoundError()
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
usumbufu~=0.3.5
|
usumbufu~=0.3.8
|
||||||
confini~=0.5.3
|
confini~=0.6.0
|
||||||
cic-eth-registry~=0.6.1
|
cic-eth-registry~=0.6.9
|
||||||
cic-types~=0.2.1a8
|
cic-types~=0.2.2
|
||||||
phonenumbers==8.12.12
|
phonenumbers==8.12.12
|
||||||
eth-erc20~=0.1.2
|
eth-erc20~=0.3.0
|
||||||
hexathon~=0.1.0
|
hexathon~=0.1.0
|
||||||
pycryptodome~=3.10.1
|
pycryptodome~=3.10.1
|
||||||
chainlib-eth~=0.0.21
|
chainlib-eth~=0.1.0
|
||||||
chainlib~=0.0.17
|
chainlib~=0.1.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = clicada
|
name = clicada
|
||||||
version = 0.0.6
|
version = 0.1.0
|
||||||
description = CLI CRM tool for the cic-stack custodial wallet system
|
description = CLI CRM tool for the cic-stack custodial wallet system
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
|||||||
Reference in New Issue
Block a user