@reyaxyz/api-sdk 0.169.4 → 0.169.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/clients/api-client.js +0 -149
  2. package/dist/clients/api-client.js.map +1 -1
  3. package/dist/clients/modules/account/index.js +0 -20
  4. package/dist/clients/modules/account/index.js.map +1 -1
  5. package/dist/clients/modules/account/types.js.map +1 -1
  6. package/dist/clients/modules/lp/index.js +0 -9
  7. package/dist/clients/modules/lp/index.js.map +1 -1
  8. package/dist/clients/modules/lp/types.js.map +1 -1
  9. package/dist/clients/types.js +0 -7
  10. package/dist/clients/types.js.map +1 -1
  11. package/dist/types/clients/api-client.d.ts +0 -106
  12. package/dist/types/clients/api-client.d.ts.map +1 -1
  13. package/dist/types/clients/modules/account/index.d.ts +2 -4
  14. package/dist/types/clients/modules/account/index.d.ts.map +1 -1
  15. package/dist/types/clients/modules/account/types.d.ts +0 -8
  16. package/dist/types/clients/modules/account/types.d.ts.map +1 -1
  17. package/dist/types/clients/modules/lp/index.d.ts +2 -3
  18. package/dist/types/clients/modules/lp/index.d.ts.map +1 -1
  19. package/dist/types/clients/modules/lp/types.d.ts +1 -4
  20. package/dist/types/clients/modules/lp/types.d.ts.map +1 -1
  21. package/dist/types/clients/types.d.ts +0 -7
  22. package/dist/types/clients/types.d.ts.map +1 -1
  23. package/package.json +4 -5
  24. package/src/clients/api-client.ts +0 -159
  25. package/src/clients/modules/account/index.ts +1 -24
  26. package/src/clients/modules/account/types.ts +0 -14
  27. package/src/clients/modules/lp/index.ts +1 -13
  28. package/src/clients/modules/lp/types.ts +0 -5
  29. package/src/clients/types.ts +0 -7
  30. package/dist/clients/modules/binance/index.js +0 -104
  31. package/dist/clients/modules/binance/index.js.map +0 -1
  32. package/dist/clients/modules/binance/types.js +0 -3
  33. package/dist/clients/modules/binance/types.js.map +0 -1
  34. package/dist/clients/modules/deposit-existing-MA.simulation/index.js +0 -117
  35. package/dist/clients/modules/deposit-existing-MA.simulation/index.js.map +0 -1
  36. package/dist/clients/modules/deposit-existing-MA.simulation/types.js +0 -3
  37. package/dist/clients/modules/deposit-existing-MA.simulation/types.js.map +0 -1
  38. package/dist/clients/modules/deposit-new-MA.simulation/index.js +0 -67
  39. package/dist/clients/modules/deposit-new-MA.simulation/index.js.map +0 -1
  40. package/dist/clients/modules/deposit-new-MA.simulation/types.js +0 -3
  41. package/dist/clients/modules/deposit-new-MA.simulation/types.js.map +0 -1
  42. package/dist/clients/modules/depth-chart.simulation/index.js +0 -142
  43. package/dist/clients/modules/depth-chart.simulation/index.js.map +0 -1
  44. package/dist/clients/modules/depth-chart.simulation/types.js +0 -3
  45. package/dist/clients/modules/depth-chart.simulation/types.js.map +0 -1
  46. package/dist/clients/modules/edit-collateral.simulation/index.js +0 -92
  47. package/dist/clients/modules/edit-collateral.simulation/index.js.map +0 -1
  48. package/dist/clients/modules/edit-collateral.simulation/types.js +0 -3
  49. package/dist/clients/modules/edit-collateral.simulation/types.js.map +0 -1
  50. package/dist/clients/modules/transfer-MA-Pool.simulation/index.js +0 -74
  51. package/dist/clients/modules/transfer-MA-Pool.simulation/index.js.map +0 -1
  52. package/dist/clients/modules/transfer-MA-Pool.simulation/types.js +0 -3
  53. package/dist/clients/modules/transfer-MA-Pool.simulation/types.js.map +0 -1
  54. package/dist/clients/modules/transfer-margin-between-MAs.simulation/index.js +0 -90
  55. package/dist/clients/modules/transfer-margin-between-MAs.simulation/index.js.map +0 -1
  56. package/dist/clients/modules/transfer-margin-between-MAs.simulation/types.js +0 -3
  57. package/dist/clients/modules/transfer-margin-between-MAs.simulation/types.js.map +0 -1
  58. package/dist/clients/modules/withdraw-MA.simulation/index.js +0 -120
  59. package/dist/clients/modules/withdraw-MA.simulation/index.js.map +0 -1
  60. package/dist/clients/modules/withdraw-MA.simulation/types.js +0 -3
  61. package/dist/clients/modules/withdraw-MA.simulation/types.js.map +0 -1
  62. package/dist/types/clients/modules/binance/index.d.ts +0 -7
  63. package/dist/types/clients/modules/binance/index.d.ts.map +0 -1
  64. package/dist/types/clients/modules/binance/types.d.ts +0 -10
  65. package/dist/types/clients/modules/binance/types.d.ts.map +0 -1
  66. package/dist/types/clients/modules/deposit-existing-MA.simulation/index.d.ts +0 -11
  67. package/dist/types/clients/modules/deposit-existing-MA.simulation/index.d.ts.map +0 -1
  68. package/dist/types/clients/modules/deposit-existing-MA.simulation/types.d.ts +0 -15
  69. package/dist/types/clients/modules/deposit-existing-MA.simulation/types.d.ts.map +0 -1
  70. package/dist/types/clients/modules/deposit-new-MA.simulation/index.d.ts +0 -9
  71. package/dist/types/clients/modules/deposit-new-MA.simulation/index.d.ts.map +0 -1
  72. package/dist/types/clients/modules/deposit-new-MA.simulation/types.d.ts +0 -4
  73. package/dist/types/clients/modules/deposit-new-MA.simulation/types.d.ts.map +0 -1
  74. package/dist/types/clients/modules/depth-chart.simulation/index.d.ts +0 -14
  75. package/dist/types/clients/modules/depth-chart.simulation/index.d.ts.map +0 -1
  76. package/dist/types/clients/modules/depth-chart.simulation/types.d.ts +0 -22
  77. package/dist/types/clients/modules/depth-chart.simulation/types.d.ts.map +0 -1
  78. package/dist/types/clients/modules/edit-collateral.simulation/index.d.ts +0 -13
  79. package/dist/types/clients/modules/edit-collateral.simulation/index.d.ts.map +0 -1
  80. package/dist/types/clients/modules/edit-collateral.simulation/types.d.ts +0 -13
  81. package/dist/types/clients/modules/edit-collateral.simulation/types.d.ts.map +0 -1
  82. package/dist/types/clients/modules/transfer-MA-Pool.simulation/index.d.ts +0 -9
  83. package/dist/types/clients/modules/transfer-MA-Pool.simulation/index.d.ts.map +0 -1
  84. package/dist/types/clients/modules/transfer-MA-Pool.simulation/types.d.ts +0 -12
  85. package/dist/types/clients/modules/transfer-MA-Pool.simulation/types.d.ts.map +0 -1
  86. package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/index.d.ts +0 -11
  87. package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/index.d.ts.map +0 -1
  88. package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/types.d.ts +0 -16
  89. package/dist/types/clients/modules/transfer-margin-between-MAs.simulation/types.d.ts.map +0 -1
  90. package/dist/types/clients/modules/withdraw-MA.simulation/index.d.ts +0 -12
  91. package/dist/types/clients/modules/withdraw-MA.simulation/index.d.ts.map +0 -1
  92. package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts +0 -16
  93. package/dist/types/clients/modules/withdraw-MA.simulation/types.d.ts.map +0 -1
  94. package/src/clients/modules/binance/index.ts +0 -50
  95. package/src/clients/modules/binance/types.ts +0 -25
  96. package/src/clients/modules/deposit-existing-MA.simulation/index.ts +0 -82
  97. package/src/clients/modules/deposit-existing-MA.simulation/types.ts +0 -23
  98. package/src/clients/modules/deposit-new-MA.simulation/index.ts +0 -30
  99. package/src/clients/modules/deposit-new-MA.simulation/types.ts +0 -9
  100. package/src/clients/modules/depth-chart.simulation/index.ts +0 -131
  101. package/src/clients/modules/depth-chart.simulation/types.ts +0 -25
  102. package/src/clients/modules/edit-collateral.simulation/index.ts +0 -86
  103. package/src/clients/modules/edit-collateral.simulation/types.ts +0 -15
  104. package/src/clients/modules/transfer-MA-Pool.simulation/index.ts +0 -38
  105. package/src/clients/modules/transfer-MA-Pool.simulation/types.ts +0 -15
  106. package/src/clients/modules/transfer-margin-between-MAs.simulation/index.ts +0 -65
  107. package/src/clients/modules/transfer-margin-between-MAs.simulation/types.ts +0 -18
  108. package/src/clients/modules/withdraw-MA.simulation/index.ts +0 -94
  109. package/src/clients/modules/withdraw-MA.simulation/types.ts +0 -23
@@ -1,90 +0,0 @@
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(reyaChainId, accountClient) {
45
- // Constructor added
46
- this.fromEditCollateralClient = new edit_collateral_simulation_1.default(reyaChainId, accountClient);
47
- this.toEditCollateralClient = new edit_collateral_simulation_1.default(reyaChainId, 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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/transfer-margin-between-MAs.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,6FAA2E;AAG3E;IAGE,kDAAY,WAAwB,EAAE,aAA4B;QAChE,oBAAoB;QACpB,IAAI,CAAC,wBAAwB,GAAG,IAAI,oCAA8B,CAChE,WAAW,EACX,aAAa,CACd,CAAC;QACF,IAAI,CAAC,sBAAsB,GAAG,IAAI,oCAA8B,CAC9D,WAAW,EACX,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,AAtDD,IAsDC","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';\nimport { ReyaChainId } from '@reyaxyz/common';\n\nexport default class TransferMarginBetweenMAsSimulationClient {\n private fromEditCollateralClient: EditCollateralClient;\n private toEditCollateralClient: EditCollateralClient;\n constructor(reyaChainId: ReyaChainId, accountClient: AccountClient) {\n // Constructor added\n this.fromEditCollateralClient = new EditCollateralSimulationClient(\n reyaChainId,\n accountClient,\n );\n this.toEditCollateralClient = new EditCollateralSimulationClient(\n reyaChainId,\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"]}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/transfer-margin-between-MAs.simulation/types.ts"],"names":[],"mappings":"","sourcesContent":["import { MarginRatioHealth, TokenEntity } from '@reyaxyz/common';\n\nexport type TransferMarginBetweenMAsSimulationLoadDataParams = {\n fromMarginAccountId: number;\n toMarginAccountId: number;\n};\n\nexport type TransferMarginBetweenMAsSimulationSimulateParams = {\n amount: number;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type SimulateTransferMarginBetweenMAsEntity = {\n fromMarginRatio: number;\n fromMarginRatioHealth: MarginRatioHealth;\n toMarginRatio: number;\n toMarginRatioHealth: MarginRatioHealth;\n};\n"]}
@@ -1,120 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- var common_1 = require("@reyaxyz/common");
55
- var WithdrawMASimulationClient = /** @class */ (function (_super) {
56
- __extends(WithdrawMASimulationClient, _super);
57
- function WithdrawMASimulationClient(editCollateralClient, reyaChainId, host, apiTimeout) {
58
- var _this = _super.call(this, host, apiTimeout) || this;
59
- _this.socketWithdrawFeesList = [];
60
- _this.editCollateralClient = editCollateralClient;
61
- _this.reyaChainId = reyaChainId;
62
- return _this;
63
- }
64
- // Method to asynchronously load data based on accountId
65
- WithdrawMASimulationClient.prototype.arm = function (params) {
66
- return __awaiter(this, void 0, void 0, function () {
67
- var _a;
68
- return __generator(this, function (_b) {
69
- switch (_b.label) {
70
- case 0: return [4 /*yield*/, this.editCollateralClient.arm({
71
- marginAccountId: params.marginAccountId,
72
- })];
73
- case 1:
74
- _b.sent();
75
- _a = this;
76
- return [4 /*yield*/, this.get("/api/socket/withdraw-fees")];
77
- case 2:
78
- _a.socketWithdrawFeesList = _b.sent();
79
- return [2 /*return*/];
80
- }
81
- });
82
- });
83
- };
84
- // Synchronous method to simulate operations based on an amount
85
- WithdrawMASimulationClient.prototype.simulate = function (params) {
86
- var tokenInfo = (0, common_1.getTokenInfoByAddress)(params.tokenAddress, this.reyaChainId);
87
- var moneyInOutTokenInfo = tokenInfo.name === 'RUSD'
88
- ? (0, common_1.getRUSDUnderlyingTokenInfo)(params.moneyInOutChainId)
89
- : tokenInfo;
90
- var socketWithdrawFeesEntry = this.socketWithdrawFeesList.find(function (socketWithdrawFeesEntry) {
91
- return socketWithdrawFeesEntry.moneyInOutChainId ===
92
- params.moneyInOutChainId &&
93
- socketWithdrawFeesEntry.tokenName === moneyInOutTokenInfo.name;
94
- });
95
- if (!socketWithdrawFeesEntry) {
96
- throw new Error("Socket withdraw fees for chain ".concat(params.moneyInOutChainId, " and token ").concat(moneyInOutTokenInfo.name, " not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)"));
97
- }
98
- var socketWithdrawFees = {
99
- fees: socketWithdrawFeesEntry.fees,
100
- feesInUnderlyingToken: (0, common_1.descale)(moneyInOutTokenInfo.decimals)(socketWithdrawFeesEntry.fees),
101
- underlyingTokenName: moneyInOutTokenInfo.name,
102
- };
103
- var simulateEditCollateralEntity = this.editCollateralClient.simulate({
104
- signedAmount: -params.amount,
105
- tokenAddress: params.tokenAddress,
106
- });
107
- var bridgeTimeInMS = (0, common_1.getSocketBridgeTime)({
108
- moneyInOutChainId: params.moneyInOutChainId,
109
- }).bridgeTimeInMS;
110
- return {
111
- socketWithdrawFees: socketWithdrawFees,
112
- bridgeTimeInMS: bridgeTimeInMS,
113
- marginRatio: simulateEditCollateralEntity.marginRatio,
114
- marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,
115
- };
116
- };
117
- return WithdrawMASimulationClient;
118
- }(common_1.RestClient));
119
- exports.default = WithdrawMASimulationClient;
120
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CASyB;AAQzB;IAAwD,8CAAU;IAKhE,oCACE,oBAA0C,EAC1C,WAAwB,EACxB,IAAY,EACZ,UAA0B;QAE1B,YAAA,MAAK,YAAC,IAAI,EAAE,UAAU,CAAC,SAAC;QARlB,4BAAsB,GAA8B,EAAE,CAAC;QAS7D,KAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;;IACjC,CAAC;IAED,wDAAwD;IAClD,wCAAG,GAAT,UAAU,MAA0C;;;;;4BAClD,qBAAM,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC;4BAClC,eAAe,EAAE,MAAM,CAAC,eAAe;yBACxC,CAAC,EAAA;;wBAFF,SAEE,CAAC;wBAEH,KAAA,IAAI,CAAA;wBAA0B,qBAAM,IAAI,CAAC,GAAG,CAC1C,2BAA2B,CAC5B,EAAA;;wBAFD,GAAK,sBAAsB,GAAG,SAE7B,CAAC;;;;;KACH;IAED,+DAA+D;IAC/D,6CAAQ,GAAR,UACE,MAA0C;QAE1C,IAAM,SAAS,GAAG,IAAA,8BAAqB,EACrC,MAAM,CAAC,YAAY,EACnB,IAAI,CAAC,WAAW,CACjB,CAAC;QAEF,IAAM,mBAAmB,GACvB,SAAS,CAAC,IAAI,KAAK,MAAM;YACvB,CAAC,CAAC,IAAA,mCAA0B,EAAC,MAAM,CAAC,iBAAiB,CAAC;YACtD,CAAC,CAAC,SAAS,CAAC;QAChB,IAAM,uBAAuB,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAC9D,UAAC,uBAAuB;YACtB,OAAA,uBAAuB,CAAC,iBAAiB;gBACvC,MAAM,CAAC,iBAAiB;gBAC1B,uBAAuB,CAAC,SAAS,KAAK,mBAAmB,CAAC,IAAI;QAF9D,CAE8D,CACjE,CAAC;QACF,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CACb,yCAAkC,MAAM,CAAC,iBAAiB,wBAAc,mBAAmB,CAAC,IAAI,iGAA8F,CAC/L,CAAC;QACJ,CAAC;QAED,IAAM,kBAAkB,GAAuB;YAC7C,IAAI,EAAE,uBAAuB,CAAC,IAAI;YAClC,qBAAqB,EAAE,IAAA,gBAAO,EAAC,mBAAmB,CAAC,QAAQ,CAAC,CAC1D,uBAAuB,CAAC,IAAI,CAC7B;YACD,mBAAmB,EAAE,mBAAmB,CAAC,IAAI;SAC9C,CAAC;QAEF,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,OAAO;YACL,kBAAkB,oBAAA;YAClB,cAAc,EAAE,cAAc;YAC9B,WAAW,EAAE,4BAA4B,CAAC,WAAW;YACrD,iBAAiB,EAAE,4BAA4B,CAAC,iBAAiB;SACtC,CAAC;IAChC,CAAC;IACH,iCAAC;AAAD,CAAC,AA5ED,CAAwD,mBAAU,GA4EjE","sourcesContent":["import {\n getSocketBridgeTime,\n getTokenInfoByAddress,\n ReyaChainId,\n SocketWithdrawFeesEntry,\n RestClient,\n SocketWithdrawFees,\n descale,\n getRUSDUnderlyingTokenInfo,\n} from '@reyaxyz/common';\nimport EditCollateralClient from '../edit-collateral.simulation';\nimport {\n SimulateWithdrawMAEntity,\n WithdrawMASimulationLoadDataParams,\n WithdrawMASimulationSimulateParams,\n} from './types';\n\nexport default class WithdrawMASimulationClient extends RestClient {\n private editCollateralClient: EditCollateralClient;\n private reyaChainId: ReyaChainId;\n private socketWithdrawFeesList: SocketWithdrawFeesEntry[] = [];\n\n constructor(\n editCollateralClient: EditCollateralClient,\n reyaChainId: ReyaChainId,\n host: string,\n apiTimeout?: number | null,\n ) {\n super(host, apiTimeout);\n this.editCollateralClient = editCollateralClient;\n this.reyaChainId = reyaChainId;\n }\n\n // Method to asynchronously load data based on accountId\n async arm(params: WithdrawMASimulationLoadDataParams): Promise<void> {\n await this.editCollateralClient.arm({\n marginAccountId: params.marginAccountId,\n });\n\n this.socketWithdrawFeesList = await this.get<SocketWithdrawFeesEntry[]>(\n `/api/socket/withdraw-fees`,\n );\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(\n params: WithdrawMASimulationSimulateParams,\n ): SimulateWithdrawMAEntity {\n const tokenInfo = getTokenInfoByAddress(\n params.tokenAddress,\n this.reyaChainId,\n );\n\n const moneyInOutTokenInfo =\n tokenInfo.name === 'RUSD'\n ? getRUSDUnderlyingTokenInfo(params.moneyInOutChainId)\n : tokenInfo;\n const socketWithdrawFeesEntry = this.socketWithdrawFeesList.find(\n (socketWithdrawFeesEntry) =>\n socketWithdrawFeesEntry.moneyInOutChainId ===\n params.moneyInOutChainId &&\n socketWithdrawFeesEntry.tokenName === moneyInOutTokenInfo.name,\n );\n if (!socketWithdrawFeesEntry) {\n throw new Error(\n `Socket withdraw fees for chain ${params.moneyInOutChainId} and token ${moneyInOutTokenInfo.name} not loaded. Call arm() first (or make sure arm will fetch info for this chain id and token)`,\n );\n }\n\n const socketWithdrawFees: SocketWithdrawFees = {\n fees: socketWithdrawFeesEntry.fees,\n feesInUnderlyingToken: descale(moneyInOutTokenInfo.decimals)(\n socketWithdrawFeesEntry.fees,\n ),\n underlyingTokenName: moneyInOutTokenInfo.name,\n };\n\n const simulateEditCollateralEntity = this.editCollateralClient.simulate({\n signedAmount: -params.amount,\n tokenAddress: params.tokenAddress,\n });\n\n const bridgeTimeInMS = getSocketBridgeTime({\n moneyInOutChainId: params.moneyInOutChainId,\n }).bridgeTimeInMS;\n\n return {\n socketWithdrawFees,\n bridgeTimeInMS: bridgeTimeInMS,\n marginRatio: simulateEditCollateralEntity.marginRatio,\n marginRatioHealth: simulateEditCollateralEntity.marginRatioHealth,\n } as SimulateWithdrawMAEntity;\n }\n}\n"]}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n MarginRatioHealth,\n MoneyInOutChainId,\n TokenEntity,\n} from '@reyaxyz/common';\nimport { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';\nimport { SocketWithdrawFees } from '@reyaxyz/common';\n\nexport type WithdrawMASimulationLoadDataParams =\n EditCollateralSimulationLoadDataParams;\n\nexport type WithdrawMASimulationSimulateParams = {\n moneyInOutChainId: MoneyInOutChainId;\n amount: number;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type SimulateWithdrawMAEntity = {\n socketWithdrawFees: SocketWithdrawFees;\n bridgeTimeInMS: number;\n marginRatio: number;\n marginRatioHealth: MarginRatioHealth;\n};\n"]}
@@ -1,7 +0,0 @@
1
- import { RestClient } from '@reyaxyz/common';
2
- import { BinanceCandle, BinanceCandleInterval } from './types';
3
- export declare class BinanceFuturesClient extends RestClient {
4
- constructor();
5
- getCandles(symbol: string, interval: BinanceCandleInterval, startTimeMS: number, endTimeMS: number): Promise<BinanceCandle[]>;
6
- }
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/binance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAI/D,qBAAa,oBAAqB,SAAQ,UAAU;;IAK5C,UAAU,CACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,qBAAqB,EAC/B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,EAAE,CAAC;CAkC5B"}
@@ -1,10 +0,0 @@
1
- export type BinanceCandle = {
2
- openTimeMS: number;
3
- open: number;
4
- high: number;
5
- low: number;
6
- close: number;
7
- closeTimeMS: number;
8
- };
9
- export type BinanceCandleInterval = '1m' | '3m' | '5m' | '15m' | '30m' | '1h' | '2h' | '4h' | '6h' | '8h' | '12h' | '1d' | '3d' | '1w' | '1M';
10
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/binance/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,CAAC"}
@@ -1,11 +0,0 @@
1
- import { RestClient } from '@reyaxyz/common';
2
- import EditCollateralClient from '../edit-collateral.simulation';
3
- import { DepositExistingMASimulationLoadDataParams, DepositExistingMASimulationSimulateParams, SimulateDepositExistingMAEntity } from './types';
4
- export default class DepositExistingMASimulationClient extends RestClient {
5
- private editCollateralClient;
6
- private socketDepositFeesList;
7
- constructor(editCollateralClient: EditCollateralClient, host: string, apiTimeout?: number | null);
8
- arm(params: DepositExistingMASimulationLoadDataParams): Promise<void>;
9
- simulate(params: DepositExistingMASimulationSimulateParams): SimulateDepositExistingMAEntity;
10
- }
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,yCAAyC,EACzC,yCAAyC,EACzC,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,iCAAkC,SAAQ,UAAU;IACvE,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,qBAAqB,CAAgC;gBAG3D,oBAAoB,EAAE,oBAAoB,EAC1C,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAOtB,GAAG,CAAC,MAAM,EAAE,yCAAyC,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3E,QAAQ,CACN,MAAM,EAAE,yCAAyC,GAChD,+BAA+B;CAsCnC"}
@@ -1,15 +0,0 @@
1
- import { MarginRatioHealth, MoneyInOutChainId, SocketDepositFees, 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
- amount: number;
7
- tokenAddress: TokenEntity['address'];
8
- };
9
- export type SimulateDepositExistingMAEntity = {
10
- socketDepositFees: SocketDepositFees;
11
- bridgeTimeInMS: number;
12
- marginRatio: number;
13
- marginRatioHealth: MarginRatioHealth;
14
- };
15
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/deposit-existing-MA.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,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,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,CAAC"}
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,4 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,14 +0,0 @@
1
- import { GetDepthChartParams, GetDepthChartResult, DepthSimulationLoadDataParams } from './types';
2
- import LpClient from '../lp';
3
- export default class DepthChartSimulationClient {
4
- private marketId;
5
- private loadedData;
6
- private lpClient;
7
- constructor(lpClient: LpClient);
8
- arm(params: DepthSimulationLoadDataParams): Promise<void>;
9
- private fetchPoolData;
10
- getDepthChart(params?: GetDepthChartParams): GetDepthChartResult;
11
- private calculate;
12
- static calculatePriceChangePercentage(price: number, estimatedPrice: number): number;
13
- }
14
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAE9B,MAAM,SAAS,CAAC;AAEjB,OAAO,QAAQ,MAAM,OAAO,CAAC;AAI7B,MAAM,CAAC,OAAO,OAAO,0BAA0B;IAC7C,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,QAAQ,CAAW;gBACf,QAAQ,EAAE,QAAQ;IAMxB,GAAG,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;YAMjD,aAAa;IAM3B,aAAa,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,mBAAmB;IAqDhE,OAAO,CAAC,SAAS;IAiCjB,MAAM,CAAC,8BAA8B,CACnC,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,GACrB,MAAM;CAQV"}
@@ -1,22 +0,0 @@
1
- import { MarketEntity } from '@reyaxyz/common';
2
- export type DepthSimulationLoadDataParams = {
3
- marketId: MarketEntity['id'];
4
- };
5
- export type SimulateDepthEntity = {
6
- price: number;
7
- totalSize: number;
8
- totalCost: number;
9
- priceImpact: number;
10
- };
11
- export type GetDepthChartResult = {
12
- leftChart: SimulateDepthEntity[];
13
- rightChart: SimulateDepthEntity[];
14
- };
15
- export type GetDepthChartParams = {
16
- step?: number;
17
- percentageChange?: number;
18
- maxPoints?: number;
19
- dynamicStepIncreaseFactor?: number;
20
- initialSteps?: number;
21
- };
22
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,UAAU,EAAE,mBAAmB,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
@@ -1,13 +0,0 @@
1
- import { EditCollateralSimulationLoadDataParams, EditCollateralSimulationSimulateParams, SimulateEditCollateralEntity } from './types';
2
- import AccountClient from '../account';
3
- import { ReyaChainId } from '@reyaxyz/common';
4
- export default class EditCollateralSimulationClient {
5
- private reyaChainId;
6
- private accountId;
7
- private loadedData;
8
- private accountClient;
9
- constructor(reyaChainId: ReyaChainId, accountClient: AccountClient);
10
- arm(params: EditCollateralSimulationLoadDataParams): Promise<void>;
11
- simulate(params: EditCollateralSimulationSimulateParams): SimulateEditCollateralEntity;
12
- }
13
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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;AACvC,OAAO,EAGL,WAAW,EAGZ,MAAM,iBAAiB,CAAC;AACzB,MAAM,CAAC,OAAO,OAAO,8BAA8B;IACjD,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,aAAa,CAAgB;gBACzB,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa;IAO5D,GAAG,CAAC,MAAM,EAAE,sCAAsC,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxE,QAAQ,CACN,MAAM,EAAE,sCAAsC,GAC7C,4BAA4B;CAgDhC"}
@@ -1,13 +0,0 @@
1
- import { MarginRatioHealth, TokenEntity } from '@reyaxyz/common';
2
- export type EditCollateralSimulationLoadDataParams = {
3
- marginAccountId: number;
4
- };
5
- export type EditCollateralSimulationSimulateParams = {
6
- signedAmount: number;
7
- tokenAddress: TokenEntity['address'];
8
- };
9
- export type SimulateEditCollateralEntity = {
10
- marginRatio: number;
11
- marginRatioHealth: MarginRatioHealth;
12
- };
13
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/edit-collateral.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,MAAM,sCAAsC,GAAG;IACnD,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,CAAC"}
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,12 +0,0 @@
1
- import { MarginRatioHealth, 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: number;
10
- marginRatioHealth: MarginRatioHealth;
11
- };
12
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/transfer-MA-Pool.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACjE,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,MAAM,CAAC;IACpB,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { TransferMarginBetweenMAsSimulationLoadDataParams, TransferMarginBetweenMAsSimulationSimulateParams, SimulateTransferMarginBetweenMAsEntity } from './types';
2
- import AccountClient from '../account';
3
- import { ReyaChainId } from '@reyaxyz/common';
4
- export default class TransferMarginBetweenMAsSimulationClient {
5
- private fromEditCollateralClient;
6
- private toEditCollateralClient;
7
- constructor(reyaChainId: ReyaChainId, accountClient: AccountClient);
8
- arm(params: TransferMarginBetweenMAsSimulationLoadDataParams): Promise<void>;
9
- simulate(params: TransferMarginBetweenMAsSimulationSimulateParams): SimulateTransferMarginBetweenMAsEntity;
10
- }
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,OAAO,OAAO,wCAAwC;IAC3D,OAAO,CAAC,wBAAwB,CAAuB;IACvD,OAAO,CAAC,sBAAsB,CAAuB;gBACzC,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa;IAa5D,GAAG,CACP,MAAM,EAAE,gDAAgD,GACvD,OAAO,CAAC,IAAI,CAAC;IAWhB,QAAQ,CACN,MAAM,EAAE,gDAAgD,GACvD,sCAAsC;CAuB1C"}
@@ -1,16 +0,0 @@
1
- import { MarginRatioHealth, TokenEntity } from '@reyaxyz/common';
2
- export type TransferMarginBetweenMAsSimulationLoadDataParams = {
3
- fromMarginAccountId: number;
4
- toMarginAccountId: number;
5
- };
6
- export type TransferMarginBetweenMAsSimulationSimulateParams = {
7
- amount: number;
8
- tokenAddress: TokenEntity['address'];
9
- };
10
- export type SimulateTransferMarginBetweenMAsEntity = {
11
- fromMarginRatio: number;
12
- fromMarginRatioHealth: MarginRatioHealth;
13
- toMarginRatio: number;
14
- toMarginRatioHealth: MarginRatioHealth;
15
- };
16
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/transfer-margin-between-MAs.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,MAAM,gDAAgD,GAAG;IAC7D,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,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,MAAM,CAAC;IACxB,qBAAqB,EAAE,iBAAiB,CAAC;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,iBAAiB,CAAC;CACxC,CAAC"}
@@ -1,12 +0,0 @@
1
- import { ReyaChainId, RestClient } from '@reyaxyz/common';
2
- import EditCollateralClient from '../edit-collateral.simulation';
3
- import { SimulateWithdrawMAEntity, WithdrawMASimulationLoadDataParams, WithdrawMASimulationSimulateParams } from './types';
4
- export default class WithdrawMASimulationClient extends RestClient {
5
- private editCollateralClient;
6
- private reyaChainId;
7
- private socketWithdrawFeesList;
8
- constructor(editCollateralClient: EditCollateralClient, reyaChainId: ReyaChainId, host: string, apiTimeout?: number | null);
9
- arm(params: WithdrawMASimulationLoadDataParams): Promise<void>;
10
- simulate(params: WithdrawMASimulationSimulateParams): SimulateWithdrawMAEntity;
11
- }
12
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EAEX,UAAU,EAIX,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,UAAU;IAChE,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,sBAAsB,CAAiC;gBAG7D,oBAAoB,EAAE,oBAAoB,EAC1C,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAQtB,GAAG,CAAC,MAAM,EAAE,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpE,QAAQ,CACN,MAAM,EAAE,kCAAkC,GACzC,wBAAwB;CA8C5B"}
@@ -1,16 +0,0 @@
1
- import { MarginRatioHealth, MoneyInOutChainId, TokenEntity } from '@reyaxyz/common';
2
- import { EditCollateralSimulationLoadDataParams } from '../edit-collateral.simulation/types';
3
- import { SocketWithdrawFees } from '@reyaxyz/common';
4
- export type WithdrawMASimulationLoadDataParams = EditCollateralSimulationLoadDataParams;
5
- export type WithdrawMASimulationSimulateParams = {
6
- moneyInOutChainId: MoneyInOutChainId;
7
- amount: number;
8
- tokenAddress: TokenEntity['address'];
9
- };
10
- export type SimulateWithdrawMAEntity = {
11
- socketWithdrawFees: SocketWithdrawFees;
12
- bridgeTimeInMS: number;
13
- marginRatio: number;
14
- marginRatioHealth: MarginRatioHealth;
15
- };
16
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/withdraw-MA.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sCAAsC,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,kCAAkC,GAC5C,sCAAsC,CAAC;AAEzC,MAAM,MAAM,kCAAkC,GAAG;IAC/C,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,CAAC"}
@@ -1,50 +0,0 @@
1
- import { RestClient } from '@reyaxyz/common';
2
- import { BinanceCandle, BinanceCandleInterval } from './types';
3
-
4
- // docs: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api
5
-
6
- export class BinanceFuturesClient extends RestClient {
7
- constructor() {
8
- super('https://fapi.binance.com/fapi/v1/', 10_000);
9
- }
10
-
11
- async getCandles(
12
- symbol: string,
13
- interval: BinanceCandleInterval,
14
- startTimeMS: number,
15
- endTimeMS: number,
16
- ): Promise<BinanceCandle[]> {
17
- let timeMS = startTimeMS;
18
- const response: BinanceCandle[] = [];
19
-
20
- while (timeMS < endTimeMS) {
21
- const batchAPI = await this.get<number[][]>(`markPriceKlines`, {
22
- symbol,
23
- interval,
24
- startTime: timeMS,
25
- endTime: endTimeMS - 1,
26
- limit: 1500,
27
- });
28
-
29
- if (batchAPI.length === 0) {
30
- break;
31
- }
32
-
33
- const batch = batchAPI.map(
34
- (e): BinanceCandle => ({
35
- openTimeMS: Number(e[0]),
36
- open: Number(e[1]),
37
- high: Number(e[2]),
38
- low: Number(e[3]),
39
- close: Number(e[4]),
40
- closeTimeMS: Number(e[6]),
41
- }),
42
- );
43
-
44
- response.push(...batch);
45
- timeMS = batch[batch.length - 1].closeTimeMS + 1;
46
- }
47
-
48
- return response;
49
- }
50
- }
@@ -1,25 +0,0 @@
1
- export type BinanceCandle = {
2
- openTimeMS: number;
3
- open: number;
4
- high: number;
5
- low: number;
6
- close: number;
7
- closeTimeMS: number;
8
- };
9
-
10
- export type BinanceCandleInterval =
11
- | '1m'
12
- | '3m'
13
- | '5m'
14
- | '15m'
15
- | '30m'
16
- | '1h'
17
- | '2h'
18
- | '4h'
19
- | '6h'
20
- | '8h'
21
- | '12h'
22
- | '1d'
23
- | '3d'
24
- | '1w'
25
- | '1M';