mirror of
https://github.com/luxfhe/permit.git
synced 2026-10-30 17:10:15 +00:00
36 lines
1013 B
HTML
36 lines
1013 B
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title></title>
|
|
<!-- <script id="luxfhejs" src="../dist/luxfhe.umd.min.js"></script>-->
|
|
</head>
|
|
<body>
|
|
<button id="fetch">Fetch</button>
|
|
<div id="output"></div>
|
|
</body>
|
|
<script type="module">
|
|
import { ethers } from "https://cdnjs.cloudflare.com/ajax/libs/ethers/6.7.0/ethers.min.js";
|
|
import { luxfhejs } from "../dist/luxfhe.esm.min.js";
|
|
async function doFetch() {
|
|
const provider = new ethers.JsonRpcProvider("http://localhost:8547");
|
|
const resp = new luxfhejs.LuxFHEClient({provider});
|
|
|
|
let x = await resp.encrypt_uint8(3);
|
|
|
|
return `encrypted u8: ${JSON.stringify(x)}`;
|
|
}
|
|
|
|
function setOutput(text) {
|
|
document.getElementById("output").innerText = text;
|
|
}
|
|
|
|
document.getElementById("fetch").onclick = (evt) => {
|
|
evt.target.style.display = "none";
|
|
|
|
doFetch()
|
|
.then((res) => setOutput(`result: ${res}`))
|
|
.catch((err) => setOutput(`error: ${err}`));
|
|
};
|
|
</script>
|
|
</html>
|