-
Notifications
You must be signed in to change notification settings - Fork 7
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
[Issue #2565]
network config extended
#2609
Merged
Da-Colon
merged 20 commits into
issue/2565-network-config-updates
from
issue/2565-network-config-extended
Dec 16, 2024
Merged
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
56b0eda
feat: implement dynamic Wagmi configuration and update providers to u…
Da-Colon a3f879b
refactor: remove unused dynamic Wagmi configuration hook
Da-Colon 999f0f6
feat: integrate automatic chain switching and update Wagmi configurat…
Da-Colon fb9c751
feat: integrate chain switching functionality in EstablishEssentials …
Da-Colon d11ff98
Merge branch 'issue/2565-network-config-updates' of github.com:decent…
Da-Colon c05f818
Merge branch 'issue/2565-network-config-updates' of github.com:decent…
Da-Colon 23cab88
Delay setting current config after switching chain to ensure proper s…
Da-Colon 9f2ffaf
Merge branch 'issue/2565-network-config-updates' of github.com:decent…
Da-Colon 113d28f
Update error message for invalid DAO search to reflect support for al…
Da-Colon d2319e5
Enhance useIsSafe hook to search across all supported networks and re…
Da-Colon 2bb83c1
Refactor DAOSearch to display multiple network prefixes in SearchDisp…
Da-Colon 8dab85b
Refactor DAOSearch component to remove extra gap
Da-Colon ef7a3de
revert: changes made to hook.
Da-Colon 2118a5d
Add useResolveAddressMultiChain hook for multi-chain address resolution
Da-Colon 1e8292a
Refactor DAOSearch to use resolved addresses with chain IDs and updat…
Da-Colon a25fd55
move translation initialization
Da-Colon 8dace81
Remove 'wrongNetwork' type from LoadingProblem component and its usag…
Da-Colon 5b8556b
Merge branch 'issue/2565-network-config-updates' of github.com:decent…
Da-Colon 992c141
Merge branch 'issue/2565-network-config-extended' of github.com:decen…
Da-Colon 89b2989
Merge pull request #2630 from decentdao/issue/2565-cross-chain-dao-se…
Da-Colon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,29 +12,32 @@ const supportedWagmiChains = supportedNetworks.map(network => network.chain); | |
export const walletConnectProjectId = import.meta.env.VITE_APP_WALLET_CONNECT_PROJECT_ID; | ||
export const queryClient = new QueryClient(); | ||
|
||
const wagmiMetadata = { | ||
const metadata = { | ||
name: import.meta.env.VITE_APP_NAME, | ||
description: | ||
'Are you outgrowing your Multisig? Decent extends Safe treasuries into on-chain hierarchies of permissions, token flows, and governance.', | ||
url: import.meta.env.VITE_APP_SITE_URL, | ||
icons: [`${import.meta.env.VITE_APP_SITE_URL}/favicon-96x96.png`], | ||
}; | ||
|
||
const transportsReducer = (accumulator: Record<string, HttpTransport>, network: NetworkConfig) => { | ||
export const transportsReducer = ( | ||
accumulator: Record<string, HttpTransport>, | ||
network: NetworkConfig, | ||
) => { | ||
accumulator[network.chain.id] = http(network.rpcEndpoint); | ||
return accumulator; | ||
}; | ||
|
||
export const wagmiConfig = defaultWagmiConfig({ | ||
chains: supportedWagmiChains as [Chain, ...Chain[]], | ||
projectId: walletConnectProjectId, | ||
metadata: wagmiMetadata, | ||
metadata, | ||
transports: supportedNetworks.reduce(transportsReducer, {}), | ||
batch: { | ||
multicall: true, | ||
}, | ||
}); | ||
|
||
if (walletConnectProjectId) { | ||
createWeb3Modal({ wagmiConfig, projectId: walletConnectProjectId }); | ||
createWeb3Modal({ wagmiConfig, projectId: walletConnectProjectId, metadata: metadata }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can use prop shorthand here as well |
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funny enough, this kinda reverts back to how the file was before only this now we are attempting the switch chain again onError.
While, not ideal. this does work and fixes the current network switcher issues we've been having. Ideally I think we would have completely seperate
publicClient
by passing theid
directly in. and then move all network switching to when a user clicks to send a transaction.But I'm not sure how that scales at the moment and want to discuss further before we make that change.
So this is the current path of least resistance. currently there are two spots that this is going to be required.
useAutomaticSwitchChain
EstablishEssentials
where a new network switcher will exist.