@reyaxyz/api-sdk 0.27.0 → 0.28.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 (92) hide show
  1. package/dist/clients/modules/{account.js → account/index.js} +2 -2
  2. package/dist/clients/modules/account/index.js.map +1 -0
  3. package/dist/clients/{helpers/trade.simulation.types.js → modules/account/types.js} +1 -1
  4. package/dist/clients/modules/account/types.js.map +1 -0
  5. package/dist/clients/modules/{lp.js → lp/index.js} +2 -2
  6. package/dist/clients/modules/lp/index.js.map +1 -0
  7. package/dist/clients/modules/lp/types.js +13 -0
  8. package/dist/clients/modules/lp/types.js.map +1 -0
  9. package/dist/clients/modules/{markets.js → markets/index.js} +2 -2
  10. package/dist/clients/modules/markets/index.js.map +1 -0
  11. package/dist/clients/modules/markets/types.js +3 -0
  12. package/dist/clients/modules/markets/types.js.map +1 -0
  13. package/dist/clients/modules/{rest.js → rest/index.js} +4 -4
  14. package/dist/clients/modules/rest/index.js.map +1 -0
  15. package/dist/clients/modules/{tokens.js → tokens/index.js} +2 -2
  16. package/dist/clients/modules/tokens/index.js.map +1 -0
  17. package/dist/clients/modules/tokens/types.js +3 -0
  18. package/dist/clients/modules/tokens/types.js.map +1 -0
  19. package/dist/clients/modules/{trade.simulation.js → trade.simulation/index.js} +10 -10
  20. package/dist/clients/modules/trade.simulation/index.js.map +1 -0
  21. package/dist/clients/modules/trade.simulation/types.js +3 -0
  22. package/dist/clients/modules/trade.simulation/types.js.map +1 -0
  23. package/dist/clients/types.js +4 -36
  24. package/dist/clients/types.js.map +1 -1
  25. package/dist/index.js +0 -2
  26. package/dist/index.js.map +1 -1
  27. package/dist/types/clients/modules/{account.d.ts → account/index.d.ts} +4 -4
  28. package/dist/types/clients/modules/account/index.d.ts.map +1 -0
  29. package/dist/types/clients/modules/account/types.d.ts +47 -0
  30. package/dist/types/clients/modules/account/types.d.ts.map +1 -0
  31. package/dist/types/clients/modules/{lp.d.ts → lp/index.d.ts} +4 -3
  32. package/dist/types/clients/modules/lp/index.d.ts.map +1 -0
  33. package/dist/types/clients/modules/lp/types.d.ts +46 -0
  34. package/dist/types/clients/modules/lp/types.d.ts.map +1 -0
  35. package/dist/types/clients/modules/{markets.d.ts → markets/index.d.ts} +3 -3
  36. package/dist/types/clients/modules/markets/index.d.ts.map +1 -0
  37. package/dist/types/clients/modules/markets/types.d.ts +23 -0
  38. package/dist/types/clients/modules/markets/types.d.ts.map +1 -0
  39. package/dist/types/clients/modules/{rest.d.ts → rest/index.d.ts} +2 -2
  40. package/dist/types/clients/modules/rest/index.d.ts.map +1 -0
  41. package/dist/types/clients/modules/{tokens.d.ts → tokens/index.d.ts} +3 -3
  42. package/dist/types/clients/modules/tokens/index.d.ts.map +1 -0
  43. package/dist/types/clients/modules/tokens/types.d.ts +8 -0
  44. package/dist/types/clients/modules/tokens/types.d.ts.map +1 -0
  45. package/dist/types/clients/modules/{trade.simulation.d.ts → trade.simulation/index.d.ts} +3 -3
  46. package/dist/types/clients/modules/trade.simulation/index.d.ts.map +1 -0
  47. package/dist/types/clients/modules/trade.simulation/types.d.ts +19 -0
  48. package/dist/types/clients/modules/trade.simulation/types.d.ts.map +1 -0
  49. package/dist/types/clients/types.d.ts +1 -309
  50. package/dist/types/clients/types.d.ts.map +1 -1
  51. package/dist/types/index.d.ts +0 -2
  52. package/dist/types/index.d.ts.map +1 -1
  53. package/package.json +6 -7
  54. package/src/clients/modules/{account.ts → account/index.ts} +3 -3
  55. package/src/clients/modules/account/types.ts +74 -0
  56. package/src/clients/modules/{lp.ts → lp/index.ts} +5 -3
  57. package/src/clients/modules/lp/types.ts +62 -0
  58. package/src/clients/modules/{markets.ts → markets/index.ts} +2 -2
  59. package/src/clients/modules/markets/types.ts +33 -0
  60. package/src/clients/modules/{rest.ts → rest/index.ts} +8 -3
  61. package/src/clients/modules/{tokens.ts → tokens/index.ts} +2 -2
  62. package/src/clients/modules/tokens/types.ts +9 -0
  63. package/src/clients/modules/{trade.simulation.ts → trade.simulation/index.ts} +3 -4
  64. package/src/clients/modules/trade.simulation/types.ts +21 -0
  65. package/src/clients/types.ts +16 -400
  66. package/src/index.ts +0 -2
  67. package/dist/clients/helpers/exposure.calculator.js +0 -448
  68. package/dist/clients/helpers/exposure.calculator.js.map +0 -1
  69. package/dist/clients/helpers/number.js +0 -13
  70. package/dist/clients/helpers/number.js.map +0 -1
  71. package/dist/clients/helpers/trade.simulation.types.js.map +0 -1
  72. package/dist/clients/modules/account.js.map +0 -1
  73. package/dist/clients/modules/lp.js.map +0 -1
  74. package/dist/clients/modules/markets.js.map +0 -1
  75. package/dist/clients/modules/rest.js.map +0 -1
  76. package/dist/clients/modules/tokens.js.map +0 -1
  77. package/dist/clients/modules/trade.simulation.js.map +0 -1
  78. package/dist/types/clients/helpers/exposure.calculator.d.ts +0 -58
  79. package/dist/types/clients/helpers/exposure.calculator.d.ts.map +0 -1
  80. package/dist/types/clients/helpers/number.d.ts +0 -3
  81. package/dist/types/clients/helpers/number.d.ts.map +0 -1
  82. package/dist/types/clients/helpers/trade.simulation.types.d.ts +0 -113
  83. package/dist/types/clients/helpers/trade.simulation.types.d.ts.map +0 -1
  84. package/dist/types/clients/modules/account.d.ts.map +0 -1
  85. package/dist/types/clients/modules/lp.d.ts.map +0 -1
  86. package/dist/types/clients/modules/markets.d.ts.map +0 -1
  87. package/dist/types/clients/modules/rest.d.ts.map +0 -1
  88. package/dist/types/clients/modules/tokens.d.ts.map +0 -1
  89. package/dist/types/clients/modules/trade.simulation.d.ts.map +0 -1
  90. package/src/clients/helpers/exposure.calculator.ts +0 -799
  91. package/src/clients/helpers/number.ts +0 -8
  92. package/src/clients/helpers/trade.simulation.types.ts +0 -125
@@ -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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MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE;QACN,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;CACL,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,YAAY,EACZ,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,mCAAmC,EACnC,qCAAqC,EACrC,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.28.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": "d62614e48bb530169bacfc0e359a5cf63d73a86b"
43
42
  }
@@ -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
  /**
@@ -0,0 +1,74 @@
1
+ import {
2
+ MarginAccountEntity,
3
+ MarginAccountTransactionHistoryEntity,
4
+ MarketEntity,
5
+ PositionEntity,
6
+ PositionHistoryEntity,
7
+ } from '@reyaxyz/common';
8
+
9
+ export type GetMarginAccountsParams = {
10
+ address: string;
11
+ limit?: number;
12
+ };
13
+
14
+ export type GetMarginAccountParams = {
15
+ address: string;
16
+ marginAccountId: MarginAccountEntity['id'];
17
+ };
18
+
19
+ export type GetPositionsForMarginAccountParams = {
20
+ address: string;
21
+ marginAccountId: MarginAccountEntity['id'];
22
+ limit?: number;
23
+ };
24
+
25
+ export type GetMarginAccountsResult = MarginAccountEntity[];
26
+
27
+ export type GetMarginAccountResult = MarginAccountEntity;
28
+
29
+ // ---- Transaction History
30
+ export type GetMarginAccountTransactionHistoryParams = {
31
+ marginAccountId: MarginAccountEntity['id'];
32
+ limit?: number;
33
+ };
34
+
35
+ export type GetMarginAccountTransactionHistoryResult =
36
+ MarginAccountTransactionHistoryEntity[];
37
+ // -- Max Order Size --
38
+
39
+ export type GetMaxOrderSizeAvailableParams = {
40
+ marketId: MarketEntity['id'];
41
+ marginAccountId: MarginAccountEntity['id'];
42
+ direction: 'long' | 'short';
43
+ };
44
+
45
+ export type GetMaxOrderSizeAvailableResult = number;
46
+
47
+ // --- Max Withdraw Balance for Margin Account ---
48
+ export type GetMaxWithdrawBalanceForAccountParams = {
49
+ marginAccountId: MarginAccountEntity['id'];
50
+ tokenAddress: string;
51
+ };
52
+
53
+ export type GetMaxWithdrawBalanceForAccountResult = number;
54
+
55
+ export type GetPositionsForMarginAccountResult = {
56
+ positions: PositionEntity[];
57
+ totalUnrealizedPNL: number;
58
+ };
59
+
60
+ // --- Position History ---
61
+
62
+ export type GetPositionsHistoryForMarginAccountParams = {
63
+ address: string;
64
+ marginAccountId: MarginAccountEntity['id'];
65
+ limit?: number;
66
+ };
67
+ export type GetPositionsHistoryForMarginAccountResult = PositionHistoryEntity[];
68
+
69
+ // ---- Transaction Simulation ----
70
+
71
+ export type GetTransactionSimulationInitialDataParams = {
72
+ marketId: MarketEntity['id'];
73
+ marginAccountId: MarginAccountEntity['id'];
74
+ };
@@ -9,11 +9,13 @@ import {
9
9
  GetLpPoolWithdrawBalanceParams,
10
10
  GetLpPoolWithdrawBalanceResult,
11
11
  GetLpPoolBalanceChartDataParams,
12
- GetLpPoolBalanceChartDataResult,
13
12
  GetLpPoolPerformanceChartDataParams,
13
+ } from './types';
14
+ import {
14
15
  GetLpPoolPerformanceChartDataResult,
15
- } from '../types';
16
- import RestClient from './rest';
16
+ GetLpPoolBalanceChartDataResult,
17
+ } from '@reyaxyz/common';
18
+ import RestClient from '../rest';
17
19
 
18
20
  export default class LpClient extends RestClient {
19
21
  async getLpPools(): Promise<GetLpPoolsResult> {
@@ -0,0 +1,62 @@
1
+ import {
2
+ LpPoolEntity,
3
+ LpPositionEntity,
4
+ LpTransactionHistoryEntity,
5
+ BalanceGranularity,
6
+ } from '@reyaxyz/common';
7
+
8
+ export type GetLpPoolsResult = LpPoolEntity[];
9
+
10
+ export type GetLpPoolResult = LpPoolEntity;
11
+
12
+ export type GetLpPoolParams = {
13
+ id: LpPoolEntity['id'];
14
+ };
15
+
16
+ export type GetLpPoolTransactionHistoryResult = LpTransactionHistoryEntity[];
17
+
18
+ export type GetLpPositionsParams = {
19
+ id: LpPoolEntity['id'];
20
+ address: string; // wallet address
21
+ };
22
+
23
+ export type GetLpPositionsResult = LpPositionEntity[];
24
+
25
+ export type GetLpPoolWithdrawBalanceParams = {
26
+ id: LpPoolEntity['id'];
27
+ address: string; // wallet address
28
+ };
29
+
30
+ export type GetLpPoolWithdrawBalanceResult = number;
31
+
32
+ export type GetLpPoolTransactionHistoryParams = {
33
+ id: LpPoolEntity['id'];
34
+ address: string; // wallet address
35
+ limit?: number;
36
+ };
37
+
38
+ export type GetLpPoolBalanceChartDataParams = {
39
+ poolId: LpPoolEntity['id'];
40
+ filters: {
41
+ timeframeMs: number;
42
+ granularity: BalanceGranularity;
43
+ };
44
+ };
45
+
46
+ export enum PerformanceGranularity {
47
+ ONE_MINUTE = 60 * 1000,
48
+ ONE_HOUR = 60 * 60 * 1000,
49
+ ONE_DAY = 24 * 60 * 60 * 1000,
50
+ ONE_WEEK = 7 * 24 * 60 * 60 * 1000,
51
+ ONE_MONTH = 30 * 24 * 60 * 60 * 1000,
52
+ ONE_YEAR = 365 * 24 * 60 * 60 * 1000,
53
+ }
54
+
55
+ export type GetLpPoolPerformanceChartDataParams = {
56
+ poolId: LpPoolEntity['id'];
57
+ address: string; // wallet address
58
+ filters: {
59
+ timeframeMs: number;
60
+ granularity: PerformanceGranularity;
61
+ };
62
+ };
@@ -6,8 +6,8 @@ import {
6
6
  GetMarketTradingHistoryParams,
7
7
  GetTradingHistoryResult,
8
8
  MarketCandlesResponse,
9
- } from '../types';
10
- import RestClient from './rest';
9
+ } from './types';
10
+ import RestClient from '../rest';
11
11
 
12
12
  export default class MarketsClient extends RestClient {
13
13
  /**
@@ -0,0 +1,33 @@
1
+ import {
2
+ CandlesResolution,
3
+ MarketEntity,
4
+ TradingHistoryEntity,
5
+ Candle,
6
+ } from '@reyaxyz/common';
7
+
8
+ export type GetMarketsResult = MarketEntity[];
9
+
10
+ export type GetMarketResult = MarketEntity;
11
+
12
+ export type GetMarketParams = {
13
+ id: MarketEntity['id'];
14
+ };
15
+
16
+ export type GetCandlesParams = {
17
+ marketId: MarketEntity['id'];
18
+ resolution: CandlesResolution;
19
+ fromISO?: string | null;
20
+ toISO?: string | null;
21
+ limit?: number | null;
22
+ };
23
+
24
+ export type GetMarketTradingHistoryParams = {
25
+ marketId: number;
26
+ limit?: number;
27
+ fromTimestampMillisecondsUTC?: number;
28
+ };
29
+ export type GetTradingHistoryResult = TradingHistoryEntity[];
30
+
31
+ export interface MarketCandlesResponse {
32
+ candles: Candle[];
33
+ }
@@ -1,6 +1,11 @@
1
- import { API_TIMEOUT } from '../helpers/constants';
2
- import { generateQueryPath } from '../helpers/query-helper';
3
- import { RequestMethod, Response, request, ResponseData } from '../lib/axios';
1
+ import { API_TIMEOUT } from '../../helpers/constants';
2
+ import { generateQueryPath } from '../../helpers/query-helper';
3
+ import {
4
+ RequestMethod,
5
+ Response,
6
+ request,
7
+ ResponseData,
8
+ } from '../../lib/axios';
4
9
  export default class RestClient {
5
10
  readonly host: string;
6
11
  readonly apiTimeout: number;
@@ -1,5 +1,5 @@
1
- import { GetAllowedTokensParams, GetAllowedTokenResult } from '../types';
2
- import RestClient from './rest';
1
+ import { GetAllowedTokensParams, GetAllowedTokenResult } from './types';
2
+ import RestClient from '../rest';
3
3
 
4
4
  export default class TokensClient extends RestClient {
5
5
  async getAllowedTokens(