-
Notifications
You must be signed in to change notification settings - Fork 577
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
wallet connect fix #5387
Merged
Merged
wallet connect fix #5387
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
deb1931
dont allow connections w/o accounts
benisgold aaa934d
allow connections w/o chains
benisgold f8b0dc7
purge bad sessions
benisgold 4b0639b
switch migration infra
benisgold fd39f53
Merge branch 'develop' of https://github.com/rainbow-me/rainbow into …
benisgold 41a83e5
format
benisgold b3acb1b
nit
benisgold 4e4f39a
i18n + align
skylarbarrera f2c7e87
rm debug
skylarbarrera File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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 |
---|---|---|
|
@@ -368,13 +368,8 @@ export default function WalletConnectApprovalSheet() { | |
const handleConnect = useCallback(() => { | ||
handled.current = true; | ||
goBack(); | ||
if (IS_IOS) { | ||
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. moved this inside wc approval callback. i noticed that this was causing the "connection successful" modal to pop up even if there was an error |
||
navigate(Routes.WALLET_CONNECT_REDIRECT_SHEET, { | ||
type: 'connect', | ||
}); | ||
} | ||
handleSuccess(true); | ||
}, [handleSuccess, goBack, navigate]); | ||
}, [handleSuccess, goBack]); | ||
|
||
const handleCancel = useCallback(() => { | ||
handled.current = true; | ||
|
@@ -431,6 +426,76 @@ export default function WalletConnectApprovalSheet() { | |
const sheetHeight = | ||
type === WalletConnectApprovalSheetType.connect ? 408 : 438; | ||
|
||
const renderNetworks = useCallback(() => { | ||
if (isWalletConnectV2) { | ||
if (!chainIds?.length) { | ||
return ( | ||
<Box height={{ custom: 38 }} justifyContent="center" width="full"> | ||
<LabelText>None</LabelText> | ||
</Box> | ||
); | ||
} else { | ||
return <NetworkPill chainIds={chainIds} />; | ||
} | ||
} else { | ||
return ( | ||
<NetworkSwitcherParent | ||
activeOpacity={0} | ||
isMenuPrimaryAction | ||
{...(android ? { onPress: onPressAndroid } : {})} | ||
menuConfig={{ | ||
menuItems, | ||
menuTitle: lang.t('walletconnect.available_networks'), | ||
}} | ||
onPressMenuItem={handleOnPressNetworksMenuItem} | ||
useActionSheetFallback={false} | ||
wrapNativeComponent={false} | ||
> | ||
<ButtonPressAnimation | ||
style={{ | ||
alignItems: 'center', | ||
flexDirection: 'row', | ||
height: 38, | ||
}} | ||
> | ||
<Centered marginRight={5}> | ||
<ChainLogo | ||
network={ | ||
type === WalletConnectApprovalSheetType.connect | ||
? approvalNetworkInfo.value | ||
: ethereumUtils.getNetworkFromChainId(Number(chainId)) | ||
} | ||
/> | ||
</Centered> | ||
<LabelText align="right" numberOfLines={1}> | ||
{`${ | ||
type === WalletConnectApprovalSheetType.connect | ||
? approvalNetworkInfo.name | ||
: ethereumUtils.getNetworkNameFromChainId(Number(chainId)) | ||
} ${ | ||
type === WalletConnectApprovalSheetType.connect && | ||
menuItems.length > 1 | ||
? '' | ||
: '' | ||
}`} | ||
</LabelText> | ||
</ButtonPressAnimation> | ||
</NetworkSwitcherParent> | ||
); | ||
} | ||
}, [ | ||
NetworkSwitcherParent, | ||
approvalNetworkInfo.name, | ||
approvalNetworkInfo.value, | ||
chainId, | ||
chainIds, | ||
handleOnPressNetworksMenuItem, | ||
isWalletConnectV2, | ||
menuItems, | ||
onPressAndroid, | ||
type, | ||
]); | ||
|
||
return ( | ||
<Sheet> | ||
{!Object.keys(meta).length ? ( | ||
|
@@ -585,56 +650,7 @@ export default function WalletConnectApprovalSheet() { | |
: lang.t(lang.l.walletconnect.approval_sheet_network)} | ||
</SwitchText> | ||
</Flex> | ||
{isWalletConnectV2 ? ( | ||
<NetworkPill chainIds={chainIds} /> | ||
) : ( | ||
<NetworkSwitcherParent | ||
activeOpacity={0} | ||
isMenuPrimaryAction | ||
{...(android ? { onPress: onPressAndroid } : {})} | ||
menuConfig={{ | ||
menuItems, | ||
menuTitle: lang.t('walletconnect.available_networks'), | ||
}} | ||
onPressMenuItem={handleOnPressNetworksMenuItem} | ||
useActionSheetFallback={false} | ||
wrapNativeComponent={false} | ||
> | ||
<ButtonPressAnimation | ||
style={{ | ||
alignItems: 'center', | ||
flexDirection: 'row', | ||
height: 38, | ||
}} | ||
> | ||
<Centered marginRight={5}> | ||
<ChainLogo | ||
network={ | ||
type === WalletConnectApprovalSheetType.connect | ||
? approvalNetworkInfo.value | ||
: ethereumUtils.getNetworkFromChainId( | ||
Number(chainId) | ||
) | ||
} | ||
/> | ||
</Centered> | ||
<LabelText align="right" numberOfLines={1}> | ||
{`${ | ||
type === WalletConnectApprovalSheetType.connect | ||
? approvalNetworkInfo.name | ||
: ethereumUtils.getNetworkNameFromChainId( | ||
Number(chainId) | ||
) | ||
} ${ | ||
type === WalletConnectApprovalSheetType.connect && | ||
menuItems.length > 1 | ||
? '' | ||
: '' | ||
}`} | ||
</LabelText> | ||
</ButtonPressAnimation> | ||
</NetworkSwitcherParent> | ||
)} | ||
{renderNetworks()} | ||
</RDSColumn> | ||
</Columns> | ||
</Box> | ||
|
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
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.
can we add this to the new migrations flow that our king @estrattonbailey made? wanna deleeet these at some point
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.
totally forgot that existed lol
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.
am I having a stroke or did I respond to a notification like this months ago lmao
miss you guysssss ❤️
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.
@estrattonbailey !!!!!
hope all is well over at bsky
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.
ill never miss a chance to tag my king