From c017c01c53afe56612ade1be0b52d30d4fe61f4e Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 19 Oct 2022 16:59:55 +0200 Subject: [PATCH] [#11335] Use Pokt network as an infura replacement --- ci/Jenkinsfile.android | 2 +- ci/Jenkinsfile.combined | 2 +- ci/Jenkinsfile.ios | 2 +- ci/Jenkinsfile.nix-cache | 2 +- ci/Jenkinsfile.tests | 2 +- ci/tests/Jenkinsfile.e2e-prs | 2 +- ci/tools/Jenkinsfile.fastlane-clean | 2 +- ci/tools/Jenkinsfile.playstore-meta | 2 +- nix/mobile/android/jsbundle/default.nix | 4 ++-- nix/mobile/android/release.nix | 2 +- scripts/build-android.sh | 2 +- shadow-cljs.edn | 6 +++--- src/status_im/network/core.cljs | 17 ++++++----------- src/status_im/utils/config.cljs | 14 +++++++++----- status-go-version.json | 6 +++--- 15 files changed, 33 insertions(+), 34 deletions(-) diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 1637e1c941..5431308c9a 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.6.0' +library 'status-jenkins-lib@v1.6.1' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 913ca8a21c..b3c9f7f1d1 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.6.0' +library 'status-jenkins-lib@v1.6.1' pipeline { agent { label 'linux' } diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index 077fc660ae..e391d4f0cd 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.6.0' +library 'status-jenkins-lib@v1.6.1' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() diff --git a/ci/Jenkinsfile.nix-cache b/ci/Jenkinsfile.nix-cache index 7b6e8ea7a4..40471dbd4c 100644 --- a/ci/Jenkinsfile.nix-cache +++ b/ci/Jenkinsfile.nix-cache @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.6.0' +library 'status-jenkins-lib@v1.6.1' pipeline { agent { label params.AGENT_LABEL } diff --git a/ci/Jenkinsfile.tests b/ci/Jenkinsfile.tests index dbf1dbf66b..3114e69745 100644 --- a/ci/Jenkinsfile.tests +++ b/ci/Jenkinsfile.tests @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.6.0' +library 'status-jenkins-lib@v1.6.1' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() diff --git a/ci/tests/Jenkinsfile.e2e-prs b/ci/tests/Jenkinsfile.e2e-prs index 901b605027..ad5710560a 100644 --- a/ci/tests/Jenkinsfile.e2e-prs +++ b/ci/tests/Jenkinsfile.e2e-prs @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.6.0' +library 'status-jenkins-lib@v1.6.1' pipeline { diff --git a/ci/tools/Jenkinsfile.fastlane-clean b/ci/tools/Jenkinsfile.fastlane-clean index eb62ae1de2..4b382dc442 100644 --- a/ci/tools/Jenkinsfile.fastlane-clean +++ b/ci/tools/Jenkinsfile.fastlane-clean @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.6.0' +library 'status-jenkins-lib@v1.6.1' pipeline { agent { label 'macos' } diff --git a/ci/tools/Jenkinsfile.playstore-meta b/ci/tools/Jenkinsfile.playstore-meta index 20fdd1057e..e7c4e2a343 100644 --- a/ci/tools/Jenkinsfile.playstore-meta +++ b/ci/tools/Jenkinsfile.playstore-meta @@ -1,4 +1,4 @@ -library 'status-jenkins-lib@v1.6.0' +library 'status-jenkins-lib@v1.6.1' pipeline { agent { label 'linux' } diff --git a/nix/mobile/android/jsbundle/default.nix b/nix/mobile/android/jsbundle/default.nix index f64cd309f5..97fa088896 100644 --- a/nix/mobile/android/jsbundle/default.nix +++ b/nix/mobile/android/jsbundle/default.nix @@ -44,10 +44,10 @@ stdenv.mkDerivation { "configurePhase" "buildPhase" "installPhase" ]; - # For optional INFURA_TOKEN variable + # For optional POKT_TOKEN variable secretsPhase = if (secretsFile != "") then '' source "${secretsFile}" - ${lib.checkEnvVarSet "INFURA_TOKEN"} + ${lib.checkEnvVarSet "POKT_TOKEN"} '' else '' echo "No secrets provided!" ''; diff --git a/nix/mobile/android/release.nix b/nix/mobile/android/release.nix index c62edd1082..b750c87f85 100644 --- a/nix/mobile/android/release.nix +++ b/nix/mobile/android/release.nix @@ -11,7 +11,7 @@ let inherit (lib) toLower optionalString stringLength getConfig makeLibraryPath elem; - # Pass secretsFile for INFURA_TOKEN to jsbundle build + # Pass secretsFile for POKT_TOKEN to jsbundle build builtJsBundle = jsbundle { inherit secretsFile; }; buildType = getConfig "build-type" "release"; diff --git a/scripts/build-android.sh b/scripts/build-android.sh index a98afb9bc3..7d5623ced7 100755 --- a/scripts/build-android.sh +++ b/scripts/build-android.sh @@ -40,7 +40,7 @@ chmod 644 ${SECRETS_FILE_PATH} trap "rm -vf ${SECRETS_FILE_PATH}" EXIT ERR INT QUIT # Secrets like this can't be passed via args or they end up in derivation. -if [[ -n "${INFURA_TOKEN}" ]]; then append_env_export 'INFURA_TOKEN'; fi +if [[ -n "${POKT_TOKEN}" ]]; then append_env_export 'POKT_TOKEN'; fi if [[ -n "${OPENSEA_API_KEY}" ]]; then append_env_export 'OPENSEA_API_KEY'; fi # If no secrets were passed there's no need to pass the 'secretsFile'. diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 98a93d848f..5a79ddb4e0 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -48,7 +48,7 @@ :build-notify status-im.reloader/build-notify :preloads [re-frisk-remote.preload]} :closure-defines - {status-im.utils.config/INFURA_TOKEN #shadow/env "INFURA_TOKEN" + {status-im.utils.config/POKT_TOKEN #shadow/env "POKT_TOKEN" status-im.utils.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"} :compiler-options {:output-feature-set :es5 :closure-defines @@ -63,7 +63,7 @@ :chats status-im.chat.default-chats/default-chats} :release {:closure-defines - {status-im.utils.config/INFURA_TOKEN #shadow/env "INFURA_TOKEN" + {status-im.utils.config/POKT_TOKEN #shadow/env "POKT_TOKEN" status-im.utils.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"} :compiler-options {:output-feature-set :es6 ;;disable for android build as there @@ -87,7 +87,7 @@ ;; set :ui-driven to true to let shadow-cljs inject node-repl :ui-driven true :closure-defines - {status-im.utils.config/INFURA_TOKEN #shadow/env "INFURA_TOKEN" + {status-im.utils.config/POKT_TOKEN #shadow/env "POKT_TOKEN" status-im.utils.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"} :compiler-options {;; needed because we override require and it ;; messes with source-map which reports callstack diff --git a/src/status_im/network/core.cljs b/src/status_im/network/core.cljs index 26eb821202..4cc2e916d0 100644 --- a/src/status_im/network/core.cljs +++ b/src/status_im/network/core.cljs @@ -93,21 +93,16 @@ (if-let [config (get-in db [:networks/networks network-id :config])] (if-let [upstream-url (get-in config [:UpstreamConfig :URL])] {:http-post {:url upstream-url - :data (types/clj->json [{:jsonrpc "2.0" - :method "web3_clientVersion" - :id 1} - {:jsonrpc "2.0" - :method "net_version" - :id 2}]) + :data (types/clj->json {:jsonrpc "2.0" + :method "net_version" + :id 2}) :opts {:headers {"Content-Type" "application/json"}} :on-success (fn [{:keys [response-body]}] - (let [responses (http/parse-payload response-body) - client-version (:result (first responses)) + (let [response (http/parse-payload response-body) expected-network-id (:NetworkId config) - rpc-network-id (when-let [res (:result (second responses))] + rpc-network-id (when-let [res (:result response)] (js/parseInt res))] - (if (and client-version network-id - (= expected-network-id rpc-network-id)) + (if (and network-id (= expected-network-id rpc-network-id)) (re-frame/dispatch [::connect-success network-id]) (re-frame/dispatch [::connect-failure (if (not= expected-network-id rpc-network-id) (i18n/label :t/network-invalid-network-id) diff --git a/src/status_im/utils/config.cljs b/src/status_im/utils/config.cljs index 478d29ad92..438e7d9d8e 100644 --- a/src/status_im/utils/config.cljs +++ b/src/status_im/utils/config.cljs @@ -18,12 +18,16 @@ ;; NOTE(oskarth): Feature flag deprecation lifecycles. We want to make sure ;; flags stay up to date and are removed once behavior introduced is stable. -(goog-define INFURA_TOKEN "800c641949d64d768a5070a1b0511938") +(goog-define POKT_TOKEN "3ef2018191814b7e1009b8d9") (goog-define OPENSEA_API_KEY "") -(def mainnet-rpc-url (str "https://mainnet.infura.io/v3/" INFURA_TOKEN)) -(def testnet-rpc-url (str "https://ropsten.infura.io/v3/" INFURA_TOKEN)) -(def goerli-rpc-url (str "https://goerli.infura.io/v3/" INFURA_TOKEN)) +(def mainnet-rpc-url + (str "https://eth-archival.gateway.pokt.network/v1/lb/" POKT_TOKEN)) + +(def testnet-rpc-url + (str "https://ropsten.infura.io/v3/" POKT_TOKEN)) +(def goerli-rpc-url + (str "https://goerli-archival.gateway.pokt.network/v1/lb/" POKT_TOKEN)) (def opensea-api-key OPENSEA_API_KEY) (def bootnodes-settings-enabled? (enabled? (get-config :BOOTNODES_SETTINGS_ENABLED "1"))) (def mailserver-confirmations-enabled? (enabled? (get-config :MAILSERVER_CONFIRMATIONS_ENABLED))) @@ -128,7 +132,7 @@ :config {:NetworkId (ethereum/chain-keyword->chain-id :rinkeby) :DataDir "/ethereum/rinkeby_rpc" :UpstreamConfig {:Enabled true - :URL (str "https://rinkeby.infura.io/v3/" INFURA_TOKEN)}}} + :URL (str "https://rinkeby.infura.io/v3/" POKT_TOKEN)}}} {:id "goerli_rpc", :chain-explorer-link "https://goerli.etherscan.io/address/", :name "Goerli with upstream RPC", diff --git a/status-go-version.json b/status-go-version.json index b62f3ae545..7fe515fbf8 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -3,7 +3,7 @@ "_comment": "Instead use: scripts/update-status-go.sh ", "owner": "status-im", "repo": "status-go", - "version": "v0.111.5", - "commit-sha1": "94fea4725d33fe5ef0a5cbf497f1596aefa30c18", - "src-sha256": "1bkg1f5c807rwbyaxqmzpkdk5bqhf2wcasqy7gygspyh3kdcb23c" + "version": "v0.111.6", + "commit-sha1": "5c3435c12fe430740e2b5d2a05066d423c61acec", + "src-sha256": "0v1scizr5lsbm4w3bysc2cl1v9wsd9b27bzjn80p4rw6gca7s2l1" }