v3.10.28 feat(): added new endpoints, updated examples

This commit is contained in:
JJ-Cro
2025-01-06 11:17:18 +01:00
parent a88c5003b0
commit 6ae65220f9
7 changed files with 1734 additions and 7522 deletions

View File

@@ -0,0 +1,18 @@
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.getTransferableAmount({
coinName: 'USDT',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -0,0 +1,18 @@
// https://api.bybit.com/v5/broker/account-info
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.getAffiliateUserInfo({ uid: '1234567890' })
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

View File

@@ -1,3 +1,5 @@
// https://api.bybit.com/v5/broker/account-info
const { RestClientV5 } = require('bybit-api'); const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({ const client = new RestClientV5({
@@ -7,7 +9,7 @@ const client = new RestClientV5({
}); });
client client
.getAffiliateUserInfo({ uid: '1513500' }) .getAffiliateUserList()
.then((response) => { .then((response) => {
console.log(response); console.log(response);
}) })

9153
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "bybit-api", "name": "bybit-api",
"version": "3.10.27", "version": "3.10.28",
"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

@@ -12,6 +12,7 @@ import {
AddOrReduceMarginParamsV5, AddOrReduceMarginParamsV5,
AddOrReduceMarginResultV5, AddOrReduceMarginResultV5,
AffiliateUserInfoV5, AffiliateUserInfoV5,
AffiliateUserListItemV5,
AllCoinsBalanceV5, AllCoinsBalanceV5,
AllowedDepositCoinInfoV5, AllowedDepositCoinInfoV5,
AmendOrderParamsV5, AmendOrderParamsV5,
@@ -995,6 +996,20 @@ export class RestClientV5 extends BaseRestClient {
return this.getPrivate('/v5/account/wallet-balance', params); return this.getPrivate('/v5/account/wallet-balance', params);
} }
/**
* Query the available amount to transfer of a specific coin in the Unified wallet.
*
* @param coinName Coin name, uppercase only
*/
getTransferableAmount(params: {
coinName: string;
}): Promise<APIResponseV3WithTime<{
availableWithdrawal: string;
}>> {
return this.getPrivate('/v5/account/withdrawal', params);
}
/**
/** /**
* Upgrade to unified account. * Upgrade to unified account.
* *
@@ -1782,6 +1797,32 @@ export class RestClientV5 extends BaseRestClient {
return this.postPrivate('/v5/user/del-submember', params); return this.postPrivate('/v5/user/del-submember', params);
} }
/**
*
****** Affiliate APIs
*
*/
/**
* Get Affiliate User List.
* To use this endpoint, you should have an affiliate account and only tick "affiliate" permission while creating the API key.
*
* TIP:
* - Use master UID only
* - The api key can only have "Affiliate" permission
*/
getAffiliateUserList(params?: {
size?: number;
cursor?: string;
}): Promise<APIResponseV3WithTime<{
list: AffiliateUserListItemV5[];
nextPageCursor: string;
}>> {
return this.getPrivate('/v5/affiliate/aff-user-list', params);
}
/** /**
* Get Affiliate User Info. * Get Affiliate User Info.
* *

View File

@@ -78,6 +78,14 @@ export interface SubAccountAllApiKeysResultV5 {
nextPageCursor: string; nextPageCursor: string;
} }
export interface AffiliateUserListItemV5 {
userId: string;
registerTime: string;
source: string;
remarks: string;
isKyc: boolean;
}
export interface AffiliateUserInfoV5 { export interface AffiliateUserInfoV5 {
uid: string; uid: string;
vipLevel: string; vipLevel: string;