@grvt/client 1.4.15 → 1.4.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/TDG/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type AxiosRequestConfig } from 'axios';
2
- import { type IAckResponse, type IApiAggregatedAccountSummaryResponse, type IApiCancelAllOrdersRequest, type IApiCancelAllOrdersResponse, type IApiCancelOrderRequest, type IApiCancelOrderResponse, type IApiCreateBulkOrdersRequest, type IApiCreateBulkOrdersResponse, type IApiCreateOrderRequest, type IApiCreateOrderResponse, type IApiDedustPositionRequest, type IApiDedustPositionResponse, type IApiDepositHistoryRequest, type IApiDepositHistoryResponse, type IApiFillHistoryRequest, type IApiFillHistoryResponse, type IApiFundingAccountSummaryResponse, type IApiFundingPaymentHistoryRequest, type IApiFundingPaymentHistoryResponse, type IApiGetAllInitialLeverageRequest, type IApiGetAllInitialLeverageResponse, type IApiGetMarginTiersResponse, type IApiGetOrderGroupRequest, type IApiGetOrderGroupResponse, type IApiGetOrderRequest, type IApiGetOrderResponse, type IApiOpenOrdersRequest, type IApiOpenOrdersResponse, type IApiOrderHistoryRequest, type IApiOrderHistoryResponse, type IApiPositionsRequest, type IApiPositionsResponse, type IApiPreDepositCheckRequest, type IApiPreDepositCheckResponse, type IApiPreOrderCheckRequest, type IApiPreOrderCheckResponse, type IApiQueryListFundingAccountSummaryRequest, type IApiQueryListFundingAccountSummaryResponse, type IApiQueryListSubAccountSummaryRequest, type IApiQueryListSubAccountSummaryResponse, type IApiQuerySnapVaultPositionRequest, type IApiQuerySnapVaultPositionResponse, type IApiQueryTradingPerformanceRequest, type IApiQueryTradingPerformanceResponse, type IApiQueryTradingPerformanceTrendRequest, type IApiQueryTradingPerformanceTrendResponse, type IApiQueryVaultPerformanceRequest, type IApiQueryVaultPerformanceResponse, type IApiQueryVaultPerformanceTrendRequest, type IApiQueryVaultPerformanceTrendResponse, type IApiQueryVaultRiskMetricRequest, type IApiQueryVaultRiskMetricResponse, type IApiQueryVaultSummaryHistoryRequest, type IApiQueryVaultSummaryHistoryResponse, type IApiReplaceOrdersRequest, type IApiReplaceOrdersResponse, type IApiSetInitialLeverageRequest, type IApiSetInitialLeverageResponse, type IApiSocializedLossStatusResponse, type IApiSubAccountHistoryRequest, type IApiSubAccountHistoryResponse, type IApiSubAccountSummaryRequest, type IApiSubAccountSummaryResponse, type IApiTimedAssetExposureRequest, type IApiTimedAssetExposureResponse, type IApiTimedVaultAssetExposureRequest, type IApiTransferHistoryRequest, type IApiTransferHistoryResponse, type IApiTransferRequest, type IApiTransferResponse, type IApiVaultBurnTokensRequest, type IApiVaultInvestorSummaryRequest, type IApiVaultInvestorSummaryResponse, type IApiVaultInvestRequest, type IApiVaultRedeemCancelRequest, type IApiVaultRedeemRequest, type IApiVaultViewRedemptionQueueRequest, type IApiVaultViewRedemptionQueueResponse, type IApiWithdrawalHistoryRequest, type IApiWithdrawalHistoryResponse, type IApiWithdrawalRequest, type IConfig } from '../interfaces';
2
+ import { type IAckResponse, type IApiAggregatedAccountSummaryResponse, type IApiCancelAllOrdersRequest, type IApiCancelAllOrdersResponse, type IApiCancelOrderRequest, type IApiCancelOrderResponse, type IApiCreateBulkOrdersRequest, type IApiCreateBulkOrdersResponse, type IApiCreateOrderRequest, type IApiCreateOrderResponse, type IApiDedustPositionRequest, type IApiDedustPositionResponse, type IApiDepositHistoryRequest, type IApiDepositHistoryResponse, type IApiFillHistoryRequest, type IApiFillHistoryResponse, type IApiFundingAccountSummaryResponse, type IApiFundingPaymentHistoryRequest, type IApiFundingPaymentHistoryResponse, type IApiGetAllInitialLeverageRequest, type IApiGetAllInitialLeverageResponse, type IApiGetMarginTiersResponse, type IApiGetOrderGroupRequest, type IApiGetOrderGroupResponse, type IApiGetOrderRequest, type IApiGetOrderResponse, type IApiOpenOrdersRequest, type IApiOpenOrdersResponse, type IApiOrderHistoryRequest, type IApiOrderHistoryResponse, type IApiPositionsRequest, type IApiPositionsResponse, type IApiPreDepositCheckRequest, type IApiPreDepositCheckResponse, type IApiPreOrderCheckRequest, type IApiPreOrderCheckResponse, type IApiQueryListFundingAccountSummaryRequest, type IApiQueryListFundingAccountSummaryResponse, type IApiQueryListSubAccountSummaryRequest, type IApiQueryListSubAccountSummaryResponse, type IApiQuerySnapVaultPositionRequest, type IApiQuerySnapVaultPositionResponse, type IApiQueryTradingPerformanceRequest, type IApiQueryTradingPerformanceResponse, type IApiQueryTradingPerformanceTrendRequest, type IApiQueryTradingPerformanceTrendResponse, type IApiQueryVaultPerformanceRequest, type IApiQueryVaultPerformanceResponse, type IApiQueryVaultPerformanceTrendRequest, type IApiQueryVaultPerformanceTrendResponse, type IApiQueryVaultRiskMetricRequest, type IApiQueryVaultRiskMetricResponse, type IApiQueryVaultSummaryHistoryRequest, type IApiQueryVaultSummaryHistoryResponse, type IApiReplaceOrdersRequest, type IApiReplaceOrdersResponse, type IApiSetInitialLeverageRequest, type IApiSetInitialLeverageResponse, type IApiSocializedLossStatusResponse, type IApiSubAccountHistoryRequest, type IApiSubAccountHistoryResponse, type IApiSubAccountSummaryRequest, type IApiSubAccountSummaryResponse, type IApiTimedAssetExposureRequest, type IApiTimedAssetExposureResponse, type IApiTimedVaultAssetExposureRequest, type IApiTransferHistoryRequest, type IApiTransferHistoryResponse, type IApiTransferRequest, type IApiTransferResponse, type IApiVaultBurnTokensRequest, type IApiVaultDetailRequest, type IApiVaultDetailResponse, type IApiVaultInvestorSummaryRequest, type IApiVaultInvestorSummaryResponse, type IApiVaultInvestRequest, type IApiVaultRedeemCancelRequest, type IApiVaultRedeemRequest, type IApiVaultViewRedemptionQueueRequest, type IApiVaultViewRedemptionQueueResponse, type IApiWithdrawalHistoryRequest, type IApiWithdrawalHistoryResponse, type IApiWithdrawalRequest, type IConfig } from '../interfaces';
3
3
  export declare class TDG {
4
4
  private readonly _axios;
5
5
  private readonly _fullUrl;
@@ -125,4 +125,5 @@ export declare class TDG {
125
125
  vaultSummaryHistory(payload: IApiQueryVaultSummaryHistoryRequest, config?: AxiosRequestConfig): Promise<IApiQueryVaultSummaryHistoryResponse>;
126
126
  vaultAssetExposure(payload: IApiTimedVaultAssetExposureRequest, config?: AxiosRequestConfig): Promise<IApiTimedAssetExposureResponse>;
127
127
  snapVaultPosition(payload: IApiQuerySnapVaultPositionRequest, config?: AxiosRequestConfig): Promise<IApiQuerySnapVaultPositionResponse>;
128
+ vaultDetail(payload: IApiVaultDetailRequest, config?: AxiosRequestConfig): Promise<IApiVaultDetailResponse>;
128
129
  }
package/TDG/index.js CHANGED
@@ -311,5 +311,10 @@ class TDG {
311
311
  return utils_1.Utils.schemaMap(response.data, interfaces_1.API_QUERY_SNAP_VAULT_POSITION_RESPONSE_MAP.LITE_TO_FULL);
312
312
  }).catch(utils_1.Utils.coverApiError);
313
313
  }
314
+ vaultDetail(payload, config) {
315
+ return this._axios.post(this._liteUrl + '/vault_detail', utils_1.Utils.schemaMap(payload, interfaces_1.API_VAULT_DETAIL_REQUEST_MAP.FULL_TO_LITE, true), config).then((response) => {
316
+ return utils_1.Utils.schemaMap(response.data, interfaces_1.API_VAULT_DETAIL_RESPONSE_MAP.LITE_TO_FULL);
317
+ }).catch(utils_1.Utils.coverApiError);
318
+ }
314
319
  }
315
320
  exports.TDG = TDG;
@@ -651,6 +651,8 @@ export interface IApiQueryVaultPerformanceRequest {
651
651
  export interface IApiQueryVaultPerformanceResponse {
652
652
  trading_volume?: string;
653
653
  apr?: number;
654
+ realized_pnl?: string;
655
+ pnl?: string;
654
656
  }
655
657
  export interface IApiQueryVaultPerformanceTrendRequest {
656
658
  vault_id?: string;
@@ -848,6 +850,17 @@ export interface IApiVaultBurnTokensRequest {
848
850
  num_tokens?: string;
849
851
  signature?: ISignature;
850
852
  }
853
+ export interface IApiVaultDetailRequest {
854
+ vault_id?: string;
855
+ }
856
+ export interface IApiVaultDetailResponse {
857
+ share_price?: string;
858
+ total_equity?: string;
859
+ valuation_cap?: string;
860
+ unrealized_pnl?: string;
861
+ initial_margin?: string;
862
+ maintenance_margin?: string;
863
+ }
851
864
  export interface IApiVaultInvestRequest {
852
865
  main_account_id?: string;
853
866
  vault_id?: string;
@@ -1592,11 +1605,14 @@ export interface IVaultRedeemResults {
1592
1605
  export interface IVaultRedemption {
1593
1606
  num_lp_tokens?: string;
1594
1607
  request_valuation?: string;
1608
+ request_time?: string;
1609
+ max_redemption_period_timestamp?: string;
1595
1610
  }
1596
1611
  export interface IVaultRedemptionReqView {
1597
1612
  request_time?: string;
1598
1613
  currency?: ECurrency;
1599
1614
  num_lp_tokens?: string;
1615
+ max_redemption_period_timestamp?: string;
1600
1616
  }
1601
1617
  export interface IWSCancelFeedDataV1 {
1602
1618
  stream?: string;
@@ -5,10 +5,14 @@ exports.API_QUERY_VAULT_PERFORMANCE_RESPONSE_MAP = void 0;
5
5
  exports.API_QUERY_VAULT_PERFORMANCE_RESPONSE_MAP = Object.freeze({
6
6
  FULL_TO_LITE: {
7
7
  trading_volume: 'tv',
8
- apr: 'a'
8
+ apr: 'a',
9
+ realized_pnl: 'rp',
10
+ pnl: 'p'
9
11
  },
10
12
  LITE_TO_FULL: {
11
13
  tv: 'trading_volume',
12
- a: 'apr'
14
+ a: 'apr',
15
+ rp: 'realized_pnl',
16
+ p: 'pnl'
13
17
  }
14
18
  });
@@ -0,0 +1,2 @@
1
+ import { type SchemaPairMap } from './types';
2
+ export declare const API_VAULT_DETAIL_REQUEST_MAP: SchemaPairMap;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_VAULT_DETAIL_REQUEST_MAP = void 0;
4
+ // Schema map for the 'API_VAULT_DETAIL_REQUEST' struct.
5
+ exports.API_VAULT_DETAIL_REQUEST_MAP = Object.freeze({
6
+ FULL_TO_LITE: {
7
+ vault_id: 'vi'
8
+ },
9
+ LITE_TO_FULL: {
10
+ vi: 'vault_id'
11
+ }
12
+ });
@@ -0,0 +1,2 @@
1
+ import { type SchemaPairMap } from './types';
2
+ export declare const API_VAULT_DETAIL_RESPONSE_MAP: SchemaPairMap;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_VAULT_DETAIL_RESPONSE_MAP = void 0;
4
+ // Schema map for the 'API_VAULT_DETAIL_RESPONSE' struct.
5
+ exports.API_VAULT_DETAIL_RESPONSE_MAP = Object.freeze({
6
+ FULL_TO_LITE: {
7
+ share_price: 'sp',
8
+ total_equity: 'te',
9
+ valuation_cap: 'vc',
10
+ unrealized_pnl: 'up',
11
+ initial_margin: 'im',
12
+ maintenance_margin: 'mm'
13
+ },
14
+ LITE_TO_FULL: {
15
+ sp: 'share_price',
16
+ te: 'total_equity',
17
+ vc: 'valuation_cap',
18
+ up: 'unrealized_pnl',
19
+ im: 'initial_margin',
20
+ mm: 'maintenance_margin'
21
+ }
22
+ });
@@ -143,6 +143,8 @@ export * from './api_transfer_response';
143
143
  export * from './api_user_category_affinity_score_request';
144
144
  export * from './api_user_category_affinity_score_response';
145
145
  export * from './api_vault_burn_tokens_request';
146
+ export * from './api_vault_detail_request';
147
+ export * from './api_vault_detail_response';
146
148
  export * from './api_vault_invest_request';
147
149
  export * from './api_vault_investor_summary_request';
148
150
  export * from './api_vault_investor_summary_response';
@@ -159,6 +159,8 @@ __exportStar(require("./api_transfer_response"), exports);
159
159
  __exportStar(require("./api_user_category_affinity_score_request"), exports);
160
160
  __exportStar(require("./api_user_category_affinity_score_response"), exports);
161
161
  __exportStar(require("./api_vault_burn_tokens_request"), exports);
162
+ __exportStar(require("./api_vault_detail_request"), exports);
163
+ __exportStar(require("./api_vault_detail_response"), exports);
162
164
  __exportStar(require("./api_vault_invest_request"), exports);
163
165
  __exportStar(require("./api_vault_investor_summary_request"), exports);
164
166
  __exportStar(require("./api_vault_investor_summary_response"), exports);
@@ -5,10 +5,14 @@ exports.VAULT_REDEMPTION_MAP = void 0;
5
5
  exports.VAULT_REDEMPTION_MAP = Object.freeze({
6
6
  FULL_TO_LITE: {
7
7
  num_lp_tokens: 'nl',
8
- request_valuation: 'rv'
8
+ request_valuation: 'rv',
9
+ request_time: 'rt',
10
+ max_redemption_period_timestamp: 'mr'
9
11
  },
10
12
  LITE_TO_FULL: {
11
13
  nl: 'num_lp_tokens',
12
- rv: 'request_valuation'
14
+ rv: 'request_valuation',
15
+ rt: 'request_time',
16
+ mr: 'max_redemption_period_timestamp'
13
17
  }
14
18
  });
@@ -6,11 +6,13 @@ exports.VAULT_REDEMPTION_REQ_VIEW_MAP = Object.freeze({
6
6
  FULL_TO_LITE: {
7
7
  request_time: 'rt',
8
8
  currency: 'c',
9
- num_lp_tokens: 'nl'
9
+ num_lp_tokens: 'nl',
10
+ max_redemption_period_timestamp: 'mr'
10
11
  },
11
12
  LITE_TO_FULL: {
12
13
  rt: 'request_time',
13
14
  c: 'currency',
14
- nl: 'num_lp_tokens'
15
+ nl: 'num_lp_tokens',
16
+ mr: 'max_redemption_period_timestamp'
15
17
  }
16
18
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grvt/client",
3
- "version": "1.4.15",
3
+ "version": "1.4.17",
4
4
  "description": "Node.js & JavaScript client for GRVT REST APIs & WebSockets",
5
5
  "repository": {
6
6
  "type": "git",
package/ws/ws.js CHANGED
@@ -217,11 +217,11 @@ class WS {
217
217
  const depositDestinationAccountId = omitZeroStr(result.to_account_id);
218
218
  const transferSourceKey = [
219
219
  omitZeroStr(result.from_account_id),
220
- omitZeroStr(result.from_sub_account_id) ? result.from_sub_account_id : 0
220
+ omitZeroStr(result.from_sub_account_id)
221
221
  ].filter(Boolean).join('-');
222
222
  const transferDestinationKey = [
223
223
  omitZeroStr(result.to_account_id),
224
- omitZeroStr(result.to_sub_account_id) ? result.to_sub_account_id : 0
224
+ omitZeroStr(result.to_sub_account_id)
225
225
  ].filter(Boolean).join('-');
226
226
  const withdrawalFromAccountId = omitZeroStr(result.from_account_id);
227
227
  switch (stream) {
@@ -408,10 +408,7 @@ class WS {
408
408
  return params.main_account_id;
409
409
  };
410
410
  const transferFeed = (params) => {
411
- if (params.sub_account_id) {
412
- return [params.main_account_id, params.sub_account_id].join('-');
413
- }
414
- return params.main_account_id;
411
+ return [params.main_account_id, params.sub_account_id].filter(Boolean).join('-');
415
412
  };
416
413
  const withdrawalFeed = (params) => {
417
414
  return params.main_account_id;