@grvt/client 1.4.1 → 1.4.3

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 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 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 IApiSetInitialLeverageRequest, type IApiSetInitialLeverageResponse, type IApiSocializedLossStatusResponse, type IApiSubAccountHistoryRequest, type IApiSubAccountHistoryResponse, type IApiSubAccountSummaryRequest, type IApiSubAccountSummaryResponse, type IApiTimedAssetExposureRequest, type IApiTimedAssetExposureResponse, type IApiTransferHistoryRequest, type IApiTransferHistoryResponse, type IApiTransferRequest, type IApiWithdrawalHistoryRequest, type IApiWithdrawalHistoryResponse, type IApiWithdrawalRequest, type IConfig } from '../interfaces';
2
+ import { 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 IApiSetInitialLeverageRequest, type IApiSetInitialLeverageResponse, type IApiSocializedLossStatusResponse, type IApiSubAccountHistoryRequest, type IApiSubAccountHistoryResponse, type IApiSubAccountSummaryRequest, type IApiSubAccountSummaryResponse, type IApiTimedAssetExposureRequest, type IApiTimedAssetExposureResponse, type IApiTransferHistoryRequest, type IApiTransferHistoryResponse, type IApiTransferRequest, type IApiTransferResponse, 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;
@@ -19,9 +19,7 @@ export declare class TDG {
19
19
  * TODO: missing response interface
20
20
  * @see https://api-docs.grvt.io/trading_api/#transfer
21
21
  */
22
- transfer(payload: IApiTransferRequest, config?: AxiosRequestConfig): Promise<{
23
- acknowledgement: boolean;
24
- }>;
22
+ transfer(payload: IApiTransferRequest, config?: AxiosRequestConfig): Promise<IApiTransferResponse>;
25
23
  /**
26
24
  * @see https://api-docs.grvt.io/trading_api/#transfer-history
27
25
  */
package/TDG/index.js CHANGED
@@ -37,7 +37,7 @@ class TDG {
37
37
  */
38
38
  transfer(payload, config) {
39
39
  return this._axios.post(this._liteUrl + '/transfer', utils_1.Utils.schemaMap(payload, interfaces_1.API_TRANSFER_REQUEST_MAP.FULL_TO_LITE, true), config).then((response) => {
40
- return utils_1.Utils.schemaMap(response.data, interfaces_1.ACK_RESPONSE_MAP.LITE_TO_FULL);
40
+ return utils_1.Utils.schemaMap(response.data, interfaces_1.API_TRANSFER_RESPONSE_MAP.LITE_TO_FULL);
41
41
  }).catch(utils_1.Utils.coverApiError);
42
42
  }
43
43
  /**
@@ -1,5 +1,6 @@
1
1
  export declare enum EBridgeType {
2
- XY = "XY"
2
+ XY = "XY",
3
+ RHINO = "RHINO"
3
4
  }
4
5
  export declare enum EBrokerTag {
5
6
  UNSPECIFIED = "UNSPECIFIED",
@@ -181,7 +182,9 @@ export declare enum ETimeInterval {
181
182
  export declare enum ETransferType {
182
183
  STANDARD = "STANDARD",
183
184
  FAST_ARB_DEPOSIT = "FAST_ARB_DEPOSIT",
184
- FAST_ARB_WITHDRAWAL = "FAST_ARB_WITHDRAWAL"
185
+ FAST_ARB_WITHDRAWAL = "FAST_ARB_WITHDRAWAL",
186
+ NON_NATIVE_BRIDGE_DEPOSIT = "NON_NATIVE_BRIDGE_DEPOSIT",
187
+ NON_NATIVE_BRIDGE_WITHDRAWAL = "NON_NATIVE_BRIDGE_WITHDRAWAL"
185
188
  }
186
189
  export declare enum ETriggerBy {
187
190
  UNSPECIFIED = "UNSPECIFIED",
@@ -723,6 +726,10 @@ export interface IApiTradingPerformanceTrend {
723
726
  trading_volume?: string;
724
727
  realized_pnl?: string;
725
728
  }
729
+ export interface IApiTransferAck {
730
+ ack?: boolean;
731
+ tx_id?: string;
732
+ }
726
733
  export interface IApiTransferHistoryRequest {
727
734
  currency?: ECurrency[];
728
735
  start_time?: string;
@@ -747,6 +754,9 @@ export interface IApiTransferRequest {
747
754
  transfer_type?: ETransferType;
748
755
  transfer_metadata?: string;
749
756
  }
757
+ export interface IApiTransferResponse {
758
+ result?: IApiTransferAck;
759
+ }
750
760
  export interface IApiUserCategoryAffinityScoreRequest {
751
761
  account_id?: string;
752
762
  start_time?: string;
@@ -5,6 +5,8 @@ var EBridgeType;
5
5
  (function (EBridgeType) {
6
6
  // XY Bridge type
7
7
  EBridgeType["XY"] = "XY";
8
+ // Rhino Bridge type
9
+ EBridgeType["RHINO"] = "RHINO";
8
10
  })(EBridgeType || (exports.EBridgeType = EBridgeType = {}));
9
11
  // BrokerTag is a tag for the broker that the order is sent from.
10
12
  var EBrokerTag;
@@ -357,6 +359,10 @@ var ETransferType;
357
359
  ETransferType["FAST_ARB_DEPOSIT"] = "FAST_ARB_DEPOSIT";
358
360
  // Fast Arb Withdrawal Metadata type
359
361
  ETransferType["FAST_ARB_WITHDRAWAL"] = "FAST_ARB_WITHDRAWAL";
362
+ // Transfer type for non native bridging deposit
363
+ ETransferType["NON_NATIVE_BRIDGE_DEPOSIT"] = "NON_NATIVE_BRIDGE_DEPOSIT";
364
+ // Transfer type for non native bridging withdrawal
365
+ ETransferType["NON_NATIVE_BRIDGE_WITHDRAWAL"] = "NON_NATIVE_BRIDGE_WITHDRAWAL";
360
366
  })(ETransferType || (exports.ETransferType = ETransferType = {}));
361
367
  // Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
362
368
  //
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EVenueInt = exports.EVaultTypeInt = exports.ETriggerTypeInt = exports.ETriggerByInt = exports.ETransferTypeInt = exports.ETimeIntervalInt = exports.ETimeInForceInt = exports.ESubAccountTradeIntervalInt = exports.ERewardProgramTypeInt = exports.ERewardEpochStatusInt = exports.EOrderStatusInt = exports.EOrderRejectReasonInt = exports.EMarginTypeInt = exports.EKindInt = exports.EInstrumentSettlementPeriodInt = exports.EEpochBadgeTypeInt = exports.ECurrencyInt = exports.ECandlestickTypeInt = exports.ECandlestickIntervalInt = exports.ECancelStatusInt = exports.EBrokerTagInt = exports.EBridgeTypeInt = void 0;
4
4
  const data_interface_1 = require("./data.interface");
5
5
  exports.EBridgeTypeInt = Object.freeze({
6
- [data_interface_1.EBridgeType.XY]: 1
6
+ [data_interface_1.EBridgeType.XY]: 1,
7
+ [data_interface_1.EBridgeType.RHINO]: 2
7
8
  });
8
9
  exports.EBrokerTagInt = Object.freeze({
9
10
  [data_interface_1.EBrokerTag.UNSPECIFIED]: 0,
@@ -185,7 +186,9 @@ exports.ETimeIntervalInt = Object.freeze({
185
186
  exports.ETransferTypeInt = Object.freeze({
186
187
  [data_interface_1.ETransferType.STANDARD]: 1,
187
188
  [data_interface_1.ETransferType.FAST_ARB_DEPOSIT]: 2,
188
- [data_interface_1.ETransferType.FAST_ARB_WITHDRAWAL]: 3
189
+ [data_interface_1.ETransferType.FAST_ARB_WITHDRAWAL]: 3,
190
+ [data_interface_1.ETransferType.NON_NATIVE_BRIDGE_DEPOSIT]: 4,
191
+ [data_interface_1.ETransferType.NON_NATIVE_BRIDGE_WITHDRAWAL]: 5
189
192
  });
190
193
  exports.ETriggerByInt = Object.freeze({
191
194
  [data_interface_1.ETriggerBy.UNSPECIFIED]: 0,
@@ -0,0 +1,2 @@
1
+ import { type SchemaPairMap } from './types';
2
+ export declare const API_TRANSFER_ACK_MAP: SchemaPairMap;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_TRANSFER_ACK_MAP = void 0;
4
+ // Schema map for the 'API_TRANSFER_ACK' struct.
5
+ exports.API_TRANSFER_ACK_MAP = Object.freeze({
6
+ FULL_TO_LITE: {
7
+ ack: 'a',
8
+ tx_id: 'ti'
9
+ },
10
+ LITE_TO_FULL: {
11
+ a: 'ack',
12
+ ti: 'tx_id'
13
+ }
14
+ });
@@ -0,0 +1,2 @@
1
+ import { type SchemaPairMap } from './types';
2
+ export declare const API_TRANSFER_RESPONSE_MAP: SchemaPairMap;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_TRANSFER_RESPONSE_MAP = void 0;
4
+ const api_transfer_ack_1 = require("./api_transfer_ack");
5
+ // Schema map for the 'API_TRANSFER_RESPONSE' struct.
6
+ exports.API_TRANSFER_RESPONSE_MAP = Object.freeze({
7
+ FULL_TO_LITE: {
8
+ result: ['r', api_transfer_ack_1.API_TRANSFER_ACK_MAP.FULL_TO_LITE]
9
+ },
10
+ LITE_TO_FULL: {
11
+ r: ['result', api_transfer_ack_1.API_TRANSFER_ACK_MAP.LITE_TO_FULL]
12
+ }
13
+ });
@@ -120,9 +120,11 @@ export * from './api_trade_history_response';
120
120
  export * from './api_trade_request';
121
121
  export * from './api_trade_response';
122
122
  export * from './api_trading_performance_trend';
123
+ export * from './api_transfer_ack';
123
124
  export * from './api_transfer_history_request';
124
125
  export * from './api_transfer_history_response';
125
126
  export * from './api_transfer_request';
127
+ export * from './api_transfer_response';
126
128
  export * from './api_user_category_affinity_score_request';
127
129
  export * from './api_user_category_affinity_score_response';
128
130
  export * from './api_withdrawal_history_request';
@@ -136,9 +136,11 @@ __exportStar(require("./api_trade_history_response"), exports);
136
136
  __exportStar(require("./api_trade_request"), exports);
137
137
  __exportStar(require("./api_trade_response"), exports);
138
138
  __exportStar(require("./api_trading_performance_trend"), exports);
139
+ __exportStar(require("./api_transfer_ack"), exports);
139
140
  __exportStar(require("./api_transfer_history_request"), exports);
140
141
  __exportStar(require("./api_transfer_history_response"), exports);
141
142
  __exportStar(require("./api_transfer_request"), exports);
143
+ __exportStar(require("./api_transfer_response"), exports);
142
144
  __exportStar(require("./api_user_category_affinity_score_request"), exports);
143
145
  __exportStar(require("./api_user_category_affinity_score_response"), exports);
144
146
  __exportStar(require("./api_withdrawal_history_request"), exports);
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "@grvt/client",
3
- "version": "1.4.1",
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": "dist/index.js",
22
- "types": "dist/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.3",
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": "dist/index.js",
22
+ "types": "dist/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
+ }