chore(4.1.0): updated earn types to include V5 suffix

This commit is contained in:
JJ-Cro
2025-03-26 11:13:03 +01:00
parent 855c90dc4b
commit 9bb6cae032
5 changed files with 234 additions and 234 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "bybit-api", "name": "bybit-api",
"version": "4.0.2", "version": "4.1.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "bybit-api", "name": "bybit-api",
"version": "4.0.2", "version": "4.1.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"axios": "^1.7.9", "axios": "^1.7.9",

View File

@@ -1,6 +1,6 @@
{ {
"name": "bybit-api", "name": "bybit-api",
"version": "4.0.2", "version": "4.1.0",
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.", "description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",

View File

@@ -1,225 +1,225 @@
/* eslint-disable max-len */ /* eslint-disable max-len */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { import {
APIResponseV3, APIResponseV3,
APIResponseV3WithTime, APIResponseV3WithTime,
AccountBorrowCollateralLimitV5, AccountBorrowCollateralLimitV5,
AccountCoinBalanceV5, AccountCoinBalanceV5,
AccountInfoV5, AccountInfoV5,
AccountMarginModeV5, AccountMarginModeV5,
AccountOrderV5, AccountOrderV5,
AccountTypeV5, AccountTypeV5,
AddOrReduceMarginParamsV5, AddOrReduceMarginParamsV5,
AddOrReduceMarginResultV5, AddOrReduceMarginResultV5,
AffiliateUserInfoV5, AffiliateUserInfoV5,
AffiliateUserListItemV5, AffiliateUserListItemV5,
AllCoinsBalanceV5, AllCoinsBalanceV5,
AllowedDepositCoinInfoV5, AllowedDepositCoinInfoV5,
AmendOrderParamsV5, AmendOrderParamsV5,
ApiKeyInfoV5, ApiKeyInfoV5,
AssetInfoV5, AssetInfoV5,
BatchAmendOrderParamsV5, BatchAmendOrderParamsV5,
BatchAmendOrderResultV5, BatchAmendOrderResultV5,
BatchCancelOrderParamsV5, BatchCancelOrderParamsV5,
BatchCancelOrderResultV5, BatchCancelOrderResultV5,
BatchCreateOrderResultV5, BatchCreateOrderResultV5,
BatchOrderParamsV5, BatchOrderParamsV5,
BatchOrdersResponseV5, BatchOrdersResponseV5,
BorrowCryptoLoanParamsV5, BorrowCryptoLoanParamsV5,
BorrowHistoryRecordV5, BorrowHistoryRecordV5,
BrokerIssuedVoucherV5, BrokerIssuedVoucherV5,
BrokerVoucherSpecV5, BrokerVoucherSpecV5,
CancelAllOrdersParamsV5, CancelAllOrdersParamsV5,
CancelOrderParamsV5, CancelOrderParamsV5,
CategoryCursorListV5, CategoryCursorListV5,
CategoryListV5, CategoryListV5,
CategorySymbolListV5, CategorySymbolListV5,
CategoryV5, CategoryV5,
ClosedPnLV5, ClosedPnLV5,
CoinExchangeRecordV5, CoinExchangeRecordV5,
CoinGreeksV5, CoinGreeksV5,
CoinInfoV5, CoinInfoV5,
CollateralInfoV5, CollateralInfoV5,
CompletedLoanOrderV5, CompletedLoanOrderV5,
ConfirmNewRiskLimitParamsV5, ConfirmNewRiskLimitParamsV5,
ConvertCoinSpecV5, ConvertCoinSpecV5,
ConvertCoinsParamsV5, ConvertCoinsParamsV5,
ConvertHistoryRecordV5, ConvertHistoryRecordV5,
ConvertQuoteV5, ConvertQuoteV5,
ConvertStatusV5, ConvertStatusV5,
CreateP2PAdParamsV5, CreateP2PAdParamsV5,
CreateSubApiKeyParamsV5, CreateSubApiKeyParamsV5,
CreateSubApiKeyResultV5, CreateSubApiKeyResultV5,
CreateSubMemberParamsV5, CreateSubMemberParamsV5,
CreateSubMemberResultV5, CreateSubMemberResultV5,
CursorListV5, CursorListV5,
CursorRowsV5, CursorRowsV5,
DCPInfoV5, DCPInfoV5,
DeleteSubMemberParamsV5, DeleteSubMemberParamsV5,
DeliveryPriceV5, DeliveryPriceV5,
DeliveryRecordV5, DeliveryRecordV5,
DepositAddressChainV5, DepositAddressChainV5,
DepositRecordV5, DepositRecordV5,
EarnOrderHistory, EarnOrderHistoryV5,
EarnPosition, EarnPositionV5,
EarnProduct, EarnProductV5,
ExchangeBrokerAccountInfoV5, ExchangeBrokerAccountInfoV5,
ExchangeBrokerEarningResultV5, ExchangeBrokerEarningResultV5,
ExchangeBrokerSubAccountDepositRecordV5, ExchangeBrokerSubAccountDepositRecordV5,
ExecutionV5, ExecutionV5,
FeeRateV5, FeeRateV5,
FundingRateHistoryResponseV5, FundingRateHistoryResponseV5,
GetAccountCoinBalanceParamsV5, GetAccountCoinBalanceParamsV5,
GetAccountHistoricOrdersParamsV5, GetAccountHistoricOrdersParamsV5,
GetAccountOrdersParamsV5, GetAccountOrdersParamsV5,
GetAllCoinsBalanceParamsV5, GetAllCoinsBalanceParamsV5,
GetAllowedDepositCoinInfoParamsV5, GetAllowedDepositCoinInfoParamsV5,
GetAssetInfoParamsV5, GetAssetInfoParamsV5,
GetBorrowHistoryParamsV5, GetBorrowHistoryParamsV5,
GetBrokerIssuedVoucherParamsV5, GetBrokerIssuedVoucherParamsV5,
GetBrokerSubAccountDepositsV5, GetBrokerSubAccountDepositsV5,
GetClassicTransactionLogsParamsV5, GetClassicTransactionLogsParamsV5,
GetClosedPnLParamsV5, GetClosedPnLParamsV5,
GetCoinExchangeRecordParamsV5, GetCoinExchangeRecordParamsV5,
GetCompletedLoanOrderHistoryParamsV5, GetCompletedLoanOrderHistoryParamsV5,
GetConvertHistoryParamsV5, GetConvertHistoryParamsV5,
GetDeliveryPriceParamsV5, GetDeliveryPriceParamsV5,
GetDeliveryRecordParamsV5, GetDeliveryRecordParamsV5,
GetDepositRecordParamsV5, GetDepositRecordParamsV5,
GetEarnOrderHistoryParams, GetEarnOrderHistoryParamsV5,
GetEarnPositionParams, GetEarnPositionParamsV5,
GetExchangeBrokerEarningsParamsV5, GetExchangeBrokerEarningsParamsV5,
GetExecutionListParamsV5, GetExecutionListParamsV5,
GetFeeRateParamsV5, GetFeeRateParamsV5,
GetFundingRateHistoryParamsV5, GetFundingRateHistoryParamsV5,
GetHistoricalVolatilityParamsV5, GetHistoricalVolatilityParamsV5,
GetIndexPriceKlineParamsV5, GetIndexPriceKlineParamsV5,
GetInstrumentsInfoParamsV5, GetInstrumentsInfoParamsV5,
GetInsuranceParamsV5, GetInsuranceParamsV5,
GetInternalDepositRecordParamsV5, GetInternalDepositRecordParamsV5,
GetInternalTransferParamsV5, GetInternalTransferParamsV5,
GetKlineParamsV5, GetKlineParamsV5,
GetLoanLTVAdjustmentHistoryParamsV5, GetLoanLTVAdjustmentHistoryParamsV5,
GetLongShortRatioParamsV5, GetLongShortRatioParamsV5,
GetMarkPriceKlineParamsV5, GetMarkPriceKlineParamsV5,
GetMovePositionHistoryParamsV5, GetMovePositionHistoryParamsV5,
GetOpenInterestParamsV5, GetOpenInterestParamsV5,
GetOptionDeliveryPriceParamsV5, GetOptionDeliveryPriceParamsV5,
GetOrderbookParamsV5, GetOrderbookParamsV5,
GetP2PAccountCoinsBalanceParamsV5, GetP2PAccountCoinsBalanceParamsV5,
GetP2PCounterpartyUserInfoParamsV5, GetP2PCounterpartyUserInfoParamsV5,
GetP2POnlineAdsParamsV5, GetP2POnlineAdsParamsV5,
GetP2POrderMessagesParamsV5, GetP2POrderMessagesParamsV5,
GetP2POrdersParamsV5, GetP2POrdersParamsV5,
GetP2PPendingOrdersParamsV5, GetP2PPendingOrdersParamsV5,
GetP2PPersonalAdsParamsV5, GetP2PPersonalAdsParamsV5,
GetPreUpgradeClosedPnlParamsV5, GetPreUpgradeClosedPnlParamsV5,
GetPreUpgradeOptionDeliveryRecordParamsV5, GetPreUpgradeOptionDeliveryRecordParamsV5,
GetPreUpgradeOrderHistoryParamsV5, GetPreUpgradeOrderHistoryParamsV5,
GetPreUpgradeTradeHistoryParamsV5, GetPreUpgradeTradeHistoryParamsV5,
GetPreUpgradeTransactionLogParamsV5, GetPreUpgradeTransactionLogParamsV5,
GetPreUpgradeUSDCSessionParamsV5, GetPreUpgradeUSDCSessionParamsV5,
GetPremiumIndexPriceKlineParamsV5, GetPremiumIndexPriceKlineParamsV5,
GetPublicTradingHistoryParamsV5, GetPublicTradingHistoryParamsV5,
GetRepaymentHistoryParamsV5, GetRepaymentHistoryParamsV5,
GetRiskLimitParamsV5, GetRiskLimitParamsV5,
GetSettlementRecordParamsV5, GetSettlementRecordParamsV5,
GetSpotLeveragedTokenOrderHistoryParamsV5, GetSpotLeveragedTokenOrderHistoryParamsV5,
GetSubAccountAllApiKeysParamsV5, GetSubAccountAllApiKeysParamsV5,
GetSubAccountDepositRecordParamsV5, GetSubAccountDepositRecordParamsV5,
GetTickersParamsV5, GetTickersParamsV5,
GetTransactionLogParamsV5, GetTransactionLogParamsV5,
GetUniversalTransferRecordsParamsV5, GetUniversalTransferRecordsParamsV5,
GetUnpaidLoanOrdersParamsV5, GetUnpaidLoanOrdersParamsV5,
GetVIPMarginDataParamsV5, GetVIPMarginDataParamsV5,
GetWalletBalanceParamsV5, GetWalletBalanceParamsV5,
GetWithdrawalRecordsParamsV5, GetWithdrawalRecordsParamsV5,
HistoricalVolatilityV5, HistoricalVolatilityV5,
InstrumentInfoResponseV5, InstrumentInfoResponseV5,
InsuranceResponseV5, InsuranceResponseV5,
InternalDepositRecordV5, InternalDepositRecordV5,
InternalTransferRecordV5, InternalTransferRecordV5,
IssueVoucherParamsV5, IssueVoucherParamsV5,
LeverageTokenInfoV5, LeverageTokenInfoV5,
LeveragedTokenMarketResultV5, LeveragedTokenMarketResultV5,
LoanLTVAdjustmentHistoryV5, LoanLTVAdjustmentHistoryV5,
LongShortRatioV5, LongShortRatioV5,
MMPModifyParamsV5, MMPModifyParamsV5,
MMPStateV5, MMPStateV5,
MarkP2POrderAsPaidParamsV5, MarkP2POrderAsPaidParamsV5,
MovePositionHistoryV5, MovePositionHistoryV5,
MovePositionParamsV5, MovePositionParamsV5,
MovePositionResultV5, MovePositionResultV5,
OHLCKlineV5, OHLCKlineV5,
OHLCVKlineV5, OHLCVKlineV5,
OpenInterestResponseV5, OpenInterestResponseV5,
OptionDeliveryPriceV5, OptionDeliveryPriceV5,
OrderParamsV5, OrderParamsV5,
OrderResultV5, OrderResultV5,
OrderSideV5, OrderSideV5,
OrderbookResponseV5, OrderbookResponseV5,
P2PAccountCoinsBalanceV5, P2PAccountCoinsBalanceV5,
P2PAdDetailV5, P2PAdDetailV5,
P2PCounterpartyUserInfoV5, P2PCounterpartyUserInfoV5,
P2PCreateAdResponseV5, P2PCreateAdResponseV5,
P2POnlineAdsResponseV5, P2POnlineAdsResponseV5,
P2POrderDetailV5, P2POrderDetailV5,
P2POrderMessageV5, P2POrderMessageV5,
P2POrdersResponseV5, P2POrdersResponseV5,
P2PPersonalAdsResponseV5, P2PPersonalAdsResponseV5,
P2PUserInfoV5, P2PUserInfoV5,
P2PUserPaymentV5, P2PUserPaymentV5,
PositionInfoParamsV5, PositionInfoParamsV5,
PositionV5, PositionV5,
PreUpgradeOptionsDelivery, PreUpgradeOptionsDelivery,
PreUpgradeTransaction, PreUpgradeTransaction,
PreUpgradeUSDCSessionSettlement, PreUpgradeUSDCSessionSettlement,
PublicTradeV5, PublicTradeV5,
PurchaseSpotLeveragedTokenParamsV5, PurchaseSpotLeveragedTokenParamsV5,
PurchaseSpotLeveragedTokenResultV5, PurchaseSpotLeveragedTokenResultV5,
RedeemSpotLeveragedTokenParamsV5, RedeemSpotLeveragedTokenParamsV5,
RedeemSpotLeveragedTokenResultV5, RedeemSpotLeveragedTokenResultV5,
RepayLiabilityParamsV5, RepayLiabilityParamsV5,
RepayLiabilityResultV5, RepayLiabilityResultV5,
RepaymentHistoryV5, RepaymentHistoryV5,
RequestConvertQuoteParamsV5, RequestConvertQuoteParamsV5,
RiskLimitV5, RiskLimitV5,
SendP2POrderMessageParamsV5, SendP2POrderMessageParamsV5,
SetAutoAddMarginParamsV5, SetAutoAddMarginParamsV5,
SetCollateralCoinParamsV5, SetCollateralCoinParamsV5,
SetLeverageParamsV5, SetLeverageParamsV5,
SetRiskLimitParamsV5, SetRiskLimitParamsV5,
SetRiskLimitResultV5, SetRiskLimitResultV5,
SetTPSLModeParamsV5, SetTPSLModeParamsV5,
SetTradingStopParamsV5, SetTradingStopParamsV5,
SettlementRecordV5, SettlementRecordV5,
SpotBorrowCheckResultV5, SpotBorrowCheckResultV5,
SpotLeveragedTokenOrderHistoryV5, SpotLeveragedTokenOrderHistoryV5,
SpotMarginStateV5, SpotMarginStateV5,
SubMemberV5, SubMemberV5,
SubmitStakeRedeemParams, SubmitStakeRedeemParamsV5,
SwitchIsolatedMarginParamsV5, SwitchIsolatedMarginParamsV5,
SwitchPositionModeParamsV5, SwitchPositionModeParamsV5,
TPSLModeV5, TPSLModeV5,
TickerLinearInverseV5, TickerLinearInverseV5,
TickerOptionV5, TickerOptionV5,
TickerSpotV5, TickerSpotV5,
TransactionLogV5, TransactionLogV5,
UnifiedAccountUpgradeResultV5, UnifiedAccountUpgradeResultV5,
UniversalTransferParamsV5, UniversalTransferParamsV5,
UniversalTransferRecordV5, UniversalTransferRecordV5,
UnpaidLoanOrderV5, UnpaidLoanOrderV5,
UpdateApiKeyParamsV5, UpdateApiKeyParamsV5,
UpdateApiKeyResultV5, UpdateApiKeyResultV5,
UpdateP2PAdParamsV5, UpdateP2PAdParamsV5,
VIPMarginDataV5, VIPMarginDataV5,
VaspEntityV5, VaspEntityV5,
VipBorrowableCoinsV5, VipBorrowableCoinsV5,
VipCollateralCoinsV5, VipCollateralCoinsV5,
WalletBalanceV5, WalletBalanceV5,
WithdrawParamsV5, WithdrawParamsV5,
WithdrawableAmountV5, WithdrawableAmountV5,
WithdrawalRecordV5, WithdrawalRecordV5,
} from './types'; } from './types';
import { REST_CLIENT_TYPE_ENUM } from './util'; import { REST_CLIENT_TYPE_ENUM } from './util';
import BaseRestClient from './util/BaseRestClient'; import BaseRestClient from './util/BaseRestClient';
@@ -2587,7 +2587,7 @@ export class RestClientV5 extends BaseRestClient {
*/ */
getEarnProduct(params: { category: string; coin?: string }): Promise< getEarnProduct(params: { category: string; coin?: string }): Promise<
APIResponseV3WithTime<{ APIResponseV3WithTime<{
list: EarnProduct[]; list: EarnProductV5[];
}> }>
> { > {
return this.get('/v5/earn/product', params); return this.get('/v5/earn/product', params);
@@ -2603,7 +2603,7 @@ export class RestClientV5 extends BaseRestClient {
* within 48 hours. Once the redemption request is initiated, it cannot be canceled, * within 48 hours. Once the redemption request is initiated, it cannot be canceled,
* and your principal will continue to earn interest until the process is completed. * and your principal will continue to earn interest until the process is completed.
*/ */
submitStakeRedeem(params: SubmitStakeRedeemParams): Promise< submitStakeRedeem(params: SubmitStakeRedeemParamsV5): Promise<
APIResponseV3WithTime<{ APIResponseV3WithTime<{
orderId: string; orderId: string;
orderLinkId: string; orderLinkId: string;
@@ -2620,9 +2620,9 @@ export class RestClientV5 extends BaseRestClient {
* Note: Either orderId or orderLinkId is required. If both are passed, * Note: Either orderId or orderLinkId is required. If both are passed,
* make sure they're matched, otherwise returning empty result * make sure they're matched, otherwise returning empty result
*/ */
getEarnOrderHistory(params: GetEarnOrderHistoryParams): Promise< getEarnOrderHistory(params: GetEarnOrderHistoryParamsV5): Promise<
APIResponseV3WithTime<{ APIResponseV3WithTime<{
list: EarnOrderHistory[]; list: EarnOrderHistoryV5[];
}> }>
> { > {
return this.getPrivate('/v5/earn/order', params); return this.getPrivate('/v5/earn/order', params);
@@ -2635,9 +2635,9 @@ export class RestClientV5 extends BaseRestClient {
* *
* Note: Fully redeemed position is also returned in the response * Note: Fully redeemed position is also returned in the response
*/ */
getEarnPosition(params: GetEarnPositionParams): Promise< getEarnPosition(params: GetEarnPositionParamsV5): Promise<
APIResponseV3WithTime<{ APIResponseV3WithTime<{
list: EarnPosition[]; list: EarnPositionV5[];
}> }>
> { > {
return this.getPrivate('/v5/earn/position', params); return this.getPrivate('/v5/earn/position', params);

View File

@@ -1,4 +1,4 @@
export interface SubmitStakeRedeemParams { export interface SubmitStakeRedeemParamsV5 {
category: string; category: string;
orderType: 'Stake' | 'Redeem'; orderType: 'Stake' | 'Redeem';
accountType: 'FUND' | 'UNIFIED'; accountType: 'FUND' | 'UNIFIED';
@@ -8,13 +8,13 @@ export interface SubmitStakeRedeemParams {
orderLinkId: string; orderLinkId: string;
} }
export interface GetEarnOrderHistoryParams { export interface GetEarnOrderHistoryParamsV5 {
category: string; category: string;
orderId?: string; orderId?: string;
orderLinkId?: string; orderLinkId?: string;
} }
export interface GetEarnPositionParams { export interface GetEarnPositionParamsV5 {
category: string; category: string;
productId?: string; productId?: string;
coin?: string; coin?: string;

View File

@@ -1,4 +1,4 @@
export interface EarnProduct { export interface EarnProductV5 {
category: string; category: string;
estimateApr: string; estimateApr: string;
coin: string; coin: string;
@@ -9,7 +9,7 @@ export interface EarnProduct {
status: 'Available' | 'NotAvailable'; status: 'Available' | 'NotAvailable';
} }
export interface EarnOrderHistory { export interface EarnOrderHistoryV5 {
coin: string; coin: string;
orderValue: string; orderValue: string;
orderType: 'Redeem' | 'Stake'; orderType: 'Redeem' | 'Stake';
@@ -21,7 +21,7 @@ export interface EarnOrderHistory {
updatedAt: string; updatedAt: string;
} }
export interface EarnPosition { export interface EarnPositionV5 {
coin: string; coin: string;
productId: string; productId: string;
amount: string; amount: string;