Skip to content

Instantly share code, notes, and snippets.

@muellerberndt
Last active February 25, 2019 06:18
Show Gist options
  • Select an option

  • Save muellerberndt/aef6f92c25348a5b4a18596931a72dd4 to your computer and use it in GitHub Desktop.

Select an option

Save muellerberndt/aef6f92c25348a5b4a18596931a72dd4 to your computer and use it in GitHub Desktop.
Armlet Example
const armlet = require('armlet');
/* Format data for MythX API */
const data = {
contractName: contractName,
bytecode: contract.evm.bytecode.object,
sourceMap: contract.evm.deployedBytecode.sourceMap,
deployedBytecode: contract.evm.deployedBytecode.object,
deployedSourceMap: contract.evm.deployedBytecode.sourceMap,
sourceList: [ solidity_file ],
analysisMode: 'quick',
sources: {}
};
data.sources[solidity_file] = {source: solidity_code};
/* Instantiate MythX Client */
const client = new armlet.Client(
clientToolName: 'your-tool', // change this to the name of your tool for usage tracking
ethAddress: ethAddress,
password: password,
}
);
client.analyzeWithStatus({data, timeout: 300000})
.then(result => {
/* so something with the analysis results */
})
.catch(err => {
console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment