-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Explorer]: Update blockchain explorers for Bitcoin and Nano (#3656)
* [Nano]: Update block explorer for Nano * [Bitcoin]: Update block explorer * [Nano]: Fix `txPath` and `accountPath` * [KMP]: Fix KMP CI * [NEAR]: Update blockchain explorer * [Misc]: Add a Python script to validate `registry.json` * Fix sampleTx and Explorer URL for `BandChain`, `Oasis`, `OKXChain`, `Stellar`
- Loading branch information
1 parent
8f8a266
commit 408ca6a
Showing
11 changed files
with
81 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import json | ||
import sys | ||
import requests | ||
|
||
PATH_TO_REGISTRY_JSON = "registry.json" | ||
|
||
|
||
def ping_url(url): | ||
response = requests.get(url) | ||
if response.status_code != 200: | ||
raise Exception(str(response.status_code)) | ||
|
||
|
||
def ping_explorers(_args): | ||
"""Pings blockchain explorers inside 'registry.json'""" | ||
registry_file = open(PATH_TO_REGISTRY_JSON, 'r') | ||
registry_json = json.load(registry_file) | ||
|
||
for chain_json in registry_json: | ||
explorer_json = chain_json["explorer"] | ||
sample_url = explorer_json["url"] | ||
|
||
# Not all chains have `sampleTx` parameter. | ||
if "sampleTx" in explorer_json: | ||
sample_url += explorer_json["txPath"] + explorer_json["sampleTx"] | ||
|
||
try: | ||
ping_url(sample_url) | ||
except Exception as exception: | ||
print(chain_json["name"], ":", sample_url, " NOT WORKING") | ||
print("\tError: ", exception) | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description="Operations over registry.json") | ||
subparsers = parser.add_subparsers() | ||
|
||
ping_explorers_parser = subparsers.add_parser('ping-explorers', | ||
help="Ping blockchain explorers inside 'registry.json'") | ||
ping_explorers_parser.set_defaults(func=ping_explorers) | ||
|
||
args = parser.parse_args() | ||
args.func(args) |