Skip to content

Commit

Permalink
[Explorer]: Update blockchain explorers for Bitcoin and Nano (#3656)
Browse files Browse the repository at this point in the history
* [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
satoshiotomakan authored Jan 12, 2024
1 parent 8f8a266 commit 408ca6a
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 35 deletions.
30 changes: 15 additions & 15 deletions registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"publicKeyHasher": "sha256ripemd",
"base58Hasher": "sha256d",
"explorer": {
"url": "https://blockchair.com",
"txPath": "/bitcoin/transaction/",
"accountPath": "/bitcoin/address/",
"url": "https://mempool.space",
"txPath": "/tx/",
"accountPath": "/address/",
"sampleTx": "0607f62530b68cfcc91c57a1702841dd399a899d0eecda8e31ecca3f52f01df2",
"sampleAccount": "17A16QmavnUfCW11DAApiJxp7ARnxN5pGX"
},
Expand Down Expand Up @@ -1498,7 +1498,7 @@
"url": "https://blockchair.com/stellar",
"txPath": "/transaction/",
"accountPath": "/account/",
"sampleTx": "d9aeabfa9d24df8c5755125f8af243b74cd3ff878656cfa72c566a8824bf6e84",
"sampleTx": "8a7ff7261e8b3f31af7f6ed257c2e9fe7c47afcd9b1ce1be1bfc1bc5f6a3ad9e",
"sampleAccount": "GCILJZQ3CKBKBUJWW4TAM6Q37LJA5MQX6GMSFSQN75BPLWIZ33OPRG52"
},
"info": {
Expand Down Expand Up @@ -1559,9 +1559,9 @@
"publicKeyType": "ed25519Blake2b",
"url": "https://nano.org",
"explorer": {
"url": "https://nanocrawler.cc",
"txPath": "/explorer/block/",
"accountPath": "/explorer/account/",
"url": "https://www.nanolooker.com",
"txPath": "/block/",
"accountPath": "/account/",
"sampleTx": "C264DB7BF40738F0CEFF19B606746CB925B713E4B8699A055699E0DC8ABBC70F",
"sampleAccount": "nano_1wpj616kwhe1y38y1mspd8aub8i334cwybqco511iyuxm55zx8d67ptf1tsf"
},
Expand Down Expand Up @@ -2034,9 +2034,9 @@
"curve": "ed25519",
"publicKeyType": "ed25519",
"explorer": {
"url": "https://explorer.near.org",
"txPath": "/transactions/",
"accountPath": "/accounts/",
"url": "https://nearblocks.io",
"txPath": "/txns/",
"accountPath": "/address/",
"sampleTx": "FPQAMaVnvFHNwNBJWnTttXfdJhp5FvMGGDJEesB8gvbL",
"sampleAccount": "test-trust.vlad.near"
},
Expand Down Expand Up @@ -2297,11 +2297,11 @@
"hrp": "band",
"addressHasher": "sha256ripemd",
"explorer": {
"url": "https://scan-wenchang-testnet2.bandchain.org/",
"url": "https://www.mintscan.io/band",
"txPath": "/tx/",
"accountPath": "/account/",
"sampleTx": "473264551D3063A9EC64EC251C61BE92DDDFCF6CC46D026D1E574D83D5447173",
"sampleAccount": "band12nmsm9khdsv0tywge43q3zwj8kkj3hvup9rltp"
"sampleTx": "74AF38C2183B06EB6274DA4AAC0D2334E6E283643D436852F5E088AEA2CD0B17",
"sampleAccount": "band16gpgu994g2gdrzvwp9047le3pcq9wz6mcgtd4w"
},
"info": {
"url": "https://bandprotocol.com/",
Expand Down Expand Up @@ -2713,7 +2713,7 @@
"url": "https://oasisscan.com",
"txPath": "/transactions/",
"accountPath": "/accounts/detail/",
"sampleTx": "0b9bd4983f1c88a1c71bf33562b6ba02b3064e01697d15a0de4bfe1922ec74b8",
"sampleTx": "73dc977fdd8596d4a57e6feb891b21f5da3652d26815dc94f15f7420c298e29e",
"sampleAccount": "oasis1qrx376dmwuckmruzn9vq64n49clw72lywctvxdf4"
},
"info": {
Expand Down Expand Up @@ -4130,7 +4130,7 @@
"publicKeyType": "secp256k1Extended",
"addressHasher": "keccak256",
"explorer": {
"url": "https://www.oklink.com/en/okc",
"url": "https://www.oklink.com/oktc",
"txPath": "/tx/",
"accountPath": "/address/",
"sampleTx": "0x46C3A947E8248570FBD28E4FE456CC8F80DFD90716533878FB67857B95FA3D37",
Expand Down
2 changes: 1 addition & 1 deletion samples/kmp/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("com.trustwallet:wallet-core-kotlin:4.0.14")
implementation("com.trustwallet:wallet-core-kotlin:4.0.16")
}
}
val commonTest by getting {
Expand Down
4 changes: 2 additions & 2 deletions tests/chains/Bitcoin/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ TEST(TWBitcoinCoinType, TWCoinType) {
ASSERT_EQ(0x5, TWCoinTypeP2shPrefix(TWCoinTypeBitcoin));
ASSERT_EQ(0x0, TWCoinTypeStaticPrefix(TWCoinTypeBitcoin));
assertStringsEqual(symbol, "BTC");
assertStringsEqual(txUrl, "https://blockchair.com/bitcoin/transaction/0607f62530b68cfcc91c57a1702841dd399a899d0eecda8e31ecca3f52f01df2");
assertStringsEqual(accUrl, "https://blockchair.com/bitcoin/address/17A16QmavnUfCW11DAApiJxp7ARnxN5pGX");
assertStringsEqual(txUrl, "https://mempool.space/tx/0607f62530b68cfcc91c57a1702841dd399a899d0eecda8e31ecca3f52f01df2");
assertStringsEqual(accUrl, "https://mempool.space/address/17A16QmavnUfCW11DAApiJxp7ARnxN5pGX");
assertStringsEqual(id, "bitcoin");
assertStringsEqual(name, "Bitcoin");
}
8 changes: 4 additions & 4 deletions tests/chains/Cosmos/BandChain/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

TEST(TWBandChainCoinType, TWCoinType) {
auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(TWCoinTypeBandChain));
auto txId = WRAPS(TWStringCreateWithUTF8Bytes("473264551D3063A9EC64EC251C61BE92DDDFCF6CC46D026D1E574D83D5447173"));
auto txId = WRAPS(TWStringCreateWithUTF8Bytes("74AF38C2183B06EB6274DA4AAC0D2334E6E283643D436852F5E088AEA2CD0B17"));
auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(TWCoinTypeBandChain, txId.get()));
auto accId = WRAPS(TWStringCreateWithUTF8Bytes("band12nmsm9khdsv0tywge43q3zwj8kkj3hvup9rltp"));
auto accId = WRAPS(TWStringCreateWithUTF8Bytes("band16gpgu994g2gdrzvwp9047le3pcq9wz6mcgtd4w"));
auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(TWCoinTypeBandChain, accId.get()));
auto id = WRAPS(TWCoinTypeConfigurationGetID(TWCoinTypeBandChain));
auto name = WRAPS(TWCoinTypeConfigurationGetName(TWCoinTypeBandChain));
Expand All @@ -27,8 +27,8 @@ TEST(TWBandChainCoinType, TWCoinType) {
ASSERT_EQ(0x0, TWCoinTypeP2shPrefix(TWCoinTypeBandChain));
ASSERT_EQ(0x0, TWCoinTypeStaticPrefix(TWCoinTypeBandChain));
assertStringsEqual(symbol, "BAND");
assertStringsEqual(txUrl, "https://scan-wenchang-testnet2.bandchain.org//tx/473264551D3063A9EC64EC251C61BE92DDDFCF6CC46D026D1E574D83D5447173");
assertStringsEqual(accUrl, "https://scan-wenchang-testnet2.bandchain.org//account/band12nmsm9khdsv0tywge43q3zwj8kkj3hvup9rltp");
assertStringsEqual(txUrl, "https://www.mintscan.io/band/tx/74AF38C2183B06EB6274DA4AAC0D2334E6E283643D436852F5E088AEA2CD0B17");
assertStringsEqual(accUrl, "https://www.mintscan.io/band/account/band16gpgu994g2gdrzvwp9047le3pcq9wz6mcgtd4w");
assertStringsEqual(id, "band");
assertStringsEqual(name, "BandChain");
}
6 changes: 3 additions & 3 deletions tests/chains/NEAR/TWAnySignerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ TEST(TWAnySignerNEAR, SignStakeMainnetReplication) {
Proto::SigningOutput output;
ANY_SIGN(input, TWCoinTypeNEAR);

// https://explorer.near.org/transactions/kd7ajFw1CfXB8LiJXvhz5NDS7QpQXkuQraAbhb5MMMq
// https://nearblocks.io/txns/kd7ajFw1CfXB8LiJXvhz5NDS7QpQXkuQraAbhb5MMMq
ASSERT_EQ(Base58::encode(data(output.hash())), "kd7ajFw1CfXB8LiJXvhz5NDS7QpQXkuQraAbhb5MMMq");
ASSERT_EQ(Base64::encode(data(output.signed_transaction())), "QAAAAGI4ZDVkZjI1MDQ3ODQxMzY1MDA4ZjMwZmI2YjMwZGQ4MjBlOWE4NGQ4NjlmMDU2MjNkMTE0ZTk2ODMxZjJmYmYAzgCT6NK76nb1mB7pToefgkGUHfUe5BKvvr3gW/nq+MgEuu1Mq0YAABEAAABhdmFkby5wb29sdjEubmVhcueGgJlhJ7eg8/I0NQLkQvJDZsul95y3L4vG0N67Js4kAQAAAAIRAAAAZGVwb3NpdF9hbmRfc3Rha2UCAAAAe30A0JjUr3EAAAAAgPZK4ccCLRUAAAAAAAAALNrorr8qTL6u1nlxLpuPa45nFdYmjU96i7CmJP08mVHVzHUaw/bGN30Z3u3o1F2o2yefCBNqO9Ogn9fM25NGCg==");
}
Expand Down Expand Up @@ -122,7 +122,7 @@ TEST(TWAnySignerNEAR, SignUnstakeMainnetReplication) {
Proto::SigningOutput output;
ANY_SIGN(input, TWCoinTypeNEAR);

// https://explorer.near.org/transactions/DH6QAX3TkY6XtkteorvKBoGT5hA5ADkURZdzrbbKRs8P
// https://nearblocks.io/txns/DH6QAX3TkY6XtkteorvKBoGT5hA5ADkURZdzrbbKRs8P
ASSERT_EQ(Base58::encode(data(output.hash())), "DH6QAX3TkY6XtkteorvKBoGT5hA5ADkURZdzrbbKRs8P");
ASSERT_EQ(Base64::encode(data(output.signed_transaction())), "QAAAAGI4ZDVkZjI1MDQ3ODQxMzY1MDA4ZjMwZmI2YjMwZGQ4MjBlOWE4NGQ4NjlmMDU2MjNkMTE0ZTk2ODMxZjJmYmYAzgCT6NK76nb1mB7pToefgkGUHfUe5BKvvr3gW/nq+MgGuu1Mq0YAABEAAABhdmFkby5wb29sdjEubmVhcq0YnhRlt+TTtagkoy0qKn56zAfGhE+jkTJW6PR5k5r8AQAAAAILAAAAdW5zdGFrZV9hbGwCAAAAe30A0JjUr3EAAAAAAAAAAAAAAAAAAAAAAAAABaFP0EkfJU3VQZ4QAiTwq9ebWDJ7jx7TxbA+VGH4hwKX3gWnmDHVve+LK7/UbbffjF/y8vn0KrPxdh3ONAG0Ag==");
}
Expand All @@ -131,7 +131,7 @@ TEST(TWAnySignerNEAR, SignUnstakeMainnetReplication) {
/// https://nomicon.io/Standards/Tokens/FungibleToken/Core
///
/// Successfully broadcasted tx:
/// https://explorer.near.org/transactions/ABQY6nfLdNrRVynHYNjYkfUM6Up5pDHHpuhRJe6FCMRu
/// https://nearblocks.io/txns/ABQY6nfLdNrRVynHYNjYkfUM6Up5pDHHpuhRJe6FCMRu
TEST(TWAnySignerNEAR, SignTokenTransfer) {
auto privateKey = parse_hex("77006e227658c18da47546413926a26b839204b1b19e807c4a13d994d661c72e");

Expand Down
4 changes: 2 additions & 2 deletions tests/chains/NEAR/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ TEST(TWNEARCoinType, TWCoinType) {
ASSERT_EQ(0x0, TWCoinTypeP2shPrefix(TWCoinTypeNEAR));
ASSERT_EQ(0x0, TWCoinTypeStaticPrefix(TWCoinTypeNEAR));
assertStringsEqual(symbol, "NEAR");
assertStringsEqual(txUrl, "https://explorer.near.org/transactions/FPQAMaVnvFHNwNBJWnTttXfdJhp5FvMGGDJEesB8gvbL");
assertStringsEqual(accUrl, "https://explorer.near.org/accounts/test-trust.vlad.near");
assertStringsEqual(txUrl, "https://nearblocks.io/txns/FPQAMaVnvFHNwNBJWnTttXfdJhp5FvMGGDJEesB8gvbL");
assertStringsEqual(accUrl, "https://nearblocks.io/address/test-trust.vlad.near");
assertStringsEqual(id, "near");
assertStringsEqual(name, "NEAR");
}
4 changes: 2 additions & 2 deletions tests/chains/Nano/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ TEST(TWNanoCoinType, TWCoinType) {
ASSERT_EQ(0x0, TWCoinTypeP2shPrefix(TWCoinTypeNano));
ASSERT_EQ(0x0, TWCoinTypeStaticPrefix(TWCoinTypeNano));
assertStringsEqual(symbol, "XNO");
assertStringsEqual(txUrl, "https://nanocrawler.cc/explorer/block/C264DB7BF40738F0CEFF19B606746CB925B713E4B8699A055699E0DC8ABBC70F");
assertStringsEqual(accUrl, "https://nanocrawler.cc/explorer/account/nano_1wpj616kwhe1y38y1mspd8aub8i334cwybqco511iyuxm55zx8d67ptf1tsf");
assertStringsEqual(txUrl, "https://www.nanolooker.com/block/C264DB7BF40738F0CEFF19B606746CB925B713E4B8699A055699E0DC8ABBC70F");
assertStringsEqual(accUrl, "https://www.nanolooker.com/account/nano_1wpj616kwhe1y38y1mspd8aub8i334cwybqco511iyuxm55zx8d67ptf1tsf");
assertStringsEqual(id, "nano");
assertStringsEqual(name, "Nano");
}
4 changes: 2 additions & 2 deletions tests/chains/OKXChain/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ TEST(TWCoinTypeOKXChain, TWCoinType) {
ASSERT_EQ(0x0, TWCoinTypeP2shPrefix(TWCoinTypeOKXChain));
ASSERT_EQ(0x0, TWCoinTypeStaticPrefix(TWCoinTypeOKXChain));
assertStringsEqual(symbol, "OKT");
assertStringsEqual(txUrl, "https://www.oklink.com/en/okc/tx/0x46C3A947E8248570FBD28E4FE456CC8F80DFD90716533878FB67857B95FA3D37");
assertStringsEqual(accUrl, "https://www.oklink.com/en/okc/address/0x074faafd0b20fad2efa115b8ed7e75993e580b85");
assertStringsEqual(txUrl, "https://www.oklink.com/oktc/tx/0x46C3A947E8248570FBD28E4FE456CC8F80DFD90716533878FB67857B95FA3D37");
assertStringsEqual(accUrl, "https://www.oklink.com/oktc/address/0x074faafd0b20fad2efa115b8ed7e75993e580b85");
assertStringsEqual(id, "okc");
assertStringsEqual(name, "OKX Chain");
}
4 changes: 2 additions & 2 deletions tests/chains/Oasis/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

TEST(TWOasisCoinType, TWCoinType) {
auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(TWCoinTypeOasis));
auto txId = WRAPS(TWStringCreateWithUTF8Bytes("0b9bd4983f1c88a1c71bf33562b6ba02b3064e01697d15a0de4bfe1922ec74b8"));
auto txId = WRAPS(TWStringCreateWithUTF8Bytes("73dc977fdd8596d4a57e6feb891b21f5da3652d26815dc94f15f7420c298e29e"));
auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(TWCoinTypeOasis, txId.get()));
auto accId = WRAPS(TWStringCreateWithUTF8Bytes("oasis1qrx376dmwuckmruzn9vq64n49clw72lywctvxdf4"));
auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(TWCoinTypeOasis, accId.get()));
Expand All @@ -27,7 +27,7 @@ TEST(TWOasisCoinType, TWCoinType) {
ASSERT_EQ(0x0, TWCoinTypeP2shPrefix(TWCoinTypeOasis));
ASSERT_EQ(0x0, TWCoinTypeStaticPrefix(TWCoinTypeOasis));
assertStringsEqual(symbol, "ROSE");
assertStringsEqual(txUrl, "https://oasisscan.com/transactions/0b9bd4983f1c88a1c71bf33562b6ba02b3064e01697d15a0de4bfe1922ec74b8");
assertStringsEqual(txUrl, "https://oasisscan.com/transactions/73dc977fdd8596d4a57e6feb891b21f5da3652d26815dc94f15f7420c298e29e");
assertStringsEqual(accUrl, "https://oasisscan.com/accounts/detail/oasis1qrx376dmwuckmruzn9vq64n49clw72lywctvxdf4");
assertStringsEqual(id, "oasis");
assertStringsEqual(name, "Oasis");
Expand Down
4 changes: 2 additions & 2 deletions tests/chains/Stellar/TWCoinTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

TEST(TWStellarCoinType, TWCoinType) {
auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(TWCoinTypeStellar));
auto txId = WRAPS(TWStringCreateWithUTF8Bytes("d9aeabfa9d24df8c5755125f8af243b74cd3ff878656cfa72c566a8824bf6e84"));
auto txId = WRAPS(TWStringCreateWithUTF8Bytes("8a7ff7261e8b3f31af7f6ed257c2e9fe7c47afcd9b1ce1be1bfc1bc5f6a3ad9e"));
auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(TWCoinTypeStellar, txId.get()));
auto accId = WRAPS(TWStringCreateWithUTF8Bytes("GCILJZQ3CKBKBUJWW4TAM6Q37LJA5MQX6GMSFSQN75BPLWIZ33OPRG52"));
auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(TWCoinTypeStellar, accId.get()));
Expand All @@ -27,7 +27,7 @@ TEST(TWStellarCoinType, TWCoinType) {
ASSERT_EQ(0x0, TWCoinTypeP2shPrefix(TWCoinTypeStellar));
ASSERT_EQ(0x0, TWCoinTypeStaticPrefix(TWCoinTypeStellar));
assertStringsEqual(symbol, "XLM");
assertStringsEqual(txUrl, "https://blockchair.com/stellar/transaction/d9aeabfa9d24df8c5755125f8af243b74cd3ff878656cfa72c566a8824bf6e84");
assertStringsEqual(txUrl, "https://blockchair.com/stellar/transaction/8a7ff7261e8b3f31af7f6ed257c2e9fe7c47afcd9b1ce1be1bfc1bc5f6a3ad9e");
assertStringsEqual(accUrl, "https://blockchair.com/stellar/account/GCILJZQ3CKBKBUJWW4TAM6Q37LJA5MQX6GMSFSQN75BPLWIZ33OPRG52");
assertStringsEqual(id, "stellar");
assertStringsEqual(name, "Stellar");
Expand Down
46 changes: 46 additions & 0 deletions tools/registry
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)

0 comments on commit 408ca6a

Please sign in to comment.