@grvt/client 1.4.15 → 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.
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 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;
@@ -848,6 +848,14 @@ export interface IApiVaultBurnTokensRequest {
848
848
  num_tokens?: string;
849
849
  signature?: ISignature;
850
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
+ }
851
859
  export interface IApiVaultInvestRequest {
852
860
  main_account_id?: string;
853
861
  vault_id?: string;
@@ -1592,11 +1600,14 @@ export interface IVaultRedeemResults {
1592
1600
  export interface IVaultRedemption {
1593
1601
  num_lp_tokens?: string;
1594
1602
  request_valuation?: string;
1603
+ request_time?: string;
1604
+ max_redemption_period_timestamp?: string;
1595
1605
  }
1596
1606
  export interface IVaultRedemptionReqView {
1597
1607
  request_time?: string;
1598
1608
  currency?: ECurrency;
1599
1609
  num_lp_tokens?: string;
1610
+ max_redemption_period_timestamp?: string;
1600
1611
  }
1601
1612
  export interface IWSCancelFeedDataV1 {
1602
1613
  stream?: string;
@@ -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
+ });
@@ -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,50 +1,50 @@
1
- {
2
- "name": "@grvt/client",
3
- "version": "1.4.15",
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
+ }