Skip to content

Commit

Permalink
Merge pull request #282 from Outblock:master
Browse files Browse the repository at this point in the history
Merge hotfixes back to dev
  • Loading branch information
tombeckenham authored Dec 12, 2024
2 parents ba22390 + 74ab5ec commit 16fe000
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 13 additions & 2 deletions src/content-script/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-nocheck
import { WalletUtils } from '@onflow/fcl';
//import { WalletUtils } from '@onflow/fcl';
// import { nanoid } from 'nanoid';

// const channelName = nanoid();
Expand Down Expand Up @@ -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);
12 changes: 2 additions & 10 deletions src/ui/views/AddWelcome/Sync/SyncQr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const SyncQr = ({
const usewallet = useWallet();
const classes = useStyles();
const [Uri, setUri] = useState('');
const [web3wallet, setWeb3Wallet] = useState<any>(null);
const [loading, setShowLoading] = useState<boolean>(false);
const [session, setSession] = useState<SessionTypes.Struct>();
const [mnemonic, setMnemonic] = useState(bip39.generateMnemonic());
Expand Down Expand Up @@ -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 (
<>
Expand Down
10 changes: 1 addition & 9 deletions src/ui/views/Sync/SyncQr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ const SyncQr = ({ handleClick, savedUsername, confirmMnemonic, setUsername }) =>
const usewallet = useWallet();
const classes = useStyles();
const [Uri, setUri] = useState('');
const [web3wallet, setWeb3Wallet] = useState<any>(null);
const [loading, setShowLoading] = useState<boolean>(false);
const [session, setSession] = useState<SessionTypes.Struct>();
const [mnemonic, setMnemonic] = useState(bip39.generateMnemonic());
Expand Down Expand Up @@ -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 (
<>
Expand Down

0 comments on commit 16fe000

Please sign in to comment.