@reyaxyz/api-sdk 0.69.7 → 0.70.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/clients/api-client.js +25 -2
  2. package/dist/clients/api-client.js.map +1 -1
  3. package/dist/clients/modules/deposit-existing-MA.simulation/index.js +6 -6
  4. package/dist/clients/modules/deposit-existing-MA.simulation/index.js.map +1 -1
  5. package/dist/clients/modules/deposit-passive-pool.simulation/index.js +6 -6
  6. package/dist/clients/modules/deposit-passive-pool.simulation/index.js.map +1 -1
  7. package/dist/clients/modules/withdraw-MA.simulation/index.js +47 -15
  8. package/dist/clients/modules/withdraw-MA.simulation/index.js.map +1 -1
  9. package/dist/clients/modules/withdraw-MA.simulation/types.js.map +1 -1
  10. package/dist/clients/modules/withdraw-passive-pool.simulation/index.js +106 -0
  11. package/dist/clients/modules/withdraw-passive-pool.simulation/index.js.map +1 -0
  12. package/dist/clients/modules/withdraw-passive-pool.simulation/types.js +3 -0
  13. package/dist/clients/modules/withdraw-passive-pool.simulation/types.js.map +1 -0
  14. package/dist/clients/types.js +1 -0
  15. package/dist/clients/types.js.map +1 -1
  16. package/dist/types/clients/api-client.d.ts +18 -3
  17. package/dist/types/clients/api-client.d.ts.map +1 -1
  18. package/dist/types/clients/modules/deposit-existing-MA.simulation/index.d.ts.map +1 -1
  19. package/dist/types/clients/modules/deposit-passive-pool.simulation/index.d.ts.map +1 -1
  20. package/dist/types/clients/modules/withdraw-MA.simulation/index.d.ts +4 -3
  21. package/dist/types/clients/modules/withdraw-MA.simulation/index.d.ts.map +1 -1
  22. package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts +3 -3
  23. package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts.map +1 -1
  24. package/dist/types/clients/modules/withdraw-passive-pool.simulation/index.d.ts +10 -0
  25. package/dist/types/clients/modules/withdraw-passive-pool.simulation/index.d.ts.map +1 -0
  26. package/dist/types/clients/modules/withdraw-passive-pool.simulation/types.d.ts +9 -0
  27. package/dist/types/clients/modules/withdraw-passive-pool.simulation/types.d.ts.map +1 -0
  28. package/dist/types/clients/types.d.ts +1 -0
  29. package/dist/types/clients/types.d.ts.map +1 -1
  30. package/package.json +3 -3
  31. package/src/clients/api-client.ts +32 -3
  32. package/src/clients/modules/deposit-existing-MA.simulation/index.ts +10 -10
  33. package/src/clients/modules/deposit-passive-pool.simulation/index.ts +10 -10
  34. package/src/clients/modules/withdraw-MA.simulation/index.ts +38 -11
  35. package/src/clients/modules/withdraw-MA.simulation/types.ts +2 -3
  36. package/src/clients/modules/withdraw-passive-pool.simulation/index.ts +69 -0
  37. package/src/clients/modules/withdraw-passive-pool.simulation/types.ts +10 -0
  38. package/src/clients/types.ts +1 -0
@@ -16,6 +16,7 @@ var deposit_existing_MA_simulation_1 = __importDefault(require("./modules/deposi
16
16
  var deposit_new_MA_simulation_1 = __importDefault(require("./modules/deposit-new-MA.simulation"));
17
17
  var deposit_passive_pool_simulation_1 = __importDefault(require("./modules/deposit-passive-pool.simulation"));
18
18
  var withdraw_MA_simulation_1 = __importDefault(require("./modules/withdraw-MA.simulation"));
19
+ var withdraw_passive_pool_simulation_1 = __importDefault(require("./modules/withdraw-passive-pool.simulation"));
19
20
  var transfer_margin_between_MAs_simulation_1 = __importDefault(require("./modules/transfer-margin-between-MAs.simulation"));
20
21
  var transfer_MA_Pool_simulation_1 = __importDefault(require("./modules/transfer-MA-Pool.simulation"));
21
22
  var depth_chart_simulation_1 = __importDefault(require("./modules/depth-chart.simulation"));
@@ -34,7 +35,9 @@ var ApiClient = /** @class */ (function () {
34
35
  this._depositExistingMASimulation = new deposit_existing_MA_simulation_1.default(this._editCollateralSimulation, ApiClient.config.apiEndpoint);
35
36
  this._depositNewMASimulation = new deposit_new_MA_simulation_1.default(this._depositExistingMASimulation);
36
37
  this._depositPassivePoolSimulation = new deposit_passive_pool_simulation_1.default(ApiClient.config.apiEndpoint);
37
- this._withdrawMASimulation = new withdraw_MA_simulation_1.default(this._editCollateralSimulation, ApiClient.config.chain);
38
+ this._withdrawMASimulation = new withdraw_MA_simulation_1.default(this._editCollateralSimulation, ApiClient.config.chain, ApiClient.config.apiEndpoint);
39
+ this._withdrawPassivePoolSimulation =
40
+ new withdraw_passive_pool_simulation_1.default(ApiClient.config.chain, ApiClient.config.apiEndpoint);
38
41
  this._transferMarginBetweenMAsSimulation =
39
42
  new transfer_margin_between_MAs_simulation_1.default(ApiClient.network, this._account);
40
43
  this._transferMAPoolSimulation = new transfer_MA_Pool_simulation_1.default(this._editCollateralSimulation);
@@ -220,7 +223,7 @@ var ApiClient = /** @class */ (function () {
220
223
  * private `_withdrawMASimulation` property, ensuring that trade simulation operations
221
224
  * use a consistent client configuration and state.
222
225
  *
223
- * @returns {WithdrawMASimulationClient} An instance of WithrawMASimulationClient for trade simulation operations.
226
+ * @returns {WithdrawMASimulationClient} An instance of WithdrawMASimulationClient for trade simulation operations.
224
227
  * @memberof ApiClient
225
228
  * @example
226
229
  * // Access the withdraw MA simulation client from the ApiClient
@@ -232,6 +235,26 @@ var ApiClient = /** @class */ (function () {
232
235
  enumerable: false,
233
236
  configurable: true
234
237
  });
238
+ Object.defineProperty(ApiClient, "withdrawPassivePoolSimulation", {
239
+ /**
240
+ * Provides access to the WithdrawPassivePoolSimulationClient instance.
241
+ * This getter allows for interacting with trade simulation functionalities.
242
+ * It ensures a singleton pattern by fetching the instance from the ApiClient's
243
+ * private `_withdrawPassivePoolSimulation` property, ensuring that trade simulation operations
244
+ * use a consistent client configuration and state.
245
+ *
246
+ * @returns {WithdrawPassivePoolSimulationClient} An instance of WithdrawPassivePoolSimulationClient for trade simulation operations.
247
+ * @memberof ApiClient
248
+ * @example
249
+ * // Access the withdraw MA simulation client from the ApiClient
250
+ * const withdrawPassivePoolSimulationClient = ApiClient.withdrawPassivePoolSimulation;
251
+ */
252
+ get: function () {
253
+ return ApiClient.getInstance()._withdrawPassivePoolSimulation;
254
+ },
255
+ enumerable: false,
256
+ configurable: true
257
+ });
235
258
  Object.defineProperty(ApiClient, "transferMarginBetweenMAsSimulation", {
236
259
  /**
237
260
  * Provides access to the TransferMarginBetweenMAsSimulationClient instance.
@@ -1 +1 @@
1
- {"version":3,"file":"api-client.js","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAoE;AACpE,8DAA8C;AAC9C,8DAA8C;AAC9C,gFAA+D;AAC/D,oDAAoC;AACpC,4DAA4C;AAE5C,0DAA0C;AAC1C,oGAAkF;AAClF,4GAAyF;AACzF,kGAA+E;AAC/E,8GAA2F;AAC3F,4FAA0E;AAC1E,4HAAwG;AACxG,sGAAmF;AACnF,4FAA0E;AAC1E,wEAAuD;AAEvD;;GAEG;AACH;IAmBE;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,GAAG,GAAG,IAAI,YAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACtD,IAAI,CAAC,gBAAgB,GAAG,IAAI,0BAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjE,IAAI,CAAC,mBAAmB,GAAG,IAAI,sBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChE,IAAI,CAAC,yBAAyB,GAAG,IAAI,oCAA8B,CACjE,SAAS,CAAC,OAAO,EACjB,IAAI,CAAC,QAAQ,CACd,CAAC;QACF,IAAI,CAAC,4BAA4B,GAAG,IAAI,wCAAiC,CACvE,IAAI,CAAC,yBAAyB,EAC9B,SAAS,CAAC,MAAM,CAAC,WAAW,CAC7B,CAAC;QACF,IAAI,CAAC,uBAAuB,GAAG,IAAI,mCAA4B,CAC7D,IAAI,CAAC,4BAA4B,CAClC,CA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YG;aAEH;YACE,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,qBAAqB,CAAC;QACvD,CAAC;;;OAAA;IAgBD,sBAAkB,+CAAkC;QAdpD;;;;;;;;;;;;WAYG;aAEH;YACE,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,mCAAmC,CAAC;QACrE,CAAC;;;OAAA;IAgBD,sBAAkB,qCAAwB;QAd1C;;;;;;;;;;;;WAYG;aAEH;YACE,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,yBAAyB,CAAC;QAC3D,CAAC;;;OAAA;IAYD,sBAAkB,eAAE;QAVpB;;;;;;;;;WASG;aACH;YACE,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC;QACrC,CAAC;;;OAAA;IAYD,sBAAkB,mBAAM;QAVxB;;;;;;;;;WASG;aACH;YACE,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC;QACzC,CAAC;;;OAAA;IAYD,sBAAkB,kBAAK;QAVvB;;;;;;;;;WASG;aACH;YACE,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC;QACxC,CAAC;;;OAAA;IAzSc,gBAAM,GAAkB,2BAAkB,CAAC,MAAM,CAAC,CAAC;IA0SpE,gBAAC;CAAA,AA5SD,IA4SC;AA5SY,8BAAS","sourcesContent":["import { API_CLIENT_CONFIGS, ServiceConfig } from '@reyaxyz/common';\nimport MarketsClient from './modules/markets';\nimport AccountClient from './modules/account';\nimport TradeSimulationClient from './modules/trade.simulation';\nimport LpClient from './modules/lp';\nimport TokensClient from './modules/tokens';\nimport { ReyaChainId } from '@reyaxyz/common';\nimport OwnerClient from './modules/owner';\nimport EditCollateralSimulationClient from './modules/edit-collateral.simulation';\nimport DepositExistingMASimulationClient from './modules/deposit-existing-MA.simulation';\nimport DepositNewMASimulationClient from './modules/deposit-new-MA.simulation';\nimport DepositPassivePoolSimulationClient from './modules/deposit-passive-pool.simulation';\nimport WithdrawMASimulationClient from './modules/withdraw-MA.simulation';\nimport TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-between-MAs.simulation';\nimport TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';\nimport DepthChartSimulationClient from './modules/depth-chart.simulation';\nimport FundingRateClient from './modules/funding-rate';\n\n/**\n * @description Client for API\n */\nexport class ApiClient {\n private static instance: ApiClient;\n private static config: ServiceConfig = API_CLIENT_CONFIGS['test'];\n private readonly _markets: MarketsClient;\n private readonly _account: AccountClient;\n private readonly _lp: LpClient;\n private readonly _tradeSimulation: TradeSimulationClient;\n private readonly _fundingRateHistory: FundingRateClient;\n private readonly _editCollateralSimulation: EditCollateralSimulationClient;\n private readonly _depositExistingMASimulation: DepositExistingMASimulationClient;\n private readonly _depositNewMASimulation: DepositNewMASimulationClient;\n private readonly _depositPassivePoolSimulation: DepositPassivePoolSimulationClient;\n private readonly _withdrawMASimulation: WithdrawMASimulationClient;\n private readonly _transferMarginBetweenMAsSimulation: TransferMarginBetweenMAsSimulationClient;\n private readonly _transferMAPoolSimulation: TransferMAPoolSimulationClient;\n private readonly _depthSimulation: DepthChartSimulationClient;\n private readonly _tokens: TokensClient;\n private readonly _owner: OwnerClient;\n\n private constructor() {\n this._markets = new MarketsClient(ApiClient.config.apiEndpoint);\n this._account = new AccountClient(ApiClient.config.apiEndpoint);\n this._lp = new LpClient(ApiClient.config.apiEndpoint);\n this._tradeSimulation = new TradeSimulationClient(this._account);\n this._fundingRateHistory = new FundingRateClient(this._markets);\n this._editCollateralSimulation = new EditCollateralSimulationClient(\n ApiClient.network,\n this._account,\n );\n this._depositExistingMASimulation = new DepositExistingMASimulationClient(\n this._editCollateralSimulation,\n ApiClient.config.apiEndpoint,\n );\n this._depositNewMASimulation = new DepositNewMASimulationClient(\n this._depositExistingMASimulation,\n );\n this._depositPassivePoolSimulation = new DepositPassivePoolSimulationClient(\n ApiClient.config.apiEndpoint,\n );\n this._withdrawMASimulation = new WithdrawMASimulationClient(\n this._editCollateralSimulation,\n ApiClient.config.chain,\n );\n this._transferMarginBetweenMAsSimulation =\n new TransferMarginBetweenMAsSimulationClient(\n ApiClient.network,\n this._account,\n );\n this._transferMAPoolSimulation = new TransferMAPoolSimulationClient(\n this._editCollateralSimulation,\n );\n\n this._depthSimulation = new DepthChartSimulationClient(this._lp);\n this._tokens = new TokensClient(ApiClient.config.apiEndpoint);\n this._owner = new OwnerClient(ApiClient.config.apiEndpoint);\n }\n\n public static configure(environment: ServiceConfig['environment']): void {\n ApiClient.config =\n API_CLIENT_CONFIGS[environment] || API_CLIENT_CONFIGS['test'];\n ApiClient.instance = new ApiClient();\n }\n\n private static getInstance(): ApiClient {\n if (!ApiClient.instance) {\n throw new Error(\n 'ApiClient is not configured. Please configure it before using.',\n );\n }\n return ApiClient.instance;\n }\n public static get network(): ReyaChainId {\n if (!ApiClient.config.chain) {\n throw new Error('ApiClient is not configured');\n }\n return ApiClient.config.chain;\n }\n\n /**\n * Provides access to the MarketsClient instance.\n * This getter allows for interacting with market-related API functionalities.\n *\n * @returns {MarketsClient} An instance of MarketsClient for market-related operations.\n * @memberof ApiClient\n */\n public static get markets(): MarketsClient {\n return ApiClient.getInstance()._markets;\n }\n\n /**\n * Provides access to the AccountClient instance.\n * This getter allows for interacting with account-related API functionalities.\n *\n * @returns {AccountClient} An instance of AccountClient for account-related operations.\n * @memberof ApiClient\n */\n public static get account(): AccountClient {\n return ApiClient.getInstance()._account;\n }\n\n /**\n * Provides access to the TradeSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_tradeSimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {TradeSimulationClient} An instance of TradeSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the trade simulation client from the ApiClient\n * const tradeSimulationClient = ApiClient.tradeSimulation;\n */\n\n public static get tradeSimulation(): TradeSimulationClient {\n return ApiClient.getInstance()._tradeSimulation;\n }\n\n public static get fundingRateHistory(): FundingRateClient {\n return ApiClient.getInstance()._fundingRateHistory;\n }\n\n /**\n * Retrieves the DepthChartSimulationClient instance used for depth simulation.\n * This method provides access to the depth simulation client through the ApiClient.\n * @returns {DepthChartSimulationClient} The DepthChartSimulationClient instance.\n * @static\n * @public\n */\n public static get depthSimulation(): DepthChartSimulationClient {\n return ApiClient.getInstance()._depthSimulation;\n }\n\n /**\n * Provides access to the EditCollateralSimulationClient instance.\n * This getter allows for interacting with edit collateral simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_editCollateralSimulation` property, ensuring that edit collateral simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {EditCollateralSimulationClient} An instance of EditCollateralSimulationClient for edit collateral simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the edit collateral simulation client from the ApiClient\n * const editCollateralSimulationClient = ApiClient.editCollateralSimulation;\n */\n\n public static get editCollateralSimulationClient(): EditCollateralSimulationClient {\n return ApiClient.getInstance()._editCollateralSimulation;\n }\n\n /**\n * Provides access to the DepositExistingMASimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_depositExistingMASimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {DepositExistingMASimulationClient} An instance of DepositExistingMASimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the deposit existing Ma simulation client from the ApiClient\n * const depositExistingMASimulationClient = ApiClient.depositExistingMASimulation;\n */\n\n public static get depositExistingMASimulation(): DepositExistingMASimulationClient {\n return ApiClient.getInstance()._depositExistingMASimulation;\n }\n\n /**\n * Provides access to the DepositNewMASimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_depositNewMASimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {DepositNewMASimulationClient} An instance of DepositNewMASimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the deposit new MA simulation client from the ApiClient\n * const depositNewMASimulationClient = ApiClient.depositNewMASimulation;\n */\n\n public static get depositNewMASimulation(): DepositNewMASimulationClient {\n return ApiClient.getInstance()._depositNewMASimulation;\n }\n\n /**\n * Provides access to the DepositPassivePoolSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_depositPassivePoolSimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {DepositPassivePoolSimulationClient} An instance of DepositPassivePoolSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the deposit existing Ma simulation client from the ApiClient\n * const depositPassivePoolSimulationClient = ApiClient.depositPassivePoolSimulation;\n */\n\n public static get depositPassivePoolSimulation(): DepositPassivePoolSimulationClient {\n return ApiClient.getInstance()._depositPassivePoolSimulation;\n }\n\n /**\n * Provides access to the WithdrawMASimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_withdrawMASimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {WithdrawMASimulationClient} An instance of WithrawMASimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the withdraw MA simulation client from the ApiClient\n * const withdrawMASimulationClient = ApiClient.withdrawMASimulation;\n */\n\n public static get withdrawMASimulation(): WithdrawMASimulationClient {\n return ApiClient.getInstance()._withdrawMASimulation;\n }\n\n /**\n * Provides access to the TransferMarginBetweenMAsSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_transferMarginBetweenMAsSimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {TransferMarginBetweenMAsSimulationClient} An instance of TransferMarginBetweenMAsSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the transfer margin between MAs simulation client from the ApiClient\n * const transferMarginBetweenMAsSimulationClient = ApiClient.transferMarginBetweenMAsSimulation;\n */\n\n public static get transferMarginBetweenMAsSimulation(): TransferMarginBetweenMAsSimulationClient {\n return ApiClient.getInstance()._transferMarginBetweenMAsSimulation;\n }\n\n /**\n * Provides access to the TransferMAPoolSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_TransferMAPoolSimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {TransferMAPoolSimulationClient} An instance of TransferMAPoolSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the transfer from MA to Pool simulation client from the ApiClient\n * const transferMAPoolSimulationClient = ApiClient.transferMAPoolSimulation;\n */\n\n public static get transferMAPoolSimulation(): TransferMAPoolSimulationClient {\n return ApiClient.getInstance()._transferMAPoolSimulation;\n }\n\n /**\n * Gets the current instance of the LpClient from the ApiClient.\n *\n * This static getter allows access to the LpClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the LpClient directly, bypassing the need to manually access the internal `_lp` property of the ApiClient instance.\n *\n * @returns {LpClient} The LpClient instance currently held by the ApiClient.\n * @example\n * // Assuming ApiClient and LpClient are properly set up\n * const lpClient = ApiClient.lp;\n */\n public static get lp(): LpClient {\n return ApiClient.getInstance()._lp;\n }\n\n /**\n * Gets the current instance of the TokensClient from the ApiClient.\n *\n * This static getter allows access to the TokensClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the TokensClient directly, bypassing the need to manually access the internal `_tokens` property of the ApiClient instance.\n *\n * @returns {TokensClient} The TokensClient instance currently held by the ApiClient.\n * @example\n * // Assuming ApiClient and TokensClient are properly set up\n * const tokensClient = ApiClient.tokens;\n */\n public static get tokens(): TokensClient {\n return ApiClient.getInstance()._tokens;\n }\n\n /**\n * Gets the current instance of the OwnerClient from the ApiClient.\n *\n * This static getter allows access to the OwnerClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the OwnerClient directly, bypassing the need to manually access the internal `_owner` property of the ApiClient instance.\n *\n * @returns {OwnerClient} The OwnerClient instance currently held by the ApiClient.\n * @example\n * // Assuming ApiClient and OwnerClient are properly set up\n * const ownerClient = ApiClient.tokens;\n */\n public static get owner(): OwnerClient {\n return ApiClient.getInstance()._owner;\n }\n}\n"]}
1
+ {"version":3,"file":"api-client.js","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":";;;;;;AAAA,0CAIyB;AACzB,8DAA8C;AAC9C,8DAA8C;AAC9C,gFAA+D;AAC/D,oDAAoC;AACpC,4DAA4C;AAC5C,0DAA0C;AAC1C,oGAAkF;AAClF,4GAAyF;AACzF,kGAA+E;AAC/E,8GAA2F;AAC3F,4FAA0E;AAC1E,gHAA6F;AAC7F,4HAAwG;AACxG,sGAAmF;AACnF,4FAA0E;AAC1E,wEAAuD;AAEvD;;GAEG;AACH;IAoBE;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,GAAG,GAAG,IAAI,YAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACtD,IAAI,CAAC,gBAAgB,GAAG,IAAI,0BAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjE,IAAI,CAAC,mBAAmB,GAAG,IAAI,sBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChE,IAAI,CAAC,yBAAyB,GAAG,IAAI,oCAA8B,CACjE,SAAS,CAAC,OAAO,EACjB,IAAI,CAAC,QAAQ,CACd,CAAC;QACF,IAAI,CAAC,4BAA4B,GAAG,IAAI,wCAAiC,CACvE,IAAI,CAAC,yBAAyB,EAC9B,SAAS,CAAC,MAAM,CAAC,WAAW,CAC7B,C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FIGS,\n ServiceConfig,\n ReyaChainId,\n} from '@reyaxyz/common';\nimport MarketsClient from './modules/markets';\nimport AccountClient from './modules/account';\nimport TradeSimulationClient from './modules/trade.simulation';\nimport LpClient from './modules/lp';\nimport TokensClient from './modules/tokens';\nimport OwnerClient from './modules/owner';\nimport EditCollateralSimulationClient from './modules/edit-collateral.simulation';\nimport DepositExistingMASimulationClient from './modules/deposit-existing-MA.simulation';\nimport DepositNewMASimulationClient from './modules/deposit-new-MA.simulation';\nimport DepositPassivePoolSimulationClient from './modules/deposit-passive-pool.simulation';\nimport WithdrawMASimulationClient from './modules/withdraw-MA.simulation';\nimport WithdrawPassivePoolSimulationClient from './modules/withdraw-passive-pool.simulation';\nimport TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-between-MAs.simulation';\nimport TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';\nimport DepthChartSimulationClient from './modules/depth-chart.simulation';\nimport FundingRateClient from './modules/funding-rate';\n\n/**\n * @description Client for API\n */\nexport class ApiClient {\n private static instance: ApiClient;\n private static config: ServiceConfig = API_CLIENT_CONFIGS['test'];\n private readonly _markets: MarketsClient;\n private readonly _account: AccountClient;\n private readonly _lp: LpClient;\n private readonly _tradeSimulation: TradeSimulationClient;\n private readonly _fundingRateHistory: FundingRateClient;\n private readonly _editCollateralSimulation: EditCollateralSimulationClient;\n private readonly _depositExistingMASimulation: DepositExistingMASimulationClient;\n private readonly _depositNewMASimulation: DepositNewMASimulationClient;\n private readonly _depositPassivePoolSimulation: DepositPassivePoolSimulationClient;\n private readonly _withdrawMASimulation: WithdrawMASimulationClient;\n private readonly _withdrawPassivePoolSimulation: WithdrawPassivePoolSimulationClient;\n private readonly _transferMarginBetweenMAsSimulation: TransferMarginBetweenMAsSimulationClient;\n private readonly _transferMAPoolSimulation: TransferMAPoolSimulationClient;\n private readonly _depthSimulation: DepthChartSimulationClient;\n private readonly _tokens: TokensClient;\n private readonly _owner: OwnerClient;\n\n private constructor() {\n this._markets = new MarketsClient(ApiClient.config.apiEndpoint);\n this._account = new AccountClient(ApiClient.config.apiEndpoint);\n this._lp = new LpClient(ApiClient.config.apiEndpoint);\n this._tradeSimulation = new TradeSimulationClient(this._account);\n this._fundingRateHistory = new FundingRateClient(this._markets);\n this._editCollateralSimulation = new EditCollateralSimulationClient(\n ApiClient.network,\n this._account,\n );\n this._depositExistingMASimulation = new DepositExistingMASimulationClient(\n this._editCollateralSimulation,\n ApiClient.config.apiEndpoint,\n );\n this._depositNewMASimulation = new DepositNewMASimulationClient(\n this._depositExistingMASimulation,\n );\n this._depositPassivePoolSimulation = new DepositPassivePoolSimulationClient(\n ApiClient.config.apiEndpoint,\n );\n this._withdrawMASimulation = new WithdrawMASimulationClient(\n this._editCollateralSimulation,\n ApiClient.config.chain,\n ApiClient.config.apiEndpoint,\n );\n this._withdrawPassivePoolSimulation =\n new WithdrawPassivePoolSimulationClient(\n ApiClient.config.chain,\n ApiClient.config.apiEndpoint,\n );\n this._transferMarginBetweenMAsSimulation =\n new TransferMarginBetweenMAsSimulationClient(\n ApiClient.network,\n this._account,\n );\n this._transferMAPoolSimulation = new TransferMAPoolSimulationClient(\n this._editCollateralSimulation,\n );\n\n this._depthSimulation = new DepthChartSimulationClient(this._lp);\n this._tokens = new TokensClient(ApiClient.config.apiEndpoint);\n this._owner = new OwnerClient(ApiClient.config.apiEndpoint);\n }\n\n public static configure(environment: ServiceConfig['environment']): void {\n ApiClient.config =\n API_CLIENT_CONFIGS[environment] || API_CLIENT_CONFIGS['test'];\n ApiClient.instance = new ApiClient();\n }\n\n private static getInstance(): ApiClient {\n if (!ApiClient.instance) {\n throw new Error(\n 'ApiClient is not configured. Please configure it before using.',\n );\n }\n return ApiClient.instance;\n }\n public static get network(): ReyaChainId {\n if (!ApiClient.config.chain) {\n throw new Error('ApiClient is not configured');\n }\n return ApiClient.config.chain;\n }\n\n /**\n * Provides access to the MarketsClient instance.\n * This getter allows for interacting with market-related API functionalities.\n *\n * @returns {MarketsClient} An instance of MarketsClient for market-related operations.\n * @memberof ApiClient\n */\n public static get markets(): MarketsClient {\n return ApiClient.getInstance()._markets;\n }\n\n /**\n * Provides access to the AccountClient instance.\n * This getter allows for interacting with account-related API functionalities.\n *\n * @returns {AccountClient} An instance of AccountClient for account-related operations.\n * @memberof ApiClient\n */\n public static get account(): AccountClient {\n return ApiClient.getInstance()._account;\n }\n\n /**\n * Provides access to the TradeSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_tradeSimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {TradeSimulationClient} An instance of TradeSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the trade simulation client from the ApiClient\n * const tradeSimulationClient = ApiClient.tradeSimulation;\n */\n\n public static get tradeSimulation(): TradeSimulationClient {\n return ApiClient.getInstance()._tradeSimulation;\n }\n\n public static get fundingRateHistory(): FundingRateClient {\n return ApiClient.getInstance()._fundingRateHistory;\n }\n\n /**\n * Retrieves the DepthChartSimulationClient instance used for depth simulation.\n * This method provides access to the depth simulation client through the ApiClient.\n * @returns {DepthChartSimulationClient} The DepthChartSimulationClient instance.\n * @static\n * @public\n */\n public static get depthSimulation(): DepthChartSimulationClient {\n return ApiClient.getInstance()._depthSimulation;\n }\n\n /**\n * Provides access to the EditCollateralSimulationClient instance.\n * This getter allows for interacting with edit collateral simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_editCollateralSimulation` property, ensuring that edit collateral simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {EditCollateralSimulationClient} An instance of EditCollateralSimulationClient for edit collateral simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the edit collateral simulation client from the ApiClient\n * const editCollateralSimulationClient = ApiClient.editCollateralSimulation;\n */\n\n public static get editCollateralSimulationClient(): EditCollateralSimulationClient {\n return ApiClient.getInstance()._editCollateralSimulation;\n }\n\n /**\n * Provides access to the DepositExistingMASimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_depositExistingMASimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {DepositExistingMASimulationClient} An instance of DepositExistingMASimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the deposit existing Ma simulation client from the ApiClient\n * const depositExistingMASimulationClient = ApiClient.depositExistingMASimulation;\n */\n\n public static get depositExistingMASimulation(): DepositExistingMASimulationClient {\n return ApiClient.getInstance()._depositExistingMASimulation;\n }\n\n /**\n * Provides access to the DepositNewMASimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_depositNewMASimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {DepositNewMASimulationClient} An instance of DepositNewMASimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the deposit new MA simulation client from the ApiClient\n * const depositNewMASimulationClient = ApiClient.depositNewMASimulation;\n */\n\n public static get depositNewMASimulation(): DepositNewMASimulationClient {\n return ApiClient.getInstance()._depositNewMASimulation;\n }\n\n /**\n * Provides access to the DepositPassivePoolSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_depositPassivePoolSimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {DepositPassivePoolSimulationClient} An instance of DepositPassivePoolSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the deposit existing Ma simulation client from the ApiClient\n * const depositPassivePoolSimulationClient = ApiClient.depositPassivePoolSimulation;\n */\n\n public static get depositPassivePoolSimulation(): DepositPassivePoolSimulationClient {\n return ApiClient.getInstance()._depositPassivePoolSimulation;\n }\n\n /**\n * Provides access to the WithdrawMASimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_withdrawMASimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {WithdrawMASimulationClient} An instance of WithdrawMASimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the withdraw MA simulation client from the ApiClient\n * const withdrawMASimulationClient = ApiClient.withdrawMASimulation;\n */\n\n public static get withdrawMASimulation(): WithdrawMASimulationClient {\n return ApiClient.getInstance()._withdrawMASimulation;\n }\n\n /**\n * Provides access to the WithdrawPassivePoolSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_withdrawPassivePoolSimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {WithdrawPassivePoolSimulationClient} An instance of WithdrawPassivePoolSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the withdraw MA simulation client from the ApiClient\n * const withdrawPassivePoolSimulationClient = ApiClient.withdrawPassivePoolSimulation;\n */\n\n public static get withdrawPassivePoolSimulation(): WithdrawPassivePoolSimulationClient {\n return ApiClient.getInstance()._withdrawPassivePoolSimulation;\n }\n\n /**\n * Provides access to the TransferMarginBetweenMAsSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_transferMarginBetweenMAsSimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {TransferMarginBetweenMAsSimulationClient} An instance of TransferMarginBetweenMAsSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the transfer margin between MAs simulation client from the ApiClient\n * const transferMarginBetweenMAsSimulationClient = ApiClient.transferMarginBetweenMAsSimulation;\n */\n\n public static get transferMarginBetweenMAsSimulation(): TransferMarginBetweenMAsSimulationClient {\n return ApiClient.getInstance()._transferMarginBetweenMAsSimulation;\n }\n\n /**\n * Provides access to the TransferMAPoolSimulationClient instance.\n * This getter allows for interacting with trade simulation functionalities.\n * It ensures a singleton pattern by fetching the instance from the ApiClient's\n * private `_TransferMAPoolSimulation` property, ensuring that trade simulation operations\n * use a consistent client configuration and state.\n *\n * @returns {TransferMAPoolSimulationClient} An instance of TransferMAPoolSimulationClient for trade simulation operations.\n * @memberof ApiClient\n * @example\n * // Access the transfer from MA to Pool simulation client from the ApiClient\n * const transferMAPoolSimulationClient = ApiClient.transferMAPoolSimulation;\n */\n\n public static get transferMAPoolSimulation(): TransferMAPoolSimulationClient {\n return ApiClient.getInstance()._transferMAPoolSimulation;\n }\n\n /**\n * Gets the current instance of the LpClient from the ApiClient.\n *\n * This static getter allows access to the LpClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the LpClient directly, bypassing the need to manually access the internal `_lp` property of the ApiClient instance.\n *\n * @returns {LpClient} The LpClient instance currently held by the ApiClient.\n * @example\n * // Assuming ApiClient and LpClient are properly set up\n * const lpClient = ApiClient.lp;\n */\n public static get lp(): LpClient {\n return ApiClient.getInstance()._lp;\n }\n\n /**\n * Gets the current instance of the TokensClient from the ApiClient.\n *\n * This static getter allows access to the TokensClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the TokensClient directly, bypassing the need to manually access the internal `_tokens` property of the ApiClient instance.\n *\n * @returns {TokensClient} The TokensClient instance currently held by the ApiClient.\n * @example\n * // Assuming ApiClient and TokensClient are properly set up\n * const tokensClient = ApiClient.tokens;\n */\n public static get tokens(): TokensClient {\n return ApiClient.getInstance()._tokens;\n }\n\n /**\n * Gets the current instance of the OwnerClient from the ApiClient.\n *\n * This static getter allows access to the OwnerClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the OwnerClient directly, bypassing the need to manually access the internal `_owner` property of the ApiClient instance.\n *\n * @returns {OwnerClient} The OwnerClient instance currently held by the ApiClient.\n * @example\n * // Assuming ApiClient and OwnerClient are properly set up\n * const ownerClient = ApiClient.tokens;\n */\n public static get owner(): OwnerClient {\n return ApiClient.getInstance()._owner;\n }\n}\n"]}
@@ -85,16 +85,16 @@ var DepositExistingMASimulationClient = /** @class */ (function (_super) {
85
85
  DepositExistingMASimulationClient.prototype.simulate = function (params) {
86
86
  var moneyInOutChainId = params.moneyInOutChainId;
87
87
  var tokenInfo = (0, common_1.getTokenInfoByAddress)(params.tokenAddress, moneyInOutChainId);
88
- var socketDpositFeesRow = this.socketDepositFeesList.find(function (socketDepositFeesRow) {
89
- return socketDepositFeesRow.moneyInOutChainId === moneyInOutChainId &&
90
- socketDepositFeesRow.tokenName === tokenInfo.name;
88
+ var socketDepositFeesEntry = this.socketDepositFeesList.find(function (socketDepositFeesEntry) {
89
+ return socketDepositFeesEntry.moneyInOutChainId === moneyInOutChainId &&
90
+ socketDepositFeesEntry.tokenName === tokenInfo.name;
91
91
  });
92
- if (!socketDpositFeesRow) {
92
+ if (!socketDepositFeesEntry) {
93
93
  throw new Error("Socket deposit fees for chain ".concat(moneyInOutChainId, " and token ").concat(tokenInfo.name, " not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)"));
94
94
  }
95
95
  var socketDepositFees = {
96
- fees: socketDpositFeesRow.fees,
97
- feesInUnderlyingToken: (0, common_1.descale)(18)(socketDpositFeesRow.fees),
96
+ fees: socketDepositFeesEntry.fees,
97
+ feesInUnderlyingToken: (0, common_1.descale)(18)(socketDepositFeesEntry.fees),
98
98
  underlyingTokenName: (0, common_2.getNativeToken)(moneyInOutChainId),
99
99
  };
100
100
  var simulateEditCollateralEntity = this.editCollateralClient.simulate({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAOyB;AAOzB,0CAAiD;AAEjD;IAA+D,qDAAU;IAIvE,2CACE,oBAA0C,EAC1C,IAAY,EACZ,UAA0B;QAE1B,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QAPlB,2BAAqB,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,EAAE,MAAM,CAAC,MAAM;YAC3B,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CAAC;QAEH,IAAM,cAAc,GAAG,IAAA,4BAAmB,EAAC;YACzC,iBAAiB,EAAE,iBAAiB;SACrC,CAAC,CAAC,cAAc,CAAC;QAElB,OAAO;YACL,iBAAiB,EAAE,iBAAiB;YACpC,cAAc,EAAE,cAAc;YAC9B,WAAW,EAAE,4BAA4B,CAAC,WAAW;YACrD,iBAAiB,EAAE,4BAA4B,CAAC,iBAAiB;SAClE,CAAC;IACJ,CAAC;IACH,wCAAC;AAAD,CAAC,AAjED,CAA+D,mBAAU,GAiExE","sourcesContent":["import {\n descale,\n getSocketBridgeTime,\n getTokenInfoByAddress,\n RestClient,\n SocketDepositFees,\n SocketDepositFeesRow,\n} from '@reyaxyz/common';\nimport EditCollateralClient from '../edit-collateral.simulation';\nimport {\n DepositExistingMASimulationLoadDataParams,\n DepositExistingMASimulationSimulateParams,\n SimulateDepositExistingMAEntity,\n} from './types';\nimport { getNativeToken } from '@reyaxyz/common';\n\nexport default class DepositExistingMASimulationClient extends RestClient {\n private editCollateralClient: EditCollateralClient;\n private socketDepositFeesList: SocketDepositFeesRow[] = [];\n\n constructor(\n editCollateralClient: EditCollateralClient,\n host: string,\n apiTimeout?: number | null,\n ) {\n super(host, apiTimeout);\n this.editCollateralClient = editCollateralClient;\n }\n\n // Method to asynchronously load data based on accountId\n async arm(params: DepositExistingMASimulationLoadDataParams): Promise<void> {\n await this.editCollateralClient.arm({\n marginAccountId: params.marginAccountId,\n });\n\n this.socketDepositFeesList = await this.get<SocketDepositFeesRow[]>(\n `/api/socket/deposit-fees`,\n );\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: DepositExistingMASimulationSimulateParams,\n ): SimulateDepositExistingMAEntity {\n const moneyInOutChainId = params.moneyInOutChainId;\n const tokenInfo = getTokenInfoByAddress(\n params.tokenAddress,\n moneyInOutChainId,\n );\n const socketDpositFeesRow = this.socketDepositFeesList.find(\n (socketDepositFeesRow) =>\n socketDepositFeesRow.moneyInOutChainId === moneyInOutChainId &&\n socketDepositFeesRow.tokenName === tokenInfo.name,\n );\n if (!socketDpositFeesRow) {\n throw new Error(\n `Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,\n );\n }\n const socketDepositFees: SocketDepositFees = {\n fees: socketDpositFeesRow.fees,\n feesInUnderlyingToken: descale(18)(socketDpositFeesRow.fees),\n underlyingTokenName: getNativeToken(moneyInOutChainId),\n };\n\n const simulateEditCollateralEntity = this.editCollateralClient.simulate({\n signedAmount: params.amount,\n tokenAddress: params.tokenAddress,\n });\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: moneyInOutChainId,\n }).bridgeTimeInMS;\n\n return {\n socketDepositFees: socketDepositFees,\n bridgeTimeInMS: bridgeTimeInMS,\n marginRatio: simulateEditCollateralEntity.marginRatio,\n marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAOyB;AAOzB,0CAAiD;AAEjD;IAA+D,qDAAU;IAIvE,2CACE,oBAA0C,EAC1C,IAAY,EACZ,UAA0B;QAE1B,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QAPlB,2BAAqB,GAA6B,EAAE,CAAC;QAQ3D,KAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;;IACnD,CAAC;IAED,wDAAwD;IAClD,+CAAG,GAAT,UAAU,MAAiD;;;;;4BACzD,qBAAM,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC;4BAClC,eAAe,EAAE,MAAM,CAAC,eAAe;yBACxC,CAAC,EAAA;;wBAFF,SA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C9B,WAAW,EAAE,4BAA4B,CAAC,WAAW;YACrD,iBAAiB,EAAE,4BAA4B,CAAC,iBAAiB;SAClE,CAAC;IACJ,CAAC;IACH,wCAAC;AAAD,CAAC,AAjED,CAA+D,mBAAU,GAiExE","sourcesContent":["import {\n descale,\n getSocketBridgeTime,\n getTokenInfoByAddress,\n RestClient,\n SocketDepositFees,\n SocketDepositFeesEntry,\n} from '@reyaxyz/common';\nimport EditCollateralClient from '../edit-collateral.simulation';\nimport {\n DepositExistingMASimulationLoadDataParams,\n DepositExistingMASimulationSimulateParams,\n SimulateDepositExistingMAEntity,\n} from './types';\nimport { getNativeToken } from '@reyaxyz/common';\n\nexport default class DepositExistingMASimulationClient extends RestClient {\n private editCollateralClient: EditCollateralClient;\n private socketDepositFeesList: SocketDepositFeesEntry[] = [];\n\n constructor(\n editCollateralClient: EditCollateralClient,\n host: string,\n apiTimeout?: number | null,\n ) {\n super(host, apiTimeout);\n this.editCollateralClient = editCollateralClient;\n }\n\n // Method to asynchronously load data based on accountId\n async arm(params: DepositExistingMASimulationLoadDataParams): Promise<void> {\n await this.editCollateralClient.arm({\n marginAccountId: params.marginAccountId,\n });\n\n this.socketDepositFeesList = await this.get<SocketDepositFeesEntry[]>(\n `/api/socket/deposit-fees`,\n );\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: DepositExistingMASimulationSimulateParams,\n ): SimulateDepositExistingMAEntity {\n const moneyInOutChainId = params.moneyInOutChainId;\n const tokenInfo = getTokenInfoByAddress(\n params.tokenAddress,\n moneyInOutChainId,\n );\n const socketDepositFeesEntry = this.socketDepositFeesList.find(\n (socketDepositFeesEntry) =>\n socketDepositFeesEntry.moneyInOutChainId === moneyInOutChainId &&\n socketDepositFeesEntry.tokenName === tokenInfo.name,\n );\n if (!socketDepositFeesEntry) {\n throw new Error(\n `Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,\n );\n }\n const socketDepositFees: SocketDepositFees = {\n fees: socketDepositFeesEntry.fees,\n feesInUnderlyingToken: descale(18)(socketDepositFeesEntry.fees),\n underlyingTokenName: getNativeToken(moneyInOutChainId),\n };\n\n const simulateEditCollateralEntity = this.editCollateralClient.simulate({\n signedAmount: params.amount,\n tokenAddress: params.tokenAddress,\n });\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: moneyInOutChainId,\n }).bridgeTimeInMS;\n\n return {\n socketDepositFees: socketDepositFees,\n bridgeTimeInMS: bridgeTimeInMS,\n marginRatio: simulateEditCollateralEntity.marginRatio,\n marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,\n };\n }\n}\n"]}
@@ -80,16 +80,16 @@ var DepositPassivePoolSimulationClient = /** @class */ (function (_super) {
80
80
  DepositPassivePoolSimulationClient.prototype.simulate = function (params) {
81
81
  var moneyInOutChainId = params.moneyInOutChainId;
82
82
  var tokenInfo = (0, common_1.getRUSDUnderlyingTokenInfo)(moneyInOutChainId);
83
- var socketDpositFeesRow = this.socketDepositFeesList.find(function (socketDepositFeesRow) {
84
- return socketDepositFeesRow.moneyInOutChainId === moneyInOutChainId &&
85
- socketDepositFeesRow.tokenName === tokenInfo.name;
83
+ var socketDepositFeesEntry = this.socketDepositFeesList.find(function (socketDepositFeesEntry) {
84
+ return socketDepositFeesEntry.moneyInOutChainId === moneyInOutChainId &&
85
+ socketDepositFeesEntry.tokenName === tokenInfo.name;
86
86
  });
87
- if (!socketDpositFeesRow) {
87
+ if (!socketDepositFeesEntry) {
88
88
  throw new Error("Socket deposit fees for chain ".concat(moneyInOutChainId, " and token ").concat(tokenInfo.name, " not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)"));
89
89
  }
90
90
  var socketDepositFees = {
91
- fees: socketDpositFeesRow.fees,
92
- feesInUnderlyingToken: (0, common_1.descale)(18)(socketDpositFeesRow.fees),
91
+ fees: socketDepositFeesEntry.fees,
92
+ feesInUnderlyingToken: (0, common_1.descale)(18)(socketDepositFeesEntry.fees),
93
93
  underlyingTokenName: (0, common_2.getNativeToken)(moneyInOutChainId),
94
94
  };
95
95
  var bridgeTimeInMS = (0, common_1.getSocketBridgeTime)({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/deposit-passive-pool.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAOyB;AAKzB,0CAAiD;AAEjD;IAAgE,sDAAU;IAGxE,4CAAY,IAAY,EAAE,UAA0B;QAClD,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QAHlB,2BAAqB,GAA2B,EAAE,CAAC;;IAI3D,CAAC;IAED,wDAAwD;IAClD,gDAAG,GAAT;;;;;;wBACE,KAAA,IAAI,CAAA;wBAAyB,qBAAM,IAAI,CAAC,GAAG,CACzC,0BAA0B,CAC3B,EAAA;;wBAFD,GAAK,qBAAqB,GAAG,SAE5B,CAAC;;;;;KACH;IAED,+DAA+D;IAC/D,qDAAQ,GAAR,UACE,MAAkD;QAElD,IAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,IAAM,SAAS,GAAG,IAAA,mCAA0B,EAAC,iBAAiB,CAAC,CAAC;QAChE,IAAM,mBAAmB,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CACzD,UAAC,oBAAoB;YACnB,OAAA,oBAAoB,CAAC,iBAAiB,KAAK,iBAAiB;gBAC5D,oBAAoB,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI;QADjD,CACiD,CACpD,CAAC;QACF,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,wCAAiC,iBAAiB,wBAAc,SAAS,CAAC,IAAI,iGAA8F,CAC7K,CAAC;QACJ,CAAC;QACD,IAAM,iBAAiB,GAAsB;YAC3C,IAAI,EAAE,mBAAmB,CAAC,IAAI;YAC9B,qBAAqB,EAAE,IAAA,gBAAO,EAAC,EAAE,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC;YAC5D,mBAAmB,EAAE,IAAA,uBAAc,EAAC,iBAAiB,CAAC;SACvD,CAAC;QAEF,IAAM,cAAc,GAAG,IAAA,4BAAmB,EAAC;YACzC,iBAAiB,EAAE,iBAAiB;SACrC,CAAC,CAAC,cAAc,CAAC;QAElB,OAAO;YACL,iBAAiB,EAAE,iBAAiB;YACpC,cAAc,EAAE,cAAc;SAC/B,CAAC;IACJ,CAAC;IACH,yCAAC;AAAD,CAAC,AA7CD,CAAgE,mBAAU,GA6CzE","sourcesContent":["import {\n descale,\n getRUSDUnderlyingTokenInfo,\n getSocketBridgeTime,\n RestClient,\n SocketDepositFees,\n SocketDepositFeesRow,\n} from '@reyaxyz/common';\nimport {\n DepositPassivePoolSimulationSimulateParams,\n SimulateDepositPassivePoolEntity,\n} from './types';\nimport { getNativeToken } from '@reyaxyz/common';\n\nexport default class DepositPassivePoolSimulationClient extends RestClient {\n private socketDepositFeesList: SocketDepositFeesRow[] = [];\n\n constructor(host: string, apiTimeout?: number | null) {\n super(host, apiTimeout);\n }\n\n // Method to asynchronously load data based on accountId\n async arm(): Promise<void> {\n this.socketDepositFeesList = await this.get<SocketDepositFeesRow[]>(\n `/api/socket/deposit-fees`,\n );\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: DepositPassivePoolSimulationSimulateParams,\n ): SimulateDepositPassivePoolEntity {\n const moneyInOutChainId = params.moneyInOutChainId;\n const tokenInfo = getRUSDUnderlyingTokenInfo(moneyInOutChainId);\n const socketDpositFeesRow = this.socketDepositFeesList.find(\n (socketDepositFeesRow) =>\n socketDepositFeesRow.moneyInOutChainId === moneyInOutChainId &&\n socketDepositFeesRow.tokenName === tokenInfo.name,\n );\n if (!socketDpositFeesRow) {\n throw new Error(\n `Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,\n );\n }\n const socketDepositFees: SocketDepositFees = {\n fees: socketDpositFeesRow.fees,\n feesInUnderlyingToken: descale(18)(socketDpositFeesRow.fees),\n underlyingTokenName: getNativeToken(moneyInOutChainId),\n };\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: moneyInOutChainId,\n }).bridgeTimeInMS;\n\n return {\n socketDepositFees: socketDepositFees,\n bridgeTimeInMS: bridgeTimeInMS,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/deposit-passive-pool.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAOyB;AAKzB,0CAAiD;AAEjD;IAAgE,sDAAU;IAGxE,4CAAY,IAAY,EAAE,UAA0B;QAClD,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QAHlB,2BAAqB,GAA6B,EAAE,CAAC;;IAI7D,CAAC;IAED,wDAAwD;IAClD,gDAAG,GAAT;;;;;;wBACE,KAAA,IAAI,CAAA;wBAAyB,qBAAM,IAAI,CAAC,GAAG,CACzC,0BAA0B,CAC3B,EAAA;;wBAFD,GAAK,qBAAqB,GAAG,SAE5B,CAAC;;;;;KACH;IAED,+DAA+D;IAC/D,qDAAQ,GAAR,UACE,MAAkD;QAElD,IAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,IAAM,SAAS,GAAG,IAAA,mCAA0B,EAAC,iBAAiB,CAAC,CAAC;QAChE,IAAM,sBAAsB,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAC5D,UAAC,sBAAsB;YACrB,OAAA,sBAAsB,CAAC,iBAAiB,KAAK,iBAAiB;gBAC9D,sBAAsB,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI;QADnD,CACmD,CACtD,CAAC;QACF,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CACb,wCAAiC,iBAAiB,wBAAc,SAAS,CAAC,IAAI,iGAA8F,CAC7K,CAAC;QACJ,CAAC;QACD,IAAM,iBAAiB,GAAsB;YAC3C,IAAI,EAAE,sBAAsB,CAAC,IAAI;YACjC,qBAAqB,EAAE,IAAA,gBAAO,EAAC,EAAE,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC;YAC/D,mBAAmB,EAAE,IAAA,uBAAc,EAAC,iBAAiB,CAAC;SACvD,CAAC;QAEF,IAAM,cAAc,GAAG,IAAA,4BAAmB,EAAC;YACzC,iBAAiB,EAAE,iBAAiB;SACrC,CAAC,CAAC,cAAc,CAAC;QAElB,OAAO;YACL,iBAAiB,EAAE,iBAAiB;YACpC,cAAc,EAAE,cAAc;SAC/B,CAAC;IACJ,CAAC;IACH,yCAAC;AAAD,CAAC,AA7CD,CAAgE,mBAAU,GA6CzE","sourcesContent":["import {\n descale,\n getRUSDUnderlyingTokenInfo,\n getSocketBridgeTime,\n RestClient,\n SocketDepositFees,\n SocketDepositFeesEntry,\n} from '@reyaxyz/common';\nimport {\n DepositPassivePoolSimulationSimulateParams,\n SimulateDepositPassivePoolEntity,\n} from './types';\nimport { getNativeToken } from '@reyaxyz/common';\n\nexport default class DepositPassivePoolSimulationClient extends RestClient {\n private socketDepositFeesList: SocketDepositFeesEntry[] = [];\n\n constructor(host: string, apiTimeout?: number | null) {\n super(host, apiTimeout);\n }\n\n // Method to asynchronously load data based on accountId\n async arm(): Promise<void> {\n this.socketDepositFeesList = await this.get<SocketDepositFeesEntry[]>(\n `/api/socket/deposit-fees`,\n );\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: DepositPassivePoolSimulationSimulateParams,\n ): SimulateDepositPassivePoolEntity {\n const moneyInOutChainId = params.moneyInOutChainId;\n const tokenInfo = getRUSDUnderlyingTokenInfo(moneyInOutChainId);\n const socketDepositFeesEntry = this.socketDepositFeesList.find(\n (socketDepositFeesEntry) =>\n socketDepositFeesEntry.moneyInOutChainId === moneyInOutChainId &&\n socketDepositFeesEntry.tokenName === tokenInfo.name,\n );\n if (!socketDepositFeesEntry) {\n throw new Error(\n `Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,\n );\n }\n const socketDepositFees: SocketDepositFees = {\n fees: socketDepositFeesEntry.fees,\n feesInUnderlyingToken: descale(18)(socketDepositFeesEntry.fees),\n underlyingTokenName: getNativeToken(moneyInOutChainId),\n };\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: moneyInOutChainId,\n }).bridgeTimeInMS;\n\n return {\n socketDepositFees: socketDepositFees,\n bridgeTimeInMS: bridgeTimeInMS,\n };\n }\n}\n"]}
@@ -1,4 +1,19 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
2
17
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
18
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
19
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -37,21 +52,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
52
  };
38
53
  Object.defineProperty(exports, "__esModule", { value: true });
39
54
  var common_1 = require("@reyaxyz/common");
40
- var WithdrawMASimulationClient = /** @class */ (function () {
41
- function WithdrawMASimulationClient(editCollateralClient, reyaChainId) {
42
- this.editCollateralClient = editCollateralClient;
43
- this.reyaChainId = reyaChainId;
55
+ var WithdrawMASimulationClient = /** @class */ (function (_super) {
56
+ __extends(WithdrawMASimulationClient, _super);
57
+ function WithdrawMASimulationClient(editCollateralClient, reyaChainId, host, apiTimeout) {
58
+ var _this = _super.call(this, host, apiTimeout) || this;
59
+ _this.socketWithdrawFeesList = [];
60
+ _this.editCollateralClient = editCollateralClient;
61
+ _this.reyaChainId = reyaChainId;
62
+ return _this;
44
63
  }
45
64
  // Method to asynchronously load data based on accountId
46
65
  WithdrawMASimulationClient.prototype.arm = function (params) {
47
66
  return __awaiter(this, void 0, void 0, function () {
48
- return __generator(this, function (_a) {
49
- switch (_a.label) {
67
+ var _a;
68
+ return __generator(this, function (_b) {
69
+ switch (_b.label) {
50
70
  case 0: return [4 /*yield*/, this.editCollateralClient.arm({
51
71
  marginAccountId: params.marginAccountId,
52
72
  })];
53
73
  case 1:
54
- _a.sent();
74
+ _b.sent();
75
+ _a = this;
76
+ return [4 /*yield*/, this.get("/api/socket/withdraw-fees")];
77
+ case 2:
78
+ _a.socketWithdrawFeesList = _b.sent();
55
79
  return [2 /*return*/];
56
80
  }
57
81
  });
@@ -59,6 +83,20 @@ var WithdrawMASimulationClient = /** @class */ (function () {
59
83
  };
60
84
  // Synchronous method to simulate operations based on an amount
61
85
  WithdrawMASimulationClient.prototype.simulate = function (params) {
86
+ var tokenInfo = (0, common_1.getTokenInfoByAddress)(params.tokenAddress, this.reyaChainId);
87
+ var socketWithdrawFeesEntry = this.socketWithdrawFeesList.find(function (socketWithdrawFeesEntry) {
88
+ return socketWithdrawFeesEntry.moneyInOutChainId ===
89
+ params.moneyInOutChainId &&
90
+ socketWithdrawFeesEntry.tokenName === tokenInfo.name;
91
+ });
92
+ if (!socketWithdrawFeesEntry) {
93
+ throw new Error("Socket withdraw fees for chain ".concat(params.moneyInOutChainId, " and token ").concat(tokenInfo.name, " not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)"));
94
+ }
95
+ var socketWithdrawFees = {
96
+ fees: socketWithdrawFeesEntry.fees,
97
+ feesInUnderlyingToken: (0, common_1.descale)(tokenInfo.decimals)(socketWithdrawFeesEntry.fees),
98
+ underlyingTokenName: tokenInfo.name,
99
+ };
62
100
  var simulateEditCollateralEntity = this.editCollateralClient.simulate({
63
101
  signedAmount: -params.amount,
64
102
  tokenAddress: params.tokenAddress,
@@ -66,20 +104,14 @@ var WithdrawMASimulationClient = /** @class */ (function () {
66
104
  var bridgeTimeInMS = (0, common_1.getSocketBridgeTime)({
67
105
  moneyInOutChainId: params.moneyInOutChainId,
68
106
  }).bridgeTimeInMS;
69
- var fees = (0, common_1.getSocketWithdrawFees)({
70
- reyaChainId: this.reyaChainId,
71
- tokenAddress: params.tokenAddress,
72
- });
73
- var feesUnderlyingToken = (0, common_1.getTokenInfoByAddress)(params.tokenAddress).name;
74
107
  return {
75
- fees: fees.fees,
76
- feesUnderlyingToken: feesUnderlyingToken,
108
+ socketWithdrawFees: socketWithdrawFees,
77
109
  bridgeTimeInMS: bridgeTimeInMS,
78
110
  marginRatio: simulateEditCollateralEntity.marginRatio,
79
111
  marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,
80
112
  };
81
113
  };
82
114
  return WithdrawMASimulationClient;
83
- }());
115
+ }(common_1.RestClient));
84
116
  exports.default = WithdrawMASimulationClient;
85
117
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAKyB;AAQzB;IAIE,oCACE,oBAA0C,EAC1C,WAAwB;QAExB,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,wDAAwD;IAClD,wCAAG,GAAT,UAAU,MAA0C;;;;4BAClD,qBAAM,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC;4BAClC,eAAe,EAAE,MAAM,CAAC,eAAe;yBACxC,CAAC,EAAA;;wBAFF,SAEE,CAAC;;;;;KACJ;IAED,+DAA+D;IAC/D,6CAAQ,GAAR,UACE,MAA0C;QAE1C,IAAM,4BAA4B,GAAG,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC;YACtE,YAAY,EAAE,CAAC,MAAM,CAAC,MAAM;YAC5B,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CAAC;QAEH,IAAM,cAAc,GAAG,IAAA,4BAAmB,EAAC;YACzC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;SAC5C,CAAC,CAAC,cAAc,CAAC;QAElB,IAAM,IAAI,GAAG,IAAA,8BAAqB,EAAC;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CAAC;QAEH,IAAM,mBAAmB,GAAG,IAAA,8BAAqB,EAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;QAE5E,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,mBAAmB,EAAE,mBAAmB;YACxC,cAAc,EAAE,cAAc;YAC9B,WAAW,EAAE,4BAA4B,CAAC,WAAW;YACrD,iBAAiB,EAAE,4BAA4B,CAAC,iBAAiB;SACtC,CAAC;IAChC,CAAC;IACH,iCAAC;AAAD,CAAC,AA/CD,IA+CC","sourcesContent":["import {\n getSocketBridgeTime,\n getSocketWithdrawFees,\n getTokenInfoByAddress,\n ReyaChainId,\n} from '@reyaxyz/common';\nimport EditCollateralClient from '../edit-collateral.simulation';\nimport {\n SimulateWithdrawMAEntity,\n WithdrawMASimulationLoadDataParams,\n WithdrawMASimulationSimulateParams,\n} from './types';\n\nexport default class WithdrawMASimulationClient {\n private editCollateralClient: EditCollateralClient;\n private reyaChainId: ReyaChainId;\n\n constructor(\n editCollateralClient: EditCollateralClient,\n reyaChainId: ReyaChainId,\n ) {\n this.editCollateralClient = editCollateralClient;\n this.reyaChainId = reyaChainId;\n }\n\n // Method to asynchronously load data based on accountId\n async arm(params: WithdrawMASimulationLoadDataParams): Promise<void> {\n await this.editCollateralClient.arm({\n marginAccountId: params.marginAccountId,\n });\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: WithdrawMASimulationSimulateParams,\n ): SimulateWithdrawMAEntity {\n const simulateEditCollateralEntity = this.editCollateralClient.simulate({\n signedAmount: -params.amount,\n tokenAddress: params.tokenAddress,\n });\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: params.moneyInOutChainId,\n }).bridgeTimeInMS;\n\n const fees = getSocketWithdrawFees({\n reyaChainId: this.reyaChainId,\n tokenAddress: params.tokenAddress,\n });\n\n const feesUnderlyingToken = getTokenInfoByAddress(params.tokenAddress).name;\n\n return {\n fees: fees.fees,\n feesUnderlyingToken: feesUnderlyingToken,\n bridgeTimeInMS: bridgeTimeInMS,\n marginRatio: simulateEditCollateralEntity.marginRatio,\n marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,\n } as SimulateWithdrawMAEntity;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAQyB;AAQzB;IAAwD,8CAAU;IAKhE,oCACE,oBAA0C,EAC1C,WAAwB,EACxB,IAAY,EACZ,UAA0B;QAE1B,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QARlB,4BAAsB,GAA8B,EAAE,CAAC;QAS7D,KAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;;IACjC,CAAC;IAED,wDAAwD;IAClD,wCAAG,GAAT,UAAU,MAA0C;;;;;4BAClD,qBAAM,I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BAAiB;SAC5C,CAAC,CAAC,cAAc,CAAC;QAElB,OAAO;YACL,kBAAkB,oBAAA;YAClB,cAAc,EAAE,cAAc;YAC9B,WAAW,EAAE,4BAA4B,CAAC,WAAW;YACrD,iBAAiB,EAAE,4BAA4B,CAAC,iBAAiB;SACtC,CAAC;IAChC,CAAC;IACH,iCAAC;AAAD,CAAC,AAvED,CAAwD,mBAAU,GAuEjE","sourcesContent":["import {\n getSocketBridgeTime,\n getTokenInfoByAddress,\n ReyaChainId,\n SocketWithdrawFeesEntry,\n RestClient,\n SocketWithdrawFees,\n descale,\n} from '@reyaxyz/common';\nimport EditCollateralClient from '../edit-collateral.simulation';\nimport {\n SimulateWithdrawMAEntity,\n WithdrawMASimulationLoadDataParams,\n WithdrawMASimulationSimulateParams,\n} from './types';\n\nexport default class WithdrawMASimulationClient extends RestClient {\n private editCollateralClient: EditCollateralClient;\n private reyaChainId: ReyaChainId;\n private socketWithdrawFeesList: SocketWithdrawFeesEntry[] = [];\n\n constructor(\n editCollateralClient: EditCollateralClient,\n reyaChainId: ReyaChainId,\n host: string,\n apiTimeout?: number | null,\n ) {\n super(host, apiTimeout);\n this.editCollateralClient = editCollateralClient;\n this.reyaChainId = reyaChainId;\n }\n\n // Method to asynchronously load data based on accountId\n async arm(params: WithdrawMASimulationLoadDataParams): Promise<void> {\n await this.editCollateralClient.arm({\n marginAccountId: params.marginAccountId,\n });\n\n this.socketWithdrawFeesList = await this.get<SocketWithdrawFeesEntry[]>(\n `/api/socket/withdraw-fees`,\n );\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: WithdrawMASimulationSimulateParams,\n ): SimulateWithdrawMAEntity {\n const tokenInfo = getTokenInfoByAddress(\n params.tokenAddress,\n this.reyaChainId,\n );\n const socketWithdrawFeesEntry = this.socketWithdrawFeesList.find(\n (socketWithdrawFeesEntry) =>\n socketWithdrawFeesEntry.moneyInOutChainId ===\n params.moneyInOutChainId &&\n socketWithdrawFeesEntry.tokenName === tokenInfo.name,\n );\n if (!socketWithdrawFeesEntry) {\n throw new Error(\n `Socket withdraw fees for chain ${params.moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,\n );\n }\n\n const socketWithdrawFees: SocketWithdrawFees = {\n fees: socketWithdrawFeesEntry.fees,\n feesInUnderlyingToken: descale(tokenInfo.decimals)(\n socketWithdrawFeesEntry.fees,\n ),\n underlyingTokenName: tokenInfo.name,\n };\n\n const simulateEditCollateralEntity = this.editCollateralClient.simulate({\n signedAmount: -params.amount,\n tokenAddress: params.tokenAddress,\n });\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: params.moneyInOutChainId,\n }).bridgeTimeInMS;\n\n return {\n socketWithdrawFees,\n bridgeTimeInMS: bridgeTimeInMS,\n marginRatio: simulateEditCollateralEntity.marginRatio,\n marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,\n } as SimulateWithdrawMAEntity;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n MarginAccountEntity,\n MoneyInOutChainId,\n TokenEntity,\n TokenName,\n} from '@reyaxyz/common';\nimport { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';\n\nexport type WithdrawMASimulationLoadDataParams =\n EditCollateralSimulationLoadDataParams;\n\nexport type WithdrawMASimulationSimulateParams = {\n moneyInOutChainId: MoneyInOutChainId;\n amount: number;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type SimulateWithdrawMAEntity = {\n fees: number;\n feesUnderlyingToken: TokenName;\n bridgeTimeInMS: number;\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n MarginAccountEntity,\n MoneyInOutChainId,\n TokenEntity,\n} from '@reyaxyz/common';\nimport { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';\nimport { SocketWithdrawFees } from '@reyaxyz/common';\n\nexport type WithdrawMASimulationLoadDataParams =\n EditCollateralSimulationLoadDataParams;\n\nexport type WithdrawMASimulationSimulateParams = {\n moneyInOutChainId: MoneyInOutChainId;\n amount: number;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type SimulateWithdrawMAEntity = {\n socketWithdrawFees: SocketWithdrawFees;\n bridgeTimeInMS: number;\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n};\n"]}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ var common_1 = require("@reyaxyz/common");
55
+ var WithdrawPassivePoolSimulationClient = /** @class */ (function (_super) {
56
+ __extends(WithdrawPassivePoolSimulationClient, _super);
57
+ function WithdrawPassivePoolSimulationClient(reyaChainId, host, apiTimeout) {
58
+ var _this = _super.call(this, host, apiTimeout) || this;
59
+ _this.socketWithdrawFeesList = [];
60
+ _this.reyaChainId = reyaChainId;
61
+ return _this;
62
+ }
63
+ // Method to asynchronously load data based on accountId
64
+ WithdrawPassivePoolSimulationClient.prototype.arm = function () {
65
+ return __awaiter(this, void 0, void 0, function () {
66
+ var _a;
67
+ return __generator(this, function (_b) {
68
+ switch (_b.label) {
69
+ case 0:
70
+ _a = this;
71
+ return [4 /*yield*/, this.get("/api/socket/withdraw-fees")];
72
+ case 1:
73
+ _a.socketWithdrawFeesList = _b.sent();
74
+ return [2 /*return*/];
75
+ }
76
+ });
77
+ });
78
+ };
79
+ // Synchronous method to simulate operations based on an amount
80
+ WithdrawPassivePoolSimulationClient.prototype.simulate = function (params) {
81
+ var tokenInfo = (0, common_1.getRUSDUnderlyingTokenInfo)(this.reyaChainId);
82
+ var socketWithdrawFeesEntry = this.socketWithdrawFeesList.find(function (socketWithdrawFeesEntry) {
83
+ return socketWithdrawFeesEntry.moneyInOutChainId ===
84
+ params.moneyInOutChainId &&
85
+ socketWithdrawFeesEntry.tokenName === tokenInfo.name;
86
+ });
87
+ if (!socketWithdrawFeesEntry) {
88
+ throw new Error("Socket withdraw fees for chain ".concat(params.moneyInOutChainId, " and token ").concat(tokenInfo.name, " not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)"));
89
+ }
90
+ var socketWithdrawFees = {
91
+ fees: socketWithdrawFeesEntry.fees,
92
+ feesInUnderlyingToken: (0, common_1.descale)(tokenInfo.decimals)(socketWithdrawFeesEntry.fees),
93
+ underlyingTokenName: tokenInfo.name,
94
+ };
95
+ var bridgeTimeInMS = (0, common_1.getSocketBridgeTime)({
96
+ moneyInOutChainId: params.moneyInOutChainId,
97
+ }).bridgeTimeInMS;
98
+ return {
99
+ socketWithdrawFees: socketWithdrawFees,
100
+ bridgeTimeInMS: bridgeTimeInMS,
101
+ };
102
+ };
103
+ return WithdrawPassivePoolSimulationClient;
104
+ }(common_1.RestClient));
105
+ exports.default = WithdrawPassivePoolSimulationClient;
106
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/withdraw-passive-pool.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAQyB;AAMzB;IAAiE,uDAAU;IAIzE,6CACE,WAAwB,EACxB,IAAY,EACZ,UAA0B;QAE1B,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QAPlB,4BAAsB,GAA8B,EAAE,CAAC;QAQ7D,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;;IACjC,CAAC;IAED,wDAAwD;IAClD,iDAAG,GAAT;;;;;;wBACE,KAAA,IAAI,CAAA;wBAA0B,qBAAM,IAAI,CAAC,GAAG,CAC1C,2BAA2B,CAC5B,EAAA;;wBAFD,GAAK,sBAAsB,GAAG,SAE7B,CAAC;;;;;KACH;IAED,+DAA+D;IAC/D,sDAAQ,GAAR,UACE,MAAmD;QAEnD,IAAM,SAAS,GAAG,IAAA,mCAA0B,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/D,IAAM,uBAAuB,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAC9D,UAAC,uBAAuB;YACtB,OAAA,uBAAuB,CAAC,iBAAiB;gBACvC,MAAM,CAAC,iBAAiB;gBAC1B,uBAAuB,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI;QAFpD,CAEoD,CACvD,CAAC;QACF,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CACb,yCAAkC,MAAM,CAAC,iBAAiB,wBAAc,SAAS,CAAC,IAAI,iGAA8F,CACrL,CAAC;QACJ,CAAC;QAED,IAAM,kBAAkB,GAAuB;YAC7C,IAAI,EAAE,uBAAuB,CAAC,IAAI;YAClC,qBAAqB,EAAE,IAAA,gBAAO,EAAC,SAAS,CAAC,QAAQ,CAAC,CAChD,uBAAuB,CAAC,IAAI,CAC7B;YACD,mBAAmB,EAAE,SAAS,CAAC,IAAI;SACpC,CAAC;QAEF,IAAM,cAAc,GAAG,IAAA,4BAAmB,EAAC;YACzC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;SAC5C,CAAC,CAAC,cAAc,CAAC;QAElB,OAAO;YACL,kBAAkB,oBAAA;YAClB,cAAc,EAAE,cAAc;SACM,CAAC;IACzC,CAAC;IACH,0CAAC;AAAD,CAAC,AAtDD,CAAiE,mBAAU,GAsD1E","sourcesContent":["import {\n getSocketBridgeTime,\n ReyaChainId,\n SocketWithdrawFeesEntry,\n RestClient,\n SocketWithdrawFees,\n descale,\n getRUSDUnderlyingTokenInfo,\n} from '@reyaxyz/common';\nimport {\n SimulateWithdrawPassivePoolEntity,\n WithdrawPassivePoolSimulationSimulateParams,\n} from './types';\n\nexport default class WithdrawPassivePoolSimulationClient extends RestClient {\n private reyaChainId: ReyaChainId;\n private socketWithdrawFeesList: SocketWithdrawFeesEntry[] = [];\n\n constructor(\n reyaChainId: ReyaChainId,\n host: string,\n apiTimeout?: number | null,\n ) {\n super(host, apiTimeout);\n this.reyaChainId = reyaChainId;\n }\n\n // Method to asynchronously load data based on accountId\n async arm(): Promise<void> {\n this.socketWithdrawFeesList = await this.get<SocketWithdrawFeesEntry[]>(\n `/api/socket/withdraw-fees`,\n );\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: WithdrawPassivePoolSimulationSimulateParams,\n ): SimulateWithdrawPassivePoolEntity {\n const tokenInfo = getRUSDUnderlyingTokenInfo(this.reyaChainId);\n const socketWithdrawFeesEntry = this.socketWithdrawFeesList.find(\n (socketWithdrawFeesEntry) =>\n socketWithdrawFeesEntry.moneyInOutChainId ===\n params.moneyInOutChainId &&\n socketWithdrawFeesEntry.tokenName === tokenInfo.name,\n );\n if (!socketWithdrawFeesEntry) {\n throw new Error(\n `Socket withdraw fees for chain ${params.moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,\n );\n }\n\n const socketWithdrawFees: SocketWithdrawFees = {\n fees: socketWithdrawFeesEntry.fees,\n feesInUnderlyingToken: descale(tokenInfo.decimals)(\n socketWithdrawFeesEntry.fees,\n ),\n underlyingTokenName: tokenInfo.name,\n };\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: params.moneyInOutChainId,\n }).bridgeTimeInMS;\n\n return {\n socketWithdrawFees,\n bridgeTimeInMS: bridgeTimeInMS,\n } as SimulateWithdrawPassivePoolEntity;\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/withdraw-passive-pool.simulation/types.ts"],"names":[],"mappings":"","sourcesContent":["import { MoneyInOutChainId, SocketWithdrawFees } from '@reyaxyz/common';\n\nexport type WithdrawPassivePoolSimulationSimulateParams = {\n moneyInOutChainId: MoneyInOutChainId;\n};\n\nexport type SimulateWithdrawPassivePoolEntity = {\n socketWithdrawFees: SocketWithdrawFees;\n bridgeTimeInMS: number;\n};\n"]}
@@ -36,6 +36,7 @@ __exportStar(require("./modules/deposit-new-MA.simulation/types"), exports);
36
36
  __exportStar(require("./modules/deposit-passive-pool.simulation/types"), exports);
37
37
  __exportStar(require("./modules/edit-collateral.simulation/types"), exports);
38
38
  __exportStar(require("./modules/withdraw-MA.simulation/types"), exports);
39
+ __exportStar(require("./modules/withdraw-passive-pool.simulation/types"), exports);
39
40
  __exportStar(require("./modules/transfer-margin-between-MAs.simulation/types"), exports);
40
41
  __exportStar(require("./modules/transfer-MA-Pool.simulation/types"), exports);
41
42
  __exportStar(require("./modules/funding-rate/types"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,0CA2ByB;AAzBvB,2GAAA,iBAAiB,OAAA;AAYjB,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AAGjB,8GAAA,oBAAoB,OAAA;AACpB,yHAAA,+BAA+B,OAAA;AAE/B,oIAAA,0CAA0C,OAAA;AAG1C,6HAAA,mCAAmC,OAAA;AAEnC,uHAAA,6BAA6B,OAAA;AAE/B,0DAAwC;AACxC,qDAAmC;AACnC,0DAAwC;AACxC,yDAAuC;AACvC,mEAAiD;AACjD,wDAAsC;AACtC,iFAA+D;AAC/D,4EAA0D;AAC1D,kFAAgE;AAChE,6EAA2D;AAC3D,yEAAuD;AACvD,yFAAuE;AACvE,8EAA4D;AAC5D,+DAA6C;AAC7C,yEAAuD;AACvD,kFAAgE","sourcesContent":["// reexporting what we want to share with integrators\nexport {\n Candle,\n CandlesResolution,\n MarketEntity,\n LpTransactionHistoryEntity,\n TradingHistoryEntity,\n PositionHistoryEntity,\n PositionEntity,\n TransactionHistoryType,\n MarginAccountTransactionHistoryType,\n MarginAccountTransactionHistoryEntity,\n MarginAccountEntity,\n LpPositionEntity,\n LpPoolEntity,\n ReyaChainId,\n MoneyInOutChainId,\n GetLpPoolPerformanceChartDataResult,\n GetLpPoolBalanceChartDataResult,\n LpBalanceGranularity,\n MarginAccountBalanceGranularity,\n GetMarginAccountBalanceChartDataResult,\n MarginAccountCollateralsBalanceGranularity,\n GetMarginAccountCollateralsBalanceChartDataResult,\n GetAllMarginAccountsBalanceChartDataResult,\n AllMarginAccountsBalanceGranularity,\n GetFundingRateChartDataResult,\n FundingRateHistoryGranularity,\n} from '@reyaxyz/common';\nexport * from './modules/account/types';\nexport * from './modules/lp/types';\nexport * from './modules/markets/types';\nexport * from './modules/tokens/types';\nexport * from './modules/trade.simulation/types';\nexport * from './modules/owner/types';\nexport * from './modules/deposit-existing-MA.simulation/types';\nexport * from './modules/deposit-new-MA.simulation/types';\nexport * from './modules/deposit-passive-pool.simulation/types';\nexport * from './modules/edit-collateral.simulation/types';\nexport * from './modules/withdraw-MA.simulation/types';\nexport * from './modules/transfer-margin-between-MAs.simulation/types';\nexport * from './modules/transfer-MA-Pool.simulation/types';\nexport * from './modules/funding-rate/types';\nexport * from './modules/depth-chart.simulation/types';\nexport * from './modules/deposit-passive-pool.simulation/types';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,0CA2ByB;AAzBvB,2GAAA,iBAAiB,OAAA;AAYjB,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AAGjB,8GAAA,oBAAoB,OAAA;AACpB,yHAAA,+BAA+B,OAAA;AAE/B,oIAAA,0CAA0C,OAAA;AAG1C,6HAAA,mCAAmC,OAAA;AAEnC,uHAAA,6BAA6B,OAAA;AAE/B,0DAAwC;AACxC,qDAAmC;AACnC,0DAAwC;AACxC,yDAAuC;AACvC,mEAAiD;AACjD,wDAAsC;AACtC,iFAA+D;AAC/D,4EAA0D;AAC1D,kFAAgE;AAChE,6EAA2D;AAC3D,yEAAuD;AACvD,mFAAiE;AACjE,yFAAuE;AACvE,8EAA4D;AAC5D,+DAA6C;AAC7C,yEAAuD;AACvD,kFAAgE","sourcesContent":["// reexporting what we want to share with integrators\nexport {\n Candle,\n CandlesResolution,\n MarketEntity,\n LpTransactionHistoryEntity,\n TradingHistoryEntity,\n PositionHistoryEntity,\n PositionEntity,\n TransactionHistoryType,\n MarginAccountTransactionHistoryType,\n MarginAccountTransactionHistoryEntity,\n MarginAccountEntity,\n LpPositionEntity,\n LpPoolEntity,\n ReyaChainId,\n MoneyInOutChainId,\n GetLpPoolPerformanceChartDataResult,\n GetLpPoolBalanceChartDataResult,\n LpBalanceGranularity,\n MarginAccountBalanceGranularity,\n GetMarginAccountBalanceChartDataResult,\n MarginAccountCollateralsBalanceGranularity,\n GetMarginAccountCollateralsBalanceChartDataResult,\n GetAllMarginAccountsBalanceChartDataResult,\n AllMarginAccountsBalanceGranularity,\n GetFundingRateChartDataResult,\n FundingRateHistoryGranularity,\n} from '@reyaxyz/common';\nexport * from './modules/account/types';\nexport * from './modules/lp/types';\nexport * from './modules/markets/types';\nexport * from './modules/tokens/types';\nexport * from './modules/trade.simulation/types';\nexport * from './modules/owner/types';\nexport * from './modules/deposit-existing-MA.simulation/types';\nexport * from './modules/deposit-new-MA.simulation/types';\nexport * from './modules/deposit-passive-pool.simulation/types';\nexport * from './modules/edit-collateral.simulation/types';\nexport * from './modules/withdraw-MA.simulation/types';\nexport * from './modules/withdraw-passive-pool.simulation/types';\nexport * from './modules/transfer-margin-between-MAs.simulation/types';\nexport * from './modules/transfer-MA-Pool.simulation/types';\nexport * from './modules/funding-rate/types';\nexport * from './modules/depth-chart.simulation/types';\nexport * from './modules/deposit-passive-pool.simulation/types';\n"]}
@@ -1,16 +1,16 @@
1
- import { ServiceConfig } from '@reyaxyz/common';
1
+ import { ServiceConfig, ReyaChainId } from '@reyaxyz/common';
2
2
  import MarketsClient from './modules/markets';
3
3
  import AccountClient from './modules/account';
4
4
  import TradeSimulationClient from './modules/trade.simulation';
5
5
  import LpClient from './modules/lp';
6
6
  import TokensClient from './modules/tokens';
7
- import { ReyaChainId } from '@reyaxyz/common';
8
7
  import OwnerClient from './modules/owner';
9
8
  import EditCollateralSimulationClient from './modules/edit-collateral.simulation';
10
9
  import DepositExistingMASimulationClient from './modules/deposit-existing-MA.simulation';
11
10
  import DepositNewMASimulationClient from './modules/deposit-new-MA.simulation';
12
11
  import DepositPassivePoolSimulationClient from './modules/deposit-passive-pool.simulation';
13
12
  import WithdrawMASimulationClient from './modules/withdraw-MA.simulation';
13
+ import WithdrawPassivePoolSimulationClient from './modules/withdraw-passive-pool.simulation';
14
14
  import TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-between-MAs.simulation';
15
15
  import TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';
16
16
  import DepthChartSimulationClient from './modules/depth-chart.simulation';
@@ -31,6 +31,7 @@ export declare class ApiClient {
31
31
  private readonly _depositNewMASimulation;
32
32
  private readonly _depositPassivePoolSimulation;
33
33
  private readonly _withdrawMASimulation;
34
+ private readonly _withdrawPassivePoolSimulation;
34
35
  private readonly _transferMarginBetweenMAsSimulation;
35
36
  private readonly _transferMAPoolSimulation;
36
37
  private readonly _depthSimulation;
@@ -142,13 +143,27 @@ export declare class ApiClient {
142
143
  * private `_withdrawMASimulation` property, ensuring that trade simulation operations
143
144
  * use a consistent client configuration and state.
144
145
  *
145
- * @returns {WithdrawMASimulationClient} An instance of WithrawMASimulationClient for trade simulation operations.
146
+ * @returns {WithdrawMASimulationClient} An instance of WithdrawMASimulationClient for trade simulation operations.
146
147
  * @memberof ApiClient
147
148
  * @example
148
149
  * // Access the withdraw MA simulation client from the ApiClient
149
150
  * const withdrawMASimulationClient = ApiClient.withdrawMASimulation;
150
151
  */
151
152
  static get withdrawMASimulation(): WithdrawMASimulationClient;
153
+ /**
154
+ * Provides access to the WithdrawPassivePoolSimulationClient instance.
155
+ * This getter allows for interacting with trade simulation functionalities.
156
+ * It ensures a singleton pattern by fetching the instance from the ApiClient's
157
+ * private `_withdrawPassivePoolSimulation` property, ensuring that trade simulation operations
158
+ * use a consistent client configuration and state.
159
+ *
160
+ * @returns {WithdrawPassivePoolSimulationClient} An instance of WithdrawPassivePoolSimulationClient for trade simulation operations.
161
+ * @memberof ApiClient
162
+ * @example
163
+ * // Access the withdraw MA simulation client from the ApiClient
164
+ * const withdrawPassivePoolSimulationClient = ApiClient.withdrawPassivePoolSimulation;
165
+ */
166
+ static get withdrawPassivePoolSimulation(): WithdrawPassivePoolSimulationClient;
152
167
  /**
153
168
  * Provides access to the TransferMarginBetweenMAsSimulationClient instance.
154
169
  * This getter allows for interacting with trade simulation functionalities.
@@ -1 +1 @@
1
- {"version":3,"file":"api-client.d.ts","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[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kB,4BAA4B,IAAI,kCAAkC,CAEnF;IAED;;;;;;;;;;;;OAYG;IAEH,WAAkB,oBAAoB,IAAI,0BAA0B,CAEnE;IAED;;;;;;;;;;;;OAYG;IAEH,WAAkB,6BAA6B,IAAI,mCAAmC,CAErF;IAED;;;;;;;;;;;;OAYG;IAEH,WAAkB,kCAAkC,IAAI,wCAAwC,CAE/F;IAED;;;;;;;;;;;;OAYG;IAEH,WAAkB,wBAAwB,IAAI,8BAA8B,CAE3E;IAED;;;;;;;;;OASG;IACH,WAAkB,EAAE,IAAI,QAAQ,CAE/B;IAED;;;;;;;;;OASG;IACH,WAAkB,MAAM,IAAI,YAAY,CAEvC;IAED;;;;;;;;;OASG;IACH,WAAkB,KAAK,IAAI,WAAW,CAErC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,yCAAyC,EACzC,yCAAyC,EACzC,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,iCAAkC,SAAQ,UAAU;IACvE,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,qBAAqB,CAA8B;gBAGzD,oBAAoB,EAAE,oBAAoB,EAC1C,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAOtB,GAAG,CAAC,MAAM,EAAE,yCAAyC,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3E,QAAQ,CACN,MAAM,EAAE,yCAAyC,GAChD,+BAA+B;CAsCnC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,yCAAyC,EACzC,yCAAyC,EACzC,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,iCAAkC,SAAQ,UAAU;IACvE,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,qBAAqB,CAAgC;gBAG3D,oBAAoB,EAAE,oBAAoB,EAC1C,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAOtB,GAAG,CAAC,MAAM,EAAE,yCAAyC,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3E,QAAQ,CACN,MAAM,EAAE,yCAAyC,GAChD,+BAA+B;CAsCnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-passive-pool.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0CAA0C,EAC1C,gCAAgC,EACjC,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,kCAAmC,SAAQ,UAAU;IACxE,OAAO,CAAC,qBAAqB,CAA8B;gBAE/C,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAK9C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAO1B,QAAQ,CACN,MAAM,EAAE,0CAA0C,GACjD,gCAAgC;CA4BpC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-passive-pool.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0CAA0C,EAC1C,gCAAgC,EACjC,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,kCAAmC,SAAQ,UAAU;IACxE,OAAO,CAAC,qBAAqB,CAAgC;gBAEjD,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAK9C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAO1B,QAAQ,CACN,MAAM,EAAE,0CAA0C,GACjD,gCAAgC;CA4BpC"}
@@ -1,10 +1,11 @@
1
- import { ReyaChainId } from '@reyaxyz/common';
1
+ import { ReyaChainId, RestClient } from '@reyaxyz/common';
2
2
  import EditCollateralClient from '../edit-collateral.simulation';
3
3
  import { SimulateWithdrawMAEntity, WithdrawMASimulationLoadDataParams, WithdrawMASimulationSimulateParams } from './types';
4
- export default class WithdrawMASimulationClient {
4
+ export default class WithdrawMASimulationClient extends RestClient {
5
5
  private editCollateralClient;
6
6
  private reyaChainId;
7
- constructor(editCollateralClient: EditCollateralClient, reyaChainId: ReyaChainId);
7
+ private socketWithdrawFeesList;
8
+ constructor(editCollateralClient: EditCollateralClient, reyaChainId: ReyaChainId, host: string, apiTimeout?: number | null);
8
9
  arm(params: WithdrawMASimulationLoadDataParams): Promise<void>;
9
10
  simulate(params: WithdrawMASimulationSimulateParams): SimulateWithdrawMAEntity;
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,0BAA0B;IAC7C,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,WAAW,CAAc;gBAG/B,oBAAoB,EAAE,oBAAoB,EAC1C,WAAW,EAAE,WAAW;IAOpB,GAAG,CAAC,MAAM,EAAE,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC;IAOpE,QAAQ,CACN,MAAM,EAAE,kCAAkC,GACzC,wBAAwB;CAyB5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EAEX,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,UAAU;IAChE,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,sBAAsB,CAAiC;gBAG7D,oBAAoB,EAAE,oBAAoB,EAC1C,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAQtB,GAAG,CAAC,MAAM,EAAE,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpE,QAAQ,CACN,MAAM,EAAE,kCAAkC,GACzC,wBAAwB;CAyC5B"}
@@ -1,5 +1,6 @@
1
- import { MarginAccountEntity, MoneyInOutChainId, TokenEntity, TokenName } from '@reyaxyz/common';
1
+ import { MarginAccountEntity, MoneyInOutChainId, TokenEntity } from '@reyaxyz/common';
2
2
  import { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';
3
+ import { SocketWithdrawFees } from '@reyaxyz/common';
3
4
  export type WithdrawMASimulationLoadDataParams = EditCollateralSimulationLoadDataParams;
4
5
  export type WithdrawMASimulationSimulateParams = {
5
6
  moneyInOutChainId: MoneyInOutChainId;
@@ -7,8 +8,7 @@ export type WithdrawMASimulationSimulateParams = {
7
8
  tokenAddress: TokenEntity['address'];
8
9
  };
9
10
  export type SimulateWithdrawMAEntity = {
10
- fees: number;
11
- feesUnderlyingToken: TokenName;
11
+ socketWithdrawFees: SocketWithdrawFees;
12
12
  bridgeTimeInMS: number;
13
13
  marginRatio: MarginAccountEntity['marginRatioPercentage'];
14
14
  marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
@@ -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,EACX,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sCAAsC,EAAE,MAAM,qCAAqC,CAAC;AAE7F,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,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,SAAS,CAAC;IAC/B,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,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"}
@@ -0,0 +1,10 @@
1
+ import { ReyaChainId, RestClient } from '@reyaxyz/common';
2
+ import { SimulateWithdrawPassivePoolEntity, WithdrawPassivePoolSimulationSimulateParams } from './types';
3
+ export default class WithdrawPassivePoolSimulationClient extends RestClient {
4
+ private reyaChainId;
5
+ private socketWithdrawFeesList;
6
+ constructor(reyaChainId: ReyaChainId, host: string, apiTimeout?: number | null);
7
+ arm(): Promise<void>;
8
+ simulate(params: WithdrawPassivePoolSimulationSimulateParams): SimulateWithdrawPassivePoolEntity;
9
+ }
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-passive-pool.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAEX,UAAU,EAIX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iCAAiC,EACjC,2CAA2C,EAC5C,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,mCAAoC,SAAQ,UAAU;IACzE,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,sBAAsB,CAAiC;gBAG7D,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAOtB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAO1B,QAAQ,CACN,MAAM,EAAE,2CAA2C,GAClD,iCAAiC;CA+BrC"}
@@ -0,0 +1,9 @@
1
+ import { MoneyInOutChainId, SocketWithdrawFees } from '@reyaxyz/common';
2
+ export type WithdrawPassivePoolSimulationSimulateParams = {
3
+ moneyInOutChainId: MoneyInOutChainId;
4
+ };
5
+ export type SimulateWithdrawPassivePoolEntity = {
6
+ socketWithdrawFees: SocketWithdrawFees;
7
+ bridgeTimeInMS: number;
8
+ };
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-passive-pool.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAExE,MAAM,MAAM,2CAA2C,GAAG;IACxD,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -10,6 +10,7 @@ export * from './modules/deposit-new-MA.simulation/types';
10
10
  export * from './modules/deposit-passive-pool.simulation/types';
11
11
  export * from './modules/edit-collateral.simulation/types';
12
12
  export * from './modules/withdraw-MA.simulation/types';
13
+ export * from './modules/withdraw-passive-pool.simulation/types';
13
14
  export * from './modules/transfer-margin-between-MAs.simulation/types';
14
15
  export * from './modules/transfer-MA-Pool.simulation/types';
15
16
  export * from './modules/funding-rate/types';
@@ -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,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,mCAAmC,EACnC,qCAAqC,EACrC,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,mCAAmC,EACnC,+BAA+B,EAC/B,oBAAoB,EACpB,+BAA+B,EAC/B,sC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,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.69.7",
3
+ "version": "0.70.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -33,9 +33,9 @@
33
33
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
34
34
  },
35
35
  "dependencies": {
36
- "@reyaxyz/common": "0.74.2",
36
+ "@reyaxyz/common": "0.76.0",
37
37
  "bignumber.js": "^9.1.2"
38
38
  },
39
39
  "packageManager": "pnpm@8.10.4",
40
- "gitHead": "c5d4c2a38149f9e7864c77cd917e11b8fe9fdaed"
40
+ "gitHead": "18a9a0f6f827ead537e9dc1dfc22307612f9e3b7"
41
41
  }
@@ -1,16 +1,20 @@
1
- import { API_CLIENT_CONFIGS, ServiceConfig } from '@reyaxyz/common';
1
+ import {
2
+ API_CLIENT_CONFIGS,
3
+ ServiceConfig,
4
+ ReyaChainId,
5
+ } from '@reyaxyz/common';
2
6
  import MarketsClient from './modules/markets';
3
7
  import AccountClient from './modules/account';
4
8
  import TradeSimulationClient from './modules/trade.simulation';
5
9
  import LpClient from './modules/lp';
6
10
  import TokensClient from './modules/tokens';
7
- import { ReyaChainId } from '@reyaxyz/common';
8
11
  import OwnerClient from './modules/owner';
9
12
  import EditCollateralSimulationClient from './modules/edit-collateral.simulation';
10
13
  import DepositExistingMASimulationClient from './modules/deposit-existing-MA.simulation';
11
14
  import DepositNewMASimulationClient from './modules/deposit-new-MA.simulation';
12
15
  import DepositPassivePoolSimulationClient from './modules/deposit-passive-pool.simulation';
13
16
  import WithdrawMASimulationClient from './modules/withdraw-MA.simulation';
17
+ import WithdrawPassivePoolSimulationClient from './modules/withdraw-passive-pool.simulation';
14
18
  import TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-between-MAs.simulation';
15
19
  import TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';
16
20
  import DepthChartSimulationClient from './modules/depth-chart.simulation';
@@ -32,6 +36,7 @@ export class ApiClient {
32
36
  private readonly _depositNewMASimulation: DepositNewMASimulationClient;
33
37
  private readonly _depositPassivePoolSimulation: DepositPassivePoolSimulationClient;
34
38
  private readonly _withdrawMASimulation: WithdrawMASimulationClient;
39
+ private readonly _withdrawPassivePoolSimulation: WithdrawPassivePoolSimulationClient;
35
40
  private readonly _transferMarginBetweenMAsSimulation: TransferMarginBetweenMAsSimulationClient;
36
41
  private readonly _transferMAPoolSimulation: TransferMAPoolSimulationClient;
37
42
  private readonly _depthSimulation: DepthChartSimulationClient;
@@ -61,7 +66,13 @@ export class ApiClient {
61
66
  this._withdrawMASimulation = new WithdrawMASimulationClient(
62
67
  this._editCollateralSimulation,
63
68
  ApiClient.config.chain,
69
+ ApiClient.config.apiEndpoint,
64
70
  );
71
+ this._withdrawPassivePoolSimulation =
72
+ new WithdrawPassivePoolSimulationClient(
73
+ ApiClient.config.chain,
74
+ ApiClient.config.apiEndpoint,
75
+ );
65
76
  this._transferMarginBetweenMAsSimulation =
66
77
  new TransferMarginBetweenMAsSimulationClient(
67
78
  ApiClient.network,
@@ -231,7 +242,7 @@ export class ApiClient {
231
242
  * private `_withdrawMASimulation` property, ensuring that trade simulation operations
232
243
  * use a consistent client configuration and state.
233
244
  *
234
- * @returns {WithdrawMASimulationClient} An instance of WithrawMASimulationClient for trade simulation operations.
245
+ * @returns {WithdrawMASimulationClient} An instance of WithdrawMASimulationClient for trade simulation operations.
235
246
  * @memberof ApiClient
236
247
  * @example
237
248
  * // Access the withdraw MA simulation client from the ApiClient
@@ -242,6 +253,24 @@ export class ApiClient {
242
253
  return ApiClient.getInstance()._withdrawMASimulation;
243
254
  }
244
255
 
256
+ /**
257
+ * Provides access to the WithdrawPassivePoolSimulationClient instance.
258
+ * This getter allows for interacting with trade simulation functionalities.
259
+ * It ensures a singleton pattern by fetching the instance from the ApiClient's
260
+ * private `_withdrawPassivePoolSimulation` property, ensuring that trade simulation operations
261
+ * use a consistent client configuration and state.
262
+ *
263
+ * @returns {WithdrawPassivePoolSimulationClient} An instance of WithdrawPassivePoolSimulationClient for trade simulation operations.
264
+ * @memberof ApiClient
265
+ * @example
266
+ * // Access the withdraw MA simulation client from the ApiClient
267
+ * const withdrawPassivePoolSimulationClient = ApiClient.withdrawPassivePoolSimulation;
268
+ */
269
+
270
+ public static get withdrawPassivePoolSimulation(): WithdrawPassivePoolSimulationClient {
271
+ return ApiClient.getInstance()._withdrawPassivePoolSimulation;
272
+ }
273
+
245
274
  /**
246
275
  * Provides access to the TransferMarginBetweenMAsSimulationClient instance.
247
276
  * This getter allows for interacting with trade simulation functionalities.
@@ -4,7 +4,7 @@ import {
4
4
  getTokenInfoByAddress,
5
5
  RestClient,
6
6
  SocketDepositFees,
7
- SocketDepositFeesRow,
7
+ SocketDepositFeesEntry,
8
8
  } from '@reyaxyz/common';
9
9
  import EditCollateralClient from '../edit-collateral.simulation';
10
10
  import {
@@ -16,7 +16,7 @@ import { getNativeToken } from '@reyaxyz/common';
16
16
 
17
17
  export default class DepositExistingMASimulationClient extends RestClient {
18
18
  private editCollateralClient: EditCollateralClient;
19
- private socketDepositFeesList: SocketDepositFeesRow[] = [];
19
+ private socketDepositFeesList: SocketDepositFeesEntry[] = [];
20
20
 
21
21
  constructor(
22
22
  editCollateralClient: EditCollateralClient,
@@ -33,7 +33,7 @@ export default class DepositExistingMASimulationClient extends RestClient {
33
33
  marginAccountId: params.marginAccountId,
34
34
  });
35
35
 
36
- this.socketDepositFeesList = await this.get<SocketDepositFeesRow[]>(
36
+ this.socketDepositFeesList = await this.get<SocketDepositFeesEntry[]>(
37
37
  `/api/socket/deposit-fees`,
38
38
  );
39
39
  }
@@ -47,19 +47,19 @@ export default class DepositExistingMASimulationClient extends RestClient {
47
47
  params.tokenAddress,
48
48
  moneyInOutChainId,
49
49
  );
50
- const socketDpositFeesRow = this.socketDepositFeesList.find(
51
- (socketDepositFeesRow) =>
52
- socketDepositFeesRow.moneyInOutChainId === moneyInOutChainId &&
53
- socketDepositFeesRow.tokenName === tokenInfo.name,
50
+ const socketDepositFeesEntry = this.socketDepositFeesList.find(
51
+ (socketDepositFeesEntry) =>
52
+ socketDepositFeesEntry.moneyInOutChainId === moneyInOutChainId &&
53
+ socketDepositFeesEntry.tokenName === tokenInfo.name,
54
54
  );
55
- if (!socketDpositFeesRow) {
55
+ if (!socketDepositFeesEntry) {
56
56
  throw new Error(
57
57
  `Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,
58
58
  );
59
59
  }
60
60
  const socketDepositFees: SocketDepositFees = {
61
- fees: socketDpositFeesRow.fees,
62
- feesInUnderlyingToken: descale(18)(socketDpositFeesRow.fees),
61
+ fees: socketDepositFeesEntry.fees,
62
+ feesInUnderlyingToken: descale(18)(socketDepositFeesEntry.fees),
63
63
  underlyingTokenName: getNativeToken(moneyInOutChainId),
64
64
  };
65
65
 
@@ -4,7 +4,7 @@ import {
4
4
  getSocketBridgeTime,
5
5
  RestClient,
6
6
  SocketDepositFees,
7
- SocketDepositFeesRow,
7
+ SocketDepositFeesEntry,
8
8
  } from '@reyaxyz/common';
9
9
  import {
10
10
  DepositPassivePoolSimulationSimulateParams,
@@ -13,7 +13,7 @@ import {
13
13
  import { getNativeToken } from '@reyaxyz/common';
14
14
 
15
15
  export default class DepositPassivePoolSimulationClient extends RestClient {
16
- private socketDepositFeesList: SocketDepositFeesRow[] = [];
16
+ private socketDepositFeesList: SocketDepositFeesEntry[] = [];
17
17
 
18
18
  constructor(host: string, apiTimeout?: number | null) {
19
19
  super(host, apiTimeout);
@@ -21,7 +21,7 @@ export default class DepositPassivePoolSimulationClient extends RestClient {
21
21
 
22
22
  // Method to asynchronously load data based on accountId
23
23
  async arm(): Promise<void> {
24
- this.socketDepositFeesList = await this.get<SocketDepositFeesRow[]>(
24
+ this.socketDepositFeesList = await this.get<SocketDepositFeesEntry[]>(
25
25
  `/api/socket/deposit-fees`,
26
26
  );
27
27
  }
@@ -32,19 +32,19 @@ export default class DepositPassivePoolSimulationClient extends RestClient {
32
32
  ): SimulateDepositPassivePoolEntity {
33
33
  const moneyInOutChainId = params.moneyInOutChainId;
34
34
  const tokenInfo = getRUSDUnderlyingTokenInfo(moneyInOutChainId);
35
- const socketDpositFeesRow = this.socketDepositFeesList.find(
36
- (socketDepositFeesRow) =>
37
- socketDepositFeesRow.moneyInOutChainId === moneyInOutChainId &&
38
- socketDepositFeesRow.tokenName === tokenInfo.name,
35
+ const socketDepositFeesEntry = this.socketDepositFeesList.find(
36
+ (socketDepositFeesEntry) =>
37
+ socketDepositFeesEntry.moneyInOutChainId === moneyInOutChainId &&
38
+ socketDepositFeesEntry.tokenName === tokenInfo.name,
39
39
  );
40
- if (!socketDpositFeesRow) {
40
+ if (!socketDepositFeesEntry) {
41
41
  throw new Error(
42
42
  `Socket deposit fees for chain ${moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,
43
43
  );
44
44
  }
45
45
  const socketDepositFees: SocketDepositFees = {
46
- fees: socketDpositFeesRow.fees,
47
- feesInUnderlyingToken: descale(18)(socketDpositFeesRow.fees),
46
+ fees: socketDepositFeesEntry.fees,
47
+ feesInUnderlyingToken: descale(18)(socketDepositFeesEntry.fees),
48
48
  underlyingTokenName: getNativeToken(moneyInOutChainId),
49
49
  };
50
50
 
@@ -1,8 +1,11 @@
1
1
  import {
2
2
  getSocketBridgeTime,
3
- getSocketWithdrawFees,
4
3
  getTokenInfoByAddress,
5
4
  ReyaChainId,
5
+ SocketWithdrawFeesEntry,
6
+ RestClient,
7
+ SocketWithdrawFees,
8
+ descale,
6
9
  } from '@reyaxyz/common';
7
10
  import EditCollateralClient from '../edit-collateral.simulation';
8
11
  import {
@@ -11,14 +14,18 @@ import {
11
14
  WithdrawMASimulationSimulateParams,
12
15
  } from './types';
13
16
 
14
- export default class WithdrawMASimulationClient {
17
+ export default class WithdrawMASimulationClient extends RestClient {
15
18
  private editCollateralClient: EditCollateralClient;
16
19
  private reyaChainId: ReyaChainId;
20
+ private socketWithdrawFeesList: SocketWithdrawFeesEntry[] = [];
17
21
 
18
22
  constructor(
19
23
  editCollateralClient: EditCollateralClient,
20
24
  reyaChainId: ReyaChainId,
25
+ host: string,
26
+ apiTimeout?: number | null,
21
27
  ) {
28
+ super(host, apiTimeout);
22
29
  this.editCollateralClient = editCollateralClient;
23
30
  this.reyaChainId = reyaChainId;
24
31
  }
@@ -28,12 +35,40 @@ export default class WithdrawMASimulationClient {
28
35
  await this.editCollateralClient.arm({
29
36
  marginAccountId: params.marginAccountId,
30
37
  });
38
+
39
+ this.socketWithdrawFeesList = await this.get<SocketWithdrawFeesEntry[]>(
40
+ `/api/socket/withdraw-fees`,
41
+ );
31
42
  }
32
43
 
33
44
  // Synchronous method to simulate operations based on an amount
34
45
  simulate(
35
46
  params: WithdrawMASimulationSimulateParams,
36
47
  ): SimulateWithdrawMAEntity {
48
+ const tokenInfo = getTokenInfoByAddress(
49
+ params.tokenAddress,
50
+ this.reyaChainId,
51
+ );
52
+ const socketWithdrawFeesEntry = this.socketWithdrawFeesList.find(
53
+ (socketWithdrawFeesEntry) =>
54
+ socketWithdrawFeesEntry.moneyInOutChainId ===
55
+ params.moneyInOutChainId &&
56
+ socketWithdrawFeesEntry.tokenName === tokenInfo.name,
57
+ );
58
+ if (!socketWithdrawFeesEntry) {
59
+ throw new Error(
60
+ `Socket withdraw fees for chain ${params.moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,
61
+ );
62
+ }
63
+
64
+ const socketWithdrawFees: SocketWithdrawFees = {
65
+ fees: socketWithdrawFeesEntry.fees,
66
+ feesInUnderlyingToken: descale(tokenInfo.decimals)(
67
+ socketWithdrawFeesEntry.fees,
68
+ ),
69
+ underlyingTokenName: tokenInfo.name,
70
+ };
71
+
37
72
  const simulateEditCollateralEntity = this.editCollateralClient.simulate({
38
73
  signedAmount: -params.amount,
39
74
  tokenAddress: params.tokenAddress,
@@ -43,16 +78,8 @@ export default class WithdrawMASimulationClient {
43
78
  moneyInOutChainId: params.moneyInOutChainId,
44
79
  }).bridgeTimeInMS;
45
80
 
46
- const fees = getSocketWithdrawFees({
47
- reyaChainId: this.reyaChainId,
48
- tokenAddress: params.tokenAddress,
49
- });
50
-
51
- const feesUnderlyingToken = getTokenInfoByAddress(params.tokenAddress).name;
52
-
53
81
  return {
54
- fees: fees.fees,
55
- feesUnderlyingToken: feesUnderlyingToken,
82
+ socketWithdrawFees,
56
83
  bridgeTimeInMS: bridgeTimeInMS,
57
84
  marginRatio: simulateEditCollateralEntity.marginRatio,
58
85
  marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,
@@ -2,9 +2,9 @@ import {
2
2
  MarginAccountEntity,
3
3
  MoneyInOutChainId,
4
4
  TokenEntity,
5
- TokenName,
6
5
  } from '@reyaxyz/common';
7
6
  import { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';
7
+ import { SocketWithdrawFees } from '@reyaxyz/common';
8
8
 
9
9
  export type WithdrawMASimulationLoadDataParams =
10
10
  EditCollateralSimulationLoadDataParams;
@@ -16,8 +16,7 @@ export type WithdrawMASimulationSimulateParams = {
16
16
  };
17
17
 
18
18
  export type SimulateWithdrawMAEntity = {
19
- fees: number;
20
- feesUnderlyingToken: TokenName;
19
+ socketWithdrawFees: SocketWithdrawFees;
21
20
  bridgeTimeInMS: number;
22
21
  marginRatio: MarginAccountEntity['marginRatioPercentage'];
23
22
  marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
@@ -0,0 +1,69 @@
1
+ import {
2
+ getSocketBridgeTime,
3
+ ReyaChainId,
4
+ SocketWithdrawFeesEntry,
5
+ RestClient,
6
+ SocketWithdrawFees,
7
+ descale,
8
+ getRUSDUnderlyingTokenInfo,
9
+ } from '@reyaxyz/common';
10
+ import {
11
+ SimulateWithdrawPassivePoolEntity,
12
+ WithdrawPassivePoolSimulationSimulateParams,
13
+ } from './types';
14
+
15
+ export default class WithdrawPassivePoolSimulationClient extends RestClient {
16
+ private reyaChainId: ReyaChainId;
17
+ private socketWithdrawFeesList: SocketWithdrawFeesEntry[] = [];
18
+
19
+ constructor(
20
+ reyaChainId: ReyaChainId,
21
+ host: string,
22
+ apiTimeout?: number | null,
23
+ ) {
24
+ super(host, apiTimeout);
25
+ this.reyaChainId = reyaChainId;
26
+ }
27
+
28
+ // Method to asynchronously load data based on accountId
29
+ async arm(): Promise<void> {
30
+ this.socketWithdrawFeesList = await this.get<SocketWithdrawFeesEntry[]>(
31
+ `/api/socket/withdraw-fees`,
32
+ );
33
+ }
34
+
35
+ // Synchronous method to simulate operations based on an amount
36
+ simulate(
37
+ params: WithdrawPassivePoolSimulationSimulateParams,
38
+ ): SimulateWithdrawPassivePoolEntity {
39
+ const tokenInfo = getRUSDUnderlyingTokenInfo(this.reyaChainId);
40
+ const socketWithdrawFeesEntry = this.socketWithdrawFeesList.find(
41
+ (socketWithdrawFeesEntry) =>
42
+ socketWithdrawFeesEntry.moneyInOutChainId ===
43
+ params.moneyInOutChainId &&
44
+ socketWithdrawFeesEntry.tokenName === tokenInfo.name,
45
+ );
46
+ if (!socketWithdrawFeesEntry) {
47
+ throw new Error(
48
+ `Socket withdraw fees for chain ${params.moneyInOutChainId} and token ${tokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,
49
+ );
50
+ }
51
+
52
+ const socketWithdrawFees: SocketWithdrawFees = {
53
+ fees: socketWithdrawFeesEntry.fees,
54
+ feesInUnderlyingToken: descale(tokenInfo.decimals)(
55
+ socketWithdrawFeesEntry.fees,
56
+ ),
57
+ underlyingTokenName: tokenInfo.name,
58
+ };
59
+
60
+ const bridgeTimeInMS = getSocketBridgeTime({
61
+ moneyInOutChainId: params.moneyInOutChainId,
62
+ }).bridgeTimeInMS;
63
+
64
+ return {
65
+ socketWithdrawFees,
66
+ bridgeTimeInMS: bridgeTimeInMS,
67
+ } as SimulateWithdrawPassivePoolEntity;
68
+ }
69
+ }
@@ -0,0 +1,10 @@
1
+ import { MoneyInOutChainId, SocketWithdrawFees } from '@reyaxyz/common';
2
+
3
+ export type WithdrawPassivePoolSimulationSimulateParams = {
4
+ moneyInOutChainId: MoneyInOutChainId;
5
+ };
6
+
7
+ export type SimulateWithdrawPassivePoolEntity = {
8
+ socketWithdrawFees: SocketWithdrawFees;
9
+ bridgeTimeInMS: number;
10
+ };
@@ -38,6 +38,7 @@ export * from './modules/deposit-new-MA.simulation/types';
38
38
  export * from './modules/deposit-passive-pool.simulation/types';
39
39
  export * from './modules/edit-collateral.simulation/types';
40
40
  export * from './modules/withdraw-MA.simulation/types';
41
+ export * from './modules/withdraw-passive-pool.simulation/types';
41
42
  export * from './modules/transfer-margin-between-MAs.simulation/types';
42
43
  export * from './modules/transfer-MA-Pool.simulation/types';
43
44
  export * from './modules/funding-rate/types';