|
|
|
@ -1,35 +1,40 @@ |
|
|
|
|
import async = require('async') |
|
|
|
|
import Web3 = require('web3') |
|
|
|
|
import assert = require('assert') |
|
|
|
|
import async from 'async' |
|
|
|
|
import Web3 from 'web3' |
|
|
|
|
import * as assert from 'assert' |
|
|
|
|
import { Provider } from 'remix-simulator' |
|
|
|
|
|
|
|
|
|
let Compiler = require('../src/compiler.js') |
|
|
|
|
let Deployer = require('../src/deployer.js') |
|
|
|
|
let TestRunner = require('../src/testRunner.ts') |
|
|
|
|
const Provider = require('remix-simulator').Provider |
|
|
|
|
|
|
|
|
|
interface Results { |
|
|
|
|
passingNum: number, |
|
|
|
|
failureNum: number, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function compileAndDeploy (filename, callback) { |
|
|
|
|
function compileAndDeploy (filename: string, callback: Function) { |
|
|
|
|
let web3 = new Web3() |
|
|
|
|
web3.setProvider(new Provider()) |
|
|
|
|
let compilationData |
|
|
|
|
let accounts |
|
|
|
|
let compilationData: Object |
|
|
|
|
let accounts: Object |
|
|
|
|
async.waterfall([ |
|
|
|
|
function getAccountList (next) { |
|
|
|
|
web3.eth.getAccounts((_err, _accounts) => { |
|
|
|
|
function getAccountList (next: Function) { |
|
|
|
|
web3.eth.getAccounts((_err: Error, _accounts: Object) => { |
|
|
|
|
accounts = _accounts |
|
|
|
|
next(_err) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
function compile (next) { |
|
|
|
|
function compile (next: Function) { |
|
|
|
|
Compiler.compileFileOrFiles(filename, false, {accounts}, next) |
|
|
|
|
}, |
|
|
|
|
function deployAllContracts (compilationResult, next) { |
|
|
|
|
try { |
|
|
|
|
compilationData = compilationResult |
|
|
|
|
Deployer.deployAll(compilationResult, web3, next) |
|
|
|
|
next() |
|
|
|
|
} catch(e) { |
|
|
|
|
throw e |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
], function (_err, contracts) { |
|
|
|
|
callback(null, compilationData, contracts, accounts) |
|
|
|
|