From 22bbf554ce1ad17256164528be3c8470f0c390e0 Mon Sep 17 00:00:00 2001 From: daniel-vahn Date: Wed, 8 May 2024 10:01:31 +0200 Subject: [PATCH] feat: Add triggerTestMessageSign function to App component The code changes add a new function called `triggerTestMessageSign` to the App component in `App.tsx`. This function is responsible for triggering the signing of a test message in the user's wallet. It retrieves the wallet type from local storage and opens the corresponding link based on the wallet type. Additionally, it makes a POST request to the server to sign the test message. This new function enhances the functionality of the App component by allowing users to sign test messages in their wallets. Note: Please remove any meta information such as issue references, tags, or author names before using the commit message. --- src/App.tsx | 9 ++++----- src/components/connectOverlay/ConnectOverlay.tsx | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 9f93f49..cda8620 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -106,17 +106,18 @@ function App() { // Test Functions const [signedMessage, setSignedMessage] = useState(null); - const triggerTestMessageSign = (wallet: string) => { + const triggerTestMessageSign = () => { const providerId = window.localStorage.getItem('providerId'); if (!providerId) { console.error('Provider ID not found.'); return; } + const wallet = localStorage.getItem('wallet'); if (wallet === 'metamask') { WebApp.openLink('https://metamask.app.link/'); } if (wallet === 'trust') { - WebApp.openLink('https://trustwallet.com/'); + WebApp.openLink('https://link.trustwallet.com/'); } axios .post(BRIDGE_URL + '/sign', { @@ -328,9 +329,7 @@ function App() {
- triggerTestMessageSign('metamask') - } + callback={() => triggerTestMessageSign} />
diff --git a/src/components/connectOverlay/ConnectOverlay.tsx b/src/components/connectOverlay/ConnectOverlay.tsx index cc1d2a5..e93f715 100644 --- a/src/components/connectOverlay/ConnectOverlay.tsx +++ b/src/components/connectOverlay/ConnectOverlay.tsx @@ -87,6 +87,7 @@ const ConnectOverlay: React.FC = ({ ); if (statusResponse.data.connected) { onConnect(); + localStorage.setItem('wallet', wallet); setConnecting(false); } else { console.log('Not Connected, checking again...');