-
Notifications
You must be signed in to change notification settings - Fork 0
/
bob.js
52 lines (34 loc) · 1007 Bytes
/
bob.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$(document).ready(function(){
console.log("Hello Bob with address: " + BOB_PUB);
var bobBalance = 0
$("#bob-address").text(BOB_PUB);
// Specify to which commit-chain we want to connect
const nocustManagerBob = new NocustManager({
rpcApi: web3,
operatorApiUrl: HUB_API_URL,
contractAddress: HUB_CONTRACT_ADDRESS,
});
// Register bob's address with the commit-chain
async function register() {
// TODO !
}
const sendToALice = async () => {
var val = $("#amount").val() || 0;
val = parseInt(val);
$("#send-button").prop('disabled', true);
$("#send-button").text('⌛ Sending...');
// TODO!
$("#send-button").prop('disabled', false);
$("#send-button").text('🎁 Send to Alice');
}
async function updateBalance() {
// TODO!
}
async function main() {
await register();
// Periodically fetch balances
setInterval(updateBalance, 1500)
}
window.sendToALice = sendToALice;
main()
});