Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 77c853f

Browse files
authored
VG-7268 Tezos explorer migration (#884)
* VG-737 Fix crash on base58 decode with empty string * Add new TezosLikeBlockchainExplorer & implemet getCurrentBlock * Implement getTransactions * Implement getBalance * Implement isFunded * update tezos node url * fix parsing blocks * remove unused call to getGasPrice * make tests use tzstats * fix missing block level * fix delegate transactions displayed as undelegate * implement getFees & test * remove unused getGasPrice * update isDelegate * remove unused getTokenBalance * fix clang format * fix http client post headers * update http cache * fix some clang tidy warnings * use clang tidy config in github action * exclude generated files from clang tidy review & disable complexity check for existing over-complex function * fix clang tidy * disable clang tidy complexity for existing code * fix clang tidy * fix clang format * use nlohmann_json as submodule to fix nix builds * fix circleci * add helping log * simplify usage of new json parser fix new parser logic & some review comments * fix pagination on synchronisation * fix for macos * clang format * Minor changes for code review comments * refactor common logic * better json parsing for BigInt * constify HttpClient.hpp * clang format * fix clang tidy * move function body to cpp file
1 parent e38c333 commit 77c853f

File tree

68 files changed

+1297
-797
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1297
-797
lines changed

.circleci/init_submodules.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ git submodule update -- toolchains/polly || echo "===========Polly submodule alr
1919
git submodule update -- core/lib/spdlog || echo "===========spdlog submodule already updated"
2020
git submodule update -- core/lib/ethash || echo "===========ethash submodule already updated"
2121
git submodule update -- core/lib/fmt || echo "===========fmt submodule already updated"
22+
git submodule update -- core/lib/nlohmann_json || echo "===========nlohmann_json submodule already updated"
2223
git submodule update -- core/test/lib/googletest || echo "===========googletest submodule already updated"
2324
git submodule update -- core/lib/CRCpp || echo "===========CRCpp submodule already updated"
2425
git submodule update -- core/test/lib/libuv || echo "===========libuv submodule already updated"

.clang-tidy

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dumped from custom clion config
2+
# --> https://gist.github.com/ArnaudValensi/0d36639fb84b80ee57d0c3c977deb70e
3+
---
4+
Checks: >
5+
-*,bugprone-*,
6+
cert-dcl21-cpp,cert-dcl50-cpp,cert-env33-c,cert-err34-c,cert-err52-cpp,cert-flp30-c,cert-msc50-cpp,cert-msc51-cpp,
7+
cppcoreguidelines-*,-cppcoreguidelines-macro-usage,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-owning-memory,
8+
google-build-using-namespace,google-explicit-constructor,google-global-names-in-headers,google-readability-casting,google-runtime-int,google-runtime-operator,
9+
hicpp-*,-hicpp-vararg,
10+
misc-*,-misc-throw-by-value-catch-by-reference,
11+
modernize-*,-modernize-use-trailing-return-type,
12+
performance-*,
13+
readability-*,-readability-named-parameter,-readability-identifier-length,-readability-implicit-bool-conversion,-readability-convert-member-functions-to-static,-readability-magic-numbers
14+
CheckOptions:
15+
- key: bugprone-argument-comment.StrictMode
16+
value: 1
17+
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
18+
value: 1
19+
...
20+

.github/workflows/clang-tidty-review.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
apt_packages: libssl-dev
2020
# Googletest triggers a _lot_ of clang-tidy warnings, so ignore all
2121
# the unit tests until they're fixed or ignored upstream
22-
exclude: "core/test/*"
22+
exclude: "core/test/*,core/lib/*,core/test/lib/*,core/src/api/*,core/src/jni/*"
23+
config_file: '.clang-tidy'
2324
# CMake command to run in order to generate compile_commands.json
2425
cmake_command: cmake . -B build -DSYS_OPENSSL=ON -DOPENSSL_USE_STATIC_LIBS=TRUE -DTARGET_JNI=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=on && cmake --build build --target secp256k1

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@
3131
[submodule "cmake/cmake-scripts"]
3232
path = cmake/cmake-scripts
3333
url = https://github.com/StableCoder/cmake-scripts
34+
[submodule "core/lib/nlohmann_json"]
35+
path = core/lib/nlohmann_json
36+
url = https://github.com/nlohmann/json.git

core/idl/wallet/common/wallet.djinni

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ Operation = interface +c {
200200
}
201201

202202
OperationOrderKey = enum {
203-
date; amount; senders; recipients; type; currency_name; fees; block_height;
203+
date; amount; senders; recipients; type; currency_name; fees; block_height; time;
204204
}
205205

206206
#TODO

core/idl/wallet/configuration.djinni

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ BlockchainExplorerEngines = interface +c {
1313
const RIPPLE_NODE: string = "RIPPLE_NODE";
1414
const TEZOS_NODE: string = "TEZOS_NODE";
1515
const TZSTATS_API: string = "TZSTATS_API";
16+
const TZKT_API: string = "TZKT_API";
1617
}
1718

1819
# Available API to use with observers.

core/idl/wallet/tezos/tezos_like_wallet.djinni

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,10 @@ TezosLikeAccount = interface +c {
154154
getEstimatedGasLimit(address: string, callback: Callback<BigInt>);
155155
# Get fees from network
156156
getFees(callback: Callback<BigInt>);
157-
# Get gas price from network
158-
getGasPrice(callback: Callback<BigInt>);
159157
# Get originated accounts by current account
160158
getOriginatedAccounts(): list<TezosLikeOriginatedAccount>;
161159
# Get current delegate
162160
getCurrentDelegate(callback: Callback<string>);
163-
# Get the balance of the account for a given token
164-
# @param tokenAddress Address of the contract
165-
getTokenBalance(tokenAddress: string, callback: Callback<BigInt>);
166161
# Get the deterministic operation Uid
167162
const computeOperationUid(transaction: TezosLikeTransaction): string;
168163
}
@@ -203,8 +198,9 @@ TezosConfigurationDefaults = interface +c {
203198
const BCD_API_ENDPOINT: string = "https://api.better-call.dev/v1";
204199
const TEZOS_DEFAULT_API_ENDPOINT: string = "https://explorers.api.live.ledger.com";
205200
const TEZOS_DEFAULT_API_VERSION: string = "v3";
206-
const TZSTATS_API_ENDPOINT: string = "https://api.tzstats.com/explorer";
207-
const TEZOS_DEFAULT_NODE: string = "https://mainnet.tezrpc.me";
201+
const TZSTATS_API_ENDPOINT: string = "https://xtz-explorer.api.vault.ledger.com/explorer";
202+
const TZKT_API_ENDPOINT: string = "https://api.tzkt.io";
203+
const TEZOS_DEFAULT_NODE: string = "https://xtz-node.api.vault.ledger.com";
208204
const TEZOS_OBSERVER_NODE_ENDPOINT_S3: string = "https://s3.tezos.com";
209205
const TEZOS_OBSERVER_WS_ENDPOINT_S2: string = "wss://s2.tezos.com";
210206
const TEZOS_OBSERVER_WS_ENDPOINT_S3: string = "wss://s3.tezos.com";

core/lib/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,13 @@ add_subdirectory(soci_sqlite3)
5454
if (PG_SUPPORT)
5555
add_subdirectory(soci_postgresql)
5656
endif()
57+
58+
# Typically you don't care so much for a third party library's tests to be
59+
# run from your own project's code.
60+
set(JSON_BuildTests OFF CACHE INTERNAL "")
61+
62+
# If you only include this third party in PRIVATE source files, you do not
63+
# need to install it when your main project gets installed.
64+
set(JSON_Install OFF CACHE INTERNAL "")
65+
66+
add_subdirectory(nlohmann_json)

core/lib/nlohmann_json

Submodule nlohmann_json added at 7d361ec

core/src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ endif()
159159
160160
target_link_libraries(ledger-core-interface INTERFACE ethash)
161161
162+
target_link_libraries(ledger-core-interface INTERFACE nlohmann_json::nlohmann_json)
163+
162164
target_link_libraries(ledger-core-interface INTERFACE ${SQLITE_LIB})
163165
164166
file(GLOB_RECURSE LEDGER_CORE_HEADERS

0 commit comments

Comments
 (0)