subspace/test/test4.js

27 lines
741 B
JavaScript
Raw Normal View History

2019-08-29 19:59:53 +00:00
const Web3Eth = require('web3-eth');
let eth = new Web3Eth("ws://localhost:8545");
async function run() {
let accounts = await eth.getAccounts();
setTimeout(async () => {
await eth.sendTransaction({from: accounts[0], to: accounts[1], value: "100000000"});
await eth.sendTransaction({from: accounts[2], to: accounts[0], value: "999999999"});
await eth.sendTransaction({from: accounts[2], to: accounts[0], value: "232433434"});
}, 3000);
const EventSyncer = require('../dist/node.js');
2019-08-29 19:59:53 +00:00
const eventSyncer = new EventSyncer(eth.currentProvider);
await eventSyncer.init();
eventSyncer.trackBalance(accounts[0]).pipe().subscribe((balance) => {
console.log("accounts[0] balance is ", balance);
})
}
run()