Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set chain id based on the env variable #831

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

r-czajkowski
Copy link
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.
Copy link

netlify bot commented Nov 6, 2024

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