Commit 88fd06d5 authored by Iuri Matias's avatar Iuri Matias

add simple provider

parent a8d8f41d
...@@ -41,10 +41,11 @@ ...@@ -41,10 +41,11 @@
"change-case": "^3.0.1", "change-case": "^3.0.1",
"colors": "^1.1.2", "colors": "^1.1.2",
"commander": "^2.13.0", "commander": "^2.13.0",
"ethereumjs-util": "^5.1.5",
"ethereumjs-vm": "^2.3.2", "ethereumjs-vm": "^2.3.2",
"remix-lib": "latest", "remix-lib": "latest",
"remix-solidity": "latest", "remix-solidity": "latest",
"standard": "^10.0.3", "standard": "^10.0.3",
"web3": "^1.0.0-beta.27" "web3": "1.0.0-beta.27"
} }
} }
...@@ -3,9 +3,12 @@ const Web3 = require('web3') ...@@ -3,9 +3,12 @@ const Web3 = require('web3')
const RemixTests = require('./index.js') const RemixTests = require('./index.js')
const fs = require('fs') const fs = require('fs')
const Provider = require('./src/provider.js')
commander.action(function (filename) { commander.action(function (filename) {
let web3 = new Web3() let web3 = new Web3()
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')) //web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'))
web3.setProvider(new Provider())
// web3.setProvider(new web3.providers.WebsocketProvider('http://localhost:8546')) // web3.setProvider(new web3.providers.WebsocketProvider('http://localhost:8546'))
let isDirectory = fs.lstatSync(filename).isDirectory() let isDirectory = fs.lstatSync(filename).isDirectory()
......
...@@ -79,10 +79,16 @@ function deployAll (compileResult, web3, callback) { ...@@ -79,10 +79,16 @@ function deployAll (compileResult, web3, callback) {
let deployObject = contractObject.deploy({arguments: [], data: contractCode}) let deployObject = contractObject.deploy({arguments: [], data: contractCode})
deployObject.estimateGas().then((gasValue) => { deployObject.estimateGas().then((gasValue) => {
console.dir("got gas estimation " + gasValue);
console.dir(accounts);
deployObject.send({ deployObject.send({
from: accounts[0], from: accounts[0],
gas: Math.ceil(gasValue * 1.1) gas: Math.ceil(gasValue * 1.1)
}).on('receipt', function (receipt) { }).on('receipt', function (receipt) {
console.dir("==== got the receipt");
console.dir(receipt);
contractObject.options.address = receipt.contractAddress contractObject.options.address = receipt.contractAddress
contractObject.options.from = accounts[0] contractObject.options.from = accounts[0]
contractObject.options.gas = 5000 * 1000 contractObject.options.gas = 5000 * 1000
...@@ -91,6 +97,10 @@ function deployAll (compileResult, web3, callback) { ...@@ -91,6 +97,10 @@ function deployAll (compileResult, web3, callback) {
contracts[contractName] = contractObject contracts[contractName] = contractObject
nextEach() nextEach()
}).on('error', function(err) {
console.dir("===============");
console.dir("error");
console.dir(err);
}) })
}) })
}, function () { }, function () {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment