Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: point to hl indy-did-networks repo #329

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading