Skip to content

Commit

Permalink
Merge pull request coinbase#82 from coinbase/some-bug-fixes
Browse files Browse the repository at this point in the history
Misc bugfixes
  • Loading branch information
CjS77 authored Nov 3, 2017
2 parents 605742b + 114bf87 commit 5840388
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/FXService/FXProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ export abstract class FXProvider {
return pending.then((result: FXObject) => {
this._pending[index] = undefined;
return result;
}).catch((err) => {
this._pending[index] = undefined;
return Promise.reject(err);
});
}

Expand Down
14 changes: 5 additions & 9 deletions src/consoles/gdaxConsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ program
.option('-O --orders', 'Retrieve all my open orders (if product is provided, limited to that book)')
.option('-x --cancelAllOrders', 'Cancel all open orders (if product is provided, limited to that book)')
.option('-W --crypto_withdraw [amount,cur,address]', 'Withdraw to a crypto address')
.option('--transfer [type,amount,cur,coinbase_id]', 'deposit or withdraw from/to coinbase')
.option('--transfer [type,amount,coinbase_id]', 'deposit or withdraw from/to coinbase')
.option('-X --method [method]', 'method for general request')
.option('-U --url [url]', 'request url')
.option('-P --body [body]', 'request body')
Expand Down Expand Up @@ -119,17 +119,13 @@ if (program.ticker) {
}

if (program.transfer) {
if (!requiredOptions(['product'])) {
process.exit(1);
}
let {type, amount, cur, coinbase_id} = program.transfer.split(',');
type = type.lowerCase().startsWith('dep') ? 'deposits' : 'withdrawals';
let [type, amount, coinbaseId] = program.transfer.split(',');
type = type.toLowerCase().startsWith('dep') ? 'deposit' : 'withdraw';
const options = {
amount: String(+amount),
currency: cur,
coinbase_account_id: coinbase_id
coinbase_account_id: coinbaseId
};
makeGenericRequest('POST', `${type}/coinbase-account`, JSON.stringify(options)).then((res) => {
makeGenericRequest('POST', `/transfers`, JSON.stringify(options)).then((res) => {
console.log(printSeparator());
console.log(res);
}).catch(logError);
Expand Down

0 comments on commit 5840388

Please sign in to comment.