2023-08-09 17:22:24 +02:00

52 lines
1.7 KiB
JavaScript

/*eslint-disable */
import { send } from "../Scripts/Testnet";
import sjcl from "sjcl";
function desprorr2(encripted) {
var parsedMessage = JSON.parse(encripted);
var encryptedMessageWithoutParameters = JSON.stringify(parsedMessage);
//Decrypt
var parsedMessage = JSON.parse(encryptedMessageWithoutParameters);
var messageWithParameters = JSON.stringify(parsedMessage);
var decryptedMessage = sjcl.decrypt("arstotzka", messageWithParameters);
return decryptedMessage;
}
export default function Pay({ keys }) {
function handleSend() {
console.log(keys);
const amount = document.getElementById("amount").value;
const to = document.getElementById("to").value;
send(amount, desprorr2(keys.private), to);
}
return (
<div className="h-3/6 w-2/6 bg-secondary self-center ml-[10rem] rounded-2xl flex flex-col gap-5 justify-center">
<label htmlFor="send2" className="font-bold text-3xl self-center">
Send to:
</label>
<input
name="send2"
id="to"
className="h-[2rem] w-3/6 self-center border-4 border-tertiary rounded-md"
placeholder="Example: GDY2CP7XLBIY65YX7KS72X7JCZJVJ3AEPEEFTW3TYPLGDRWEZKAC7NR3"
type="text"
/>
<label htmlFor="amount" className="font-bold text-3xl self-center">
BLC Amount:
</label>
<input
id="amount"
name="amount"
className="h-[2rem] w-3/6 self-center border-4 border-tertiary rounded-md"
type="number"
/>
<input
name="submit"
type="submit"
value="Send"
className="rounded bg-primary text-tertiary px-4 py-2 cursor-pointer w-3/6 self-center"
onClick={handleSend}
/>
</div>
);
}