feat(): added all broker response types

This commit is contained in:
JJ-Cro
2024-12-13 12:12:16 +01:00
parent 68c5d7d89d
commit 6cabbe5edb
3 changed files with 208 additions and 19 deletions

View File

@@ -16,6 +16,9 @@ import {
ConvertTradeResponseV2,
CopyTradingProductTypeV2,
CreateSubAccountApiKeyRequestV2,
CreateSubaccountApiKeyResponseV2,
CreateSubaccountDepositAddressV2,
CreateSubaccountResponseV2,
CreateVirtualSubAccountAndApiKeyV2,
CreateVirtualSubAccountApiKeyV2,
CreateVirtualSubAccountV2,
@@ -158,6 +161,8 @@ import {
ModifyFuturesTraderOrderTPSLRequestV2,
ModifyLoanPledgeRateRequestV2,
ModifySubAccountApiKeyRequestV2,
ModifySubaccountApiKeyResponseV2,
ModifySubaccountResponseV2,
ModifySubRequestV2,
ModifyVirtualSubAccountApiKeyV2,
ModifyVirtualSubApiKeyRequestV2,
@@ -214,6 +219,13 @@ import {
SpotWithdrawalRecordV2,
SpotWithdrawalRequestV2,
SubAccountApiKeyListV2,
SubaccountApiKeyV2,
SubaccountDepositV2,
SubaccountEmailV2,
SubaccountFutureAssetsV2,
SubaccountsListV2,
SubaccountSpotAssetsV2,
SubaccountWithdrawalV2,
SubDepositRecordsRequestV2,
SubmitSpotBatchOrdersResponseV2,
SubWithdrawalRecordsRequestV2,
@@ -1451,33 +1463,45 @@ export class RestClientV2 extends BaseRestClient {
modifySubaccountEmail(params: {
subUid: string;
subaccountEmail: string;
}): Promise<APIResponse<any>> {
}): Promise<APIResponse<string>> {
return this.postPrivate(
'/api/v2/broker/account/modify-subaccount-email',
params,
);
}
getBrokerInfo(): Promise<APIResponse<any>> {
getBrokerInfo(): Promise<
APIResponse<{
subAccountSize: string;
maxSubAccountSize: string;
uTime: string;
}>
> {
return this.getPrivate('/api/v2/broker/account/info');
}
createSubaccount(params: {
subaccountName: string;
label: string;
}): Promise<APIResponse<any>> {
}): Promise<APIResponse<CreateSubaccountResponseV2>> {
return this.postPrivate('/api/v2/broker/account/create-subaccount', params);
}
getSubaccounts(params?: GetSubAccountsRequestV2): Promise<APIResponse<any>> {
getSubaccounts(
params?: GetSubAccountsRequestV2,
): Promise<APIResponse<SubaccountsListV2>> {
return this.getPrivate('/api/v2/broker/account/subaccount-list', params);
}
modifySubaccount(params: ModifySubRequestV2): Promise<APIResponse<any>> {
modifySubaccount(
params: ModifySubRequestV2,
): Promise<APIResponse<ModifySubaccountResponseV2>> {
return this.postPrivate('/api/v2/broker/account/modify-subaccount', params);
}
getSubaccountEmail(params: { subUid: string }): Promise<APIResponse<any>> {
getSubaccountEmail(params: {
subUid: string;
}): Promise<APIResponse<SubaccountEmailV2>> {
return this.getPrivate('/api/v2/broker/account/subaccount-email', params);
}
@@ -1485,7 +1509,7 @@ export class RestClientV2 extends BaseRestClient {
subUid: string;
coin?: string;
assetType?: 'hold_only' | 'all';
}): Promise<APIResponse<any>> {
}): Promise<APIResponse<SubaccountSpotAssetsV2>> {
return this.getPrivate(
'/api/v2/broker/account/subaccount-spot-assets',
params,
@@ -1495,7 +1519,7 @@ export class RestClientV2 extends BaseRestClient {
getSubaccountFuturesAssets(params: {
subUid: string;
productType: FuturesProductTypeV2;
}): Promise<APIResponse<any>> {
}): Promise<APIResponse<SubaccountFutureAssetsV2>> {
return this.getPrivate(
'/api/v2/broker/account/subaccount-future-assets',
params,
@@ -1506,16 +1530,19 @@ export class RestClientV2 extends BaseRestClient {
subUid: string;
coin: string;
chain?: string;
}): Promise<APIResponse<any>> {
}): Promise<APIResponse<CreateSubaccountDepositAddressV2>> {
return this.postPrivate(
'/api/v2/broker/account/subaccount-address',
params,
);
}
subaccountWithdrawal(
params: SubWithdrawalRequestV2,
): Promise<APIResponse<any>> {
subaccountWithdrawal(params: SubWithdrawalRequestV2): Promise<
APIResponse<{
orderId: string;
clientOid: string;
}>
> {
return this.postPrivate(
'/api/v2/broker/account/subaccount-withdrawal',
params,
@@ -1526,7 +1553,7 @@ export class RestClientV2 extends BaseRestClient {
subUid: string;
coin: string;
toAccountType: string;
}): Promise<APIResponse<any>> {
}): Promise<APIResponse<string>> {
return this.postPrivate(
'/api/v2/broker/account/set-subaccount-autotransfer',
params,
@@ -1535,32 +1562,34 @@ export class RestClientV2 extends BaseRestClient {
subaccountDepositRecords(
params: SubDepositRecordsRequestV2,
): Promise<APIResponse<any>> {
): Promise<APIResponse<SubaccountDepositV2>> {
return this.postPrivate('/api/v2/broker/subaccount-deposit', params);
}
subaccountWithdrawalRecords(
params: SubWithdrawalRecordsRequestV2,
): Promise<APIResponse<any>> {
): Promise<APIResponse<SubaccountWithdrawalV2>> {
return this.postPrivate('/api/v2/broker/subaccount-withdrawal', params);
}
/**
*
* * Broker | Subaccount
* Broker | Api Key
*
*/
createSubaccountApiKey(
params: CreateSubAccountApiKeyRequestV2,
): Promise<APIResponse<any>> {
): Promise<APIResponse<CreateSubaccountApiKeyResponseV2>> {
return this.postPrivate(
'/api/v2/broker/manage/create-subaccount-apikey',
params,
);
}
getSubaccountApiKey(params: { subUid: string }): Promise<APIResponse<any>> {
getSubaccountApiKey(params: {
subUid: string;
}): Promise<APIResponse<SubaccountApiKeyV2[]>> {
return this.getPrivate(
'/api/v2/broker/manage/subaccount-apikey-list',
params,
@@ -1569,7 +1598,7 @@ export class RestClientV2 extends BaseRestClient {
modifySubaccountApiKey(
params: ModifySubAccountApiKeyRequestV2,
): Promise<APIResponse<any>> {
): Promise<APIResponse<ModifySubaccountApiKeyResponseV2>> {
return this.postPrivate(
'/api/v2/broker/manage/modify-subaccount-apikey',
params,

View File

@@ -1,6 +1,7 @@
export * from './v1/futures';
export * from './v1/shared';
export * from './v1/spot';
export * from './v2/broker';
export * from './v2/common';
export * from './v2/futures';
export * from './v2/spot';

View File

@@ -0,0 +1,159 @@
/**
*
* * Broker | Subaccount
*
*/
export interface CreateSubaccountResponseV2 {
subUid: string;
subaccountName: string;
status: string;
permList: string[];
label: string;
cTime: string;
}
export interface SubaccountsListV2 {
hasNextPage: boolean;
idLessThan: number;
subList: {
subUid: string;
subaccountName: string;
status: string;
permList: string[];
label: string;
language: string;
cTime: string;
uTime: string;
}[];
}
export interface ModifySubaccountResponseV2 {
subUid: string;
subaccountName: string;
status: string;
permList: string[];
label: string;
language: string;
cTime: string;
uTime: string;
}
export interface SubaccountEmailV2 {
subUid: string;
subaccountName: string;
subaccountEmail: string;
cTime: string;
uTime: string;
}
export interface SubaccountSpotAssetsV2 {
assetsList: {
coin: string;
available: string;
frozen: string;
locked: string;
uTime: string;
}[];
}
export interface SubaccountFutureAssetsV2 {
assetsList: {
marginCoin: string;
available: string;
frozen: string;
locked: string;
crossedMaxAvailable: string;
isolatedMaxAvailable: string;
maxTransferOut: string;
accountEquity: string;
usdtEquity: string;
btcEquity: string;
uTime: string;
}[];
}
export interface CreateSubaccountDepositAddressV2 {
subUid: string;
coin: string;
address: string;
chain: string;
tag: string;
url: string;
cTime: string;
}
export interface SubaccountDepositV2 {
orderId: string;
txId: string;
coin: string;
type: string;
dest: string;
amount: string;
status: string;
fromAddress: string;
toAddress: string;
fee: string;
chain: string;
confirm: string;
tag: string;
cTime: string;
uTime: string;
}
export interface SubaccountWithdrawalV2 {
resultList: {
orderId: string;
txId: string;
coin: string;
type: string;
dest: string;
amount: string;
status: string;
fromAddress: string;
toAddress: string;
fee: string;
chain: string;
confirm: string;
tag: string;
userId: string;
cTime: string;
uTime: string;
}[];
endId: string;
}
/**
*
* Broker | Api Key
*
*/
export interface CreateSubaccountApiKeyResponseV2 {
subUid: string;
apiKey: string;
secretKey: string;
label: string;
ipList: string[];
permType: string;
permList: string[];
}
export interface SubaccountApiKeyV2 {
subUid: string;
label: string;
apiKey: string;
secretKey: string;
permType: string;
permList: string[];
ipList: string[];
}
export interface ModifySubaccountApiKeyResponseV2 {
subUid: string;
apiKey: string;
label: string;
ipList: string[];
permType: string;
permList: string[];
}