Compare commits
15 Commits
feat/csv_i
...
v0.3.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3361f90ae1 | ||
| 37188a60e8 | |||
|
|
fb1ebcf8cd | ||
| 38cfb18527 | |||
| c84517e3db | |||
| dcea763ce5 | |||
| e55b82f529 | |||
|
|
02df3f792e | ||
| d2e55fad0e | |||
|
|
edf312d969 | ||
| 5f22220825 | |||
|
|
067f354905 | ||
| f30076783d | |||
| 60e8ecc41a | |||
| 3c4a86010d |
27
CHANGELOG.md
27
CHANGELOG.md
@@ -2,6 +2,33 @@
|
|||||||
|
|
||||||
<!--next-version-placeholder-->
|
<!--next-version-placeholder-->
|
||||||
|
|
||||||
|
## v0.3.4 (2022-04-27)
|
||||||
|
### Fix
|
||||||
|
* Bump deps again ([`37188a6`](https://git.grassecon.net/cicnet/cic-cli/commit/37188a60e85d9545acfd950c1c160801c22d2b5b))
|
||||||
|
|
||||||
|
## v0.3.3 (2022-04-26)
|
||||||
|
### Fix
|
||||||
|
* It's ok if you already exsist ([`38cfb18`](https://git.grassecon.net/cicnet/cic-cli/commit/38cfb185270fb361ff5d9da9976745e1fecc40f8))
|
||||||
|
* Take the reins off ([`c84517e`](https://git.grassecon.net/cicnet/cic-cli/commit/c84517e3db264f541e6e5a8eef30703bf28d32d0))
|
||||||
|
* Bump deps ([`dcea763`](https://git.grassecon.net/cicnet/cic-cli/commit/dcea763ce5b3d542ed0a50586720fc3a45142e77))
|
||||||
|
* **attachement:** Directory not getting created ([`e55b82f`](https://git.grassecon.net/cicnet/cic-cli/commit/e55b82f5295397b3e4123297bc6b231ca251bc83))
|
||||||
|
|
||||||
|
## v0.3.2 (2022-04-26)
|
||||||
|
### Fix
|
||||||
|
* Update deps ([`d2e55fa`](https://git.grassecon.net/cicnet/cic-cli/commit/d2e55fad0efd13fa7a1de8ed8ab43e703a4aa046))
|
||||||
|
|
||||||
|
## v0.3.1 (2022-04-26)
|
||||||
|
### Fix
|
||||||
|
* Throw if directory exsists ([`5f22220`](https://git.grassecon.net/cicnet/cic-cli/commit/5f22220825f5c485550ca9a21a54598fbe3b3ba3))
|
||||||
|
|
||||||
|
## v0.3.0 (2022-04-26)
|
||||||
|
### Feature
|
||||||
|
* **wizard:** Add csv input flag ([`a9f97a9`](https://git.grassecon.net/cicnet/cic-cli/commit/a9f97a9a5c6908e4d51710e3b121764d2511c0ab))
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
* Tests ([`f300767`](https://git.grassecon.net/cicnet/cic-cli/commit/f30076783d5fc93d91d29e9343d62af4c0fdffaa))
|
||||||
|
* Bump ci ([`60e8ecc`](https://git.grassecon.net/cicnet/cic-cli/commit/60e8ecc41a472dbea25c36d869259c8161145002))
|
||||||
|
|
||||||
## v0.2.3 (2022-03-22)
|
## v0.2.3 (2022-03-22)
|
||||||
### Fix
|
### Fix
|
||||||
* Remove this ([`92794a2`](https://git.grassecon.net/cicnet/cic-cli/commit/92794a2e3b2fc5ace63f519bbe5b23c542afc853))
|
* Remove this ([`92794a2`](https://git.grassecon.net/cicnet/cic-cli/commit/92794a2e3b2fc5ace63f519bbe5b23c542afc853))
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = "0.2.3"
|
__version__ = "0.3.4"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
# standard import
|
# standard import
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
from chainlib.cli.config import Config
|
from chainlib.cli.config import Config
|
||||||
|
|
||||||
@@ -66,13 +66,17 @@ def execute(
|
|||||||
if wallet_keystore:
|
if wallet_keystore:
|
||||||
config.add(wallet_keystore, "WALLET_KEY_FILE", exists_ok=True)
|
config.add(wallet_keystore, "WALLET_KEY_FILE", exists_ok=True)
|
||||||
|
|
||||||
if not skip_gen:
|
if skip_gen:
|
||||||
|
contract = load_contract(directory)
|
||||||
|
else:
|
||||||
|
if os.path.exists(directory):
|
||||||
|
raise Exception(f"Directory {directory} already exists")
|
||||||
if csv_file:
|
if csv_file:
|
||||||
|
print(f"Generating from csv:{csv_file} to {directory}")
|
||||||
contract = load_contract_from_csv(config, directory, csv_file)
|
contract = load_contract_from_csv(config, directory, csv_file)
|
||||||
else:
|
else:
|
||||||
|
print("Using Interactive Mode")
|
||||||
contract = generate_contract(directory, [target], config, interactive=True)
|
contract = generate_contract(directory, [target], config, interactive=True)
|
||||||
else:
|
|
||||||
contract = load_contract(directory)
|
|
||||||
|
|
||||||
print(contract)
|
print(contract)
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ class Attachment(Data):
|
|||||||
self.path = path
|
self.path = path
|
||||||
self.writer = writer
|
self.writer = writer
|
||||||
self.attachment_path = os.path.join(self.path, "attachments")
|
self.attachment_path = os.path.join(self.path, "attachments")
|
||||||
|
self.start()
|
||||||
if interactive:
|
if interactive:
|
||||||
self.start()
|
|
||||||
input(
|
input(
|
||||||
f"Please add attachment files to '{os.path.abspath(os.path.join(self.path,'attachments'))}' and then press ENTER to continue"
|
f"Please add attachment files to '{os.path.abspath(os.path.join(self.path,'attachments'))}' and then press ENTER to continue"
|
||||||
)
|
)
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
"""Loads attachment data from settings."""
|
"""Loads attachment data from settings."""
|
||||||
@@ -45,7 +45,7 @@ class Attachment(Data):
|
|||||||
def start(self):
|
def start(self):
|
||||||
"""Initialize attachment settings from template."""
|
"""Initialize attachment settings from template."""
|
||||||
super(Attachment, self).start()
|
super(Attachment, self).start()
|
||||||
os.makedirs(self.attachment_path)
|
os.makedirs(self.attachment_path, exist_ok=True)
|
||||||
|
|
||||||
def get(self, k):
|
def get(self, k):
|
||||||
"""Get a single attachment by the sha256 hash of the content.
|
"""Get a single attachment by the sha256 hash of the content.
|
||||||
|
|||||||
@@ -4,13 +4,8 @@ import logging
|
|||||||
import os
|
import os
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
# external imports
|
|
||||||
from cic_types.ext.metadata import MetadataRequestsHandler
|
|
||||||
from cic_types.ext.metadata.signer import Signer as MetadataSigner
|
|
||||||
from chainlib.chain import ChainSpec
|
from chainlib.chain import ChainSpec
|
||||||
from chainlib.cli.config import Config
|
from chainlib.cli.config import Config
|
||||||
|
|
||||||
# Local Modules
|
# Local Modules
|
||||||
from cic.contract.components.attachment import Attachment
|
from cic.contract.components.attachment import Attachment
|
||||||
from cic.contract.components.meta import Meta
|
from cic.contract.components.meta import Meta
|
||||||
@@ -20,8 +15,9 @@ from cic.contract.helpers import init_writers_from_config
|
|||||||
from cic.contract.network import Network
|
from cic.contract.network import Network
|
||||||
from cic.contract.processor import ContractProcessor
|
from cic.contract.processor import ContractProcessor
|
||||||
from cic.writers import HTTPWriter, KeyedWriterFactory, MetadataWriter
|
from cic.writers import HTTPWriter, KeyedWriterFactory, MetadataWriter
|
||||||
|
# external imports
|
||||||
|
from cic_types.ext.metadata import MetadataRequestsHandler
|
||||||
|
from cic_types.ext.metadata.signer import Signer as MetadataSigner
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -74,16 +70,6 @@ def load_contract(directory) -> Contract:
|
|||||||
def generate_contract(
|
def generate_contract(
|
||||||
directory: str, targets: List[str], config, interactive=True
|
directory: str, targets: List[str], config, interactive=True
|
||||||
) -> Contract:
|
) -> Contract:
|
||||||
if os.path.exists(directory):
|
|
||||||
contine = input(
|
|
||||||
f"Directory {directory} already exists, Would you like to delete it? (y/n): "
|
|
||||||
)
|
|
||||||
if contine.lower() != "y":
|
|
||||||
log.debug("Trying to load existing contract")
|
|
||||||
return load_contract(directory)
|
|
||||||
else:
|
|
||||||
print(f"Deleted {directory}")
|
|
||||||
os.system(f"rm -rf {directory}")
|
|
||||||
os.makedirs(directory)
|
os.makedirs(directory)
|
||||||
log.info("Generating token")
|
log.info("Generating token")
|
||||||
token = Token(directory, interactive=interactive)
|
token = Token(directory, interactive=interactive)
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ def object_to_str(obj, keys):
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
value = eval("obj." + key)
|
value = eval("obj." + key)
|
||||||
key = key.replace("()", "")
|
key = key.replace("()", "")
|
||||||
if type(value) == str:
|
if isinstance(value, str):
|
||||||
s += f"{key} = {value}\n"
|
s += f"{key} = {value}\n"
|
||||||
elif type(value) == list:
|
elif isinstance(value, list):
|
||||||
for idx, vv in enumerate(value):
|
for idx, vv in enumerate(value):
|
||||||
if not vv:
|
if not vv:
|
||||||
s += f"{key}[{idx}] = \n"
|
s += f"{key}[{idx}] = \n"
|
||||||
continue
|
continue
|
||||||
s += f"{key}[{idx}] = {vv}\n"
|
s += f"{key}[{idx}] = {vv}\n"
|
||||||
elif type(value) == dict:
|
elif isinstance(value, dict):
|
||||||
for vv_key in value.keys():
|
for vv_key in value.keys():
|
||||||
vv_value = value[vv_key]
|
vv_value = value[vv_key]
|
||||||
if not vv_value:
|
if not vv_value:
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class StdoutWriter(OutputWriter):
|
|||||||
|
|
||||||
|
|
||||||
class KVWriter(OutputWriter):
|
class KVWriter(OutputWriter):
|
||||||
def __init__(self, *args, path=None, **kwargs):
|
def __init__(self, path=None, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
os.stat(path)
|
os.stat(path)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
@@ -42,7 +42,7 @@ class KVWriter(OutputWriter):
|
|||||||
|
|
||||||
|
|
||||||
class HTTPWriter(OutputWriter):
|
class HTTPWriter(OutputWriter):
|
||||||
def __init__(self, *args, path=None, **kwargs):
|
def __init__(self, path=None, *args, **kwargs):
|
||||||
super(HTTPWriter, self).__init__(*args, **kwargs)
|
super(HTTPWriter, self).__init__(*args, **kwargs)
|
||||||
self.path = path
|
self.path = path
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ class KeyedWriterFactory:
|
|||||||
logg.debug(f"adding key {k} t keyed writer factory")
|
logg.debug(f"adding key {k} t keyed writer factory")
|
||||||
self.x[k] = v
|
self.x[k] = v
|
||||||
|
|
||||||
def new(self, *_args, path=None, **_kwargs):
|
def new(self, path=None, *_args, **_kwargs):
|
||||||
writer_keyed = None
|
writer_keyed = None
|
||||||
writer_immutable = None
|
writer_immutable = None
|
||||||
if self.key_writer_constructor is not None:
|
if self.key_writer_constructor is not None:
|
||||||
|
|||||||
611
poetry.lock
generated
611
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "cic-cli"
|
name = "cic-cli"
|
||||||
version = "0.2.3"
|
version = "0.3.4"
|
||||||
description = "Generic cli tooling for the CIC token network"
|
description = "Generic cli tooling for the CIC token network"
|
||||||
authors = [
|
authors = [
|
||||||
"Louis Holbrook <dev@holbrook.no>",
|
"Louis Holbrook <dev@holbrook.no>",
|
||||||
@@ -41,18 +41,18 @@ secondary = true
|
|||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.8"
|
python = "^3.8"
|
||||||
funga-eth = "~0.5.5"
|
funga-eth = "^0.6.0"
|
||||||
cic-types = "~0.2.1a8"
|
cic-types = "^0.2.2"
|
||||||
confini = "~0.5.3"
|
confini = "^0.6.0"
|
||||||
chainlib = "~0.0.17"
|
chainlib = "~0.1.0"
|
||||||
cbor2 = "5.4.1"
|
cbor2 = "~5.4.1"
|
||||||
|
|
||||||
chainlib-eth = { version = "~0.0.25", optional = true }
|
chainlib-eth = { version = "~0.1.1", optional = true }
|
||||||
eth-token-index = { version = "~0.2.4", optional = true }
|
eth-token-index = { version = "^0.3.0", optional = true }
|
||||||
eth-address-index = { version = "~0.2.4", optional = true }
|
eth-address-index = { version = "~0.5.0", optional = true }
|
||||||
okota = { version = "~0.2.5", optional = true }
|
okota = { version = "^0.4.0", optional = true }
|
||||||
cic_eth_registry = { version = "~0.6.6", optional = true }
|
cic-eth-registry = { version = "^0.6.9", optional = true }
|
||||||
cic_contracts = { version = "~0.0.5", optional = true }
|
cic-contracts = { version = "~0.1.0", optional = true }
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
@@ -61,7 +61,6 @@ pytest-cov = "2.10.1"
|
|||||||
python-semantic-release = "^7.25.2"
|
python-semantic-release = "^7.25.2"
|
||||||
pylint = "^2.12.2"
|
pylint = "^2.12.2"
|
||||||
black = { version = "^22.1.0", allow-prereleases = true }
|
black = { version = "^22.1.0", allow-prereleases = true }
|
||||||
eth-erc20 = ">0.1.2a3,<0.2.0"
|
|
||||||
eth_tester = "0.5.0b3"
|
eth_tester = "0.5.0b3"
|
||||||
py-evm = "0.3.0a20"
|
py-evm = "0.3.0a20"
|
||||||
rlp = "2.0.1"
|
rlp = "2.0.1"
|
||||||
|
|||||||
@@ -4,15 +4,14 @@ import random
|
|||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from cic.contract.components.attachment import Attachment
|
# external imports
|
||||||
from cic.contract.components.proof import Proof
|
from hexathon import add_0x
|
||||||
from cic.contract.processor import ContractProcessor
|
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic.writers import KVWriter
|
from cic.writers import KVWriter
|
||||||
|
from cic.contract.components.attachment import Attachment
|
||||||
# external imports
|
from cic.contract.components.proof import Proof
|
||||||
from hexathon import add_0x
|
from cic.contract.processor import ContractProcessor
|
||||||
|
|
||||||
test_base_dir = os.path.dirname(os.path.realpath(__file__))
|
test_base_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
test_data_dir = os.path.join(test_base_dir, "testdata")
|
test_data_dir = os.path.join(test_base_dir, "testdata")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from cic.keystore import KeystoreDirectory
|
|||||||
# test imports
|
# test imports
|
||||||
from tests.base_cic import test_base_dir
|
from tests.base_cic import test_base_dir
|
||||||
|
|
||||||
logging = logging.getLogger()
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
script_dir = test_base_dir
|
script_dir = test_base_dir
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user