@reyaxyz/api-sdk 0.51.0 → 0.52.1

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 (46) hide show
  1. package/dist/clients/helpers/constants.js +4 -5
  2. package/dist/clients/helpers/constants.js.map +1 -1
  3. package/dist/clients/modules/account/index.js +2 -5
  4. package/dist/clients/modules/account/index.js.map +1 -1
  5. package/dist/clients/modules/lp/index.js +2 -5
  6. package/dist/clients/modules/lp/index.js.map +1 -1
  7. package/dist/clients/modules/markets/index.js +2 -5
  8. package/dist/clients/modules/markets/index.js.map +1 -1
  9. package/dist/clients/modules/owner/index.js +2 -5
  10. package/dist/clients/modules/owner/index.js.map +1 -1
  11. package/dist/clients/modules/tokens/index.js +2 -5
  12. package/dist/clients/modules/tokens/index.js.map +1 -1
  13. package/dist/types/clients/helpers/constants.d.ts +0 -1
  14. package/dist/types/clients/helpers/constants.d.ts.map +1 -1
  15. package/dist/types/clients/modules/account/index.d.ts +1 -3
  16. package/dist/types/clients/modules/account/index.d.ts.map +1 -1
  17. package/dist/types/clients/modules/lp/index.d.ts +1 -3
  18. package/dist/types/clients/modules/lp/index.d.ts.map +1 -1
  19. package/dist/types/clients/modules/markets/index.d.ts +1 -2
  20. package/dist/types/clients/modules/markets/index.d.ts.map +1 -1
  21. package/dist/types/clients/modules/owner/index.d.ts +1 -1
  22. package/dist/types/clients/modules/owner/index.d.ts.map +1 -1
  23. package/dist/types/clients/modules/tokens/index.d.ts +1 -1
  24. package/dist/types/clients/modules/tokens/index.d.ts.map +1 -1
  25. package/package.json +3 -4
  26. package/src/clients/helpers/constants.ts +1 -3
  27. package/src/clients/modules/account/index.ts +2 -2
  28. package/src/clients/modules/lp/index.ts +2 -3
  29. package/src/clients/modules/markets/index.ts +1 -2
  30. package/src/clients/modules/owner/index.ts +1 -1
  31. package/src/clients/modules/tokens/index.ts +1 -1
  32. package/dist/clients/helpers/query-helper.js +0 -21
  33. package/dist/clients/helpers/query-helper.js.map +0 -1
  34. package/dist/clients/lib/axios.js +0 -26
  35. package/dist/clients/lib/axios.js.map +0 -1
  36. package/dist/clients/modules/rest/index.js +0 -117
  37. package/dist/clients/modules/rest/index.js.map +0 -1
  38. package/dist/types/clients/helpers/query-helper.d.ts +0 -2
  39. package/dist/types/clients/helpers/query-helper.d.ts.map +0 -1
  40. package/dist/types/clients/lib/axios.d.ts +0 -13
  41. package/dist/types/clients/lib/axios.d.ts.map +0 -1
  42. package/dist/types/clients/modules/rest/index.d.ts +0 -10
  43. package/dist/types/clients/modules/rest/index.d.ts.map +0 -1
  44. package/src/clients/helpers/query-helper.ts +0 -17
  45. package/src/clients/lib/axios.ts +0 -28
  46. package/src/clients/modules/rest/index.ts +0 -69
@@ -1,26 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.API_CLIENT_CONFIGS = exports.API_TIMEOUT = void 0;
3
+ exports.API_CLIENT_CONFIGS = void 0;
4
4
  var common_1 = require("@reyaxyz/common");
5
- exports.API_TIMEOUT = 2500;
6
5
  exports.API_CLIENT_CONFIGS = {
7
6
  local: {
8
7
  chain: common_1.ReyaChainId.reyaCronos,
9
8
  apiEndpoint: 'http://localhost:3000',
10
9
  environment: 'local',
11
- timeout: exports.API_TIMEOUT,
10
+ timeout: common_1.API_TIMEOUT,
12
11
  },
13
12
  production: {
14
13
  chain: common_1.ReyaChainId.reyaNetwork,
15
14
  apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',
16
15
  environment: 'production',
17
- timeout: exports.API_TIMEOUT,
16
+ timeout: common_1.API_TIMEOUT,
18
17
  },
19
18
  test: {
20
19
  chain: common_1.ReyaChainId.reyaCronos,
21
20
  apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',
22
21
  environment: 'test',
23
- timeout: exports.API_TIMEOUT,
22
+ timeout: common_1.API_TIMEOUT,
24
23
  },
25
24
  };
26
25
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"/","sources":["clients/helpers/constants.ts"],"names":[],"mappings":";;;AAAA,0CAA8C;AAEjC,QAAA,WAAW,GAAW,IAAI,CAAC;AAU3B,QAAA,kBAAkB,GAA8C;IAC3E,KAAK,EAAE;QACL,KAAK,EAAE,oBAAW,CAAC,UAAU;QAC7B,WAAW,EAAE,uBAAuB;QACpC,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,mBAAW;KACrB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,oBAAW,CAAC,WAAW;QAC9B,WAAW,EAAE,kDAAkD;QAC/D,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,mBAAW;KACrB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,oBAAW,CAAC,UAAU;QAC7B,WAAW,EAAE,kDAAkD;QAC/D,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,mBAAW;KACrB;CACF,CAAC","sourcesContent":["import { ReyaChainId } from '@reyaxyz/common';\n\nexport const API_TIMEOUT: number = 2500;\n\ntype ServiceEnvironment = 'production' | 'test' | 'local';\nexport interface ServiceConfig {\n chain: ReyaChainId;\n apiEndpoint: string;\n environment: ServiceEnvironment; // Configuration for SDK, such as base URL for the REST API\n timeout: number; // Optional timeout for API requests\n}\n\nexport const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig> = {\n local: {\n chain: ReyaChainId.reyaCronos,\n apiEndpoint: 'http://localhost:3000',\n environment: 'local',\n timeout: API_TIMEOUT,\n },\n production: {\n chain: ReyaChainId.reyaNetwork,\n apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',\n environment: 'production',\n timeout: API_TIMEOUT,\n },\n test: {\n chain: ReyaChainId.reyaCronos,\n apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',\n environment: 'test',\n timeout: API_TIMEOUT,\n },\n};\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"/","sources":["clients/helpers/constants.ts"],"names":[],"mappings":";;;AAAA,0CAA2D;AAU9C,QAAA,kBAAkB,GAA8C;IAC3E,KAAK,EAAE;QACL,KAAK,EAAE,oBAAW,CAAC,UAAU;QAC7B,WAAW,EAAE,uBAAuB;QACpC,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,oBAAW;KACrB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,oBAAW,CAAC,WAAW;QAC9B,WAAW,EAAE,kDAAkD;QAC/D,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,oBAAW;KACrB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,oBAAW,CAAC,UAAU;QAC7B,WAAW,EAAE,kDAAkD;QAC/D,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,oBAAW;KACrB;CACF,CAAC","sourcesContent":["import { API_TIMEOUT, ReyaChainId } from '@reyaxyz/common';\n\ntype ServiceEnvironment = 'production' | 'test' | 'local';\nexport interface ServiceConfig {\n chain: ReyaChainId;\n apiEndpoint: string;\n environment: ServiceEnvironment; // Configuration for SDK, such as base URL for the REST API\n timeout: number; // Optional timeout for API requests\n}\n\nexport const API_CLIENT_CONFIGS: Record<ServiceEnvironment, ServiceConfig> = {\n local: {\n chain: ReyaChainId.reyaCronos,\n apiEndpoint: 'http://localhost:3000',\n environment: 'local',\n timeout: API_TIMEOUT,\n },\n production: {\n chain: ReyaChainId.reyaNetwork,\n apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',\n environment: 'production',\n timeout: API_TIMEOUT,\n },\n test: {\n chain: ReyaChainId.reyaCronos,\n apiEndpoint: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',\n environment: 'test',\n timeout: API_TIMEOUT,\n },\n};\n"]}
@@ -50,11 +50,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
53
  Object.defineProperty(exports, "__esModule", { value: true });
57
- var rest_1 = __importDefault(require("../rest"));
54
+ var common_1 = require("@reyaxyz/common");
58
55
  var AccountClient = /** @class */ (function (_super) {
59
56
  __extends(AccountClient, _super);
60
57
  function AccountClient() {
@@ -253,6 +250,6 @@ var AccountClient = /** @class */ (function (_super) {
253
250
  });
254
251
  };
255
252
  return AccountClient;
256
- }(rest_1.default));
253
+ }(common_1.RestClient));
257
254
  exports.default = AccountClient;
258
255
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/account/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,iDAAiC;AAWjC;IAA2C,iCAAU;IAArD;;IAqKA,CAAC;IApKC;;;;;;;;;;;SAWK;IAEC,yCAAiB,GAAvB,UACE,MAA+B;;;;gBAEzB,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,CAAE,CAAC;gBAC9C,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,EAAC;;;KAC/C;IAED;;;;;;;;;;OAUG;IAEG,wCAAgB,GAAtB,UACE,MAA8B;;;;gBAExB,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,4BAAkB,MAAM,CAAC,eAAe,CAAE,CAAC;gBACtF,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,oDAA4B,GAAlC,UACE,MAA0C;;;;gBAEpC,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,4BAAkB,MAAM,CAAC,eAAe,eAAY,CAAC;gBAChG,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,EA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M,CAAC,EAAE,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;gBAC/C,CAAC;gBACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;oBAC1C,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;gBAC5C,CAAC;gBAEK,GAAG,GAAG,wBAAiB,MAAM,CAAC,EAAE,UAAO,CAAC;gBAC9C,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,EAAE,EAAE,MAAM,CAAC,EAAE;wBACb,IAAI,EAAE,MAAM,CAAC,IAAI;qBAClB,CAAC,EAAC;;;KACJ;IACK,0CAAkB,GAAxB,UACE,MAAgC;;;;gBAEhC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;gBAC/C,CAAC;gBAEK,GAAG,GAAG,wBAAiB,MAAM,CAAC,EAAE,UAAO,CAAC;gBAC9C,sBAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;wBACtB,EAAE,EAAE,MAAM,CAAC,EAAE;qBACd,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AArKD,CAA2C,cAAU,GAqKpD","sourcesContent":["import {\n GetMarginAccountParams,\n GetMarginAccountResult,\n GetMarginAccountsParams,\n GetMarginAccountsResult,\n GetMarginAccountTransactionHistoryParams,\n GetMarginAccountTransactionHistoryResult,\n GetMaxOrderSizeAvailableParams,\n GetMaxOrderSizeAvailableResult,\n GetMaxWithdrawBalanceForAccountParams,\n GetMaxWithdrawBalanceForAccountResult,\n GetPositionsForMarginAccountParams,\n GetPositionsForMarginAccountResult,\n GetPositionsHistoryForMarginAccountParams,\n GetPositionsHistoryForMarginAccountResult,\n GetTransactionSimulationInitialDataParams,\n GetMarginAccountBalanceChartDataParams,\n GetMarginAccountCollateralsBalanceChartDataParams,\n GetAllMarginAccountsBalanceChartDataParams,\n EditMarginAccountParams,\n CloseMarginAccountParams,\n GetAllMarginAccountsSummaryResult,\n GetAllMarginAccountsSummaryParams,\n GetEditCollateralSimulationInitialDataParams,\n EditMarginAccountResult,\n CloseMarginAccountResult,\n} from './types';\nimport RestClient from '../rest';\nimport {\n EditCollateralSimulationState,\n TradeSimulationState,\n} from '@reyaxyz/common';\nimport {\n GetMarginAccountCollateralsBalanceChartDataResult,\n GetMarginAccountBalanceChartDataResult,\n} from '@reyaxyz/common';\nimport { GetAllMarginAccountsBalanceChartDataResult } from '@reyaxyz/common';\n\nexport default class AccountClient extends RestClient {\n /**\n * Asynchronously retrieves a list of margin accounts associated with a specific address.\n *\n * This method makes a request to the API endpoint to fetch collateral account data. The data is filtered\n * based on the provided Ethereum address. An optional limit can be specified to control the number of\n * collateral accounts returned in the response.\n *\n * @param {GetMarginAccountsParams} params\n * @returns {Promise<GetMarginAccountsResult>} A promise that resolves to the response containing the margin\n * account data.\n * @memberof account\n * */\n\n async getMarginAccounts(\n params: GetMarginAccountsParams,\n ): Promise<GetMarginAccountsResult> {\n const uri = `/api/accounts/${params.address}`;\n return this.get(uri, { limit: params.limit });\n }\n\n /**\n * Asynchronously retrieves details of a specific collateral account for a given Ethereum address.\n *\n * This method sends a request to the API to obtain detailed information about a specific collateral account\n * associated with the provided Ethereum address. The account is identified using the collateral account number.\n *\n * @param {GetMarginAccountParams} params\n * @returns {Promise<GetMarginAccountResult>} A promise that resolves to the response containing the detailed\n * information of the specified margin account.\n * @memberof account\n */\n\n async getMarginAccount(\n params: GetMarginAccountParams,\n ): Promise<GetMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}`;\n return this.get(uri);\n }\n\n async getPositionsForMarginAccount(\n params: GetPositionsForMarginAccountParams,\n ): Promise<GetPositionsForMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions`;\n return this.get(uri, { limit: params.limit });\n }\n\n async getPositionsHistoryForMarginAccount(\n params: GetPositionsHistoryForMarginAccountParams,\n ): Promise<GetPositionsHistoryForMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions/history`;\n return this.get(uri, { limit: params.limit });\n }\n\n async getMaxOrderSizeAvailable(\n params: GetMaxOrderSizeAvailableParams,\n ): Promise<GetMaxOrderSizeAvailableResult> {\n const uri = `/api/accounts/${params.marginAccountId}/max-order-size`;\n return this.get(uri, {\n marketId: params.marketId,\n direction: params.direction,\n });\n }\n\n async getTransactionSimulationInitialData(\n params: GetTransactionSimulationInitialDataParams,\n ): Promise<TradeSimulationState> {\n const uri = `/api/accounts/${params.marginAccountId}/trade-simulation-data`;\n return this.get(uri, {\n marketId: params.marketId,\n });\n }\n\n async getEditCollateralSimulationInitialData(\n params: GetEditCollateralSimulationInitialDataParams,\n ): Promise<EditCollateralSimulationState> {\n const uri = `/api/accounts/${params.marginAccountId}/edit-collateral-simulation-data`;\n return this.get(uri);\n }\n\n async getMarginAccountTransactionHistory(\n params: GetMarginAccountTransactionHistoryParams,\n ): Promise<GetMarginAccountTransactionHistoryResult> {\n const uri = `/api/accounts/${params.marginAccountId}/transaction-history`;\n return this.get(uri, {\n limit: params.limit,\n });\n }\n\n async getMaxWithdrawBalanceForAccount(\n params: GetMaxWithdrawBalanceForAccountParams,\n ): Promise<GetMaxWithdrawBalanceForAccountResult> {\n const uri = `/api/accounts/${params.marginAccountId}/max-withdraw-amount`;\n return this.get(uri, {\n assetAddress: params.tokenAddress,\n });\n }\n\n async getMarginAccountBalanceChartData(\n params: GetMarginAccountBalanceChartDataParams,\n ): Promise<GetMarginAccountBalanceChartDataResult> {\n const uri = `/api/accounts/${params.marginAccountId}/balance-chart-data`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n\n async getMarginAccountCollateralsBalanceChartData(\n params: GetMarginAccountCollateralsBalanceChartDataParams,\n ): Promise<GetMarginAccountCollateralsBalanceChartDataResult> {\n const uri = `/api/accounts/${params.marginAccountId}/collaterals-balance-chart-data`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n\n async getAllMarginAccountsBalanceChart(\n params: GetAllMarginAccountsBalanceChartDataParams,\n ): Promise<GetAllMarginAccountsBalanceChartDataResult> {\n const uri = `/api/accounts/owner/${params.ownerAddress}/balance`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n\n async getAllMarginAccountsSummary(\n params: GetAllMarginAccountsSummaryParams,\n ): Promise<GetAllMarginAccountsSummaryResult> {\n const uri = `/api/accounts/owner/${params.ownerAddress}/summary`;\n return this.get(uri);\n }\n\n // TODO: Milan validate\n async editMarginAccount(\n params: EditMarginAccountParams,\n ): Promise<EditMarginAccountResult> {\n const name = (params.name || '').trim();\n if (!params.id) {\n throw new Error('Missing margin account id');\n }\n if (name.length === 0 || name.length > 25) {\n throw new Error('Max size 25 characters');\n }\n\n const uri = `/api/accounts/${params.id}/edit`;\n return this.put(uri, {\n id: params.id,\n name: params.name,\n });\n }\n async closeMarginAccount(\n params: CloseMarginAccountParams,\n ): Promise<CloseMarginAccountResult> {\n if (!params.id) {\n throw new Error('Missing margin account id');\n }\n\n const uri = `/api/accounts/${params.id}/edit`;\n return this.delete(uri, {\n id: params.id,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/account/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,0CAKyB;AAEzB;IAA2C,iCAAU;IAArD;;IAqKA,CAAC;IApKC;;;;;;;;;;;SAWK;IAEC,yCAAiB,GAAvB,UACE,MAA+B;;;;gBAEzB,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,CAAE,CAAC;gBAC9C,sBAAO,IAAI,CAAC,GAAG,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E;wBACtB,EAAE,EAAE,MAAM,CAAC,EAAE;qBACd,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AArKD,CAA2C,mBAAU,GAqKpD","sourcesContent":["import {\n GetMarginAccountParams,\n GetMarginAccountResult,\n GetMarginAccountsParams,\n GetMarginAccountsResult,\n GetMarginAccountTransactionHistoryParams,\n GetMarginAccountTransactionHistoryResult,\n GetMaxOrderSizeAvailableParams,\n GetMaxOrderSizeAvailableResult,\n GetMaxWithdrawBalanceForAccountParams,\n GetMaxWithdrawBalanceForAccountResult,\n GetPositionsForMarginAccountParams,\n GetPositionsForMarginAccountResult,\n GetPositionsHistoryForMarginAccountParams,\n GetPositionsHistoryForMarginAccountResult,\n GetTransactionSimulationInitialDataParams,\n GetMarginAccountBalanceChartDataParams,\n GetMarginAccountCollateralsBalanceChartDataParams,\n GetAllMarginAccountsBalanceChartDataParams,\n EditMarginAccountParams,\n CloseMarginAccountParams,\n GetAllMarginAccountsSummaryResult,\n GetAllMarginAccountsSummaryParams,\n GetEditCollateralSimulationInitialDataParams,\n EditMarginAccountResult,\n CloseMarginAccountResult,\n} from './types';\nimport {\n EditCollateralSimulationState,\n TradeSimulationState,\n} from '@reyaxyz/common';\nimport {\n GetMarginAccountCollateralsBalanceChartDataResult,\n GetMarginAccountBalanceChartDataResult,\n GetAllMarginAccountsBalanceChartDataResult,\n RestClient,\n} from '@reyaxyz/common';\n\nexport default class AccountClient extends RestClient {\n /**\n * Asynchronously retrieves a list of margin accounts associated with a specific address.\n *\n * This method makes a request to the API endpoint to fetch collateral account data. The data is filtered\n * based on the provided Ethereum address. An optional limit can be specified to control the number of\n * collateral accounts returned in the response.\n *\n * @param {GetMarginAccountsParams} params\n * @returns {Promise<GetMarginAccountsResult>} A promise that resolves to the response containing the margin\n * account data.\n * @memberof account\n * */\n\n async getMarginAccounts(\n params: GetMarginAccountsParams,\n ): Promise<GetMarginAccountsResult> {\n const uri = `/api/accounts/${params.address}`;\n return this.get(uri, { limit: params.limit });\n }\n\n /**\n * Asynchronously retrieves details of a specific collateral account for a given Ethereum address.\n *\n * This method sends a request to the API to obtain detailed information about a specific collateral account\n * associated with the provided Ethereum address. The account is identified using the collateral account number.\n *\n * @param {GetMarginAccountParams} params\n * @returns {Promise<GetMarginAccountResult>} A promise that resolves to the response containing the detailed\n * information of the specified margin account.\n * @memberof account\n */\n\n async getMarginAccount(\n params: GetMarginAccountParams,\n ): Promise<GetMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}`;\n return this.get(uri);\n }\n\n async getPositionsForMarginAccount(\n params: GetPositionsForMarginAccountParams,\n ): Promise<GetPositionsForMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions`;\n return this.get(uri, { limit: params.limit });\n }\n\n async getPositionsHistoryForMarginAccount(\n params: GetPositionsHistoryForMarginAccountParams,\n ): Promise<GetPositionsHistoryForMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions/history`;\n return this.get(uri, { limit: params.limit });\n }\n\n async getMaxOrderSizeAvailable(\n params: GetMaxOrderSizeAvailableParams,\n ): Promise<GetMaxOrderSizeAvailableResult> {\n const uri = `/api/accounts/${params.marginAccountId}/max-order-size`;\n return this.get(uri, {\n marketId: params.marketId,\n direction: params.direction,\n });\n }\n\n async getTransactionSimulationInitialData(\n params: GetTransactionSimulationInitialDataParams,\n ): Promise<TradeSimulationState> {\n const uri = `/api/accounts/${params.marginAccountId}/trade-simulation-data`;\n return this.get(uri, {\n marketId: params.marketId,\n });\n }\n\n async getEditCollateralSimulationInitialData(\n params: GetEditCollateralSimulationInitialDataParams,\n ): Promise<EditCollateralSimulationState> {\n const uri = `/api/accounts/${params.marginAccountId}/edit-collateral-simulation-data`;\n return this.get(uri);\n }\n\n async getMarginAccountTransactionHistory(\n params: GetMarginAccountTransactionHistoryParams,\n ): Promise<GetMarginAccountTransactionHistoryResult> {\n const uri = `/api/accounts/${params.marginAccountId}/transaction-history`;\n return this.get(uri, {\n limit: params.limit,\n });\n }\n\n async getMaxWithdrawBalanceForAccount(\n params: GetMaxWithdrawBalanceForAccountParams,\n ): Promise<GetMaxWithdrawBalanceForAccountResult> {\n const uri = `/api/accounts/${params.marginAccountId}/max-withdraw-amount`;\n return this.get(uri, {\n assetAddress: params.tokenAddress,\n });\n }\n\n async getMarginAccountBalanceChartData(\n params: GetMarginAccountBalanceChartDataParams,\n ): Promise<GetMarginAccountBalanceChartDataResult> {\n const uri = `/api/accounts/${params.marginAccountId}/balance-chart-data`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n\n async getMarginAccountCollateralsBalanceChartData(\n params: GetMarginAccountCollateralsBalanceChartDataParams,\n ): Promise<GetMarginAccountCollateralsBalanceChartDataResult> {\n const uri = `/api/accounts/${params.marginAccountId}/collaterals-balance-chart-data`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n\n async getAllMarginAccountsBalanceChart(\n params: GetAllMarginAccountsBalanceChartDataParams,\n ): Promise<GetAllMarginAccountsBalanceChartDataResult> {\n const uri = `/api/accounts/owner/${params.ownerAddress}/balance`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n\n async getAllMarginAccountsSummary(\n params: GetAllMarginAccountsSummaryParams,\n ): Promise<GetAllMarginAccountsSummaryResult> {\n const uri = `/api/accounts/owner/${params.ownerAddress}/summary`;\n return this.get(uri);\n }\n\n // TODO: Milan validate\n async editMarginAccount(\n params: EditMarginAccountParams,\n ): Promise<EditMarginAccountResult> {\n const name = (params.name || '').trim();\n if (!params.id) {\n throw new Error('Missing margin account id');\n }\n if (name.length === 0 || name.length > 25) {\n throw new Error('Max size 25 characters');\n }\n\n const uri = `/api/accounts/${params.id}/edit`;\n return this.put(uri, {\n id: params.id,\n name: params.name,\n });\n }\n async closeMarginAccount(\n params: CloseMarginAccountParams,\n ): Promise<CloseMarginAccountResult> {\n if (!params.id) {\n throw new Error('Missing margin account id');\n }\n\n const uri = `/api/accounts/${params.id}/edit`;\n return this.delete(uri, {\n id: params.id,\n });\n }\n}\n"]}
@@ -50,11 +50,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
53
  Object.defineProperty(exports, "__esModule", { value: true });
57
- var rest_1 = __importDefault(require("../rest"));
54
+ var common_1 = require("@reyaxyz/common");
58
55
  var LpClient = /** @class */ (function (_super) {
59
56
  __extends(LpClient, _super);
60
57
  function LpClient() {
@@ -149,6 +146,6 @@ var LpClient = /** @class */ (function (_super) {
149
146
  });
150
147
  };
151
148
  return LpClient;
152
- }(rest_1.default));
149
+ }(common_1.RestClient));
153
150
  exports.default = LpClient;
154
151
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/lp/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,iDAAiC;AAGjC;IAAsC,4BAAU;IAAhD;;IAoEA,CAAC;IAnEO,6BAAU,GAAhB;;;;gBACQ,GAAG,GAAG,eAAe,CAAC;gBAC5B,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,4BAAS,GAAf,UAAgB,MAAuB;;;;gBAC/B,GAAG,GAAG,wBAAiB,MAAM,CAAC,EAAE,CAAE,CAAC;gBACzC,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,8CAA2B,GAAjC,UACE,MAAyC;;;;gBAEnC,GAAG,GAAG,wBAAiB,MAAM,CAAC,EAA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G,GAAG,wBAAiB,MAAM,CAAC,MAAM,2BAAwB,CAAC;gBACnE,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;qBAC1B,CAAC,EAAC;;;KACJ;IACH,eAAC;AAAD,CAAC,AApED,CAAsC,cAAU,GAoE/C","sourcesContent":["import {\n GetLpPoolParams,\n GetLpPositionsParams,\n GetLpPoolResult,\n GetLpPoolsResult,\n GetLpPoolTransactionHistoryParams,\n GetLpPoolTransactionHistoryResult,\n GetLpPositionsResult,\n GetLpPoolWithdrawBalanceParams,\n GetLpPoolWithdrawBalanceResult,\n GetLpPoolBalanceChartDataParams,\n GetLpPoolPerformanceChartDataParams,\n getLpPoolDepthChartSimulationDataParams,\n} from './types';\nimport {\n GetLpPoolBalanceChartDataResult,\n GetLpPoolPerformanceChartDataResult,\n} from '@reyaxyz/common';\nimport RestClient from '../rest';\nimport { GetLpPoolDepthChartSimulationDataResult } from '@reyaxyz/common';\n\nexport default class LpClient extends RestClient {\n async getLpPools(): Promise<GetLpPoolsResult> {\n const uri = '/api/lp-pools';\n return this.get(uri);\n }\n\n async getLpPool(params: GetLpPoolParams): Promise<GetLpPoolResult> {\n const uri = `/api/lp-pools/${params.id}`;\n return this.get(uri);\n }\n\n async getLpPoolTransactionHistory(\n params: GetLpPoolTransactionHistoryParams,\n ): Promise<GetLpPoolTransactionHistoryResult> {\n const uri = `/api/lp-pools/${params.id}/transaction-history`;\n return this.get(uri, {\n limit: params.limit,\n address: params.address,\n });\n }\n\n async getLpPositions(\n params: GetLpPositionsParams,\n ): Promise<GetLpPositionsResult> {\n const uri = `/api/lp-pools/${params.id}/positions`;\n return this.get(uri, {\n address: params.address,\n });\n }\n\n async getLpPoolWithdrawBalance(\n params: GetLpPoolWithdrawBalanceParams,\n ): Promise<GetLpPoolWithdrawBalanceResult> {\n const uri = `/api/lp-pools/${params.id}/withdraw-balance`;\n return this.get(uri, {\n address: params.address,\n });\n }\n\n async getLpPoolBalanceChartData(\n params: GetLpPoolBalanceChartDataParams,\n ): Promise<GetLpPoolBalanceChartDataResult> {\n const uri = `/api/lp-pools/${params.poolId}/balance-chart-data`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n\n async getLpPoolPerformanceChartData(\n params: GetLpPoolPerformanceChartDataParams,\n ): Promise<GetLpPoolPerformanceChartDataResult> {\n const uri = `/api/lp-pools/${params.poolId}/performance-chart-data`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n address: params.address,\n });\n }\n\n async getLpPoolDepthChartSimulationData(\n params: getLpPoolDepthChartSimulationDataParams,\n ): Promise<GetLpPoolDepthChartSimulationDataResult> {\n const uri = `/api/lp-pools/${params.poolId}/depth-simulation-data`;\n return this.get(uri, {\n marketId: params.marketId,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/lp/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,0CAKyB;AACzB;IAAsC,4BAAU;IAAhD;;IAoEA,CAAC;IAnEO,6BAAU,GAAhB;;;;gBACQ,GAAG,GAAG,eAAe,CAAC;gBAC5B,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,4BAAS,GAAf,UAAgB,MAAuB;;;;gBAC/B,GAAG,GAAG,wBAAiB,MAAM,CAAC,EAAE,CAAE,CAAC;gBACzC,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,8CAA2B,GAAjC,UACE,MAAyC;;;;gBAEnC,GAAG,GAAG,wBAAiB,MAAM,CAAC,EAAE,yBAAsB,CAAC;gBAC7D,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,OA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AAE,MAAM,CAAC,QAAQ;qBAC1B,CAAC,EAAC;;;KACJ;IACH,eAAC;AAAD,CAAC,AApED,CAAsC,mBAAU,GAoE/C","sourcesContent":["import {\n GetLpPoolParams,\n GetLpPositionsParams,\n GetLpPoolResult,\n GetLpPoolsResult,\n GetLpPoolTransactionHistoryParams,\n GetLpPoolTransactionHistoryResult,\n GetLpPositionsResult,\n GetLpPoolWithdrawBalanceParams,\n GetLpPoolWithdrawBalanceResult,\n GetLpPoolBalanceChartDataParams,\n GetLpPoolPerformanceChartDataParams,\n getLpPoolDepthChartSimulationDataParams,\n} from './types';\nimport {\n GetLpPoolBalanceChartDataResult,\n GetLpPoolPerformanceChartDataResult,\n RestClient,\n GetLpPoolDepthChartSimulationDataResult,\n} from '@reyaxyz/common';\nexport default class LpClient extends RestClient {\n async getLpPools(): Promise<GetLpPoolsResult> {\n const uri = '/api/lp-pools';\n return this.get(uri);\n }\n\n async getLpPool(params: GetLpPoolParams): Promise<GetLpPoolResult> {\n const uri = `/api/lp-pools/${params.id}`;\n return this.get(uri);\n }\n\n async getLpPoolTransactionHistory(\n params: GetLpPoolTransactionHistoryParams,\n ): Promise<GetLpPoolTransactionHistoryResult> {\n const uri = `/api/lp-pools/${params.id}/transaction-history`;\n return this.get(uri, {\n limit: params.limit,\n address: params.address,\n });\n }\n\n async getLpPositions(\n params: GetLpPositionsParams,\n ): Promise<GetLpPositionsResult> {\n const uri = `/api/lp-pools/${params.id}/positions`;\n return this.get(uri, {\n address: params.address,\n });\n }\n\n async getLpPoolWithdrawBalance(\n params: GetLpPoolWithdrawBalanceParams,\n ): Promise<GetLpPoolWithdrawBalanceResult> {\n const uri = `/api/lp-pools/${params.id}/withdraw-balance`;\n return this.get(uri, {\n address: params.address,\n });\n }\n\n async getLpPoolBalanceChartData(\n params: GetLpPoolBalanceChartDataParams,\n ): Promise<GetLpPoolBalanceChartDataResult> {\n const uri = `/api/lp-pools/${params.poolId}/balance-chart-data`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n\n async getLpPoolPerformanceChartData(\n params: GetLpPoolPerformanceChartDataParams,\n ): Promise<GetLpPoolPerformanceChartDataResult> {\n const uri = `/api/lp-pools/${params.poolId}/performance-chart-data`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n address: params.address,\n });\n }\n\n async getLpPoolDepthChartSimulationData(\n params: getLpPoolDepthChartSimulationDataParams,\n ): Promise<GetLpPoolDepthChartSimulationDataResult> {\n const uri = `/api/lp-pools/${params.poolId}/depth-simulation-data`;\n return this.get(uri, {\n marketId: params.marketId,\n });\n }\n}\n"]}
@@ -50,11 +50,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
53
  Object.defineProperty(exports, "__esModule", { value: true });
57
- var rest_1 = __importDefault(require("../rest"));
54
+ var common_1 = require("@reyaxyz/common");
58
55
  var MarketsClient = /** @class */ (function (_super) {
59
56
  __extends(MarketsClient, _super);
60
57
  function MarketsClient() {
@@ -147,6 +144,6 @@ var MarketsClient = /** @class */ (function (_super) {
147
144
  });
148
145
  };
149
146
  return MarketsClient;
150
- }(rest_1.default));
147
+ }(common_1.RestClient));
151
148
  exports.default = MarketsClient;
152
149
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/markets/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,iDAAiC;AAGjC;IAA2C,iCAAU;IAArD;;IA0EA,CAAC;IAzEC;;;;;;;;;;;;;;;;OAgBG;IAEG,kCAAU,GAAhB;;;;gBACQ,GAAG,GAAG,cAAc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ketResult,\n GetMarketsResult,\n GetMarketTradingHistoryParams,\n GetTradingHistoryResult,\n MarketCandlesResponse,\n} from './types';\nimport RestClient from '../rest';\nimport { GetFundingRateChartDataResult } from '@reyaxyz/common';\n\nexport default class MarketsClient extends RestClient {\n /**\n * Asynchronously retrieves market data from the API.\n *\n * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,\n * it fetches data for that particular market; otherwise, it fetches data for all available markets.\n *\n * @returns {Promise<GetMarketsResult>} A promise that resolves to the response containing market data.\n * @memberof MarketsClient\n *\n * @example\n * // Fetch data for all markets\n * const allMarketsData = await market.getMarkets();\n *\n * @example\n * // Fetch data for a specific market\n * const specificMarketData = await market.getMarkets('ETH-USDC');\n */\n\n async getMarkets(): Promise<GetMarketsResult> {\n const uri = '/api/markets';\n return this.get(uri);\n }\n\n async getMarket(params: GetMarketParams): Promise<GetMarketResult> {\n const uri = `/api/markets/${params.id}`;\n return this.get(uri);\n }\n\n /**\n * Retrieves candlestick data for a specified market.\n *\n * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.\n * The data can be filtered by time range (fromISO and toISO) and resolution.\n *\n * @param {GetCandlesParams} params\n * @returns {Promise<MarketCandlesResponse>} A promise that resolves to the market candlestick data.\n * @memberof MarketsClient\n *\n * @example\n * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');\n */\n\n async getMarketCandles(\n params: GetCandlesParams,\n ): Promise<MarketCandlesResponse> {\n const uri = `/api/markets/candles/${params.marketId}`;\n return this.get(uri, {\n resolution: params.resolution,\n fromISO: params.fromISO,\n toISO: params.toISO,\n limit: params.limit,\n });\n }\n\n async getMarketTradingHistory(\n params: GetMarketTradingHistoryParams,\n ): Promise<GetTradingHistoryResult> {\n const uri = `/api/trades/${params.marketId}`;\n return this.get(uri, {\n limit: params.limit,\n fromTimestampMillisecondsUTC: params.fromTimestampMillisecondsUTC,\n });\n }\n\n async getFundingRateChartData(\n params: GetFundingRateChartDataParams,\n ): Promise<GetFundingRateChartDataResult> {\n const uri = `/api/markets/${params.marketId}/funding-rate-history`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/markets/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,0CAA4E;AAE5E;IAA2C,iCAAU;IAArD;;IA0EA,CAAC;IAzEC;;;;;;;;;;;;;;;;OAgBG;IAEG,kCAAU,GAAhB;;;;gBACQ,GAAG,GAAG,cAAc,CAAC;gBAC3B,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,iCAAS,GAAf,UAAgB,MAAuB;;;;gBAC/B,GAAG,GAAG,uBAAgB,MAAM,CAAC,EAAE,CAAE,CAAC;gBACxC,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAED;;;;;;;;;;;;OAYG;IAEG,wCAAgB,GAAtB,UACE,MAAwB;;;;gBAElB,GAAG,GAAG,+BAAwB,MAAM,CAAC,QAAQ,CAAE,CAAC;gBACtD,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,UAAU,EAAE,MAAM,CAAC,UAAU;wBAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;wBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;qBACpB,CAAC,EAAC;;;KACJ;IAEK,+CAAuB,GAA7B,UACE,MAAqC;;;;gBAE/B,GAAG,GAAG,sBAAe,MAAM,CAAC,QAAQ,CAAE,CAAC;gBAC7C,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,4BAA4B,EAAE,MAAM,CAAC,4BAA4B;qBAClE,CAAC,EAAC;;;KACJ;IAEK,+CAAuB,GAA7B,UACE,MAAqC;;;;gBAE/B,GAAG,GAAG,uBAAgB,MAAM,CAAC,QAAQ,0BAAuB,CAAC;gBACnE,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW;wBACvC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW;qBACxC,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AA1ED,CAA2C,mBAAU,GA0EpD","sourcesContent":["import {\n GetCandlesParams,\n GetFundingRateChartDataParams,\n GetMarketParams,\n GetMarketResult,\n GetMarketsResult,\n GetMarketTradingHistoryParams,\n GetTradingHistoryResult,\n MarketCandlesResponse,\n} from './types';\nimport { GetFundingRateChartDataResult, RestClient } from '@reyaxyz/common';\n\nexport default class MarketsClient extends RestClient {\n /**\n * Asynchronously retrieves market data from the API.\n *\n * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,\n * it fetches data for that particular market; otherwise, it fetches data for all available markets.\n *\n * @returns {Promise<GetMarketsResult>} A promise that resolves to the response containing market data.\n * @memberof MarketsClient\n *\n * @example\n * // Fetch data for all markets\n * const allMarketsData = await market.getMarkets();\n *\n * @example\n * // Fetch data for a specific market\n * const specificMarketData = await market.getMarkets('ETH-USDC');\n */\n\n async getMarkets(): Promise<GetMarketsResult> {\n const uri = '/api/markets';\n return this.get(uri);\n }\n\n async getMarket(params: GetMarketParams): Promise<GetMarketResult> {\n const uri = `/api/markets/${params.id}`;\n return this.get(uri);\n }\n\n /**\n * Retrieves candlestick data for a specified market.\n *\n * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.\n * The data can be filtered by time range (fromISO and toISO) and resolution.\n *\n * @param {GetCandlesParams} params\n * @returns {Promise<MarketCandlesResponse>} A promise that resolves to the market candlestick data.\n * @memberof MarketsClient\n *\n * @example\n * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');\n */\n\n async getMarketCandles(\n params: GetCandlesParams,\n ): Promise<MarketCandlesResponse> {\n const uri = `/api/markets/candles/${params.marketId}`;\n return this.get(uri, {\n resolution: params.resolution,\n fromISO: params.fromISO,\n toISO: params.toISO,\n limit: params.limit,\n });\n }\n\n async getMarketTradingHistory(\n params: GetMarketTradingHistoryParams,\n ): Promise<GetTradingHistoryResult> {\n const uri = `/api/trades/${params.marketId}`;\n return this.get(uri, {\n limit: params.limit,\n fromTimestampMillisecondsUTC: params.fromTimestampMillisecondsUTC,\n });\n }\n\n async getFundingRateChartData(\n params: GetFundingRateChartDataParams,\n ): Promise<GetFundingRateChartDataResult> {\n const uri = `/api/markets/${params.marketId}/funding-rate-history`;\n return this.get(uri, {\n timeframeMs: params.filters.timeframeMs,\n granularity: params.filters.granularity,\n });\n }\n}\n"]}
@@ -50,11 +50,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
53
  Object.defineProperty(exports, "__esModule", { value: true });
57
- var rest_1 = __importDefault(require("../rest"));
54
+ var common_1 = require("@reyaxyz/common");
58
55
  var OwnerClient = /** @class */ (function (_super) {
59
56
  __extends(OwnerClient, _super);
60
57
  function OwnerClient() {
@@ -70,6 +67,6 @@ var OwnerClient = /** @class */ (function (_super) {
70
67
  });
71
68
  };
72
69
  return OwnerClient;
73
- }(rest_1.default));
70
+ }(common_1.RestClient));
74
71
  exports.default = OwnerClient;
75
72
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/owner/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAiC;AAEjC;IAAyC,+BAAU;IAAnD;;IAOA,CAAC;IANO,sCAAgB,GAAtB,UACE,MAA8B;;;;gBAExB,GAAG,GAAG,qBAAc,MAAM,CAAC,YAAY,cAAW,CAAC;gBACzD,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IACH,kBAAC;AAAD,CAAC,AAPD,CAAyC,cAAU,GAOlD","sourcesContent":["import { GetOwnerMetadataParams, GetOwnerMetadataResult } from './types';\nimport RestClient from '../rest';\n\nexport default class OwnerClient extends RestClient {\n async getOwnerMetadata(\n params: GetOwnerMetadataParams,\n ): Promise<GetOwnerMetadataResult> {\n const uri = `/api/owner/${params.ownerAddress}/metadata`;\n return this.get(uri);\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/owner/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAA6C;AAE7C;IAAyC,+BAAU;IAAnD;;IAOA,CAAC;IANO,sCAAgB,GAAtB,UACE,MAA8B;;;;gBAExB,GAAG,GAAG,qBAAc,MAAM,CAAC,YAAY,cAAW,CAAC;gBACzD,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IACH,kBAAC;AAAD,CAAC,AAPD,CAAyC,mBAAU,GAOlD","sourcesContent":["import { GetOwnerMetadataParams, GetOwnerMetadataResult } from './types';\nimport { RestClient } from '@reyaxyz/common';\n\nexport default class OwnerClient extends RestClient {\n async getOwnerMetadata(\n params: GetOwnerMetadataParams,\n ): Promise<GetOwnerMetadataResult> {\n const uri = `/api/owner/${params.ownerAddress}/metadata`;\n return this.get(uri);\n }\n}\n"]}
@@ -50,11 +50,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
53
  Object.defineProperty(exports, "__esModule", { value: true });
57
- var rest_1 = __importDefault(require("../rest"));
54
+ var common_1 = require("@reyaxyz/common");
58
55
  var TokensClient = /** @class */ (function (_super) {
59
56
  __extends(TokensClient, _super);
60
57
  function TokensClient() {
@@ -70,6 +67,6 @@ var TokensClient = /** @class */ (function (_super) {
70
67
  });
71
68
  };
72
69
  return TokensClient;
73
- }(rest_1.default));
70
+ }(common_1.RestClient));
74
71
  exports.default = TokensClient;
75
72
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/tokens/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAiC;AAEjC;IAA0C,gCAAU;IAApD;;IAOA,CAAC;IANO,uCAAgB,GAAtB,UACE,MAA8B;;;;gBAExB,GAAG,GAAG,sBAAe,MAAM,CAAC,OAAO,oBAAiB,CAAC;gBAC3D,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IACH,mBAAC;AAAD,CAAC,AAPD,CAA0C,cAAU,GAOnD","sourcesContent":["import { GetAllowedTokensParams, GetAllowedTokenResult } from './types';\nimport RestClient from '../rest';\n\nexport default class TokensClient extends RestClient {\n async getAllowedTokens(\n params: GetAllowedTokensParams,\n ): Promise<GetAllowedTokenResult> {\n const uri = `/api/tokens/${params.chainId}/allowed-tokens`;\n return this.get(uri);\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/tokens/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAA6C;AAE7C;IAA0C,gCAAU;IAApD;;IAOA,CAAC;IANO,uCAAgB,GAAtB,UACE,MAA8B;;;;gBAExB,GAAG,GAAG,sBAAe,MAAM,CAAC,OAAO,oBAAiB,CAAC;gBAC3D,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IACH,mBAAC;AAAD,CAAC,AAPD,CAA0C,mBAAU,GAOnD","sourcesContent":["import { GetAllowedTokensParams, GetAllowedTokenResult } from './types';\nimport { RestClient } from '@reyaxyz/common';\n\nexport default class TokensClient extends RestClient {\n async getAllowedTokens(\n params: GetAllowedTokensParams,\n ): Promise<GetAllowedTokenResult> {\n const uri = `/api/tokens/${params.chainId}/allowed-tokens`;\n return this.get(uri);\n }\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import { ReyaChainId } from '@reyaxyz/common';
2
- export declare const API_TIMEOUT: number;
3
2
  type ServiceEnvironment = 'production' | 'test' | 'local';
4
3
  export interface ServiceConfig {
5
4
  chain: ReyaChainId;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"/","sources":["clients/helpers/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,eAAO,MAAM,WAAW,EAAE,MAAa,CAAC;AAExC,KAAK,kBAAkB,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAC1D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,kBAAkB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAmBxE,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"/","sources":["clients/helpers/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3D,KAAK,kBAAkB,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAC1D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,kBAAkB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAmBxE,CAAC"}
@@ -1,8 +1,6 @@
1
1
  import { GetMarginAccountParams, GetMarginAccountResult, GetMarginAccountsParams, GetMarginAccountsResult, GetMarginAccountTransactionHistoryParams, GetMarginAccountTransactionHistoryResult, GetMaxOrderSizeAvailableParams, GetMaxOrderSizeAvailableResult, GetMaxWithdrawBalanceForAccountParams, GetMaxWithdrawBalanceForAccountResult, GetPositionsForMarginAccountParams, GetPositionsForMarginAccountResult, GetPositionsHistoryForMarginAccountParams, GetPositionsHistoryForMarginAccountResult, GetTransactionSimulationInitialDataParams, GetMarginAccountBalanceChartDataParams, GetMarginAccountCollateralsBalanceChartDataParams, GetAllMarginAccountsBalanceChartDataParams, EditMarginAccountParams, CloseMarginAccountParams, GetAllMarginAccountsSummaryResult, GetAllMarginAccountsSummaryParams, GetEditCollateralSimulationInitialDataParams, EditMarginAccountResult, CloseMarginAccountResult } from './types';
2
- import RestClient from '../rest';
3
2
  import { EditCollateralSimulationState, TradeSimulationState } from '@reyaxyz/common';
4
- import { GetMarginAccountCollateralsBalanceChartDataResult, GetMarginAccountBalanceChartDataResult } from '@reyaxyz/common';
5
- import { GetAllMarginAccountsBalanceChartDataResult } from '@reyaxyz/common';
3
+ import { GetMarginAccountCollateralsBalanceChartDataResult, GetMarginAccountBalanceChartDataResult, GetAllMarginAccountsBalanceChartDataResult, RestClient } from '@reyaxyz/common';
6
4
  export default class AccountClient extends RestClient {
7
5
  /**
8
6
  * Asynchronously retrieves a list of margin accounts associated with a specific address.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/account/index.ts"],"names":[],"mappings":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/B,OAAO,CAAC,wBAAwB,CAAC;CAUrC"}
@@ -1,7 +1,5 @@
1
1
  import { GetLpPoolParams, GetLpPositionsParams, GetLpPoolResult, GetLpPoolsResult, GetLpPoolTransactionHistoryParams, GetLpPoolTransactionHistoryResult, GetLpPositionsResult, GetLpPoolWithdrawBalanceParams, GetLpPoolWithdrawBalanceResult, GetLpPoolBalanceChartDataParams, GetLpPoolPerformanceChartDataParams, getLpPoolDepthChartSimulationDataParams } from './types';
2
- import { GetLpPoolBalanceChartDataResult, GetLpPoolPerformanceChartDataResult } from '@reyaxyz/common';
3
- import RestClient from '../rest';
4
- import { GetLpPoolDepthChartSimulationDataResult } from '@reyaxyz/common';
2
+ import { GetLpPoolBalanceChartDataResult, GetLpPoolPerformanceChartDataResult, RestClient, GetLpPoolDepthChartSimulationDataResult } from '@reyaxyz/common';
5
3
  export default class LpClient extends RestClient {
6
4
  getLpPools(): Promise<GetLpPoolsResult>;
7
5
  getLpPool(params: GetLpPoolParams): Promise<GetLpPoolResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/lp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,iCAAiC,EACjC,iCAAiC,EACjC,oBAAoB,EACpB,8BAA8B,EAC9B,8BAA8B,EAC9B,+BAA+B,EAC/B,mCAAmC,EACnC,uCAAuC,EACxC,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,+BAA+B,EAC/B,mCAAmC,EACpC,MAAM,iBAAiB,CAAC;AACzB,OAAO,UAAU,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,uCAAuC,EAAE,MAAM,iBAAiB,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;IACxC,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKvC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAA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,yBAAyB,CAC7B,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,+BAA+B,CAAC;IAQrC,6BAA6B,CACjC,MAAM,EAAE,mCAAmC,GAC1C,OAAO,CAAC,mCAAmC,CAAC;IASzC,iCAAiC,CACrC,MAAM,EAAE,uCAAuC,GAC9C,OAAO,CAAC,uCAAuC,CAAC;CAMpD"}
@@ -1,6 +1,5 @@
1
1
  import { GetCandlesParams, GetFundingRateChartDataParams, GetMarketParams, GetMarketResult, GetMarketsResult, GetMarketTradingHistoryParams, GetTradingHistoryResult, MarketCandlesResponse } from './types';
2
- import RestClient from '../rest';
3
- import { GetFundingRateChartDataResult } from '@reyaxyz/common';
2
+ import { GetFundingRateChartDataResult, RestClient } from '@reyaxyz/common';
4
3
  export default class MarketsClient extends RestClient {
5
4
  /**
6
5
  * Asynchronously retrieves market data from the API.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/markets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AACjB,OAAO,UAAU,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;;;;;;OAgBG;IAEG,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKvC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAKlE;;;;;;;;;;;;OAYG;IAEG,gBAAgB,CACpB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,qBAAqB,CAAC;IAU3B,uBAAuB,CAC3B,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,uBAAuB,CAAC;IAQ7B,uBAAuB,CAC3B,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,6BAA6B,CAAC;CAO1C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/markets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,6BAA6B,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE5E,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;;;;;;OAgBG;IAEG,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKvC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAKlE;;;;;;;;;;;;OAYG;IAEG,gBAAgB,CACpB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,qBAAqB,CAAC;IAU3B,uBAAuB,CAC3B,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,uBAAuB,CAAC;IAQ7B,uBAAuB,CAC3B,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,6BAA6B,CAAC;CAO1C"}
@@ -1,5 +1,5 @@
1
1
  import { GetOwnerMetadataParams, GetOwnerMetadataResult } from './types';
2
- import RestClient from '../rest';
2
+ import { RestClient } from '@reyaxyz/common';
3
3
  export default class OwnerClient extends RestClient {
4
4
  getOwnerMetadata(params: GetOwnerMetadataParams): Promise<GetOwnerMetadataResult>;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/owner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,UAAU,MAAM,SAAS,CAAC;AAEjC,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,UAAU;IAC3C,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;CAInC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/owner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,UAAU;IAC3C,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;CAInC"}
@@ -1,5 +1,5 @@
1
1
  import { GetAllowedTokensParams, GetAllowedTokenResult } from './types';
2
- import RestClient from '../rest';
2
+ import { RestClient } from '@reyaxyz/common';
3
3
  export default class TokensClient extends RestClient {
4
4
  getAllowedTokens(params: GetAllowedTokensParams): Promise<GetAllowedTokenResult>;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,UAAU,MAAM,SAAS,CAAC;AAEjC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU;IAC5C,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,qBAAqB,CAAC;CAIlC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU;IAC5C,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,qBAAqB,CAAC;CAIlC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/api-sdk",
3
- "version": "0.51.0",
3
+ "version": "0.52.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -33,10 +33,9 @@
33
33
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
34
34
  },
35
35
  "dependencies": {
36
- "@reyaxyz/common": "0.25.0",
37
- "axios": "^1.6.2",
36
+ "@reyaxyz/common": "0.27.0",
38
37
  "bignumber.js": "^9.1.2"
39
38
  },
40
39
  "packageManager": "pnpm@8.10.4",
41
- "gitHead": "526498449fa697eaab4aac5befa07a59fc0c9e15"
40
+ "gitHead": "8eb6eea74ac708cd39716c34626d02d716376114"
42
41
  }
@@ -1,6 +1,4 @@
1
- import { ReyaChainId } from '@reyaxyz/common';
2
-
3
- export const API_TIMEOUT: number = 2500;
1
+ import { API_TIMEOUT, ReyaChainId } from '@reyaxyz/common';
4
2
 
5
3
  type ServiceEnvironment = 'production' | 'test' | 'local';
6
4
  export interface ServiceConfig {
@@ -25,7 +25,6 @@ import {
25
25
  EditMarginAccountResult,
26
26
  CloseMarginAccountResult,
27
27
  } from './types';
28
- import RestClient from '../rest';
29
28
  import {
30
29
  EditCollateralSimulationState,
31
30
  TradeSimulationState,
@@ -33,8 +32,9 @@ import {
33
32
  import {
34
33
  GetMarginAccountCollateralsBalanceChartDataResult,
35
34
  GetMarginAccountBalanceChartDataResult,
35
+ GetAllMarginAccountsBalanceChartDataResult,
36
+ RestClient,
36
37
  } from '@reyaxyz/common';
37
- import { GetAllMarginAccountsBalanceChartDataResult } from '@reyaxyz/common';
38
38
 
39
39
  export default class AccountClient extends RestClient {
40
40
  /**
@@ -15,10 +15,9 @@ import {
15
15
  import {
16
16
  GetLpPoolBalanceChartDataResult,
17
17
  GetLpPoolPerformanceChartDataResult,
18
+ RestClient,
19
+ GetLpPoolDepthChartSimulationDataResult,
18
20
  } from '@reyaxyz/common';
19
- import RestClient from '../rest';
20
- import { GetLpPoolDepthChartSimulationDataResult } from '@reyaxyz/common';
21
-
22
21
  export default class LpClient extends RestClient {
23
22
  async getLpPools(): Promise<GetLpPoolsResult> {
24
23
  const uri = '/api/lp-pools';
@@ -8,8 +8,7 @@ import {
8
8
  GetTradingHistoryResult,
9
9
  MarketCandlesResponse,
10
10
  } from './types';
11
- import RestClient from '../rest';
12
- import { GetFundingRateChartDataResult } from '@reyaxyz/common';
11
+ import { GetFundingRateChartDataResult, RestClient } from '@reyaxyz/common';
13
12
 
14
13
  export default class MarketsClient extends RestClient {
15
14
  /**
@@ -1,5 +1,5 @@
1
1
  import { GetOwnerMetadataParams, GetOwnerMetadataResult } from './types';
2
- import RestClient from '../rest';
2
+ import { RestClient } from '@reyaxyz/common';
3
3
 
4
4
  export default class OwnerClient extends RestClient {
5
5
  async getOwnerMetadata(
@@ -1,5 +1,5 @@
1
1
  import { GetAllowedTokensParams, GetAllowedTokenResult } from './types';
2
- import RestClient from '../rest';
2
+ import { RestClient } from '@reyaxyz/common';
3
3
 
4
4
  export default class TokensClient extends RestClient {
5
5
  async getAllowedTokens(
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateQueryPath = void 0;
4
- function generateQueryPath(url, params) {
5
- var definedEntries = Object.entries(params).filter(function (_a) {
6
- var value = _a[1];
7
- return value !== undefined;
8
- });
9
- if (!definedEntries.length) {
10
- return url;
11
- }
12
- var paramsString = definedEntries
13
- .map(function (_a) {
14
- var key = _a[0], value = _a[1];
15
- return "".concat(key, "=").concat(value);
16
- })
17
- .join('&');
18
- return "".concat(url, "?").concat(paramsString);
19
- }
20
- exports.generateQueryPath = generateQueryPath;
21
- //# sourceMappingURL=query-helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query-helper.js","sourceRoot":"/","sources":["clients/helpers/query-helper.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAC/B,GAAW,EACX,MAA4B;IAE5B,IAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAClD,UAAC,EAA4B;YAAzB,KAAK,QAAA;QAAyB,OAAA,KAAK,KAAK,SAAS;IAAnB,CAAmB,CACtD,CAAC;IAEF,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAM,YAAY,GAAG,cAAc;SAChC,GAAG,CAAC,UAAC,EAA+B;YAA9B,GAAG,QAAA,EAAE,KAAK,QAAA;QAAyB,OAAA,UAAG,GAAG,cAAI,KAAK,CAAE;IAAjB,CAAiB,CAAC;SAC3D,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,UAAG,GAAG,cAAI,YAAY,CAAE,CAAC;AAClC,CAAC;AAhBD,8CAgBC","sourcesContent":["export function generateQueryPath(\n url: string,\n params: NonNullable<unknown>,\n): string {\n const definedEntries = Object.entries(params).filter(\n ([, value]: [string, unknown]) => value !== undefined,\n );\n\n if (!definedEntries.length) {\n return url;\n }\n\n const paramsString = definedEntries\n .map(([key, value]: [string, unknown]) => `${key}=${value}`)\n .join('&');\n return `${url}?${paramsString}`;\n}\n"]}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.request = exports.RequestMethod = void 0;
7
- var axios_1 = __importDefault(require("axios"));
8
- var RequestMethod;
9
- (function (RequestMethod) {
10
- RequestMethod["POST"] = "POST";
11
- RequestMethod["PUT"] = "PUT";
12
- RequestMethod["GET"] = "GET";
13
- RequestMethod["DELETE"] = "DELETE";
14
- })(RequestMethod || (exports.RequestMethod = RequestMethod = {}));
15
- function request(url, method, body, headers) {
16
- if (method === void 0) { method = RequestMethod.GET; }
17
- if (headers === void 0) { headers = {}; }
18
- return (0, axios_1.default)({
19
- url: url,
20
- method: method,
21
- data: body,
22
- headers: headers,
23
- });
24
- }
25
- exports.request = request;
26
- //# sourceMappingURL=axios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios.js","sourceRoot":"/","sources":["clients/lib/axios.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAE1B,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,4BAAW,CAAA;IACX,4BAAW,CAAA;IACX,kCAAiB,CAAA;AACnB,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB;AAQD,SAAgB,OAAO,CACrB,GAAW,EACX,MAAyC,EACzC,IAAqB,EACrB,OAAkC;IAFlC,uBAAA,EAAA,SAAwB,aAAa,CAAC,GAAG;IAEzC,wBAAA,EAAA,YAAkC;IAElC,OAAO,IAAA,eAAK,EAAmC;QAC7C,GAAG,KAAA;QACH,MAAM,QAAA;QACN,IAAI,EAAE,IAAI;QACV,OAAO,SAAA;KACR,CAAC,CAAC;AACL,CAAC;AAZD,0BAYC","sourcesContent":["import axios from 'axios';\n\nexport enum RequestMethod {\n POST = 'POST',\n PUT = 'PUT',\n GET = 'GET',\n DELETE = 'DELETE',\n}\n\nexport type ApiResponse<Data> = {\n status: number;\n data: Data;\n headers: NonNullable<unknown>;\n};\n\nexport function request<ResponseData>(\n url: string,\n method: RequestMethod = RequestMethod.GET,\n body?: unknown | null,\n headers: NonNullable<unknown> = {},\n): Promise<ApiResponse<ResponseData>> {\n return axios<never, ApiResponse<ResponseData>>({\n url,\n method,\n data: body,\n headers,\n });\n}\n"]}
@@ -1,117 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var constants_1 = require("../../helpers/constants");
40
- var query_helper_1 = require("../../helpers/query-helper");
41
- var axios_1 = require("../../lib/axios");
42
- var RestClient = /** @class */ (function () {
43
- function RestClient(host, apiTimeout) {
44
- this.host = host;
45
- this.apiTimeout = apiTimeout || constants_1.API_TIMEOUT;
46
- }
47
- RestClient.prototype.get = function (requestPath, params) {
48
- if (params === void 0) { params = {}; }
49
- return __awaiter(this, void 0, void 0, function () {
50
- var url, response;
51
- return __generator(this, function (_a) {
52
- switch (_a.label) {
53
- case 0:
54
- url = "".concat(this.host).concat((0, query_helper_1.generateQueryPath)(requestPath, params));
55
- return [4 /*yield*/, (0, axios_1.request)(url)];
56
- case 1:
57
- response = _a.sent();
58
- return [2 /*return*/, response.data];
59
- }
60
- });
61
- });
62
- };
63
- RestClient.prototype.post = function (requestPath, params, body, headers) {
64
- if (params === void 0) { params = {}; }
65
- if (headers === void 0) { headers = {}; }
66
- return __awaiter(this, void 0, void 0, function () {
67
- var url, response;
68
- return __generator(this, function (_a) {
69
- switch (_a.label) {
70
- case 0:
71
- url = "".concat(this.host).concat((0, query_helper_1.generateQueryPath)(requestPath, params));
72
- return [4 /*yield*/, (0, axios_1.request)(url, axios_1.RequestMethod.POST, body, headers)];
73
- case 1:
74
- response = _a.sent();
75
- return [2 /*return*/, response.data];
76
- }
77
- });
78
- });
79
- };
80
- RestClient.prototype.put = function (requestPath, params, body, headers) {
81
- if (params === void 0) { params = {}; }
82
- if (headers === void 0) { headers = {}; }
83
- return __awaiter(this, void 0, void 0, function () {
84
- var url, response;
85
- return __generator(this, function (_a) {
86
- switch (_a.label) {
87
- case 0:
88
- url = "".concat(this.host).concat((0, query_helper_1.generateQueryPath)(requestPath, params));
89
- return [4 /*yield*/, (0, axios_1.request)(url, axios_1.RequestMethod.PUT, body, headers)];
90
- case 1:
91
- response = _a.sent();
92
- return [2 /*return*/, response.data];
93
- }
94
- });
95
- });
96
- };
97
- RestClient.prototype.delete = function (requestPath, params, body, headers) {
98
- if (params === void 0) { params = {}; }
99
- if (headers === void 0) { headers = {}; }
100
- return __awaiter(this, void 0, void 0, function () {
101
- var url, response;
102
- return __generator(this, function (_a) {
103
- switch (_a.label) {
104
- case 0:
105
- url = "".concat(this.host).concat((0, query_helper_1.generateQueryPath)(requestPath, params));
106
- return [4 /*yield*/, (0, axios_1.request)(url, axios_1.RequestMethod.DELETE, body, headers)];
107
- case 1:
108
- response = _a.sent();
109
- return [2 /*return*/, response.data];
110
- }
111
- });
112
- });
113
- };
114
- return RestClient;
115
- }());
116
- exports.default = RestClient;
117
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/rest/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAsD;AACtD,2DAA+D;AAC/D,yCAAyD;AACzD;IAIE,oBAAY,IAAY,EAAE,UAA0B;QAClD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,uBAAW,CAAC;IAC9C,CAAC;IAEK,wBAAG,GAAT,UACE,WAAmB,EACnB,MAAiC;QAAjC,uBAAA,EAAA,WAAiC;;;;;;wBAE3B,GAAG,GAAG,UAAG,IAAI,CAAC,IAAI,SAAG,IAAA,gCAAiB,EAAC,WAAW,EAAE,MAAM,CAAC,CAAE,CAAC;wBACnD,qBAAM,IAAA,eAAO,EAAW,GAAG,CAAC,EAAA;;wBAAvC,QAAQ,GAAG,SAA4B;wBAC7C,sBAAO,QAAQ,CAAC,IAAI,EAAC;;;;KACtB;IAEK,yBAAI,GAAV,UACE,WAAmB,EACnB,MAAiC,EACjC,IAAqB,EACrB,OAAkC;QAFlC,uBAAA,EAAA,WAAiC;QAEjC,wBAAA,EAAA,YAAkC;;;;;;wBAE5B,GAAG,GAAG,UAAG,IAAI,CAAC,IAAI,SAAG,IAAA,gCAAiB,EAAC,WAAW,EAAE,MAAM,CAAC,CAAE,CAAC;wBACnD,qBAAM,IAAA,eAAO,EAC5B,GAAG,EACH,qBAAa,CAAC,IAAI,EAClB,IAAI,EACJ,OAAO,CACR,EAAA;;wBALK,QAAQ,GAAG,SAKhB;wBACD,sBAAO,QAAQ,CAAC,IAAI,EAAC;;;;KACtB;IAEK,wBAAG,GAAT,UACE,WAAmB,EACnB,MAAiC,EACjC,IAAqB,EACrB,OAAkC;QAFlC,uBAAA,EAAA,WAAiC;QAEjC,wBAAA,EAAA,YAAkC;;;;;;wBAE5B,GAAG,GAAG,UAAG,IAAI,CAAC,IAAI,SAAG,IAAA,gCAAiB,EAAC,WAAW,EAAE,MAAM,CAAC,CAAE,CAAC;wBACnD,qBAAM,IAAA,eAAO,EAC5B,GAAG,EACH,qBAAa,CAAC,GAAG,EACjB,IAAI,EACJ,OAAO,CACR,EAAA;;wBALK,QAAQ,GAAG,SAKhB;wBACD,sBAAO,QAAQ,CAAC,IAAI,EAAC;;;;KACtB;IAEK,2BAAM,GAAZ,UACE,WAAmB,EACnB,MAAiC,EACjC,IAAqB,EACrB,OAAkC;QAFlC,uBAAA,EAAA,WAAiC;QAEjC,wBAAA,EAAA,YAAkC;;;;;;wBAE5B,GAAG,GAAG,UAAG,IAAI,CAAC,IAAI,SAAG,IAAA,gCAAiB,EAAC,WAAW,EAAE,MAAM,CAAC,CAAE,CAAC;wBACnD,qBAAM,IAAA,eAAO,EAC5B,GAAG,EACH,qBAAa,CAAC,MAAM,EACpB,IAAI,EACJ,OAAO,CACR,EAAA;;wBALK,QAAQ,GAAG,SAKhB;wBACD,sBAAO,QAAQ,CAAC,IAAI,EAAC;;;;KACtB;IACH,iBAAC;AAAD,CAAC,AAjED,IAiEC","sourcesContent":["import { API_TIMEOUT } from '../../helpers/constants';\nimport { generateQueryPath } from '../../helpers/query-helper';\nimport { RequestMethod, request } from '../../lib/axios';\nexport default class RestClient {\n readonly host: string;\n readonly apiTimeout: number;\n\n constructor(host: string, apiTimeout?: number | null) {\n this.host = host;\n this.apiTimeout = apiTimeout || API_TIMEOUT;\n }\n\n async get<Response>(\n requestPath: string,\n params: NonNullable<unknown> = {},\n ): Promise<Response> {\n const url = `${this.host}${generateQueryPath(requestPath, params)}`;\n const response = await request<Response>(url);\n return response.data;\n }\n\n async post<Response>(\n requestPath: string,\n params: NonNullable<unknown> = {},\n body?: unknown | null,\n headers: NonNullable<unknown> = {},\n ): Promise<Response> {\n const url = `${this.host}${generateQueryPath(requestPath, params)}`;\n const response = await request<Response>(\n url,\n RequestMethod.POST,\n body,\n headers,\n );\n return response.data;\n }\n\n async put<Response>(\n requestPath: string,\n params: NonNullable<unknown> = {},\n body?: unknown | null,\n headers: NonNullable<unknown> = {},\n ): Promise<Response> {\n const url = `${this.host}${generateQueryPath(requestPath, params)}`;\n const response = await request<Response>(\n url,\n RequestMethod.PUT,\n body,\n headers,\n );\n return response.data;\n }\n\n async delete<Response>(\n requestPath: string,\n params: NonNullable<unknown> = {},\n body?: unknown | null,\n headers: NonNullable<unknown> = {},\n ): Promise<Response> {\n const url = `${this.host}${generateQueryPath(requestPath, params)}`;\n const response = await request<Response>(\n url,\n RequestMethod.DELETE,\n body,\n headers,\n );\n return response.data;\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- export declare function generateQueryPath(url: string, params: NonNullable<unknown>): string;
2
- //# sourceMappingURL=query-helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query-helper.d.ts","sourceRoot":"/","sources":["clients/helpers/query-helper.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,GAC3B,MAAM,CAaR"}
@@ -1,13 +0,0 @@
1
- export declare enum RequestMethod {
2
- POST = "POST",
3
- PUT = "PUT",
4
- GET = "GET",
5
- DELETE = "DELETE"
6
- }
7
- export type ApiResponse<Data> = {
8
- status: number;
9
- data: Data;
10
- headers: NonNullable<unknown>;
11
- };
12
- export declare function request<ResponseData>(url: string, method?: RequestMethod, body?: unknown | null, headers?: NonNullable<unknown>): Promise<ApiResponse<ResponseData>>;
13
- //# sourceMappingURL=axios.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios.d.ts","sourceRoot":"/","sources":["clients/lib/axios.ts"],"names":[],"mappings":"AAEA,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,WAAW,CAAC,IAAI,IAAI;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEF,wBAAgB,OAAO,CAAC,YAAY,EAClC,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,aAAiC,EACzC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,EACrB,OAAO,GAAE,WAAW,CAAC,OAAO,CAAM,GACjC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAOpC"}
@@ -1,10 +0,0 @@
1
- export default class RestClient {
2
- readonly host: string;
3
- readonly apiTimeout: number;
4
- constructor(host: string, apiTimeout?: number | null);
5
- get<Response>(requestPath: string, params?: NonNullable<unknown>): Promise<Response>;
6
- post<Response>(requestPath: string, params?: NonNullable<unknown>, body?: unknown | null, headers?: NonNullable<unknown>): Promise<Response>;
7
- put<Response>(requestPath: string, params?: NonNullable<unknown>, body?: unknown | null, headers?: NonNullable<unknown>): Promise<Response>;
8
- delete<Response>(requestPath: string, params?: NonNullable<unknown>, body?: unknown | null, headers?: NonNullable<unknown>): Promise<Response>;
9
- }
10
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/rest/index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAK9C,GAAG,CAAC,QAAQ,EAChB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,WAAW,CAAC,OAAO,CAAM,GAChC,OAAO,CAAC,QAAQ,CAAC;IAMd,IAAI,CAAC,QAAQ,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,WAAW,CAAC,OAAO,CAAM,EACjC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,EACrB,OAAO,GAAE,WAAW,CAAC,OAAO,CAAM,GACjC,OAAO,CAAC,QAAQ,CAAC;IAWd,GAAG,CAAC,QAAQ,EAChB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,WAAW,CAAC,OAAO,CAAM,EACjC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,EACrB,OAAO,GAAE,WAAW,CAAC,OAAO,CAAM,GACjC,OAAO,CAAC,QAAQ,CAAC;IAWd,MAAM,CAAC,QAAQ,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,WAAW,CAAC,OAAO,CAAM,EACjC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,EACrB,OAAO,GAAE,WAAW,CAAC,OAAO,CAAM,GACjC,OAAO,CAAC,QAAQ,CAAC;CAUrB"}
@@ -1,17 +0,0 @@
1
- export function generateQueryPath(
2
- url: string,
3
- params: NonNullable<unknown>,
4
- ): string {
5
- const definedEntries = Object.entries(params).filter(
6
- ([, value]: [string, unknown]) => value !== undefined,
7
- );
8
-
9
- if (!definedEntries.length) {
10
- return url;
11
- }
12
-
13
- const paramsString = definedEntries
14
- .map(([key, value]: [string, unknown]) => `${key}=${value}`)
15
- .join('&');
16
- return `${url}?${paramsString}`;
17
- }
@@ -1,28 +0,0 @@
1
- import axios from 'axios';
2
-
3
- export enum RequestMethod {
4
- POST = 'POST',
5
- PUT = 'PUT',
6
- GET = 'GET',
7
- DELETE = 'DELETE',
8
- }
9
-
10
- export type ApiResponse<Data> = {
11
- status: number;
12
- data: Data;
13
- headers: NonNullable<unknown>;
14
- };
15
-
16
- export function request<ResponseData>(
17
- url: string,
18
- method: RequestMethod = RequestMethod.GET,
19
- body?: unknown | null,
20
- headers: NonNullable<unknown> = {},
21
- ): Promise<ApiResponse<ResponseData>> {
22
- return axios<never, ApiResponse<ResponseData>>({
23
- url,
24
- method,
25
- data: body,
26
- headers,
27
- });
28
- }
@@ -1,69 +0,0 @@
1
- import { API_TIMEOUT } from '../../helpers/constants';
2
- import { generateQueryPath } from '../../helpers/query-helper';
3
- import { RequestMethod, request } from '../../lib/axios';
4
- export default class RestClient {
5
- readonly host: string;
6
- readonly apiTimeout: number;
7
-
8
- constructor(host: string, apiTimeout?: number | null) {
9
- this.host = host;
10
- this.apiTimeout = apiTimeout || API_TIMEOUT;
11
- }
12
-
13
- async get<Response>(
14
- requestPath: string,
15
- params: NonNullable<unknown> = {},
16
- ): Promise<Response> {
17
- const url = `${this.host}${generateQueryPath(requestPath, params)}`;
18
- const response = await request<Response>(url);
19
- return response.data;
20
- }
21
-
22
- async post<Response>(
23
- requestPath: string,
24
- params: NonNullable<unknown> = {},
25
- body?: unknown | null,
26
- headers: NonNullable<unknown> = {},
27
- ): Promise<Response> {
28
- const url = `${this.host}${generateQueryPath(requestPath, params)}`;
29
- const response = await request<Response>(
30
- url,
31
- RequestMethod.POST,
32
- body,
33
- headers,
34
- );
35
- return response.data;
36
- }
37
-
38
- async put<Response>(
39
- requestPath: string,
40
- params: NonNullable<unknown> = {},
41
- body?: unknown | null,
42
- headers: NonNullable<unknown> = {},
43
- ): Promise<Response> {
44
- const url = `${this.host}${generateQueryPath(requestPath, params)}`;
45
- const response = await request<Response>(
46
- url,
47
- RequestMethod.PUT,
48
- body,
49
- headers,
50
- );
51
- return response.data;
52
- }
53
-
54
- async delete<Response>(
55
- requestPath: string,
56
- params: NonNullable<unknown> = {},
57
- body?: unknown | null,
58
- headers: NonNullable<unknown> = {},
59
- ): Promise<Response> {
60
- const url = `${this.host}${generateQueryPath(requestPath, params)}`;
61
- const response = await request<Response>(
62
- url,
63
- RequestMethod.DELETE,
64
- body,
65
- headers,
66
- );
67
- return response.data;
68
- }
69
- }