Merge pull request #378 from JJ-Cro/Update031024
feat(): added new endpoints
This commit is contained in:
22
examples/apidoc/V5/Broker/issue-voucher.js
Normal file
22
examples/apidoc/V5/Broker/issue-voucher.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.issueBrokerVoucher({
|
||||||
|
accountId: '2846381',
|
||||||
|
awardId: '123456',
|
||||||
|
specCode: 'award-001',
|
||||||
|
amount: '100',
|
||||||
|
brokerId: 'v-28478',
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
21
examples/apidoc/V5/Broker/query-issued-voucher.js
Normal file
21
examples/apidoc/V5/Broker/query-issued-voucher.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getBrokerVoucherSpec({
|
||||||
|
accountId: '5714139',
|
||||||
|
awardId: '189528',
|
||||||
|
specCode: 'demo000',
|
||||||
|
withUsedAmount: false,
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
18
examples/apidoc/V5/Broker/query-voucher-spec.js
Normal file
18
examples/apidoc/V5/Broker/query-voucher-spec.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getBrokerIssuedVoucher({
|
||||||
|
id: '80209',
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.18",
|
"version": "3.10.19",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.18",
|
"version": "3.10.19",
|
||||||
"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.18",
|
"version": "3.10.19",
|
||||||
"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",
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import {
|
|||||||
BatchOrderParamsV5,
|
BatchOrderParamsV5,
|
||||||
BatchOrdersResponseV5,
|
BatchOrdersResponseV5,
|
||||||
BorrowHistoryRecordV5,
|
BorrowHistoryRecordV5,
|
||||||
|
BrokerIssuedVoucherV5,
|
||||||
|
BrokerVoucherSpecV5,
|
||||||
CancelAllOrdersParamsV5,
|
CancelAllOrdersParamsV5,
|
||||||
CancelOrderParamsV5,
|
CancelOrderParamsV5,
|
||||||
CategoryCursorListV5,
|
CategoryCursorListV5,
|
||||||
@@ -65,6 +67,7 @@ import {
|
|||||||
GetAllowedDepositCoinInfoParamsV5,
|
GetAllowedDepositCoinInfoParamsV5,
|
||||||
GetAssetInfoParamsV5,
|
GetAssetInfoParamsV5,
|
||||||
GetBorrowHistoryParamsV5,
|
GetBorrowHistoryParamsV5,
|
||||||
|
GetBrokerIssuedVoucherParamsV5,
|
||||||
GetBrokerSubAccountDepositsV5,
|
GetBrokerSubAccountDepositsV5,
|
||||||
GetClassicTransactionLogsParamsV5,
|
GetClassicTransactionLogsParamsV5,
|
||||||
GetClosedPnLParamsV5,
|
GetClosedPnLParamsV5,
|
||||||
@@ -114,6 +117,7 @@ import {
|
|||||||
InsuranceResponseV5,
|
InsuranceResponseV5,
|
||||||
InternalDepositRecordV5,
|
InternalDepositRecordV5,
|
||||||
InternalTransferRecordV5,
|
InternalTransferRecordV5,
|
||||||
|
IssueVoucherParamsV5,
|
||||||
LeverageTokenInfoV5,
|
LeverageTokenInfoV5,
|
||||||
LeveragedTokenMarketResultV5,
|
LeveragedTokenMarketResultV5,
|
||||||
LongShortRatioV5,
|
LongShortRatioV5,
|
||||||
@@ -2167,4 +2171,37 @@ export class RestClientV5 extends BaseRestClient {
|
|||||||
params,
|
params,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query Voucher Spec
|
||||||
|
*/
|
||||||
|
getBrokerVoucherSpec(params: {
|
||||||
|
id: string;
|
||||||
|
}): Promise<APIResponseV3WithTime<BrokerVoucherSpecV5>> {
|
||||||
|
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<undefined>> {
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,3 +15,18 @@ export interface GetBrokerSubAccountDepositsV5 {
|
|||||||
limit?: number;
|
limit?: number;
|
||||||
cursor?: string;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -59,3 +59,28 @@ export interface ExchangeBrokerSubAccountDepositRecordV5 {
|
|||||||
batchReleaseLimit: string;
|
batchReleaseLimit: string;
|
||||||
depositType: string;
|
depositType: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface BrokerVoucherSpecV5 {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user