@reyaxyz/api-sdk 0.44.0 → 0.45.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 +67 -0
- package/dist/clients/api-client.js.map +1 -1
- package/dist/clients/modules/account/index.js +9 -0
- package/dist/clients/modules/account/index.js.map +1 -1
- package/dist/clients/modules/account/types.js.map +1 -1
- package/dist/clients/modules/deposit-existing-MA.simulation/index.js +84 -0
- package/dist/clients/modules/deposit-existing-MA.simulation/index.js.map +1 -0
- package/dist/clients/modules/deposit-existing-MA.simulation/types.js +3 -0
- package/dist/clients/modules/deposit-existing-MA.simulation/types.js.map +1 -0
- package/dist/clients/modules/deposit-new-MA.simulation/index.js +67 -0
- package/dist/clients/modules/deposit-new-MA.simulation/index.js.map +1 -0
- package/dist/clients/modules/deposit-new-MA.simulation/types.js +3 -0
- package/dist/clients/modules/deposit-new-MA.simulation/types.js.map +1 -0
- package/dist/clients/modules/edit-collateral.simulation/index.js +84 -0
- package/dist/clients/modules/edit-collateral.simulation/index.js.map +1 -0
- package/dist/clients/modules/edit-collateral.simulation/types.js +3 -0
- package/dist/clients/modules/edit-collateral.simulation/types.js.map +1 -0
- package/dist/clients/modules/trade.simulation/index.js +2 -2
- package/dist/clients/modules/trade.simulation/index.js.map +1 -1
- package/dist/clients/modules/withdraw-MA.simulation/index.js +83 -0
- package/dist/clients/modules/withdraw-MA.simulation/index.js.map +1 -0
- package/dist/clients/modules/withdraw-MA.simulation/types.js +3 -0
- package/dist/clients/modules/withdraw-MA.simulation/types.js.map +1 -0
- package/dist/types/clients/api-client.d.ts +48 -0
- package/dist/types/clients/api-client.d.ts.map +1 -1
- package/dist/types/clients/modules/account/index.d.ts +3 -2
- package/dist/types/clients/modules/account/index.d.ts.map +1 -1
- package/dist/types/clients/modules/account/types.d.ts +3 -0
- package/dist/types/clients/modules/account/types.d.ts.map +1 -1
- package/dist/types/clients/modules/deposit-existing-MA.simulation/index.d.ts +9 -0
- package/dist/types/clients/modules/deposit-existing-MA.simulation/index.d.ts.map +1 -0
- package/dist/types/clients/modules/deposit-existing-MA.simulation/types.d.ts +16 -0
- package/dist/types/clients/modules/deposit-existing-MA.simulation/types.d.ts.map +1 -0
- package/dist/types/clients/modules/deposit-new-MA.simulation/index.d.ts +9 -0
- package/dist/types/clients/modules/deposit-new-MA.simulation/index.d.ts.map +1 -0
- package/dist/types/clients/modules/deposit-new-MA.simulation/types.d.ts +4 -0
- package/dist/types/clients/modules/deposit-new-MA.simulation/types.d.ts.map +1 -0
- package/dist/types/clients/modules/edit-collateral.simulation/index.d.ts +11 -0
- package/dist/types/clients/modules/edit-collateral.simulation/index.d.ts.map +1 -0
- package/dist/types/clients/modules/edit-collateral.simulation/types.d.ts +13 -0
- package/dist/types/clients/modules/edit-collateral.simulation/types.d.ts.map +1 -0
- package/dist/types/clients/modules/trade.simulation/index.d.ts.map +1 -1
- package/dist/types/clients/modules/withdraw-MA.simulation/index.d.ts +9 -0
- package/dist/types/clients/modules/withdraw-MA.simulation/index.d.ts.map +1 -0
- package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts +16 -0
- package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/clients/api-client.ts +68 -0
- package/src/clients/modules/account/index.ts +12 -1
- package/src/clients/modules/account/types.ts +6 -0
- package/src/clients/modules/deposit-existing-MA.simulation/index.ts +50 -0
- package/src/clients/modules/deposit-existing-MA.simulation/types.ts +23 -0
- package/src/clients/modules/deposit-new-MA.simulation/index.ts +30 -0
- package/src/clients/modules/deposit-new-MA.simulation/types.ts +9 -0
- package/src/clients/modules/edit-collateral.simulation/index.ts +75 -0
- package/src/clients/modules/edit-collateral.simulation/types.ts +15 -0
- package/src/clients/modules/trade.simulation/index.ts +2 -0
- package/src/clients/modules/withdraw-MA.simulation/index.ts +48 -0
- package/src/clients/modules/withdraw-MA.simulation/types.ts +24 -0
|
@@ -0,0 +1,83 @@
|
|
|
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 common_1 = require("@reyaxyz/common");
|
|
40
|
+
var WithdrawMASimulationClient = /** @class */ (function () {
|
|
41
|
+
function WithdrawMASimulationClient(editCollateralClient) {
|
|
42
|
+
// Constructor added
|
|
43
|
+
this.editCollateralClient = editCollateralClient;
|
|
44
|
+
}
|
|
45
|
+
// Method to asynchronously load data based on accountId
|
|
46
|
+
WithdrawMASimulationClient.prototype.arm = function (params) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0: return [4 /*yield*/, this.editCollateralClient.arm({
|
|
51
|
+
marginAccountId: params.marginAccountId,
|
|
52
|
+
})];
|
|
53
|
+
case 1:
|
|
54
|
+
_a.sent();
|
|
55
|
+
return [2 /*return*/];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
// Synchronous method to simulate operations based on an amount
|
|
61
|
+
WithdrawMASimulationClient.prototype.simulate = function (params) {
|
|
62
|
+
var simulateEditCollateralEntity = this.editCollateralClient.simulate({
|
|
63
|
+
collateralDelta: params.collateralDelta,
|
|
64
|
+
collateralAddress: params.collateralAddress,
|
|
65
|
+
});
|
|
66
|
+
var bridgeTimeInMS = (0, common_1.getSocketBridgeTime)({
|
|
67
|
+
moneyInOutChainId: params.moneyInOutChainId,
|
|
68
|
+
}).bridgeTimeInMS;
|
|
69
|
+
var fees = (0, common_1.getSocketWithdrawFees)({
|
|
70
|
+
reyaChainId: params.reyaChainId,
|
|
71
|
+
tokenAddress: params.collateralAddress,
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
fees: fees.fees,
|
|
75
|
+
bridgeTimeInMS: bridgeTimeInMS,
|
|
76
|
+
marginRatio: simulateEditCollateralEntity.marginRatio,
|
|
77
|
+
marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
return WithdrawMASimulationClient;
|
|
81
|
+
}());
|
|
82
|
+
exports.default = WithdrawMASimulationClient;
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6E;AAQ7E;IAEE,oCAAY,oBAA0C;QACpD,oBAAoB;QACpB,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,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,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;SAC5C,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,MAAM,CAAC,WAAW;YAC/B,YAAY,EAAE,MAAM,CAAC,iBAAiB;SACvC,CAAC,CAAC;QAEH,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,cAAc,EAAE,cAAc;YAC9B,WAAW,EAAE,4BAA4B,CAAC,WAAW;YACrD,iBAAiB,EAAE,4BAA4B,CAAC,iBAAiB;SACtC,CAAC;IAChC,CAAC;IACH,iCAAC;AAAD,CAAC,AAvCD,IAuCC","sourcesContent":["import { getSocketBridgeTime, getSocketWithdrawFees } from '@reyaxyz/common';\nimport EditCollateralClient from '../edit-collateral.simulation';\nimport {\n SimulateWithdrawMAEntity,\n WithdrawMASimulationLoadDataParams,\n WithdrawMASimulationSimulateParams,\n} from './types';\n\nexport default class WithdrawMASimulationClient {\n private editCollateralClient: EditCollateralClient;\n 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: 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 collateralDelta: params.collateralDelta,\n collateralAddress: params.collateralAddress,\n });\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: params.moneyInOutChainId,\n }).bridgeTimeInMS;\n\n const fees = getSocketWithdrawFees({\n reyaChainId: params.reyaChainId,\n tokenAddress: params.collateralAddress,\n });\n\n return {\n fees: fees.fees,\n bridgeTimeInMS: bridgeTimeInMS,\n marginRatio: simulateEditCollateralEntity.marginRatio,\n marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,\n } as SimulateWithdrawMAEntity;\n }\n}\n"]}
|
|
@@ -0,0 +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 ReyaChainId,\n TokenEntity,\n} from '@reyaxyz/common';\nimport { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';\n\nexport type WithdrawMASimulationLoadDataParams =\n EditCollateralSimulationLoadDataParams;\n\nexport type WithdrawMASimulationSimulateParams = {\n reyaChainId: ReyaChainId;\n moneyInOutChainId: MoneyInOutChainId;\n collateralDelta: number; // + for deposit, - for withdraw\n collateralAddress: TokenEntity['address'];\n};\n\nexport type SimulateWithdrawMAEntity = {\n fees: number;\n bridgeTimeInMS: number;\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n};\n"]}
|
|
@@ -6,6 +6,9 @@ import LpClient from './modules/lp';
|
|
|
6
6
|
import TokensClient from './modules/tokens';
|
|
7
7
|
import { ReyaChainId } from '@reyaxyz/common';
|
|
8
8
|
import OwnerClient from './modules/owner';
|
|
9
|
+
import EditCollateralSimulationClient from './modules/edit-collateral.simulation';
|
|
10
|
+
import DepositExistingMASimulationClient from './modules/deposit-existing-MA.simulation';
|
|
11
|
+
import DepositNewMASimulationClient from './modules/deposit-new-MA.simulation';
|
|
9
12
|
/**
|
|
10
13
|
* @description Client for API
|
|
11
14
|
*/
|
|
@@ -17,6 +20,9 @@ export declare class ApiClient {
|
|
|
17
20
|
private readonly _account;
|
|
18
21
|
private readonly _lp;
|
|
19
22
|
private readonly _trade_simulation;
|
|
23
|
+
private readonly _edit_collateral_simulation;
|
|
24
|
+
private readonly _deposit_existing_MA_simulation;
|
|
25
|
+
private readonly _deposit_new_MA_simulation;
|
|
20
26
|
private readonly _tokens;
|
|
21
27
|
private readonly _owner;
|
|
22
28
|
private static chain;
|
|
@@ -54,6 +60,48 @@ export declare class ApiClient {
|
|
|
54
60
|
* const tradeSimulationClient = ApiClient.tradeSimulation;
|
|
55
61
|
*/
|
|
56
62
|
static get tradeSimulation(): TradeSimulationClient;
|
|
63
|
+
/**
|
|
64
|
+
* Provides access to the EditCollateralSimulationClient instance.
|
|
65
|
+
* This getter allows for interacting with edit collateral simulation functionalities.
|
|
66
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
67
|
+
* private `_edit_collateral_simulation` property, ensuring that edit collateral simulation operations
|
|
68
|
+
* use a consistent client configuration and state.
|
|
69
|
+
*
|
|
70
|
+
* @returns {EditCollateralSimulationClient} An instance of EditCollateralSimulationClient for edit collateral simulation operations.
|
|
71
|
+
* @memberof ApiClient
|
|
72
|
+
* @example
|
|
73
|
+
* // Access the edit collateral simulation client from the ApiClient
|
|
74
|
+
* const editCollateralSimulationClient = ApiClient.editCollateralSimulation;
|
|
75
|
+
*/
|
|
76
|
+
static get editCollateralSimulationClient(): EditCollateralSimulationClient;
|
|
77
|
+
/**
|
|
78
|
+
* Provides access to the DepositExistingMASimulationClient instance.
|
|
79
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
80
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
81
|
+
* private `_deposit_existing_MA_simulation` property, ensuring that trade simulation operations
|
|
82
|
+
* use a consistent client configuration and state.
|
|
83
|
+
*
|
|
84
|
+
* @returns {DepositExistingMASimulationClient} An instance of DepositExistingMASimulationClient for trade simulation operations.
|
|
85
|
+
* @memberof ApiClient
|
|
86
|
+
* @example
|
|
87
|
+
* // Access the deposit existing Ma simulation client from the ApiClient
|
|
88
|
+
* const depositExistingMASimulationClient = ApiClient.depositExistingMASimulation;
|
|
89
|
+
*/
|
|
90
|
+
static get depositExistingMASimulation(): DepositExistingMASimulationClient;
|
|
91
|
+
/**
|
|
92
|
+
* Provides access to the DepositNewMASimulationClient instance.
|
|
93
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
94
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
95
|
+
* private `_deposit_new_MA_simulation` property, ensuring that trade simulation operations
|
|
96
|
+
* use a consistent client configuration and state.
|
|
97
|
+
*
|
|
98
|
+
* @returns {DepositNewMASimulationClient} An instance of DepositNewMASimulationClient for trade simulation operations.
|
|
99
|
+
* @memberof ApiClient
|
|
100
|
+
* @example
|
|
101
|
+
* // Access the deposit new MA simulation client from the ApiClient
|
|
102
|
+
* const depositNewMASimulationClient = ApiClient.depositNewMASimulation;
|
|
103
|
+
*/
|
|
104
|
+
static get depositNewMASimulation(): DepositNewMASimulationClient;
|
|
57
105
|
/**
|
|
58
106
|
* Gets the current instance of the LpClient from the ApiClient.
|
|
59
107
|
*
|
|
@@ -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;
|
|
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,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AI,qBAAqB,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;;;;;;;;;OASG;IACH,WAAkB,EAAE,IAAI,QAAQ,CAE/B;IAED;;;;;;;;;OASG;IACH,WAAkB,MAAM,IAAI,YAAY,CAEvC;IAED;;;;;;;;;OASG;IACH,WAAkB,KAAK,IAAI,WAAW,CAErC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GetMarginAccountParams, GetMarginAccountResult, GetMarginAccountsParams, GetMarginAccountsResult, GetMarginAccountTransactionHistoryParams, GetMarginAccountTransactionHistoryResult, GetMaxOrderSizeAvailableParams, GetMaxOrderSizeAvailableResult, GetMaxWithdrawBalanceForAccountParams, GetMaxWithdrawBalanceForAccountResult, GetPositionsForMarginAccountParams, GetPositionsForMarginAccountResult, GetPositionsHistoryForMarginAccountParams, GetPositionsHistoryForMarginAccountResult, GetTransactionSimulationInitialDataParams, GetMarginAccountBalanceChartDataParams, GetMarginAccountCollateralsBalanceChartDataParams, GetAllMarginAccountsBalanceChartDataParams, EditMarginAccountParams, CloseMarginAccountParams, GetAllMarginAccountsSummaryResult, GetAllMarginAccountsSummaryParams } from './types';
|
|
1
|
+
import { GetMarginAccountParams, GetMarginAccountResult, GetMarginAccountsParams, GetMarginAccountsResult, GetMarginAccountTransactionHistoryParams, GetMarginAccountTransactionHistoryResult, GetMaxOrderSizeAvailableParams, GetMaxOrderSizeAvailableResult, GetMaxWithdrawBalanceForAccountParams, GetMaxWithdrawBalanceForAccountResult, GetPositionsForMarginAccountParams, GetPositionsForMarginAccountResult, GetPositionsHistoryForMarginAccountParams, GetPositionsHistoryForMarginAccountResult, GetTransactionSimulationInitialDataParams, GetMarginAccountBalanceChartDataParams, GetMarginAccountCollateralsBalanceChartDataParams, GetAllMarginAccountsBalanceChartDataParams, EditMarginAccountParams, CloseMarginAccountParams, GetAllMarginAccountsSummaryResult, GetAllMarginAccountsSummaryParams, GetEditCollateralSimulationInitialDataParams } from './types';
|
|
2
2
|
import RestClient from '../rest';
|
|
3
|
-
import { TradeSimulationState } from '@reyaxyz/common';
|
|
3
|
+
import { EditCollateralSimulationState, TradeSimulationState } from '@reyaxyz/common';
|
|
4
4
|
import { GetMarginAccountCollateralsBalanceChartDataResult, GetMarginAccountBalanceChartDataResult } from '@reyaxyz/common';
|
|
5
5
|
import { GetAllMarginAccountsBalanceChartDataResult } from '@reyaxyz/common';
|
|
6
6
|
export default class AccountClient extends RestClient {
|
|
@@ -33,6 +33,7 @@ export default class AccountClient extends RestClient {
|
|
|
33
33
|
getPositionsHistoryForMarginAccount(params: GetPositionsHistoryForMarginAccountParams): Promise<GetPositionsHistoryForMarginAccountResult>;
|
|
34
34
|
getMaxOrderSizeAvailable(params: GetMaxOrderSizeAvailableParams): Promise<GetMaxOrderSizeAvailableResult>;
|
|
35
35
|
getTransactionSimulationInitialData(params: GetTransactionSimulationInitialDataParams): Promise<TradeSimulationState>;
|
|
36
|
+
getEditCollateralSimulationInitialData(params: GetEditCollateralSimulationInitialDataParams): Promise<EditCollateralSimulationState>;
|
|
36
37
|
getMarginAccountTransactionHistory(params: GetMarginAccountTransactionHistoryParams): Promise<GetMarginAccountTransactionHistoryResult>;
|
|
37
38
|
getMaxWithdrawBalanceForAccount(params: GetMaxWithdrawBalanceForAccountParams): Promise<GetMaxWithdrawBalanceForAccountResult>;
|
|
38
39
|
getMarginAccountBalanceChartData(params: GetMarginAccountBalanceChartDataParams): Promise<GetMarginAccountBalanceChartDataResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,wCAAwC,EACxC,wCAAwC,EACxC,8BAA8B,EAC9B,8BAA8B,EAC9B,qCAAqC,EACrC,qCAAqC,EACrC,kCAAkC,EAClC,kCAAkC,EAClC,yCAAyC,EACzC,yCAAyC,EACzC,yCAAyC,EACzC,sCAAsC,EACtC,iDAAiD,EACjD,0CAA0C,EAC1C,uBAAuB,EACvB,wBAAwB,EACxB,iCAAiC,EACjC,iCAAiC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/account/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,wCAAwC,EACxC,wCAAwC,EACxC,8BAA8B,EAC9B,8BAA8B,EAC9B,qCAAqC,EACrC,qCAAqC,EACrC,kCAAkC,EAClC,kCAAkC,EAClC,yCAAyC,EACzC,yCAAyC,EACzC,yCAAyC,EACzC,sCAAsC,EACtC,iDAAiD,EACjD,0CAA0C,EAC1C,uBAAuB,EACvB,wBAAwB,EACxB,iCAAiC,EACjC,iCAAiC,EACjC,4CAA4C,EAC7C,MAAM,SAAS,CAAC;AACjB,OAAO,UAAU,MAAM,SAAS,CAAC;AACjC,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iDAAiD,EACjD,sCAAsC,EACvC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,0CAA0C,EAAE,MAAM,iBAAiB,CAAC;AAE7E,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;SAWK;IAEC,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAKnC;;;;;;;;;;OAUG;IAEG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAK5B,4BAA4B,CAChC,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,kCAAkC,CAAC;IAKxC,mCAAmC,CACvC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,yCAAyC,CAAC;IAK/C,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,8BAA8B,CAAC;IAQpC,mCAAmC,CACvC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,oBAAoB,CAAC;IAO1B,sCAAsC,CAC1C,MAAM,EAAE,4CAA4C,GACnD,OAAO,CAAC,6BAA6B,CAAC;IAKnC,kCAAkC,CACtC,MAAM,EAAE,wCAAwC,GAC/C,OAAO,CAAC,wCAAwC,CAAC;IAO9C,+BAA+B,CACnC,MAAM,EAAE,qCAAqC,GAC5C,OAAO,CAAC,qCAAqC,CAAC;IAO3C,gCAAgC,CACpC,MAAM,EAAE,sCAAsC,GAC7C,OAAO,CAAC,sCAAsC,CAAC;IAQ5C,2CAA2C,CAC/C,MAAM,EAAE,iDAAiD,GACxD,OAAO,CAAC,iDAAiD,CAAC;IAQvD,gCAAgC,CACpC,MAAM,EAAE,0CAA0C,GACjD,OAAO,CAAC,0CAA0C,CAAC;IAQhD,2BAA2B,CAC/B,MAAM,EAAE,iCAAiC,GACxC,OAAO,CAAC,iCAAiC,CAAC;IAMvC,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAe1B,kBAAkB,CACtB,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAUjC"}
|
|
@@ -45,6 +45,9 @@ export type GetTransactionSimulationInitialDataParams = {
|
|
|
45
45
|
marketId: MarketEntity['id'];
|
|
46
46
|
marginAccountId: MarginAccountEntity['id'];
|
|
47
47
|
};
|
|
48
|
+
export type GetEditCollateralSimulationInitialDataParams = {
|
|
49
|
+
marginAccountId: MarginAccountEntity['id'];
|
|
50
|
+
};
|
|
48
51
|
export type GetMarginAccountBalanceChartDataParams = {
|
|
49
52
|
marginAccountId: MarginAccountEntity['id'];
|
|
50
53
|
filters: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/account/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,qCAAqC,EACrC,YAAY,EACZ,cAAc,EACd,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,+BAA+B,EAC/B,0CAA0C,EAC1C,mCAAmC,EACpC,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,EAAE,CAAC;AAE5D,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAGzD,MAAM,MAAM,wCAAwC,GAAG;IACrD,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAClD,qCAAqC,EAAE,CAAC;AAG1C,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;I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,IAAI,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,+BAA+B,CAAC;KAC9C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,iDAAiD,GAAG;IAC9D,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,0CAA0C,CAAC;KACzD,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,0CAA0C,GAAG;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,mCAAmC,CAAC;KAClD,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,4BAA4B,EAAE,MAAM,CAAC;IACrC,2BAA2B,EAAE,MAAM,CAAC;CACrC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import EditCollateralClient from '../edit-collateral.simulation';
|
|
2
|
+
import { DepositExistingMASimulationLoadDataParams, DepositExistingMASimulationSimulateParams, SimulateDepositExistingMAEntity } from './types';
|
|
3
|
+
export default class DepositExistingMASimulationClient {
|
|
4
|
+
private editCollateralClient;
|
|
5
|
+
constructor(editCollateralClient: EditCollateralClient);
|
|
6
|
+
arm(params: DepositExistingMASimulationLoadDataParams): Promise<void>;
|
|
7
|
+
simulate(params: DepositExistingMASimulationSimulateParams): SimulateDepositExistingMAEntity;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/index.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,yCAAyC,EACzC,yCAAyC,EACzC,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,iCAAiC;IACpD,OAAO,CAAC,oBAAoB,CAAuB;gBACvC,oBAAoB,EAAE,oBAAoB;IAMhD,GAAG,CAAC,MAAM,EAAE,yCAAyC,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3E,QAAQ,CACN,MAAM,EAAE,yCAAyC,GAChD,+BAA+B;CAwBnC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MarginAccountEntity, MoneyInOutChainId, TokenEntity } from '@reyaxyz/common';
|
|
2
|
+
import { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';
|
|
3
|
+
export type DepositExistingMASimulationLoadDataParams = EditCollateralSimulationLoadDataParams;
|
|
4
|
+
export type DepositExistingMASimulationSimulateParams = {
|
|
5
|
+
moneyInOutChainId: MoneyInOutChainId;
|
|
6
|
+
collateralDelta: number;
|
|
7
|
+
collateralAddress: TokenEntity['address'];
|
|
8
|
+
};
|
|
9
|
+
export type SimulateDepositExistingMAEntity = {
|
|
10
|
+
fees: number;
|
|
11
|
+
feesUnit: string;
|
|
12
|
+
bridgeTimeInMS: number;
|
|
13
|
+
marginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
14
|
+
marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,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 DepositExistingMASimulationClient from '../deposit-existing-MA.simulation';
|
|
2
|
+
import { DepositNewMASimulationSimulateParams, SimulateDepositNewMAEntity } from './types';
|
|
3
|
+
export default class DepositNewMASimulationClient {
|
|
4
|
+
private depositExistingMASimulationClient;
|
|
5
|
+
constructor(depositExistingMASimulationClient: DepositExistingMASimulationClient);
|
|
6
|
+
arm(): Promise<void>;
|
|
7
|
+
simulate(params: DepositNewMASimulationSimulateParams): SimulateDepositNewMAEntity;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-new-MA.simulation/index.ts"],"names":[],"mappings":"AACA,OAAO,iCAAiC,MAAM,mCAAmC,CAAC;AAClF,OAAO,EACL,oCAAoC,EACpC,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,4BAA4B;IAC/C,OAAO,CAAC,iCAAiC,CAAoC;gBAE3E,iCAAiC,EAAE,iCAAiC;IAOhE,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAO1B,QAAQ,CACN,MAAM,EAAE,oCAAoC,GAC3C,0BAA0B;CAG9B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DepositExistingMASimulationSimulateParams, SimulateDepositExistingMAEntity } from '../deposit-existing-MA.simulation/types';
|
|
2
|
+
export type DepositNewMASimulationSimulateParams = DepositExistingMASimulationSimulateParams;
|
|
3
|
+
export type SimulateDepositNewMAEntity = SimulateDepositExistingMAEntity;
|
|
4
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-new-MA.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yCAAyC,EACzC,+BAA+B,EAChC,MAAM,yCAAyC,CAAC;AAEjD,MAAM,MAAM,oCAAoC,GAC9C,yCAAyC,CAAC;AAE5C,MAAM,MAAM,0BAA0B,GAAG,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EditCollateralSimulationLoadDataParams, EditCollateralSimulationSimulateParams, SimulateEditCollateralEntity } from './types';
|
|
2
|
+
import AccountClient from '../account';
|
|
3
|
+
export default class EditCollateralSimulationClient {
|
|
4
|
+
private accountId;
|
|
5
|
+
private loadedData;
|
|
6
|
+
private accountClient;
|
|
7
|
+
constructor(accountClient: AccountClient);
|
|
8
|
+
arm(params: EditCollateralSimulationLoadDataParams): Promise<void>;
|
|
9
|
+
simulate(params: EditCollateralSimulationSimulateParams): SimulateEditCollateralEntity;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/edit-collateral.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,sCAAsC,EACtC,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,MAAM,YAAY,CAAC;AAMvC,MAAM,CAAC,OAAO,OAAO,8BAA8B;IACjD,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,aAAa,CAAgB;gBACzB,aAAa,EAAE,aAAa;IAMlC,GAAG,CAAC,MAAM,EAAE,sCAAsC,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxE,QAAQ,CACN,MAAM,EAAE,sCAAsC,GAC7C,4BAA4B;CAyChC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MarginAccountEntity, TokenEntity } from '@reyaxyz/common';
|
|
2
|
+
export type EditCollateralSimulationLoadDataParams = {
|
|
3
|
+
marginAccountId: MarginAccountEntity['id'];
|
|
4
|
+
};
|
|
5
|
+
export type EditCollateralSimulationSimulateParams = {
|
|
6
|
+
collateralDelta: number;
|
|
7
|
+
collateralAddress: TokenEntity['address'];
|
|
8
|
+
};
|
|
9
|
+
export type SimulateEditCollateralEntity = {
|
|
10
|
+
marginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
11
|
+
marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/edit-collateral.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,MAAM,sCAAsC,GAAG;IACnD,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;CAC7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/trade.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,MAAM,YAAY,CAAC;AAIvC,MAAM,CAAC,OAAO,OAAO,qBAAqB;IACxC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,aAAa,CAAgB;gBACzB,aAAa,EAAE,aAAa;IAMlC,GAAG,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;YAOjD,eAAe;IAW7B,QAAQ,CAAC,MAAM,EAAE,6BAA6B,GAAG,mBAAmB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/trade.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,MAAM,YAAY,CAAC;AAIvC,MAAM,CAAC,OAAO,OAAO,qBAAqB;IACxC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,aAAa,CAAgB;gBACzB,aAAa,EAAE,aAAa;IAMlC,GAAG,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;YAOjD,eAAe;IAW7B,QAAQ,CAAC,MAAM,EAAE,6BAA6B,GAAG,mBAAmB;CAmHrE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import EditCollateralClient from '../edit-collateral.simulation';
|
|
2
|
+
import { SimulateWithdrawMAEntity, WithdrawMASimulationLoadDataParams, WithdrawMASimulationSimulateParams } from './types';
|
|
3
|
+
export default class WithdrawMASimulationClient {
|
|
4
|
+
private editCollateralClient;
|
|
5
|
+
constructor(editCollateralClient: EditCollateralClient);
|
|
6
|
+
arm(params: WithdrawMASimulationLoadDataParams): Promise<void>;
|
|
7
|
+
simulate(params: WithdrawMASimulationSimulateParams): SimulateWithdrawMAEntity;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AAEjB,MAAM,CAAC,OAAO,OAAO,0BAA0B;IAC7C,OAAO,CAAC,oBAAoB,CAAuB;gBACvC,oBAAoB,EAAE,oBAAoB;IAMhD,GAAG,CAAC,MAAM,EAAE,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC;IAOpE,QAAQ,CACN,MAAM,EAAE,kCAAkC,GACzC,wBAAwB;CAsB5B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MarginAccountEntity, MoneyInOutChainId, ReyaChainId, TokenEntity } from '@reyaxyz/common';
|
|
2
|
+
import { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';
|
|
3
|
+
export type WithdrawMASimulationLoadDataParams = EditCollateralSimulationLoadDataParams;
|
|
4
|
+
export type WithdrawMASimulationSimulateParams = {
|
|
5
|
+
reyaChainId: ReyaChainId;
|
|
6
|
+
moneyInOutChainId: MoneyInOutChainId;
|
|
7
|
+
collateralDelta: number;
|
|
8
|
+
collateralAddress: TokenEntity['address'];
|
|
9
|
+
};
|
|
10
|
+
export type SimulateWithdrawMAEntity = {
|
|
11
|
+
fees: number;
|
|
12
|
+
bridgeTimeInMS: number;
|
|
13
|
+
marginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
14
|
+
marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,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,WAAW,EAAE,WAAW,CAAC;IACzB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CAC3C,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/api-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.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.23.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": "eccb0c061d91c383ae02680b3193ff8ee07a4ad6"
|
|
42
42
|
}
|
|
@@ -6,6 +6,9 @@ import LpClient from './modules/lp';
|
|
|
6
6
|
import TokensClient from './modules/tokens';
|
|
7
7
|
import { ReyaChainId } from '@reyaxyz/common';
|
|
8
8
|
import OwnerClient from './modules/owner';
|
|
9
|
+
import EditCollateralSimulationClient from './modules/edit-collateral.simulation';
|
|
10
|
+
import DepositExistingMASimulationClient from './modules/deposit-existing-MA.simulation';
|
|
11
|
+
import DepositNewMASimulationClient from './modules/deposit-new-MA.simulation';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* @description Client for API
|
|
@@ -21,6 +24,9 @@ export class ApiClient {
|
|
|
21
24
|
private readonly _account: AccountClient;
|
|
22
25
|
private readonly _lp: LpClient;
|
|
23
26
|
private readonly _trade_simulation: TradeSimulationClient;
|
|
27
|
+
private readonly _edit_collateral_simulation: EditCollateralSimulationClient;
|
|
28
|
+
private readonly _deposit_existing_MA_simulation: DepositExistingMASimulationClient;
|
|
29
|
+
private readonly _deposit_new_MA_simulation: DepositNewMASimulationClient;
|
|
24
30
|
private readonly _tokens: TokensClient;
|
|
25
31
|
private readonly _owner: OwnerClient;
|
|
26
32
|
private static chain: ReyaChainId;
|
|
@@ -38,6 +44,14 @@ export class ApiClient {
|
|
|
38
44
|
this._account = new AccountClient(this.apiEndpoint);
|
|
39
45
|
this._lp = new LpClient(this.apiEndpoint);
|
|
40
46
|
this._trade_simulation = new TradeSimulationClient(this._account);
|
|
47
|
+
this._edit_collateral_simulation = new EditCollateralSimulationClient(
|
|
48
|
+
this._account,
|
|
49
|
+
);
|
|
50
|
+
this._deposit_existing_MA_simulation =
|
|
51
|
+
new DepositExistingMASimulationClient(this._edit_collateral_simulation);
|
|
52
|
+
this._deposit_new_MA_simulation = new DepositNewMASimulationClient(
|
|
53
|
+
this._deposit_existing_MA_simulation,
|
|
54
|
+
);
|
|
41
55
|
this._tokens = new TokensClient(this.apiEndpoint);
|
|
42
56
|
this._owner = new OwnerClient(this.apiEndpoint);
|
|
43
57
|
}
|
|
@@ -102,6 +116,60 @@ export class ApiClient {
|
|
|
102
116
|
return ApiClient.getInstance()._trade_simulation;
|
|
103
117
|
}
|
|
104
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Provides access to the EditCollateralSimulationClient instance.
|
|
121
|
+
* This getter allows for interacting with edit collateral simulation functionalities.
|
|
122
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
123
|
+
* private `_edit_collateral_simulation` property, ensuring that edit collateral simulation operations
|
|
124
|
+
* use a consistent client configuration and state.
|
|
125
|
+
*
|
|
126
|
+
* @returns {EditCollateralSimulationClient} An instance of EditCollateralSimulationClient for edit collateral simulation operations.
|
|
127
|
+
* @memberof ApiClient
|
|
128
|
+
* @example
|
|
129
|
+
* // Access the edit collateral simulation client from the ApiClient
|
|
130
|
+
* const editCollateralSimulationClient = ApiClient.editCollateralSimulation;
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
public static get editCollateralSimulationClient(): EditCollateralSimulationClient {
|
|
134
|
+
return ApiClient.getInstance()._edit_collateral_simulation;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Provides access to the DepositExistingMASimulationClient 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 `_deposit_existing_MA_simulation` property, ensuring that trade simulation operations
|
|
142
|
+
* use a consistent client configuration and state.
|
|
143
|
+
*
|
|
144
|
+
* @returns {DepositExistingMASimulationClient} An instance of DepositExistingMASimulationClient for trade simulation operations.
|
|
145
|
+
* @memberof ApiClient
|
|
146
|
+
* @example
|
|
147
|
+
* // Access the deposit existing Ma simulation client from the ApiClient
|
|
148
|
+
* const depositExistingMASimulationClient = ApiClient.depositExistingMASimulation;
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
public static get depositExistingMASimulation(): DepositExistingMASimulationClient {
|
|
152
|
+
return ApiClient.getInstance()._deposit_existing_MA_simulation;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Provides access to the DepositNewMASimulationClient instance.
|
|
157
|
+
* This getter allows for interacting with trade simulation functionalities.
|
|
158
|
+
* It ensures a singleton pattern by fetching the instance from the ApiClient's
|
|
159
|
+
* private `_deposit_new_MA_simulation` property, ensuring that trade simulation operations
|
|
160
|
+
* use a consistent client configuration and state.
|
|
161
|
+
*
|
|
162
|
+
* @returns {DepositNewMASimulationClient} An instance of DepositNewMASimulationClient for trade simulation operations.
|
|
163
|
+
* @memberof ApiClient
|
|
164
|
+
* @example
|
|
165
|
+
* // Access the deposit new MA simulation client from the ApiClient
|
|
166
|
+
* const depositNewMASimulationClient = ApiClient.depositNewMASimulation;
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
public static get depositNewMASimulation(): DepositNewMASimulationClient {
|
|
170
|
+
return ApiClient.getInstance()._deposit_new_MA_simulation;
|
|
171
|
+
}
|
|
172
|
+
|
|
105
173
|
/**
|
|
106
174
|
* Gets the current instance of the LpClient from the ApiClient.
|
|
107
175
|
*
|
|
@@ -21,9 +21,13 @@ import {
|
|
|
21
21
|
CloseMarginAccountParams,
|
|
22
22
|
GetAllMarginAccountsSummaryResult,
|
|
23
23
|
GetAllMarginAccountsSummaryParams,
|
|
24
|
+
GetEditCollateralSimulationInitialDataParams,
|
|
24
25
|
} from './types';
|
|
25
26
|
import RestClient from '../rest';
|
|
26
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
EditCollateralSimulationState,
|
|
29
|
+
TradeSimulationState,
|
|
30
|
+
} from '@reyaxyz/common';
|
|
27
31
|
import {
|
|
28
32
|
GetMarginAccountCollateralsBalanceChartDataResult,
|
|
29
33
|
GetMarginAccountBalanceChartDataResult,
|
|
@@ -103,6 +107,13 @@ export default class AccountClient extends RestClient {
|
|
|
103
107
|
});
|
|
104
108
|
}
|
|
105
109
|
|
|
110
|
+
async getEditCollateralSimulationInitialData(
|
|
111
|
+
params: GetEditCollateralSimulationInitialDataParams,
|
|
112
|
+
): Promise<EditCollateralSimulationState> {
|
|
113
|
+
const uri = `/api/accounts/${params.marginAccountId}/edit-collateral-simulation-data`;
|
|
114
|
+
return this.get(uri);
|
|
115
|
+
}
|
|
116
|
+
|
|
106
117
|
async getMarginAccountTransactionHistory(
|
|
107
118
|
params: GetMarginAccountTransactionHistoryParams,
|
|
108
119
|
): Promise<GetMarginAccountTransactionHistoryResult> {
|
|
@@ -78,6 +78,12 @@ export type GetTransactionSimulationInitialDataParams = {
|
|
|
78
78
|
marginAccountId: MarginAccountEntity['id'];
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
// ---- Edit Collateral Simulation ----
|
|
82
|
+
|
|
83
|
+
export type GetEditCollateralSimulationInitialDataParams = {
|
|
84
|
+
marginAccountId: MarginAccountEntity['id'];
|
|
85
|
+
};
|
|
86
|
+
|
|
81
87
|
export type GetMarginAccountBalanceChartDataParams = {
|
|
82
88
|
marginAccountId: MarginAccountEntity['id'];
|
|
83
89
|
filters: {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getSocketBridgeTime, getSocketDepositFees } from '@reyaxyz/common';
|
|
2
|
+
import EditCollateralClient from '../edit-collateral.simulation';
|
|
3
|
+
import {
|
|
4
|
+
DepositExistingMASimulationLoadDataParams,
|
|
5
|
+
DepositExistingMASimulationSimulateParams,
|
|
6
|
+
SimulateDepositExistingMAEntity,
|
|
7
|
+
} from './types';
|
|
8
|
+
|
|
9
|
+
export default class DepositExistingMASimulationClient {
|
|
10
|
+
private editCollateralClient: EditCollateralClient;
|
|
11
|
+
constructor(editCollateralClient: EditCollateralClient) {
|
|
12
|
+
// Constructor added
|
|
13
|
+
this.editCollateralClient = editCollateralClient;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Method to asynchronously load data based on accountId
|
|
17
|
+
async arm(params: DepositExistingMASimulationLoadDataParams): Promise<void> {
|
|
18
|
+
await this.editCollateralClient.arm({
|
|
19
|
+
marginAccountId: params.marginAccountId,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Synchronous method to simulate operations based on an amount
|
|
24
|
+
simulate(
|
|
25
|
+
params: DepositExistingMASimulationSimulateParams,
|
|
26
|
+
): SimulateDepositExistingMAEntity {
|
|
27
|
+
const simulateEditCollateralEntity = this.editCollateralClient.simulate({
|
|
28
|
+
collateralDelta: params.collateralDelta,
|
|
29
|
+
collateralAddress: params.collateralAddress,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const bridgeTimeInMS = getSocketBridgeTime({
|
|
33
|
+
moneyInOutChainId: params.moneyInOutChainId,
|
|
34
|
+
}).bridgeTimeInMS;
|
|
35
|
+
|
|
36
|
+
const fees = getSocketDepositFees({
|
|
37
|
+
moneyInOutChainId: params.moneyInOutChainId,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const result: SimulateDepositExistingMAEntity = {
|
|
41
|
+
fees: fees.fees,
|
|
42
|
+
feesUnit: fees.feesUnit,
|
|
43
|
+
bridgeTimeInMS: bridgeTimeInMS,
|
|
44
|
+
marginRatio: simulateEditCollateralEntity.marginRatio,
|
|
45
|
+
marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MarginAccountEntity,
|
|
3
|
+
MoneyInOutChainId,
|
|
4
|
+
TokenEntity,
|
|
5
|
+
} from '@reyaxyz/common';
|
|
6
|
+
import { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';
|
|
7
|
+
|
|
8
|
+
export type DepositExistingMASimulationLoadDataParams =
|
|
9
|
+
EditCollateralSimulationLoadDataParams;
|
|
10
|
+
|
|
11
|
+
export type DepositExistingMASimulationSimulateParams = {
|
|
12
|
+
moneyInOutChainId: MoneyInOutChainId;
|
|
13
|
+
collateralDelta: number; // + for deposit, - for withdraw
|
|
14
|
+
collateralAddress: TokenEntity['address'];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type SimulateDepositExistingMAEntity = {
|
|
18
|
+
fees: number;
|
|
19
|
+
feesUnit: string;
|
|
20
|
+
bridgeTimeInMS: number;
|
|
21
|
+
marginRatio: MarginAccountEntity['marginRatioPercentage'];
|
|
22
|
+
marginRatioHealth: MarginAccountEntity['marginRatioHealth'];
|
|
23
|
+
};
|