13 Commits

Author SHA1 Message Date
semantic-release
6f04de8d7e 0.2.2
All checks were successful
continuous-integration/drone/push Build is passing
Automatically generated by python-semantic-release
2022-03-22 07:16:17 +00:00
71bf1e15c4 fix: enfore upper case symbol name
All checks were successful
continuous-integration/drone/push Build is passing
2022-03-22 10:14:36 +03:00
32ba29354a docs: update bange urls
All checks were successful
continuous-integration/drone/push Build is passing
2022-03-16 11:55:13 +03:00
semantic-release
fb818a529c 0.2.1
All checks were successful
continuous-integration/drone/push Build is passing
Automatically generated by python-semantic-release
2022-03-16 08:23:27 +00:00
f7d0503c7b fix: update config paths
All checks were successful
continuous-integration/drone/push Build is passing
2022-03-16 11:21:48 +03:00
semantic-release
a862a73d7c 0.2.0
All checks were successful
continuous-integration/drone/push Build is passing
Automatically generated by python-semantic-release
2022-03-16 08:06:11 +00:00
f4e370cb5d feat: copy base configs to user configs
All checks were successful
continuous-integration/drone/push Build is passing
2022-03-16 11:04:38 +03:00
semantic-release
69bbbd7c8b 0.1.1
All checks were successful
continuous-integration/drone/push Build is passing
Automatically generated by python-semantic-release
2022-03-16 07:57:00 +00:00
b51d1e92d7 fix: update configs
All checks were successful
continuous-integration/drone/push Build is passing
2022-03-16 10:55:25 +03:00
semantic-release
b77f572b82 0.1.0
All checks were successful
continuous-integration/drone/push Build is passing
Automatically generated by python-semantic-release
2022-03-16 06:22:39 +00:00
c832763240 ci: fix semantic release branch
All checks were successful
continuous-integration/drone/push Build is passing
2022-03-16 09:20:55 +03:00
941b9e6b65 docs: add cluter deployment info
Some checks failed
continuous-integration/drone/push Build is failing
2022-03-16 09:18:29 +03:00
0fcf2eb3bc feat: add interactive deployment and switch to poetry' (#2)
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #2
2022-03-16 05:37:48 +00:00
12 changed files with 109 additions and 28 deletions

View File

@@ -1,4 +0,0 @@
- 0.0.2
* Add executable entry point in package install
- 0.0.1
* Token creation setup for eth

41
CHANGELOG.md Normal file
View File

@@ -0,0 +1,41 @@
# Changelog
<!--next-version-placeholder-->
## v0.2.2 (2022-03-22)
### Fix
* Enfore upper case symbol name ([`71bf1e1`](https://git.grassecon.net/cicnet/cic-cli/commit/71bf1e15c4a217111ae6f6568814985a9d5b960f))
### Documentation
* Update bange urls ([`32ba293`](https://git.grassecon.net/cicnet/cic-cli/commit/32ba29354ae53bf8166bef4d117667aa314a6cfe))
## v0.2.1 (2022-03-16)
### Fix
* Update config paths ([`f7d0503`](https://git.grassecon.net/cicnet/cic-cli/commit/f7d0503c7b85d96588bf1a75fdf1cce27acf1460))
## v0.2.0 (2022-03-16)
### Feature
* Copy base configs to user configs ([`f4e370c`](https://git.grassecon.net/cicnet/cic-cli/commit/f4e370cb5db79c74abe26179f5b15bd079bdd066))
## v0.1.1 (2022-03-16)
### Fix
* Update configs ([`b51d1e9`](https://git.grassecon.net/cicnet/cic-cli/commit/b51d1e92d7ae1e3b91ca50c036ffd58e762df24b))
## v0.1.0 (2022-03-16)
### Feature
* Add interactive deployment and switch to poetry' ([#2](https://git.grassecon.net/cicnet/cic-cli/issues/2)) ([`0fcf2eb`](https://git.grassecon.net/cicnet/cic-cli/commit/0fcf2eb3bc807111db02e9e47e469ec0a965797f))
* **wizard:** Add ability to select wallet address ([`556366a`](https://git.grassecon.net/cicnet/cic-cli/commit/556366a93384bba51aa617d54bcf50f4473b790a))
* Add token symbol proof metadata references ([`a707f12`](https://git.grassecon.net/cicnet/cic-cli/commit/a707f120865186c8e4a7840d53c9dcf5f4257ab3))
### Fix
* Add getpass ([`47a9b25`](https://git.grassecon.net/cicnet/cic-cli/commit/47a9b259ae54c34df9af4aa1fb176070d305296a))
* Incorrect var name ([`41dbd5a`](https://git.grassecon.net/cicnet/cic-cli/commit/41dbd5a400287d4687d0830017466b9a43054ecf))
* **ext:** Allow loading chain_spec from config ([`1d4b051`](https://git.grassecon.net/cicnet/cic-cli/commit/1d4b0512ad65b4d2903bd7d022e562cda158a592))
* Change name to cic-cli ([`40e386d`](https://git.grassecon.net/cicnet/cic-cli/commit/40e386db1175839394f2480a1a3e1bbfc52edea9))
* Add missing json import ([`48ee805`](https://git.grassecon.net/cicnet/cic-cli/commit/48ee8050c17edb21b0dc4065bf0018b1502d4a8c))
* Broken imports ([`4f219e3`](https://git.grassecon.net/cicnet/cic-cli/commit/4f219e3d1853befa197f46a19dc8a8a76ef26811))
### Documentation
* Add cluter deployment info ([`941b9e6`](https://git.grassecon.net/cicnet/cic-cli/commit/941b9e6b650163c4f35e4b08203fb10c9309ee91))
* Rename prod config to testnet ([`67f947a`](https://git.grassecon.net/cicnet/cic-cli/commit/67f947a9af16dc01fb68459a51629320264d281f))
* Add badge ([`be5d988`](https://git.grassecon.net/cicnet/cic-cli/commit/be5d988fa4d03dfcd44f71c7c6d4a562b780da09))

View File

@@ -1,28 +1,23 @@
# CIC Token Deployment Tool
[![Status](https://ci.grassecon.net/api/badges/grassrootseconomics/cic/status.svg?ref=refs/heads/master)](https://ci.grassecon.net/grassrootseconomics/cic)
[![Version](https://img.shields.io/pypi/v/cic?color=green)](https://pypi.org/project/cic/)
[![Status](https://ci.grassecon.net/api/badges/cicnet/cic-cli/status.svg)](https://ci.grassecon.net/grassrootseconomics/cic)
[![Version](https://img.shields.io/pypi/v/cic-cli?color=green)](https://pypi.org/project/cic/)
CIC-CLI provides tooling to generate and publish metadata in relation to
token deployments.
```shell
pip install --extra-index-url https://pip.grassrootseconomics.net cic[eth]
pip install cic-cli[eth]
```
## Setup
### Importing a wallet from metamask
- Export the accounts private key [Instructions](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key)
- Save the private key to a file
- Run `eth-keyfile -k <file> > ~/.config/cic/keystore/keyfile.json`
## Usage
### Using the wizard
First make sure that you edit the configs below to add your paths for `[auth]keyfile_path` and `[wallet]keyfile`
The configs are located in `~/.config/cic/cli/config/`
```
# Local
cic wizard ./somewhere -c ./config/docker
cic wizard ./somewhere -c ~/.config/cic/cli/config/docker
# Test Net
cic wizard ./somewhere -c ./config/testnet
cic wizard ./somewhere -c ~/.config/cic/cli/config/testnet
```
### Modular
Some of the concepts described below assume familiarity with base
@@ -52,7 +47,8 @@ below are limited to the context of the EVM.
## Development
### Requirements
- [poetry](https://python-poetry.org/docs/#installation)
- Install [poetry](https://python-poetry.org/docs/#installation)
### Setup
```
@@ -68,7 +64,36 @@ below are limited to the context of the EVM.
```bash
poetry run cic wizard ./somewhere -c ./config/docker
```
### Importing a wallet from metamask
- Export the accounts private key [Instructions](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key)
- Save the private key to a file
- Run `eth-keyfile -k <file> > ~/.config/cic/keystore/keyfile.json`
### Port Forwarding
<details>
<summary>Install Kubectl</summary>
```bash
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
```
</details>
- Download testnet cluster config from https://cloud.digitalocean.com/kubernetes/clusters
- Move the config to `$HOME/.kube/`
- Run `kubectl -n grassroots --kubeconfig=$HOME/.kube/<config_file_name>.yaml get pods`
- Copy the name of the meta pod (e.g `cic-meta-server-67dc7c6468-8rhdq`)
- Port foward the meta pod to the local machine using `kubectl port-forward pods/<name_of_meta_pod> 6700:8000 -n grassroots --kubeconfig=$HOME/.kube/<config_file_name>.yaml`
- Clone this repository to your local machine
- Run `poetry install -E eth` in the repo root
- Open `./cic/config/testnet/config.ini` and change
- [auth]keyfile_path
- [wallet]key_file
- Open a new terminal and run `poetry run cic wizard -c ./cic/config/testnet ./somewhere`
### Tests
```

View File

@@ -1 +1 @@
__version__ = "0.0.2"
__version__ = "0.2.2"

15
cic/config.py Normal file
View File

@@ -0,0 +1,15 @@
import os
import shutil
default_module_configs = os.path.join(os.path.dirname(os.path.realpath(__file__)), '.', 'configs')
def ensure_base_configs(config_dir: str):
"""
Ensure that the base configs are present.
"""
if not os.path.exists(config_dir):
os.makedirs(config_dir)
for f in os.listdir(default_module_configs):
if not os.path.exists(os.path.join(config_dir, f)):
shutil.copytree(os.path.join(default_module_configs, f), os.path.join(config_dir, f))

View File

@@ -8,11 +8,11 @@ ext_writer = cic.writers.KVWriter
registry_address = 0x999487d8B1EC2b2ac9F4a9D1A6D35a24D75D7EF4
[meta]
url = https://meta.grassecon.net
url = https://meta.grassecon.org
http_origin =
[rpc]
provider = https://rpc.kitabu.grassecon.net
provider = https://rpc.kitabu.grassecon.org
[auth]
type = gnupg

View File

@@ -8,7 +8,7 @@ ext_writer = cic.writers.KVWriter
registry_address = 0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299
[meta]
url = http://localhost:6700
url = https://meta.grassecon.net
http_origin =
[rpc]

View File

@@ -40,7 +40,7 @@ class Token(Data):
):
super(Token, self).__init__()
self.name = name
self.symbol = symbol
self.symbol = symbol.upper()
self.supply = supply
self.precision = precision
self.code = code
@@ -57,6 +57,7 @@ class Token(Data):
self.name = input(f"Enter Token Name ({self.name}): ") or self.name
self.symbol = input(f"Enter Token Symbol ({self.symbol}): ") or self.symbol
self.symbol = this.symbol.upper()
self.precision = input(f"Enter Token Precision ({self.precision}): ") or self.precision
self.supply = input(f"Enter Token Supply ({self.supply}): ") or self.supply
@@ -68,7 +69,7 @@ class Token(Data):
o = json.load(f)
self.name = o["name"]
self.symbol = o["symbol"]
self.symbol = o["symbol"].upper()
self.precision = o["precision"]
self.code = o["code"]
self.supply = o["supply"]
@@ -100,7 +101,7 @@ class Token(Data):
with open(token_template_file_path, encoding="utf-8") as f:
o = json.load(f)
o["name"] = self.name
o["symbol"] = self.symbol
o["symbol"] = self.symbol.upper()
o["precision"] = self.precision
o["code"] = self.code
o["supply"] = self.supply
@@ -115,7 +116,7 @@ class Token(Data):
def __str__(self):
s = f"name = {self.name}\n"
s += f"symbol = {self.symbol}\n"
s += f"symbol = {self.symbol.upper()}\n"
s += f"precision = {self.precision}\n"
s += f"supply = {self.supply}\n"
for idx, extra in enumerate(self.extra_args):

View File

@@ -13,6 +13,7 @@ import cic.cmd.show as cmd_show
import cic.cmd.ext as cmd_ext
import cic.cmd.export as cmd_export
import cic.cmd.wizard as cmd_wizard
from cic.config import ensure_base_configs
logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger()
@@ -21,6 +22,7 @@ script_dir = os.path.dirname(os.path.realpath(__file__))
data_dir = os.path.join(script_dir, '..', 'data')
base_config_dir = os.path.join(data_dir, 'config')
schema_dir = os.path.join(script_dir, '..', 'schema')
user_config_dir = os.path.join(os.path.expanduser("~"), ".config", "cic", "cli", "config")
arg_flags = chainlib.cli.argflag_std_read | chainlib.cli.Flag.SEQ
argparser = chainlib.cli.ArgumentParser(
@@ -62,6 +64,7 @@ cmd_mod = importlib.import_module(modname)
extra_args = {
'p': 'RPC_PROVIDER',
}
ensure_base_configs(user_config_dir)
config = chainlib.cli.Config.from_args(args, arg_flags=arg_flags, base_config_dir=base_config_dir, extra_args=extra_args)

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "cic-cli"
version = "0.0.2"
version = "0.2.2"
description = "Generic cli tooling for the CIC token network"
authors = [
"Louis Holbrook <dev@holbrook.no>",
@@ -48,7 +48,7 @@ chainlib = "~0.0.17"
cbor2 = "5.4.1"
chainlib-eth = { version = "~0.0.25", optional = true }
eth-token-index = { version = "0.2.4", optional = true }
eth-token-index = { version = "~0.2.4", optional = true }
eth-address-index = { version = "~0.2.4", optional = true }
okota = { version = "~0.2.5", optional = true }
cic_eth_registry = { version = "~0.6.6", optional = true }
@@ -87,7 +87,7 @@ testpaths = ["tests"]
[tool.semantic_release]
version_variable = ["cic/__init__.py:__version__", "pyproject.toml:version"]
version_source = "commit"
branch = "main"
branch = "master"
upload_to_repository = true
upload_to_release = true
build_command = "pip install poetry && poetry build"