@reyaxyz/api-sdk 0.46.2 → 0.47.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.
|
@@ -26,6 +26,7 @@ var owner_1 = __importDefault(require("./modules/owner"));
|
|
|
26
26
|
var edit_collateral_simulation_1 = __importDefault(require("./modules/edit-collateral.simulation"));
|
|
27
27
|
var deposit_existing_MA_simulation_1 = __importDefault(require("./modules/deposit-existing-MA.simulation"));
|
|
28
28
|
var deposit_new_MA_simulation_1 = __importDefault(require("./modules/deposit-new-MA.simulation"));
|
|
29
|
+
var withdraw_MA_simulation_1 = __importDefault(require("./modules/withdraw-MA.simulation"));
|
|
29
30
|
/**
|
|
30
31
|
* @description Client for API
|
|
31
32
|
*/
|
|
@@ -47,6 +48,7 @@ var ApiClient = /** @class */ (function () {
|
|
|
47
48
|
this._deposit_existing_MA_simulation =
|
|
48
49
|
new deposit_existing_MA_simulation_1.default(this._edit_collateral_simulation);
|
|
49
50
|
this._deposit_new_MA_simulation = new deposit_new_MA_simulation_1.default(this._deposit_existing_MA_simulation);
|
|
51
|
+
this._withdraw_MA_simulation = new withdraw_MA_simulation_1.default(this._edit_collateral_simulation);
|
|
50
52
|
this._tokens = new tokens_1.default(this.apiEndpoint);
|
|
51
53
|
this._owner = new owner_1.default(this.apiEndpoint);
|
|
52
54
|
}
|
|
@@ -178,6 +180,26 @@ var ApiClient = /** @class */ (function () {
|
|
|
178
180
|
enumerable: false,
|
|
179
181
|
configurable: true
|
|
180
182
|
});
|
|
183
|
+
Object.defineProperty(ApiClient, "withdrawMASimulation", {
|
|
184
|
+
/**
|
|
185
|
+
* Provides access to the WithdrawMASimulationClient instance.
|
|
186
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
187
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
188
|
+
* private `_withdraw_MA_simulation` property, ensuring that trade simulation operations
|
|
189
|
+
* use a consistent client configuration and state.
|
|
190
|
+
*
|
|
191
|
+
* @returns {WithdrawMASimulationClient} An instance of WithrawMASimulationClient for trade simulation operations.
|
|
192
|
+
* @memberof ApiClient
|
|
193
|
+
* @example
|
|
194
|
+
* // Access the withdraw MA simulation client from the ApiClient
|
|
195
|
+
* const withdrawMASimulationClient = ApiClient.withdrawMASimulation;
|
|
196
|
+
*/
|
|
197
|
+
get: function () {
|
|
198
|
+
return ApiClient.getInstance()._withdraw_MA_simulation;
|
|
199
|
+
},
|
|
200
|
+
enumerable: false,
|
|
201
|
+
configurable: true
|
|
202
|
+
});
|
|
181
203
|
Object.defineProperty(ApiClient, "lp", {
|
|
182
204
|
/**
|
|
183
205
|
* 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,iDAA2E;AAC3E,8DAA8C;AAC9C,8DAA8C;AAC9C,gFAA+D;AAC/D,oDAAoC;AACpC,4DAA4C;AAC5C,0CAA8C;AAC9C,0DAA0C;AAC1C,oGAAkF;AAClF,4GAAyF;AACzF,kGAA+E;AAE/E;;GAEG;AACH;IAkBE,mBAAoB,MAAqB;QACvC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW;YACnC,CAAC,CAAC,oBAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;YAC9B,CAAC,CAAC,oBAAQ,CAAC,MAAM,CAAC,CAAC;QACrB,SAAS,CAAC,KAAK;YACb,MAAM,CAAC,WAAW,KAAK,YAAY;gBACjC,CAAC,CAAC,oBAAW,CAAC,WAAW;gBACzB,CAAC,CAAC,oBAAW,CAAC,UAAU,CAAC;QAC7B,SAAS,CAAC,MAAM,yBAAQ,SAAS,CAAC,MAAM,GAAK,MAAM,CAAE,CAAC;QACtD,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,CAAC,QA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AtMY,8BAAS","sourcesContent":["import { API_TIMEOUT, API_URLS, 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';\n\n/**\n * @description Client for API\n */\nexport class ApiClient {\n private static instance: ApiClient;\n private static config: ServiceConfig = {\n environment: 'test', // default value\n timeout: API_TIMEOUT, // default value, e.g., 5000 milliseconds\n };\n private readonly apiEndpoint: string;\n private readonly _markets: MarketsClient;\n private readonly _account: AccountClient;\n private readonly _lp: LpClient;\n private readonly _trade_simulation: TradeSimulationClient;\n private readonly _edit_collateral_simulation: EditCollateralSimulationClient;\n private readonly _deposit_existing_MA_simulation: DepositExistingMASimulationClient;\n private readonly _deposit_new_MA_simulation: DepositNewMASimulationClient;\n private readonly _tokens: TokensClient;\n private readonly _owner: OwnerClient;\n private static chain: ReyaChainId;\n\n private constructor(config: ServiceConfig) {\n this.apiEndpoint = config.environment\n ? API_URLS[config.environment]\n : API_URLS['test'];\n ApiClient.chain =\n config.environment === 'production'\n ? ReyaChainId.reyaNetwork\n : ReyaChainId.reyaCronos;\n ApiClient.config = { ...ApiClient.config, ...config };\n this._markets = new MarketsClient(this.apiEndpoint);\n this._account = new AccountClient(this.apiEndpoint);\n this._lp = new LpClient(this.apiEndpoint);\n this._trade_simulation = new TradeSimulationClient(this._account);\n this._edit_collateral_simulation = new EditCollateralSimulationClient(\n this._account,\n );\n this._deposit_existing_MA_simulation =\n new DepositExistingMASimulationClient(this._edit_collateral_simulation);\n this._deposit_new_MA_simulation = new DepositNewMASimulationClient(\n this._deposit_existing_MA_simulation,\n );\n this._tokens = new TokensClient(this.apiEndpoint);\n this._owner = new OwnerClient(this.apiEndpoint);\n }\n\n public static configure(config: ServiceConfig): void {\n ApiClient.config = config;\n ApiClient.instance = new ApiClient(config);\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.chain) {\n throw new Error('ApiClient is not configured');\n }\n return ApiClient.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 `_trade_simulation` 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()._trade_simulation;\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 `_edit_collateral_simulation` 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()._edit_collateral_simulation;\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 `_deposit_existing_MA_simulation` 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()._deposit_existing_MA_simulation;\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 `_deposit_new_MA_simulation` 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()._deposit_new_MA_simulation;\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,iDAA2E;AAC3E,8DAA8C;AAC9C,8DAA8C;AAC9C,gFAA+D;AAC/D,oDAAoC;AACpC,4DAA4C;AAC5C,0CAA8C;AAC9C,0DAA0C;AAC1C,oGAAkF;AAClF,4GAAyF;AACzF,kGAA+E;AAC/E,4FAA0E;AAE1E;;GAEG;AACH;IAmBE,mBAAoB,MAAqB;QACvC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW;YACnC,CAAC,CAAC,oBAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;YAC9B,CAAC,CAAC,oBAAQ,CAAC,MAAM,CAAC,CAAC;QACrB,SAAS,CAAC,KAAK;YACb,MAAM,CAAC,WAAW,KAAK,YAAY;gBACjC,CAAC,CAAC,oBAAW,CAAC,WAAW;gBACzB,CAAC,CAAC,oBAAW,CAAC,UAAU,CAAC;QAC7B,SAAS,CAAC,MAAM,yBAAQ,SAAS,CAAC,MAAM,GAAK,MAAM,CAAE,CAAC;QACtD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AAE,CAAC,OAAO,CAAC;QACzC,CAAC;;;OAAA;IAYD,sBAAkB,kBAAK;QAVvB;;;;;;;;;WASG;aACH;YACE,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC;QACxC,CAAC;;;OAAA;IAzNc,gBAAM,GAAkB;QACrC,WAAW,EAAE,MAAM,EAAE,gBAAgB;QACrC,OAAO,EAAE,uBAAW,EAAE,yCAAyC;KAChE,CAAC;IAuNJ,gBAAC;CAAA,AA5ND,IA4NC;AA5NY,8BAAS","sourcesContent":["import { API_TIMEOUT, API_URLS, 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 = {\n environment: 'test', // default value\n timeout: API_TIMEOUT, // default value, e.g., 5000 milliseconds\n };\n private readonly apiEndpoint: string;\n private readonly _markets: MarketsClient;\n private readonly _account: AccountClient;\n private readonly _lp: LpClient;\n private readonly _trade_simulation: TradeSimulationClient;\n private readonly _edit_collateral_simulation: EditCollateralSimulationClient;\n private readonly _deposit_existing_MA_simulation: DepositExistingMASimulationClient;\n private readonly _deposit_new_MA_simulation: DepositNewMASimulationClient;\n private readonly _withdraw_MA_simulation: WithdrawMASimulationClient;\n private readonly _tokens: TokensClient;\n private readonly _owner: OwnerClient;\n private static chain: ReyaChainId;\n\n private constructor(config: ServiceConfig) {\n this.apiEndpoint = config.environment\n ? API_URLS[config.environment]\n : API_URLS['test'];\n ApiClient.chain =\n config.environment === 'production'\n ? ReyaChainId.reyaNetwork\n : ReyaChainId.reyaCronos;\n ApiClient.config = { ...ApiClient.config, ...config };\n this._markets = new MarketsClient(this.apiEndpoint);\n this._account = new AccountClient(this.apiEndpoint);\n this._lp = new LpClient(this.apiEndpoint);\n this._trade_simulation = new TradeSimulationClient(this._account);\n this._edit_collateral_simulation = new EditCollateralSimulationClient(\n this._account,\n );\n this._deposit_existing_MA_simulation =\n new DepositExistingMASimulationClient(this._edit_collateral_simulation);\n this._deposit_new_MA_simulation = new DepositNewMASimulationClient(\n this._deposit_existing_MA_simulation,\n );\n this._withdraw_MA_simulation = new WithdrawMASimulationClient(\n this._edit_collateral_simulation,\n );\n this._tokens = new TokensClient(this.apiEndpoint);\n this._owner = new OwnerClient(this.apiEndpoint);\n }\n\n public static configure(config: ServiceConfig): void {\n ApiClient.config = config;\n ApiClient.instance = new ApiClient(config);\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.chain) {\n throw new Error('ApiClient is not configured');\n }\n return ApiClient.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 `_trade_simulation` 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()._trade_simulation;\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 `_edit_collateral_simulation` 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()._edit_collateral_simulation;\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 `_deposit_existing_MA_simulation` 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()._deposit_existing_MA_simulation;\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 `_deposit_new_MA_simulation` 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()._deposit_new_MA_simulation;\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 `_withdraw_MA_simulation` 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()._withdraw_MA_simulation;\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"]}
|
|
@@ -9,6 +9,7 @@ import OwnerClient from './modules/owner';
|
|
|
9
9
|
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
|
+
import WithdrawMASimulationClient from './modules/withdraw-MA.simulation';
|
|
12
13
|
/**
|
|
13
14
|
* @description Client for API
|
|
14
15
|
*/
|
|
@@ -23,6 +24,7 @@ export declare class ApiClient {
|
|
|
23
24
|
private readonly _edit_collateral_simulation;
|
|
24
25
|
private readonly _deposit_existing_MA_simulation;
|
|
25
26
|
private readonly _deposit_new_MA_simulation;
|
|
27
|
+
private readonly _withdraw_MA_simulation;
|
|
26
28
|
private readonly _tokens;
|
|
27
29
|
private readonly _owner;
|
|
28
30
|
private static chain;
|
|
@@ -102,6 +104,20 @@ export declare class ApiClient {
|
|
|
102
104
|
* const depositNewMASimulationClient = ApiClient.depositNewMASimulation;
|
|
103
105
|
*/
|
|
104
106
|
static get depositNewMASimulation(): DepositNewMASimulationClient;
|
|
107
|
+
/**
|
|
108
|
+
* Provides access to the WithdrawMASimulationClient instance.
|
|
109
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
110
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
111
|
+
* private `_withdraw_MA_simulation` property, ensuring that trade simulation operations
|
|
112
|
+
* use a consistent client configuration and state.
|
|
113
|
+
*
|
|
114
|
+
* @returns {WithdrawMASimulationClient} An instance of WithrawMASimulationClient for trade simulation operations.
|
|
115
|
+
* @memberof ApiClient
|
|
116
|
+
* @example
|
|
117
|
+
* // Access the withdraw MA simulation client from the ApiClient
|
|
118
|
+
* const withdrawMASimulationClient = ApiClient.withdrawMASimulation;
|
|
119
|
+
*/
|
|
120
|
+
static get withdrawMASimulation(): WithdrawMASimulationClient;
|
|
105
121
|
/**
|
|
106
122
|
* Gets the current instance of the LpClient from the ApiClient.
|
|
107
123
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,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;
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"/","sources":["clients/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,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,4BAA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AA4B,CAEvE;IAED;;;;;;;;;;;;OAYG;IAEH,WAAkB,oBAAoB,IAAI,0BAA0B,CAEnE;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/api-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"bignumber.js": "^9.1.2"
|
|
39
39
|
},
|
|
40
40
|
"packageManager": "pnpm@8.10.4",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "74c223cd03a26481a44c924c18c41df4447ce820"
|
|
42
42
|
}
|
|
@@ -9,6 +9,7 @@ import OwnerClient from './modules/owner';
|
|
|
9
9
|
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
|
+
import WithdrawMASimulationClient from './modules/withdraw-MA.simulation';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @description Client for API
|
|
@@ -27,6 +28,7 @@ export class ApiClient {
|
|
|
27
28
|
private readonly _edit_collateral_simulation: EditCollateralSimulationClient;
|
|
28
29
|
private readonly _deposit_existing_MA_simulation: DepositExistingMASimulationClient;
|
|
29
30
|
private readonly _deposit_new_MA_simulation: DepositNewMASimulationClient;
|
|
31
|
+
private readonly _withdraw_MA_simulation: WithdrawMASimulationClient;
|
|
30
32
|
private readonly _tokens: TokensClient;
|
|
31
33
|
private readonly _owner: OwnerClient;
|
|
32
34
|
private static chain: ReyaChainId;
|
|
@@ -52,6 +54,9 @@ export class ApiClient {
|
|
|
52
54
|
this._deposit_new_MA_simulation = new DepositNewMASimulationClient(
|
|
53
55
|
this._deposit_existing_MA_simulation,
|
|
54
56
|
);
|
|
57
|
+
this._withdraw_MA_simulation = new WithdrawMASimulationClient(
|
|
58
|
+
this._edit_collateral_simulation,
|
|
59
|
+
);
|
|
55
60
|
this._tokens = new TokensClient(this.apiEndpoint);
|
|
56
61
|
this._owner = new OwnerClient(this.apiEndpoint);
|
|
57
62
|
}
|
|
@@ -170,6 +175,24 @@ export class ApiClient {
|
|
|
170
175
|
return ApiClient.getInstance()._deposit_new_MA_simulation;
|
|
171
176
|
}
|
|
172
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Provides access to the WithdrawMASimulationClient instance.
|
|
180
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
181
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
182
|
+
* private `_withdraw_MA_simulation` property, ensuring that trade simulation operations
|
|
183
|
+
* use a consistent client configuration and state.
|
|
184
|
+
*
|
|
185
|
+
* @returns {WithdrawMASimulationClient} An instance of WithrawMASimulationClient for trade simulation operations.
|
|
186
|
+
* @memberof ApiClient
|
|
187
|
+
* @example
|
|
188
|
+
* // Access the withdraw MA simulation client from the ApiClient
|
|
189
|
+
* const withdrawMASimulationClient = ApiClient.withdrawMASimulation;
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
public static get withdrawMASimulation(): WithdrawMASimulationClient {
|
|
193
|
+
return ApiClient.getInstance()._withdraw_MA_simulation;
|
|
194
|
+
}
|
|
195
|
+
|
|
173
196
|
/**
|
|
174
197
|
* Gets the current instance of the LpClient from the ApiClient.
|
|
175
198
|
*
|