tokenbridge/e2e-commons/scripts/blocks.js

27 lines
834 B
JavaScript
Raw Normal View History

2019-06-03 16:49:40 +03:00
const Web3 = require('web3')
2019-06-04 11:28:11 +03:00
const { generateNewBlock } = require('../utils')
2019-06-03 16:49:40 +03:00
const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8541'))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8542'))
const {user, blockGenerator} = require('../constants.json');
homeWeb3.eth.accounts.wallet.add(user.privateKey)
foreignWeb3.eth.accounts.wallet.add(user.privateKey)
homeWeb3.eth.accounts.wallet.add(blockGenerator.privateKey)
foreignWeb3.eth.accounts.wallet.add(blockGenerator.privateKey)
2019-06-03 16:49:40 +03:00
function main() {
setTimeout(async () => {
generateNewBlock(homeWeb3, blockGenerator.address)
generateNewBlock(foreignWeb3, blockGenerator.address)
2019-06-03 16:49:40 +03:00
main()
}, 1000)
2019-06-03 16:49:40 +03:00
}
main()
process.on('SIGTERM', function () {
console.log('Finishing sending blocks...')
process.exit(0);
});