@reyaxyz/api-sdk 0.157.0 → 0.159.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 (94) hide show
  1. package/dist/clients/api-client.js +0 -60
  2. package/dist/clients/api-client.js.map +1 -1
  3. package/dist/clients/modules/account/index.js +33 -94
  4. package/dist/clients/modules/account/index.js.map +1 -1
  5. package/dist/clients/modules/account/types.js.map +1 -1
  6. package/dist/clients/modules/auth/types.js.map +1 -1
  7. package/dist/clients/modules/conditional-orders/types.js.map +1 -1
  8. package/dist/clients/modules/deposit-existing-MA.simulation/types.js.map +1 -1
  9. package/dist/clients/modules/edit-collateral.simulation/types.js.map +1 -1
  10. package/dist/clients/modules/markets/index.js +0 -15
  11. package/dist/clients/modules/markets/index.js.map +1 -1
  12. package/dist/clients/modules/owner/index.js +0 -36
  13. package/dist/clients/modules/owner/index.js.map +1 -1
  14. package/dist/clients/modules/transfer-MA-Pool.simulation/types.js.map +1 -1
  15. package/dist/clients/modules/transfer-margin-between-MAs.simulation/types.js.map +1 -1
  16. package/dist/clients/modules/withdraw-MA.simulation/types.js.map +1 -1
  17. package/dist/clients/types.js +0 -3
  18. package/dist/clients/types.js.map +1 -1
  19. package/dist/types/clients/api-client.d.ts +0 -42
  20. package/dist/types/clients/api-client.d.ts.map +1 -1
  21. package/dist/types/clients/modules/account/index.d.ts +2 -10
  22. package/dist/types/clients/modules/account/index.d.ts.map +1 -1
  23. package/dist/types/clients/modules/account/types.d.ts +24 -24
  24. package/dist/types/clients/modules/account/types.d.ts.map +1 -1
  25. package/dist/types/clients/modules/auth/types.d.ts +1 -2
  26. package/dist/types/clients/modules/auth/types.d.ts.map +1 -1
  27. package/dist/types/clients/modules/conditional-orders/types.d.ts +3 -3
  28. package/dist/types/clients/modules/conditional-orders/types.d.ts.map +1 -1
  29. package/dist/types/clients/modules/deposit-existing-MA.simulation/types.d.ts +3 -3
  30. package/dist/types/clients/modules/deposit-existing-MA.simulation/types.d.ts.map +1 -1
  31. package/dist/types/clients/modules/edit-collateral.simulation/types.d.ts +4 -4
  32. package/dist/types/clients/modules/edit-collateral.simulation/types.d.ts.map +1 -1
  33. package/dist/types/clients/modules/markets/index.d.ts +1 -2
  34. package/dist/types/clients/modules/markets/index.d.ts.map +1 -1
  35. package/dist/types/clients/modules/owner/index.d.ts +1 -5
  36. package/dist/types/clients/modules/owner/index.d.ts.map +1 -1
  37. package/dist/types/clients/modules/transfer-MA-Pool.simulation/types.d.ts +3 -3
  38. package/dist/types/clients/modules/transfer-MA-Pool.simulation/types.d.ts.map +1 -1
  39. package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/types.d.ts +7 -7
  40. package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/types.d.ts.map +1 -1
  41. package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts +3 -3
  42. package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts.map +1 -1
  43. package/dist/types/clients/socket-client.d.ts +1 -1
  44. package/dist/types/clients/types.d.ts +1 -4
  45. package/dist/types/clients/types.d.ts.map +1 -1
  46. package/package.json +4 -4
  47. package/src/clients/api-client.ts +0 -58
  48. package/src/clients/modules/account/index.ts +34 -90
  49. package/src/clients/modules/account/types.ts +25 -24
  50. package/src/clients/modules/auth/types.ts +1 -2
  51. package/src/clients/modules/conditional-orders/types.ts +3 -3
  52. package/src/clients/modules/deposit-existing-MA.simulation/types.ts +3 -3
  53. package/src/clients/modules/edit-collateral.simulation/types.ts +4 -4
  54. package/src/clients/modules/markets/index.ts +1 -12
  55. package/src/clients/modules/owner/index.ts +0 -36
  56. package/src/clients/modules/transfer-MA-Pool.simulation/types.ts +3 -3
  57. package/src/clients/modules/transfer-margin-between-MAs.simulation/types.ts +7 -7
  58. package/src/clients/modules/withdraw-MA.simulation/types.ts +3 -3
  59. package/src/clients/types.ts +1 -4
  60. package/dist/clients/modules/isolated-order.simulation/index.js +0 -302
  61. package/dist/clients/modules/isolated-order.simulation/index.js.map +0 -1
  62. package/dist/clients/modules/isolated-order.simulation/types.js +0 -3
  63. package/dist/clients/modules/isolated-order.simulation/types.js.map +0 -1
  64. package/dist/clients/modules/rage-trade/index.js +0 -99
  65. package/dist/clients/modules/rage-trade/index.js.map +0 -1
  66. package/dist/clients/modules/rage-trade/types.js +0 -3
  67. package/dist/clients/modules/rage-trade/types.js.map +0 -1
  68. package/dist/clients/modules/trade.simulation/index.js +0 -331
  69. package/dist/clients/modules/trade.simulation/index.js.map +0 -1
  70. package/dist/clients/modules/trade.simulation/types.js +0 -3
  71. package/dist/clients/modules/trade.simulation/types.js.map +0 -1
  72. package/dist/clients/modules/trade.simulation/utils.js +0 -35
  73. package/dist/clients/modules/trade.simulation/utils.js.map +0 -1
  74. package/dist/types/clients/modules/isolated-order.simulation/index.d.ts +0 -24
  75. package/dist/types/clients/modules/isolated-order.simulation/index.d.ts.map +0 -1
  76. package/dist/types/clients/modules/isolated-order.simulation/types.d.ts +0 -44
  77. package/dist/types/clients/modules/isolated-order.simulation/types.d.ts.map +0 -1
  78. package/dist/types/clients/modules/rage-trade/index.d.ts +0 -9
  79. package/dist/types/clients/modules/rage-trade/index.d.ts.map +0 -1
  80. package/dist/types/clients/modules/rage-trade/types.d.ts +0 -80
  81. package/dist/types/clients/modules/rage-trade/types.d.ts.map +0 -1
  82. package/dist/types/clients/modules/trade.simulation/index.d.ts +0 -22
  83. package/dist/types/clients/modules/trade.simulation/index.d.ts.map +0 -1
  84. package/dist/types/clients/modules/trade.simulation/types.d.ts +0 -85
  85. package/dist/types/clients/modules/trade.simulation/types.d.ts.map +0 -1
  86. package/dist/types/clients/modules/trade.simulation/utils.d.ts +0 -8
  87. package/dist/types/clients/modules/trade.simulation/utils.d.ts.map +0 -1
  88. package/src/clients/modules/isolated-order.simulation/index.ts +0 -490
  89. package/src/clients/modules/isolated-order.simulation/types.ts +0 -55
  90. package/src/clients/modules/rage-trade/index.ts +0 -38
  91. package/src/clients/modules/rage-trade/types.ts +0 -91
  92. package/src/clients/modules/trade.simulation/index.ts +0 -534
  93. package/src/clients/modules/trade.simulation/types.ts +0 -98
  94. package/src/clients/modules/trade.simulation/utils.ts +0 -52
@@ -1,4 +1,4 @@
1
- import { MarginAccountEntity, MoneyInOutChainId, TokenEntity } from '@reyaxyz/common';
1
+ import { MarginRatioHealth, MoneyInOutChainId, TokenEntity } from '@reyaxyz/common';
2
2
  import { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';
3
3
  import { SocketWithdrawFees } from '@reyaxyz/common';
4
4
  export type WithdrawMASimulationLoadDataParams = EditCollateralSimulationLoadDataParams;
@@ -10,7 +10,7 @@ export type WithdrawMASimulationSimulateParams = {
10
10
  export type SimulateWithdrawMAEntity = {
11
11
  socketWithdrawFees: SocketWithdrawFees;
12
12
  bridgeTimeInMS: number;
13
- marginRatio: MarginAccountEntity['marginRatioPercentage'];
14
- marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
13
+ marginRatio: number;
14
+ marginRatioHealth: MarginRatioHealth;
15
15
  };
16
16
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sCAAsC,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,kCAAkC,GAC5C,sCAAsC,CAAC;AAEzC,MAAM,MAAM,kCAAkC,GAAG;IAC/C,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;CAC7D,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sCAAsC,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,kCAAkC,GAC5C,sCAAsC,CAAC;AAEzC,MAAM,MAAM,kCAAkC,GAAG;IAC/C,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,CAAC"}
@@ -100,7 +100,7 @@ export declare class SocketClient {
100
100
  *
101
101
  */
102
102
  set onMessage(callback: (event: SocketMessage) => void);
103
- getReadyState(): 0 | 2 | 1 | 3 | undefined;
103
+ getReadyState(): 0 | 1 | 2 | 3 | undefined;
104
104
  /**
105
105
  * @description Send a subscribe message to the websocket connection.
106
106
  *
@@ -1,10 +1,9 @@
1
- export { Candle, CandlesResolution, MarketEntity, LpTransactionHistoryEntity, TradingHistoryEntity, OrderHistoryEntity, PositionEntity, TransactionHistoryType, MarginAccountTransactionHistoryType, MarginAccountTransactionHistoryEntity, MarginAccountEntity, LpPositionEntity, LpPoolEntity, ReyaChainId, MoneyInOutChainId, LpBalanceGranularity, MarginAccountBalanceGranularity, GetMarginAccountBalanceChartDataResult, MarginAccountCollateralsBalanceGranularity, GetMarginAccountCollateralsBalanceChartDataResult, GetAllMarginAccountsBalanceChartDataResult, AllMarginAccountsBalanceGranularity, GetFundingRateChartDataResult, FundingRateHistoryGranularity, MoneyInOutConfigurationPerTokenName, UnifiedConditionalOrderType, ConditionalOrderType, } from '@reyaxyz/common';
1
+ export { Candle, CandlesResolution, MarketEntity, LpTransactionHistoryEntity, TradingHistoryEntity, OrderHistoryEntity, PositionEntity, TransactionHistoryType, MarginAccountTransactionHistoryType, MarginAccountTransactionHistoryEntity, StrippedMarginAccountEntity, LpPositionEntity, LpPoolEntity, ReyaChainId, MoneyInOutChainId, LpBalanceGranularity, MarginAccountBalanceGranularity, GetMarginAccountBalanceChartDataResult, MarginAccountCollateralsBalanceGranularity, GetMarginAccountCollateralsBalanceChartDataResult, GetAllMarginAccountsBalanceChartDataResult, AllMarginAccountsBalanceGranularity, GetFundingRateChartDataResult, FundingRateHistoryGranularity, MoneyInOutConfigurationPerTokenName, UnifiedConditionalOrderType, ConditionalOrderType, } from '@reyaxyz/common';
2
2
  export * from './modules/account/types';
3
3
  export * from './modules/conditional-orders/types';
4
4
  export * from './modules/lp/types';
5
5
  export * from './modules/markets/types';
6
6
  export * from './modules/tokens/types';
7
- export * from './modules/trade.simulation/types';
8
7
  export * from './modules/owner/types';
9
8
  export * from './modules/deposit-existing-MA.simulation/types';
10
9
  export * from './modules/deposit-new-MA.simulation/types';
@@ -17,6 +16,4 @@ export * from './modules/transfer-MA-Pool.simulation/types';
17
16
  export * from './modules/funding-rate/types';
18
17
  export * from './modules/depth-chart.simulation/types';
19
18
  export * from './modules/deposit-passive-pool.simulation/types';
20
- export * from './modules/isolated-order.simulation/types';
21
- export * from './modules/rage-trade/types';
22
19
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
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,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,mCAAmC,EACnC,qCAAqC,EACrC,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,+BAA+B,EAC/B,sCAAsC,EACtC,0CAA0C,EAC1C,iDAAiD,EACjD,0CAA0C,EAC1C,mCAAmC,EACnC,6BAA6B,EAC7B,6BAA6B,EAC7B,mCAAmC,EACnC,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,gDAAgD,CAAC;AAC/D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wDAAwD,CAAC;AACvE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,iDAAiD,CAAC;AAChE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4BAA4B,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,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,mCAAmC,EACnC,qCAAqC,EACrC,2BAA2B,EAC3B,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,+BAA+B,EAC/B,sCAAsC,EACtC,0CAA0C,EAC1C,iDAAiD,EACjD,0CAA0C,EAC1C,mCAAmC,EACnC,6BAA6B,EAC7B,6BAA6B,EAC7B,mCAAmC,EACnC,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gDAAgD,CAAC;AAC/D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iDAAiD,CAAC;AAChE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wDAAwD,CAAC;AACvE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,iDAAiD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/api-sdk",
3
- "version": "0.157.0",
3
+ "version": "0.159.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -33,15 +33,15 @@
33
33
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
34
34
  },
35
35
  "dependencies": {
36
- "@reyaxyz/common": "0.311.0",
36
+ "@reyaxyz/common": "0.312.0",
37
37
  "@simplewebauthn/types": "10.0.0",
38
38
  "bignumber.js": "9.1.2",
39
39
  "ethers": "6.9.0",
40
40
  "isomorphic-ws": "5.0.0"
41
41
  },
42
42
  "packageManager": "pnpm@8.3.1",
43
- "gitHead": "820bf1d931672522440894ba3b13568bc7ea753e",
43
+ "gitHead": "9466fb19baa2841b90d1d99f5eb4ca44bf457e73",
44
44
  "devDependencies": {
45
- "@reyaxyz/database": "0.149.6"
45
+ "@reyaxyz/database": "0.149.7"
46
46
  }
47
47
  }
@@ -5,7 +5,6 @@ import {
5
5
  } from '@reyaxyz/common';
6
6
  import MarketsClient from './modules/markets';
7
7
  import AccountClient from './modules/account';
8
- import TradeSimulationClient from './modules/trade.simulation';
9
8
  import LpClient from './modules/lp';
10
9
  import TokensClient from './modules/tokens';
11
10
  import OwnerClient from './modules/owner';
@@ -19,11 +18,9 @@ import TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-
19
18
  import TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';
20
19
  import DepthChartSimulationClient from './modules/depth-chart.simulation';
21
20
  import FundingRateClient from './modules/funding-rate';
22
- import IsolatedOrderSimulationClient from './modules/isolated-order.simulation';
23
21
  import ConditionalOrdersClient from './modules/conditional-orders';
24
22
  import ReferralClient from './modules/referral';
25
23
  import AuthClient from './modules/auth';
26
- import RageTradeClient from './modules/rage-trade';
27
24
 
28
25
  /**
29
26
  * @description Client for API
@@ -34,7 +31,6 @@ export class ApiClient {
34
31
  private readonly _markets: MarketsClient;
35
32
  private readonly _account: AccountClient;
36
33
  private readonly _lp: LpClient;
37
- private readonly _tradeSimulation: TradeSimulationClient;
38
34
  private readonly _fundingRateHistory: FundingRateClient;
39
35
  private readonly _editCollateralSimulation: EditCollateralSimulationClient;
40
36
  private readonly _depositExistingMASimulation: DepositExistingMASimulationClient;
@@ -45,22 +41,16 @@ export class ApiClient {
45
41
  private readonly _transferMarginBetweenMAsSimulation: TransferMarginBetweenMAsSimulationClient;
46
42
  private readonly _transferMAPoolSimulation: TransferMAPoolSimulationClient;
47
43
  private readonly _depthSimulation: DepthChartSimulationClient;
48
- private readonly _isolatedOrderSimulation: IsolatedOrderSimulationClient;
49
44
  private readonly _tokens: TokensClient;
50
45
  private readonly _owner: OwnerClient;
51
46
  private readonly _conditionalOrders: ConditionalOrdersClient;
52
47
  private readonly _referral: ReferralClient;
53
- private readonly _rageTrade: RageTradeClient;
54
48
  private readonly _auth: AuthClient;
55
49
 
56
50
  private constructor() {
57
51
  this._markets = new MarketsClient(ApiClient.config.apiEndpoint);
58
52
  this._account = new AccountClient(ApiClient.config.apiEndpoint);
59
53
  this._lp = new LpClient(ApiClient.config.apiEndpoint);
60
- this._tradeSimulation = new TradeSimulationClient(this._account);
61
- this._isolatedOrderSimulation = new IsolatedOrderSimulationClient(
62
- this._account,
63
- );
64
54
  this._fundingRateHistory = new FundingRateClient(this._markets);
65
55
  this._editCollateralSimulation = new EditCollateralSimulationClient(
66
56
  ApiClient.network,
@@ -103,7 +93,6 @@ export class ApiClient {
103
93
  ApiClient.config.apiEndpoint,
104
94
  );
105
95
  this._referral = new ReferralClient(ApiClient.config.apiEndpoint);
106
- this._rageTrade = new RageTradeClient(ApiClient.config.apiEndpoint);
107
96
  this._auth = new AuthClient(ApiClient.config.apiEndpoint);
108
97
  }
109
98
 
@@ -149,41 +138,6 @@ export class ApiClient {
149
138
  return ApiClient.getInstance()._account;
150
139
  }
151
140
 
152
- /**
153
- * Provides access to the TradeSimulationClient instance.
154
- * This getter allows for interacting with trade simulation functionalities.
155
- * It ensures a singleton pattern by fetching the instance from the ApiClient's
156
- * private `_tradeSimulation` property, ensuring that trade simulation operations
157
- * use a consistent client configuration and state.
158
- *
159
- * @returns {TradeSimulationClient} An instance of TradeSimulationClient for trade simulation operations.
160
- * @memberof ApiClient
161
- * @example
162
- * // Access the trade simulation client from the ApiClient
163
- * const tradeSimulationClient = ApiClient.tradeSimulation;
164
- */
165
-
166
- public static get tradeSimulation(): TradeSimulationClient {
167
- return ApiClient.getInstance()._tradeSimulation;
168
- }
169
-
170
- /**
171
- * Provides access to the IsolatedOrderSimulationClient instance.
172
- * This getter allows for interacting with isolatedTrade simulation functionalities.
173
- * It ensures a singleton pattern by fetching the instance from the ApiClient's
174
- * private `_isolatedTradeSimulation` property, ensuring that isolatedTrade simulation operations
175
- * use a consistent client configuration and state.
176
- *
177
- * @returns {IsolatedOrderSimulationClient} An instance of IsolatedOrderSimulationClient for isolatedTrade simulation operations.
178
- * @memberof ApiClient
179
- * @example
180
- * // Access the isolatedTrade simulation client from the ApiClient
181
- * const isolatedTradeSimulationClient = ApiClient.isolatedTradeSimulation;
182
- */
183
- public static get isolatedSimulation(): IsolatedOrderSimulationClient {
184
- return ApiClient.getInstance()._isolatedOrderSimulation;
185
- }
186
-
187
141
  public static get fundingRateHistory(): FundingRateClient {
188
142
  return ApiClient.getInstance()._fundingRateHistory;
189
143
  }
@@ -407,18 +361,6 @@ export class ApiClient {
407
361
  return ApiClient.getInstance()._referral;
408
362
  }
409
363
 
410
- /**
411
- * Gets the current instance of the RageTradeClient from the ApiClient.
412
- *
413
- * This static getter allows access to the RageTradeClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the RageTradeClient directly, bypassing the need to manually access the internal `_rageTrade` property of the ApiClient instance.
414
- *
415
- * @returns {RageTradeClient} The RageTradeClient instance currently held by the ApiClient.
416
- */
417
-
418
- public static get rageTrade(): RageTradeClient {
419
- return ApiClient.getInstance()._rageTrade;
420
- }
421
-
422
364
  /**
423
365
  * Gets the current instance of the AuthClient from the ApiClient.
424
366
  *
@@ -5,25 +5,13 @@ import {
5
5
  GetMarginAccountsResult,
6
6
  GetMarginAccountTransactionHistoryParams,
7
7
  GetMarginAccountTransactionHistoryResult,
8
- GetMaxOrderSizeAvailableParams,
9
- GetMaxOrderSizeAvailableResult,
10
8
  GetMaxWithdrawBalanceForAccountParams,
11
9
  GetMaxWithdrawBalanceForAccountResult,
12
- GetPositionsForMarginAccountParams,
13
- GetPositionsForMarginAccountResult,
14
- GetTransactionSimulationInitialDataParams,
15
- GetMarginAccountBalanceChartDataParams,
16
- GetMarginAccountCollateralsBalanceChartDataParams,
17
- GetAllMarginAccountsBalanceChartDataParams,
18
10
  EditMarginAccountParams,
19
11
  CloseMarginAccountParams,
20
- GetAllMarginAccountsSummaryResult,
21
- GetAllMarginAccountsSummaryParams,
22
12
  GetEditCollateralSimulationInitialDataParams,
23
13
  EditMarginAccountResult,
24
14
  CloseMarginAccountResult,
25
- GetIsolatedOrderMaxSizeAvailableParams,
26
- GetIsolatedOrderMaxSizeAvailableResult,
27
15
  GetMarginAccountOrderHistoryPaginatedParams,
28
16
  GetMarginAccountOrderHistoryPaginatedResult,
29
17
  GetLiquidationHistoryForOwnerAddressResult,
@@ -37,11 +25,8 @@ import {
37
25
  } from './types';
38
26
  import {
39
27
  EditCollateralSimulationState,
40
- TradeSimulationState,
41
- GetMarginAccountCollateralsBalanceChartDataResult,
42
- GetMarginAccountBalanceChartDataResult,
43
- GetAllMarginAccountsBalanceChartDataResult,
44
28
  RestClient,
29
+ StrippedMarginAccountEntity,
45
30
  } from '@reyaxyz/common';
46
31
 
47
32
  export default class AccountClient extends RestClient {
@@ -67,7 +52,24 @@ export default class AccountClient extends RestClient {
67
52
  includePositions: false,
68
53
  });
69
54
 
70
- return response;
55
+ const strippedResponse = response.map(
56
+ (account): StrippedMarginAccountEntity => {
57
+ return {
58
+ id: account.id,
59
+ name: account.name,
60
+ marginRatioHealth: account.marginRatioHealth,
61
+ marginRatioPercentage: account.marginRatioPercentage,
62
+ marginRatioHealthDangerThreshold:
63
+ account.marginRatioHealthDangerThreshold,
64
+ marginRatioHealthWarningThreshold:
65
+ account.marginRatioHealthWarningThreshold,
66
+ isApproachingLiquidation: account.isApproachingLiquidation,
67
+ isLiquidationImminent: account.isLiquidationImminent,
68
+ };
69
+ },
70
+ );
71
+
72
+ return strippedResponse;
71
73
  }
72
74
 
73
75
  /**
@@ -86,14 +88,22 @@ export default class AccountClient extends RestClient {
86
88
  params: GetMarginAccountParams,
87
89
  ): Promise<GetMarginAccountResult> {
88
90
  const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}`;
89
- return this.get(uri);
90
- }
91
+ const response: GetMarginAccountResult = await this.get(uri);
91
92
 
92
- async getPositionsForMarginAccount(
93
- params: GetPositionsForMarginAccountParams,
94
- ): Promise<GetPositionsForMarginAccountResult> {
95
- const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions`;
96
- return this.get(uri, { limit: params.limit });
93
+ const strippedResponse = {
94
+ id: response.id,
95
+ name: response.name,
96
+ marginRatioHealth: response.marginRatioHealth,
97
+ marginRatioPercentage: response.marginRatioPercentage,
98
+ marginRatioHealthDangerThreshold:
99
+ response.marginRatioHealthDangerThreshold,
100
+ marginRatioHealthWarningThreshold:
101
+ response.marginRatioHealthWarningThreshold,
102
+ isApproachingLiquidation: response.isApproachingLiquidation,
103
+ isLiquidationImminent: response.isLiquidationImminent,
104
+ };
105
+
106
+ return strippedResponse;
97
107
  }
98
108
 
99
109
  async getMarginAccountOrderHistoryPaginated(
@@ -125,35 +135,6 @@ export default class AccountClient extends RestClient {
125
135
  });
126
136
  }
127
137
 
128
- async getMaxOrderSizeAvailable(
129
- params: GetMaxOrderSizeAvailableParams,
130
- ): Promise<GetMaxOrderSizeAvailableResult> {
131
- const uri = `/api/accounts/${params.marginAccountId}/max-order-size`;
132
- return this.get(uri, {
133
- marketId: params.marketId,
134
- direction: params.direction,
135
- });
136
- }
137
-
138
- async getIsolatedOrderMaxSizeAvailable(
139
- params: GetIsolatedOrderMaxSizeAvailableParams,
140
- ): Promise<GetIsolatedOrderMaxSizeAvailableResult> {
141
- const uri = `/api/accounts/${params.marginAccountId}/max-order-size-isolated`;
142
- return this.get(uri, {
143
- marketId: params.marketId,
144
- direction: params.direction,
145
- });
146
- }
147
-
148
- async getTransactionSimulationInitialData(
149
- params: GetTransactionSimulationInitialDataParams,
150
- ): Promise<TradeSimulationState> {
151
- const uri = `/api/accounts/${params.marginAccountId}/trade-simulation-data`;
152
- return this.get(uri, {
153
- marketId: params.marketId,
154
- });
155
- }
156
-
157
138
  async getEditCollateralSimulationInitialData(
158
139
  params: GetEditCollateralSimulationInitialDataParams,
159
140
  ): Promise<EditCollateralSimulationState> {
@@ -188,43 +169,6 @@ export default class AccountClient extends RestClient {
188
169
  });
189
170
  }
190
171
 
191
- async getMarginAccountBalanceChartData(
192
- params: GetMarginAccountBalanceChartDataParams,
193
- ): Promise<GetMarginAccountBalanceChartDataResult> {
194
- const uri = `/api/accounts/${params.marginAccountId}/balance-chart-data`;
195
- return this.get(uri, {
196
- timeframeMs: params.filters.timeframeMs,
197
- granularity: params.filters.granularity,
198
- });
199
- }
200
-
201
- async getMarginAccountCollateralsBalanceChartData(
202
- params: GetMarginAccountCollateralsBalanceChartDataParams,
203
- ): Promise<GetMarginAccountCollateralsBalanceChartDataResult> {
204
- const uri = `/api/accounts/${params.marginAccountId}/collaterals-balance-chart-data`;
205
- return this.get(uri, {
206
- timeframeMs: params.filters.timeframeMs,
207
- granularity: params.filters.granularity,
208
- });
209
- }
210
-
211
- async getAllMarginAccountsBalanceChart(
212
- params: GetAllMarginAccountsBalanceChartDataParams,
213
- ): Promise<GetAllMarginAccountsBalanceChartDataResult> {
214
- const uri = `/api/accounts/owner/${params.ownerAddress}/balance`;
215
- return this.get(uri, {
216
- timeframeMs: params.filters.timeframeMs,
217
- granularity: params.filters.granularity,
218
- });
219
- }
220
-
221
- async getAllMarginAccountsSummary(
222
- params: GetAllMarginAccountsSummaryParams,
223
- ): Promise<GetAllMarginAccountsSummaryResult> {
224
- const uri = `/api/accounts/owner/${params.ownerAddress}/summary`;
225
- return this.get(uri);
226
- }
227
-
228
172
  // TODO: Milan validate
229
173
  async editMarginAccount(
230
174
  params: EditMarginAccountParams,
@@ -1,9 +1,10 @@
1
1
  import {
2
- MarginAccountEntity,
3
2
  MarginAccountTransactionHistoryEntity,
4
3
  MarketEntity,
5
4
  PositionEntity,
6
5
  OrderHistoryEntity,
6
+ MarginRatioHealth,
7
+ StrippedMarginAccountEntity,
7
8
  } from '@reyaxyz/common';
8
9
  import {
9
10
  MarginAccountBalanceGranularity,
@@ -21,22 +22,22 @@ export type GetMarginAccountsParams = {
21
22
 
22
23
  export type GetMarginAccountParams = {
23
24
  address: string;
24
- marginAccountId: MarginAccountEntity['id'];
25
+ marginAccountId: number;
25
26
  };
26
27
 
27
28
  export type GetPositionsForMarginAccountParams = {
28
29
  address: string;
29
- marginAccountId: MarginAccountEntity['id'];
30
+ marginAccountId: number;
30
31
  limit?: number;
31
32
  };
32
33
 
33
- export type GetMarginAccountsResult = MarginAccountEntity[];
34
+ export type GetMarginAccountsResult = StrippedMarginAccountEntity[];
34
35
 
35
- export type GetMarginAccountResult = MarginAccountEntity;
36
+ export type GetMarginAccountResult = StrippedMarginAccountEntity;
36
37
 
37
38
  // ---- Transaction History
38
39
  export type GetMarginAccountTransactionHistoryParams = {
39
- marginAccountId: MarginAccountEntity['id'];
40
+ marginAccountId: number;
40
41
  limit?: number;
41
42
  };
42
43
 
@@ -44,7 +45,7 @@ export type GetMarginAccountTransactionHistoryResult =
44
45
  MarginAccountTransactionHistoryEntity[];
45
46
 
46
47
  export type GetAccountFeeRebatesHistoryParams = {
47
- marginAccountId: MarginAccountEntity['id'];
48
+ marginAccountId: number;
48
49
  limit?: number;
49
50
  };
50
51
 
@@ -55,7 +56,7 @@ export type GetAccountFeeRebatesHistoryResult = {
55
56
 
56
57
  export type GetMaxOrderSizeAvailableParams = {
57
58
  marketId: MarketEntity['id'];
58
- marginAccountId: MarginAccountEntity['id'];
59
+ marginAccountId: number;
59
60
  direction: 'long' | 'short';
60
61
  };
61
62
 
@@ -66,7 +67,7 @@ export type GetMaxOrderSizeAvailableResult = {
66
67
 
67
68
  // --- Max Withdraw Balance for Margin Account ---
68
69
  export type GetMaxWithdrawBalanceForAccountParams = {
69
- marginAccountId: MarginAccountEntity['id'];
70
+ marginAccountId: number;
70
71
  tokenAddress: string;
71
72
  };
72
73
 
@@ -81,12 +82,12 @@ export type GetPositionsForMarginAccountResult = {
81
82
 
82
83
  export type GetMarginAccountOrderHistoryParams = {
83
84
  address: string;
84
- marginAccountId: MarginAccountEntity['id'];
85
+ marginAccountId: number;
85
86
  limit?: number;
86
87
  };
87
88
  export type GetMarginAccountOrderHistoryPaginatedParams = {
88
89
  address: string;
89
- marginAccountId: MarginAccountEntity['id'];
90
+ marginAccountId: number;
90
91
  page: number;
91
92
  perPage: number;
92
93
  type?: 'order' | 'liquidation';
@@ -116,10 +117,10 @@ export type LiquidationHistoryEntity = {
116
117
  timestamp: number;
117
118
  baseUnderlyingToken: string;
118
119
  marginAccount: {
119
- id: MarginAccountEntity['id'];
120
- name: MarginAccountEntity['name'];
121
- marginRatioPercentage: MarginAccountEntity['marginRatioPercentage'];
122
- marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
120
+ id: number;
121
+ name: string;
122
+ marginRatioPercentage: number;
123
+ marginRatioHealth: MarginRatioHealth;
123
124
  };
124
125
  };
125
126
 
@@ -133,17 +134,17 @@ export type GetAutoExchangeHistoryForOwnerAddressResult = {
133
134
 
134
135
  export type GetTransactionSimulationInitialDataParams = {
135
136
  marketId: MarketEntity['id'];
136
- marginAccountId: MarginAccountEntity['id'];
137
+ marginAccountId: number;
137
138
  };
138
139
 
139
140
  // ---- Edit Collateral Simulation ----
140
141
 
141
142
  export type GetEditCollateralSimulationInitialDataParams = {
142
- marginAccountId: MarginAccountEntity['id'];
143
+ marginAccountId: number;
143
144
  };
144
145
 
145
146
  export type GetMarginAccountBalanceChartDataParams = {
146
- marginAccountId: MarginAccountEntity['id'];
147
+ marginAccountId: number;
147
148
  filters: {
148
149
  timeframeMs: number;
149
150
  granularity: MarginAccountBalanceGranularity;
@@ -151,7 +152,7 @@ export type GetMarginAccountBalanceChartDataParams = {
151
152
  };
152
153
 
153
154
  export type GetMarginAccountCollateralsBalanceChartDataParams = {
154
- marginAccountId: MarginAccountEntity['id'];
155
+ marginAccountId: number;
155
156
  filters: {
156
157
  timeframeMs: number;
157
158
  granularity: MarginAccountCollateralsBalanceGranularity;
@@ -167,14 +168,14 @@ export type GetAllMarginAccountsBalanceChartDataParams = {
167
168
  };
168
169
 
169
170
  export type EditMarginAccountParams = {
170
- id: MarginAccountEntity['id'];
171
- name: MarginAccountEntity['name'];
171
+ id: number;
172
+ name: string;
172
173
  };
173
174
 
174
175
  export type EditMarginAccountResult = { success: boolean };
175
176
 
176
177
  export type CloseMarginAccountParams = {
177
- id: MarginAccountEntity['id'];
178
+ id: number;
178
179
  };
179
180
 
180
181
  export type CloseMarginAccountResult = { success: boolean };
@@ -192,7 +193,7 @@ export type GetAllMarginAccountsSummaryResult = {
192
193
 
193
194
  export type GetIsolatedOrderMaxSizeAvailableParams = {
194
195
  marketId: MarketEntity['id'];
195
- marginAccountId: MarginAccountEntity['id'];
196
+ marginAccountId: number;
196
197
  direction: 'long' | 'short';
197
198
  };
198
199
 
@@ -202,7 +203,7 @@ export type GetIsolatedOrderMaxSizeAvailableResult = {
202
203
  };
203
204
 
204
205
  export type UpdateLeverageForAccountAndMarketParams = {
205
- accountId: MarginAccountEntity['id'];
206
+ accountId: number;
206
207
  marketId: MarketEntity['id'];
207
208
  leverage: number;
208
209
  };
@@ -1,9 +1,8 @@
1
1
  import { JsonRpcSigner, Signer } from 'ethers';
2
- import { MarginAccountEntity } from '@reyaxyz/common';
3
2
  import { RegistrationResponseJSON } from '@simplewebauthn/types';
4
3
 
5
4
  export type RegisterParams = {
6
5
  signer: Signer | JsonRpcSigner;
7
- marginAccountId: MarginAccountEntity['id'];
6
+ marginAccountId: number;
8
7
  attestationResponse: RegistrationResponseJSON;
9
8
  };
@@ -4,7 +4,7 @@ import {
4
4
  ConditionalOrderType,
5
5
  } from '@reyaxyz/common';
6
6
  import { Signer, JsonRpcSigner } from 'ethers';
7
- import { MarginAccountEntity, MarketEntity, Address } from '@reyaxyz/common';
7
+ import { MarketEntity, Address } from '@reyaxyz/common';
8
8
 
9
9
  export type CancelConditionalOrderParams = {
10
10
  signer: Signer | JsonRpcSigner;
@@ -31,7 +31,7 @@ export type OrderSupportingParams = {
31
31
 
32
32
  export type RegisterConditionalOrderParams = {
33
33
  signer: Signer | JsonRpcSigner;
34
- marginAccountId: MarginAccountEntity['id'];
34
+ marginAccountId: number;
35
35
  triggerPrice: number;
36
36
  orderType: ConditionalOrderType;
37
37
  marketId: number;
@@ -66,7 +66,7 @@ export type AlreadyGaveTradePermissionToWalletResult = {
66
66
  // ---- Conditional Orders History ---
67
67
  export type GetConditionalOrdersHistoryForMarginAccountParams = {
68
68
  address: string;
69
- marginAccountId: MarginAccountEntity['id'];
69
+ marginAccountId: number;
70
70
  limit?: number;
71
71
  };
72
72
 
@@ -1,5 +1,5 @@
1
1
  import {
2
- MarginAccountEntity,
2
+ MarginRatioHealth,
3
3
  MoneyInOutChainId,
4
4
  SocketDepositFees,
5
5
  TokenEntity,
@@ -18,6 +18,6 @@ export type DepositExistingMASimulationSimulateParams = {
18
18
  export type SimulateDepositExistingMAEntity = {
19
19
  socketDepositFees: SocketDepositFees;
20
20
  bridgeTimeInMS: number;
21
- marginRatio: MarginAccountEntity['marginRatioPercentage'];
22
- marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
21
+ marginRatio: number;
22
+ marginRatioHealth: MarginRatioHealth;
23
23
  };
@@ -1,7 +1,7 @@
1
- import { MarginAccountEntity, TokenEntity } from '@reyaxyz/common';
1
+ import { MarginRatioHealth, TokenEntity } from '@reyaxyz/common';
2
2
 
3
3
  export type EditCollateralSimulationLoadDataParams = {
4
- marginAccountId: MarginAccountEntity['id'];
4
+ marginAccountId: number;
5
5
  };
6
6
 
7
7
  export type EditCollateralSimulationSimulateParams = {
@@ -10,6 +10,6 @@ export type EditCollateralSimulationSimulateParams = {
10
10
  };
11
11
 
12
12
  export type SimulateEditCollateralEntity = {
13
- marginRatio: MarginAccountEntity['marginRatioPercentage'];
14
- marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
13
+ marginRatio: number;
14
+ marginRatioHealth: MarginRatioHealth;
15
15
  };
@@ -5,15 +5,10 @@ import {
5
5
  GetMarketResult,
6
6
  GetMarketsResult,
7
7
  GetMarketTradingHistoryParams,
8
- GetPoolPriceResult,
9
8
  GetTradingHistoryResult,
10
9
  MarketCandlesResponse,
11
10
  } from './types';
12
- import {
13
- GetFundingRateChartDataResult,
14
- RestClient,
15
- GetInstantPoolPriceResult,
16
- } from '@reyaxyz/common';
11
+ import { GetFundingRateChartDataResult, RestClient } from '@reyaxyz/common';
17
12
 
18
13
  export default class MarketsClient extends RestClient {
19
14
  /**
@@ -44,12 +39,6 @@ export default class MarketsClient extends RestClient {
44
39
  return this.get(uri);
45
40
  }
46
41
 
47
- async getPoolPrice(params: GetMarketParams): Promise<GetPoolPriceResult> {
48
- const uri = `/api/markets/${params.id}/pool-price/`;
49
- const poolPriceInfo: GetInstantPoolPriceResult = await this.get(uri);
50
- return { price: poolPriceInfo.poolPrice };
51
- }
52
-
53
42
  /**
54
43
  * Retrieves candlestick data for a specified market.
55
44
  *