Skip to content

Commit

Permalink
Merge pull request #329 from dbluhm/fix/indy-networks-base-url
Browse files Browse the repository at this point in the history
fix: point to hl indy-did-networks repo
  • Loading branch information
swcurran authored Sep 18, 2024
2 parents 7fc06f8 + ef54fbc commit 59c4318
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions wrappers/python/indy_vdr/utils.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import os
from typing import Dict, List
from typing import Dict, List, Optional
import urllib.request
import urllib.error


INDY_NETWORKS_GITHUB_RAW_BASE = (
"https://raw.githubusercontent.com/IDunion/indy-did-networks/main"
"https://raw.githubusercontent.com/hyperledger/indy-did-networks/main"
)
GENESIS_FILENAME = "pool_transactions_genesis.json"


def get_genesis_txns_from_did_indy_folder(
path: str, genesis_filename: str = None
path: str, genesis_filename: Optional[str] = None
) -> Dict[str, str]:
"""Retrieves mapping from local folder.
Expand Down Expand Up @@ -40,7 +41,7 @@ def get_genesis_txns_from_did_indy_folder(
sub_entries = os.listdir(os.path.join(path, entry))

for sub_entry in sub_entries:

sub_entry_p = os.path.join(entry_p, sub_entry)
sub_namespace = sub_entry if os.path.isdir(sub_entry_p) else None

Expand All @@ -57,12 +58,15 @@ def get_genesis_txns_from_did_indy_folder(


def get_genesis_txns_from_did_indy_repo_by_name(
namespaces: List[str], genesis_filename: str = None
namespaces: List[str], genesis_filename: Optional[str] = None,
*,
repo_base_url: Optional[str] = None,
) -> Dict[str, str]:
"""Retrieves genesis txn from standard indy networks repo given their names."""
genesis_map = dict()

genesis_filename = genesis_filename if genesis_filename else GENESIS_FILENAME
repo_base_url = repo_base_url or INDY_NETWORKS_GITHUB_RAW_BASE

base_dir = "networks"

Expand All @@ -73,7 +77,7 @@ def get_genesis_txns_from_did_indy_repo_by_name(
main = next(parts, None)
sub = next(parts, None)

genesis_file_url = f"{INDY_NETWORKS_GITHUB_RAW_BASE}/networks/{name}/{genesis_filename}"
genesis_file_url = f"{repo_base_url}/networks/{name}/{genesis_filename}"
target_local_path = f"{base_dir}/{name}/{genesis_filename}"
try:
urllib.request.urlretrieve(genesis_file_url, target_local_path)
Expand Down

0 comments on commit 59c4318

Please sign in to comment.