From f8934ebdfe3265d6770ca0f0cfe77b58d2afd1fa Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Tue, 13 Aug 2024 15:06:54 +0530 Subject: [PATCH] Update script and cli command --- cli/README.md | 2 +- cli/core.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/README.md b/cli/README.md index 6bd81fe..bdaee9b 100644 --- a/cli/README.md +++ b/cli/README.md @@ -21,7 +21,7 @@ ## Usage ```bash -laconic-testnet --onboarded-json path/to/onboarded-accounts.json --csv-input path/to/subscribers.csv --output path/to/subscribed-onboarded-accounts.csv +laconic-testnet --onboarded-json path/to/onboarded-accounts.json --subscribers-csv path/to/subscribers.csv --output path/to/subscribed-onboarded-accounts.csv ``` ## Cleanup diff --git a/cli/core.py b/cli/core.py index 5bd3647..8329c22 100644 --- a/cli/core.py +++ b/cli/core.py @@ -3,7 +3,7 @@ import hashlib import json def hash_subscriber_id(subscriber_id): - return hashlib.sha256(subscriber_id.encode()).hexdigest() + return '0x' + hashlib.sha256(subscriber_id.encode()).hexdigest() def process_subscribers(onboarded_json, subscribers_csv, output): # Load JSON data from the file @@ -30,7 +30,7 @@ def process_subscribers(onboarded_json, subscribers_csv, output): 'cosmos_address': participant['cosmos_address'], 'nitro_address': participant['nitro_address'], 'role': participant['role'], - 'kyc_id': participant['kyc_id'], + 'hashed_subscriber_id': participant['kyc_id'], 'status': subscriber['status'], 'premium': subscriber['premium?'], 'created_at': subscriber['created_at'] @@ -42,7 +42,7 @@ def process_subscribers(onboarded_json, subscribers_csv, output): # 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', 'kyc_id', 'status', 'premium', 'created_at'] + 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)