Skip to content

Commit

Permalink
fix: remove function + check clipboard prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacook committed Oct 16, 2023
1 parent 1d74125 commit e0ead58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/services/walletconnect/WalletConnectContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { stripEip155Prefix } from './utils'

const walletConnectSingleton = new WalletConnectWallet()

const isWcUri = (uri: string) => uri.startsWith('wc:')

export const WalletConnectContext = createContext<{
walletConnect: WalletConnectWallet | null
error: Error | null
Expand Down
19 changes: 12 additions & 7 deletions src/services/walletconnect/useWalletConnectClipboardUri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ export const useWalletConnectClipboardUri = (): [string, Dispatch<SetStateAction
return
}

// Errors handled in the clipboard utils
const setClipboard = () => {
isClipboardGranted().then((isGranted) => {
if (isGranted) {
getClipboard().then(setState)
}
})
const setClipboard = async () => {
// Errors handled in the clipboard utils
const isGranted = await isClipboardGranted()
if (!isGranted) {
return
}

const clipboard = await getClipboard()

if (clipboard.startsWith('wc:')) {
setState(clipboard)
}
}

setClipboard()
Expand Down

0 comments on commit e0ead58

Please sign in to comment.