[#11335] Use Pokt network as an infura replacement

This commit is contained in:
Roman Volosovskyi 2022-10-19 16:59:55 +02:00
parent 5d775d93fa
commit c017c01c53
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
15 changed files with 33 additions and 34 deletions

View File

@ -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()

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.6.0'
library 'status-jenkins-lib@v1.6.1'
pipeline {
agent { label 'linux' }

View File

@ -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()

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.6.0'
library 'status-jenkins-lib@v1.6.1'
pipeline {
agent { label params.AGENT_LABEL }

View File

@ -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()

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.6.0'
library 'status-jenkins-lib@v1.6.1'
pipeline {

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.6.0'
library 'status-jenkins-lib@v1.6.1'
pipeline {
agent { label 'macos' }

View File

@ -1,4 +1,4 @@
library 'status-jenkins-lib@v1.6.0'
library 'status-jenkins-lib@v1.6.1'
pipeline {
agent { label 'linux' }

View File

@ -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!"
'';

View File

@ -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";

View File

@ -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'.

View File

@ -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

View File

@ -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)

View File

@ -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",

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"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"
}