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