add simple provider

pull/7/head
Iuri Matias 7 years ago
parent a8d8f41d25
commit 88fd06d55a
  1. 3
      package.json
  2. 5
      run.js
  3. 10
      src/deployer.js
  4. 163
      src/provider.js

@ -41,10 +41,11 @@
"change-case": "^3.0.1",
"colors": "^1.1.2",
"commander": "^2.13.0",
"ethereumjs-util": "^5.1.5",
"ethereumjs-vm": "^2.3.2",
"remix-lib": "latest",
"remix-solidity": "latest",
"standard": "^10.0.3",
"web3": "^1.0.0-beta.27"
"web3": "1.0.0-beta.27"
}
}

@ -3,9 +3,12 @@ const Web3 = require('web3')
const RemixTests = require('./index.js')
const fs = require('fs')
const Provider = require('./src/provider.js')
commander.action(function (filename) {
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'))
let isDirectory = fs.lstatSync(filename).isDirectory()

@ -79,10 +79,16 @@ function deployAll (compileResult, web3, callback) {
let deployObject = contractObject.deploy({arguments: [], data: contractCode})
deployObject.estimateGas().then((gasValue) => {
console.dir("got gas estimation " + gasValue);
console.dir(accounts);
deployObject.send({
from: accounts[0],
gas: Math.ceil(gasValue * 1.1)
}).on('receipt', function (receipt) {
console.dir("==== got the receipt");
console.dir(receipt);
contractObject.options.address = receipt.contractAddress
contractObject.options.from = accounts[0]
contractObject.options.gas = 5000 * 1000
@ -91,6 +97,10 @@ function deployAll (compileResult, web3, callback) {
contracts[contractName] = contractObject
nextEach()
}).on('error', function(err) {
console.dir("===============");
console.dir("error");
console.dir(err);
})
})
}, function () {

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save