gasgasgas/js/index.html
2023-09-03 13:52:14 +01:00

111 lines
2.9 KiB
HTML

<html>
<head>
<title>gas3</title>
<script defer src="node_modules/alpinejs/dist/cdn.min.js"></script>
<script src="node_modules/openpgp/dist/openpgp.min.js"></script>
<script src="node_modules/MimeJS/src/base64.js"></script>
<script src="node_modules/MimeJS/dist/mime-js.min.js"></script>
<script src="run.js"></script>
<script src="booteth/wallet.js"></script>
<script src="booteth/session.js"></script>
<script src="booteth/eip1193.js"></script>
<script src="registry.js"></script>
<script src="rpc.js"></script>
<script type="module" src="main.js"></script>
<script>
wallet_fallback = sessionwallet_create;
wallet_detect(ethers);
</script>
<link rel="stylesheet" type="text/css" href="style.css"></link>
</head>
<body x-data='{
needKey: false,
error: "",
lock: true,
menuSelected: "main",
}
' >
<ul id="menu"
x-data='{
keyTitle: "unlock key",
}'>
<li><a id="menuKey" href="javascript:void(null);" x-text='keyTitle' @click='menuSelected="main"' ></a>
<li><a href="javascript:void(null);" id="menuStatus" @click='menuSelected="state"'>status</a>
<div id="main"
x-show='needKey && menuSelected == "main"'
@messagestatechange.window='
if (checkState(STATE.LOCAL_KEY_PROBE, $event.detail.state)) {
needKey = true;
}
if (checkState(STATE.LOCAL_KEY_REQUEST | STATE.LOCAL_KEY_UNLOCK, $event.detail.state)) {
error = undefined;
}
if (checkState(STATE.LOCAL_KEY_REJECT, $event.detail.state)) {
error = $event.detail.s;
}
if (checkState(STATE.LOCAL_KEY_UNLOCK, $event.detail.state)) {
needKey = false;
lock = false;
}
'
>
<form onSubmit='return false;'>
<input type="password" name="passphrase" id="passphrase" /><br/>
<button id="passphraseUnlock"
x-data='{
keyTitle: "enter new pin",
}
'
x-text='keyTitle'
@messagestatechange.window='
if (checkState(STATE.LOCAL_KEY, $event.detail.state)) {
keyTitle = "unlock key with pin";
}
'
x-on:click='stateChange("unlock key request", STATE.LOCAL_KEY_REQUEST);'
></button>
<form>
<br/><span id="keyError" class="error"
x-text='error'
></span>
</div>
<div id="state"
x-show='menuSelected == "state"'
x-data='{
stateKey: "locked",
stateEvm: "disconnected",
stateBalance: "0",
stateAddress: "unknown",
}
'
@messagestatechange.window='
if (checkState(STATE.LOCAL_KEY_UNLOCK, $event.detail.state)) {
stateKey = "unlocked";
}
if (checkState(STATE.RPC_CONNECT, $event.detail.state)) {
stateEvm = "connected";
}
console.debug("state", $event.detail.s);
if (checkState(STATE.RPC_PING, $event.detail.state)) {
stateBalance = $event.detail.s["balance"];
stateAddress = $event.detail.s["address"];
stateChange("reset ping", 0, STATE.RPC_PING);
}
'
>
<dl>
<dt>Key</dt>
<dd x-text='stateKey'>
<dt>Address</dt>
<dd x-text='stateAddress'>
<dt>Balance</dt>
<dd x-text='stateBalance'>
</dl>
</div>
</body>
</html>