@grvt/client 1.4.14 → 1.4.16

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.
Files changed (29) hide show
  1. package/README.md +62 -62
  2. package/TDG/index.d.ts +3 -1
  3. package/TDG/index.js +10 -0
  4. package/interfaces/codegen/data.interface.d.ts +40 -1
  5. package/interfaces/codegen/data.interface.js +8 -0
  6. package/interfaces/codegen/enum-int.js +5 -1
  7. package/interfaces/codegen/schema-maps/api_query_snap_vault_position_request.d.ts +2 -0
  8. package/interfaces/codegen/schema-maps/api_query_snap_vault_position_request.js +12 -0
  9. package/interfaces/codegen/schema-maps/api_query_snap_vault_position_response.d.ts +2 -0
  10. package/interfaces/codegen/schema-maps/api_query_snap_vault_position_response.js +15 -0
  11. package/interfaces/codegen/schema-maps/api_set_derisk_to_maintenance_margin_ratio_request.d.ts +2 -0
  12. package/interfaces/codegen/schema-maps/api_set_derisk_to_maintenance_margin_ratio_request.js +17 -0
  13. package/interfaces/codegen/schema-maps/api_set_derisk_to_maintenance_margin_ratio_response.d.ts +2 -0
  14. package/interfaces/codegen/schema-maps/api_set_derisk_to_maintenance_margin_ratio_response.js +12 -0
  15. package/interfaces/codegen/schema-maps/api_vault_detail_request.d.ts +2 -0
  16. package/interfaces/codegen/schema-maps/api_vault_detail_request.js +12 -0
  17. package/interfaces/codegen/schema-maps/api_vault_detail_response.d.ts +2 -0
  18. package/interfaces/codegen/schema-maps/api_vault_detail_response.js +16 -0
  19. package/interfaces/codegen/schema-maps/index.d.ts +8 -0
  20. package/interfaces/codegen/schema-maps/index.js +8 -0
  21. package/interfaces/codegen/schema-maps/order.js +4 -2
  22. package/interfaces/codegen/schema-maps/query_latest_sub_account_summary_request.d.ts +2 -0
  23. package/interfaces/codegen/schema-maps/query_latest_sub_account_summary_request.js +12 -0
  24. package/interfaces/codegen/schema-maps/query_latest_sub_account_summary_response.d.ts +2 -0
  25. package/interfaces/codegen/schema-maps/query_latest_sub_account_summary_response.js +13 -0
  26. package/interfaces/codegen/schema-maps/snap_sub_account.js +6 -2
  27. package/interfaces/codegen/schema-maps/vault_redemption.js +6 -2
  28. package/interfaces/codegen/schema-maps/vault_redemption_req_view.js +4 -2
  29. package/package.json +50 -50
package/README.md CHANGED
@@ -1,62 +1,62 @@
1
- # GRVT
2
-
3
- Node.js & JavaScript client for GRVT REST APIs & WebSockets
4
-
5
- ## Installing
6
-
7
- Using npm:
8
-
9
- ```bash
10
- npm install @grvt/client
11
- ```
12
-
13
- Using yarn:
14
-
15
- ```bash
16
- yarn add @grvt/client
17
- ```
18
-
19
- Using pnpm:
20
-
21
- ```bash
22
- pnpm add @grvt/client
23
- ```
24
-
25
- Once the package is installed, you can import the library using `import` or `require` approach:
26
-
27
- ```js
28
- import GRVT from '@grvt/client'
29
- ```
30
-
31
- You can also use the default export, since the named export is just a re-export from the GRVT factory:
32
-
33
- ```js
34
- import GRVT from '@grvt/client'
35
- console.log(
36
- new GRVT.MDG({
37
- host: 'https://market-data.dev.gravitymarkets.io',
38
- version: 'v1'
39
- })
40
- )
41
- ```
42
-
43
- If you use `require` for importing:
44
-
45
- ```js
46
- const GRVT = require('@grvt/client')
47
- console.log(
48
- new GRVT.MDG({
49
- host: 'https://market-data.dev.gravitymarkets.io',
50
- version: 'v1'
51
- })
52
- )
53
- ```
54
-
55
- ## To use WebSocket (available only in browsers/platforms that support WebSocket)
56
-
57
- [Browsers supported](https://caniuse.com/websockets)
58
-
59
- ```js
60
- import { EStreamEndpoints, WS } from '@grvt/client/ws'
61
- console.log(new WS('wss://market-data.dev.gravitymarkets.io/ws'))
62
- ```
1
+ # GRVT
2
+
3
+ Node.js & JavaScript client for GRVT REST APIs & WebSockets
4
+
5
+ ## Installing
6
+
7
+ Using npm:
8
+
9
+ ```bash
10
+ npm install @grvt/client
11
+ ```
12
+
13
+ Using yarn:
14
+
15
+ ```bash
16
+ yarn add @grvt/client
17
+ ```
18
+
19
+ Using pnpm:
20
+
21
+ ```bash
22
+ pnpm add @grvt/client
23
+ ```
24
+
25
+ Once the package is installed, you can import the library using `import` or `require` approach:
26
+
27
+ ```js
28
+ import GRVT from '@grvt/client'
29
+ ```
30
+
31
+ You can also use the default export, since the named export is just a re-export from the GRVT factory:
32
+
33
+ ```js
34
+ import GRVT from '@grvt/client'
35
+ console.log(
36
+ new GRVT.MDG({
37
+ host: 'https://market-data.dev.gravitymarkets.io',
38
+ version: 'v1'
39
+ })
40
+ )
41
+ ```
42
+
43
+ If you use `require` for importing:
44
+
45
+ ```js
46
+ const GRVT = require('@grvt/client')
47
+ console.log(
48
+ new GRVT.MDG({
49
+ host: 'https://market-data.dev.gravitymarkets.io',
50
+ version: 'v1'
51
+ })
52
+ )
53
+ ```
54
+
55
+ ## To use WebSocket (available only in browsers/platforms that support WebSocket)
56
+
57
+ [Browsers supported](https://caniuse.com/websockets)
58
+
59
+ ```js
60
+ import { EStreamEndpoints, WS } from '@grvt/client/ws'
61
+ console.log(new WS('wss://market-data.dev.gravitymarkets.io/ws'))
62
+ ```
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 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;
@@ -124,4 +124,6 @@ export declare class TDG {
124
124
  vaultRiskMetric(payload: IApiQueryVaultRiskMetricRequest, config?: AxiosRequestConfig): Promise<IApiQueryVaultRiskMetricResponse>;
125
125
  vaultSummaryHistory(payload: IApiQueryVaultSummaryHistoryRequest, config?: AxiosRequestConfig): Promise<IApiQueryVaultSummaryHistoryResponse>;
126
126
  vaultAssetExposure(payload: IApiTimedVaultAssetExposureRequest, config?: AxiosRequestConfig): Promise<IApiTimedAssetExposureResponse>;
127
+ snapVaultPosition(payload: IApiQuerySnapVaultPositionRequest, config?: AxiosRequestConfig): Promise<IApiQuerySnapVaultPositionResponse>;
128
+ vaultDetail(payload: IApiVaultDetailRequest, config?: AxiosRequestConfig): Promise<IApiVaultDetailResponse>;
127
129
  }
package/TDG/index.js CHANGED
@@ -306,5 +306,15 @@ class TDG {
306
306
  return utils_1.Utils.schemaMap(response.data, interfaces_1.API_TIMED_ASSET_EXPOSURE_RESPONSE_MAP.LITE_TO_FULL);
307
307
  }).catch(utils_1.Utils.coverApiError);
308
308
  }
309
+ snapVaultPosition(payload, config) {
310
+ return this._axios.post(this._liteUrl + '/snap_vault_position', utils_1.Utils.schemaMap(payload, interfaces_1.API_QUERY_SNAP_VAULT_POSITION_REQUEST_MAP.FULL_TO_LITE, true), config).then((response) => {
311
+ return utils_1.Utils.schemaMap(response.data, interfaces_1.API_QUERY_SNAP_VAULT_POSITION_RESPONSE_MAP.LITE_TO_FULL);
312
+ }).catch(utils_1.Utils.coverApiError);
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
+ }
309
319
  }
310
320
  exports.TDG = TDG;
@@ -144,7 +144,11 @@ export declare enum EOrderRejectReason {
144
144
  CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED = "CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED",
145
145
  OCO_COUNTER_PART_TRIGGERED = "OCO_COUNTER_PART_TRIGGERED",
146
146
  REDUCE_ONLY_LIMIT = "REDUCE_ONLY_LIMIT",
147
- CLIENT_REPLACE = "CLIENT_REPLACE"
147
+ CLIENT_REPLACE = "CLIENT_REPLACE",
148
+ DERISK_MUST_BE_IOC = "DERISK_MUST_BE_IOC",
149
+ DERISK_MUST_BE_REDUCE_ONLY = "DERISK_MUST_BE_REDUCE_ONLY",
150
+ DERISK_NOT_SUPPORTED = "DERISK_NOT_SUPPORTED",
151
+ INVALID_ORDER_TYPE = "INVALID_ORDER_TYPE"
148
152
  }
149
153
  export declare enum EOrderStatus {
150
154
  PENDING = "PENDING",
@@ -618,6 +622,13 @@ export interface IApiQueryListSubAccountSummaryResponse {
618
622
  result?: ISnapSubAccountSummary[];
619
623
  next?: string;
620
624
  }
625
+ export interface IApiQuerySnapVaultPositionRequest {
626
+ vault_id?: string;
627
+ }
628
+ export interface IApiQuerySnapVaultPositionResponse {
629
+ event_time?: string;
630
+ positions?: IPositionSummary[];
631
+ }
621
632
  export interface IApiQueryTradingPerformanceRequest {
622
633
  sub_account_id?: string;
623
634
  asset?: string;
@@ -678,6 +689,14 @@ export interface IApiResolveEpochEcosystemMetricResponse {
678
689
  point?: number;
679
690
  last_calculated_time?: string;
680
691
  }
692
+ export interface IApiSetDeriskToMaintenanceMarginRatioRequest {
693
+ sub_account_id?: string;
694
+ ratio?: string;
695
+ signature?: ISignature;
696
+ }
697
+ export interface IApiSetDeriskToMaintenanceMarginRatioResponse {
698
+ success?: boolean;
699
+ }
681
700
  export interface IApiSetInitialLeverageRequest {
682
701
  sub_account_id?: string;
683
702
  instrument?: string;
@@ -829,6 +848,14 @@ export interface IApiVaultBurnTokensRequest {
829
848
  num_tokens?: string;
830
849
  signature?: ISignature;
831
850
  }
851
+ export interface IApiVaultDetailRequest {
852
+ vault_id?: string;
853
+ }
854
+ export interface IApiVaultDetailResponse {
855
+ share_price?: string;
856
+ total_equity?: string;
857
+ valuation_cap?: string;
858
+ }
832
859
  export interface IApiVaultInvestRequest {
833
860
  main_account_id?: string;
834
861
  vault_id?: string;
@@ -1180,6 +1207,7 @@ export interface IOrder {
1180
1207
  metadata?: IOrderMetadata;
1181
1208
  state?: IOrderState;
1182
1209
  is_liquidation?: boolean;
1210
+ is_derisk?: boolean;
1183
1211
  }
1184
1212
  export interface IOrderLeg {
1185
1213
  instrument?: string;
@@ -1292,6 +1320,12 @@ export interface IQueryGetListEpochRequest {
1292
1320
  export interface IQueryGetListEpochResponse {
1293
1321
  result?: IEpoch[];
1294
1322
  }
1323
+ export interface IQueryLatestSubAccountSummaryRequest {
1324
+ sub_account_id?: string;
1325
+ }
1326
+ export interface IQueryLatestSubAccountSummaryResponse {
1327
+ result?: ISnapSubAccountSummary;
1328
+ }
1295
1329
  export interface IQueryTradingPerformanceTrendRequest {
1296
1330
  sub_account_i_ds?: string[];
1297
1331
  time_interval?: ETimeInterval;
@@ -1383,6 +1417,8 @@ export interface ISubAccount {
1383
1417
  settle_index_price?: string;
1384
1418
  is_vault?: boolean;
1385
1419
  vault_im_additions?: string;
1420
+ derisk_margin?: string;
1421
+ derisk_to_maintenance_margin_ratio?: string;
1386
1422
  }
1387
1423
  export interface ISubAccountTradeAggregation {
1388
1424
  sub_account_id?: string;
@@ -1564,11 +1600,14 @@ export interface IVaultRedeemResults {
1564
1600
  export interface IVaultRedemption {
1565
1601
  num_lp_tokens?: string;
1566
1602
  request_valuation?: string;
1603
+ request_time?: string;
1604
+ max_redemption_period_timestamp?: string;
1567
1605
  }
1568
1606
  export interface IVaultRedemptionReqView {
1569
1607
  request_time?: string;
1570
1608
  currency?: ECurrency;
1571
1609
  num_lp_tokens?: string;
1610
+ max_redemption_period_timestamp?: string;
1572
1611
  }
1573
1612
  export interface IWSCancelFeedDataV1 {
1574
1613
  stream?: string;
@@ -287,6 +287,14 @@ var EOrderRejectReason;
287
287
  EOrderRejectReason["REDUCE_ONLY_LIMIT"] = "REDUCE_ONLY_LIMIT";
288
288
  // the order was replaced by a client replace request
289
289
  EOrderRejectReason["CLIENT_REPLACE"] = "CLIENT_REPLACE";
290
+ // the derisk order must be an IOC order
291
+ EOrderRejectReason["DERISK_MUST_BE_IOC"] = "DERISK_MUST_BE_IOC";
292
+ // the derisk order must be a reduce-only order
293
+ EOrderRejectReason["DERISK_MUST_BE_REDUCE_ONLY"] = "DERISK_MUST_BE_REDUCE_ONLY";
294
+ // derisk is not supported
295
+ EOrderRejectReason["DERISK_NOT_SUPPORTED"] = "DERISK_NOT_SUPPORTED";
296
+ // the order type is invalid
297
+ EOrderRejectReason["INVALID_ORDER_TYPE"] = "INVALID_ORDER_TYPE";
290
298
  })(EOrderRejectReason || (exports.EOrderRejectReason = EOrderRejectReason = {}));
291
299
  var EOrderStatus;
292
300
  (function (EOrderStatus) {
@@ -148,7 +148,11 @@ exports.EOrderRejectReasonInt = Object.freeze({
148
148
  [data_interface_1.EOrderRejectReason.CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED]: 29,
149
149
  [data_interface_1.EOrderRejectReason.OCO_COUNTER_PART_TRIGGERED]: 30,
150
150
  [data_interface_1.EOrderRejectReason.REDUCE_ONLY_LIMIT]: 31,
151
- [data_interface_1.EOrderRejectReason.CLIENT_REPLACE]: 32
151
+ [data_interface_1.EOrderRejectReason.CLIENT_REPLACE]: 32,
152
+ [data_interface_1.EOrderRejectReason.DERISK_MUST_BE_IOC]: 33,
153
+ [data_interface_1.EOrderRejectReason.DERISK_MUST_BE_REDUCE_ONLY]: 34,
154
+ [data_interface_1.EOrderRejectReason.DERISK_NOT_SUPPORTED]: 35,
155
+ [data_interface_1.EOrderRejectReason.INVALID_ORDER_TYPE]: 36
152
156
  });
153
157
  exports.EOrderStatusInt = Object.freeze({
154
158
  [data_interface_1.EOrderStatus.PENDING]: 1,
@@ -0,0 +1,2 @@
1
+ import { type SchemaPairMap } from './types';
2
+ export declare const API_QUERY_SNAP_VAULT_POSITION_REQUEST_MAP: SchemaPairMap;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_QUERY_SNAP_VAULT_POSITION_REQUEST_MAP = void 0;
4
+ // Schema map for the 'API_QUERY_SNAP_VAULT_POSITION_REQUEST' struct.
5
+ exports.API_QUERY_SNAP_VAULT_POSITION_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_QUERY_SNAP_VAULT_POSITION_RESPONSE_MAP: SchemaPairMap;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_QUERY_SNAP_VAULT_POSITION_RESPONSE_MAP = void 0;
4
+ const position_summary_1 = require("./position_summary");
5
+ // Schema map for the 'API_QUERY_SNAP_VAULT_POSITION_RESPONSE' struct.
6
+ exports.API_QUERY_SNAP_VAULT_POSITION_RESPONSE_MAP = Object.freeze({
7
+ FULL_TO_LITE: {
8
+ event_time: 'et',
9
+ positions: ['p', [position_summary_1.POSITION_SUMMARY_MAP.FULL_TO_LITE]]
10
+ },
11
+ LITE_TO_FULL: {
12
+ et: 'event_time',
13
+ p: ['positions', [position_summary_1.POSITION_SUMMARY_MAP.LITE_TO_FULL]]
14
+ }
15
+ });
@@ -0,0 +1,2 @@
1
+ import { type SchemaPairMap } from './types';
2
+ export declare const API_SET_DERISK_TO_MAINTENANCE_MARGIN_RATIO_REQUEST_MAP: SchemaPairMap;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_SET_DERISK_TO_MAINTENANCE_MARGIN_RATIO_REQUEST_MAP = void 0;
4
+ const signature_1 = require("./signature");
5
+ // Schema map for the 'API_SET_DERISK_TO_MAINTENANCE_MARGIN_RATIO_REQUEST' struct.
6
+ exports.API_SET_DERISK_TO_MAINTENANCE_MARGIN_RATIO_REQUEST_MAP = Object.freeze({
7
+ FULL_TO_LITE: {
8
+ sub_account_id: 'sa',
9
+ ratio: 'r',
10
+ signature: ['s', signature_1.SIGNATURE_MAP.FULL_TO_LITE]
11
+ },
12
+ LITE_TO_FULL: {
13
+ sa: 'sub_account_id',
14
+ r: 'ratio',
15
+ s: ['signature', signature_1.SIGNATURE_MAP.LITE_TO_FULL]
16
+ }
17
+ });
@@ -0,0 +1,2 @@
1
+ import { type SchemaPairMap } from './types';
2
+ export declare const API_SET_DERISK_TO_MAINTENANCE_MARGIN_RATIO_RESPONSE_MAP: SchemaPairMap;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_SET_DERISK_TO_MAINTENANCE_MARGIN_RATIO_RESPONSE_MAP = void 0;
4
+ // Schema map for the 'API_SET_DERISK_TO_MAINTENANCE_MARGIN_RATIO_RESPONSE' struct.
5
+ exports.API_SET_DERISK_TO_MAINTENANCE_MARGIN_RATIO_RESPONSE_MAP = Object.freeze({
6
+ FULL_TO_LITE: {
7
+ success: 's'
8
+ },
9
+ LITE_TO_FULL: {
10
+ s: 'success'
11
+ }
12
+ });
@@ -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,16 @@
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
+ },
11
+ LITE_TO_FULL: {
12
+ sp: 'share_price',
13
+ te: 'total_equity',
14
+ vc: 'valuation_cap'
15
+ }
16
+ });
@@ -94,6 +94,8 @@ export * from './api_query_list_funding_account_summary_request';
94
94
  export * from './api_query_list_funding_account_summary_response';
95
95
  export * from './api_query_list_sub_account_summary_request';
96
96
  export * from './api_query_list_sub_account_summary_response';
97
+ export * from './api_query_snap_vault_position_request';
98
+ export * from './api_query_snap_vault_position_response';
97
99
  export * from './api_query_trading_performance_request';
98
100
  export * from './api_query_trading_performance_response';
99
101
  export * from './api_query_trading_performance_trend_request';
@@ -109,6 +111,8 @@ export * from './api_query_vault_summary_history_response';
109
111
  export * from './api_replace_orders_request';
110
112
  export * from './api_replace_orders_response';
111
113
  export * from './api_resolve_epoch_ecosystem_metric_response';
114
+ export * from './api_set_derisk_to_maintenance_margin_ratio_request';
115
+ export * from './api_set_derisk_to_maintenance_margin_ratio_response';
112
116
  export * from './api_set_initial_leverage_request';
113
117
  export * from './api_set_initial_leverage_response';
114
118
  export * from './api_settlement_price_request';
@@ -139,6 +143,8 @@ export * from './api_transfer_response';
139
143
  export * from './api_user_category_affinity_score_request';
140
144
  export * from './api_user_category_affinity_score_response';
141
145
  export * from './api_vault_burn_tokens_request';
146
+ export * from './api_vault_detail_request';
147
+ export * from './api_vault_detail_response';
142
148
  export * from './api_vault_invest_request';
143
149
  export * from './api_vault_investor_summary_request';
144
150
  export * from './api_vault_investor_summary_response';
@@ -206,6 +212,8 @@ export * from './query_find_epoch_response';
206
212
  export * from './query_get_latest_lp_snapshot_response';
207
213
  export * from './query_get_list_epoch_request';
208
214
  export * from './query_get_list_epoch_response';
215
+ export * from './query_latest_sub_account_summary_request';
216
+ export * from './query_latest_sub_account_summary_response';
209
217
  export * from './query_trading_performance_trend_request';
210
218
  export * from './query_trading_performance_trend_response';
211
219
  export * from './query_vault_summary_history_request';
@@ -110,6 +110,8 @@ __exportStar(require("./api_query_list_funding_account_summary_request"), export
110
110
  __exportStar(require("./api_query_list_funding_account_summary_response"), exports);
111
111
  __exportStar(require("./api_query_list_sub_account_summary_request"), exports);
112
112
  __exportStar(require("./api_query_list_sub_account_summary_response"), exports);
113
+ __exportStar(require("./api_query_snap_vault_position_request"), exports);
114
+ __exportStar(require("./api_query_snap_vault_position_response"), exports);
113
115
  __exportStar(require("./api_query_trading_performance_request"), exports);
114
116
  __exportStar(require("./api_query_trading_performance_response"), exports);
115
117
  __exportStar(require("./api_query_trading_performance_trend_request"), exports);
@@ -125,6 +127,8 @@ __exportStar(require("./api_query_vault_summary_history_response"), exports);
125
127
  __exportStar(require("./api_replace_orders_request"), exports);
126
128
  __exportStar(require("./api_replace_orders_response"), exports);
127
129
  __exportStar(require("./api_resolve_epoch_ecosystem_metric_response"), exports);
130
+ __exportStar(require("./api_set_derisk_to_maintenance_margin_ratio_request"), exports);
131
+ __exportStar(require("./api_set_derisk_to_maintenance_margin_ratio_response"), exports);
128
132
  __exportStar(require("./api_set_initial_leverage_request"), exports);
129
133
  __exportStar(require("./api_set_initial_leverage_response"), exports);
130
134
  __exportStar(require("./api_settlement_price_request"), exports);
@@ -155,6 +159,8 @@ __exportStar(require("./api_transfer_response"), exports);
155
159
  __exportStar(require("./api_user_category_affinity_score_request"), exports);
156
160
  __exportStar(require("./api_user_category_affinity_score_response"), exports);
157
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);
158
164
  __exportStar(require("./api_vault_invest_request"), exports);
159
165
  __exportStar(require("./api_vault_investor_summary_request"), exports);
160
166
  __exportStar(require("./api_vault_investor_summary_response"), exports);
@@ -222,6 +228,8 @@ __exportStar(require("./query_find_epoch_response"), exports);
222
228
  __exportStar(require("./query_get_latest_lp_snapshot_response"), exports);
223
229
  __exportStar(require("./query_get_list_epoch_request"), exports);
224
230
  __exportStar(require("./query_get_list_epoch_response"), exports);
231
+ __exportStar(require("./query_latest_sub_account_summary_request"), exports);
232
+ __exportStar(require("./query_latest_sub_account_summary_response"), exports);
225
233
  __exportStar(require("./query_trading_performance_trend_request"), exports);
226
234
  __exportStar(require("./query_trading_performance_trend_response"), exports);
227
235
  __exportStar(require("./query_vault_summary_history_request"), exports);
@@ -18,7 +18,8 @@ exports.ORDER_MAP = Object.freeze({
18
18
  signature: ['s', signature_1.SIGNATURE_MAP.FULL_TO_LITE],
19
19
  metadata: ['m', order_metadata_1.ORDER_METADATA_MAP.FULL_TO_LITE],
20
20
  state: ['s1', order_state_1.ORDER_STATE_MAP.FULL_TO_LITE],
21
- is_liquidation: 'il'
21
+ is_liquidation: 'il',
22
+ is_derisk: 'id'
22
23
  },
23
24
  LITE_TO_FULL: {
24
25
  oi: 'order_id',
@@ -31,6 +32,7 @@ exports.ORDER_MAP = Object.freeze({
31
32
  s: ['signature', signature_1.SIGNATURE_MAP.LITE_TO_FULL],
32
33
  m: ['metadata', order_metadata_1.ORDER_METADATA_MAP.LITE_TO_FULL],
33
34
  s1: ['state', order_state_1.ORDER_STATE_MAP.LITE_TO_FULL],
34
- il: 'is_liquidation'
35
+ il: 'is_liquidation',
36
+ id: 'is_derisk'
35
37
  }
36
38
  });
@@ -0,0 +1,2 @@
1
+ import { type SchemaPairMap } from './types';
2
+ export declare const QUERY_LATEST_SUB_ACCOUNT_SUMMARY_REQUEST_MAP: SchemaPairMap;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QUERY_LATEST_SUB_ACCOUNT_SUMMARY_REQUEST_MAP = void 0;
4
+ // Schema map for the 'QUERY_LATEST_SUB_ACCOUNT_SUMMARY_REQUEST' struct.
5
+ exports.QUERY_LATEST_SUB_ACCOUNT_SUMMARY_REQUEST_MAP = Object.freeze({
6
+ FULL_TO_LITE: {
7
+ sub_account_id: 'sa'
8
+ },
9
+ LITE_TO_FULL: {
10
+ sa: 'sub_account_id'
11
+ }
12
+ });
@@ -0,0 +1,2 @@
1
+ import { type SchemaPairMap } from './types';
2
+ export declare const QUERY_LATEST_SUB_ACCOUNT_SUMMARY_RESPONSE_MAP: SchemaPairMap;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QUERY_LATEST_SUB_ACCOUNT_SUMMARY_RESPONSE_MAP = void 0;
4
+ const snap_sub_account_summary_1 = require("./snap_sub_account_summary");
5
+ // Schema map for the 'QUERY_LATEST_SUB_ACCOUNT_SUMMARY_RESPONSE' struct.
6
+ exports.QUERY_LATEST_SUB_ACCOUNT_SUMMARY_RESPONSE_MAP = Object.freeze({
7
+ FULL_TO_LITE: {
8
+ result: ['r', snap_sub_account_summary_1.SNAP_SUB_ACCOUNT_SUMMARY_MAP.FULL_TO_LITE]
9
+ },
10
+ LITE_TO_FULL: {
11
+ r: ['result', snap_sub_account_summary_1.SNAP_SUB_ACCOUNT_SUMMARY_MAP.LITE_TO_FULL]
12
+ }
13
+ });
@@ -19,7 +19,9 @@ exports.SUB_ACCOUNT_MAP = Object.freeze({
19
19
  positions: ['p', [api_position_1.POSITIONS_MAP.FULL_TO_LITE]],
20
20
  settle_index_price: 'si',
21
21
  is_vault: 'iv',
22
- vault_im_additions: 'vi'
22
+ vault_im_additions: 'vi',
23
+ derisk_margin: 'dm',
24
+ derisk_to_maintenance_margin_ratio: 'dt'
23
25
  },
24
26
  LITE_TO_FULL: {
25
27
  et: 'event_time',
@@ -35,6 +37,8 @@ exports.SUB_ACCOUNT_MAP = Object.freeze({
35
37
  p: ['positions', [api_position_1.POSITIONS_MAP.LITE_TO_FULL]],
36
38
  si: 'settle_index_price',
37
39
  iv: 'is_vault',
38
- vi: 'vault_im_additions'
40
+ vi: 'vault_im_additions',
41
+ dm: 'derisk_margin',
42
+ dt: 'derisk_to_maintenance_margin_ratio'
39
43
  }
40
44
  });
@@ -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,50 +1,50 @@
1
- {
2
- "name": "@grvt/client",
3
- "version": "1.4.14",
4
- "description": "Node.js & JavaScript client for GRVT REST APIs & WebSockets",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/gravity-technologies/grvt-js-client.git"
8
- },
9
- "keywords": [
10
- "GRVT"
11
- ],
12
- "bugs": {
13
- "url": "https://github.com/gravity-technologies/grvt-js-client/issues"
14
- },
15
- "homepage": "https://github.com/gravity-technologies/grvt-js-client#readme",
16
- "author": "danh@grvt.io",
17
- "license": "UNLICENSED",
18
- "engines": {
19
- "node": ">=20"
20
- },
21
- "main": "index.js",
22
- "types": "index.d.ts",
23
- "scripts": {
24
- "start": "tsc --watch",
25
- "prebuild": "rimraf dist",
26
- "build": "tsc",
27
- "postbuild": "cp package.json dist/ && cp README.md dist/ && cp LICENSE dist/",
28
- "prerelease": "npm run build",
29
- "release": "cd dist/ && npm publish --access public",
30
- "link-local": "cp package.json dist/ && cd dist/ && npm link && cd ..",
31
- "lint": "npx eslint \"src/**/*.{js,ts}\"",
32
- "lint-fix": "npx eslint \"src/**/*.{js,ts}\" --fix",
33
- "test": "nodemon dist/index.js"
34
- },
35
- "dependencies": {
36
- "axios": "^1.8.2"
37
- },
38
- "devDependencies": {
39
- "@typescript-eslint/eslint-plugin": "^6.10.0",
40
- "eslint": "^8.56.0",
41
- "eslint-config-standard-with-typescript": "^39.1.1",
42
- "eslint-plugin-import": "^2.29.0",
43
- "eslint-plugin-import-newlines": "^1.3.4",
44
- "eslint-plugin-n": "^16.3.0",
45
- "eslint-plugin-promise": "^6.1.1",
46
- "nodemon": "^3.0.2",
47
- "rimraf": "^5.0.5",
48
- "typescript": "^5.2.2"
49
- }
50
- }
1
+ {
2
+ "name": "@grvt/client",
3
+ "version": "1.4.16",
4
+ "description": "Node.js & JavaScript client for GRVT REST APIs & WebSockets",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/gravity-technologies/grvt-js-client.git"
8
+ },
9
+ "keywords": [
10
+ "GRVT"
11
+ ],
12
+ "bugs": {
13
+ "url": "https://github.com/gravity-technologies/grvt-js-client/issues"
14
+ },
15
+ "homepage": "https://github.com/gravity-technologies/grvt-js-client#readme",
16
+ "author": "danh@grvt.io",
17
+ "license": "UNLICENSED",
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
21
+ "main": "index.js",
22
+ "types": "index.d.ts",
23
+ "scripts": {
24
+ "start": "tsc --watch",
25
+ "prebuild": "rimraf dist",
26
+ "build": "tsc",
27
+ "postbuild": "cp package.json dist/ && cp README.md dist/ && cp LICENSE dist/",
28
+ "prerelease": "npm run build",
29
+ "release": "cd dist/ && npm publish --access public",
30
+ "link-local": "cp package.json dist/ && cd dist/ && npm link && cd ..",
31
+ "lint": "npx eslint \"src/**/*.{js,ts}\"",
32
+ "lint-fix": "npx eslint \"src/**/*.{js,ts}\" --fix",
33
+ "test": "nodemon dist/index.js"
34
+ },
35
+ "dependencies": {
36
+ "axios": "^1.8.2"
37
+ },
38
+ "devDependencies": {
39
+ "@typescript-eslint/eslint-plugin": "^6.10.0",
40
+ "eslint": "^8.56.0",
41
+ "eslint-config-standard-with-typescript": "^39.1.1",
42
+ "eslint-plugin-import": "^2.29.0",
43
+ "eslint-plugin-import-newlines": "^1.3.4",
44
+ "eslint-plugin-n": "^16.3.0",
45
+ "eslint-plugin-promise": "^6.1.1",
46
+ "nodemon": "^3.0.2",
47
+ "rimraf": "^5.0.5",
48
+ "typescript": "^5.2.2"
49
+ }
50
+ }