-
Notifications
You must be signed in to change notification settings - Fork 183
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
feat: add wallet connection functionality #40
Merged
Merged
Changes from 40 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
12e0b71
feat: set up basic wallet connection functionality (#32)
kristiehuang 15e0218
feat: add gradient identicons (#39)
kristiehuang bbc1111
Fix timeout typing
kristiehuang d85ea9b
feat: Add WalletConnect QR code to ConnectWalletDialog with latest we…
kristiehuang b62cd44
feat: switch to using w3r's Web3ReactProvider (#50)
kristiehuang 72c5106
feat: add fallback mainnet JSON RPC endpoint (#43)
kristiehuang e95f07b
fix: fix integrator provider accounts.every error
kristiehuang 7de77ff
add flashbots RPC endpoint to fallbacks
kristiehuang 243f85b
lint
kristiehuang 12c8749
fix: use undistorted QR code (#53)
kristiehuang 77fcc2f
nit: show loading state if trade is loading
kristiehuang ba31255
feat: give integrators option to pass in 'false' to disable our built…
kristiehuang fd40f63
style(lint): lint action with ESLint
9179e6d
Revert "feat: give integrators option to pass in 'false' to disable o…
kristiehuang 69180be
Merge branch 'wallet-connect-flow' of https://github.com/Uniswap/widg…
kristiehuang 495ac68
fix: bump w3r versions to fix bug
kristiehuang 291c409
feat: add widget disconnection via hover (#61)
kristiehuang 0463186
fix: multichain widget (#59)
kristiehuang b6bd985
Merge branch 'main' into wallet-connect-flow
kristiehuang f5f9fe4
fix: use web3react instead of activeweb3react
kristiehuang c9c8264
style(lint): lint action with ESLint
e7ef6cb
Add public rpcs
kristiehuang f6fa679
Merge branch 'wallet-connect-flow' of https://github.com/Uniswap/widg…
kristiehuang d67063c
nit
kristiehuang f8f7e0e
Update jsonRpcEndpoints
kristiehuang 2875281
Update jsonRpcEndpoints to support routing
kristiehuang 401566d
fix: catch errors (#55)
kristiehuang 2184784
Use JsonRpcConnector built-in for custom wallet provider
kristiehuang 3dbfcc9
revert swap.fixture
kristiehuang 24ce4f9
Rename onClickConnectWallet to onConnectWalletClick
kristiehuang 92b4894
Address PR reviews
kristiehuang 5ffa949
style(lint): lint action with ESLint
6e7a7b0
nit
kristiehuang d3c4da3
feat: add hideConnectionUI prop
kristiehuang 30cc010
Merge branch 'wallet-connect-flow' of https://github.com/Uniswap/widg…
kristiehuang 4bf9148
update types/node and w3r/metamask versions
kristiehuang 43ffcd4
nit
kristiehuang 94bc505
Use ButtonContents to button contents
kristiehuang df0854a
fix: Use entries of jsonRpcUrlMap for connectors key
kristiehuang 9fc1dcf
pass account as prop to ConnectedWalletChip
kristiehuang 985298c
use promise pattern for onConnectWalletClick
kristiehuang df93c73
use atom for callback fxn instead of passing down all the way
kristiehuang 1e42f3c
move onconnectclickatom to wallet.ts
kristiehuang affbe3f
nit
kristiehuang e58a7ff
nit: fix heights pxs
kristiehuang 1ac569c
fix defaultChainid bug
kristiehuang e2af593
nit: PR review
kristiehuang 3c98744
Merge branch 'main' into wallet-connect-flow
kristiehuang 191575e
feat: [wallet connection] update tests (#62)
kristiehuang 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
lts/* | ||
18 |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Trans } from '@lingui/macro' | ||
import { Wallet as WalletIcon } from 'icons' | ||
import { useCallback, useState } from 'react' | ||
import styled from 'styled-components/macro' | ||
import { ThemedText } from 'theme' | ||
|
||
import { TextButton } from '../Button' | ||
import Dialog from '../Dialog' | ||
import Row from '../Row' | ||
import { ConnectWalletDialog } from './ConnectWalletDialog' | ||
|
||
interface ConnectWalletProps { | ||
disabled?: boolean | ||
onIntegratorConnectWalletCallback?: (e?: React.MouseEvent<HTMLButtonElement>) => void | ||
} | ||
|
||
const WalletButton = styled(TextButton)<{ hidden?: boolean }>` | ||
filter: none; | ||
visibility: ${({ hidden }) => hidden && 'hidden'}; | ||
` | ||
|
||
export default function ConnectWallet({ disabled, onIntegratorConnectWalletCallback }: ConnectWalletProps) { | ||
// Opens a dialog that initiates own wallet connection flow | ||
const [open, setOpen] = useState(false) | ||
|
||
const onClose = useCallback(() => setOpen(false), []) | ||
|
||
const onClick = useCallback( | ||
(e?: React.MouseEvent<HTMLButtonElement>) => { | ||
if (onIntegratorConnectWalletCallback) { | ||
onIntegratorConnectWalletCallback(e) | ||
if (e && e.defaultPrevented) return | ||
} | ||
setOpen(true) // Initiate our own wallet connection flow | ||
}, | ||
[onIntegratorConnectWalletCallback] | ||
) | ||
|
||
return ( | ||
<> | ||
<WalletButton hidden={disabled} onClick={onClick} color="secondary" data-testid="wallet"> | ||
<ThemedText.Caption> | ||
<Row gap={0.5}> | ||
<WalletIcon /> | ||
<Trans>Connect wallet to swap</Trans> | ||
</Row> | ||
</ThemedText.Caption> | ||
</WalletButton> | ||
{open && ( | ||
<Dialog color="dialog" onClose={onClose}> | ||
<ConnectWalletDialog /> | ||
</Dialog> | ||
)} | ||
</> | ||
) | ||
} |
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.
I'm not super familiar w/ these testing utils, but the docs seem to indicate the
act
wrapper should not be necessary.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.
think it's because the
Web3Provider
causes issues, we have the same errors in interface atm