@reyaxyz/api-sdk 0.27.0 → 0.29.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 (101) hide show
  1. package/dist/clients/api-client.js +4 -2
  2. package/dist/clients/api-client.js.map +1 -1
  3. package/dist/clients/helpers/constants.js +6 -3
  4. package/dist/clients/helpers/constants.js.map +1 -1
  5. package/dist/clients/modules/{account.js → account/index.js} +2 -2
  6. package/dist/clients/modules/account/index.js.map +1 -0
  7. package/dist/clients/{helpers/trade.simulation.types.js → modules/account/types.js} +1 -1
  8. package/dist/clients/modules/account/types.js.map +1 -0
  9. package/dist/clients/modules/{lp.js → lp/index.js} +2 -2
  10. package/dist/clients/modules/lp/index.js.map +1 -0
  11. package/dist/clients/modules/lp/types.js +13 -0
  12. package/dist/clients/modules/lp/types.js.map +1 -0
  13. package/dist/clients/modules/{markets.js → markets/index.js} +2 -2
  14. package/dist/clients/modules/markets/index.js.map +1 -0
  15. package/dist/clients/modules/markets/types.js +3 -0
  16. package/dist/clients/modules/markets/types.js.map +1 -0
  17. package/dist/clients/modules/{rest.js → rest/index.js} +4 -4
  18. package/dist/clients/modules/rest/index.js.map +1 -0
  19. package/dist/clients/modules/{tokens.js → tokens/index.js} +2 -2
  20. package/dist/clients/modules/tokens/index.js.map +1 -0
  21. package/dist/clients/modules/tokens/types.js +3 -0
  22. package/dist/clients/modules/tokens/types.js.map +1 -0
  23. package/dist/clients/modules/{trade.simulation.js → trade.simulation/index.js} +10 -10
  24. package/dist/clients/modules/trade.simulation/index.js.map +1 -0
  25. package/dist/clients/modules/trade.simulation/types.js +3 -0
  26. package/dist/clients/modules/trade.simulation/types.js.map +1 -0
  27. package/dist/clients/types.js +4 -36
  28. package/dist/clients/types.js.map +1 -1
  29. package/dist/index.js +0 -2
  30. package/dist/index.js.map +1 -1
  31. package/dist/types/clients/api-client.d.ts.map +1 -1
  32. package/dist/types/clients/helpers/constants.d.ts +4 -3
  33. package/dist/types/clients/helpers/constants.d.ts.map +1 -1
  34. package/dist/types/clients/modules/{account.d.ts → account/index.d.ts} +4 -4
  35. package/dist/types/clients/modules/account/index.d.ts.map +1 -0
  36. package/dist/types/clients/modules/account/types.d.ts +47 -0
  37. package/dist/types/clients/modules/account/types.d.ts.map +1 -0
  38. package/dist/types/clients/modules/{lp.d.ts → lp/index.d.ts} +4 -3
  39. package/dist/types/clients/modules/lp/index.d.ts.map +1 -0
  40. package/dist/types/clients/modules/lp/types.d.ts +46 -0
  41. package/dist/types/clients/modules/lp/types.d.ts.map +1 -0
  42. package/dist/types/clients/modules/{markets.d.ts → markets/index.d.ts} +3 -3
  43. package/dist/types/clients/modules/markets/index.d.ts.map +1 -0
  44. package/dist/types/clients/modules/markets/types.d.ts +23 -0
  45. package/dist/types/clients/modules/markets/types.d.ts.map +1 -0
  46. package/dist/types/clients/modules/{rest.d.ts → rest/index.d.ts} +2 -2
  47. package/dist/types/clients/modules/rest/index.d.ts.map +1 -0
  48. package/dist/types/clients/modules/{tokens.d.ts → tokens/index.d.ts} +3 -3
  49. package/dist/types/clients/modules/tokens/index.d.ts.map +1 -0
  50. package/dist/types/clients/modules/tokens/types.d.ts +8 -0
  51. package/dist/types/clients/modules/tokens/types.d.ts.map +1 -0
  52. package/dist/types/clients/modules/{trade.simulation.d.ts → trade.simulation/index.d.ts} +3 -3
  53. package/dist/types/clients/modules/trade.simulation/index.d.ts.map +1 -0
  54. package/dist/types/clients/modules/trade.simulation/types.d.ts +19 -0
  55. package/dist/types/clients/modules/trade.simulation/types.d.ts.map +1 -0
  56. package/dist/types/clients/types.d.ts +1 -309
  57. package/dist/types/clients/types.d.ts.map +1 -1
  58. package/dist/types/index.d.ts +0 -2
  59. package/dist/types/index.d.ts.map +1 -1
  60. package/package.json +6 -7
  61. package/src/clients/api-client.ts +5 -8
  62. package/src/clients/helpers/constants.ts +7 -6
  63. package/src/clients/modules/{account.ts → account/index.ts} +3 -3
  64. package/src/clients/modules/account/types.ts +74 -0
  65. package/src/clients/modules/{lp.ts → lp/index.ts} +5 -3
  66. package/src/clients/modules/lp/types.ts +62 -0
  67. package/src/clients/modules/{markets.ts → markets/index.ts} +2 -2
  68. package/src/clients/modules/markets/types.ts +33 -0
  69. package/src/clients/modules/{rest.ts → rest/index.ts} +8 -3
  70. package/src/clients/modules/{tokens.ts → tokens/index.ts} +2 -2
  71. package/src/clients/modules/tokens/types.ts +9 -0
  72. package/src/clients/modules/{trade.simulation.ts → trade.simulation/index.ts} +3 -4
  73. package/src/clients/modules/trade.simulation/types.ts +21 -0
  74. package/src/clients/types.ts +16 -400
  75. package/src/index.ts +0 -2
  76. package/dist/clients/helpers/exposure.calculator.js +0 -448
  77. package/dist/clients/helpers/exposure.calculator.js.map +0 -1
  78. package/dist/clients/helpers/number.js +0 -13
  79. package/dist/clients/helpers/number.js.map +0 -1
  80. package/dist/clients/helpers/trade.simulation.types.js.map +0 -1
  81. package/dist/clients/modules/account.js.map +0 -1
  82. package/dist/clients/modules/lp.js.map +0 -1
  83. package/dist/clients/modules/markets.js.map +0 -1
  84. package/dist/clients/modules/rest.js.map +0 -1
  85. package/dist/clients/modules/tokens.js.map +0 -1
  86. package/dist/clients/modules/trade.simulation.js.map +0 -1
  87. package/dist/types/clients/helpers/exposure.calculator.d.ts +0 -58
  88. package/dist/types/clients/helpers/exposure.calculator.d.ts.map +0 -1
  89. package/dist/types/clients/helpers/number.d.ts +0 -3
  90. package/dist/types/clients/helpers/number.d.ts.map +0 -1
  91. package/dist/types/clients/helpers/trade.simulation.types.d.ts +0 -113
  92. package/dist/types/clients/helpers/trade.simulation.types.d.ts.map +0 -1
  93. package/dist/types/clients/modules/account.d.ts.map +0 -1
  94. package/dist/types/clients/modules/lp.d.ts.map +0 -1
  95. package/dist/types/clients/modules/markets.d.ts.map +0 -1
  96. package/dist/types/clients/modules/rest.d.ts.map +0 -1
  97. package/dist/types/clients/modules/tokens.d.ts.map +0 -1
  98. package/dist/types/clients/modules/trade.simulation.d.ts.map +0 -1
  99. package/src/clients/helpers/exposure.calculator.ts +0 -799
  100. package/src/clients/helpers/number.ts +0 -8
  101. package/src/clients/helpers/trade.simulation.types.ts +0 -125
@@ -0,0 +1,46 @@
1
+ import { LpPoolEntity, LpPositionEntity, LpTransactionHistoryEntity, BalanceGranularity } from '@reyaxyz/common';
2
+ export type GetLpPoolsResult = LpPoolEntity[];
3
+ export type GetLpPoolResult = LpPoolEntity;
4
+ export type GetLpPoolParams = {
5
+ id: LpPoolEntity['id'];
6
+ };
7
+ export type GetLpPoolTransactionHistoryResult = LpTransactionHistoryEntity[];
8
+ export type GetLpPositionsParams = {
9
+ id: LpPoolEntity['id'];
10
+ address: string;
11
+ };
12
+ export type GetLpPositionsResult = LpPositionEntity[];
13
+ export type GetLpPoolWithdrawBalanceParams = {
14
+ id: LpPoolEntity['id'];
15
+ address: string;
16
+ };
17
+ export type GetLpPoolWithdrawBalanceResult = number;
18
+ export type GetLpPoolTransactionHistoryParams = {
19
+ id: LpPoolEntity['id'];
20
+ address: string;
21
+ limit?: number;
22
+ };
23
+ export type GetLpPoolBalanceChartDataParams = {
24
+ poolId: LpPoolEntity['id'];
25
+ filters: {
26
+ timeframeMs: number;
27
+ granularity: BalanceGranularity;
28
+ };
29
+ };
30
+ export declare enum PerformanceGranularity {
31
+ ONE_MINUTE = 60000,
32
+ ONE_HOUR = 3600000,
33
+ ONE_DAY = 86400000,
34
+ ONE_WEEK = 604800000,
35
+ ONE_MONTH = 2592000000,
36
+ ONE_YEAR = 31536000000
37
+ }
38
+ export type GetLpPoolPerformanceChartDataParams = {
39
+ poolId: LpPoolEntity['id'];
40
+ address: string;
41
+ filters: {
42
+ timeframeMs: number;
43
+ granularity: PerformanceGranularity;
44
+ };
45
+ };
46
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/lp/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,E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E,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,sBAAsB,CAAC;KACrC,CAAC;CACH,CAAC"}
@@ -1,5 +1,5 @@
1
- import { GetCandlesParams, GetMarketParams, GetMarketResult, GetMarketsResult, GetMarketTradingHistoryParams, GetTradingHistoryResult, MarketCandlesResponse } from '../types';
2
- import RestClient from './rest';
1
+ import { GetCandlesParams, GetMarketParams, GetMarketResult, GetMarketsResult, GetMarketTradingHistoryParams, GetTradingHistoryResult, MarketCandlesResponse } from './types';
2
+ import RestClient from '../rest';
3
3
  export default class MarketsClient extends RestClient {
4
4
  /**
5
5
  * Asynchronously retrieves market data from the API.
@@ -36,4 +36,4 @@ export default class MarketsClient extends RestClient {
36
36
  getMarketCandles(params: GetCandlesParams): Promise<MarketCandlesResponse>;
37
37
  getMarketTradingHistory(params: GetMarketTradingHistoryParams): Promise<GetTradingHistoryResult>;
38
38
  }
39
- //# sourceMappingURL=markets.d.ts.map
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/markets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AACjB,OAAO,UAAU,MAAM,SAAS,CAAC;AAEjC,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;CAOpC"}
@@ -0,0 +1,23 @@
1
+ import { CandlesResolution, MarketEntity, TradingHistoryEntity, Candle } from '@reyaxyz/common';
2
+ export type GetMarketsResult = MarketEntity[];
3
+ export type GetMarketResult = MarketEntity;
4
+ export type GetMarketParams = {
5
+ id: MarketEntity['id'];
6
+ };
7
+ export type GetCandlesParams = {
8
+ marketId: MarketEntity['id'];
9
+ resolution: CandlesResolution;
10
+ fromISO?: string | null;
11
+ toISO?: string | null;
12
+ limit?: number | null;
13
+ };
14
+ export type GetMarketTradingHistoryParams = {
15
+ marketId: number;
16
+ limit?: number;
17
+ fromTimestampMillisecondsUTC?: number;
18
+ };
19
+ export type GetTradingHistoryResult = TradingHistoryEntity[];
20
+ export interface MarketCandlesResponse {
21
+ candles: Candle[];
22
+ }
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/markets/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,MAAM,EACP,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,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,EAAE,CAAC;AAE7D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB"}
@@ -1,4 +1,4 @@
1
- import { Response, ResponseData } from '../lib/axios';
1
+ import { Response, ResponseData } from '../../lib/axios';
2
2
  export default class RestClient {
3
3
  readonly host: string;
4
4
  readonly apiTimeout: number;
@@ -6,4 +6,4 @@ export default class RestClient {
6
6
  get(requestPath: string, params?: NonNullable<unknown>): Promise<ResponseData>;
7
7
  post(requestPath: string, params?: NonNullable<unknown>, body?: unknown | null, headers?: NonNullable<unknown>): Promise<Response>;
8
8
  }
9
- //# sourceMappingURL=rest.d.ts.map
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/rest/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,QAAQ,EAER,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,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,CACP,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,WAAW,CAAC,OAAO,CAAM,GAChC,OAAO,CAAC,YAAY,CAAC;IAMlB,IAAI,CACR,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;CAIrB"}
@@ -1,6 +1,6 @@
1
- import { GetAllowedTokensParams, GetAllowedTokenResult } from '../types';
2
- import RestClient from './rest';
1
+ import { GetAllowedTokensParams, GetAllowedTokenResult } from './types';
2
+ import RestClient from '../rest';
3
3
  export default class TokensClient extends RestClient {
4
4
  getAllowedTokens(params: GetAllowedTokensParams): Promise<GetAllowedTokenResult>;
5
5
  }
6
- //# sourceMappingURL=tokens.d.ts.map
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,8 @@
1
+ import { SupportedChainId, TokenEntity } from '@reyaxyz/common';
2
+ export type GetAllowedTokensParams = {
3
+ chainId: SupportedChainId;
4
+ };
5
+ export type GetAllowedTokenResult = {
6
+ tokens: TokenEntity[];
7
+ };
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/tokens/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { SimulateTradeEntity, TradeSimulationLoadDataParams, TradeSimulationSimulateParams } from '../types';
2
- import AccountClient from './account';
1
+ import { SimulateTradeEntity, TradeSimulationLoadDataParams, TradeSimulationSimulateParams } from './types';
2
+ import AccountClient from '../account';
3
3
  export default class TradeSimulationClient {
4
4
  private marketId;
5
5
  private accountId;
@@ -10,4 +10,4 @@ export default class TradeSimulationClient {
10
10
  private fetchMarketData;
11
11
  simulate(params: TradeSimulationSimulateParams): SimulateTradeEntity;
12
12
  }
13
- //# sourceMappingURL=trade.simulation.d.ts.map
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/trade.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,MAAM,YAAY,CAAC;AAIvC,MAAM,CAAC,OAAO,OAAO,qBAAqB;IACxC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,aAAa,CAAgB;gBACzB,aAAa,EAAE,aAAa;IAMlC,GAAG,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;YAOjD,eAAe;IAW7B,QAAQ,CAAC,MAAM,EAAE,6BAA6B,GAAG,mBAAmB;CA2GrE"}
@@ -0,0 +1,19 @@
1
+ import { MarginAccountEntity, MarketEntity } from '@reyaxyz/common';
2
+ export type TradeSimulationLoadDataParams = {
3
+ marketId: MarketEntity['id'];
4
+ marginAccountId: MarginAccountEntity['id'];
5
+ };
6
+ export type TradeSimulationSimulateParams = {
7
+ amount: number;
8
+ };
9
+ export type SimulateTradeEntity = {
10
+ liquidationPrice: number;
11
+ fees: number;
12
+ estimatedPrice: number;
13
+ estimatedSlippage: number;
14
+ imr: number;
15
+ impliedLeverage: number;
16
+ marginRatio: MarginAccountEntity['marginRatioPercentage'];
17
+ marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
18
+ };
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/trade.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpE,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;CAC7D,CAAC"}
@@ -1,310 +1,2 @@
1
- export declare enum CandlesResolution {
2
- ONE_MINUTE = "1MIN",
3
- FIVE_MINUTES = "5MINS",
4
- FIFTEEN_MINUTES = "15MINS",
5
- THIRTY_MINUTES = "30MINS",
6
- ONE_HOUR = "1HOUR",
7
- FOUR_HOURS = "4HOURS",
8
- ONE_DAY = "1DAY"
9
- }
10
- export interface Candle {
11
- id: string;
12
- startedAt: string;
13
- ticker: string;
14
- resolution: CandlesResolution;
15
- low: string;
16
- high: string;
17
- open: string;
18
- close: string;
19
- baseTokenVolume: string;
20
- usdVolume: string;
21
- trades: number;
22
- startingOpenInterest: string;
23
- }
24
- export interface MarketCandlesResponse {
25
- candles: Candle[];
26
- }
27
- export type MarketOrderInfo = {
28
- counterpartyAccountIds: number[];
29
- exchangeId: number;
30
- };
31
- export type MarketEntity = {
32
- id: number;
33
- ticker: string;
34
- underlyingAsset: string;
35
- quoteToken: string;
36
- markPrice: number;
37
- isActive: boolean;
38
- maxLeverage: number;
39
- volume24H: number;
40
- priceChange24H: number;
41
- priceChange24HPercentage: number;
42
- openInterest: number;
43
- fundingRate: number;
44
- description: string;
45
- orderInfo: MarketOrderInfo;
46
- tickSizeDecimals: number;
47
- chainId: SupportedChainId;
48
- };
49
- export type GetMarketsResult = MarketEntity[];
50
- export type GetMarketResult = MarketEntity;
51
- export type GetMarketParams = {
52
- id: MarketEntity['id'];
53
- };
54
- export type GetCandlesParams = {
55
- marketId: MarketEntity['id'];
56
- resolution: CandlesResolution;
57
- fromISO?: string | null;
58
- toISO?: string | null;
59
- limit?: number | null;
60
- };
61
- export type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';
62
- export type Side = 'long' | 'short';
63
- export type GetMarginAccountsParams = {
64
- address: string;
65
- limit?: number;
66
- };
67
- export type GetMarginAccountParams = {
68
- address: string;
69
- marginAccountId: MarginAccountEntity['id'];
70
- };
71
- export type GetPositionsForMarginAccountParams = {
72
- address: string;
73
- marginAccountId: MarginAccountEntity['id'];
74
- limit?: number;
75
- };
76
- export type MarginAccountEntity = {
77
- id: number;
78
- name: string;
79
- marginRatioHealth: 'danger' | 'healthy' | 'warning';
80
- marginRatioPercentage: number;
81
- totalBalance: number;
82
- totalBalanceUnderlyingAsset: string;
83
- collaterals: {
84
- token: string;
85
- percentage: number;
86
- balance: number;
87
- balanceRUSD: number;
88
- }[];
89
- };
90
- export type GetMarginAccountsResult = MarginAccountEntity[];
91
- export type GetMarginAccountResult = MarginAccountEntity;
92
- export type PositionEntity = {
93
- id: number;
94
- side: Side;
95
- size: number;
96
- base: number;
97
- price: number;
98
- markPrice: number;
99
- orderStatus: Status;
100
- realisedPnl?: number | null;
101
- unrealisedPnl?: number | null;
102
- liquidationPrice: number;
103
- fundingRate: number;
104
- market: MarketEntity;
105
- date: Date;
106
- };
107
- export type GetPositionsForMarginAccountResult = {
108
- positions: PositionEntity[];
109
- totalUnrealizedPNL: number;
110
- };
111
- export type GetMarketTradingHistoryParams = {
112
- marketId: number;
113
- limit?: number;
114
- fromTimestampMillisecondsUTC?: number;
115
- };
116
- export type TradingHistoryEntity = {
117
- id: number;
118
- price: number;
119
- priceUnderlyingToken: string;
120
- size: number;
121
- sizeUnderlyingToken: string;
122
- timestampMillisecondsUTC: number;
123
- };
124
- export type GetTradingHistoryResult = TradingHistoryEntity[];
125
- export type GetPositionsHistoryForMarginAccountParams = {
126
- address: string;
127
- marginAccountId: MarginAccountEntity['id'];
128
- limit?: number;
129
- };
130
- export type OrderType = 'market';
131
- export type PositionHistoryType = 'long-trade' | 'short-trade' | 'long-liquidation' | 'short-liquidation';
132
- export type PositionHistoryEntity = {
133
- id: number;
134
- action: PositionHistoryType;
135
- orderType: OrderType;
136
- size: number;
137
- executionPrice: number;
138
- realisedPnl?: number | null;
139
- fees: number;
140
- timestamp: number;
141
- market: MarketEntity;
142
- };
143
- export type GetPositionsHistoryForMarginAccountResult = PositionHistoryEntity[];
144
- export type GetMaxOrderSizeAvailableParams = {
145
- marketId: MarketEntity['id'];
146
- marginAccountId: MarginAccountEntity['id'];
147
- direction: 'long' | 'short';
148
- };
149
- export type GetMaxOrderSizeAvailableResult = number;
150
- export type SimulateTradeEntity = {
151
- liquidationPrice: number;
152
- fees: number;
153
- estimatedPrice: number;
154
- estimatedSlippage: number;
155
- imr: number;
156
- impliedLeverage: number;
157
- marginRatio: MarginAccountEntity['marginRatioPercentage'];
158
- marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
159
- };
160
- export type TradeSimulationLoadDataParams = {
161
- marketId: MarketEntity['id'];
162
- marginAccountId: MarginAccountEntity['id'];
163
- };
164
- export type TradeSimulationSimulateParams = {
165
- amount: number;
166
- };
167
- export declare enum SupportedChainId {
168
- polygonMumbai = 80001,
169
- reyaCronos = 1729
170
- }
171
- export type LpPoolEntity = {
172
- id: number;
173
- name: string;
174
- description: string;
175
- longDescription: string;
176
- readMoreLink: string;
177
- currentAPY: number;
178
- balanceSupplied?: number | null;
179
- apyChange24H: number;
180
- tokenAddress: string;
181
- token: string;
182
- allowedChainsForLiquidity: number[];
183
- chainId: SupportedChainId;
184
- };
185
- export type GetLpPoolsResult = LpPoolEntity[];
186
- export type GetLpPoolResult = LpPoolEntity;
187
- export type GetLpPoolParams = {
188
- id: LpPoolEntity['id'];
189
- };
190
- export type TransactionHistoryType = 'deposit' | 'withdrawal';
191
- export type LpTransactionHistoryEntity = {
192
- id: number;
193
- type: TransactionHistoryType;
194
- token: string;
195
- amount: number;
196
- transactionHash: string;
197
- timestamp: number;
198
- };
199
- export type GetLpPoolTransactionHistoryParams = {
200
- id: LpPoolEntity['id'];
201
- address: string;
202
- limit?: number;
203
- };
204
- export type GetLpPoolTransactionHistoryResult = LpTransactionHistoryEntity[];
205
- export type GetLpPositionsParams = {
206
- id: LpPoolEntity['id'];
207
- address: string;
208
- };
209
- export type LpPositionEntity = {
210
- id: number;
211
- deposited: number;
212
- currentBalance: number;
213
- pnl: number;
214
- fundingRate: number;
215
- lpPool: LpPoolEntity;
216
- };
217
- export type GetLpPositionsResult = LpPositionEntity[];
218
- export type GetLpPoolWithdrawBalanceParams = {
219
- id: LpPoolEntity['id'];
220
- address: string;
221
- };
222
- export type GetLpPoolWithdrawBalanceResult = number;
223
- export type GetTransactionSimulationInitialDataParams = {
224
- marketId: MarketEntity['id'];
225
- marginAccountId: MarginAccountEntity['id'];
226
- };
227
- export type GetMarginAccountTransactionHistoryParams = {
228
- marginAccountId: MarginAccountEntity['id'];
229
- limit?: number;
230
- };
231
- export type MarginAccountTransactionHistoryType = 'deposit' | 'withdrawal' | 'transfer' | 'auto_exchange';
232
- export type MarginAccountTransactionHistoryEntity = {
233
- id: number;
234
- type: MarginAccountTransactionHistoryType;
235
- token: string;
236
- amount: number;
237
- transactionHash: string;
238
- timestamp: number;
239
- };
240
- export type GetMarginAccountTransactionHistoryResult = MarginAccountTransactionHistoryEntity[];
241
- export declare enum BalanceGranularity {
242
- ONE_MINUTE = 60000,
243
- ONE_HOUR = 3600000,
244
- ONE_DAY = 86400000,
245
- ONE_WEEK = 604800000,
246
- ONE_MONTH = 2592000000,
247
- ONE_YEAR = 31536000000
248
- }
249
- export type GetLpPoolBalanceChartDataParams = {
250
- poolId: LpPoolEntity['id'];
251
- filters: {
252
- timeframeMs: number;
253
- granularity: BalanceGranularity;
254
- };
255
- };
256
- export type GetLpPoolBalanceChartDataResult = {
257
- data: {
258
- timestampInMs: number;
259
- value: number;
260
- }[];
261
- tvl: number;
262
- tvlChangePercentage: number;
263
- apy: number;
264
- apyChangePercentage: number;
265
- };
266
- export type GetLpPoolPerformanceChartDataResult = {
267
- capitalInvestedData: {
268
- timestampInMs: number;
269
- value: number;
270
- }[];
271
- balanceData: {
272
- timestampInMs: number;
273
- value: number;
274
- }[];
275
- balance: number;
276
- balanceChangePercentage: number;
277
- capitalInvested: number;
278
- capitalInvestedChangePercentage: number;
279
- };
280
- export declare enum PerformanceGranularity {
281
- ONE_MINUTE = 60000,
282
- ONE_HOUR = 3600000,
283
- ONE_DAY = 86400000,
284
- ONE_WEEK = 604800000,
285
- ONE_MONTH = 2592000000,
286
- ONE_YEAR = 31536000000
287
- }
288
- export type GetLpPoolPerformanceChartDataParams = {
289
- poolId: LpPoolEntity['id'];
290
- address: string;
291
- filters: {
292
- timeframeMs: number;
293
- granularity: PerformanceGranularity;
294
- };
295
- };
296
- export type GetMaxWithdrawBalanceForAccountParams = {
297
- marginAccountId: MarginAccountEntity['id'];
298
- tokenAddress: string;
299
- };
300
- export type GetMaxWithdrawBalanceForAccountResult = number;
301
- export type GetAllowedTokensParams = {
302
- chainId: number;
303
- };
304
- export type GetAllowedTokenResult = {
305
- tokens: {
306
- id: string;
307
- address: string;
308
- }[];
309
- };
1
+ export { Candle, CandlesResolution, MarketEntity, LpTransactionHistoryEntity, TradingHistoryEntity, PositionHistoryEntity, PositionEntity, TransactionHistoryType, MarginAccountTransactionHistoryType, MarginAccountTransactionHistoryEntity, MarginAccountEntity, LpPositionEntity, LpPoolEntity, } from '@reyaxyz/common';
310
2
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,UAAU,SAAS;IACnB,YAAY,UAAU;IACtB,eAAe,WAAW;IAC1B,cAAc,WAAW;IACzB,QAAQ,UAAU;IAClB,UAAU,WAAW;IACrB,OAAO,SAAS;CACjB;AAGD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,iBAAiB,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAID,MAAM,MAAM,eAAe,GAAG;IAC5B,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAA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C,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,GACb,MAAM,iBAAiB,CAAC"}
@@ -1,5 +1,3 @@
1
1
  export { ApiClient } from './clients/api-client';
2
2
  export * from './clients/types';
3
- export * from './clients/helpers/exposure.calculator';
4
- export * from './clients/helpers/trade.simulation.types';
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,uCAAuC,CAAC;AACtD,cAAc,0CAA0C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,cAAc,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/api-sdk",
3
- "version": "0.27.0",
3
+ "version": "0.29.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -24,20 +24,19 @@
24
24
  "ts:circular-check": "dpdm --no-output --no-tree --no-warning --exit-code circular:1 -T src/index.ts",
25
25
  "ts:check": "pnpm ts:check-types && pnpm ts:circular-check",
26
26
  "lint:check": "eslint '{src,demo,tests}/**/*.{ts,tsx}'",
27
- "prettier:check": "npx prettier --loglevel silent --check './{src,demo,tests}/**/*.{ts,tsx}'",
27
+ "prettier:check": "npx prettier --log-level silent --check './{src,demo,tests}/**/*.{ts,tsx}'",
28
28
  "code-quality:check": "npx concurrently 'pnpm ts:check' 'pnpm prettier:check' 'pnpm lint:check --quiet'",
29
29
  "lint:fix": "npx eslint --fix '{src,demo,tests}/**/*.{ts,tsx}'",
30
- "prettier:fix": "npx prettier --loglevel silent --write './{src,demo,tests}/**/*.{ts,tsx}'",
30
+ "prettier:fix": "npx prettier --log-level silent --write './{src,demo,tests}/**/*.{ts,tsx}'",
31
31
  "test": "npx jest --silent",
32
32
  "test:coverage": "npx jest test --coverage",
33
33
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
34
34
  },
35
35
  "dependencies": {
36
- "@types/lodash": "^4.14.202",
36
+ "@reyaxyz/common": "0.1.0",
37
37
  "axios": "^1.6.2",
38
- "bignumber.js": "^9.1.2",
39
- "lodash": "^4.17.21"
38
+ "bignumber.js": "^9.1.2"
40
39
  },
41
40
  "packageManager": "pnpm@8.10.4",
42
- "gitHead": "4f23d7ea33e5b0cfeead1661fbbd1dc20c702551"
41
+ "gitHead": "5019db70f29333faa41f046769a55f9d320b5f7f"
43
42
  }
@@ -1,9 +1,4 @@
1
- import {
2
- ServiceConfig,
3
- API_TIMEOUT,
4
- API_TESTNET,
5
- API_PRODUCTION,
6
- } from './helpers/constants';
1
+ import { ServiceConfig, API_TIMEOUT, API_URLS } from './helpers/constants';
7
2
  import MarketsClient from './modules/markets';
8
3
  import AccountClient from './modules/account';
9
4
  import TradeSimulationClient from './modules/trade.simulation';
@@ -16,7 +11,7 @@ import TokensClient from './modules/tokens';
16
11
  export class ApiClient {
17
12
  private static instance: ApiClient;
18
13
  private static config: ServiceConfig = {
19
- production: true, // default value
14
+ environment: 'test', // default value
20
15
  timeout: API_TIMEOUT, // default value, e.g., 5000 milliseconds
21
16
  };
22
17
  private readonly apiEndpoint: string;
@@ -27,7 +22,9 @@ export class ApiClient {
27
22
  private readonly _tokens: TokensClient;
28
23
 
29
24
  private constructor(config: ServiceConfig) {
30
- this.apiEndpoint = config.production ? API_PRODUCTION : API_TESTNET;
25
+ this.apiEndpoint = config.environment
26
+ ? API_URLS[config.environment]
27
+ : API_URLS['test'];
31
28
  ApiClient.config = { ...ApiClient.config, ...config };
32
29
  this._markets = new MarketsClient(this.apiEndpoint);
33
30
  this._account = new AccountClient(this.apiEndpoint);
@@ -1,12 +1,13 @@
1
1
  export const API_TIMEOUT: number = 2500;
2
2
 
3
+ type ServiceEnvironment = 'production' | 'test' | 'local';
3
4
  export interface ServiceConfig {
4
- production?: boolean; // Base URL for the REST API
5
+ environment?: ServiceEnvironment; // Configuration for SDK, such as base URL for the REST API
5
6
  timeout?: number; // Optional timeout for API requests
6
7
  }
7
8
 
8
- export const API_PRODUCTION: string =
9
- 'https://m8mjgmqmte.eu-central-1.awsapprunner.com';
10
-
11
- export const API_TESTNET: string =
12
- 'https://m8mjgmqmte.eu-central-1.awsapprunner.com';
9
+ export const API_URLS: Record<ServiceEnvironment, string> = {
10
+ production: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',
11
+ test: 'https://m8mjgmqmte.eu-central-1.awsapprunner.com',
12
+ local: 'http://localhost:3000',
13
+ };
@@ -14,9 +14,9 @@ import {
14
14
  GetPositionsHistoryForMarginAccountParams,
15
15
  GetPositionsHistoryForMarginAccountResult,
16
16
  GetTransactionSimulationInitialDataParams,
17
- } from '../types';
18
- import RestClient from './rest';
19
- import { TradeSimulationState } from '../helpers/trade.simulation.types';
17
+ } from './types';
18
+ import RestClient from '../rest';
19
+ import { TradeSimulationState } from '@reyaxyz/common';
20
20
 
21
21
  export default class AccountClient extends RestClient {
22
22
  /**