Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Revise for armlet 2.0.0
Browse files Browse the repository at this point in the history
Note: we will need to change remove git version  in package.json before release
  • Loading branch information
rocky committed Feb 18, 2019
1 parent 50fcf14 commit b490be1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 3 additions & 5 deletions helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ const doAnalysis = async (client, config, jsonFiles, contractNames = null, limit

// request analysis to armlet.
try {
debugger
const {issues, status} = await client.analyzeWithStatus(analyzeOpts);
if (config.debug) {
config.logger.debug(`UUID for this job is ${status.uuid}`);
Expand Down Expand Up @@ -356,11 +357,9 @@ const getNotFoundContracts = (mythXIssuesObjects, contracts) => {
return contracts.filter(c => !mythxContracts.includes(c));
}

const getArmletClient = (apiKey, ethAddress, password, clientToolName = 'truffle') => {
const getArmletClient = (ethAddress, password, clientToolName = 'truffle') => {
const options = { clientToolName };
if (apiKey) {
options.apiKey = apiKey;
} else if (password && ethAddress) {
if (password && ethAddress) {
options.ethAddress = ethAddress;
options.password = password;
} else if (!password && !ethAddress) {
Expand Down Expand Up @@ -388,7 +387,6 @@ async function analyze(config) {
}

const client = getArmletClient(
process.env.MYTHX_API_KEY,
process.env.MYTHX_ETH_ADDRESS,
process.env.MYTHX_PASSWORD
)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.1",
"description": "MythX security analysis plugin for Truffle Framework",
"dependencies": {
"armlet": "^1.2.0",
"armlet": "git+ssh://git@github.com:consensys/armlet.git",
"configstore": "^4.0.0",
"js-yaml": "^3.12.1",
"mocha": "^5.2.0",
Expand Down
5 changes: 4 additions & 1 deletion test/test_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ describe('helpers.js', function() {
let armletClient, stubAnalyze, debuggerStub;

beforeEach(() => {
armletClient = new armlet.Client({ apiKey: 'test' });
armletClient = new armlet.Client({
ethAddress: rewiredHelpers.trialEthAddress,
password: rewiredHelpers.trialPassword
});
stubAnalyze = sinon.stub(armletClient, 'analyzeWithStatus');
debuggerStub = sinon.stub();
});
Expand Down

0 comments on commit b490be1

Please sign in to comment.