Merge pull request #346 from karimsan/master
v3.10.4: Introduce `getSubAccountAllApiKeys`, update `deleteSubApiKey`
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.3",
|
"version": "3.10.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.3",
|
"version": "3.10.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.6.6",
|
"axios": "^1.6.6",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.3",
|
"version": "3.10.4",
|
||||||
"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",
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ import {
|
|||||||
GetRiskLimitParamsV5,
|
GetRiskLimitParamsV5,
|
||||||
GetSettlementRecordParamsV5,
|
GetSettlementRecordParamsV5,
|
||||||
GetSpotLeveragedTokenOrderHistoryParamsV5,
|
GetSpotLeveragedTokenOrderHistoryParamsV5,
|
||||||
|
GetSubAccountAllApiKeysParamsV5,
|
||||||
GetSubAccountDepositRecordParamsV5,
|
GetSubAccountDepositRecordParamsV5,
|
||||||
GetTickersParamsV5,
|
GetTickersParamsV5,
|
||||||
GetTransactionLogParamsV5,
|
GetTransactionLogParamsV5,
|
||||||
@@ -126,6 +127,7 @@ import {
|
|||||||
SettlementRecordV5,
|
SettlementRecordV5,
|
||||||
SpotBorrowCheckResultV5,
|
SpotBorrowCheckResultV5,
|
||||||
SpotLeveragedTokenOrderHistoryV5,
|
SpotLeveragedTokenOrderHistoryV5,
|
||||||
|
SubAccountAllApiKeysResultV5,
|
||||||
SubMemberV5,
|
SubMemberV5,
|
||||||
SwitchIsolatedMarginParamsV5,
|
SwitchIsolatedMarginParamsV5,
|
||||||
SwitchPositionModeParamsV5,
|
SwitchPositionModeParamsV5,
|
||||||
@@ -1295,6 +1297,17 @@ export class RestClientV5 extends BaseRestClient {
|
|||||||
return this.getPrivate('/v5/user/query-sub-members');
|
return this.getPrivate('/v5/user/query-sub-members');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query all api keys information of a sub UID.
|
||||||
|
*/
|
||||||
|
getSubAccountAllApiKeys(
|
||||||
|
params: GetSubAccountAllApiKeysParamsV5,
|
||||||
|
): Promise<
|
||||||
|
APIResponseV3WithTime<SubAccountAllApiKeysResultV5>
|
||||||
|
> {
|
||||||
|
return this.getPrivate('/v5/user/sub-apikeys', params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Froze sub uid. Use master user's api key only.
|
* Froze sub uid. Use master user's api key only.
|
||||||
*
|
*
|
||||||
@@ -1361,12 +1374,16 @@ export class RestClientV5 extends BaseRestClient {
|
|||||||
*
|
*
|
||||||
* TIP:
|
* TIP:
|
||||||
* The API key must have one of the permissions to be allowed to call the following API endpoint.
|
* The API key must have one of the permissions to be allowed to call the following API endpoint.
|
||||||
* - sub API key: "Account Transfer"
|
* - sub API key: "Account Transfer", "Sub Member Transfer"
|
||||||
|
* - master API Key: "Account Transfer", "Sub Member Transfer", "Withdrawal"
|
||||||
*
|
*
|
||||||
* DANGER: BE CAREFUL! The API key used to call this interface will be invalid immediately.
|
* DANGER: BE CAREFUL! The sub API key used to call this interface will be invalid immediately.
|
||||||
*/
|
*/
|
||||||
deleteSubApiKey(): Promise<APIResponseV3WithTime<{}>> {
|
deleteSubApiKey(params?: { apikey?: string; }): Promise<APIResponseV3WithTime<{}>> {
|
||||||
return this.postPrivate('/v5/user/delete-sub-api');
|
return this.postPrivate(
|
||||||
|
'/v5/user/delete-sub-api',
|
||||||
|
params,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,3 +39,9 @@ export interface UpdateSubApiKeyUpdateParamsV5 {
|
|||||||
export interface DeleteSubMemberParamsV5 {
|
export interface DeleteSubMemberParamsV5 {
|
||||||
subMemberId: string;
|
subMemberId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GetSubAccountAllApiKeysParamsV5 {
|
||||||
|
subMemberId: string;
|
||||||
|
limit?: number;
|
||||||
|
cursor?: string;
|
||||||
|
}
|
||||||
@@ -34,7 +34,7 @@ export interface ApiKeyInfoV5 {
|
|||||||
secret: string;
|
secret: string;
|
||||||
permissions: PermissionsV5;
|
permissions: PermissionsV5;
|
||||||
ips?: string[];
|
ips?: string[];
|
||||||
type: 1 | 2;
|
type: ApiKeyType;
|
||||||
deadlineDay?: number;
|
deadlineDay?: number;
|
||||||
expiredAt?: string;
|
expiredAt?: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
@@ -57,3 +57,22 @@ export interface UpdateApiKeyResultV5 {
|
|||||||
permissions: PermissionsV5;
|
permissions: PermissionsV5;
|
||||||
ips: string[];
|
ips: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SubAccountAllApiKeysResultV5 {
|
||||||
|
result: {
|
||||||
|
id: string;
|
||||||
|
ips?: string[];
|
||||||
|
apiKey: string;
|
||||||
|
note: string;
|
||||||
|
status: number;
|
||||||
|
expiredAt?: string;
|
||||||
|
createdAt: string;
|
||||||
|
type: ApiKeyType;
|
||||||
|
permissions: PermissionsV5;
|
||||||
|
secret: string;
|
||||||
|
readOnly: 0 | 1;
|
||||||
|
deadlineDay?: number;
|
||||||
|
flag: string;
|
||||||
|
}[],
|
||||||
|
nextPageCursor: string;
|
||||||
|
}
|
||||||
|
|||||||
@@ -273,6 +273,16 @@ describe('Private READ V5 REST API Endpoints', () => {
|
|||||||
...successResponseObjectV3(),
|
...successResponseObjectV3(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getSubAccountAllApiKeys()', async () => {
|
||||||
|
expect(
|
||||||
|
await api.getSubAccountAllApiKeys({subMemberId: 'fakeid'})
|
||||||
|
).toMatchObject({
|
||||||
|
// ...successResponseObjectV3(),
|
||||||
|
// Expected, since sub account ID is fake
|
||||||
|
retCode: API_ERROR_CODE.PARAMS_MISSING_OR_WRONG,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Spot Leverage Token APIs', () => {
|
describe('Spot Leverage Token APIs', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user