-
Notifications
You must be signed in to change notification settings - Fork 695
Smart wallet auth #3220
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
Smart wallet auth #3220
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
97672c9
basic login button implementation
tom2drum c58e889
refactoring and add dynamic auth button to the other pages
tom2drum 6a2fcd4
connect wallet without authenticating an user
tom2drum 0cc2884
login and logout user in blockscout account
tom2drum a69329b
refactoring and RPC overrides
tom2drum fb6cbb5
authenticate user with connected wallet
tom2drum d2eb8c9
add ENS to profile button
tom2drum deecf82
override evm chains and fix contract write with waas wallet
tom2drum c00d9fc
disconnect wallet and fix docker build
tom2drum 1ed5202
add dynamic imports to components that use web3 wallet packages
tom2drum ed46774
refactor user profile directory
tom2drum d895991
clean up
tom2drum 1857636
Merge branch 'main' of github.com:blockscout/frontend into tom2drum/i…
tom2drum 2f08863
Merge branch 'main' of github.com:blockscout/frontend into tom2drum/i…
tom2drum 12e5b20
tweaks
tom2drum 2122e93
update pw ci script
tom2drum 8d0af50
fix "connect wallet" button behavior
tom2drum 65246a4
handle linking email to profile with dynamic provider
tom2drum e5e2c1c
fix test
tom2drum b983322
async loading web3 hooks and remove dynamic loading from components t…
tom2drum 4b6100f
fix pw tests
tom2drum 919e5f8
add account navigation in horizontal layout when auth provider is dyn…
tom2drum b80b5b4
Merge branch 'main' of github.com:blockscout/frontend into tom2drum/i…
tom2drum 98666c4
fix address verification modal
tom2drum 0ced802
review fixes
tom2drum e902324
Merge branch 'main' of github.com:blockscout/frontend into tom2drum/i…
tom2drum a77e00a
spelling fixes
tom2drum 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
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
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,22 @@ | ||
| import { AuthProvider } from 'types/client/account'; | ||
| import * as yup from 'yup'; | ||
|
|
||
| export const accountSchema = yup | ||
| .object() | ||
| .shape({ | ||
| NEXT_PUBLIC_IS_ACCOUNT_SUPPORTED: yup.boolean(), | ||
| NEXT_PUBLIC_ACCOUNT_AUTH_PROVIDER: yup | ||
| .string<AuthProvider>() | ||
| .when('NEXT_PUBLIC_IS_ACCOUNT_SUPPORTED', { | ||
| is: (value: boolean) => value === true, | ||
| then: (schema) => schema.oneOf([ 'auth0', 'dynamic' ]), | ||
| otherwise: (schema) => schema.max(-1, 'NEXT_PUBLIC_ACCOUNT_AUTH_PROVIDER cannot not be used if NEXT_PUBLIC_IS_ACCOUNT_SUPPORTED is not defined'), | ||
| }), | ||
| NEXT_PUBLIC_ACCOUNT_DYNAMIC_ENVIRONMENT_ID: yup | ||
| .string() | ||
| .when('NEXT_PUBLIC_ACCOUNT_AUTH_PROVIDER', { | ||
| is: (value: AuthProvider) => value === 'dynamic', | ||
| then: (schema) => schema.required(), | ||
| otherwise: (schema) => schema.max(-1, 'NEXT_PUBLIC_ACCOUNT_DYNAMIC_ENVIRONMENT_ID can only be used if NEXT_PUBLIC_ACCOUNT_AUTH_PROVIDER is set to \'dynamic\' '), | ||
| }), | ||
| }); |
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
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,5 @@ | ||
| import type React from 'react'; | ||
|
|
||
| export const FallbackProvider = ({ children }: { children: React.ReactNode }) => { | ||
| return children; | ||
| }; |
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,40 @@ | ||
| import { useDynamicContext, useUserWallets } from '@dynamic-labs/sdk-react-core'; | ||
| import React from 'react'; | ||
| import type { UseAccountReturnType } from 'wagmi'; | ||
|
|
||
| export default function useAccountDynamic(): UseAccountReturnType { | ||
| const userWallets = useUserWallets(); | ||
| const { primaryWallet } = useDynamicContext(); | ||
|
|
||
| const address = (primaryWallet?.address || userWallets[0]?.address) as `0x${ string }` | undefined; | ||
|
|
||
| return React.useMemo(() => { | ||
| if (!address) { | ||
| return { | ||
| address: undefined, | ||
| addresses: undefined, | ||
| chain: undefined, | ||
| chainId: undefined, | ||
| connector: undefined, | ||
| isConnected: false, | ||
| isConnecting: false, | ||
| isDisconnected: true, | ||
| isReconnecting: false, | ||
| status: 'disconnected', | ||
| }; | ||
| } | ||
|
|
||
| return { | ||
| address, | ||
| addresses: [ address ], | ||
| chain: undefined, | ||
| chainId: undefined, | ||
| connector: undefined, | ||
| isConnected: true, | ||
| isConnecting: false, | ||
| isDisconnected: false, | ||
| isReconnecting: false, | ||
| status: 'connected', | ||
| } as unknown as UseAccountReturnType; | ||
| }, [ address ]); | ||
| } |
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,17 @@ | ||
| import React from 'react'; | ||
| import type { UseAccountReturnType } from 'wagmi'; | ||
|
|
||
| export default function useAccountFallback(): UseAccountReturnType { | ||
| return React.useMemo(() => ({ | ||
| address: undefined, | ||
| addresses: undefined, | ||
| chain: undefined, | ||
| chainId: undefined, | ||
| connector: undefined, | ||
| isConnected: false, | ||
| isConnecting: false, | ||
| isDisconnected: true, | ||
| isReconnecting: false, | ||
| status: 'disconnected', | ||
| }), []); | ||
| } |
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.
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.