@reyaxyz/api-sdk 0.47.2 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/api-client.js +45 -0
- package/dist/clients/api-client.js.map +1 -1
- package/dist/clients/modules/deposit-existing-MA.simulation/types.js.map +1 -1
- package/dist/clients/modules/transfer-MA-Pool.simulation/index.js +74 -0
- package/dist/clients/modules/transfer-MA-Pool.simulation/index.js.map +1 -0
- package/dist/clients/modules/transfer-MA-Pool.simulation/types.js +3 -0
- package/dist/clients/modules/transfer-MA-Pool.simulation/types.js.map +1 -0
- package/dist/clients/modules/transfer-margin-between-MAs.simulation/index.js +90 -0
- package/dist/clients/modules/transfer-margin-between-MAs.simulation/index.js.map +1 -0
- package/dist/clients/modules/transfer-margin-between-MAs.simulation/types.js +3 -0
- package/dist/clients/modules/transfer-margin-between-MAs.simulation/types.js.map +1 -0
- package/dist/clients/modules/withdraw-MA.simulation/index.js +3 -0
- package/dist/clients/modules/withdraw-MA.simulation/index.js.map +1 -1
- package/dist/clients/modules/withdraw-MA.simulation/types.js.map +1 -1
- package/dist/types/clients/api-client.d.ts +32 -0
- package/dist/types/clients/api-client.d.ts.map +1 -1
- package/dist/types/clients/modules/deposit-existing-MA.simulation/types.d.ts +1 -1
- package/dist/types/clients/modules/deposit-existing-MA.simulation/types.d.ts.map +1 -1
- package/dist/types/clients/modules/transfer-MA-Pool.simulation/index.d.ts +9 -0
- package/dist/types/clients/modules/transfer-MA-Pool.simulation/index.d.ts.map +1 -0
- package/dist/types/clients/modules/transfer-MA-Pool.simulation/types.d.ts +12 -0
- package/dist/types/clients/modules/transfer-MA-Pool.simulation/types.d.ts.map +1 -0
- package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/index.d.ts +10 -0
- package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/index.d.ts.map +1 -0
- package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/types.d.ts +16 -0
- package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/types.d.ts.map +1 -0
- package/dist/types/clients/modules/withdraw-MA.simulation/index.d.ts.map +1 -1
- package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts +1 -0
- package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/clients/api-client.ts +45 -0
- package/src/clients/modules/deposit-existing-MA.simulation/types.ts +1 -1
- package/src/clients/modules/transfer-MA-Pool.simulation/index.ts +38 -0
- package/src/clients/modules/transfer-MA-Pool.simulation/types.ts +15 -0
- package/src/clients/modules/transfer-margin-between-MAs.simulation/index.ts +62 -0
- package/src/clients/modules/transfer-margin-between-MAs.simulation/types.ts +18 -0
- package/src/clients/modules/withdraw-MA.simulation/index.ts +4 -1
- package/src/clients/modules/withdraw-MA.simulation/types.ts +1 -0
|
@@ -15,6 +15,8 @@ var edit_collateral_simulation_1 = __importDefault(require("./modules/edit-colla
|
|
|
15
15
|
var deposit_existing_MA_simulation_1 = __importDefault(require("./modules/deposit-existing-MA.simulation"));
|
|
16
16
|
var deposit_new_MA_simulation_1 = __importDefault(require("./modules/deposit-new-MA.simulation"));
|
|
17
17
|
var withdraw_MA_simulation_1 = __importDefault(require("./modules/withdraw-MA.simulation"));
|
|
18
|
+
var transfer_margin_between_MAs_simulation_1 = __importDefault(require("./modules/transfer-margin-between-MAs.simulation"));
|
|
19
|
+
var transfer_MA_Pool_simulation_1 = __importDefault(require("./modules/transfer-MA-Pool.simulation"));
|
|
18
20
|
/**
|
|
19
21
|
* @description Client for API
|
|
20
22
|
*/
|
|
@@ -28,6 +30,9 @@ var ApiClient = /** @class */ (function () {
|
|
|
28
30
|
this._depositExistingMASimulation = new deposit_existing_MA_simulation_1.default(this._editCollateralSimulation);
|
|
29
31
|
this._depositNewMASimulation = new deposit_new_MA_simulation_1.default(this._depositExistingMASimulation);
|
|
30
32
|
this._withdrawMASimulation = new withdraw_MA_simulation_1.default(this._editCollateralSimulation, ApiClient.config.chain);
|
|
33
|
+
this._transferMarginBetweenMAsSimulation =
|
|
34
|
+
new transfer_margin_between_MAs_simulation_1.default(this._account);
|
|
35
|
+
this._transferMAPoolSimulation = new transfer_MA_Pool_simulation_1.default(this._editCollateralSimulation);
|
|
31
36
|
this._tokens = new tokens_1.default(ApiClient.config.apiEndpoint);
|
|
32
37
|
this._owner = new owner_1.default(ApiClient.config.apiEndpoint);
|
|
33
38
|
}
|
|
@@ -180,6 +185,46 @@ var ApiClient = /** @class */ (function () {
|
|
|
180
185
|
enumerable: false,
|
|
181
186
|
configurable: true
|
|
182
187
|
});
|
|
188
|
+
Object.defineProperty(ApiClient, "transferMarginBetweenMAsSimulation", {
|
|
189
|
+
/**
|
|
190
|
+
* Provides access to the TransferMarginBetweenMAsSimulationClient instance.
|
|
191
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
192
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
193
|
+
* private `_transferMarginBetweenMAsSimulation` property, ensuring that trade simulation operations
|
|
194
|
+
* use a consistent client configuration and state.
|
|
195
|
+
*
|
|
196
|
+
* @returns {TransferMarginBetweenMAsSimulationClient} An instance of TransferMarginBetweenMAsSimulationClient for trade simulation operations.
|
|
197
|
+
* @memberof ApiClient
|
|
198
|
+
* @example
|
|
199
|
+
* // Access the transfer margin between MAs simulation client from the ApiClient
|
|
200
|
+
* const transferMarginBetweenMAsSimulationClient = ApiClient.transferMarginBetweenMAsSimulation;
|
|
201
|
+
*/
|
|
202
|
+
get: function () {
|
|
203
|
+
return ApiClient.getInstance()._transferMarginBetweenMAsSimulation;
|
|
204
|
+
},
|
|
205
|
+
enumerable: false,
|
|
206
|
+
configurable: true
|
|
207
|
+
});
|
|
208
|
+
Object.defineProperty(ApiClient, "transferMAPoolSimulation", {
|
|
209
|
+
/**
|
|
210
|
+
* Provides access to the TransferMAPoolSimulationClient instance.
|
|
211
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
212
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
213
|
+
* private `_TransferMAPoolSimulation` property, ensuring that trade simulation operations
|
|
214
|
+
* use a consistent client configuration and state.
|
|
215
|
+
*
|
|
216
|
+
* @returns {TransferMAPoolSimulationClient} An instance of TransferMAPoolSimulationClient for trade simulation operations.
|
|
217
|
+
* @memberof ApiClient
|
|
218
|
+
* @example
|
|
219
|
+
* // Access the transfer from MA to Pool simulation client from the ApiClient
|
|
220
|
+
* const transferMAPoolSimulationClient = ApiClient.transferMAPoolSimulation;
|
|
221
|
+
*/
|
|
222
|
+
get: function () {
|
|
223
|
+
return ApiClient.getInstance()._transferMAPoolSimulation;
|
|
224
|
+
},
|
|
225
|
+
enumerable: false,
|
|
226
|
+
configurable: true
|
|
227
|
+
});
|
|
183
228
|
Object.defineProperty(ApiClient, "lp", {
|
|
184
229
|
/**
|
|
185
230
|
* Gets the current instance of the LpClient from the ApiClient.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.js","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAwE;AACxE,8DAA8C;AAC9C,8DAA8C;AAC9C,gFAA+D;AAC/D,oDAAoC;AACpC,4DAA4C;AAE5C,0DAA0C;AAC1C,oGAAkF;AAClF,4GAAyF;AACzF,kGAA+E;AAC/E,4FAA0E;AAE1E;;GAEG;AACH;IAcE;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,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CAAC;IAgNpE,gBAAC;CAAA,AAlND,IAkNC;AAlNY,8BAAS","sourcesContent":["import { API_CLIENT_CONFIGS, ServiceConfig } from './helpers/constants';\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 WithdrawMASimulationClient from './modules/withdraw-MA.simulation';\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 _editCollateralSimulation: EditCollateralSimulationClient;\n private readonly _depositExistingMASimulation: DepositExistingMASimulationClient;\n private readonly _depositNewMASimulation: DepositNewMASimulationClient;\n private readonly _withdrawMASimulation: WithdrawMASimulationClient;\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._editCollateralSimulation = new EditCollateralSimulationClient(\n this._account,\n );\n this._depositExistingMASimulation = new DepositExistingMASimulationClient(\n this._editCollateralSimulation,\n );\n this._depositNewMASimulation = new DepositNewMASimulationClient(\n this._depositExistingMASimulation,\n );\n this._withdrawMASimulation = new WithdrawMASimulationClient(\n this._editCollateralSimulation,\n ApiClient.config.chain,\n );\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 /**\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 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 * 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,iDAAwE;AACxE,8DAA8C;AAC9C,8DAA8C;AAC9C,gFAA+D;AAC/D,oDAAoC;AACpC,4DAA4C;AAE5C,0DAA0C;AAC1C,oGAAkF;AAClF,4GAAyF;AACzF,kGAA+E;AAC/E,4FAA0E;AAC1E,4HAAwG;AACxG,sGAAmF;AAEnF;;GAEG;AACH;IAgBE;QACE,IAAI,CAAC,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B,iCAAoB;QAdtC;;;;;;;;;;;;WAYG;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;IA1Pc,gBAAM,GAAkB,8BAAkB,CAAC,MAAM,CAAC,CAAC;IA2PpE,gBAAC;CAAA,AA7PD,IA6PC;AA7PY,8BAAS","sourcesContent":["import { API_CLIENT_CONFIGS, ServiceConfig } from './helpers/constants';\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 WithdrawMASimulationClient from './modules/withdraw-MA.simulation';\nimport TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-between-MAs.simulation';\nimport TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';\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 _editCollateralSimulation: EditCollateralSimulationClient;\n private readonly _depositExistingMASimulation: DepositExistingMASimulationClient;\n private readonly _depositNewMASimulation: DepositNewMASimulationClient;\n private readonly _withdrawMASimulation: WithdrawMASimulationClient;\n private readonly _transferMarginBetweenMAsSimulation: TransferMarginBetweenMAsSimulationClient;\n private readonly _transferMAPoolSimulation: TransferMAPoolSimulationClient;\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._editCollateralSimulation = new EditCollateralSimulationClient(\n this._account,\n );\n this._depositExistingMASimulation = new DepositExistingMASimulationClient(\n this._editCollateralSimulation,\n );\n this._depositNewMASimulation = new DepositNewMASimulationClient(\n this._depositExistingMASimulation,\n );\n this._withdrawMASimulation = new WithdrawMASimulationClient(\n this._editCollateralSimulation,\n ApiClient.config.chain,\n );\n this._transferMarginBetweenMAsSimulation =\n new TransferMarginBetweenMAsSimulationClient(this._account);\n this._transferMAPoolSimulation = new TransferMAPoolSimulationClient(\n this._editCollateralSimulation,\n );\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 /**\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 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/deposit-existing-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';\n\nexport type DepositExistingMASimulationLoadDataParams =\n EditCollateralSimulationLoadDataParams;\n\nexport type DepositExistingMASimulationSimulateParams = {\n moneyInOutChainId: MoneyInOutChainId;\n amount: number;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type SimulateDepositExistingMAEntity = {\n fees: number;\n feesUnderlyingToken:
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/deposit-existing-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';\n\nexport type DepositExistingMASimulationLoadDataParams =\n EditCollateralSimulationLoadDataParams;\n\nexport type DepositExistingMASimulationSimulateParams = {\n moneyInOutChainId: MoneyInOutChainId;\n amount: number;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type SimulateDepositExistingMAEntity = {\n fees: number;\n feesUnderlyingToken: TokenEntity['id'];\n bridgeTimeInMS: number;\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n};\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var TransferMAPoolSimulationClient = /** @class */ (function () {
|
|
40
|
+
function TransferMAPoolSimulationClient(editCollateralClient) {
|
|
41
|
+
// Constructor added
|
|
42
|
+
this.editCollateralClient = editCollateralClient;
|
|
43
|
+
}
|
|
44
|
+
// Method to asynchronously load data based on accountId
|
|
45
|
+
TransferMAPoolSimulationClient.prototype.arm = function (params) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0: return [4 /*yield*/, this.editCollateralClient.arm({
|
|
50
|
+
marginAccountId: params.marginAccountId,
|
|
51
|
+
})];
|
|
52
|
+
case 1:
|
|
53
|
+
_a.sent();
|
|
54
|
+
return [2 /*return*/];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
// Synchronous method to simulate operations based on an amount
|
|
60
|
+
TransferMAPoolSimulationClient.prototype.simulate = function (params) {
|
|
61
|
+
var simulateEditCollateralEntity = this.editCollateralClient.simulate({
|
|
62
|
+
signedAmount: -params.amount,
|
|
63
|
+
tokenAddress: params.tokenAddress,
|
|
64
|
+
});
|
|
65
|
+
var result = {
|
|
66
|
+
marginRatio: simulateEditCollateralEntity.marginRatio,
|
|
67
|
+
marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,
|
|
68
|
+
};
|
|
69
|
+
return result;
|
|
70
|
+
};
|
|
71
|
+
return TransferMAPoolSimulationClient;
|
|
72
|
+
}());
|
|
73
|
+
exports.default = TransferMAPoolSimulationClient;
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/transfer-MA-Pool.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;IAEE,wCAAY,oBAA0C;QACpD,oBAAoB;QACpB,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAED,wDAAwD;IAClD,4CAAG,GAAT,UAAU,MAA8C;;;;4BACtD,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,iDAAQ,GAAR,UACE,MAA8C;QAE9C,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,MAAM,GAAiC;YAC3C,WAAW,EAAE,4BAA4B,CAAC,WAAW;YACrD,iBAAiB,EAAE,4BAA4B,CAAC,iBAAiB;SAClE,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;IACH,qCAAC;AAAD,CAAC,AA9BD,IA8BC","sourcesContent":["import EditCollateralClient from '../edit-collateral.simulation';\nimport {\n TransferMAPoolSimulationLoadDataParams,\n TransferMAPoolSimulationSimulateParams,\n SimulateTransferMAPoolEntity,\n} from './types';\n\nexport default class TransferMAPoolSimulationClient {\n private editCollateralClient: EditCollateralClient;\n constructor(editCollateralClient: EditCollateralClient) {\n // Constructor added\n this.editCollateralClient = editCollateralClient;\n }\n\n // Method to asynchronously load data based on accountId\n async arm(params: TransferMAPoolSimulationLoadDataParams): 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: TransferMAPoolSimulationSimulateParams,\n ): SimulateTransferMAPoolEntity {\n const simulateEditCollateralEntity = this.editCollateralClient.simulate({\n signedAmount: -params.amount,\n tokenAddress: params.tokenAddress,\n });\n\n const result: SimulateTransferMAPoolEntity = {\n marginRatio: simulateEditCollateralEntity.marginRatio,\n marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,\n };\n\n return result;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/transfer-MA-Pool.simulation/types.ts"],"names":[],"mappings":"","sourcesContent":["import { MarginAccountEntity, TokenEntity } from '@reyaxyz/common';\nimport { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';\n\nexport type TransferMAPoolSimulationLoadDataParams =\n EditCollateralSimulationLoadDataParams;\n\nexport type TransferMAPoolSimulationSimulateParams = {\n amount: number;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type SimulateTransferMAPoolEntity = {\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n};\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var edit_collateral_simulation_1 = __importDefault(require("../edit-collateral.simulation"));
|
|
43
|
+
var TransferMarginBetweenMAsSimulationClient = /** @class */ (function () {
|
|
44
|
+
function TransferMarginBetweenMAsSimulationClient(accountClient) {
|
|
45
|
+
// Constructor added
|
|
46
|
+
this.fromEditCollateralClient = new edit_collateral_simulation_1.default(accountClient);
|
|
47
|
+
this.toEditCollateralClient = new edit_collateral_simulation_1.default(accountClient);
|
|
48
|
+
}
|
|
49
|
+
// Method to asynchronously load data based on accountId
|
|
50
|
+
TransferMarginBetweenMAsSimulationClient.prototype.arm = function (params) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0: return [4 /*yield*/, this.fromEditCollateralClient.arm({
|
|
55
|
+
marginAccountId: params.fromMarginAccountId,
|
|
56
|
+
})];
|
|
57
|
+
case 1:
|
|
58
|
+
_a.sent();
|
|
59
|
+
return [4 /*yield*/, this.toEditCollateralClient.arm({
|
|
60
|
+
marginAccountId: params.toMarginAccountId,
|
|
61
|
+
})];
|
|
62
|
+
case 2:
|
|
63
|
+
_a.sent();
|
|
64
|
+
return [2 /*return*/];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
// Synchronous method to simulate operations based on an amount
|
|
70
|
+
TransferMarginBetweenMAsSimulationClient.prototype.simulate = function (params) {
|
|
71
|
+
var simulateFromEditCollateralEntity = this.fromEditCollateralClient.simulate({
|
|
72
|
+
signedAmount: -params.amount,
|
|
73
|
+
tokenAddress: params.tokenAddress,
|
|
74
|
+
});
|
|
75
|
+
var simulateToEditCollateralEntity = this.toEditCollateralClient.simulate({
|
|
76
|
+
signedAmount: params.amount,
|
|
77
|
+
tokenAddress: params.tokenAddress,
|
|
78
|
+
});
|
|
79
|
+
var result = {
|
|
80
|
+
fromMarginRatio: simulateFromEditCollateralEntity.marginRatio,
|
|
81
|
+
fromMarginRatioHealth: simulateFromEditCollateralEntity.marginRatioHealth,
|
|
82
|
+
toMarginRatio: simulateToEditCollateralEntity.marginRatio,
|
|
83
|
+
toMarginRatioHealth: simulateToEditCollateralEntity.marginRatioHealth,
|
|
84
|
+
};
|
|
85
|
+
return result;
|
|
86
|
+
};
|
|
87
|
+
return TransferMarginBetweenMAsSimulationClient;
|
|
88
|
+
}());
|
|
89
|
+
exports.default = TransferMarginBetweenMAsSimulationClient;
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/transfer-margin-between-MAs.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,6FAA2E;AAE3E;IAGE,kDAAY,aAA4B;QACtC,oBAAoB;QACpB,IAAI,CAAC,wBAAwB,GAAG,IAAI,oCAA8B,CAChE,aAAa,CACd,CAAC;QACF,IAAI,CAAC,sBAAsB,GAAG,IAAI,oCAA8B,CAC9D,aAAa,CACd,CAAC;IACJ,CAAC;IAED,wDAAwD;IAClD,sDAAG,GAAT,UACE,MAAwD;;;;4BAExD,qBAAM,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC;4BACtC,eAAe,EAAE,MAAM,CAAC,mBAAmB;yBAC5C,CAAC,EAAA;;wBAFF,SAEE,CAAC;wBAEH,qBAAM,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC;gCACpC,eAAe,EAAE,MAAM,CAAC,iBAAiB;6BAC1C,CAAC,EAAA;;wBAFF,SAEE,CAAC;;;;;KACJ;IAED,+DAA+D;IAC/D,2DAAQ,GAAR,UACE,MAAwD;QAExD,IAAM,gCAAgC,GACpC,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC;YACrC,YAAY,EAAE,CAAC,MAAM,CAAC,MAAM;YAC5B,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CAAC;QAEL,IAAM,8BAA8B,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CACzE;YACE,YAAY,EAAE,MAAM,CAAC,MAAM;YAC3B,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CACF,CAAC;QAEF,IAAM,MAAM,GAA2C;YACrD,eAAe,EAAE,gCAAgC,CAAC,WAAW;YAC7D,qBAAqB,EAAE,gCAAgC,CAAC,iBAAiB;YACzE,aAAa,EAAE,8BAA8B,CAAC,WAAW;YACzD,mBAAmB,EAAE,8BAA8B,CAAC,iBAAiB;SACtE,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;IACH,+CAAC;AAAD,CAAC,AApDD,IAoDC","sourcesContent":["import EditCollateralClient from '../edit-collateral.simulation';\nimport {\n TransferMarginBetweenMAsSimulationLoadDataParams,\n TransferMarginBetweenMAsSimulationSimulateParams,\n SimulateTransferMarginBetweenMAsEntity,\n} from './types';\nimport AccountClient from '../account';\nimport EditCollateralSimulationClient from '../edit-collateral.simulation';\n\nexport default class TransferMarginBetweenMAsSimulationClient {\n private fromEditCollateralClient: EditCollateralClient;\n private toEditCollateralClient: EditCollateralClient;\n constructor(accountClient: AccountClient) {\n // Constructor added\n this.fromEditCollateralClient = new EditCollateralSimulationClient(\n accountClient,\n );\n this.toEditCollateralClient = new EditCollateralSimulationClient(\n accountClient,\n );\n }\n\n // Method to asynchronously load data based on accountId\n async arm(\n params: TransferMarginBetweenMAsSimulationLoadDataParams,\n ): Promise<void> {\n await this.fromEditCollateralClient.arm({\n marginAccountId: params.fromMarginAccountId,\n });\n\n await this.toEditCollateralClient.arm({\n marginAccountId: params.toMarginAccountId,\n });\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: TransferMarginBetweenMAsSimulationSimulateParams,\n ): SimulateTransferMarginBetweenMAsEntity {\n const simulateFromEditCollateralEntity =\n this.fromEditCollateralClient.simulate({\n signedAmount: -params.amount,\n tokenAddress: params.tokenAddress,\n });\n\n const simulateToEditCollateralEntity = this.toEditCollateralClient.simulate(\n {\n signedAmount: params.amount,\n tokenAddress: params.tokenAddress,\n },\n );\n\n const result: SimulateTransferMarginBetweenMAsEntity = {\n fromMarginRatio: simulateFromEditCollateralEntity.marginRatio,\n fromMarginRatioHealth: simulateFromEditCollateralEntity.marginRatioHealth,\n toMarginRatio: simulateToEditCollateralEntity.marginRatio,\n toMarginRatioHealth: simulateToEditCollateralEntity.marginRatioHealth,\n };\n\n return result;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/transfer-margin-between-MAs.simulation/types.ts"],"names":[],"mappings":"","sourcesContent":["import { MarginAccountEntity, TokenEntity } from '@reyaxyz/common';\n\nexport type TransferMarginBetweenMAsSimulationLoadDataParams = {\n fromMarginAccountId: MarginAccountEntity['id'];\n toMarginAccountId: MarginAccountEntity['id'];\n};\n\nexport type TransferMarginBetweenMAsSimulationSimulateParams = {\n amount: number;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type SimulateTransferMarginBetweenMAsEntity = {\n fromMarginRatio: MarginAccountEntity['marginRatioPercentage'];\n fromMarginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n toMarginRatio: MarginAccountEntity['marginRatioPercentage'];\n toMarginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n};\n"]}
|
|
@@ -37,6 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var common_1 = require("@reyaxyz/common");
|
|
40
|
+
var common_2 = require("@reyaxyz/common");
|
|
40
41
|
var WithdrawMASimulationClient = /** @class */ (function () {
|
|
41
42
|
function WithdrawMASimulationClient(editCollateralClient, reyaChainId) {
|
|
42
43
|
this.editCollateralClient = editCollateralClient;
|
|
@@ -70,8 +71,10 @@ var WithdrawMASimulationClient = /** @class */ (function () {
|
|
|
70
71
|
reyaChainId: this.reyaChainId,
|
|
71
72
|
tokenAddress: params.tokenAddress,
|
|
72
73
|
});
|
|
74
|
+
var feesUnderlyingToken = (0, common_2.getTokenDetails)(params.tokenAddress).tokenName;
|
|
73
75
|
return {
|
|
74
76
|
fees: fees.fees,
|
|
77
|
+
feesUnderlyingToken: feesUnderlyingToken,
|
|
75
78
|
bridgeTimeInMS: bridgeTimeInMS,
|
|
76
79
|
marginRatio: simulateEditCollateralEntity.marginRatio,
|
|
77
80
|
marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6E;AAO7E,0CAA+D;AAE/D;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,wBAAe,EAAC,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC;QAE3E,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 { getSocketBridgeTime, getSocketWithdrawFees } from '@reyaxyz/common';\nimport EditCollateralClient from '../edit-collateral.simulation';\nimport {\n SimulateWithdrawMAEntity,\n WithdrawMASimulationLoadDataParams,\n WithdrawMASimulationSimulateParams,\n} from './types';\nimport { ReyaChainId, getTokenDetails } from '@reyaxyz/common';\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 = getTokenDetails(params.tokenAddress).tokenName;\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 +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} 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 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';\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: TokenEntity['id'];\n bridgeTimeInMS: number;\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n};\n"]}
|
|
@@ -10,6 +10,8 @@ import EditCollateralSimulationClient from './modules/edit-collateral.simulation
|
|
|
10
10
|
import DepositExistingMASimulationClient from './modules/deposit-existing-MA.simulation';
|
|
11
11
|
import DepositNewMASimulationClient from './modules/deposit-new-MA.simulation';
|
|
12
12
|
import WithdrawMASimulationClient from './modules/withdraw-MA.simulation';
|
|
13
|
+
import TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-between-MAs.simulation';
|
|
14
|
+
import TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';
|
|
13
15
|
/**
|
|
14
16
|
* @description Client for API
|
|
15
17
|
*/
|
|
@@ -24,6 +26,8 @@ export declare class ApiClient {
|
|
|
24
26
|
private readonly _depositExistingMASimulation;
|
|
25
27
|
private readonly _depositNewMASimulation;
|
|
26
28
|
private readonly _withdrawMASimulation;
|
|
29
|
+
private readonly _transferMarginBetweenMAsSimulation;
|
|
30
|
+
private readonly _transferMAPoolSimulation;
|
|
27
31
|
private readonly _tokens;
|
|
28
32
|
private readonly _owner;
|
|
29
33
|
private constructor();
|
|
@@ -116,6 +120,34 @@ export declare class ApiClient {
|
|
|
116
120
|
* const withdrawMASimulationClient = ApiClient.withdrawMASimulation;
|
|
117
121
|
*/
|
|
118
122
|
static get withdrawMASimulation(): WithdrawMASimulationClient;
|
|
123
|
+
/**
|
|
124
|
+
* Provides access to the TransferMarginBetweenMAsSimulationClient instance.
|
|
125
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
126
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
127
|
+
* private `_transferMarginBetweenMAsSimulation` property, ensuring that trade simulation operations
|
|
128
|
+
* use a consistent client configuration and state.
|
|
129
|
+
*
|
|
130
|
+
* @returns {TransferMarginBetweenMAsSimulationClient} An instance of TransferMarginBetweenMAsSimulationClient for trade simulation operations.
|
|
131
|
+
* @memberof ApiClient
|
|
132
|
+
* @example
|
|
133
|
+
* // Access the transfer margin between MAs simulation client from the ApiClient
|
|
134
|
+
* const transferMarginBetweenMAsSimulationClient = ApiClient.transferMarginBetweenMAsSimulation;
|
|
135
|
+
*/
|
|
136
|
+
static get transferMarginBetweenMAsSimulation(): TransferMarginBetweenMAsSimulationClient;
|
|
137
|
+
/**
|
|
138
|
+
* Provides access to the TransferMAPoolSimulationClient instance.
|
|
139
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
140
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
141
|
+
* private `_TransferMAPoolSimulation` property, ensuring that trade simulation operations
|
|
142
|
+
* use a consistent client configuration and state.
|
|
143
|
+
*
|
|
144
|
+
* @returns {TransferMAPoolSimulationClient} An instance of TransferMAPoolSimulationClient for trade simulation operations.
|
|
145
|
+
* @memberof ApiClient
|
|
146
|
+
* @example
|
|
147
|
+
* // Access the transfer from MA to Pool simulation client from the ApiClient
|
|
148
|
+
* const transferMAPoolSimulationClient = ApiClient.transferMAPoolSimulation;
|
|
149
|
+
*/
|
|
150
|
+
static get transferMAPoolSimulation(): TransferMAPoolSimulationClient;
|
|
119
151
|
/**
|
|
120
152
|
* Gets the current instance of the LpClient from the ApiClient.
|
|
121
153
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,QAAQ,MAAM,cAAc,CAAC;AACpC,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,8BAA8B,MAAM,sCAAsC,CAAC;AAClF,OAAO,iCAAiC,MAAM,0CAA0C,CAAC;AACzF,OAAO,4BAA4B,MAAM,qCAAqC,CAAC;AAC/E,OAAO,0BAA0B,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,QAAQ,MAAM,cAAc,CAAC;AACpC,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO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B,CAEzD;IAED;;;;;;;;;;;;OAYG;IAEH,WAAkB,8BAA8B,IAAI,8BAA8B,CAEjF;IAED;;;;;;;;;;;;OAYG;IAEH,WAAkB,2BAA2B,IAAI,iCAAiC,CAEjF;IAED;;;;;;;;;;;;OAYG;IAEH,WAAkB,sBAAsB,IAAI,4BAA4B,CAEvE;IAED;;;;;;;;;;;;OAYG;IAEH,WAAkB,oBAAoB,IAAI,0BAA0B,CAEnE;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"}
|
|
@@ -8,7 +8,7 @@ export type DepositExistingMASimulationSimulateParams = {
|
|
|
8
8
|
};
|
|
9
9
|
export type SimulateDepositExistingMAEntity = {
|
|
10
10
|
fees: number;
|
|
11
|
-
feesUnderlyingToken:
|
|
11
|
+
feesUnderlyingToken: TokenEntity['id'];
|
|
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/deposit-existing-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;AAE7F,MAAM,MAAM,yCAAyC,GACnD,sCAAsC,CAAC;AAEzC,MAAM,MAAM,yCAAyC,GAAG;IACtD,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-existing-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;AAE7F,MAAM,MAAM,yCAAyC,GACnD,sCAAsC,CAAC;AAEzC,MAAM,MAAM,yCAAyC,GAAG;IACtD,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,WAAW,CAAC,IAAI,CAAC,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,9 @@
|
|
|
1
|
+
import EditCollateralClient from '../edit-collateral.simulation';
|
|
2
|
+
import { TransferMAPoolSimulationLoadDataParams, TransferMAPoolSimulationSimulateParams, SimulateTransferMAPoolEntity } from './types';
|
|
3
|
+
export default class TransferMAPoolSimulationClient {
|
|
4
|
+
private editCollateralClient;
|
|
5
|
+
constructor(editCollateralClient: EditCollateralClient);
|
|
6
|
+
arm(params: TransferMAPoolSimulationLoadDataParams): Promise<void>;
|
|
7
|
+
simulate(params: TransferMAPoolSimulationSimulateParams): SimulateTransferMAPoolEntity;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/transfer-MA-Pool.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,sCAAsC,EACtC,sCAAsC,EACtC,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,8BAA8B;IACjD,OAAO,CAAC,oBAAoB,CAAuB;gBACvC,oBAAoB,EAAE,oBAAoB;IAMhD,GAAG,CAAC,MAAM,EAAE,sCAAsC,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxE,QAAQ,CACN,MAAM,EAAE,sCAAsC,GAC7C,4BAA4B;CAahC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MarginAccountEntity, TokenEntity } from '@reyaxyz/common';
|
|
2
|
+
import { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';
|
|
3
|
+
export type TransferMAPoolSimulationLoadDataParams = EditCollateralSimulationLoadDataParams;
|
|
4
|
+
export type TransferMAPoolSimulationSimulateParams = {
|
|
5
|
+
amount: number;
|
|
6
|
+
tokenAddress: TokenEntity['address'];
|
|
7
|
+
};
|
|
8
|
+
export type SimulateTransferMAPoolEntity = {
|
|
9
|
+
marginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
10
|
+
marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/transfer-MA-Pool.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,sCAAsC,EAAE,MAAM,qCAAqC,CAAC;AAE7F,MAAM,MAAM,sCAAsC,GAChD,sCAAsC,CAAC;AAEzC,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;CAC7D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TransferMarginBetweenMAsSimulationLoadDataParams, TransferMarginBetweenMAsSimulationSimulateParams, SimulateTransferMarginBetweenMAsEntity } from './types';
|
|
2
|
+
import AccountClient from '../account';
|
|
3
|
+
export default class TransferMarginBetweenMAsSimulationClient {
|
|
4
|
+
private fromEditCollateralClient;
|
|
5
|
+
private toEditCollateralClient;
|
|
6
|
+
constructor(accountClient: AccountClient);
|
|
7
|
+
arm(params: TransferMarginBetweenMAsSimulationLoadDataParams): Promise<void>;
|
|
8
|
+
simulate(params: TransferMarginBetweenMAsSimulationSimulateParams): SimulateTransferMarginBetweenMAsEntity;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/transfer-margin-between-MAs.simulation/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gDAAgD,EAChD,gDAAgD,EAChD,sCAAsC,EACvC,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,MAAM,YAAY,CAAC;AAGvC,MAAM,CAAC,OAAO,OAAO,wCAAwC;IAC3D,OAAO,CAAC,wBAAwB,CAAuB;IACvD,OAAO,CAAC,sBAAsB,CAAuB;gBACzC,aAAa,EAAE,aAAa;IAWlC,GAAG,CACP,MAAM,EAAE,gDAAgD,GACvD,OAAO,CAAC,IAAI,CAAC;IAWhB,QAAQ,CACN,MAAM,EAAE,gDAAgD,GACvD,sCAAsC;CAuB1C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MarginAccountEntity, TokenEntity } from '@reyaxyz/common';
|
|
2
|
+
export type TransferMarginBetweenMAsSimulationLoadDataParams = {
|
|
3
|
+
fromMarginAccountId: MarginAccountEntity['id'];
|
|
4
|
+
toMarginAccountId: MarginAccountEntity['id'];
|
|
5
|
+
};
|
|
6
|
+
export type TransferMarginBetweenMAsSimulationSimulateParams = {
|
|
7
|
+
amount: number;
|
|
8
|
+
tokenAddress: TokenEntity['address'];
|
|
9
|
+
};
|
|
10
|
+
export type SimulateTransferMarginBetweenMAsEntity = {
|
|
11
|
+
fromMarginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
12
|
+
fromMarginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
13
|
+
toMarginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
14
|
+
toMarginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/transfer-margin-between-MAs.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,MAAM,gDAAgD,GAAG;IAC7D,mBAAmB,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC/C,iBAAiB,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,gDAAgD,GAAG;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,eAAe,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;IAC9D,qBAAqB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;IAChE,aAAa,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;IAC5D,mBAAmB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;CAC/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAE/D,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"}
|
|
@@ -8,6 +8,7 @@ export type WithdrawMASimulationSimulateParams = {
|
|
|
8
8
|
};
|
|
9
9
|
export type SimulateWithdrawMAEntity = {
|
|
10
10
|
fees: number;
|
|
11
|
+
feesUnderlyingToken: TokenEntity['id'];
|
|
11
12
|
bridgeTimeInMS: number;
|
|
12
13
|
marginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
13
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,EACZ,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,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;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,WAAW,CAAC,IAAI,CAAC,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;CAC7D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/api-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@reyaxyz/common": "0.
|
|
36
|
+
"@reyaxyz/common": "0.24.0",
|
|
37
37
|
"axios": "^1.6.2",
|
|
38
38
|
"bignumber.js": "^9.1.2"
|
|
39
39
|
},
|
|
40
40
|
"packageManager": "pnpm@8.10.4",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "69c426121209165bda9742354b5294d51a989096"
|
|
42
42
|
}
|
|
@@ -10,6 +10,8 @@ import EditCollateralSimulationClient from './modules/edit-collateral.simulation
|
|
|
10
10
|
import DepositExistingMASimulationClient from './modules/deposit-existing-MA.simulation';
|
|
11
11
|
import DepositNewMASimulationClient from './modules/deposit-new-MA.simulation';
|
|
12
12
|
import WithdrawMASimulationClient from './modules/withdraw-MA.simulation';
|
|
13
|
+
import TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-between-MAs.simulation';
|
|
14
|
+
import TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* @description Client for API
|
|
@@ -25,6 +27,8 @@ export class ApiClient {
|
|
|
25
27
|
private readonly _depositExistingMASimulation: DepositExistingMASimulationClient;
|
|
26
28
|
private readonly _depositNewMASimulation: DepositNewMASimulationClient;
|
|
27
29
|
private readonly _withdrawMASimulation: WithdrawMASimulationClient;
|
|
30
|
+
private readonly _transferMarginBetweenMAsSimulation: TransferMarginBetweenMAsSimulationClient;
|
|
31
|
+
private readonly _transferMAPoolSimulation: TransferMAPoolSimulationClient;
|
|
28
32
|
private readonly _tokens: TokensClient;
|
|
29
33
|
private readonly _owner: OwnerClient;
|
|
30
34
|
|
|
@@ -46,6 +50,11 @@ export class ApiClient {
|
|
|
46
50
|
this._editCollateralSimulation,
|
|
47
51
|
ApiClient.config.chain,
|
|
48
52
|
);
|
|
53
|
+
this._transferMarginBetweenMAsSimulation =
|
|
54
|
+
new TransferMarginBetweenMAsSimulationClient(this._account);
|
|
55
|
+
this._transferMAPoolSimulation = new TransferMAPoolSimulationClient(
|
|
56
|
+
this._editCollateralSimulation,
|
|
57
|
+
);
|
|
49
58
|
this._tokens = new TokensClient(ApiClient.config.apiEndpoint);
|
|
50
59
|
this._owner = new OwnerClient(ApiClient.config.apiEndpoint);
|
|
51
60
|
}
|
|
@@ -183,6 +192,42 @@ export class ApiClient {
|
|
|
183
192
|
return ApiClient.getInstance()._withdrawMASimulation;
|
|
184
193
|
}
|
|
185
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Provides access to the TransferMarginBetweenMAsSimulationClient instance.
|
|
197
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
198
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
199
|
+
* private `_transferMarginBetweenMAsSimulation` property, ensuring that trade simulation operations
|
|
200
|
+
* use a consistent client configuration and state.
|
|
201
|
+
*
|
|
202
|
+
* @returns {TransferMarginBetweenMAsSimulationClient} An instance of TransferMarginBetweenMAsSimulationClient for trade simulation operations.
|
|
203
|
+
* @memberof ApiClient
|
|
204
|
+
* @example
|
|
205
|
+
* // Access the transfer margin between MAs simulation client from the ApiClient
|
|
206
|
+
* const transferMarginBetweenMAsSimulationClient = ApiClient.transferMarginBetweenMAsSimulation;
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
public static get transferMarginBetweenMAsSimulation(): TransferMarginBetweenMAsSimulationClient {
|
|
210
|
+
return ApiClient.getInstance()._transferMarginBetweenMAsSimulation;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Provides access to the TransferMAPoolSimulationClient instance.
|
|
215
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
216
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
217
|
+
* private `_TransferMAPoolSimulation` property, ensuring that trade simulation operations
|
|
218
|
+
* use a consistent client configuration and state.
|
|
219
|
+
*
|
|
220
|
+
* @returns {TransferMAPoolSimulationClient} An instance of TransferMAPoolSimulationClient for trade simulation operations.
|
|
221
|
+
* @memberof ApiClient
|
|
222
|
+
* @example
|
|
223
|
+
* // Access the transfer from MA to Pool simulation client from the ApiClient
|
|
224
|
+
* const transferMAPoolSimulationClient = ApiClient.transferMAPoolSimulation;
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
public static get transferMAPoolSimulation(): TransferMAPoolSimulationClient {
|
|
228
|
+
return ApiClient.getInstance()._transferMAPoolSimulation;
|
|
229
|
+
}
|
|
230
|
+
|
|
186
231
|
/**
|
|
187
232
|
* Gets the current instance of the LpClient from the ApiClient.
|
|
188
233
|
*
|
|
@@ -16,7 +16,7 @@ export type DepositExistingMASimulationSimulateParams = {
|
|
|
16
16
|
|
|
17
17
|
export type SimulateDepositExistingMAEntity = {
|
|
18
18
|
fees: number;
|
|
19
|
-
feesUnderlyingToken:
|
|
19
|
+
feesUnderlyingToken: TokenEntity['id'];
|
|
20
20
|
bridgeTimeInMS: number;
|
|
21
21
|
marginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
22
22
|
marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import EditCollateralClient from '../edit-collateral.simulation';
|
|
2
|
+
import {
|
|
3
|
+
TransferMAPoolSimulationLoadDataParams,
|
|
4
|
+
TransferMAPoolSimulationSimulateParams,
|
|
5
|
+
SimulateTransferMAPoolEntity,
|
|
6
|
+
} from './types';
|
|
7
|
+
|
|
8
|
+
export default class TransferMAPoolSimulationClient {
|
|
9
|
+
private editCollateralClient: EditCollateralClient;
|
|
10
|
+
constructor(editCollateralClient: EditCollateralClient) {
|
|
11
|
+
// Constructor added
|
|
12
|
+
this.editCollateralClient = editCollateralClient;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Method to asynchronously load data based on accountId
|
|
16
|
+
async arm(params: TransferMAPoolSimulationLoadDataParams): Promise<void> {
|
|
17
|
+
await this.editCollateralClient.arm({
|
|
18
|
+
marginAccountId: params.marginAccountId,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Synchronous method to simulate operations based on an amount
|
|
23
|
+
simulate(
|
|
24
|
+
params: TransferMAPoolSimulationSimulateParams,
|
|
25
|
+
): SimulateTransferMAPoolEntity {
|
|
26
|
+
const simulateEditCollateralEntity = this.editCollateralClient.simulate({
|
|
27
|
+
signedAmount: -params.amount,
|
|
28
|
+
tokenAddress: params.tokenAddress,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const result: SimulateTransferMAPoolEntity = {
|
|
32
|
+
marginRatio: simulateEditCollateralEntity.marginRatio,
|
|
33
|
+
marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MarginAccountEntity, TokenEntity } from '@reyaxyz/common';
|
|
2
|
+
import { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';
|
|
3
|
+
|
|
4
|
+
export type TransferMAPoolSimulationLoadDataParams =
|
|
5
|
+
EditCollateralSimulationLoadDataParams;
|
|
6
|
+
|
|
7
|
+
export type TransferMAPoolSimulationSimulateParams = {
|
|
8
|
+
amount: number;
|
|
9
|
+
tokenAddress: TokenEntity['address'];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type SimulateTransferMAPoolEntity = {
|
|
13
|
+
marginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
14
|
+
marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
15
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import EditCollateralClient from '../edit-collateral.simulation';
|
|
2
|
+
import {
|
|
3
|
+
TransferMarginBetweenMAsSimulationLoadDataParams,
|
|
4
|
+
TransferMarginBetweenMAsSimulationSimulateParams,
|
|
5
|
+
SimulateTransferMarginBetweenMAsEntity,
|
|
6
|
+
} from './types';
|
|
7
|
+
import AccountClient from '../account';
|
|
8
|
+
import EditCollateralSimulationClient from '../edit-collateral.simulation';
|
|
9
|
+
|
|
10
|
+
export default class TransferMarginBetweenMAsSimulationClient {
|
|
11
|
+
private fromEditCollateralClient: EditCollateralClient;
|
|
12
|
+
private toEditCollateralClient: EditCollateralClient;
|
|
13
|
+
constructor(accountClient: AccountClient) {
|
|
14
|
+
// Constructor added
|
|
15
|
+
this.fromEditCollateralClient = new EditCollateralSimulationClient(
|
|
16
|
+
accountClient,
|
|
17
|
+
);
|
|
18
|
+
this.toEditCollateralClient = new EditCollateralSimulationClient(
|
|
19
|
+
accountClient,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Method to asynchronously load data based on accountId
|
|
24
|
+
async arm(
|
|
25
|
+
params: TransferMarginBetweenMAsSimulationLoadDataParams,
|
|
26
|
+
): Promise<void> {
|
|
27
|
+
await this.fromEditCollateralClient.arm({
|
|
28
|
+
marginAccountId: params.fromMarginAccountId,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
await this.toEditCollateralClient.arm({
|
|
32
|
+
marginAccountId: params.toMarginAccountId,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Synchronous method to simulate operations based on an amount
|
|
37
|
+
simulate(
|
|
38
|
+
params: TransferMarginBetweenMAsSimulationSimulateParams,
|
|
39
|
+
): SimulateTransferMarginBetweenMAsEntity {
|
|
40
|
+
const simulateFromEditCollateralEntity =
|
|
41
|
+
this.fromEditCollateralClient.simulate({
|
|
42
|
+
signedAmount: -params.amount,
|
|
43
|
+
tokenAddress: params.tokenAddress,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const simulateToEditCollateralEntity = this.toEditCollateralClient.simulate(
|
|
47
|
+
{
|
|
48
|
+
signedAmount: params.amount,
|
|
49
|
+
tokenAddress: params.tokenAddress,
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const result: SimulateTransferMarginBetweenMAsEntity = {
|
|
54
|
+
fromMarginRatio: simulateFromEditCollateralEntity.marginRatio,
|
|
55
|
+
fromMarginRatioHealth: simulateFromEditCollateralEntity.marginRatioHealth,
|
|
56
|
+
toMarginRatio: simulateToEditCollateralEntity.marginRatio,
|
|
57
|
+
toMarginRatioHealth: simulateToEditCollateralEntity.marginRatioHealth,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MarginAccountEntity, TokenEntity } from '@reyaxyz/common';
|
|
2
|
+
|
|
3
|
+
export type TransferMarginBetweenMAsSimulationLoadDataParams = {
|
|
4
|
+
fromMarginAccountId: MarginAccountEntity['id'];
|
|
5
|
+
toMarginAccountId: MarginAccountEntity['id'];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type TransferMarginBetweenMAsSimulationSimulateParams = {
|
|
9
|
+
amount: number;
|
|
10
|
+
tokenAddress: TokenEntity['address'];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type SimulateTransferMarginBetweenMAsEntity = {
|
|
14
|
+
fromMarginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
15
|
+
fromMarginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
16
|
+
toMarginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
17
|
+
toMarginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
18
|
+
};
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
WithdrawMASimulationLoadDataParams,
|
|
6
6
|
WithdrawMASimulationSimulateParams,
|
|
7
7
|
} from './types';
|
|
8
|
-
import { ReyaChainId } from '@reyaxyz/common';
|
|
8
|
+
import { ReyaChainId, getTokenDetails } from '@reyaxyz/common';
|
|
9
9
|
|
|
10
10
|
export default class WithdrawMASimulationClient {
|
|
11
11
|
private editCollateralClient: EditCollateralClient;
|
|
@@ -44,8 +44,11 @@ export default class WithdrawMASimulationClient {
|
|
|
44
44
|
tokenAddress: params.tokenAddress,
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
+
const feesUnderlyingToken = getTokenDetails(params.tokenAddress).tokenName;
|
|
48
|
+
|
|
47
49
|
return {
|
|
48
50
|
fees: fees.fees,
|
|
51
|
+
feesUnderlyingToken: feesUnderlyingToken,
|
|
49
52
|
bridgeTimeInMS: bridgeTimeInMS,
|
|
50
53
|
marginRatio: simulateEditCollateralEntity.marginRatio,
|
|
51
54
|
marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,
|
|
@@ -16,6 +16,7 @@ export type WithdrawMASimulationSimulateParams = {
|
|
|
16
16
|
|
|
17
17
|
export type SimulateWithdrawMAEntity = {
|
|
18
18
|
fees: number;
|
|
19
|
+
feesUnderlyingToken: TokenEntity['id'];
|
|
19
20
|
bridgeTimeInMS: number;
|
|
20
21
|
marginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
21
22
|
marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|