-
Notifications
You must be signed in to change notification settings - Fork 61
feat: Integrate dynamic wallet on Hello frontend example #280
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
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
5597edc
Integrates dynamic via native api
hernan-clich ffeb99f
Using widgets
hernan-clich 07a0f66
Restored compatibility for EIP-6963
hernan-clich 8b4647e
Setting flip to true
hernan-clich 483c40d
Added chains manually
hernan-clich d9a2841
Cleanup
hernan-clich 366a037
Merge branch 'main' into feat/integrate-dynamic-vite
hernan-clich d193144
Fix lint errors
hernan-clich 567e850
Renamed hooks and cleared logs
hernan-clich 47304e8
Use Univ Sign in Global wallet and Css overrides
hernan-clich c345f03
Applying proper overrides
hernan-clich b4172ec
Add sdk api core
hernan-clich b97cfbc
Opening USI GWallet directly
hernan-clich 42c190e
Remove context overrides
hernan-clich e9232c8
Using UniversalSignInContextProvider
hernan-clich 4f74b5b
Removed all dynamic libs from project
hernan-clich f3b2676
Corrected import
hernan-clich cb09977
Use connectUniversalSignIn fn
hernan-clich f48bd85
Correct modal semantics
hernan-clich c3e1d36
Installed zeta wallet
hernan-clich c925ed5
Merge branch 'main' into feat/integrate-dynamic-vite
fadeev c9e419c
Fix runtime issue by splitting AppContent
hernan-clich 65bff90
Bump wallet lib
hernan-clich eb95949
Updated dynamic version header
hernan-clich 5131416
Remove silly comment
hernan-clich cf08228
Removed unused chain data
hernan-clich ce19b3c
Made small type fixes
hernan-clich 2452439
Optimize provider wrapping
hernan-clich b291c21
Using resolution for clunky noble hashes
hernan-clich 16ed979
Removed unnecessary file extensions on imports
hernan-clich 3f30d8d
Bump wallet lib
hernan-clich 021ff23
Completed conditional rendering setup of providers
hernan-clich 1c6cffd
Add resolutions for noble libs
hernan-clich 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,23 +1,7 @@ | ||
| import { ConnectedContent } from './ConnectedContent'; | ||
| import { SUPPORTED_CHAINS } from './constants/chains'; | ||
| import { DisconnectedContent } from './DisconnectedContent'; | ||
| import { useWallet } from './hooks/useWallet'; | ||
| import { USE_DYNAMIC_WALLET } from './constants/wallets'; | ||
| import { DynamicAppContent } from './DynamicAppContent'; | ||
| import { Eip6963AppContent } from './Eip6963AppContent'; | ||
|
|
||
| export function AppContent() { | ||
| const { account, selectedProvider, decimalChainId } = useWallet(); | ||
|
|
||
| const supportedChain = SUPPORTED_CHAINS.find( | ||
| (chain) => chain.chainId === decimalChainId | ||
| ); | ||
|
|
||
| if (!account || !selectedProvider) { | ||
| return <DisconnectedContent />; | ||
| } | ||
|
|
||
| return ( | ||
| <ConnectedContent | ||
| selectedProvider={selectedProvider} | ||
| supportedChain={supportedChain} | ||
| /> | ||
| ); | ||
| return USE_DYNAMIC_WALLET ? <DynamicAppContent /> : <Eip6963AppContent />; | ||
hernan-clich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { useUniversalSignInContext } from '@zetachain/wallet/react'; | ||
|
|
||
| import { ConnectedContent } from './ConnectedContent'; | ||
| import { SUPPORTED_CHAINS } from './constants/chains'; | ||
| import { DisconnectedContent } from './DisconnectedContent'; | ||
|
|
||
| export function DynamicAppContent() { | ||
| const { primaryWallet, network } = useUniversalSignInContext(); | ||
|
|
||
| const account = primaryWallet?.address || null; | ||
| const decimalChainId = network || null; | ||
|
|
||
| const supportedChain = SUPPORTED_CHAINS.find( | ||
| (chain) => chain.chainId === decimalChainId | ||
| ); | ||
|
|
||
| const isDisconnected = !account; | ||
|
|
||
| if (isDisconnected) { | ||
| return <DisconnectedContent />; | ||
| } | ||
|
|
||
| return ( | ||
| <ConnectedContent | ||
| selectedProvider={null} | ||
| supportedChain={supportedChain} | ||
| primaryWallet={primaryWallet} | ||
| /> | ||
| ); | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { ConnectedContent } from './ConnectedContent'; | ||
| import { SUPPORTED_CHAINS } from './constants/chains'; | ||
| import { DisconnectedContent } from './DisconnectedContent'; | ||
| import { useEip6963Wallet } from './hooks/useEip6963Wallet'; | ||
|
|
||
| export function Eip6963AppContent() { | ||
| const { selectedProvider, decimalChainId } = useEip6963Wallet(); | ||
|
|
||
| const supportedChain = SUPPORTED_CHAINS.find( | ||
| (chain) => chain.chainId === decimalChainId | ||
| ); | ||
|
|
||
| const isDisconnected = !selectedProvider; | ||
|
|
||
| if (isDisconnected) { | ||
| return <DisconnectedContent />; | ||
| } | ||
|
|
||
| return ( | ||
| <ConnectedContent | ||
| selectedProvider={selectedProvider} | ||
| supportedChain={supportedChain} | ||
| /> | ||
| ); | ||
| } |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.