@reyaxyz/api-sdk 0.50.0 → 0.52.0

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 (65) hide show
  1. package/dist/clients/api-client.js +16 -0
  2. package/dist/clients/api-client.js.map +1 -1
  3. package/dist/clients/helpers/constants.js +4 -5
  4. package/dist/clients/helpers/constants.js.map +1 -1
  5. package/dist/clients/modules/account/index.js +2 -5
  6. package/dist/clients/modules/account/index.js.map +1 -1
  7. package/dist/clients/modules/depth-chart.simulation/index.js +132 -0
  8. package/dist/clients/modules/depth-chart.simulation/index.js.map +1 -0
  9. package/dist/clients/modules/depth-chart.simulation/types.js +3 -0
  10. package/dist/clients/modules/depth-chart.simulation/types.js.map +1 -0
  11. package/dist/clients/modules/lp/index.js +13 -5
  12. package/dist/clients/modules/lp/index.js.map +1 -1
  13. package/dist/clients/modules/lp/types.js.map +1 -1
  14. package/dist/clients/modules/markets/index.js +2 -5
  15. package/dist/clients/modules/markets/index.js.map +1 -1
  16. package/dist/clients/modules/owner/index.js +2 -5
  17. package/dist/clients/modules/owner/index.js.map +1 -1
  18. package/dist/clients/modules/tokens/index.js +2 -5
  19. package/dist/clients/modules/tokens/index.js.map +1 -1
  20. package/dist/types/clients/api-client.d.ts +10 -0
  21. package/dist/types/clients/api-client.d.ts.map +1 -1
  22. package/dist/types/clients/helpers/constants.d.ts +0 -1
  23. package/dist/types/clients/helpers/constants.d.ts.map +1 -1
  24. package/dist/types/clients/modules/account/index.d.ts +1 -3
  25. package/dist/types/clients/modules/account/index.d.ts.map +1 -1
  26. package/dist/types/clients/modules/depth-chart.simulation/index.d.ts +15 -0
  27. package/dist/types/clients/modules/depth-chart.simulation/index.d.ts.map +1 -0
  28. package/dist/types/clients/modules/depth-chart.simulation/types.d.ts +16 -0
  29. package/dist/types/clients/modules/depth-chart.simulation/types.d.ts.map +1 -0
  30. package/dist/types/clients/modules/lp/index.d.ts +3 -3
  31. package/dist/types/clients/modules/lp/index.d.ts.map +1 -1
  32. package/dist/types/clients/modules/lp/types.d.ts +5 -1
  33. package/dist/types/clients/modules/lp/types.d.ts.map +1 -1
  34. package/dist/types/clients/modules/markets/index.d.ts +1 -2
  35. package/dist/types/clients/modules/markets/index.d.ts.map +1 -1
  36. package/dist/types/clients/modules/owner/index.d.ts +1 -1
  37. package/dist/types/clients/modules/owner/index.d.ts.map +1 -1
  38. package/dist/types/clients/modules/tokens/index.d.ts +1 -1
  39. package/dist/types/clients/modules/tokens/index.d.ts.map +1 -1
  40. package/package.json +3 -4
  41. package/src/clients/api-client.ts +15 -0
  42. package/src/clients/helpers/constants.ts +1 -3
  43. package/src/clients/modules/account/index.ts +2 -2
  44. package/src/clients/modules/depth-chart.simulation/index.ts +102 -0
  45. package/src/clients/modules/depth-chart.simulation/types.ts +18 -0
  46. package/src/clients/modules/lp/index.ts +13 -3
  47. package/src/clients/modules/lp/types.ts +6 -0
  48. package/src/clients/modules/markets/index.ts +1 -2
  49. package/src/clients/modules/owner/index.ts +1 -1
  50. package/src/clients/modules/tokens/index.ts +1 -1
  51. package/dist/clients/helpers/query-helper.js +0 -21
  52. package/dist/clients/helpers/query-helper.js.map +0 -1
  53. package/dist/clients/lib/axios.js +0 -26
  54. package/dist/clients/lib/axios.js.map +0 -1
  55. package/dist/clients/modules/rest/index.js +0 -117
  56. package/dist/clients/modules/rest/index.js.map +0 -1
  57. package/dist/types/clients/helpers/query-helper.d.ts +0 -2
  58. package/dist/types/clients/helpers/query-helper.d.ts.map +0 -1
  59. package/dist/types/clients/lib/axios.d.ts +0 -13
  60. package/dist/types/clients/lib/axios.d.ts.map +0 -1
  61. package/dist/types/clients/modules/rest/index.d.ts +0 -10
  62. package/dist/types/clients/modules/rest/index.d.ts.map +0 -1
  63. package/src/clients/helpers/query-helper.ts +0 -17
  64. package/src/clients/lib/axios.ts +0 -28
  65. package/src/clients/modules/rest/index.ts +0 -69
@@ -1 +1 @@
1
- {"version":3,"file":"api-client.d.ts","sourceRoot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MEOUT: 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":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,wCAAwC,EACxC,wCAAwC,EACxC,8BAA8B,EAC9B,8BAA8B,EAC9B,qCAAqC,EACrC,qCAAqC,EACrC,kCAAkC,EAClC,kCAAkC,EAClC,yCAAyC,EACzC,yCAAyC,EACzC,yCAAyC,EACzC,sCAAsC,EACtC,iDAAiD,EACjD,0CAA0C,EAC1C,uBAAuB,EACvB,wBAAwB,EACxB,iCAAiC,EACjC,iCAAiC,EACjC,4CAA4C,EAC5C,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,UAAU,MAAM,SAAS,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,E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AAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAe7B,kBAAkB,CACtB,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CAUrC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,wCAAwC,EACxC,wCAAwC,EACxC,8BAA8B,EAC9B,8BAA8B,EAC9B,qCAAqC,EACrC,qCAAqC,EACrC,kCAAkC,EAClC,kCAAkC,EAClC,yCAAyC,EACzC,yCAAyC,EACzC,yCAAyC,EACzC,sCAAsC,EACtC,iDAAiD,EACjD,0CAA0C,EAC1C,uBAAuB,EACvB,wBAAwB,EACxB,iCAAiC,EACjC,iCAAiC,EACjC,4CAA4C,EAC5C,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iDAAiD,EACjD,sCAAsC,EACtC,0CAA0C,EAC1C,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;SAWK;IAEC,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAKnC;;;;;;;;;;OAUG;IAEG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAK5B,4BAA4B,CAChC,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,kCAAkC,CAAC;IAKxC,mCAAmC,CACvC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,yCAAyC,CAAC;IAK/C,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,8BAA8B,CAAC;IAQpC,mCAAmC,CACvC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,oBAAoB,CAAC;IAO1B,sCAAsC,CAC1C,MAAM,EAAE,4CAA4C,GACnD,OAAO,CAAC,6BAA6B,CAAC;IAKnC,kCAAkC,CACtC,MAAM,EAAE,wCAAwC,GAC/C,OAAO,CAAC,wCAAwC,CAAC;IAO9C,+BAA+B,CACnC,MAAM,EAAE,qCAAqC,GAC5C,OAAO,CAAC,qCAAqC,CAAC;IAO3C,gCAAgC,CACpC,MAAM,EAAE,sCAAsC,GAC7C,OAAO,CAAC,sCAAsC,CAAC;IAQ5C,2CAA2C,CAC/C,MAAM,EAAE,iDAAiD,GACxD,OAAO,CAAC,iDAAiD,CAAC;IAQvD,gCAAgC,CACpC,MAAM,EAAE,0CAA0C,GACjD,OAAO,CAAC,0CAA0C,CAAC;IAQhD,2BAA2B,CAC/B,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,iCAAiC,CAAC;IAMvC,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAe7B,kBAAkB,CACtB,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,wBAAwB,CAAC;CAUrC"}
@@ -0,0 +1,15 @@
1
+ import { DepthChart, DepthSimulationLoadDataParams } from './types';
2
+ import LpClient from '../lp';
3
+ export default class DepthChartSimulationClient {
4
+ private poolId;
5
+ private marketId;
6
+ private loadedData;
7
+ private lpClient;
8
+ constructor(lpClient: LpClient);
9
+ arm(params: DepthSimulationLoadDataParams): Promise<void>;
10
+ private fetchPoolData;
11
+ simulate(step?: number, percentageChange?: number): DepthChart;
12
+ private calculate;
13
+ static calculatePriceChangePercentage(price: number, estimatedPrice: number): number;
14
+ }
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,6BAA6B,EAE9B,MAAM,SAAS,CAAC;AAEjB,OAAO,QAAQ,MAAM,OAAO,CAAC;AAI7B,MAAM,CAAC,OAAO,OAAO,0BAA0B;IAC7C,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,QAAQ,CAAW;gBACf,QAAQ,EAAE,QAAQ;IAMxB,GAAG,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;YAOjD,aAAa;IAU3B,QAAQ,CAAC,IAAI,GAAE,MAAW,EAAE,gBAAgB,GAAE,MAAW,GAAG,UAAU;IAyBtE,OAAO,CAAC,SAAS;IA2BjB,MAAM,CAAC,8BAA8B,CACnC,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,GACrB,MAAM;CAQV"}
@@ -0,0 +1,16 @@
1
+ import { LpPoolEntity, MarketEntity } from '@reyaxyz/common';
2
+ export type DepthSimulationLoadDataParams = {
3
+ poolId: LpPoolEntity['id'];
4
+ marketId: MarketEntity['id'];
5
+ };
6
+ export type SimulateDepthEntity = {
7
+ price: number;
8
+ totalSize: number;
9
+ totalCost: number;
10
+ priceImpact: number;
11
+ };
12
+ export type DepthChart = {
13
+ leftChart: SimulateDepthEntity[];
14
+ rightChart: SimulateDepthEntity[];
15
+ };
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,UAAU,EAAE,mBAAmB,EAAE,CAAC;CACnC,CAAC"}
@@ -1,6 +1,5 @@
1
- import { GetLpPoolParams, GetLpPositionsParams, GetLpPoolResult, GetLpPoolsResult, GetLpPoolTransactionHistoryParams, GetLpPoolTransactionHistoryResult, GetLpPositionsResult, GetLpPoolWithdrawBalanceParams, GetLpPoolWithdrawBalanceResult, GetLpPoolBalanceChartDataParams, GetLpPoolPerformanceChartDataParams } from './types';
2
- import { GetLpPoolPerformanceChartDataResult, GetLpPoolBalanceChartDataResult } from '@reyaxyz/common';
3
- import RestClient from '../rest';
1
+ import { GetLpPoolParams, GetLpPositionsParams, GetLpPoolResult, GetLpPoolsResult, GetLpPoolTransactionHistoryParams, GetLpPoolTransactionHistoryResult, GetLpPositionsResult, GetLpPoolWithdrawBalanceParams, GetLpPoolWithdrawBalanceResult, GetLpPoolBalanceChartDataParams, GetLpPoolPerformanceChartDataParams, getLpPoolDepthChartSimulationDataParams } from './types';
2
+ import { GetLpPoolBalanceChartDataResult, GetLpPoolPerformanceChartDataResult, RestClient, GetLpPoolDepthChartSimulationDataResult } from '@reyaxyz/common';
4
3
  export default class LpClient extends RestClient {
5
4
  getLpPools(): Promise<GetLpPoolsResult>;
6
5
  getLpPool(params: GetLpPoolParams): Promise<GetLpPoolResult>;
@@ -9,5 +8,6 @@ export default class LpClient extends RestClient {
9
8
  getLpPoolWithdrawBalance(params: GetLpPoolWithdrawBalanceParams): Promise<GetLpPoolWithdrawBalanceResult>;
10
9
  getLpPoolBalanceChartData(params: GetLpPoolBalanceChartDataParams): Promise<GetLpPoolBalanceChartDataResult>;
11
10
  getLpPoolPerformanceChartData(params: GetLpPoolPerformanceChartDataParams): Promise<GetLpPoolPerformanceChartDataResult>;
11
+ getLpPoolDepthChartSimulationData(params: getLpPoolDepthChartSimulationDataParams): Promise<GetLpPoolDepthChartSimulationDataResult>;
12
12
  }
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -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,EACpC,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mCAAmC,EACnC,+BAA+B,EAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,UAAU,MAAM,SAAS,CAAC;AAEjC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;IACxC,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKvC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAK5D,2BAA2B,CAC/B,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,iCAAiC,CAAC;IAQvC,cAAc,CAClB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAO1B,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,8BAA8B,CAAC;IAOpC,yBAAyB,CAC7B,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,+BAA+B,CAAC;IAQrC,6BAA6B,CACjC,MAAM,EAAE,mCAAmC,GAC1C,OAAO,CAAC,mCAAmC,CAAC;CAQhD"}
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,EACnC,UAAU,EACV,uCAAuC,EACxC,MAAM,iBAAiB,CAAC;AACzB,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,UAAU;IACxC,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKvC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAK5D,2BAA2B,CAC/B,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,iCAAiC,CAAC;IAQvC,cAAc,CAClB,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAO1B,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,8BAA8B,CAAC;IAOpC,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,4 +1,4 @@
1
- import { LpPoolEntity, LpPositionEntity, LpTransactionHistoryEntity, LpBalanceGranularity, LpWithdrawBalanceEntity } from '@reyaxyz/common';
1
+ import { LpPoolEntity, LpPositionEntity, LpTransactionHistoryEntity, LpBalanceGranularity, LpWithdrawBalanceEntity, MarketEntity } from '@reyaxyz/common';
2
2
  export type GetLpPoolsResult = LpPoolEntity[];
3
3
  export type GetLpPoolResult = LpPoolEntity;
4
4
  export type GetLpPoolParams = {
@@ -43,4 +43,8 @@ export type GetLpPoolPerformanceChartDataParams = {
43
43
  granularity: PerformanceGranularity;
44
44
  };
45
45
  };
46
+ export type getLpPoolDepthChartSimulationDataParams = {
47
+ poolId: LpPoolEntity['id'];
48
+ marketId: MarketEntity['id'];
49
+ };
46
50
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/lp/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GAAG,YAAY,EAAE,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,0BAA0B,EAAE,CAAC;AAE7E,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,EAAE,CAAC;AAEtD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,uBAAuB,CAAC;AAErE,MAAM,MAAM,iCAAiC,GAAG;IAC9C,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE;QACP,WAAW,EAAE,MAA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C,GAAG;IAC9C,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,oBAAoB,CAAC;KACnC,CAAC;CACH,CAAC;AAEF,oBAAY,sBAAsB;IAChC,UAAU,QAAY;IACtB,QAAQ,UAAiB;IACzB,OAAO,WAAsB;IAC7B,QAAQ,YAA0B;IAClC,SAAS,aAA2B;IACpC,QAAQ,cAA4B;CACrC;AAED,MAAM,MAAM,mCAAmC,GAAG;IAChD,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,sBAAsB,CAAC;KACrC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,uCAAuC,GAAG;IACpD,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC"}
@@ -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,EAC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,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.50.0",
3
+ "version": "0.52.0",
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.24.0",
37
- "axios": "^1.6.2",
36
+ "@reyaxyz/common": "0.26.0",
38
37
  "bignumber.js": "^9.1.2"
39
38
  },
40
39
  "packageManager": "pnpm@8.10.4",
41
- "gitHead": "e4aacf2b8695a831ec55bd9c1fa37a8ce94c6e2a"
40
+ "gitHead": "a01cbabdcba8466a729e2cfe39db143157919670"
42
41
  }
@@ -12,6 +12,7 @@ import DepositNewMASimulationClient from './modules/deposit-new-MA.simulation';
12
12
  import WithdrawMASimulationClient from './modules/withdraw-MA.simulation';
13
13
  import TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-between-MAs.simulation';
14
14
  import TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';
15
+ import DepthChartSimulationClient from './modules/depth-chart.simulation';
15
16
  import FundingRateClient from './modules/funding-rate';
16
17
 
17
18
  /**
@@ -31,6 +32,7 @@ export class ApiClient {
31
32
  private readonly _withdrawMASimulation: WithdrawMASimulationClient;
32
33
  private readonly _transferMarginBetweenMAsSimulation: TransferMarginBetweenMAsSimulationClient;
33
34
  private readonly _transferMAPoolSimulation: TransferMAPoolSimulationClient;
35
+ private readonly _depthSimulation: DepthChartSimulationClient;
34
36
  private readonly _tokens: TokensClient;
35
37
  private readonly _owner: OwnerClient;
36
38
 
@@ -58,6 +60,8 @@ export class ApiClient {
58
60
  this._transferMAPoolSimulation = new TransferMAPoolSimulationClient(
59
61
  this._editCollateralSimulation,
60
62
  );
63
+
64
+ this._depthSimulation = new DepthChartSimulationClient(this._lp);
61
65
  this._tokens = new TokensClient(ApiClient.config.apiEndpoint);
62
66
  this._owner = new OwnerClient(ApiClient.config.apiEndpoint);
63
67
  }
@@ -127,6 +131,17 @@ export class ApiClient {
127
131
  return ApiClient.getInstance()._fundingRateHistory;
128
132
  }
129
133
 
134
+ /**
135
+ * Retrieves the DepthChartSimulationClient instance used for depth simulation.
136
+ * This method provides access to the depth simulation client through the ApiClient.
137
+ * @returns {DepthChartSimulationClient} The DepthChartSimulationClient instance.
138
+ * @static
139
+ * @public
140
+ */
141
+ public static get depthSimulation(): DepthChartSimulationClient {
142
+ return ApiClient.getInstance()._depthSimulation;
143
+ }
144
+
130
145
  /**
131
146
  * Provides access to the EditCollateralSimulationClient instance.
132
147
  * This getter allows for interacting with edit collateral simulation functionalities.
@@ -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
  /**
@@ -0,0 +1,102 @@
1
+ import {
2
+ DepthChart,
3
+ DepthSimulationLoadDataParams,
4
+ SimulateDepthEntity,
5
+ } from './types';
6
+
7
+ import LpClient from '../lp';
8
+ import { DepthSimulationState } from '@reyaxyz/common';
9
+ import BigNumber from 'bignumber.js';
10
+
11
+ export default class DepthChartSimulationClient {
12
+ private poolId: number | null = null;
13
+ private marketId: number | null = null;
14
+ private loadedData: DepthSimulationState | null = null;
15
+ private lpClient: LpClient;
16
+ constructor(lpClient: LpClient) {
17
+ // Constructor added
18
+ this.lpClient = lpClient;
19
+ }
20
+
21
+ // Method to asynchronously load data based on marketId and poolId
22
+ async arm(params: DepthSimulationLoadDataParams): Promise<void> {
23
+ this.poolId = params.poolId;
24
+ this.marketId = params.marketId;
25
+
26
+ this.loadedData = await this.fetchPoolData(this.poolId, this.marketId);
27
+ }
28
+
29
+ private async fetchPoolData(
30
+ poolId: number,
31
+ marketId: number,
32
+ ): Promise<DepthSimulationState> {
33
+ return this.lpClient.getLpPoolDepthChartSimulationData({
34
+ poolId: poolId,
35
+ marketId: marketId,
36
+ });
37
+ }
38
+
39
+ simulate(step: number = 10, percentageChange: number = 30): DepthChart {
40
+ // step is in notional
41
+ if (!this.loadedData) {
42
+ throw new Error('Data not loaded. Call arm() first.');
43
+ }
44
+ const leftResults: SimulateDepthEntity[] = [];
45
+ const rightResults: SimulateDepthEntity[] = [];
46
+ for (let delta = 0; ; delta += step) {
47
+ const result = this.calculate(delta);
48
+ if (result.priceImpact >= percentageChange) break;
49
+ leftResults.push(result);
50
+ }
51
+
52
+ for (let delta = 0; ; delta -= step) {
53
+ const result = this.calculate(delta);
54
+ if (result.priceImpact >= percentageChange) break;
55
+ rightResults.push(result);
56
+ }
57
+
58
+ return {
59
+ leftChart: leftResults.reverse(),
60
+ rightChart: rightResults,
61
+ };
62
+ }
63
+
64
+ private calculate(delta: number): SimulateDepthEntity {
65
+ if (!this.loadedData) {
66
+ throw new Error('Data not loaded. Call arm() first.');
67
+ }
68
+
69
+ const n0Delta = BigNumber(this.loadedData.netExposure).plus(delta);
70
+ const maxExposure = n0Delta.gt(0)
71
+ ? BigNumber(this.loadedData.maxLongExposure)
72
+ : BigNumber(this.loadedData.maxShortExposure);
73
+
74
+ const currentPrice = BigNumber(this.loadedData.spotPrice).times(
75
+ BigNumber(1).minus(n0Delta.div(BigNumber(n0Delta).plus(maxExposure))),
76
+ );
77
+
78
+ const size = BigNumber(delta).div(this.loadedData.spotPrice).abs();
79
+
80
+ return {
81
+ price: currentPrice.toNumber(),
82
+ totalSize: size.toNumber(),
83
+ totalCost: size.times(currentPrice).toNumber(),
84
+ priceImpact: DepthChartSimulationClient.calculatePriceChangePercentage(
85
+ this.loadedData.spotPrice,
86
+ currentPrice.toNumber(),
87
+ ),
88
+ };
89
+ }
90
+
91
+ static calculatePriceChangePercentage(
92
+ price: number,
93
+ estimatedPrice: number,
94
+ ): number {
95
+ // Calculate the price difference
96
+ const priceDifference = estimatedPrice - price;
97
+
98
+ const absPriceDifference = Math.abs(priceDifference);
99
+ // Calculate the percentage change
100
+ return (absPriceDifference / Math.abs(price)) * 100;
101
+ }
102
+ }
@@ -0,0 +1,18 @@
1
+ import { LpPoolEntity, MarketEntity } from '@reyaxyz/common';
2
+
3
+ export type DepthSimulationLoadDataParams = {
4
+ poolId: LpPoolEntity['id'];
5
+ marketId: MarketEntity['id'];
6
+ };
7
+
8
+ export type SimulateDepthEntity = {
9
+ price: number;
10
+ totalSize: number;
11
+ totalCost: number;
12
+ priceImpact: number;
13
+ };
14
+
15
+ export type DepthChart = {
16
+ leftChart: SimulateDepthEntity[];
17
+ rightChart: SimulateDepthEntity[];
18
+ };
@@ -10,13 +10,14 @@ import {
10
10
  GetLpPoolWithdrawBalanceResult,
11
11
  GetLpPoolBalanceChartDataParams,
12
12
  GetLpPoolPerformanceChartDataParams,
13
+ getLpPoolDepthChartSimulationDataParams,
13
14
  } from './types';
14
15
  import {
15
- GetLpPoolPerformanceChartDataResult,
16
16
  GetLpPoolBalanceChartDataResult,
17
+ GetLpPoolPerformanceChartDataResult,
18
+ RestClient,
19
+ GetLpPoolDepthChartSimulationDataResult,
17
20
  } from '@reyaxyz/common';
18
- import RestClient from '../rest';
19
-
20
21
  export default class LpClient extends RestClient {
21
22
  async getLpPools(): Promise<GetLpPoolsResult> {
22
23
  const uri = '/api/lp-pools';
@@ -76,4 +77,13 @@ export default class LpClient extends RestClient {
76
77
  address: params.address,
77
78
  });
78
79
  }
80
+
81
+ async getLpPoolDepthChartSimulationData(
82
+ params: getLpPoolDepthChartSimulationDataParams,
83
+ ): Promise<GetLpPoolDepthChartSimulationDataResult> {
84
+ const uri = `/api/lp-pools/${params.poolId}/depth-simulation-data`;
85
+ return this.get(uri, {
86
+ marketId: params.marketId,
87
+ });
88
+ }
79
89
  }
@@ -4,6 +4,7 @@ import {
4
4
  LpTransactionHistoryEntity,
5
5
  LpBalanceGranularity,
6
6
  LpWithdrawBalanceEntity,
7
+ MarketEntity,
7
8
  } from '@reyaxyz/common';
8
9
 
9
10
  export type GetLpPoolsResult = LpPoolEntity[];
@@ -61,3 +62,8 @@ export type GetLpPoolPerformanceChartDataParams = {
61
62
  granularity: PerformanceGranularity;
62
63
  };
63
64
  };
65
+
66
+ export type getLpPoolDepthChartSimulationDataParams = {
67
+ poolId: LpPoolEntity['id'];
68
+ marketId: MarketEntity['id'];
69
+ };
@@ -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"]}