Last active
February 25, 2019 06:18
-
-
Save muellerberndt/aef6f92c25348a5b4a18596931a72dd4 to your computer and use it in GitHub Desktop.
Armlet Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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