diff --git a/CHANGELOG.md b/CHANGELOG.md index ccd71f9..4fc1179 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ +### 2.2.0 (2022-12-21) + +* add method `listTransfers()` +* fix url path for `getMove()`, `move()`, `listMoves()` and `updateAccountName()` +* update documentation + ### 2.1.0 (2022-12-02) -* add sub-account methods: `createAccount`, `updateAccountName`, `listAccountPendingTransactions`, `listAccountTransactions`, `listAccountBalances`, `getMove`, `move`, `listMoves` +* add sub-account methods: `createAccount()`, `updateAccountName()`, `listAccountPendingTransactions()`, `listAccountTransactions()`, `listAccountBalances()`, `getMove()`, `move()`, `listMoves()` * fix method `getBalance()` to take optional parameter `asset` as string or array * remove method `getTransaction()`, which was deprecated * update tests @@ -27,7 +33,7 @@ ### 1.9.0 (2021-12-06) -* Add methods getOrderListV2, getOrderV2, getOrderV3 +* Add methods `getOrderListV2()`, `getOrderV2()`, `getOrderV3()` ### 1.8.0 (2020-10-13) @@ -44,8 +50,8 @@ ### 1.6.0 -* Add options to postBuyOrder, postMarketBuyOrder, postSellOrder and postMarketSellOrder -* Add getFeeInfo method +* Add options to `postBuyOrder()`, `postMarketBuyOrder()`, `postSellOrder()` and `postMarketSellOrder()` +* Add `getFeeInfo()` method ### 1.5.1 @@ -53,11 +59,11 @@ ### 1.5.0 -* Add getOrder method +* Add `getOrder()` method ### 1.4.2 -* Make asset parameter optional for getBalance +* Make `asset` parameter optional for `getBalance()` ### 1.4.1 @@ -65,19 +71,19 @@ ### 1.4.0 -* Add pair option to getTicker, getOrderBook and getTrades -* Add getAllTickers method +* Add `pair` option to `getTicker()`, `getOrderBook()` and `getTrades()` +* Add `getAllTickers()` method ### 1.3.0 -* Add createFundingAddress method -* Add getTransactions method -* Accept address option for getFundingAddress -* Accept state option for getOrderList -* Add getWithdrawals method -* Add getWithdrawal method -* Add requestWithdrawal method -* Add cancelWithdrawal method +* Add `createFundingAddress()` method +* Add `getTransactions()` method +* Accept `address` option for `getFundingAddress()` +* Accept `state` option for `getOrderList()` +* Add `getWithdrawals()` method +* Add `getWithdrawal()` method +* Add `requestWithdrawal()` method +* Add `cancelWithdrawal()` method ### 1.2.1 @@ -85,14 +91,14 @@ ### 1.2.0 -* Add getFundingAddress method +* Add `getFundingAddress()` method ### 1.1.0 * Support multiple currency pairs -* BitX.getLimits is now deprecated (use BitX.getBalance instead). +* `BitX.getLimits()` is now deprecated (use `BitX.getBalance()` instead). * Updated to the latest BitX API. -* Added BitX.getBalance method. +* Added `BitX.getBalance()` method. ### 1.0.1 diff --git a/README.md b/README.md index 7bf7d55..777034e 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Example: luno.listAccountBalances(['XBT', 'ETH'], function (err, response) {}) ``` -### getMove([options][, callback]) +### getMove(options[, callback]) GET https://api.luno.com/api/exchange/1/move Example: @@ -366,7 +366,17 @@ GET https://api.luno.com/api/exchange/2/orders/{orderId} Example: ```javascript -luno.getOrder('BXHW6PFRRXKFSB4', function (err, result) {}) +luno.getOrderV2('BXHW6PFRRXKFSB4', function (err, result) {}) +``` + +### getOrderV3(options[, callback]) +GET https://api.luno.com/api/exchange/3/orders/{orderId} + +Example: + +```javascript +luno.getOrderV3({ id: 'BXMC2CJ7HNB88U4' }, function (err, result) {}) +luno.getOrderV3({ client_order_id: 'lmt-53960812' }, function (err, result) {}) ``` ### getTransactions(asset[, options][, callback]) @@ -422,6 +432,15 @@ Example: luno.cancelWithdrawal('1212', function (err, withdrawal) {}) ``` +### listTransfers(id[, options][, callback]) +GET https://api.luno.com/api/exchange/1/transfers + +Example: + +```javascript +luno.listTransfers(1212, { limit: 986 }, function (err, data) {}) +``` + ## Contributing Open a pull request or create an issue and help me improve it. diff --git a/lib/luno.js b/lib/luno.js index e178299..a9260d3 100644 --- a/lib/luno.js +++ b/lib/luno.js @@ -210,7 +210,7 @@ Luno.prototype.createAccount = function (currency, name, callback) { Luno.prototype.updateAccountName = function (id, name, callback) { let params = { name } - return this._request('PUT', `/api/1/accounts/${id}`, params, callback) + return this._request('PUT', `/api/1/accounts/${id}/name`, params, callback) } Luno.prototype.listAccountPendingTransactions = function (id, callback) { @@ -228,7 +228,7 @@ Luno.prototype.listAccountBalances = function (assets = [], callback) { } Luno.prototype.getMove = function (options, callback) { - return this._request('GET', `/api/1/move`, options, callback) + return this._request('GET', `/api/exchange/1/move`, options, callback) } Luno.prototype.move = function (amount, debit_account_id, credit_account_id, options, callback) { @@ -238,11 +238,11 @@ Luno.prototype.move = function (amount, debit_account_id, credit_account_id, opt credit_account_id, }, options, callback) - return this._request('POST', `/api/1/move`, params, cb) + return this._request('POST', `/api/exchange/1/move`, params, cb) } Luno.prototype.listMoves = function (options, callback) { - return this._request('GET', `/api/1/move/list_moves`, options, callback) + return this._request('GET', `/api/exchange/1/move/list_moves`, options, callback) } Luno.prototype.getTicker = function (options, callback) { @@ -422,4 +422,12 @@ Luno.prototype.cancelWithdrawal = function (id, callback) { return this._request('DELETE', `/api/1/withdrawals/${id}`, null, callback) } +Luno.prototype.listTransfers = function (id, options, callback) { + let [params, cb] = defaults({ + account_id: id, + }, options, callback) + + return this._request('GET', '/api/exchange/1/transfers', params, cb) +} + module.exports = Luno diff --git a/package-lock.json b/package-lock.json index a77ec69..3709bb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "luno-api-node", - "version": "2.1.0", + "version": "2.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "luno-api-node", - "version": "2.1.0", + "version": "2.2.0", "license": "MIT", "dependencies": { "debug": "^4.3.4" diff --git a/package.json b/package.json index 560726e..04e6f50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "luno-api-node", - "version": "2.1.0", + "version": "2.2.0", "author": "dutu@protonmail.com", "description": "A simple wrapper for the Luno API.", "license": "MIT",