Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
077cfe12a6 | ||
|
|
8f750bf329 |
No files matched your search
@@ -1,6 +0,0 @@
|
|||||||
venv
|
|
||||||
laconic_testnet.egg-info
|
|
||||||
__pycache__
|
|
||||||
|
|
||||||
*-deployment
|
|
||||||
*-spec.yml
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
# cli
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
* Run commands in repo root directory
|
|
||||||
```bash
|
|
||||||
python3 -m venv venv
|
|
||||||
source ./venv/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
* Install CLI in editable mode
|
|
||||||
```bash
|
|
||||||
pip install --editable .
|
|
||||||
```
|
|
||||||
|
|
||||||
* Verify installation
|
|
||||||
```bash
|
|
||||||
laconic-testnet --help
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-testnet --onboarded-json path/to/onboarded-accounts.json --subscribers-csv path/to/subscribers.csv --output path/to/subscribed-onboarded-accounts.csv
|
|
||||||
```
|
|
||||||
|
|
||||||
## Cleanup
|
|
||||||
|
|
||||||
Deactivate virtual environment
|
|
||||||
```bash
|
|
||||||
deactivate
|
|
||||||
```
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
import click
|
|
||||||
from .core import process_subscribers
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.option('--onboarded-json', required=True, type=click.Path(exists=True), help='Path to onboarded accounts JSON file.')
|
|
||||||
@click.option('--subscribers-csv', required=True, type=click.Path(exists=True), help='Path to the subscribers CSV file.')
|
|
||||||
@click.option('--output', required=True, type=click.Path(), help='Path to the output CSV file.')
|
|
||||||
def main(onboarded_json, subscribers_csv, output):
|
|
||||||
"""
|
|
||||||
CLI tool to match subscriber data with participant data and generate a CSV.
|
|
||||||
"""
|
|
||||||
process_subscribers(onboarded_json, subscribers_csv, output)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
-50
@@ -1,50 +0,0 @@
|
|||||||
import csv
|
|
||||||
import hashlib
|
|
||||||
import json
|
|
||||||
|
|
||||||
def hash_subscriber_id(subscriber_id):
|
|
||||||
return '0x' + hashlib.sha256(subscriber_id.encode()).hexdigest()
|
|
||||||
|
|
||||||
def process_subscribers(onboarded_json, subscribers_csv, output):
|
|
||||||
# Load JSON data from the file
|
|
||||||
with open(onboarded_json, 'r') as json_file:
|
|
||||||
json_data = json.load(json_file)
|
|
||||||
|
|
||||||
# Create a dictionary mapping kyc_id to participant data
|
|
||||||
kyc_map = {participant['kyc_id']: participant for participant in json_data['participants']}
|
|
||||||
|
|
||||||
# Load subscribers data from the CSV file and process it using map
|
|
||||||
with open(subscribers_csv, 'r') as csv_file:
|
|
||||||
csv_reader = csv.DictReader(csv_file)
|
|
||||||
subscribers = list(csv_reader)
|
|
||||||
|
|
||||||
# Use map to process subscribers
|
|
||||||
def process_subscriber(subscriber):
|
|
||||||
hashed_subscriber_id = hash_subscriber_id(subscriber['subscriber_id'])
|
|
||||||
participant = kyc_map.get(hashed_subscriber_id)
|
|
||||||
|
|
||||||
if participant:
|
|
||||||
return {
|
|
||||||
'subscriber_id': subscriber['subscriber_id'],
|
|
||||||
'email': subscriber['email'],
|
|
||||||
'cosmos_address': participant['cosmos_address'],
|
|
||||||
'nitro_address': participant['nitro_address'],
|
|
||||||
'role': participant['role'],
|
|
||||||
'hashed_subscriber_id': participant['kyc_id'],
|
|
||||||
'status': subscriber['status'],
|
|
||||||
'premium': subscriber['premium?'],
|
|
||||||
'created_at': subscriber['created_at']
|
|
||||||
}
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Apply the map function and filter out None values
|
|
||||||
output_data = list(filter(None, map(process_subscriber, subscribers)))
|
|
||||||
|
|
||||||
# Write the matched data to a new CSV file
|
|
||||||
with open(output, 'w', newline='') as csv_file:
|
|
||||||
fieldnames = ['subscriber_id', 'email', 'cosmos_address', 'nitro_address', 'role', 'hashed_subscriber_id', 'status', 'premium', 'created_at']
|
|
||||||
csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
|
|
||||||
csv_writer.writeheader()
|
|
||||||
csv_writer.writerows(output_data)
|
|
||||||
|
|
||||||
print(f'Data has been written to {output}')
|
|
||||||
@@ -69,6 +69,34 @@ Once all the participants have completed their onboarding, stage0 laconicd chain
|
|||||||
cp ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd/output/genesis.json stage1-deployment/data/genesis-config/genesis.json
|
cp ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd/output/genesis.json stage1-deployment/data/genesis-config/genesis.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* Republish records in stage1:
|
||||||
|
|
||||||
|
* Create bond
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ALICE_PK=$(echo y | laconic-so deployment --dir /srv/laconicd/stage1-deployment exec laconicd "laconicd keys export alice --unarmored-hex --unsafe")
|
||||||
|
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry bond create --type alnt --quantity 1000000000000 --user-key $ALICE_PK" | jq -r '.bondId'
|
||||||
|
```
|
||||||
|
|
||||||
|
* Update CLI config
|
||||||
|
|
||||||
|
```bash
|
||||||
|
BOND_ID=c5ce12710a0ba7bf01f085a24b23dc78936e8d63ba3ce9d4b9d8f789e5b2f265
|
||||||
|
laconic-so deployment --dir laconic-console-deployment exec cli "CERC_LACONICD_USER_KEY=${ALICE_PK} CERC_LACONICD_BOND_ID=${BOND_ID} CERC_LACONICD_GAS=500000 CERC_LACONICD_FEES=500000alnt /app/create-config.sh"
|
||||||
|
```
|
||||||
|
|
||||||
|
* Copy records
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp -r /srv/laconicd/testnet-repo-records laconic-console-deployment/data/laconic-registry-data/testnet-repo-records
|
||||||
|
```
|
||||||
|
|
||||||
|
* Publish
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so deployment --dir laconic-console-deployment exec cli "yarn ts-node demo/scripts/publish-records.ts --config config.yml --records /laconic-registry-data/testnet-repo-records"
|
||||||
|
```
|
||||||
|
|
||||||
* Start the stage1 deployment:
|
* Start the stage1 deployment:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
Click
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
from setuptools import setup, find_packages
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name="laconic-testnet",
|
|
||||||
version="0.1.0",
|
|
||||||
packages=find_packages(),
|
|
||||||
install_requires=[
|
|
||||||
"Click",
|
|
||||||
],
|
|
||||||
entry_points={
|
|
||||||
'console_scripts': [
|
|
||||||
'laconic-testnet = cli.cli:main',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
registry:
|
registry:
|
||||||
rpcEndpoint: ${CERC_LACONICD_RPC_ENDPOINT}
|
rpcEndpoint: ${CERC_LACONICD_RPC_ENDPOINT}
|
||||||
gqlEndpoint: ${CERC_LACONICD_GQL_ENDPOINT}
|
gqlEndpoint: ${CERC_LACONICD_GQL_ENDPOINT}
|
||||||
userKey: ${CERC_LACONICD_USER_KEY}
|
userKey: "${CERC_LACONICD_USER_KEY}"
|
||||||
bondId: ${CERC_LACONICD_BOND_ID}
|
bondId: ${CERC_LACONICD_BOND_ID}
|
||||||
chainId: ${CERC_LACONICD_CHAIN_ID}
|
chainId: ${CERC_LACONICD_CHAIN_ID}
|
||||||
gas: ${CERC_LACONICD_GAS}
|
gas: ${CERC_LACONICD_GAS}
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ laconic-so deployment --dir laconic-console-deployment start
|
|||||||
# services:
|
# services:
|
||||||
# registry:
|
# registry:
|
||||||
# ...
|
# ...
|
||||||
# userKey: <your-private-key>
|
# userKey: "<your-private-key>"
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
# Note: any changes made to the config will be lost when the cli Docker container is brought down
|
# Note: any changes made to the config will be lost when the cli Docker container is brought down
|
||||||
|
|||||||
Reference in new issue
Block a user