Compare commits
2 Commits
sohail/doc
...
lash/encry
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88b7625320
|
||
|
|
15463145d5
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,5 +2,3 @@ __pycache__
|
||||
*.egg-info
|
||||
build/
|
||||
*.pyc
|
||||
.venv
|
||||
.clicada
|
||||
69
README.md
69
README.md
@@ -1,69 +0,0 @@
|
||||
## Clicada
|
||||
|
||||
> Admin Command Line Interface to interact with cic-meta and cic-cache
|
||||
|
||||
### Pre-requisites
|
||||
|
||||
- Public key uploaded to `cic-auth-helper`
|
||||
- PGP Keyring for your key
|
||||
|
||||
### Installation
|
||||
|
||||
Use either of the following installation methods:
|
||||
|
||||
1. Install from git release (recommended)
|
||||
|
||||
```bash
|
||||
wget https://git.grassecon.net/grassrootseconomics/clicada/archive/v0.0.6.zip
|
||||
unzip clicada-v0.0.6.zip
|
||||
cd clicada
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -r requirements.txt --extra-index-url=https://pip.grassrootseconomics.net
|
||||
```
|
||||
|
||||
2. Install from pip to path (non sudo)
|
||||
|
||||
```bash
|
||||
pip3 install -UI --extra-index-url=https://pip.grassrootseconomics.net clicada
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
usage: clicada [...optional arguments] [...positional arguments]
|
||||
|
||||
positional arguments:
|
||||
{user,u,tag,t}
|
||||
user (u) retrieve transactions for a user
|
||||
tag (t) locally assign a display value to an identifier
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--no-logs Turn off all logging
|
||||
-v Be verbose
|
||||
-vv Be very verbose
|
||||
-c CONFIG, --config CONFIG
|
||||
Configuration directory
|
||||
-n NAMESPACE, --namespace NAMESPACE
|
||||
Configuration namespace
|
||||
--dumpconfig {env,ini}
|
||||
Output configuration and quit. Use with --raw to omit values and output schema only.
|
||||
--env-prefix ENV_PREFIX
|
||||
environment prefix for variables to overwrite configuration
|
||||
-p P, --rpc-provider P
|
||||
RPC HTTP(S) provider url
|
||||
--rpc-dialect RPC_DIALECT
|
||||
RPC HTTP(S) backend dialect
|
||||
--height HEIGHT Block height to execute against
|
||||
-i I, --chain-spec I Chain specification string
|
||||
-u, --unsafe Do not verify address checksums
|
||||
--seq Use sequential rpc ids
|
||||
-y Y, --key-file Y Keystore file to use for signing or address
|
||||
--raw Do not decode output
|
||||
--fee-price FEE_PRICE
|
||||
override fee price
|
||||
--fee-limit FEE_LIMIT
|
||||
override fee limit
|
||||
|
||||
```
|
||||
@@ -3,6 +3,7 @@ import json
|
||||
|
||||
# external imports
|
||||
from clicada.user import FileUserStore
|
||||
from chainlib.encode import TxHexNormalizer
|
||||
|
||||
|
||||
categories = [
|
||||
@@ -12,7 +13,7 @@ categories = [
|
||||
|
||||
|
||||
def process_args(argparser):
|
||||
argparser.add_argument('--category', required=True, type=str, help='Identifier category')
|
||||
argparser.add_argument('--category', required=True, choices=categories, type=str, help='Identifier category')
|
||||
argparser.add_argument('identifier', type=str, help='Identifier to store a display tag for')
|
||||
argparser.add_argument('tag', type=str, help='Display tag to store for the identifier')
|
||||
|
||||
@@ -35,7 +36,11 @@ def validate(config, args):
|
||||
|
||||
|
||||
def execute(ctrl):
|
||||
identifier = ctrl.get('_IDENTIFIER')
|
||||
if ctrl.get('_CATEGORY') == 'address':
|
||||
normalizer = TxHexNormalizer()
|
||||
identifier = normalizer.wallet_address(identifier)
|
||||
store_path = '.clicada'
|
||||
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.stick(ctrl.get('_IDENTIFIER'))
|
||||
user_store = FileUserStore(None, ctrl.chain(), ctrl.get('_CATEGORY'), store_path, int(ctrl.get('FILESTORE_TTL')), encrypter=ctrl.encrypter)
|
||||
user_store.put(identifier, json.dumps(ctrl.get('_TAG')), force=True)
|
||||
user_store.stick(identifier)
|
||||
|
||||
Reference in New Issue
Block a user