From d90390a8b4a652a41d6da984f4cfb3f712aa8afe Mon Sep 17 00:00:00 2001 From: Isha Venikar <145848618+IshaVenikar@users.noreply.github.com> Date: Wed, 10 Jul 2024 10:18:33 +0530 Subject: [PATCH] Take laconicd chain id from .env file (#15) * Take the chain id for namespace from env * Use cosmos chain id from env * Fix env variable names --- .env.example | 2 ++ src/context/WalletConnectContext.tsx | 6 +++--- src/pages/SignWithCosmos.tsx | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 5fb6358..abe16ab 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,3 @@ REACT_APP_WALLET_CONNECT_ID= +REACT_APP_ETHEREUM_MAINNET_CHAIN_ID=1 +REACT_APP_LACONICD_CHAIN_ID=laconic_9000-1 diff --git a/src/context/WalletConnectContext.tsx b/src/context/WalletConnectContext.tsx index 71490be..c1593da 100644 --- a/src/context/WalletConnectContext.tsx +++ b/src/context/WalletConnectContext.tsx @@ -37,7 +37,7 @@ const walletConnectContext = createContext({ const web3Modal = new WalletConnectModal({ projectId: PROJECT_ID, - chains: ["eip155:1"], + chains: [`eip155:${process.env.REACT_APP_ETHEREUM_MAINNET_CHAIN_ID}`], }); export const WalletConnectProvider = ({ @@ -112,14 +112,14 @@ export const WalletConnectProvider = ({ const proposalNamespace = { eip155: { methods: ["personal_sign"], - chains: ["eip155:1"], + chains: [`eip155:${process.env.REACT_APP_ETHEREUM_MAINNET_CHAIN_ID}`], events: [], }, cosmos: { methods: [ "cosmos_sendTransaction", ], - chains: ["cosmos:laconic_9000-1"], // TODO: Get chain ID from .env + chains: [`cosmos:${process.env.REACT_APP_LACONICD_CHAIN_ID}`], events: [], }, }; diff --git a/src/pages/SignWithCosmos.tsx b/src/pages/SignWithCosmos.tsx index 16aad73..e81a551 100644 --- a/src/pages/SignWithCosmos.tsx +++ b/src/pages/SignWithCosmos.tsx @@ -50,7 +50,7 @@ const SignWithCosmos = () => { code: number; }>({ topic: session!.topic, - chainId: "cosmos:laconic_9000-1", // TODO: Get chain ID from .env + chainId: `cosmos:${process.env.REACT_APP_LACONICD_CHAIN_ID}`, request: { method: "cosmos_sendTransaction", params,