From 644ca0328ecdd7c49dd820b057d2be79e0db70a9 Mon Sep 17 00:00:00 2001 From: Lukasz Kosiak <103423117+lukozill@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:49:11 +0100 Subject: [PATCH] APT-1507, APT-1601: Prototestnet contracts connected, config refactored #11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ɓukasz Kosiak --- .dockerignore | 1 + .env.local_zq2 | 3 +- .env.mocked | 3 +- .env.zq2_testnet | 2 + render_config_staging.yaml | 2 +- src/components/loginView.tsx | 7 ++- src/components/stakingCalculator.tsx | 8 +++- src/components/stakingPoolsList.tsx | 4 +- src/contexts/appConfigStorage.tsx | 12 +++++ src/contexts/stakingPoolsStorage.tsx | 12 +++-- src/contexts/walletConnector.tsx | 7 ++- src/misc/appConfig.ts | 15 ------ src/misc/chainConfig.ts | 68 ++++++++++++++++++---------- src/misc/formatting.ts | 6 +-- src/misc/stakingPoolsConfig.ts | 36 +++++++-------- src/misc/walletsConfig.ts | 9 ++-- src/pages/_app.tsx | 58 ++++++++++++++---------- src/pages/api/config.ts | 40 ++++++++++++++++ src/pages/index.tsx | 7 ++- src/script/fetchPoolStaticData.ts | 10 ++-- zenv/z.yaml | 2 +- 21 files changed, 202 insertions(+), 110 deletions(-) create mode 100644 .env.zq2_testnet create mode 100644 src/contexts/appConfigStorage.tsx delete mode 100644 src/misc/appConfig.ts create mode 100644 src/pages/api/config.ts diff --git a/.dockerignore b/.dockerignore index 2386470..15e35a6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -22,6 +22,7 @@ ## next.js **/.next/ **/.env*.local +.env ## production **/build diff --git a/.env.local_zq2 b/.env.local_zq2 index 2624afc..4a246ea 100644 --- a/.env.local_zq2 +++ b/.env.local_zq2 @@ -1 +1,2 @@ -NEXT_PUBLIC_ENV_CHAIN_ID=32769 \ No newline at end of file +CHAIN_ID=32769 +ZQ2_STAKING_WALLET_CONNECT_API_KEY=ewewewejwje \ No newline at end of file diff --git a/.env.mocked b/.env.mocked index eb7752e..38b0526 100644 --- a/.env.mocked +++ b/.env.mocked @@ -1 +1,2 @@ -NEXT_PUBLIC_ENV_CHAIN_ID=9999999 \ No newline at end of file +CHAIN_ID=9999999 +ZQ2_STAKING_WALLET_CONNECT_API_KEY=ewewewejwje \ No newline at end of file diff --git a/.env.zq2_testnet b/.env.zq2_testnet new file mode 100644 index 0000000..08720e1 --- /dev/null +++ b/.env.zq2_testnet @@ -0,0 +1,2 @@ +ZQ2_STAKING_CHAIN_ID=33103 +ZQ2_STAKING_WALLET_CONNECT_API_KEY=ewewewejwje \ No newline at end of file diff --git a/render_config_staging.yaml b/render_config_staging.yaml index 6570481..c3030f0 100644 --- a/render_config_staging.yaml +++ b/render_config_staging.yaml @@ -26,7 +26,7 @@ apps_to_clusters: replicas: 1 env_vars: - name: ZQ2_STAKING_CHAIN_ID - value: 33469 + value: 33103 pod_limits: cpu: 200m memory: 200Mi diff --git a/src/components/loginView.tsx b/src/components/loginView.tsx index 44a08c0..f4a045c 100644 --- a/src/components/loginView.tsx +++ b/src/components/loginView.tsx @@ -1,3 +1,4 @@ +import { AppConfigStorage } from "@/contexts/appConfigStorage"; import { WalletConnector } from "@/contexts/walletConnector"; import { MOCK_CHAIN } from "@/misc/chainConfig"; import { ConnectButton } from "@rainbow-me/rainbowkit"; @@ -5,12 +6,16 @@ import { Button } from "antd"; const LoginView: React.FC = () => { + const { + appConfig + } = AppConfigStorage.useContainer(); + const { connectDummyWallet, isDummyWalletConnecting, } = WalletConnector.useContainer(); - const connectWallet = process.env.NEXT_PUBLIC_ENV_CHAIN_ID === MOCK_CHAIN.id.toString() ? ( + const connectWallet = appConfig.chainId === MOCK_CHAIN.id ? (