Skip to content

Set chain id based on the env variable - #831

Draft
r-czajkowski wants to merge 1 commit into
mainfrom
use-hardcoded-chain-id
Draft

Set chain id based on the env variable#831
r-czajkowski wants to merge 1 commit into
mainfrom
use-hardcoded-chain-id

Conversation

@r-czajkowski

Copy link
Copy Markdown
Contributor

Define the chain id based on the env variable and use it in the connect function from wagmi. We have separate builds for each network and we do not change chain dynamically so we can use hardcoded value in connect function. If we use the useChainId hook from wagmi it will return the cached chain id. So when for example we were locally testing a dapp on the testnet and then changed the env variables to integrate with the mainnet, the wagmi used the cached chain id for the testnet and we couldn't connect to the wallet.

Define the chain id based on the env variable and use it in the
`connect` function from wagmi. We have separate builds for each network
and we do not change chain dynamically so we can use hardcoded value in
`connect` function. If we use the `useChainId` hook from wagmi it will
return the cached chain id. So when for example we were locally testing
a dapp on the testnet and then changed the env variables to integrate
with the mainnet, the wagmi used the cached chain id for the testnet and
we couldn't connect to the wallet.
@netlify

netlify Bot commented Nov 6, 2024

Copy link
Copy Markdown

Deploy Preview for acre-dapp-testnet ready!

Name Link
🔨 Latest commit a2a545f
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp-testnet/deploys/672b731dafc09f00086c9872
😎 Deploy Preview https://deploy-preview-831--acre-dapp-testnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Base automatically changed from ledger-live-updates to main November 6, 2024 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant