From 23bf69937c011ba173898c5543118c66fd3feead Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:04:53 +1100 Subject: [PATCH 1/3] HOT FIX - content script wallet connect issue Closes #280 --- package.json | 5 +++-- src/content-script/script.js | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 8c50342d..4942d944 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flow-reference-wallet", - "version": "2.6.2", + "version": "2.6.3", "description": "Digital wallet created for everyone.", "scripts": { "prepare:dev": "node ./build/prepareManifest.js dev", @@ -224,5 +224,6 @@ "node-linker": "hoisted", "strict-peer-dependencies": false, "auto-install-peers": true - } + }, + "packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c" } diff --git a/src/content-script/script.js b/src/content-script/script.js index 055c9116..2a93471a 100644 --- a/src/content-script/script.js +++ b/src/content-script/script.js @@ -1,5 +1,5 @@ // @ts-nocheck -import { WalletUtils } from '@onflow/fcl'; +//import { WalletUtils } from '@onflow/fcl'; // import { nanoid } from 'nanoid'; // const channelName = nanoid(); @@ -32,4 +32,15 @@ const service = { }, }; -WalletUtils.injectExtService(service); +function injectExtService(service) { + if (service.type === 'authn' && service.endpoint !== null) { + if (!Array.isArray(window.fcl_extensions)) { + window.fcl_extensions = []; + } + window.fcl_extensions.push(service); + } else { + console.warn('Authn service is required'); + } +} + +injectExtService(service); From ca6cf656b0337d8c5d93a59e597d409f17bf6f3b Mon Sep 17 00:00:00 2001 From: zzggo Date: Thu, 12 Dec 2024 17:56:47 +1100 Subject: [PATCH 2/3] fixed: temp fix for scanning qrcode --- src/ui/views/AddWelcome/Sync/SyncQr.tsx | 12 ++---------- src/ui/views/Sync/SyncQr.tsx | 10 +--------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/ui/views/AddWelcome/Sync/SyncQr.tsx b/src/ui/views/AddWelcome/Sync/SyncQr.tsx index 19e15144..0f753d58 100644 --- a/src/ui/views/AddWelcome/Sync/SyncQr.tsx +++ b/src/ui/views/AddWelcome/Sync/SyncQr.tsx @@ -76,7 +76,6 @@ const SyncQr = ({ const usewallet = useWallet(); const classes = useStyles(); const [Uri, setUri] = useState(''); - const [web3wallet, setWeb3Wallet] = useState(null); const [loading, setShowLoading] = useState(false); const [session, setSession] = useState(); const [mnemonic, setMnemonic] = useState(bip39.generateMnemonic()); @@ -260,31 +259,24 @@ const SyncQr = ({ }, }); - // Open QRCode modal if a URI was returned (i.e. we're not connecting an existing pairing). if (uri) { console.log('uri ', uri); await setUri(uri); - // Await session approval from the wallet. const session = await approval(); await onSessionConnected(session); - console.log('session ', session); sendRequest(wallet, session.topic); - - // onSessionConnect(session) - // Close the QRCode modal in case it was open. } } catch (e) { console.error(e); } - await setWeb3Wallet(wallet); - console.log('web3wallet', web3wallet); } catch (e) { console.error(e); } }; + createWeb3Wallet(); - }, [_subscribeToEvents, currentNetwork, onSessionConnected, sendRequest, web3wallet]); + }, []); return ( <> diff --git a/src/ui/views/Sync/SyncQr.tsx b/src/ui/views/Sync/SyncQr.tsx index 2befa86e..6b288ffd 100644 --- a/src/ui/views/Sync/SyncQr.tsx +++ b/src/ui/views/Sync/SyncQr.tsx @@ -69,7 +69,6 @@ const SyncQr = ({ handleClick, savedUsername, confirmMnemonic, setUsername }) => const usewallet = useWallet(); const classes = useStyles(); const [Uri, setUri] = useState(''); - const [web3wallet, setWeb3Wallet] = useState(null); const [loading, setShowLoading] = useState(false); const [session, setSession] = useState(); const [mnemonic, setMnemonic] = useState(bip39.generateMnemonic()); @@ -249,31 +248,24 @@ const SyncQr = ({ handleClick, savedUsername, confirmMnemonic, setUsername }) => }, }); - // Open QRCode modal if a URI was returned (i.e. we're not connecting an existing pairing). if (uri) { console.log('uri ', uri); await setUri(uri); - // Await session approval from the wallet. const session = await approval(); await onSessionConnected(session); console.log('session ', session); sendRequest(wallet, session.topic); - - // onSessionConnect(session) - // Close the QRCode modal in case it was open. } } catch (e) { console.error(e); } - await setWeb3Wallet(wallet); - console.log('web3wallet', web3wallet); } catch (e) { console.error(e); } }; createWeb3Wallet(); - }, [_subscribeToEvents, currentNetwork, onSessionConnected, sendRequest, web3wallet]); + }, []); return ( <> From 74ab5ec479436bc96feb8b5ad16cb57974e86a6a Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:33:56 +1100 Subject: [PATCH 3/3] Updated package.json to remove pnpm commands --- package.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/package.json b/package.json index 4942d944..cf9be648 100644 --- a/package.json +++ b/package.json @@ -219,11 +219,5 @@ "node": ">=22.11.0", "pnpm": ">=9" }, - "pnpm": { - "shamefully-hoist": true, - "node-linker": "hoisted", - "strict-peer-dependencies": false, - "auto-install-peers": true - }, "packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c" }