Skip to content

Commit

Permalink
refactor: phantom deeplinking (#3432)
Browse files Browse the repository at this point in the history
  • Loading branch information
enesozturk authored Dec 11, 2024
1 parent 388e6d6 commit 9fce094
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .changeset/grumpy-jeans-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@reown/appkit-adapter-solana': patch
'@apps/builder': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-cli': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-scaffold-ui': patch
'@reown/appkit-siwe': patch
'@reown/appkit-siwx': patch
'@reown/appkit-ui': patch
'@reown/appkit-wallet': patch
'@reown/appkit-wallet-button': patch
---

Fixes phantom and coinbase deeplink url parameters to be encoded
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ export function handleMobileWalletRedirection(properties: {
platform: string
}): void {
if (properties?.name === 'Phantom' && !('phantom' in window)) {
const href = window.location.href
const href = encodeURIComponent(window.location.href)
const protocol = href.startsWith('https') ? 'https' : 'http'
const host = href.split('/')[2]
const ref = `${protocol}://${host}`
window.location.href = `https://phantom.app/ul/browse/${href}?ref=${ref}`
}

if (properties?.name === 'Coinbase Wallet' && !('coinbaseSolana' in window)) {
const href = window.location.href
const href = encodeURIComponent(window.location.href)
window.location.href = `https://go.cb-w.com/dapp?cb_url=${href}`
}
}

0 comments on commit 9fce094

Please sign in to comment.