Skip to content

Commit

Permalink
feat: Add triggerTestMessageSign function to App component
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
daniel-vahn committed May 8, 2024
1 parent c135f7b commit 22bbf55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,18 @@ function App() {

// Test Functions
const [signedMessage, setSignedMessage] = useState<string | null>(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', {
Expand Down Expand Up @@ -328,9 +329,7 @@ function App() {
<div className="flex flex-col gap-2">
<PrimaryButton
title="Sign Test Message in Wallet"
callback={() =>
triggerTestMessageSign('metamask')
}
callback={() => triggerTestMessageSign}
/>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/connectOverlay/ConnectOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const ConnectOverlay: React.FC<Props> = ({
);
if (statusResponse.data.connected) {
onConnect();
localStorage.setItem('wallet', wallet);
setConnecting(false);
} else {
console.log('Not Connected, checking again...');
Expand Down

0 comments on commit 22bbf55

Please sign in to comment.