Skip to content

Commit

Permalink
Merge pull request #930 from ProvableHQ/mwong/add-generate-key
Browse files Browse the repository at this point in the history
Add generate key ability to Deploy Program in SDK
  • Loading branch information
michellewong793 authored Sep 24, 2024
2 parents 04e9715 + 8b64a01 commit de1027e
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions website/src/tabs/develop/Deploy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import {
Space, Switch,
} from "antd";
import { CodeEditor } from "./execute/CodeEditor.jsx";
import axios from "axios";
import { useAleoWASM } from "../../aleo-wasm-hook.js";


export const Deploy = () => {

const [form] = Form.useForm();
const [aleoWASM] = useAleoWASM();
const [deploymentFeeRecord, setDeploymentFeeRecord] = useState(null);
const [deployUrl, setDeployUrl] = useState("https://api.explorer.provable.com/v1");
const [deploymentFee, setDeploymentFee] = useState("1");
Expand All @@ -31,6 +33,7 @@ export const Deploy = () => {
const [transactionID, setTransactionID] = useState(null);
const [worker, setWorker] = useState(null);
const [messageApi, contextHolder] = message.useMessage();

function spawnWorker() {
let worker = new Worker(
new URL("../../workers/worker.js", import.meta.url),
Expand Down Expand Up @@ -211,7 +214,13 @@ export const Deploy = () => {
deploymentError !== null ? deploymentError : "";
const feeString = () => (deploymentFee !== null ? deploymentFee : "");
const peerUrl = () => (deployUrl !== null ? deployUrl : "");

const generateKey = () => {
form.setFieldValue(
"private_key",
new aleoWASM.PrivateKey().to_string()
);
form.validateFields(["private_key"]);
};
return (
<Card
title="Deploy Program"
Expand Down Expand Up @@ -246,17 +255,14 @@ export const Deploy = () => {
<Divider />
<Form.Item
label="Private Key"
name="private_key"
colon={false}
validateStatus={status}
>
<Input.TextArea
name="private_key"
size="small"
placeholder="Private Key"
allowClear
onChange={onPrivateKeyChange}
value={privateKeyString()}
/>
<Input.Search
enterButton="Generate Random Key"
onSearch={generateKey}
/>
</Form.Item>
<Form.Item
label="Peer Url"
Expand Down

0 comments on commit de1027e

Please sign in to comment.