Current account, clean up a bit

This commit is contained in:
Oskar Thoren 2021-01-26 12:00:07 +08:00
parent b082fff400
commit 5a3190cdec
No known key found for this signature in database
GPG Key ID: BDB55C8C0EF29911
3 changed files with 20 additions and 4 deletions

View File

@ -24,10 +24,11 @@ truffle console
npm run dev
```
## TODOs
x Import contracts and run migrations
x Setup basic UI
- Showcase basic chequebook end to end (deposit, show balance, withdraw)
x Showcase basic chequebook end to end (deposit, show balance, withdraw)
- Get basic cheque sending working (web3 provider, util code)
- Showcase swap basic operation for two nodes

View File

@ -20,9 +20,15 @@
<p class="text-center">Loading...</p>
</div>
<div id="content" style="display: none;">
<div id="current">
<h2>Current account</h2>
<p id="currentAddress"></p>
</div>
<div id="alice">
<h2>Alice</h2>
<p id="accountAddress"></p>
<p id="aliceAddress"></p>
<p id="aliceETHBalance"></p>
<p id="aliceERC20Balance"></p>
@ -59,7 +65,9 @@
</div>
<div id="bob">
<h2>Bob</h2>
<p id="bobAddress"></p>
<p id="bobETHBalance"></p>
<p id="bobERC20Balance"></p>
<p>
<form onSubmit="App.redeemCheque(); return false;">
<button type="submit" class="btn btn-primary">Redeem cheque</button>

View File

@ -117,12 +117,19 @@ App = {
loader.show();
content.hide();
// Mark current address to not confuse Alice and Bob
currentAddress = await web3.eth.accounts[0];
$("#currentAddress").html("Address: " + currentAddress);
console.log("currentAddress", currentAddress);
// Load account data
// XXX Assuming first account is Alice, not true when switching accounts
aliceAddress = await web3.eth.accounts[0];
App.aliceAddress = aliceAddress;
$("#accountAddress").html("Address: " + aliceAddress);
$("#aliceAddress").html("Address: " + aliceAddress);
console.log("aliceAddress", aliceAddress)
web3.eth.getBalance(
App.aliceAddress,
function(err, res) {