feat(): added new endpoints

This commit is contained in:
Jerko J
2024-10-03 13:34:36 +02:00
parent 409127039e
commit 4cd58406c6
8 changed files with 141 additions and 3 deletions

View File

@@ -23,6 +23,8 @@ import {
BatchOrderParamsV5,
BatchOrdersResponseV5,
BorrowHistoryRecordV5,
BrokerIssuedVoucherV5,
BrokerVoucherSpec,
CancelAllOrdersParamsV5,
CancelOrderParamsV5,
CategoryCursorListV5,
@@ -65,6 +67,7 @@ import {
GetAllowedDepositCoinInfoParamsV5,
GetAssetInfoParamsV5,
GetBorrowHistoryParamsV5,
GetBrokerIssuedVoucherParamsV5,
GetBrokerSubAccountDepositsV5,
GetClassicTransactionLogsParamsV5,
GetClosedPnLParamsV5,
@@ -114,6 +117,7 @@ import {
InsuranceResponseV5,
InternalDepositRecordV5,
InternalTransferRecordV5,
IssueVoucherParamsV5,
LeverageTokenInfoV5,
LeveragedTokenMarketResultV5,
LongShortRatioV5,
@@ -2167,4 +2171,37 @@ export class RestClientV5 extends BaseRestClient {
params,
);
}
/**
* Query Voucher Spec
*/
getBrokerVoucherSpec(params: {
id: string;
}): Promise<APIResponseV3WithTime<BrokerVoucherSpec>> {
return this.postPrivate('/v5/broker/award/info', params);
}
/**
* Issue a voucher to a user
*
* INFO
* Use exchange broker master account to issue
*/
issueBrokerVoucher(
params: IssueVoucherParamsV5,
): Promise<APIResponseV3<any>> {
return this.postPrivate('/v5/broker/award/distribute-award', params);
}
/**
* Query an issued voucher
*
* INFO
* Use exchange broker master account to query
*/
getBrokerIssuedVoucher(
params: GetBrokerIssuedVoucherParamsV5,
): Promise<APIResponseV3<BrokerIssuedVoucherV5>> {
return this.postPrivate('/v5/broker/award/distribution-record', params);
}
}

View File

@@ -15,3 +15,18 @@ export interface GetBrokerSubAccountDepositsV5 {
limit?: number;
cursor?: string;
}
export interface IssueVoucherParamsV5 {
accountId: string;
awardId: string;
specCode: string;
amount: string;
brokerId: string;
}
export interface GetBrokerIssuedVoucherParamsV5 {
accountId: string;
awardId: string;
specCode: string;
withUsedAmount?: boolean;
}

View File

@@ -59,3 +59,28 @@ export interface ExchangeBrokerSubAccountDepositRecordV5 {
batchReleaseLimit: string;
depositType: string;
}
export interface BrokerVoucherSpec {
id: string;
coin: string;
amountUnit: 'AWARD_AMOUNT_UNIT_USD' | 'AWARD_AMOUNT_UNIT_COIN';
productLine: string;
subProductLine: string;
totalAmount: {
[key: string]: string;
};
usedAmount: string;
}
export interface BrokerIssuedVoucherV5 {
accountId: string;
awardId: string;
specCode: string;
amount: string;
isClaimed: boolean;
startAt: string;
endAt: string;
effectiveAt: string;
ineffectiveAt: string;
usedAmount: string;
}