Skip to content

Commit

Permalink
Merge pull request #58 from singlesly/feat-client-id
Browse files Browse the repository at this point in the history
feat: improve generic features
  • Loading branch information
singlesly authored Oct 30, 2023
2 parents e599210 + dfec98f commit 443e91c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SignatureInterface } from 'bingx-api/bingx/account/signature.interface'
import { AccountInterface } from 'bingx-api/bingx/account/account.interface';
import { DefaultSignatureParameters } from 'bingx-api/bingx/account/default-signature-parameters';
import { SignatureParametersInterface } from 'bingx-api/bingx/account/signature-parameters.interface';
import { BingxResponse } from 'bingx-api/bingx';

export interface BalanceData {
balance: {
Expand All @@ -20,7 +21,7 @@ export interface BalanceData {
}

export class BingxGetPerpetualSwapAccountAssetEndpoint<R = BalanceData>
implements EndpointInterface<R>
implements EndpointInterface<BingxResponse<R>>
{
constructor(private readonly account: AccountInterface) {}

Expand All @@ -44,5 +45,5 @@ export class BingxGetPerpetualSwapAccountAssetEndpoint<R = BalanceData>
return this.account.sign(this.parameters());
}

readonly t!: R;
readonly t!: BingxResponse<R>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SignatureParametersInterface } from 'bingx-api/bingx/account/signature-
import { AccountInterface } from 'bingx-api/bingx/account/account.interface';
import { DefaultSignatureParameters } from 'bingx-api/bingx/account/default-signature-parameters';
import { OrderPositionSideEnum } from 'bingx-api/bingx/enums/order-position-side.enum';
import { BingxResponse } from 'bingx-api/bingx';

export interface PerpetualSwapPositionsData<
T extends number | string = string,
Expand All @@ -23,7 +24,7 @@ export interface PerpetualSwapPositionsData<

export class BingxPerpetualSwapPositionsEndpoint<R = PerpetualSwapPositionsData>
extends Endpoint
implements EndpointInterface<R>
implements EndpointInterface<BingxResponse<R>>
{
constructor(
private readonly symbol: string,
Expand All @@ -46,5 +47,5 @@ export class BingxPerpetualSwapPositionsEndpoint<R = PerpetualSwapPositionsData>
return '/openApi/swap/v2/user/positions';
}

readonly t!: R;
readonly t!: BingxResponse<R>;
}
1 change: 0 additions & 1 deletion src/bingx/endpoints/bingx-request.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { BingxResponseInterface } from 'bingx-api/bingx/endpoints/bingx-response.interface';
import { EndpointInterface } from 'bingx-api/bingx/endpoints/endpoint.interface';

export interface BingxRequestInterface<R> {
Expand Down
6 changes: 3 additions & 3 deletions src/bingx/endpoints/bingx-trade-order-endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EndpointInterface } from 'bingx-api/bingx/endpoints/endpoint.interface';
import { Endpoint } from 'bingx-api/bingx/endpoints/endpoint';
import { SignatureParametersInterface } from '../account/signature-parameters.interface';
import { BingxResponse, SignatureParametersInterface } from 'bingx-api/bingx';
import { AccountInterface } from 'bingx-api/bingx/account/account.interface';
import { BingxCreateTradeOrderInterface } from 'bingx-api/bingx/interfaces/trade-order.interface';
import { DefaultSignatureParameters } from 'bingx-api/bingx/account/default-signature-parameters';
Expand All @@ -21,7 +21,7 @@ export interface BingxOrderResponseInterface {

export class BingxTradeOrderEndpoint<R = BingxOrderResponseInterface>
extends Endpoint
implements EndpointInterface<R>
implements EndpointInterface<BingxResponse<R>>
{
constructor(
private readonly order: BingxCreateTradeOrderInterface,
Expand All @@ -30,7 +30,7 @@ export class BingxTradeOrderEndpoint<R = BingxOrderResponseInterface>
super(account);
}

readonly t!: R;
readonly t!: BingxResponse<R>;

method(): 'get' | 'post' | 'put' | 'patch' | 'delete' {
return 'post';
Expand Down

0 comments on commit 443e91c

Please sign in to comment.