Current account, clean up a bit
This commit is contained in:
parent
b082fff400
commit
5a3190cdec
|
@ -24,10 +24,11 @@ truffle console
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
x Import contracts and run migrations
|
x Import contracts and run migrations
|
||||||
x Setup basic UI
|
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)
|
- Get basic cheque sending working (web3 provider, util code)
|
||||||
- Showcase swap basic operation for two nodes
|
- Showcase swap basic operation for two nodes
|
||||||
|
|
|
@ -20,9 +20,15 @@
|
||||||
<p class="text-center">Loading...</p>
|
<p class="text-center">Loading...</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="content" style="display: none;">
|
<div id="content" style="display: none;">
|
||||||
|
|
||||||
|
<div id="current">
|
||||||
|
<h2>Current account</h2>
|
||||||
|
<p id="currentAddress"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="alice">
|
<div id="alice">
|
||||||
<h2>Alice</h2>
|
<h2>Alice</h2>
|
||||||
<p id="accountAddress"></p>
|
<p id="aliceAddress"></p>
|
||||||
<p id="aliceETHBalance"></p>
|
<p id="aliceETHBalance"></p>
|
||||||
<p id="aliceERC20Balance"></p>
|
<p id="aliceERC20Balance"></p>
|
||||||
|
|
||||||
|
@ -59,7 +65,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="bob">
|
<div id="bob">
|
||||||
<h2>Bob</h2>
|
<h2>Bob</h2>
|
||||||
|
<p id="bobAddress"></p>
|
||||||
|
<p id="bobETHBalance"></p>
|
||||||
|
<p id="bobERC20Balance"></p>
|
||||||
<p>
|
<p>
|
||||||
<form onSubmit="App.redeemCheque(); return false;">
|
<form onSubmit="App.redeemCheque(); return false;">
|
||||||
<button type="submit" class="btn btn-primary">Redeem cheque</button>
|
<button type="submit" class="btn btn-primary">Redeem cheque</button>
|
||||||
|
|
|
@ -117,12 +117,19 @@ App = {
|
||||||
loader.show();
|
loader.show();
|
||||||
content.hide();
|
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
|
// Load account data
|
||||||
|
// XXX Assuming first account is Alice, not true when switching accounts
|
||||||
aliceAddress = await web3.eth.accounts[0];
|
aliceAddress = await web3.eth.accounts[0];
|
||||||
App.aliceAddress = aliceAddress;
|
App.aliceAddress = aliceAddress;
|
||||||
$("#accountAddress").html("Address: " + aliceAddress);
|
$("#aliceAddress").html("Address: " + aliceAddress);
|
||||||
console.log("aliceAddress", aliceAddress)
|
console.log("aliceAddress", aliceAddress)
|
||||||
|
|
||||||
|
|
||||||
web3.eth.getBalance(
|
web3.eth.getBalance(
|
||||||
App.aliceAddress,
|
App.aliceAddress,
|
||||||
function(err, res) {
|
function(err, res) {
|
||||||
|
|
Loading…
Reference in New Issue