Update script and cli command

This commit is contained in:
IshaVenikar 2024-08-13 15:06:54 +05:30
parent 62ece58a96
commit f8934ebdfe
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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)