diff --git a/package.json b/package.json index 72d42542..3b567973 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", 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); 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 ( <>