import { currentAccount , EthApi } from "@joincivil/ethapi" ; import * as process from "process" ; import "rxjs/add/operator/distinctUntilChanged" ; import { Artifact , artifacts } from "../../../src/contracts/generated/artifacts" ; import { NewsroomContract } from "../../../src/contracts/generated/wrappers/newsroom" ; import Web3 = require ( "web3" ) ; import { sha3 } from "web3-utils" ; const web3 = new EthApi ( new Web3 . providers . HttpProvider ( "http://localhost:8545" ) , Object . values < Artifact > ( artifacts ) . map ( a => a . abi ) ) ; ( async ( ) => { const account = ( await currentAccount ( web3 ) ) ! ; const gas = await web3 . getGasPriceString ( ) ; const data = { from : account , gasPrice : gas , } ; console . log ( "Deploying contract" ) ; const deployTxHash = await NewsroomContract . deployTrusted . sendTransactionAsync ( web3 , "My Test Newsroom" , "http://foo.bar" , sha3 ( "test" ) , data ) ; console . log ( "deployed contract" , deployTxHash ) ; } ) ( ) . catch ( err => { console . error ( err ) ; process . exit ( 1 ) ; } ) ;