From fb495f5d0a8d7dd0512b607c2469c3f7b09d5e6d Mon Sep 17 00:00:00 2001
From: aisling-2 <112478306+aisling-2@users.noreply.github.com>
Date: Tue, 23 Jan 2024 15:11:54 +0900
Subject: [PATCH] v3.2.0
---
CHANGELOG.md | 51 ++-
.../bswap/bswapAddLiquidityPreview.test.js | 39 --
.../spot/bswap/bswapClaimRewards.test.js | 16 -
.../spot/bswap/bswapClaimedHistory.test.js | 16 -
.../spot/bswap/bswapGetPoolConfig.test.js | 30 --
__tests__/spot/bswap/bswapLiquidity.test.js | 13 -
.../spot/bswap/bswapLiquidityAdd.test.js | 45 ---
.../bswapLiquidityOperationRecord.test.js | 13 -
.../spot/bswap/bswapLiquidityRemove.test.js | 57 ---
__tests__/spot/bswap/bswapPools.test.js | 12 -
.../bswap/bswapRemoveLiquidityPreview.test.js | 39 --
.../spot/bswap/bswapRequestQuote.test.js | 45 ---
__tests__/spot/bswap/bswapSwap.test.js | 45 ---
__tests__/spot/bswap/bswapSwapHistory.test.js | 35 --
.../spot/bswap/bswapUnclaimedRewards.test.js | 16 -
__tests__/spot/savings/savingsAccount.test.js | 14 -
.../savings/savingsCustomizedPosition.test.js | 38 --
.../savingsFlexibleProductPosition.test.js | 31 --
.../savings/savingsFlexibleProducts.test.js | 31 --
.../savings/savingsFlexibleRedeem.test.js | 47 ---
.../savingsFlexibleUserLeftQuota.test.js | 34 --
...savingsFlexibleUserRedemptionQuota.test.js | 36 --
.../savings/savingsInterestHistory.test.js | 39 --
.../spot/savings/savingsProductList.test.js | 38 --
.../savingsPurchaseCustomizedProject.test.js | 37 --
.../savingsPurchaseFlexibleProduct.test.js | 37 --
.../savings/savingsPurchaseRecord.test.js | 38 --
.../savings/savingsRedemptionRecord.test.js | 38 --
__tests__/spot/staking/stakingHistory.test.js | 34 --
.../spot/staking/stakingProductList.test.js | 28 --
.../staking/stakingProductPosition.test.js | 28 --
.../spot/staking/stakingProductQuota.test.js | 30 --
.../staking/stakingPurchaseProduct.test.js | 36 --
.../spot/staking/stakingRedeemProduct.test.js | 34 --
.../staking/stakingSetAutoStaking.test.js | 36 --
.../spot/bswap/bswapAddLiquidityPreview.js | 11 -
examples/spot/bswap/bswapClaimRewards.js | 11 -
examples/spot/bswap/bswapClaimedHistory.js | 11 -
examples/spot/bswap/bswapGetPoolConfig.js | 11 -
examples/spot/bswap/bswapLiquidity.js | 11 -
examples/spot/bswap/bswapLiquidityAdd.js | 11 -
.../bswap/bswapLiquidityOperationRecord.js | 11 -
examples/spot/bswap/bswapLiquidityRemove.js | 11 -
examples/spot/bswap/bswapPools.js | 11 -
.../spot/bswap/bswapRemoveLiquidityPreview.js | 11 -
examples/spot/bswap/bswapRequestQuote.js | 11 -
examples/spot/bswap/bswapSwap.js | 11 -
examples/spot/bswap/bswapSwapHistory.js | 11 -
examples/spot/bswap/bswapUnclaimedRewards.js | 11 -
examples/spot/savings/savingsAccount.js | 10 -
.../spot/savings/savingsCustomizedPosition.js | 10 -
.../savings/savingsFlexibleProductPosition.js | 10 -
.../spot/savings/savingsFlexibleProducts.js | 13 -
.../spot/savings/savingsFlexibleRedeem.js | 10 -
.../savings/savingsFlexibleUserLeftQuota.js | 12 -
.../savingsFlexibleUserRedemptionQuota.js | 10 -
.../spot/savings/savingsInterestHistory.js | 10 -
examples/spot/savings/savingsProductList.js | 10 -
.../savingsPurchaseCustomizedProject.js | 10 -
.../savings/savingsPurchaseFlexibleProduct.js | 10 -
.../spot/savings/savingsPurchaseRecord.js | 10 -
.../spot/savings/savingsRedemptionRecord.js | 10 -
examples/spot/staking/stakingHistory.js | 13 -
examples/spot/staking/stakingProductList.js | 13 -
.../spot/staking/stakingProductPosition.js | 13 -
examples/spot/staking/stakingProductQuota.js | 11 -
.../spot/staking/stakingPurchaseProduct.js | 13 -
examples/spot/staking/stakingRedeemProduct.js | 13 -
.../spot/staking/stakingSetAutoStaking.js | 13 -
package-lock.json | 12 +-
package.json | 2 +-
src/modules/restful/bswap.js | 340 ------------------
src/modules/restful/index.js | 3 -
src/modules/restful/savings.js | 336 -----------------
src/modules/restful/staking.js | 195 ----------
75 files changed, 55 insertions(+), 2367 deletions(-)
delete mode 100644 __tests__/spot/bswap/bswapAddLiquidityPreview.test.js
delete mode 100644 __tests__/spot/bswap/bswapClaimRewards.test.js
delete mode 100644 __tests__/spot/bswap/bswapClaimedHistory.test.js
delete mode 100644 __tests__/spot/bswap/bswapGetPoolConfig.test.js
delete mode 100644 __tests__/spot/bswap/bswapLiquidity.test.js
delete mode 100644 __tests__/spot/bswap/bswapLiquidityAdd.test.js
delete mode 100644 __tests__/spot/bswap/bswapLiquidityOperationRecord.test.js
delete mode 100644 __tests__/spot/bswap/bswapLiquidityRemove.test.js
delete mode 100644 __tests__/spot/bswap/bswapPools.test.js
delete mode 100644 __tests__/spot/bswap/bswapRemoveLiquidityPreview.test.js
delete mode 100644 __tests__/spot/bswap/bswapRequestQuote.test.js
delete mode 100644 __tests__/spot/bswap/bswapSwap.test.js
delete mode 100644 __tests__/spot/bswap/bswapSwapHistory.test.js
delete mode 100644 __tests__/spot/bswap/bswapUnclaimedRewards.test.js
delete mode 100644 __tests__/spot/savings/savingsAccount.test.js
delete mode 100644 __tests__/spot/savings/savingsCustomizedPosition.test.js
delete mode 100644 __tests__/spot/savings/savingsFlexibleProductPosition.test.js
delete mode 100644 __tests__/spot/savings/savingsFlexibleProducts.test.js
delete mode 100644 __tests__/spot/savings/savingsFlexibleRedeem.test.js
delete mode 100644 __tests__/spot/savings/savingsFlexibleUserLeftQuota.test.js
delete mode 100644 __tests__/spot/savings/savingsFlexibleUserRedemptionQuota.test.js
delete mode 100644 __tests__/spot/savings/savingsInterestHistory.test.js
delete mode 100644 __tests__/spot/savings/savingsProductList.test.js
delete mode 100644 __tests__/spot/savings/savingsPurchaseCustomizedProject.test.js
delete mode 100644 __tests__/spot/savings/savingsPurchaseFlexibleProduct.test.js
delete mode 100644 __tests__/spot/savings/savingsPurchaseRecord.test.js
delete mode 100644 __tests__/spot/savings/savingsRedemptionRecord.test.js
delete mode 100644 __tests__/spot/staking/stakingHistory.test.js
delete mode 100644 __tests__/spot/staking/stakingProductList.test.js
delete mode 100644 __tests__/spot/staking/stakingProductPosition.test.js
delete mode 100644 __tests__/spot/staking/stakingProductQuota.test.js
delete mode 100644 __tests__/spot/staking/stakingPurchaseProduct.test.js
delete mode 100644 __tests__/spot/staking/stakingRedeemProduct.test.js
delete mode 100644 __tests__/spot/staking/stakingSetAutoStaking.test.js
delete mode 100644 examples/spot/bswap/bswapAddLiquidityPreview.js
delete mode 100644 examples/spot/bswap/bswapClaimRewards.js
delete mode 100644 examples/spot/bswap/bswapClaimedHistory.js
delete mode 100644 examples/spot/bswap/bswapGetPoolConfig.js
delete mode 100644 examples/spot/bswap/bswapLiquidity.js
delete mode 100644 examples/spot/bswap/bswapLiquidityAdd.js
delete mode 100644 examples/spot/bswap/bswapLiquidityOperationRecord.js
delete mode 100644 examples/spot/bswap/bswapLiquidityRemove.js
delete mode 100644 examples/spot/bswap/bswapPools.js
delete mode 100644 examples/spot/bswap/bswapRemoveLiquidityPreview.js
delete mode 100644 examples/spot/bswap/bswapRequestQuote.js
delete mode 100644 examples/spot/bswap/bswapSwap.js
delete mode 100644 examples/spot/bswap/bswapSwapHistory.js
delete mode 100644 examples/spot/bswap/bswapUnclaimedRewards.js
delete mode 100644 examples/spot/savings/savingsAccount.js
delete mode 100644 examples/spot/savings/savingsCustomizedPosition.js
delete mode 100644 examples/spot/savings/savingsFlexibleProductPosition.js
delete mode 100644 examples/spot/savings/savingsFlexibleProducts.js
delete mode 100644 examples/spot/savings/savingsFlexibleRedeem.js
delete mode 100644 examples/spot/savings/savingsFlexibleUserLeftQuota.js
delete mode 100644 examples/spot/savings/savingsFlexibleUserRedemptionQuota.js
delete mode 100644 examples/spot/savings/savingsInterestHistory.js
delete mode 100644 examples/spot/savings/savingsProductList.js
delete mode 100644 examples/spot/savings/savingsPurchaseCustomizedProject.js
delete mode 100644 examples/spot/savings/savingsPurchaseFlexibleProduct.js
delete mode 100644 examples/spot/savings/savingsPurchaseRecord.js
delete mode 100644 examples/spot/savings/savingsRedemptionRecord.js
delete mode 100644 examples/spot/staking/stakingHistory.js
delete mode 100644 examples/spot/staking/stakingProductList.js
delete mode 100644 examples/spot/staking/stakingProductPosition.js
delete mode 100644 examples/spot/staking/stakingProductQuota.js
delete mode 100644 examples/spot/staking/stakingPurchaseProduct.js
delete mode 100644 examples/spot/staking/stakingRedeemProduct.js
delete mode 100644 examples/spot/staking/stakingSetAutoStaking.js
delete mode 100644 src/modules/restful/bswap.js
delete mode 100644 src/modules/restful/savings.js
delete mode 100644 src/modules/restful/staking.js
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9ee17d3e..654d35c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,12 +1,57 @@
# Changelog
+## 3.2.0 - 2024-01-23
+
+### Changed
+- Updated `follow-redirects` dependency
+
+### Removed
+- Deprecated Savings endpoints:
+ - `GET /sapi/v1/lending/daily/product/list`
+ - `GET /sapi/v1/lending/daily/userLeftQuota`
+ - `POST /sapi/v1/lending/daily/purchase`
+ - `GET /sapi/v1/lending/daily/userRedemptionQuota`
+ - `POST /sapi/v1/lending/daily/redeem`
+ - `GET /sapi/v1/lending/daily/token/position`
+ - `GET /sapi/v1/lending/project/list`
+ - `POST /sapi/v1/lending/customizedFixed/purchase`
+ - `GET /sapi/v1/lending/union/account`
+ - `GET /sapi/v1/lending/union/purchaseRecord`
+ - `GET /sapi/v1/lending/union/redemptionRecord`
+ - `GET /sapi/v1/lending/union/interestHistory`
+ - `GET /sapi/v1/lending/project/position/list`
+
+- Deprecated Staking endpoints:
+ - `GET /sapi/v1/staking/productList`
+ - `POST /sapi/v1/staking/purchase`
+ - `POST /sapi/v1/staking/redeem`
+ - `GET /sapi/v1/staking/position`
+ - `GET /sapi/v1/staking/stakingRecord`
+ - `POST /sapi/v1/staking/setAutoStaking`
+ - `GET /sapi/v1/staking/personalLeftQuota`
+
+- Deprecated BSwap endpoints:
+ - `GET /sapi/v1/bswap/pools`
+ - `GET /sapi/v1/bswap/liquidity`
+ - `POST /sapi/v1/bswap/liquidityAdd`
+ - `POST /sapi/v1/bswap/liquidityRemove`
+ - `GET /sapi/v1/bswap/liquidityOps`
+ - `GET /sapi/v1/bswap/quote`
+ - `POST /sapi/v1/bswap/swap`
+ - `GET /sapi/v1/bswap/swap`
+ - `GET /sapi/v1/bswap/poolConfigure`
+ - `GET /sapi/v1/bswap/addLiquidityPreview`
+ - `GET /sapi/v1/bswap/removeLiquidityPreview`
+ - `GET /sapi/v1/bswap/unclaimedRewards`
+ - `POST /sapi/v1/bswap/claimRewards`
+ - `GET /sapi/v1/bswap/claimedHistory`
## 3.1.0 - 2023-12-18
### Added
-- Add Auto Invest endpoints
-- `GET /sapi/v1/margin/available-inventory` Query margin available inventory
-- `POST /sapi/v1/margin/manual-liquidation` Margin manual liquidation
+- Add Auto Invest endpoints:
+ - `GET /sapi/v1/margin/available-inventory` Query margin available inventory
+ - `POST /sapi/v1/margin/manual-liquidation` Margin manual liquidation
### Changed
- Update dependencies
diff --git a/__tests__/spot/bswap/bswapAddLiquidityPreview.test.js b/__tests__/spot/bswap/bswapAddLiquidityPreview.test.js
deleted file mode 100644
index 45f86d7d..00000000
--- a/__tests__/spot/bswap/bswapAddLiquidityPreview.test.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const { mockResponse, recvWindow } = require('../../testUtils/mockData')
-
-describe('#bswapAddLiquidityPreview', () => {
- it.each`
- poolId | type | quoteAsset | quoteQty
- ${''} | ${''} | ${''} | ${''}
- ${undefined} | ${undefined} | ${undefined} | ${undefined}
- ${''} | ${'SINGLE'} | ${'USDT'} | ${0.1}
- ${2} | ${''} | ${'USDT'} | ${0.1}
- ${2} | ${'SINGLE'} | ${''} | ${0.1}
- ${2} | ${'SINGLE'} | ${'USDT'} | ${''}
- `('throw MissingParameterError', ({ poolId, type, quoteAsset, quoteQty }) => {
- expect(() => {
- SpotClient.bswapAddLiquidityPreview(poolId, type, quoteAsset, quoteQty)
- }).toThrow(MissingParameterError)
- })
-
- it('should add liquidity preview', () => {
- const poolId = 2
- const type = 'COMBINATION'
- const quoteAsset = 'USDT'
- const quoteQty = 0.1
- const parameters = { recvWindow }
- nockMock(`/sapi/v1/bswap/addLiquidityPreview?${buildQueryString({ poolId, type, quoteAsset, quoteQty, ...parameters })}`)(mockResponse)
-
- return SpotClient.bswapAddLiquidityPreview(poolId, type, quoteAsset, quoteQty, parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapClaimRewards.test.js b/__tests__/spot/bswap/bswapClaimRewards.test.js
deleted file mode 100644
index 6bcd312c..00000000
--- a/__tests__/spot/bswap/bswapClaimRewards.test.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* global describe, it, expect */
-const { nockPostMock, SpotClient } = require('../../testUtils/testSetup')
-
-const {
- mockResponse
-} = require('../../testUtils/mockData')
-
-describe('#bswapClaimRewards', () => {
- it('should post to claim swap rewards or liquidity rewards', () => {
- nockPostMock('/sapi/v1/bswap/claimRewards')(mockResponse)
- return SpotClient.bswapClaimRewards().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapClaimedHistory.test.js b/__tests__/spot/bswap/bswapClaimedHistory.test.js
deleted file mode 100644
index e0ecb68b..00000000
--- a/__tests__/spot/bswap/bswapClaimedHistory.test.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, SpotClient } = require('../../testUtils/testSetup')
-
-const {
- mockResponse
-} = require('../../testUtils/mockData')
-
-describe('#bswapClaimedHistory', () => {
- it('should get history of claimed rewards.', () => {
- nockMock('/sapi/v1/bswap/claimedHistory')(mockResponse)
- return SpotClient.bswapClaimedHistory().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapGetPoolConfig.test.js b/__tests__/spot/bswap/bswapGetPoolConfig.test.js
deleted file mode 100644
index f3f103ef..00000000
--- a/__tests__/spot/bswap/bswapGetPoolConfig.test.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- recvWindow
-} = require('../../testUtils/mockData')
-
-describe('#bswapGetPoolConfig', () => {
- it('should return pool config when no parameter attached', () => {
- nockMock('/sapi/v1/bswap/poolConfigure')(mockResponse)
- return SpotClient.bswapGetPoolConfig().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-
- it('should return pool config', () => {
- const parameters = {
- poolId: 1,
- recvWindow
- }
-
- nockMock(`/sapi/v1/bswap/poolConfigure?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.bswapGetPoolConfig(parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapLiquidity.test.js b/__tests__/spot/bswap/bswapLiquidity.test.js
deleted file mode 100644
index f4d31b88..00000000
--- a/__tests__/spot/bswap/bswapLiquidity.test.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, SpotClient } = require('../../testUtils/testSetup')
-const { mockResponse } = require('../../testUtils/mockData')
-
-describe('#bswapLiquidity', () => {
- it('should get swap liquidity', () => {
- nockMock('/sapi/v1/bswap/liquidity')(mockResponse)
- return SpotClient.bswapLiquidity().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapLiquidityAdd.test.js b/__tests__/spot/bswap/bswapLiquidityAdd.test.js
deleted file mode 100644
index 0109b8f0..00000000
--- a/__tests__/spot/bswap/bswapLiquidityAdd.test.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const { nockPostMock, SpotClient, buildQueryString } = require('../../testUtils/testSetup')
-const {
- asset,
- quantity,
- recvWindow,
- mockResponse
-} = require('../../testUtils/mockData')
-
-describe('#bswapLiquidityAdd', () => {
- describe('throw MissingParameterError', () => {
- it('missing poolId', () => {
- expect(() => {
- SpotClient.bswapLiquidityAdd('', asset, quantity)
- }).toThrow(MissingParameterError)
- })
-
- it('missing asset', () => {
- expect(() => {
- SpotClient.bswapLiquidityAdd(1, '', quantity)
- }).toThrow(MissingParameterError)
- })
-
- it('missing quantity', () => {
- expect(() => {
- SpotClient.bswapLiquidityAdd('', asset, '')
- }).toThrow(MissingParameterError)
- })
- })
-
- it('should add liquidity to swappool', () => {
- const parameters = {
- poolId: 1,
- asset,
- quantity
- }
-
- nockPostMock(`/sapi/v1/bswap/liquidityAdd?${buildQueryString({ recvWindow, ...parameters })}`)(mockResponse)
- return SpotClient.bswapLiquidityAdd(1, asset, quantity, { recvWindow }).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapLiquidityOperationRecord.test.js b/__tests__/spot/bswap/bswapLiquidityOperationRecord.test.js
deleted file mode 100644
index f3776b4b..00000000
--- a/__tests__/spot/bswap/bswapLiquidityOperationRecord.test.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, SpotClient } = require('../../testUtils/testSetup')
-const { mockResponse } = require('../../testUtils/mockData')
-
-describe('#bswapLiquidityOperationRecord', () => {
- it('should get swap liquidity ops records', () => {
- nockMock('/sapi/v1/bswap/liquidityOps')(mockResponse)
- return SpotClient.bswapLiquidityOperationRecord().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapLiquidityRemove.test.js b/__tests__/spot/bswap/bswapLiquidityRemove.test.js
deleted file mode 100644
index f175840f..00000000
--- a/__tests__/spot/bswap/bswapLiquidityRemove.test.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- asset,
- quantity,
- recvWindow
-} = require('../../testUtils/mockData')
-
-const type = 'SINGLE'
-const shareAmount = quantity
-
-describe('#bswapLiquidityRemove', () => {
- describe('throw MissingParameterError', () => {
- it('missing poolId', () => {
- expect(() => {
- SpotClient.bswapLiquidityRemove('', type, asset, shareAmount)
- }).toThrow(MissingParameterError)
- })
-
- it('missing type', () => {
- expect(() => {
- SpotClient.bswapLiquidityRemove(1, '', asset, shareAmount)
- }).toThrow(MissingParameterError)
- })
-
- it('missing asset', () => {
- expect(() => {
- SpotClient.bswapLiquidityRemove(1, type, '', shareAmount)
- }).toThrow(MissingParameterError)
- })
-
- it('missing shareAmount', () => {
- expect(() => {
- SpotClient.bswapLiquidityRemove(1, type, asset, '')
- }).toThrow(MissingParameterError)
- })
- })
-
- it('should remove liquidity from swappool', () => {
- const parameters = {
- poolId: 1,
- type,
- asset,
- shareAmount,
- recvWindow
- }
-
- nockPostMock(`/sapi/v1/bswap/liquidityRemove?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.bswapLiquidityRemove(1, type, asset, shareAmount, { recvWindow }).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapPools.test.js b/__tests__/spot/bswap/bswapPools.test.js
deleted file mode 100644
index 19407e15..00000000
--- a/__tests__/spot/bswap/bswapPools.test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, SpotClient } = require('../../testUtils/testSetup')
-const { mockResponse } = require('../../testUtils/mockData')
-describe('#bswapPools', () => {
- it('should get all swap pools', () => {
- nockMock('/sapi/v1/bswap/pools')(mockResponse)
- return SpotClient.bswapPools().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapRemoveLiquidityPreview.test.js b/__tests__/spot/bswap/bswapRemoveLiquidityPreview.test.js
deleted file mode 100644
index 75bc0fe9..00000000
--- a/__tests__/spot/bswap/bswapRemoveLiquidityPreview.test.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const { mockResponse, recvWindow } = require('../../testUtils/mockData')
-
-describe('#bswapRemoveLiquidityPreview', () => {
- it.each`
- poolId | type | quoteAsset | shareAmount
- ${''} | ${''} | ${''} | ${''}
- ${undefined} | ${undefined} | ${undefined} | ${undefined}
- ${''} | ${'SINGLE'} | ${'USDT'} | ${0.1}
- ${2} | ${''} | ${'USDT'} | ${0.1}
- ${2} | ${'SINGLE'} | ${''} | ${0.1}
- ${2} | ${'SINGLE'} | ${'USDT'} | ${''}
- `('throw MissingParameterError', ({ poolId, type, quoteAsset, shareAmount }) => {
- expect(() => {
- SpotClient.bswapRemoveLiquidityPreview(poolId, type, quoteAsset, shareAmount)
- }).toThrow(MissingParameterError)
- })
-
- it('should remove liquidity preview', () => {
- const poolId = 2
- const type = 'COMBINATION'
- const quoteAsset = 'USDT'
- const shareAmount = 0.1
- const parameters = { recvWindow }
- nockMock(`/sapi/v1/bswap/removeLiquidityPreview?${buildQueryString({ poolId, type, quoteAsset, shareAmount, ...parameters })}`)(mockResponse)
-
- return SpotClient.bswapRemoveLiquidityPreview(poolId, type, quoteAsset, shareAmount, parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapRequestQuote.test.js b/__tests__/spot/bswap/bswapRequestQuote.test.js
deleted file mode 100644
index efa8fef1..00000000
--- a/__tests__/spot/bswap/bswapRequestQuote.test.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-const { mockResponse, recvWindow } = require('../../testUtils/mockData')
-
-const quoteAsset = 'USDT'
-const baseAsset = 'BUSD'
-const quoteQty = 1
-
-describe('#bswapRequestQuote', () => {
- describe('throw MissingParameterError', () => {
- it('missing quoteAsset', () => {
- expect(() => {
- SpotClient.bswapRequestQuote('', baseAsset, quoteQty)
- }).toThrow(MissingParameterError)
- })
-
- it('missing baseAsset', () => {
- expect(() => {
- SpotClient.bswapRequestQuote(quoteAsset, '', quoteQty)
- }).toThrow(MissingParameterError)
- })
-
- it('missing quoteQty', () => {
- expect(() => {
- SpotClient.bswapRequestQuote(quoteAsset, baseAsset, '')
- }).toThrow(MissingParameterError)
- })
- })
-
- it('should request a quote', () => {
- const parameters = {
- quoteAsset,
- baseAsset,
- quoteQty,
- recvWindow
- }
-
- nockMock(`/sapi/v1/bswap/quote?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.bswapRequestQuote(quoteAsset, baseAsset, quoteQty, { recvWindow }).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapSwap.test.js b/__tests__/spot/bswap/bswapSwap.test.js
deleted file mode 100644
index 48700b5a..00000000
--- a/__tests__/spot/bswap/bswapSwap.test.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-const { mockResponse, recvWindow } = require('../../testUtils/mockData')
-
-const quoteAsset = 'USDT'
-const baseAsset = 'BUSD'
-const quoteQty = 1
-
-describe('#bswapRequestQuote', () => {
- describe('throw MissingParameterError', () => {
- it('missing quoteAsset', () => {
- expect(() => {
- SpotClient.bswapSwap('', baseAsset, quoteQty)
- }).toThrow(MissingParameterError)
- })
-
- it('missing baseAsset', () => {
- expect(() => {
- SpotClient.bswapSwap(quoteAsset, '', quoteQty)
- }).toThrow(MissingParameterError)
- })
-
- it('missing quoteQty', () => {
- expect(() => {
- SpotClient.bswapSwap(quoteAsset, baseAsset, '')
- }).toThrow(MissingParameterError)
- })
- })
-
- it('should request a quote', () => {
- const parameters = {
- quoteAsset,
- baseAsset,
- quoteQty,
- recvWindow
- }
-
- nockPostMock(`/sapi/v1/bswap/swap?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.bswapSwap(quoteAsset, baseAsset, quoteQty, { recvWindow }).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapSwapHistory.test.js b/__tests__/spot/bswap/bswapSwapHistory.test.js
deleted file mode 100644
index 1f79766e..00000000
--- a/__tests__/spot/bswap/bswapSwapHistory.test.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- startTime,
- endTime,
- recvWindow
-} = require('../../testUtils/mockData')
-
-describe('#bswapSwapHistory', () => {
- it('should get swap history without parameter attached', () => {
- nockMock('/sapi/v1/bswap/swap')(mockResponse)
- return SpotClient.bswapSwapHistory().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-
- it('should get swap history', () => {
- const parameters = {
- swapId: 1,
- startTime,
- endTime,
- status: 0,
- recvWindow
- }
-
- nockMock(`/sapi/v1/bswap/swap?${buildQueryString({ ...parameters })}`)(mockResponse)
- return SpotClient.bswapSwapHistory(parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/bswap/bswapUnclaimedRewards.test.js b/__tests__/spot/bswap/bswapUnclaimedRewards.test.js
deleted file mode 100644
index c7b33f17..00000000
--- a/__tests__/spot/bswap/bswapUnclaimedRewards.test.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, SpotClient } = require('../../testUtils/testSetup')
-
-const {
- mockResponse
-} = require('../../testUtils/mockData')
-
-describe('#bswapUnclaimedRewards', () => {
- it('should get unclaimed rewards record', () => {
- nockMock('/sapi/v1/bswap/unclaimedRewards')(mockResponse)
- return SpotClient.bswapUnclaimedRewards().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsAccount.test.js b/__tests__/spot/savings/savingsAccount.test.js
deleted file mode 100644
index bb063934..00000000
--- a/__tests__/spot/savings/savingsAccount.test.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, SpotClient } = require('../../testUtils/testSetup')
-const { mockResponse } = require('../../testUtils/mockData')
-
-describe('#savingsAccount', () => {
- it('should return saving account', () => {
- nockMock('/sapi/v1/lending/union/account')(mockResponse)
-
- return SpotClient.savingsAccount().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsCustomizedPosition.test.js b/__tests__/spot/savings/savingsCustomizedPosition.test.js
deleted file mode 100644
index a728b3e8..00000000
--- a/__tests__/spot/savings/savingsCustomizedPosition.test.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* global describe, it, expect */
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- projectId,
- status,
- recvWindow
-} = require('../../testUtils/mockData')
-
-describe('#savingsCustomizedPosition', () => {
- it('should return all project position', () => {
- nockMock('/sapi/v1/lending/project/position/list')(mockResponse)
-
- return SpotClient.savingsCustomizedPosition().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-
- it('should return project position', () => {
- const parameters = {
- projectId,
- status,
- recvWindow
- }
- nockMock(`/sapi/v1/lending/project/position/list?${buildQueryString({ asset: 'BNB', ...parameters })}`)(mockResponse)
-
- return SpotClient.savingsCustomizedPosition('BNB', parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsFlexibleProductPosition.test.js b/__tests__/spot/savings/savingsFlexibleProductPosition.test.js
deleted file mode 100644
index 0104eaa2..00000000
--- a/__tests__/spot/savings/savingsFlexibleProductPosition.test.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* global describe, it, expect */
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- asset,
- recvWindow
-} = require('../../testUtils/mockData')
-
-describe('#savingsFlexibleProductPosition', () => {
- it('should get all flexible product position', () => {
- nockMock('/sapi/v1/lending/daily/token/position')(mockResponse)
-
- return SpotClient.savingsFlexibleProductPosition().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
- it('should get flexible product position', () => {
- nockMock(`/sapi/v1/lending/daily/token/position?${buildQueryString({ asset, recvWindow })}`)(mockResponse)
-
- return SpotClient.savingsFlexibleProductPosition(asset, { recvWindow }).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsFlexibleProducts.test.js b/__tests__/spot/savings/savingsFlexibleProducts.test.js
deleted file mode 100644
index 1fc657d9..00000000
--- a/__tests__/spot/savings/savingsFlexibleProducts.test.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* global describe, it, expect */
-const {
- nockMock,
- SpotClient,
- buildQueryString
-} = require('../../testUtils/testSetup')
-const { mockResponse } = require('../../testUtils/mockData')
-
-describe('#savingsFlexibleProducts', () => {
- it('should return flexible product list when no parameter attached', () => {
- nockMock('/sapi/v1/lending/daily/product/list')(mockResponse)
-
- return SpotClient.savingsFlexibleProducts().then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-
- it('should return flexible product list', () => {
- const parameters = {
- status: 'SUBSCRIBABLE',
- featured: 'ALL'
- }
- nockMock(`/sapi/v1/lending/daily/product/list?${buildQueryString(parameters)}`)(mockResponse)
-
- return SpotClient.savingsFlexibleProducts(parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsFlexibleRedeem.test.js b/__tests__/spot/savings/savingsFlexibleRedeem.test.js
deleted file mode 100644
index 0797a4a8..00000000
--- a/__tests__/spot/savings/savingsFlexibleRedeem.test.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockPostMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-const {
- mockResponse,
- productId,
- amount
-} = require('../../testUtils/mockData')
-
-describe('#savingsFlexibleRedeem', () => {
- describe('throw MissingParameterError', () => {
- it('missing productId', () => {
- expect(() => {
- SpotClient.savingsFlexibleRedeem('', 1, 'FAST')
- }).toThrow(MissingParameterError)
- })
-
- it('missing amount', () => {
- expect(() => {
- SpotClient.savingsFlexibleRedeem('BNB_SAVINGS', '', 'FAST')
- }).toThrow(MissingParameterError)
- })
-
- it('missing type', () => {
- expect(() => {
- SpotClient.savingsFlexibleRedeem('BNB_SAVINGS', 1, '')
- }).toThrow(MissingParameterError)
- })
- })
- it('should return success', () => {
- const parameters = {
- productId,
- amount,
- type: 'FAST'
- }
- nockPostMock(`/sapi/v1/lending/daily/redeem?${buildQueryString(parameters)}`)(mockResponse)
-
- return SpotClient.savingsFlexibleRedeem(productId, amount, 'FAST').then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsFlexibleUserLeftQuota.test.js b/__tests__/spot/savings/savingsFlexibleUserLeftQuota.test.js
deleted file mode 100644
index 7801b593..00000000
--- a/__tests__/spot/savings/savingsFlexibleUserLeftQuota.test.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- productId,
- recvWindow
-} = require('../../testUtils/mockData')
-
-describe('#savingsFlexibleUserLeftQuota', () => {
- describe('throw MissingParameterError', () => {
- it('missing productId', () => {
- expect(() => {
- SpotClient.savingsFlexibleUserLeftQuota('')
- }).toThrow(MissingParameterError)
- })
- })
- it('should return Left Daily Purchase Quota of Flexible Product', () => {
- const parameters = {
- recvWindow
- }
- nockMock(`/sapi/v1/lending/daily/userLeftQuota?${buildQueryString({ productId, ...parameters })}`)(mockResponse)
-
- return SpotClient.savingsFlexibleUserLeftQuota(productId, parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsFlexibleUserRedemptionQuota.test.js b/__tests__/spot/savings/savingsFlexibleUserRedemptionQuota.test.js
deleted file mode 100644
index 57b846a2..00000000
--- a/__tests__/spot/savings/savingsFlexibleUserRedemptionQuota.test.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- productId
-} = require('../../testUtils/mockData')
-
-describe('#savingsFlexibleUserRedemptionQuota', () => {
- describe('throw MissingParameterError', () => {
- it('missing productId', () => {
- expect(() => {
- SpotClient.savingsFlexibleUserRedemptionQuota('', 'FAST')
- }).toThrow(MissingParameterError)
- })
-
- it('missing type', () => {
- expect(() => {
- SpotClient.savingsFlexibleUserRedemptionQuota('BNB_SAVINGS', '')
- }).toThrow(MissingParameterError)
- })
- })
-
- it('should return flexible product quota', () => {
- nockMock(`/sapi/v1/lending/daily/userRedemptionQuota?${buildQueryString({ productId, type: 'FAST' })}`)(mockResponse)
- return SpotClient.savingsFlexibleUserRedemptionQuota(productId, 'FAST').then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsInterestHistory.test.js b/__tests__/spot/savings/savingsInterestHistory.test.js
deleted file mode 100644
index 2cefbc88..00000000
--- a/__tests__/spot/savings/savingsInterestHistory.test.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- asset,
- startTime,
- endTime,
- recvWindow
-} = require('../../testUtils/mockData')
-
-describe('#savingsInterestHistory', () => {
- describe('throw MissingParameterError', () => {
- it('missing lendingType', () => {
- expect(() => {
- SpotClient.savingsInterestHistory('')
- }).toThrow(MissingParameterError)
- })
- })
- it('should return redemptionRecord records', () => {
- const parameters = {
- asset,
- startTime,
- endTime,
- recvWindow
- }
- nockMock(`/sapi/v1/lending/union/interestHistory?${buildQueryString({ lendingType: 'DAILY', ...parameters })}`)(mockResponse)
-
- return SpotClient.savingsInterestHistory('DAILY', parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsProductList.test.js b/__tests__/spot/savings/savingsProductList.test.js
deleted file mode 100644
index 8aca45b0..00000000
--- a/__tests__/spot/savings/savingsProductList.test.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- asset,
- recvWindow
-} = require('../../testUtils/mockData')
-
-describe('#savingsProductList', () => {
- describe('throw MissingParameterError', () => {
- it('missing type', () => {
- expect(() => {
- SpotClient.savingsProductList('')
- }).toThrow(MissingParameterError)
- })
- })
- it('should return product list', () => {
- const parameters = {
- asset,
- status: 'ALL',
- isSortAsc: true,
- sortBy: 'START_TIME',
- recvWindow
- }
- nockMock(`/sapi/v1/lending/project/list?${buildQueryString({ type: 'REGULAR', ...parameters })}`)(mockResponse)
-
- return SpotClient.savingsProductList('REGULAR', parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsPurchaseCustomizedProject.test.js b/__tests__/spot/savings/savingsPurchaseCustomizedProject.test.js
deleted file mode 100644
index bf55cc88..00000000
--- a/__tests__/spot/savings/savingsPurchaseCustomizedProject.test.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockPostMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- projectId,
- lot
-} = require('../../testUtils/mockData')
-
-describe('#savingsPurchaseCustomizedProject', () => {
- describe('throw MissingParameterError', () => {
- it('missing projectId', () => {
- expect(() => {
- SpotClient.savingsPurchaseCustomizedProject('', lot)
- }).toThrow(MissingParameterError)
- })
-
- it('missing lot', () => {
- expect(() => {
- SpotClient.savingsPurchaseCustomizedProject(projectId, '')
- }).toThrow(MissingParameterError)
- })
- })
- it('should return purchaseId', () => {
- nockPostMock(`/sapi/v1/lending/customizedFixed/purchase?${buildQueryString({ projectId, lot })}`)(mockResponse)
-
- return SpotClient.savingsPurchaseCustomizedProject(projectId, lot).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsPurchaseFlexibleProduct.test.js b/__tests__/spot/savings/savingsPurchaseFlexibleProduct.test.js
deleted file mode 100644
index 8408508a..00000000
--- a/__tests__/spot/savings/savingsPurchaseFlexibleProduct.test.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockPostMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- productId,
- amount
-} = require('../../testUtils/mockData')
-
-describe('#savingsPurchaseFlexibleProduct', () => {
- describe('throw MissingParameterError', () => {
- it('missing productId', () => {
- expect(() => {
- SpotClient.savingsPurchaseFlexibleProduct('', 1)
- }).toThrow(MissingParameterError)
- })
-
- it('missing amount', () => {
- expect(() => {
- SpotClient.savingsPurchaseFlexibleProduct('BNB_SAVINGS', '')
- }).toThrow(MissingParameterError)
- })
- })
-
- it('should return purchaseId', () => {
- nockPostMock(`/sapi/v1/lending/daily/purchase?${buildQueryString({ productId, amount })}`)(mockResponse)
- return SpotClient.savingsPurchaseFlexibleProduct(productId, amount).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsPurchaseRecord.test.js b/__tests__/spot/savings/savingsPurchaseRecord.test.js
deleted file mode 100644
index c932e643..00000000
--- a/__tests__/spot/savings/savingsPurchaseRecord.test.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- asset,
- startTime,
- endTime,
- recvWindow
-} = require('../../testUtils/mockData')
-
-describe('#savingsPurchaseRecord', () => {
- it('throw MissingParameterError when missing lendingType', () => {
- expect(() => {
- SpotClient.savingsPurchaseRecord('')
- }).toThrow(MissingParameterError)
- })
-
- it('should return purchase records', () => {
- const parameters = {
- asset,
- startTime,
- endTime,
- recvWindow
- }
- nockMock(`/sapi/v1/lending/union/purchaseRecord?${buildQueryString({ lendingType: 'DAILY', ...parameters })}`)(mockResponse)
-
- return SpotClient.savingsPurchaseRecord('DAILY', parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/savings/savingsRedemptionRecord.test.js b/__tests__/spot/savings/savingsRedemptionRecord.test.js
deleted file mode 100644
index 0c8ad2b7..00000000
--- a/__tests__/spot/savings/savingsRedemptionRecord.test.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* global describe, it, expect */
-const MissingParameterError = require('../../../src/error/missingParameterError')
-const {
- nockMock,
- buildQueryString,
- SpotClient
-} = require('../../testUtils/testSetup')
-
-const {
- mockResponse,
- asset,
- startTime,
- endTime,
- recvWindow
-} = require('../../testUtils/mockData')
-
-describe('#savingsRedemptionRecord', () => {
- it('throw MissingParameterError when missing lendingType', () => {
- expect(() => {
- SpotClient.savingsRedemptionRecord('')
- }).toThrow(MissingParameterError)
- })
-
- it('should return redemptionRecord records', () => {
- const parameters = {
- asset,
- startTime,
- endTime,
- recvWindow
- }
- nockMock(`/sapi/v1/lending/union/redemptionRecord?${buildQueryString({ lendingType: 'DAILY', ...parameters })}`)(mockResponse)
-
- return SpotClient.savingsRedemptionRecord('DAILY', parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/staking/stakingHistory.test.js b/__tests__/spot/staking/stakingHistory.test.js
deleted file mode 100644
index a54bd8ac..00000000
--- a/__tests__/spot/staking/stakingHistory.test.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-const MissingParameterError = require('../../../src/error/missingParameterError')
-
-const {
- mockResponse,
- recvWindow
-} = require('../../testUtils/mockData')
-
-const product = 'STAKING'
-const txnType = 'SUBSCRIPTION'
-
-describe('#stakingHistory', () => {
- it.each([
- [null, null],
- [null, txnType],
- [product, null]
- ])('should throw MissingParameterError given missing params', (product, txnType) => {
- expect(() => {
- SpotClient.stakingHistory(product, txnType)
- }).toThrow(MissingParameterError)
- })
-
- it('should get staking history', () => {
- const parameters = {
- recvWindow
- }
- nockMock(`/sapi/v1/staking/stakingRecord?${buildQueryString({ product, txnType, ...parameters })}`)(mockResponse)
- return SpotClient.stakingHistory(product, txnType, parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/staking/stakingProductList.test.js b/__tests__/spot/staking/stakingProductList.test.js
deleted file mode 100644
index 7ed482bb..00000000
--- a/__tests__/spot/staking/stakingProductList.test.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-const MissingParameterError = require('../../../src/error/missingParameterError')
-
-const {
- mockResponse,
- recvWindow
-} = require('../../testUtils/mockData')
-
-const product = 'STAKING'
-
-describe('#stakingProductList', () => {
- it('throw MissingParameterError when missing product', () => {
- expect(() => {
- SpotClient.stakingProductList(null)
- }).toThrow(MissingParameterError)
- })
- it('should get staking product list', () => {
- const parameters = {
- recvWindow
- }
- nockMock(`/sapi/v1/staking/productList?${buildQueryString({ product, ...parameters })}`)(mockResponse)
- return SpotClient.stakingProductList(product, parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/staking/stakingProductPosition.test.js b/__tests__/spot/staking/stakingProductPosition.test.js
deleted file mode 100644
index 051c1080..00000000
--- a/__tests__/spot/staking/stakingProductPosition.test.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-const MissingParameterError = require('../../../src/error/missingParameterError')
-
-const {
- mockResponse,
- recvWindow
-} = require('../../testUtils/mockData')
-
-const product = 'STAKING'
-
-describe('#stakingProductPosition', () => {
- it('throw MissingParameterError when missing product', () => {
- expect(() => {
- SpotClient.stakingProductPosition(null)
- }).toThrow(MissingParameterError)
- })
- it('should get staking product position', () => {
- const parameters = {
- recvWindow
- }
- nockMock(`/sapi/v1/staking/position?${buildQueryString({ product, ...parameters })}`)(mockResponse)
- return SpotClient.stakingProductPosition(product, parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/staking/stakingProductQuota.test.js b/__tests__/spot/staking/stakingProductQuota.test.js
deleted file mode 100644
index a85294cf..00000000
--- a/__tests__/spot/staking/stakingProductQuota.test.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* global describe, it, expect */
-const { nockMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-const MissingParameterError = require('../../../src/error/missingParameterError')
-
-const {
- mockResponse,
- productId
-} = require('../../testUtils/mockData')
-
-const product = 'STAKING'
-
-describe('#stakingProductQuota', () => {
- it.each([
- [null, null],
- [null, productId],
- [product, null]
- ])('should throw MissingParameterError given missing params', (product, productId) => {
- expect(() => {
- SpotClient.stakingProductQuota(product, productId)
- }).toThrow(MissingParameterError)
- })
-
- it('should get personal left quota of staking product', () => {
- nockMock(`/sapi/v1/staking/personalLeftQuota?${buildQueryString({ product, productId })}`)(mockResponse)
- return SpotClient.stakingProductQuota(product, productId).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/staking/stakingPurchaseProduct.test.js b/__tests__/spot/staking/stakingPurchaseProduct.test.js
deleted file mode 100644
index f68c9e86..00000000
--- a/__tests__/spot/staking/stakingPurchaseProduct.test.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* global describe, it, expect */
-const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-const MissingParameterError = require('../../../src/error/missingParameterError')
-
-const {
- mockResponse,
- productId,
- amount,
- recvWindow
-} = require('../../testUtils/mockData')
-
-const product = 'STAKING'
-
-describe('#stakingPurchaseProduct', () => {
- it.each([
- [null, null, null],
- [null, productId, amount],
- [product, null, amount],
- [product, productId, null]
- ])('should throw MissingParameterError given missing params', (product, productId, amount) => {
- expect(() => {
- SpotClient.stakingPurchaseProduct(product, productId, amount)
- }).toThrow(MissingParameterError)
- })
-
- it('should purchase staking product', () => {
- const parameters = {
- recvWindow
- }
- nockPostMock(`/sapi/v1/staking/purchase?${buildQueryString({ product, productId, amount, ...parameters })}`)(mockResponse)
- return SpotClient.stakingPurchaseProduct(product, productId, amount, parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/staking/stakingRedeemProduct.test.js b/__tests__/spot/staking/stakingRedeemProduct.test.js
deleted file mode 100644
index 6895ca6f..00000000
--- a/__tests__/spot/staking/stakingRedeemProduct.test.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* global describe, it, expect */
-const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-const MissingParameterError = require('../../../src/error/missingParameterError')
-
-const {
- mockResponse,
- productId,
- recvWindow
-} = require('../../testUtils/mockData')
-
-const product = 'STAKING'
-
-describe('#stakingRedeemProduct', () => {
- it.each([
- [null, null],
- [null, productId],
- [product, null]
- ])('should throw MissingParameterError given missing params', (product, productId) => {
- expect(() => {
- SpotClient.stakingRedeemProduct(product, productId)
- }).toThrow(MissingParameterError)
- })
-
- it('should redeem staking product', () => {
- const parameters = {
- recvWindow
- }
- nockPostMock(`/sapi/v1/staking/redeem?${buildQueryString({ product, productId, ...parameters })}`)(mockResponse)
- return SpotClient.stakingRedeemProduct(product, productId, parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/__tests__/spot/staking/stakingSetAutoStaking.test.js b/__tests__/spot/staking/stakingSetAutoStaking.test.js
deleted file mode 100644
index 019d0033..00000000
--- a/__tests__/spot/staking/stakingSetAutoStaking.test.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* global describe, it, expect */
-const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
-const MissingParameterError = require('../../../src/error/missingParameterError')
-
-const {
- mockResponse,
- recvWindow
-} = require('../../testUtils/mockData')
-
-const product = 'STAKING'
-const positionId = '1234'
-const renewable = 'true'
-
-describe('#stakingSetAutoStaking', () => {
- it.each([
- [null, null, null],
- [null, positionId, renewable],
- [product, null, renewable],
- [product, positionId, null]
- ])('should throw MissingParameterError given missing params', (product, positionId, renewable) => {
- expect(() => {
- SpotClient.stakingSetAutoStaking(product, positionId, renewable)
- }).toThrow(MissingParameterError)
- })
-
- it('should set auto staking', () => {
- const parameters = {
- recvWindow
- }
- nockPostMock(`/sapi/v1/staking/setAutoStaking?${buildQueryString({ product, positionId, renewable, ...parameters })}`)(mockResponse)
- return SpotClient.stakingSetAutoStaking(product, positionId, renewable, parameters).then(response => {
- expect(response).toBeDefined()
- expect(response.data).toEqual(mockResponse)
- })
- })
-})
diff --git a/examples/spot/bswap/bswapAddLiquidityPreview.js b/examples/spot/bswap/bswapAddLiquidityPreview.js
deleted file mode 100644
index 3b2d616c..00000000
--- a/examples/spot/bswap/bswapAddLiquidityPreview.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapAddLiquidityPreview(2, 'SINGLE', 'USDT', 0.01)
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapClaimRewards.js b/examples/spot/bswap/bswapClaimRewards.js
deleted file mode 100644
index c2e94015..00000000
--- a/examples/spot/bswap/bswapClaimRewards.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapClaimRewards({ type: 1 })
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapClaimedHistory.js b/examples/spot/bswap/bswapClaimedHistory.js
deleted file mode 100644
index ab7c145e..00000000
--- a/examples/spot/bswap/bswapClaimedHistory.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapClaimedHistory({ poolId: 52, assetRewards: 'BNB', type: 1 })
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapGetPoolConfig.js b/examples/spot/bswap/bswapGetPoolConfig.js
deleted file mode 100644
index a1ee604d..00000000
--- a/examples/spot/bswap/bswapGetPoolConfig.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapGetPoolConfig()
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapLiquidity.js b/examples/spot/bswap/bswapLiquidity.js
deleted file mode 100644
index ef35b5ac..00000000
--- a/examples/spot/bswap/bswapLiquidity.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapLiquidity({ poolId: 2 })
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapLiquidityAdd.js b/examples/spot/bswap/bswapLiquidityAdd.js
deleted file mode 100644
index fc7bae83..00000000
--- a/examples/spot/bswap/bswapLiquidityAdd.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapLiquidityAdd(2, 'USDT', 100)
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapLiquidityOperationRecord.js b/examples/spot/bswap/bswapLiquidityOperationRecord.js
deleted file mode 100644
index 1242065b..00000000
--- a/examples/spot/bswap/bswapLiquidityOperationRecord.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapLiquidityOperationRecord()
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapLiquidityRemove.js b/examples/spot/bswap/bswapLiquidityRemove.js
deleted file mode 100644
index 406d2aa5..00000000
--- a/examples/spot/bswap/bswapLiquidityRemove.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapLiquidityRemove(2, 'SINGLE', 'USDT', 100)
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapPools.js b/examples/spot/bswap/bswapPools.js
deleted file mode 100644
index 7b1136b2..00000000
--- a/examples/spot/bswap/bswapPools.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapPools()
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapRemoveLiquidityPreview.js b/examples/spot/bswap/bswapRemoveLiquidityPreview.js
deleted file mode 100644
index 81b1489e..00000000
--- a/examples/spot/bswap/bswapRemoveLiquidityPreview.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapRemoveLiquidityPreview(2, 'SINGLE', 'USDT', 0.01)
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapRequestQuote.js b/examples/spot/bswap/bswapRequestQuote.js
deleted file mode 100644
index c8562629..00000000
--- a/examples/spot/bswap/bswapRequestQuote.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapRequestQuote('USDT', 'BUSD', 100)
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapSwap.js b/examples/spot/bswap/bswapSwap.js
deleted file mode 100644
index a27982e2..00000000
--- a/examples/spot/bswap/bswapSwap.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapSwap('USDT', 'BUSD', 100)
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapSwapHistory.js b/examples/spot/bswap/bswapSwapHistory.js
deleted file mode 100644
index f4b632ee..00000000
--- a/examples/spot/bswap/bswapSwapHistory.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapSwapHistory()
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/bswap/bswapUnclaimedRewards.js b/examples/spot/bswap/bswapUnclaimedRewards.js
deleted file mode 100644
index 6c8a0e03..00000000
--- a/examples/spot/bswap/bswapUnclaimedRewards.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.bswapUnclaimedRewards({ type: 1 })
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsAccount.js b/examples/spot/savings/savingsAccount.js
deleted file mode 100644
index aff307cd..00000000
--- a/examples/spot/savings/savingsAccount.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsAccount().then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsCustomizedPosition.js b/examples/spot/savings/savingsCustomizedPosition.js
deleted file mode 100644
index 3567799e..00000000
--- a/examples/spot/savings/savingsCustomizedPosition.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsCustomizedPosition('BNB').then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsFlexibleProductPosition.js b/examples/spot/savings/savingsFlexibleProductPosition.js
deleted file mode 100644
index f6e43aca..00000000
--- a/examples/spot/savings/savingsFlexibleProductPosition.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsFlexibleProductPosition('BNB').then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsFlexibleProducts.js b/examples/spot/savings/savingsFlexibleProducts.js
deleted file mode 100644
index e64e6234..00000000
--- a/examples/spot/savings/savingsFlexibleProducts.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsFlexibleProducts({
- status: 'ALL',
- featured: 'ALL'
-}).then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsFlexibleRedeem.js b/examples/spot/savings/savingsFlexibleRedeem.js
deleted file mode 100644
index 4ee883ca..00000000
--- a/examples/spot/savings/savingsFlexibleRedeem.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsFlexibleRedeem('', 1, 'FAST').then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsFlexibleUserLeftQuota.js b/examples/spot/savings/savingsFlexibleUserLeftQuota.js
deleted file mode 100644
index c918e35a..00000000
--- a/examples/spot/savings/savingsFlexibleUserLeftQuota.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsFlexibleUserLeftQuota({
- productId: ''
-}).then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsFlexibleUserRedemptionQuota.js b/examples/spot/savings/savingsFlexibleUserRedemptionQuota.js
deleted file mode 100644
index 78e41420..00000000
--- a/examples/spot/savings/savingsFlexibleUserRedemptionQuota.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsFlexibleUserRedemptionQuota('', 'FAST').then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsInterestHistory.js b/examples/spot/savings/savingsInterestHistory.js
deleted file mode 100644
index a86943c9..00000000
--- a/examples/spot/savings/savingsInterestHistory.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsInterestHistory('DAILY').then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsProductList.js b/examples/spot/savings/savingsProductList.js
deleted file mode 100644
index 3d40dba2..00000000
--- a/examples/spot/savings/savingsProductList.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsProductList('REGULAR').then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsPurchaseCustomizedProject.js b/examples/spot/savings/savingsPurchaseCustomizedProject.js
deleted file mode 100644
index 197ff561..00000000
--- a/examples/spot/savings/savingsPurchaseCustomizedProject.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsPurchaseCustomizedProject('', 1).then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsPurchaseFlexibleProduct.js b/examples/spot/savings/savingsPurchaseFlexibleProduct.js
deleted file mode 100644
index 4ef136c2..00000000
--- a/examples/spot/savings/savingsPurchaseFlexibleProduct.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsPurchaseFlexibleProduct('', 1).then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsPurchaseRecord.js b/examples/spot/savings/savingsPurchaseRecord.js
deleted file mode 100644
index d16b732d..00000000
--- a/examples/spot/savings/savingsPurchaseRecord.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsPurchaseRecord('DAILY').then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/savings/savingsRedemptionRecord.js b/examples/spot/savings/savingsRedemptionRecord.js
deleted file mode 100644
index 7af4f614..00000000
--- a/examples/spot/savings/savingsRedemptionRecord.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.savingsRedemptionRecord('DAILY').then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/staking/stakingHistory.js b/examples/spot/staking/stakingHistory.js
deleted file mode 100644
index 37ceba9a..00000000
--- a/examples/spot/staking/stakingHistory.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.stakingHistory('STAKING', 'SUBSCRIPTION', {
- recvWindow: 5000
-})
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/staking/stakingProductList.js b/examples/spot/staking/stakingProductList.js
deleted file mode 100644
index 7f9f2c1a..00000000
--- a/examples/spot/staking/stakingProductList.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.stakingProductList('STAKING', {
- recvWindow: 5000
-})
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/staking/stakingProductPosition.js b/examples/spot/staking/stakingProductPosition.js
deleted file mode 100644
index 83f5c454..00000000
--- a/examples/spot/staking/stakingProductPosition.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.stakingProductPosition('STAKING', {
- recvWindow: 5000
-})
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/staking/stakingProductQuota.js b/examples/spot/staking/stakingProductQuota.js
deleted file mode 100644
index 30a9e2e2..00000000
--- a/examples/spot/staking/stakingProductQuota.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.stakingProductQuota('STAKING', 'Axs*90')
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/staking/stakingPurchaseProduct.js b/examples/spot/staking/stakingPurchaseProduct.js
deleted file mode 100644
index 5afb5881..00000000
--- a/examples/spot/staking/stakingPurchaseProduct.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.stakingPurchaseProduct('STAKING', 'Axs*90', 10.1, {
- recvWindow: 5000
-})
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/staking/stakingRedeemProduct.js b/examples/spot/staking/stakingRedeemProduct.js
deleted file mode 100644
index 0f726f08..00000000
--- a/examples/spot/staking/stakingRedeemProduct.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.stakingRedeemProduct('STAKING', 'Axs*90', {
- recvWindow: 5000
-})
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/examples/spot/staking/stakingSetAutoStaking.js b/examples/spot/staking/stakingSetAutoStaking.js
deleted file mode 100644
index d42bc0a8..00000000
--- a/examples/spot/staking/stakingSetAutoStaking.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-const Spot = require('../../../src/spot')
-
-const apiKey = ''
-const apiSecret = ''
-const client = new Spot(apiKey, apiSecret)
-
-client.stakingSetAutoStaking('STAKING', '1234', 'true', {
- recvWindow: 5000
-})
- .then(response => client.logger.log(response.data))
- .catch(error => client.logger.error(error))
diff --git a/package-lock.json b/package-lock.json
index f6e9ee3f..73a9435a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@binance/connector",
- "version": "3.1.0",
+ "version": "3.2.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@binance/connector",
- "version": "3.1.0",
+ "version": "3.2.0",
"license": "MIT",
"dependencies": {
"axios": "^1.6",
@@ -1624,7 +1624,7 @@
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz",
"integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
"dependencies": {
- "follow-redirects": "^1.15.0",
+ "follow-redirects": "^1.15.4",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
@@ -3176,9 +3176,9 @@
"dev": true
},
"node_modules/follow-redirects": {
- "version": "1.15.3",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
- "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
+ "version": "1.15.5",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz",
+ "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==",
"funding": [
{
"type": "individual",
diff --git a/package.json b/package.json
index 94664ba2..817fe6ab 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@binance/connector",
- "version": "3.1.0",
+ "version": "3.2.0",
"description": "This is a lightweight library that works as a connector to the Binance public API.",
"main": "src/index.js",
"scripts": {
diff --git a/src/modules/restful/bswap.js b/src/modules/restful/bswap.js
deleted file mode 100644
index cc46bb59..00000000
--- a/src/modules/restful/bswap.js
+++ /dev/null
@@ -1,340 +0,0 @@
-'use strict'
-
-const { validateRequiredParameters } = require('../../helpers/validation')
-
-/**
- * API bswap endpoints
- * @module Bswap
- * @param {*} superclass
- */
-const Bswap = superclass => class extends superclass {
- /**
- * List All Swap Pools (MARKET_DATA)
- *
- * GET /sapi/v1/bswap/pools
- *
- * Get metadata about all swap pools.
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#list-all-swap-pools-market_data}
- */
- bswapPools () {
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/pools'
- )
- }
-
- /**
- * Get liquidity information of a pool (USER_DATA)
- *
- * GET /sapi/v1/bswap/liquidity
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-liquidity-information-of-a-pool-user_data}
- *
- * @param {object} [options]
- * @param {number} [options.poolId]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapLiquidity (options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/liquidity',
- options
- )
- }
-
- /**
- * Add Liquidity (TRADE)
- *
- * POST /sapi/v1/bswap/liquidityAdd
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#add-liquidity-trade}
- *
- * @param {number} poolId
- * @param {string} asset
- * @param {number} quantity
- * @param {object} [options]
- * @param {string} [options.type] - "Single" to add a single token; "Combination" to add dual tokens. Default "Single"
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapLiquidityAdd (poolId, asset, quantity, options = {}) {
- validateRequiredParameters({ poolId, asset, quantity })
-
- return this.signRequest(
- 'POST',
- '/sapi/v1/bswap/liquidityAdd',
- Object.assign(options, {
- poolId,
- asset,
- quantity
- })
- )
- }
-
- /**
- * Remove Liquidity (TRADE)
- *
- * POST /sapi/v1/bswap/liquidityRemove
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#remove-liquidity-trade}
- *
- * @param {number} poolId
- * @param {string} type -`SINGLE` for single asset removal, `COMBINATION` for combination of all coins removal
- * @param {string} asset
- * @param {number} shareAmount
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapLiquidityRemove (poolId, type, asset, shareAmount, options = {}) {
- validateRequiredParameters({ poolId, type, asset, shareAmount })
-
- return this.signRequest(
- 'POST',
- '/sapi/v1/bswap/liquidityRemove',
- Object.assign(options, {
- poolId,
- type,
- asset,
- shareAmount
- })
- )
- }
-
- /**
- * Get Liquidity Operation Record (USER_DATA)
- *
- * GET /sapi/v1/bswap/liquidityOps
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-liquidity-operation-record-user_data}
- *
- * @param {object} [options]
- * @param {number} [options.operationId]
- * @param {number} [options.poolId]
- * @param {string} [options.operation] -`ADD` or `REMOVE`
- * @param {number} [options.startTime]
- * @param {number} [options.endTime]
- * @param {number} [options.limit] - default 3, max 100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapLiquidityOperationRecord (options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/liquidityOps',
- options
- )
- }
-
- /**
- * Request Quote (USER_DATA)
- *
- * Request a quote for swap quote asset (selling asset) for base asset (buying asset),
- * essentially price/exchange rates. quoteQty is quantity of quote asset (to sell).
- * Please be noted the quote is for reference only, the actual price will change
- * as the liquidity changes, it's recommended to swap immediate after request a quote
- * for slippage prevention.
- *
- * GET /sapi/v1/bswap/quote
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#request-quote-user_data}
- *
- * @param {string} quoteAsset
- * @param {string} baseAsset
- * @param {number} quoteQty
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapRequestQuote (quoteAsset, baseAsset, quoteQty, options = {}) {
- validateRequiredParameters({ quoteAsset, baseAsset, quoteQty })
-
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/quote',
- Object.assign(options, {
- quoteAsset,
- baseAsset,
- quoteQty
- })
- )
- }
-
- /**
- * Swap (TRADE)
- *
- * POST /sapi/v1/bswap/swap
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#swap-trade}
- *
- * @param {string} quoteAsset
- * @param {string} baseAsset
- * @param {number} quoteQty
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapSwap (quoteAsset, baseAsset, quoteQty, options = {}) {
- validateRequiredParameters({ quoteAsset, baseAsset, quoteQty })
-
- return this.signRequest(
- 'POST',
- '/sapi/v1/bswap/swap',
- Object.assign(options, {
- quoteAsset,
- baseAsset,
- quoteQty
- })
- )
- }
-
- /**
- * Get Swap History (USER_DATA)
- *
- * GET /sapi/v1/bswap/swap
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#swap-trade}
- *
- * @param {object} [options]
- * @param {string} [options.swapId]
- * @param {number} [options.startTime]
- * @param {number} [options.endTime]
- * @param {number} [options.status] - 0: pending for swap, 1: success, 2: failed
- * @param {string} [options.baseAsset]
- * @param {string} [options.quoteAsset]
- * @param {number} [options.limit] - default 3, max 100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapSwapHistory (options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/swap',
- options
- )
- }
-
- /**
- * Get Pool Configure (USER_DATA)
- *
- * GET /sapi/v1/bswap/poolConfigure
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-pool-configure-user_data}
- *
- * @param {object} [options]
- * @param {number} [options.poolId]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapGetPoolConfig (options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/poolConfigure',
- options
- )
- }
-
- /**
- * Add Liquidity Preview (USER_DATA)
- *
- * GET /sapi/v1/bswap/addLiquidityPreview
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#add-liquidity-preview-user_data}
- *
- * @param {number} poolId
- * @param {string} type - "SINGLE" for adding a single token;"COMBINATION" for adding dual tokens
- * @param {string} quoteAsset
- * @param {number} quoteQty
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapAddLiquidityPreview (poolId, type, quoteAsset, quoteQty, options = {}) {
- validateRequiredParameters({ poolId, type, quoteAsset, quoteQty })
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/addLiquidityPreview',
- Object.assign(options, { poolId, type, quoteAsset, quoteQty })
- )
- }
-
- /**
- * Remove Liquidity Preview (USER_DATA)
- *
- * GET /sapi/v1/bswap/removeLiquidityPreview
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#remove-liquidity-preview-user_data}
- *
- * @param {number} poolId
- * @param {string} type - Type is "SINGLE", remove and obtain a single token;Type is "COMBINATION", remove and obtain dual token.
- * @param {string} quoteAsset
- * @param {number} shareAmount
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapRemoveLiquidityPreview (poolId, type, quoteAsset, shareAmount, options = {}) {
- validateRequiredParameters({ poolId, type, quoteAsset, shareAmount })
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/removeLiquidityPreview',
- Object.assign(options, { poolId, type, quoteAsset, shareAmount })
- )
- }
-
- /**
- * Get Unclaimed Rewards Record (USER_DATA)
- *
- * GET /sapi/v1/bswap/unclaimedRewards
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-unclaimed-rewards-record-user_data}
- *
- * @param {object} [options]
- * @param {number} [options.type] - 0: Swap rewards,1:Liquidity rewards, default to 0
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapUnclaimedRewards (options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/unclaimedRewards',
- options
- )
- }
-
- /**
- * Claim rewards (TRADE)
- *
- * POST /sapi/v1/bswap/claimRewards
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#claim-rewards-trade}
- *
- * @param {object} [options]
- * @param {number} [options.type] - 0: Swap rewards,1:Liquidity rewards, default to 0
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapClaimRewards (options = {}) {
- return this.signRequest(
- 'POST',
- '/sapi/v1/bswap/claimRewards',
- options
- )
- }
-
- /**
- * Get Claimed History (USER_DATA)
- *
- * GET /sapi/v1/bswap/claimedHistory
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-claimed-history-user_data}
- *
- * @param {object} [options]
- * @param {number} [options.poolId]
- * @param {string} [options.assetRewards]
- * @param {number} [options.type] - 0: Swap rewards,1:Liquidity rewards, default to 0
- * @param {number} [options.startTime]
- * @param {number} [options.endTime]
- * @param {number} [options.limit] - default 3, max 100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- bswapClaimedHistory (options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/bswap/claimedHistory',
- options
- )
- }
-}
-
-module.exports = Bswap
diff --git a/src/modules/restful/index.js b/src/modules/restful/index.js
index fd2ebadf..aa175355 100644
--- a/src/modules/restful/index.js
+++ b/src/modules/restful/index.js
@@ -2,15 +2,12 @@
module.exports.autoInvest = require('./autoInvest')
module.exports.Blvt = require('./blvt')
-module.exports.Bswap = require('./bswap')
module.exports.SubAccount = require('./subAccount')
module.exports.Market = require('./market')
module.exports.Trade = require('./trade')
module.exports.Wallet = require('./wallet')
module.exports.Margin = require('./margin')
module.exports.Mining = require('./mining')
-module.exports.Savings = require('./savings')
-module.exports.Staking = require('./staking')
module.exports.Stream = require('./stream')
module.exports.Futures = require('./futures')
module.exports.Fiat = require('./fiat')
diff --git a/src/modules/restful/savings.js b/src/modules/restful/savings.js
deleted file mode 100644
index 08b9ebde..00000000
--- a/src/modules/restful/savings.js
+++ /dev/null
@@ -1,336 +0,0 @@
-'use strict'
-
-const { validateRequiredParameters } = require('../../helpers/validation')
-
-/**
- * API savings endpoints
- * @module Savings
- * @param {*} superclass
- */
-const Savings = superclass => class extends superclass {
- /**
- * Get Flexible Product List (USER_DATA)
- *
- * GET /sapi/v1/lending/daily/product/list
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-list-user_data}
- *
- * @param {object} [options]
- * @param {string} [options.status] - "ALL", "SUBSCRIBABLE", "UNSUBSCRIBABLE"; default "ALL"
- * @param {string} [options.featured] - "ALL", "true"; default "ALL"
- * @param {number} [options.current] - Current query page. Default: 1, Min: 1
- * @param {number} [options.size] - Default: 50, Max: 100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsFlexibleProducts (options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/daily/product/list',
- options
- )
- }
-
- /**
- * Get Left Daily Purchase Quota of Flexible Product (USER_DATA)
- *
- * GET /sapi/v1/lending/daily/userLeftQuota
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-left-daily-purchase-quota-of-flexible-product-user_data}
- *
- * @param {string} productId
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsFlexibleUserLeftQuota (productId, options = {}) {
- validateRequiredParameters({ productId })
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/daily/userLeftQuota',
- Object.assign(options, {
- productId
- })
- )
- }
-
- /**
- * Purchase Flexible Product (USER_DATA)
- *
- * GET /sapi/v1/lending/daily/purchase
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#purchase-flexible-product-user_data}
- *
- * @param {string} productId
- * @param {string} amount
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsPurchaseFlexibleProduct (productId, amount, options = {}) {
- validateRequiredParameters({ productId, amount })
-
- return this.signRequest(
- 'POST',
- '/sapi/v1/lending/daily/purchase',
- Object.assign(options, {
- productId,
- amount
- })
- )
- }
-
- /**
- * Get Left Daily Redemption Quota of Flexible Product (USER_DATA)
- *
- * GET /sapi/v1/lending/daily/userRedemptionQuota
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-left-daily-redemption-quota-of-flexible-product-user_data}
- *
- * @param {string} productId
- * @param {string} type - "FAST", "NORMAL"
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsFlexibleUserRedemptionQuota (productId, type, options = {}) {
- validateRequiredParameters({ productId, type })
-
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/daily/userRedemptionQuota',
- Object.assign(options, {
- productId,
- type
- })
- )
- }
-
- /**
- * Redeem Flexible Product (USER_DATA)
- *
- * POST /sapi/v1/lending/daily/redeem
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-user_data}
- *
- * @param {string} productId
- * @param {number} amount
- * @param {string} type - "FAST", "NORMAL"
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsFlexibleRedeem (productId, amount, type, options = {}) {
- validateRequiredParameters({ productId, amount, type })
-
- return this.signRequest(
- 'POST',
- '/sapi/v1/lending/daily/redeem',
- Object.assign(options, {
- productId,
- amount,
- type
- })
- )
- }
-
- /**
- * Get Flexible Product Position (USER_DATA)
- *
- * GET /sapi/v1/lending/daily/token/position
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-position-user_data}
- *
- * @param {string} [asset]
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsFlexibleProductPosition (asset, options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/daily/token/position',
- Object.assign(options, {
- ...(asset ? { asset } : {})
- })
- )
- }
-
- /**
- * Get Fixed and Activity Project List(USER_DATA)
- *
- * GET /sapi/v1/lending/project/list
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-fixed-and-activity-project-list-user_data}
- *
- * @param {string} type - "ACTIVITY", "CUSTOMIZED_FIXED"
- * @param {object} [options]
- * @param {string} [options.asset]
- * @param {string} [options.status] - "ALL", "SUBSCRIBABLE", "UNSUBSCRIBABLE"; default "ALL"
- * @param {boolean} [options.isSortAsc] - default "true"
- * @param {string} [options.sortBy] - "START_TIME", "LOT_SIZE", "INTEREST_RATE", "DURATION"; default "START_TIME"
- * @param {number} [options.current] - Currently querying page. Start from 1. Default:1
- * @param {number} [options.size] - Default:10, Max:100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsProductList (type, options = {}) {
- validateRequiredParameters({ type })
-
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/project/list',
- Object.assign(options, {
- type
- })
- )
- }
-
- /**
- * Purchase Fixed/Activity Project (USER_DATA)
- *
- * POST /sapi/v1/lending/customizedFixed/purchase
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#purchase-fixed-activity-project-user_data}
- *
- * @param {string} projectId
- * @param {number} lot
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsPurchaseCustomizedProject (projectId, lot, options = {}) {
- validateRequiredParameters({ projectId, lot })
-
- return this.signRequest(
- 'POST',
- '/sapi/v1/lending/customizedFixed/purchase',
- Object.assign(options, {
- projectId,
- lot
- })
- )
- }
-
- /**
- * Get Fixed/Activity Project Position (USER_DATA)
- *
- * GET /sapi/v1/lending/project/position/list
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-fixed-activity-project-position-user_data}
- *
- * @param {string} [asset]
- * @param {object} [options]
- * @param {string} [options.projectId]
- * @param {string} [options.status] - "HOLDING", "REDEEMED"
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsCustomizedPosition (asset, options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/project/position/list',
- Object.assign(options, {
- ...(asset ? { asset } : {})
- })
- )
- }
-
- /**
- * Lending Account (USER_DATA)
- *
- * GET /sapi/v1/lending/union/account
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#lending-account-user_data}
- *
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsAccount (options = {}) {
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/union/account',
- options
- )
- }
-
- /**
- * Get Purchase Record (USER_DATA)
- *
- * GET /sapi/v1/lending/union/purchaseRecord
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-purchase-record-user_data}
- *
- * @param {string} lendingType - "DAILY" for flexible,
- * "ACTIVITY" for activity, "CUSTOMIZED_FIXED" for fixed
- * @param {object} [options]
- * @param {string} [options.asset]
- * @param {number} [options.startTime]
- * @param {number} [options.endTime]
- * @param {number} [options.current] - Currently querying page. Start from 1. Default:1
- * @param {number} [options.size] - Default:10, Max:100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsPurchaseRecord (lendingType, options = {}) {
- validateRequiredParameters({ lendingType })
-
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/union/purchaseRecord',
- Object.assign(options, {
- lendingType
- })
- )
- }
-
- /**
- * Get Redemption Record (USER_DATA)
- *
- * GET /sapi/v1/lending/union/redemptionRecord
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-redemption-record-user_data}
- *
- * @param {string} lendingType - "DAILY" for flexible,
- * "ACTIVITY" for activity, "CUSTOMIZED_FIXED" for fixed
- * @param {object} [options]
- * @param {string} [options.asset]
- * @param {number} [options.startTime]
- * @param {number} [options.endTime]
- * @param {number} [options.current] - Currently querying page. Start from 1. Default:1
- * @param {number} [options.size] - Default:10, Max:100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsRedemptionRecord (lendingType, options = {}) {
- validateRequiredParameters({ lendingType })
-
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/union/redemptionRecord',
- Object.assign(options, {
- lendingType
- })
- )
- }
-
- /**
- * Get Interest History (USER_DATA)
- *
- * GET /sapi/v1/lending/union/interestHistory
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data-2}
- *
- * @param {string} lendingType - "DAILY" for flexible,
- * "ACTIVITY" for activity, "CUSTOMIZED_FIXED" for fixed
- * @param {object} [options]
- * @param {string} [options.asset]
- * @param {number} [options.startTime]
- * @param {number} [options.endTime]
- * @param {number} [options.current] - Currently querying page. Start from 1. Default:1
- * @param {number} [options.size] - Default:10, Max:100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- savingsInterestHistory (lendingType, options = {}) {
- validateRequiredParameters({ lendingType })
-
- return this.signRequest(
- 'GET',
- '/sapi/v1/lending/union/interestHistory',
- Object.assign(options, {
- lendingType
- })
- )
- }
-}
-
-module.exports = Savings
diff --git a/src/modules/restful/staking.js b/src/modules/restful/staking.js
deleted file mode 100644
index 1eb1b554..00000000
--- a/src/modules/restful/staking.js
+++ /dev/null
@@ -1,195 +0,0 @@
-'use strict'
-
-const { validateRequiredParameters } = require('../../helpers/validation')
-
-/**
- * API staking endpoints
- * @module Staking
- * @param {*} superclass
- */
-const Staking = superclass => class extends superclass {
- /**
- * Get Staking Product List (USER_DATA)
- *
- * GET /sapi/v1/staking/productList
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-list-user_data}
- *
- * @param {string} product - * `STAKING` - for Locked Staking, * `F_DEFI` - for flexible DeFi Staking, * `L_DEFI` - for locked DeFi Staking
- * @param {object} [options]
- * @param {string} [options.asset]
- * @param {number} [options.current] - Currently querying page. Start from 1. Default:1
- * @param {number} [options.size] - Default:10, Max:100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- stakingProductList (product, options = {}) {
- validateRequiredParameters({ product })
- return this.signRequest(
- 'GET',
- '/sapi/v1/staking/productList',
- Object.assign(options, {
- product
- })
- )
- }
-
- /**
- * Purchase Staking Product (USER_DATA)
- *
- * POST /sapi/v1/staking/purchase
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#purchase-staking-product-user_data}
- *
- * @param {string} product - * `STAKING` - for Locked Staking, * `F_DEFI` - for flexible DeFi Staking, * `L_DEFI` - for locked DeFi Staking
- * @param {string} productId
- * @param {number} amount
- * @param {object} [options]
- * @param {string} [options.renewable] - true or false, default false. Active if product is `STAKING` or `L_DEFI`
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- stakingPurchaseProduct (product, productId, amount, options = {}) {
- validateRequiredParameters({ product, productId, amount })
- return this.signRequest(
- 'POST',
- '/sapi/v1/staking/purchase',
- Object.assign(options, {
- product,
- productId,
- amount
- })
- )
- }
-
- /**
- * Redeem Staking Product (USER_DATA)
- *
- * POST /sapi/v1/staking/redeem
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#redeem-staking-product-user_data}
- *
- * @param {string} product - * `STAKING` - for Locked Staking, * `F_DEFI` - for flexible DeFi Staking, * `L_DEFI` - for locked DeFi Staking
- * @param {string} productId
- * @param {object} [options]
- * @param {string} [options.positionId] - Mandatory if product is `STAKING` or `L_DEFI`
- * @param {number} [options.amount] - Mandatory if product is `F_DEFI`
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- stakingRedeemProduct (product, productId, options = {}) {
- validateRequiredParameters({ product, productId })
- return this.signRequest(
- 'POST',
- '/sapi/v1/staking/redeem',
- Object.assign(options, {
- product,
- productId
- })
- )
- }
-
- /**
- * Get Staking Product Position (USER_DATA)
- *
- * GET /sapi/v1/staking/position
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-position-user_data}
- *
- * @param {string} product - * `STAKING` - for Locked Staking, * `F_DEFI` - for flexible DeFi Staking, * `L_DEFI` - for locked DeFi Staking
- * @param {object} [options]
- * @param {string} [options.productId]
- * @param {string} [options.asset]
- * @param {number} [options.current] - Currently querying the page. Start from 1. Default:1
- * @param {number} [options.size] - Default:10, Max:100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- stakingProductPosition (product, options = {}) {
- validateRequiredParameters({ product })
- return this.signRequest(
- 'GET',
- '/sapi/v1/staking/position',
- Object.assign(options, {
- product
- })
- )
- }
-
- /**
- * Get Staking History (USER_DATA)
- *
- * GET /sapi/v1/staking/stakingRecord
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-staking-history-user_data}
- *
- * @param {string} product - * `STAKING` - for Locked Staking, * `F_DEFI` - for flexible DeFi Staking, * `L_DEFI` - for locked DeFi Staking
- * @param {string} txnType - `SUBSCRIPTION`, `REDEMPTION`, `INTEREST`
- * @param {object} [options]
- * @param {string} [options.asset]
- * @param {number} [options.startTime]
- * @param {number} [options.endTime]
- * @param {number} [options.current] - Currently querying the page. Start from 1. Default:1
- * @param {number} [options.size] - Default:10, Max:100
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- stakingHistory (product, txnType, options = {}) {
- validateRequiredParameters({ product, txnType })
- return this.signRequest(
- 'GET',
- '/sapi/v1/staking/stakingRecord',
- Object.assign(options, {
- product,
- txnType
- })
- )
- }
-
- /**
- * Set Auto Staking (USER_DATA)
- *
- * POST /sapi/v1/staking/setAutoStaking
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#set-auto-staking-user_data}
- *
- * @param {string} product - * `STAKING` - for Locked Staking, * `L_DEFI` - for locked DeFi Staking
- * @param {string} positionId
- * @param {string} renewable - true or false
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- stakingSetAutoStaking (product, positionId, renewable, options = {}) {
- validateRequiredParameters({ product, positionId, renewable })
- return this.signRequest(
- 'POST',
- '/sapi/v1/staking/setAutoStaking',
- Object.assign(options, {
- product,
- positionId,
- renewable
- })
- )
- }
-
- /**
- * Get Personal Left Quota of Staking Product (USER_DATA)
- *
- * GET /sapi/v1/staking/personalLeftQuota
- *
- * {@link https://binance-docs.github.io/apidocs/spot/en/#get-personal-left-quota-of-staking-product-user_data}
- *
- * @param {string} product - * `STAKING` - for Locked Staking, * `F_DEFI` - for flexible DeFi Staking, * `L_DEFI` - for locked DeFi Staking
- * @param {string} productId
- * @param {object} [options]
- * @param {number} [options.recvWindow] - The value cannot be greater than 60000
- */
- stakingProductQuota (product, productId, options = {}) {
- validateRequiredParameters({ product, productId })
- return this.signRequest(
- 'GET',
- '/sapi/v1/staking/personalLeftQuota',
- Object.assign(options, {
- product,
- productId
- })
- )
- }
-}
-
-module.exports = Staking