1.0.10 • Published 6 years ago

testiero v1.0.10

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

testiero

ultra-opinionated Solidity testing library

Setup

npm i testiero

Usage

We have a Solidity file called MyContractFile.sol

pragma ^4.20
contract MyContract {
  function MyContract(uint a, address b) {
    //doing stuff here
  }
}

In our Javascript we do

const privatekey = process.env["privateKey"] // without 0x
const Testiero = require('testiero')
const testiero = new Testiero('https://ropsten.infura.io/<apiKey>', privateKey)

const sourceFileString = fs.readFileSync('./MyContractFile.sol','utf8')

//Compile it
const output = testiero.compile(sourceFileString, 'MyContract')

//Gas estimation
const estimates = output.gasEstimates.creation
console.log('Gas estimate', Number(estimates[0]) + Number(estimates[1]))

//Deploy using the compile output and passing if needed the constructor arguments array
testiero.deploy(output, [300000,"0x123.."])
.then(receipt => console.log(`deployed contract ${receipt.contractAddress} \nGas used ${receipt.gasUsed}`))
.catch(console.error)
1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago