Skip to content

Commit

Permalink
Merge branch 'master' of github.com:walltime/walltime-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
felipelalli committed Nov 1, 2018
2 parents 97f6c77 + 5f16cdc commit db68e44
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 32 deletions.
1 change: 1 addition & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -61,4 +61,4 @@
withdraw

Use walltime <command> -h to see more info about each command.
➜ $WT_SECRET is set, remember to cleanup this later.
➜ $WT_LOCAL_STORAGE_PASSWORD is set, remember to cleanup this later.
2 changes: 1 addition & 1 deletion README.org
Expand Up @@ -47,5 +47,5 @@ The following commands, use walltime <command> -h to see more details:
withdraw

Use walltime <command> -h to see more info about each command.
➜ $WT_SECRET is set, remember to cleanup this later.
➜ $WT_LOCAL_STORAGE_PASSWORD is set, remember to cleanup this later.
#+END_SRC
28 changes: 7 additions & 21 deletions common.js
Expand Up @@ -156,27 +156,13 @@ function apiInfo(testnet) {
}

function insertOnQueue(queueUrl, message) {
var sqs = new AWS.SQS({region: 'us-east-1',
// The following credentials are PUBLIC, don't worry.
// They allow the world insert a message in our API queue.
// This is not a security flaw.
accessKeyId: "AKIAJWV7ZINCVN3ZE6KQ",
secretAccessKey: "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"});

var params = {
MessageBody: message,
QueueUrl: queueUrl,
DelaySeconds: 0
};

return new Promise(function (resolve, reject) {
sqs.sendMessage(params, function(err, data) {
if (err) {
reject(err);
} else {
resolve(data);
}
});
return axios({
method: 'post',
url: queueUrl,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: 'MessageBody=' + encodeURIComponent(message)
});
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "walltime-cli",
"version": "1.1.0",
"version": "1.2.0",
"description": "Walltime API CLI Interface",
"main": "walltime",
"scripts": {
Expand All @@ -20,7 +20,7 @@
},
"homepage": "https://github.com/walltime/walltime-cli#readme",
"dependencies": {
"aws-sdk": "^2.269.1",
"aws-sdk": "^2.274.1",
"axios": "^0.18.0",
"bip38": "^2.0.2",
"bitcoinjs-lib": "^3.3.2",
Expand Down
16 changes: 9 additions & 7 deletions walltime
Expand Up @@ -16,7 +16,7 @@ const os = require('os');
const pck = require('./package.json');
const common = require('./common');

var password = process.env.WT_SECRET;
var password = process.env.WT_LOCAL_STORAGE_PASSWORD || process.env.WT_SECRET;

const JSON_ERROR = { status : { success : false }};

Expand All @@ -35,7 +35,7 @@ var checkForPassword = function() {
if (program.json) {
console.log(JSON.stringify(JSON_ERROR));
} else {
console.error('Please, set the WT_SECRET env variable. It is required to encrypt/decrypt your credentials on disk.');
console.error('Please, set the WT_LOCAL_STORAGE_PASSWORD env variable. It is required to encrypt/decrypt your credentials on disk.');
}
}

Expand Down Expand Up @@ -118,17 +118,17 @@ program
console.log('');
console.log(colors.white.bold('*** IMPORTANT ***'));
console.log('');
console.log('To be able to use some commands, you have to set the system environment variable WT_SECRET to a secret that will be used to encrypt your credentials on disk. To keep it safe, it is recommended to clear this variable later.');
console.log('To be able to use some commands, you have to set the system environment variable WT_LOCAL_STORAGE_PASSWORD to an arbitrary secret (defined by you) that will be used ONLY to encrypt your credentials on disk. To keep it safe, it is recommended to clear this variable later.');
console.log('');
console.log('On Linux, use:');
console.log('');
console.log('\texport WT_SECRET=<yoursecret>');
console.log('\texport WT_LOCAL_STORAGE_PASSWORD=<yoursecret>');
console.log('');
console.log('On Windows, use:');
console.log('');
console.log('\tset WT_SECRET=<yoursecret>');
console.log('\tset WT_LOCAL_STORAGE_PASSWORD=<yoursecret>');
} else {
console.log(colors.green.bold('➜ $WT_SECRET is set, remember to cleanup this later.'));
console.log(colors.green.bold('➜ $WT_LOCAL_STORAGE_PASSWORD is set, remember to cleanup this later.'));
}

console.log('');
Expand Down Expand Up @@ -988,7 +988,7 @@ program
.command('withdraw <amount> <currency> <withdraw_address>', {noHelp: true})
.option('-n, --networkfee <networkfee>', 'set the network fee')
.usage('[-n <networkfee>] <amount> <currency> <withdraw_address>')
.description('Request a withdraw to our system in fiat or crypto.')
.description('Request a withdraw from our system in fiat or crypto.')
.action(function(amount, currency, withdraw_address, options) {
var error = false;

Expand All @@ -999,6 +999,8 @@ program
} else {
console.error('The network fee is necessary to xbt currency.');
}

error = true;
} else if (currency == 'xbt') {
var parsedNetworkFee = parseFloat(options.networkfee);
if (parsedNetworkFee > common.NETWORK_XBT_FEE_HARD_LIMIT_MAX
Expand Down

0 comments on commit db68e44

Please sign in to comment.