diff --git a/pocket/app.js b/pocket/app.js index 72a2b30..caa8115 100644 --- a/pocket/app.js +++ b/pocket/app.js @@ -187,6 +187,14 @@ app.post('/api/stake', (req, res) => { res.send(response); }) +app.post('/api/sign', (req, res) => { + const passphrase = shell.exec(`echo $KEYFILE_PASSPHRASE`).stdout.trim(); + const address = shell.exec(`pocket accounts list --datadir=/home/app/.pocket/ | cut -d' ' -f2- `).stdout.trim(); + const message = req.body.message; + const response = shell.exec(`pocket accounts sign ${address} ${message} --datadir=/home/app/.pocket/ --pwd "${passphrase}"`).stdout.trim(); + res.send(response); +}) + var server = app.listen(CUSTOM_UI_HTTP_PORT, function () { var host = server.address().address; var port = server.address().port; diff --git a/pocket/ui/src/App.tsx b/pocket/ui/src/App.tsx index 2c72bd3..712d143 100644 --- a/pocket/ui/src/App.tsx +++ b/pocket/ui/src/App.tsx @@ -15,6 +15,7 @@ function App() { const [availableChains, setAvailableChains] = useState<[Chain]>(); const [currentBlock, setCurrentBlock] = useState(null); const [amountToStake, setAmountToStake] = useState(null); + const [message, setMessage] = useState(null); const [selectedChains, setSelectedChains] = useState(new Map()); const [first, setFirst] = useState(true); const [txhash, setTxhash] = useState(null); @@ -91,6 +92,16 @@ function App() { } } + // working on message signing variable + const signMessage = async () => { + try { + setMessage(null); + if (message) + } + appService.signMessage({message}); + } + + function handleChange(id:string, isChecked: boolean) { let modifiedMap = selectedChains; if(modifiedMap?.get(id) && !isChecked) { @@ -242,6 +253,66 @@ function App() { Stake = Initial Stake. Re-stake = staking again after changing chains or amount staked. + +
+ Sign Message with your Account +
+
+ Address +
+
+ + + Address to Sign Message + +
+
+ Message +
+
+ + + You can enter any message to be signed here, but it's primary use is to self-sign the address of the account, + +
+
+ + You are using to stake with in order to prove ownership of the account, and begin the Node-Runner Tropy Process. + +
+
+ + More info on the Node-Runner Trophy Process here. + +
+
+ + {txhash && ( + + {` `}Tx: {txhash} + + )} + {(currentBlock ?? 0) === 0 && ( + + {` `}(Syncing...) + + )} +
diff --git a/pocket/ui/src/services/app.service.ts b/pocket/ui/src/services/app.service.ts index 4911522..5cd331c 100644 --- a/pocket/ui/src/services/app.service.ts +++ b/pocket/ui/src/services/app.service.ts @@ -25,4 +25,9 @@ export class AppService { return response.data; } + public async signMessage(message: string) { + const response = await axios.post(`/api/signMessage`, {message}); + return response.data; + } + } \ No newline at end of file