Skip to content

Commit

Permalink
test message signing
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-vahn committed Apr 16, 2024
1 parent 777312e commit 4a22632
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useState, useEffect, ChangeEvent } from 'react';
// import { useTonWallet } from '@tonconnect/ui-react';
import WebApp from '@twa-dev/sdk';
import axios from 'axios';
Expand Down Expand Up @@ -134,18 +134,24 @@ function App() {
WebApp.openLink('https://metamask.app.link/');
axios
.post(BRIDGE_URL + '/sign', {
message: 'This is a test message to sign in the wallet.',
message: testMessage,
account: account,
})
.then((response) => {
setSignedMessage(response.data.signature);
});
};

const triggerTestMessageToChat = () => {
// Trigger Test Message to Chat
const [testMessage, setTestMessage] = useState<string>('');

const handleTestMessageChange = (e: ChangeEvent<HTMLTextAreaElement>) => {
setTestMessage(e.target.value);
};

// const triggerTestMessageToChat = () => {
// // Trigger Test Message to Chat
// };

// Transaction Functions
const sendFunds = () => {
// Send Funds
Expand Down Expand Up @@ -211,10 +217,6 @@ function App() {
{account}
<div className="connect-buttons">
<h2 className="headline">CONNECT</h2>
<PrimaryButton
title="sign message"
callback={triggerTestMessageSign}
/>
<EVMConnectModal
title="EVM Connect"
icon={evmConnectIcon}
Expand All @@ -238,6 +240,7 @@ function App() {
<div>
<div className="components-container">
<BackButton goBack={goBack} />
<SkipButton skip={skip} />
<Avatar src={avatarTable} height="60%" />
<div className="wallet-overview">
<h2 className="headline">HORRAY!</h2>
Expand Down Expand Up @@ -306,15 +309,26 @@ function App() {
valueFiat={150}
/>
</div>
<textarea
className="transaction-input"
placeholder="Enter test message here"
onInput={handleTestMessageChange}
></textarea>
{signedMessage && (
<div>
<p>Signed Message:</p>
<p>{signedMessage}</p>
</div>
)}
<div className="test-functions">
<PrimaryButton
title="Sign Test Message in Wallet"
callback={triggerTestMessageSign}
/>
<PrimaryButton
{/* <PrimaryButton
title="Trigger Test Message to Chat"
callback={triggerTestMessageToChat}
/>
/> */}
</div>
</div>
</div>
Expand Down

0 comments on commit 4a22632

Please sign in to comment.