Skip to content

Commit

Permalink
chore(): updated type names, updated endpoint map
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ-Cro committed Sep 9, 2024
1 parent 452f915 commit f1fca6b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
5 changes: 5 additions & 0 deletions docs/endpointFunctionList.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ This table includes all endpoints from the official Exchange API docs and corres
| `getPortfolioMarginIndexPrice()` | | GET | `sapi/v1/portfolio/asset-index-price` |
| `getPortfolioMarginAssetLeverage()` | :closed_lock_with_key: | GET | `sapi/v1/portfolio/margin-asset-leverage` |
| `getPortfolioMarginProCollateralRate()` | | GET | `sapi/v1/portfolio/collateralRate` |
| `getPortfolioMarginProTieredCollateralRate()` | | GET | `sapi/v2/portfolio/collateralRate` |
| `getPortfolioMarginProAccountInfo()` | :closed_lock_with_key: | GET | `sapi/v1/portfolio/account` |
| `bnbTransfer()` | :closed_lock_with_key: | POST | `sapi/v1/portfolio/bnb-transfer` |
| `submitPortfolioMarginProFullTransfer()` | :closed_lock_with_key: | POST | `sapi/v1/portfolio/auto-collection` |
Expand Down Expand Up @@ -534,6 +535,10 @@ This table includes all endpoints from the official Exchange API docs and corres
| `setBNBBurnEnabled()` | :closed_lock_with_key: | POST | `fapi/v1/feeBurn` |
| `getBNBBurnStatus()` | :closed_lock_with_key: | GET | `fapi/v1/feeBurn` |
| `testOrder()` | :closed_lock_with_key: | POST | `fapi/v1/order/test` |
| `getAllConvertPairs()` | | GET | `fapi/v1/convert/exchangeInfo` |
| `submitConvertQuoteRequest()` | :closed_lock_with_key: | POST | `fapi/v1/convert/getQuote` |
| `acceptConvertQuote()` | :closed_lock_with_key: | POST | `fapi/v1/convert/acceptQuote` |
| `getConvertOrderStatus()` | :closed_lock_with_key: | GET | `fapi/v1/convert/orderStatus` |
| `getPortfolioMarginProAccountInfo()` | :closed_lock_with_key: | GET | `fapi/v1/pmAccountInfo` |
| `getBrokerIfNewFuturesUser()` | :closed_lock_with_key: | GET | `fapi/v1/apiReferral/ifNewUser` |
| `setBrokerCustomIdForClient()` | :closed_lock_with_key: | POST | `fapi/v1/apiReferral/customization` |
Expand Down
8 changes: 4 additions & 4 deletions src/types/futures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ export interface PortfolioMarginProAccountInfo {
maxWithdrawAmount: string; // This field will be ignored in the response
}

export interface ConvertPair {
export interface FuturesConvertPair {
fromAsset: string;
toAsset: string;
fromAssetMinAmount: string;
Expand All @@ -880,15 +880,15 @@ export interface ConvertPair {
toAssetMaxAmount: string;
}

export interface ConvertQuoteParams {
export interface FuturesConvertQuoteRequest {
fromAsset: string;
toAsset: string;
fromAmount?: number;
toAmount?: number;
validTime?: '10s' | '30s' | '1m' | '2m';
}

export interface ConvertQuote {
export interface FuturesConvertQuote {
quoteId: string;
ratio: string;
inverseRatio: string;
Expand All @@ -897,7 +897,7 @@ export interface ConvertQuote {
fromAmount: string;
}

export interface ConvertOrderStatus {
export interface FuturesConvertOrderStatus {
orderId: string;
orderStatus: 'PROCESS' | 'ACCEPT_SUCCESS' | 'SUCCESS' | 'FAIL';
fromAsset: string;
Expand Down
16 changes: 9 additions & 7 deletions src/usdm-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ import {
FuturesAccountConfig,
SymbolConfig,
UserForceOrder,
ConvertPair,
ConvertQuote,
ConvertQuoteParams,
ConvertOrderStatus,
FuturesConvertPair,
FuturesConvertQuote,
FuturesConvertOrderStatus,
FuturesConvertQuoteRequest,
} from './types/futures';

import {
Expand Down Expand Up @@ -607,11 +607,13 @@ export class USDMClient extends BaseRestClient {
getAllConvertPairs(params?: {
fromAsset?: string;
toAsset?: string;
}): Promise<ConvertPair[]> {
}): Promise<FuturesConvertPair[]> {
return this.get('fapi/v1/convert/exchangeInfo', params);
}

submitConvertQuoteRequest(params: ConvertQuoteParams): Promise<ConvertQuote> {
submitConvertQuoteRequest(
params: FuturesConvertQuoteRequest,
): Promise<FuturesConvertQuote> {
return this.postPrivate('fapi/v1/convert/getQuote', params);
}

Expand All @@ -626,7 +628,7 @@ export class USDMClient extends BaseRestClient {
getConvertOrderStatus(params: {
orderId?: string;
quoteId?: string;
}): Promise<ConvertOrderStatus> {
}): Promise<FuturesConvertOrderStatus> {
return this.getPrivate('fapi/v1/convert/orderStatus', params);
}

Expand Down

0 comments on commit f1fca6b

Please sign in to comment.