Skip to content

Commit

Permalink
feat: wallet connection via deeplink (#405)
Browse files Browse the repository at this point in the history
Co-authored-by: Gancho Radkov <[email protected]>
  • Loading branch information
ganchoradkov and Gancho Radkov committed Jan 12, 2024
1 parent 9d6d0ae commit 0053f33
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
11 changes: 9 additions & 2 deletions advanced/wallets/react-wallet-v2/src/pages/walletconnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import PageHeader from '@/components/PageHeader'
import QrReader from '@/components/QrReader'
import { web3wallet } from '@/utils/WalletConnectUtil'
import { Button, Input, Loading, Text } from '@nextui-org/react'
import { Fragment, useState } from 'react'
import { Fragment, useMemo, useState } from 'react'
import { styledToast } from '@/utils/HelperUtil'
import ModalStore from '@/store/ModalStore'

export default function WalletConnectPage() {
export default function WalletConnectPage(params: { deepLink?: string }) {
const { deepLink } = params
const [uri, setUri] = useState('')
const [loading, setLoading] = useState(false)

Expand Down Expand Up @@ -38,6 +39,12 @@ export default function WalletConnectPage() {
}
}

useMemo(() => {
if (deepLink) {
onConnect(deepLink)
}
}, [deepLink])

return (
<Fragment>
<PageHeader title="WalletConnect" />
Expand Down
22 changes: 22 additions & 0 deletions advanced/wallets/react-wallet-v2/src/pages/wc.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Text } from '@nextui-org/react'
import { Fragment } from 'react'
import { useRouter } from 'next/router'
import WalletConnectPage from './walletconnect'

export default function DeepLinkPairingPage() {
const router = useRouter()

const uri = router.query.uri as string

if (!uri) {
return (
<Fragment>
<Text css={{ opacity: '0.5', textAlign: 'center', marginTop: '$20' }}>
No URI provided via `?uri=` params
</Text>
</Fragment>
)
}

return <WalletConnectPage deepLink={uri} />
}

6 comments on commit 0053f33

@vercel
Copy link

@vercel vercel bot commented on 0053f33 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

react-auth-dapp – ./advanced/dapps/react-dapp-auth

react-auth-dapp.vercel.app
react-auth-dapp-git-main-walletconnect1.vercel.app
react-auth-dapp-walletconnect1.vercel.app
react-auth-dapp.walletconnect.com

@vercel
Copy link

@vercel vercel bot commented on 0053f33 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 0053f33 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 0053f33 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

react-auth-wallet – ./advanced/wallets/react-wallet-auth

react-auth-wallet-walletconnect1.vercel.app
react-auth-wallet.walletconnect.com
react-auth-wallet-git-main-walletconnect1.vercel.app
react-auth-wallet.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0053f33 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vue-dapp-auth – ./advanced/dapps/vue-dapp-auth

vue-dapp-auth.vercel.app
vue-dapp-auth-git-main-walletconnect1.vercel.app
vue-dapp-auth-walletconnect1.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0053f33 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.