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

Commit

Permalink
Add test and update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
passabilities committed Aug 16, 2017
1 parent d1111d6 commit 07c1d16
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ const params = {
authedClient.closePosition(params, callback);
```

* [`deposit`, `withdraw`](https://docs.gdax.com/#list-fills)
* [`deposit`, `withdraw`](https://docs.gdax.com/#deposits)

```js
// Deposit to your Exchange USD account from your Coinbase USD account.
Expand Down Expand Up @@ -406,6 +406,14 @@ const withdrawParamsBTC = {
'coinbase_account_id': '536a541fa9393bb3c7000023', // BTC Coinbase Account ID
};
authedClient.withdraw(withdrawParamsBTC, callback);

// Withdraw from your Exchange BTC account to another BTC address.
const withdrawAddressParams = {
'amount': 10.00,
'currency': 'BTC',
'crypto_address': '15USXR6S4DLhSWVHUxXRCuTkD1SA6qAdky'
}
authedClient.withdraw(withdrawAddressParams, callback);
```

* [`getTrailingVolume`](https://docs.gdax.com/#user-account)
Expand Down
28 changes: 28 additions & 0 deletions tests/authenticated.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,4 +681,32 @@ suite('AuthenticatedClient', () => {
.then(() => done())
.catch(err => assert.ifError(err) || assert.fail());
});

test('.withdrawCrypto()', done => {
const withdrawParams = {
amount: 10480,
currency: 'BTC',
crypto_address: 'test-address',
};

nock(EXCHANGE_API_URL)
.post('/withdrawals/crypto', withdrawParams)
.times(2)
.reply(200, {});

let cbtest = new Promise((resolve, reject) => {
authClient.withdrawCrypto(withdrawParams, err => {
if (err) {
reject(err);
}
resolve();
});
});

let promisetest = authClient.withdrawCrypto(withdrawParams);

Promise.all([cbtest, promisetest])
.then(() => done())
.catch(err => assert.ifError(err) || assert.fail());
});
});

0 comments on commit 07c1d16

Please sign in to comment.