@reyaxyz/api-sdk 0.164.17 → 0.164.19-perpob.110

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 (35) hide show
  1. package/dist/clients/api-client-config.js +12 -0
  2. package/dist/clients/api-client-config.js.map +1 -1
  3. package/dist/clients/api-client.js +0 -16
  4. package/dist/clients/api-client.js.map +1 -1
  5. package/dist/clients/modules/account/index.js +0 -25
  6. package/dist/clients/modules/account/index.js.map +1 -1
  7. package/dist/clients/modules/account/types.js.map +1 -1
  8. package/dist/clients/types.js +1 -3
  9. package/dist/clients/types.js.map +1 -1
  10. package/dist/types/clients/api-client-config.d.ts +1 -1
  11. package/dist/types/clients/api-client-config.d.ts.map +1 -1
  12. package/dist/types/clients/api-client.d.ts +0 -10
  13. package/dist/types/clients/api-client.d.ts.map +1 -1
  14. package/dist/types/clients/modules/account/index.d.ts +1 -3
  15. package/dist/types/clients/modules/account/index.d.ts.map +1 -1
  16. package/dist/types/clients/modules/account/types.d.ts +1 -14
  17. package/dist/types/clients/modules/account/types.d.ts.map +1 -1
  18. package/dist/types/clients/types.d.ts +1 -2
  19. package/dist/types/clients/types.d.ts.map +1 -1
  20. package/package.json +5 -5
  21. package/src/clients/api-client-config.ts +22 -0
  22. package/src/clients/api-client.ts +0 -17
  23. package/src/clients/modules/account/index.ts +0 -30
  24. package/src/clients/modules/account/types.ts +0 -18
  25. package/src/clients/types.ts +0 -3
  26. package/dist/clients/modules/conditional-orders/index.js +0 -276
  27. package/dist/clients/modules/conditional-orders/index.js.map +0 -1
  28. package/dist/clients/modules/conditional-orders/types.js +0 -3
  29. package/dist/clients/modules/conditional-orders/types.js.map +0 -1
  30. package/dist/types/clients/modules/conditional-orders/index.d.ts +0 -16
  31. package/dist/types/clients/modules/conditional-orders/index.d.ts.map +0 -1
  32. package/dist/types/clients/modules/conditional-orders/types.d.ts +0 -60
  33. package/dist/types/clients/modules/conditional-orders/types.d.ts.map +0 -1
  34. package/src/clients/modules/conditional-orders/index.ts +0 -269
  35. package/src/clients/modules/conditional-orders/types.ts +0 -79
@@ -16,7 +16,6 @@ import TransferMarginBetweenMAsSimulationClient from './modules/transfer-margin-
16
16
  import TransferMAPoolSimulationClient from './modules/transfer-MA-Pool.simulation';
17
17
  import DepthChartSimulationClient from './modules/depth-chart.simulation';
18
18
  import FundingRateClient from './modules/funding-rate';
19
- import ConditionalOrdersClient from './modules/conditional-orders';
20
19
  import ReferralClient from './modules/referral';
21
20
 
22
21
  /**
@@ -40,7 +39,6 @@ export class ApiClient {
40
39
  private readonly _depthSimulation: DepthChartSimulationClient;
41
40
  private readonly _tokens: TokensClient;
42
41
  private readonly _owner: OwnerClient;
43
- private readonly _conditionalOrders: ConditionalOrdersClient;
44
42
  private readonly _referral: ReferralClient;
45
43
 
46
44
  private constructor() {
@@ -89,10 +87,6 @@ export class ApiClient {
89
87
  this._depthSimulation = new DepthChartSimulationClient(this._lp);
90
88
  this._tokens = new TokensClient(ApiClient.config.apiEndpoint);
91
89
  this._owner = new OwnerClient(ApiClient.config.apiEndpoint);
92
- this._conditionalOrders = new ConditionalOrdersClient(
93
- ApiClient.network,
94
- ApiClient.config.apiEndpoint,
95
- );
96
90
  this._referral = new ReferralClient(ApiClient.config.apiEndpoint);
97
91
  }
98
92
 
@@ -346,17 +340,6 @@ export class ApiClient {
346
340
  return ApiClient.getInstance()._owner;
347
341
  }
348
342
 
349
- /**
350
- * Gets the current instance of the ConditionalOrdersClient from the ApiClient.
351
- *
352
- * This static getter allows access to the ConditionalOrdersClient instance managed within the ApiClient's singleton instance. It is a convenience method for retrieving the ConditionalOrdersClient directly, bypassing the need to manually access the internal `_conditionalOrders` property of the ApiClient instance.
353
- *
354
- * @returns {ConditionalOrdersClient} The ConditionalOrdersClient instance currently held by the ApiClient.
355
- */
356
- public static get conditionalOrders(): ConditionalOrdersClient {
357
- return ApiClient.getInstance()._conditionalOrders;
358
- }
359
-
360
343
  /**
361
344
  * Gets the current instance of the ReferralClient from the ApiClient.
362
345
  *
@@ -18,10 +18,6 @@ import {
18
18
  GetLiquidationHistoryForOwnerAddressParams,
19
19
  GetAccountFeeRebatesHistoryParams,
20
20
  GetAccountFeeRebatesHistoryResult,
21
- GetAutoExchangeHistoryForOwnerAddressResult,
22
- GetAutoExchangeHistoryForOwnerAddressParams,
23
- UpdateLeverageForAccountAndMarketParams,
24
- UpdateLeverageForAccountAndMarketResult,
25
21
  } from './types';
26
22
  import {
27
23
  EditCollateralSimulationState,
@@ -110,15 +106,6 @@ export default class AccountClient extends RestClient {
110
106
  });
111
107
  }
112
108
 
113
- async getAutoExchangeHistoryForOwnerAddress(
114
- params: GetAutoExchangeHistoryForOwnerAddressParams,
115
- ): Promise<GetAutoExchangeHistoryForOwnerAddressResult> {
116
- const uri = `/api/accounts/${params.address}/positions/auto-exchange`;
117
- return this.get(uri, {
118
- timestampFromMS: params.timestampFromMS,
119
- });
120
- }
121
-
122
109
  async getEditCollateralSimulationInitialData(
123
110
  params: GetEditCollateralSimulationInitialDataParams,
124
111
  ): Promise<EditCollateralSimulationState> {
@@ -183,21 +170,4 @@ export default class AccountClient extends RestClient {
183
170
  id: params.id,
184
171
  });
185
172
  }
186
-
187
- async updateLeverageForAccountAndMarket(
188
- params: UpdateLeverageForAccountAndMarketParams,
189
- ): Promise<UpdateLeverageForAccountAndMarketResult> {
190
- if (!params.accountId || !params.marketId || !params.leverage) {
191
- throw new Error('Missing required parameters');
192
- }
193
-
194
- const uri = `/api/accounts/${params.accountId}/marginAccount/${params.marketId}/set-max-leverage`;
195
- return this.post(
196
- uri,
197
- {},
198
- {
199
- leverage: params.leverage,
200
- },
201
- );
202
- }
203
173
  }
@@ -11,7 +11,6 @@ import {
11
11
  MarginAccountCollateralsBalanceGranularity,
12
12
  AllMarginAccountsBalanceGranularity,
13
13
  ReferralFeeTransactionHistoryEntity,
14
- AutoExchangeEvent,
15
14
  } from '@reyaxyz/common';
16
15
  import { Address } from '@reyaxyz/common';
17
16
 
@@ -124,12 +123,6 @@ export type LiquidationHistoryEntity = {
124
123
  };
125
124
  };
126
125
 
127
- export type GetAutoExchangeHistoryForOwnerAddressParams =
128
- GetLiquidationHistoryForOwnerAddressParams;
129
- export type GetAutoExchangeHistoryForOwnerAddressResult = {
130
- data: AutoExchangeEvent[];
131
- };
132
-
133
126
  // ---- Transaction Simulation ----
134
127
 
135
128
  export type GetTransactionSimulationInitialDataParams = {
@@ -201,14 +194,3 @@ export type GetIsolatedOrderMaxSizeAvailableResult = {
201
194
  maxAmountBase: number;
202
195
  maxAmountSize: number;
203
196
  };
204
-
205
- export type UpdateLeverageForAccountAndMarketParams = {
206
- accountId: number;
207
- marketId: MarketEntity['id'];
208
- leverage: number;
209
- };
210
-
211
- export type UpdateLeverageForAccountAndMarketResult = {
212
- successful: boolean;
213
- leverage: number;
214
- };
@@ -23,11 +23,8 @@ export {
23
23
  GetFundingRateChartDataResult,
24
24
  FundingRateHistoryGranularity,
25
25
  MoneyInOutConfigurationPerTokenName,
26
- UnifiedConditionalOrderType,
27
- ConditionalOrderType,
28
26
  } from '@reyaxyz/common';
29
27
  export * from './modules/account/types';
30
- export * from './modules/conditional-orders/types';
31
28
  export * from './modules/lp/types';
32
29
  export * from './modules/markets/types';
33
30
  export * from './modules/tokens/types';
@@ -1,276 +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 ethers_1 = require("ethers");
56
- var ConditionalOrdersClient = /** @class */ (function (_super) {
57
- __extends(ConditionalOrdersClient, _super);
58
- function ConditionalOrdersClient(reyaChainId, host) {
59
- var _this = _super.call(this, host) || this;
60
- _this.reyaChainId = reyaChainId;
61
- return _this;
62
- }
63
- // ------ Conditional Orders History ---
64
- ConditionalOrdersClient.prototype.getConditionalOrdersHistoryForMarginAccount = function (params) {
65
- return __awaiter(this, void 0, void 0, function () {
66
- var uri;
67
- return __generator(this, function (_a) {
68
- uri = "/api/conditional-orders/get-orders-by-account/".concat(params.marginAccountId);
69
- return [2 /*return*/, this.get(uri, {
70
- limit: params.limit,
71
- })];
72
- });
73
- });
74
- };
75
- ConditionalOrdersClient.prototype.getConditionalOrdersHistoryForWalletAddress = function (params) {
76
- return __awaiter(this, void 0, void 0, function () {
77
- var uri;
78
- return __generator(this, function (_a) {
79
- uri = "/api/conditional-orders/get-orders-by-wallet/".concat(params.walletAddress);
80
- return [2 /*return*/, this.get(uri, {
81
- limit: params.limit,
82
- })];
83
- });
84
- });
85
- };
86
- ConditionalOrdersClient.prototype.alreadyGaveTradePermissions = function (params) {
87
- return __awaiter(this, void 0, void 0, function () {
88
- var uri, response;
89
- return __generator(this, function (_a) {
90
- switch (_a.label) {
91
- case 0:
92
- uri = "/api/conditional-orders/gave-trade-permission/".concat(params.accountId);
93
- return [4 /*yield*/, this.get(uri)];
94
- case 1:
95
- response = _a.sent();
96
- return [2 /*return*/, {
97
- permissionGiven: response,
98
- }];
99
- }
100
- });
101
- });
102
- };
103
- ConditionalOrdersClient.prototype.alreadyGaveTradePermissionToWallet = function (params) {
104
- return __awaiter(this, void 0, void 0, function () {
105
- var uri, response;
106
- return __generator(this, function (_a) {
107
- switch (_a.label) {
108
- case 0:
109
- uri = "/api/conditional-orders/gave-trade-permission-to-wallet/".concat(params.accountId, "/").concat(params.targetWalletAddress);
110
- return [4 /*yield*/, this.get(uri)];
111
- case 1:
112
- response = _a.sent();
113
- return [2 /*return*/, {
114
- permissionGiven: response,
115
- }];
116
- }
117
- });
118
- });
119
- };
120
- ConditionalOrdersClient.prototype.cancelConditionalOrder = function (params) {
121
- return __awaiter(this, void 0, void 0, function () {
122
- var signature, uri, res;
123
- return __generator(this, function (_a) {
124
- switch (_a.label) {
125
- case 0: return [4 /*yield*/, (0, common_1.signCancelConditionalOrder)(params.signer, params.orderId)];
126
- case 1:
127
- signature = _a.sent();
128
- uri = "/api/conditional-orders/cancel-order";
129
- return [4 /*yield*/, this.put(uri, {}, {
130
- orderId: params.orderId,
131
- userSignature: signature,
132
- })];
133
- case 2:
134
- res = _a.sent();
135
- return [2 /*return*/, res];
136
- }
137
- });
138
- });
139
- };
140
- ConditionalOrdersClient.prototype.registerConditionalOrder = function (params) {
141
- return __awaiter(this, void 0, void 0, function () {
142
- var inputs, uri, result, _a, _b;
143
- var _c;
144
- return __generator(this, function (_d) {
145
- switch (_d.label) {
146
- case 0: return [4 /*yield*/, this.parseConditionalOrderInputs(params.signer, params.marginAccountId, params.marketId, params.orderType, params.triggerPrice, params.supportingParams.exchangeId, params.supportingParams.counterpartyAccountIds, params.amountInBase)];
147
- case 1:
148
- inputs = _d.sent();
149
- uri = "/api/conditional-orders/create-or-update-order";
150
- _a = this.post;
151
- _b = [uri,
152
- {}];
153
- _c = {
154
- accountId: params.marginAccountId,
155
- poolId: params.supportingParams.counterpartyAccountIds[0],
156
- deadline: inputs.deadline,
157
- exchangeId: params.supportingParams.exchangeId,
158
- isLong: inputs.actualAmountInBase > 0,
159
- marketId: params.marketId,
160
- nonce: inputs.nonce.toString(),
161
- orderPriceLimit: inputs.orderPriceLimit.toString(),
162
- orderType: params.orderType,
163
- signature: inputs.signature
164
- };
165
- return [4 /*yield*/, params.signer.getAddress()];
166
- case 2: return [4 /*yield*/, _a.apply(this, _b.concat([(_c.signerWallet = _d.sent(),
167
- _c.timestampMs = inputs.creationTimestampMs,
168
- _c.triggerPrice = params.triggerPrice,
169
- _c.orderBase = params.amountInBase,
170
- _c)]))];
171
- case 3:
172
- result = _d.sent();
173
- return [2 /*return*/, result];
174
- }
175
- });
176
- });
177
- };
178
- ConditionalOrdersClient.prototype.updateConditionalOrder = function (params) {
179
- return __awaiter(this, void 0, void 0, function () {
180
- var inputs, uri, result, _a, _b;
181
- var _c;
182
- return __generator(this, function (_d) {
183
- switch (_d.label) {
184
- case 0: return [4 /*yield*/, this.parseConditionalOrderInputs(params.signer, params.marginAccountId, params.marketId, params.orderType, params.triggerPrice, params.supportingParams.exchangeId, params.supportingParams.counterpartyAccountIds, params.amountInBase)];
185
- case 1:
186
- inputs = _d.sent();
187
- uri = "/api/conditional-orders/create-or-update-order";
188
- _a = this.post;
189
- _b = [uri,
190
- {}];
191
- _c = {
192
- accountId: params.marginAccountId,
193
- poolId: params.supportingParams.counterpartyAccountIds[0],
194
- deadline: inputs.deadline,
195
- exchangeId: params.supportingParams.exchangeId,
196
- isLong: inputs.actualAmountInBase > 0,
197
- marketId: params.marketId,
198
- nonce: inputs.nonce.toString(),
199
- orderPriceLimit: inputs.orderPriceLimit.toString(),
200
- orderType: params.orderType,
201
- signature: inputs.signature
202
- };
203
- return [4 /*yield*/, params.signer.getAddress()];
204
- case 2: return [4 /*yield*/, _a.apply(this, _b.concat([(_c.signerWallet = _d.sent(),
205
- _c.timestampMs = inputs.creationTimestampMs,
206
- _c.triggerPrice = params.triggerPrice,
207
- _c.cancelOrderId = params.cancelOrderId,
208
- _c.orderBase = params.amountInBase,
209
- _c)]))];
210
- case 3:
211
- result = _d.sent();
212
- return [2 /*return*/, result];
213
- }
214
- });
215
- });
216
- };
217
- ConditionalOrdersClient.prototype.getPosition = function (accountId, marketId) {
218
- return __awaiter(this, void 0, void 0, function () {
219
- var uri;
220
- return __generator(this, function (_a) {
221
- uri = "/api/accounts/marginAccount/position/".concat(accountId, "/").concat(marketId);
222
- return [2 /*return*/, this.get(uri)];
223
- });
224
- });
225
- };
226
- ConditionalOrdersClient.prototype.parseConditionalOrderInputs = function (signer, accountId, marketId, orderType, triggerPrice, exchangeId, counterpartyAccountIds, amountInBase) {
227
- return __awaiter(this, void 0, void 0, function () {
228
- var inputs, actualAmountInBase, isLongOrder, orderPriceLimit, position, positionBase, creationTimestampMs, _a, serializedSignature, nonce;
229
- return __generator(this, function (_b) {
230
- switch (_b.label) {
231
- case 0:
232
- if (!(orderType === common_1.ConditionalOrderType.LIMIT_ORDER)) return [3 /*break*/, 1];
233
- if (amountInBase === undefined) {
234
- throw new Error('Order base is required for limit orders');
235
- }
236
- if (amountInBase === 0) {
237
- throw new Error('Cannot create an empty limit order');
238
- }
239
- actualAmountInBase = amountInBase;
240
- isLongOrder = actualAmountInBase > 0;
241
- orderPriceLimit = (0, common_1.calculateMaxPriceLimit)(isLongOrder);
242
- inputs = ethers_1.AbiCoder.defaultAbiCoder().encode(['int256', 'uint256'], [(0, common_1.scale)(18)(amountInBase), (0, common_1.scale)(18)(triggerPrice)]);
243
- return [3 /*break*/, 3];
244
- case 1: return [4 /*yield*/, this.getPosition(accountId, marketId)];
245
- case 2:
246
- position = _b.sent();
247
- positionBase = position.base;
248
- if (positionBase === 0) {
249
- throw new Error('Cannot create SL or TP order for closed positions');
250
- }
251
- actualAmountInBase = -positionBase;
252
- isLongOrder = actualAmountInBase > 0;
253
- orderPriceLimit = (0, common_1.calculateMaxPriceLimit)(isLongOrder);
254
- inputs = ethers_1.AbiCoder.defaultAbiCoder().encode(['bool', 'uint256', 'uint256'], [isLongOrder, (0, common_1.scale)(18)(triggerPrice), orderPriceLimit]);
255
- _b.label = 3;
256
- case 3:
257
- creationTimestampMs = Date.now();
258
- return [4 /*yield*/, (0, common_1.signOrdersGatewayOrder)(signer, this.reyaChainId, accountId, marketId, exchangeId, counterpartyAccountIds, orderType, inputs, common_1.CONDITIONAL_ORDER_SIG_DEADLINE, creationTimestampMs)];
259
- case 4:
260
- _a = _b.sent(), serializedSignature = _a.serializedSignature, nonce = _a.nonce;
261
- return [2 /*return*/, {
262
- signature: serializedSignature,
263
- actualAmountInBase: actualAmountInBase,
264
- orderPriceLimit: orderPriceLimit,
265
- nonce: nonce,
266
- deadline: common_1.CONDITIONAL_ORDER_SIG_DEADLINE,
267
- creationTimestampMs: creationTimestampMs,
268
- }];
269
- }
270
- });
271
- });
272
- };
273
- return ConditionalOrdersClient;
274
- }(common_1.RestClient));
275
- exports.default = ConditionalOrdersClient;
276
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/conditional-orders/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAWyB;AACzB,iCAAkC;AAkBlC;IAAqD,2CAAU;IAG7D,iCAAY,WAAwB,EAAE,IAAY;QAChD,YAAA,MAAK,YAAC,IAAI,CAAC,SAAC;QACZ,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;;IACjC,CAAC;IAED,yCAAyC;IACnC,6EAA2C,GAAjD,UACE,MAAyD;;;;gBAEnD,GAAG,GAAG,wDAAiD,MAAM,CAAC,eAAe,CAAE,CAAC;gBACtF,sBAAO,IAAI,CAAC,GAAG,CAAoD,GAAG,EAAE;wBACtE,KAAK,EAAE,MAAM,CAAC,KAAK;qBACpB,CAAC,EAAC;;;KACJ;IAEK,6EAA2C,GAAjD,UACE,MAAyD;;;;gBAEnD,GAAG,GAAG,uDAAgD,MAAM,CAAC,aAAa,CAAE,CAAC;gBACnF,sBAAO,IAAI,CAAC,GAAG,CAAoD,GAAG,EAAE;wBACtE,KAAK,EAAE,MAAM,CAAC,KAAK;qBACpB,CAAC,EAAC;;;KACJ;IAEK,6DAA2B,GAAjC,UACE,MAAwC;;;;;;wBAElC,GAAG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AAG,IAAI,CAAC,GAAG,EAAE,CAAC;wBACA,qBAAM,IAAA,+BAAsB,EACjE,MAAM,EACN,IAAI,CAAC,WAAW,EAChB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,sBAAsB,EACtB,SAAS,EACT,MAAM,EACN,uCAA8B,EAC9B,mBAAmB,CACpB,EAAA;;wBAXK,KAAiC,SAWtC,EAXO,mBAAmB,yBAAA,EAAE,KAAK,WAAA;wBAalC,sBAAO;gCACL,SAAS,EAAE,mBAAmB;gCAC9B,kBAAkB,oBAAA;gCAClB,eAAe,iBAAA;gCACf,KAAK,OAAA;gCACL,QAAQ,EAAE,uCAA8B;gCACxC,mBAAmB,qBAAA;6BACpB,EAAC;;;;KACH;IACH,8BAAC;AAAD,CAAC,AA9OD,CAAqD,mBAAU,GA8O9D","sourcesContent":["import {\n calculateMaxPriceLimit,\n PositionEntity,\n RestClient,\n ReyaChainId,\n signOrdersGatewayOrder,\n signCancelConditionalOrder,\n ConditionalOrder,\n ConditionalOrderType,\n scale,\n CONDITIONAL_ORDER_SIG_DEADLINE,\n} from '@reyaxyz/common';\nimport { AbiCoder } from 'ethers';\nimport { Signer, JsonRpcSigner } from 'ethers';\nimport {\n AlreadyGaveTradePermissionParams,\n AlreadyGaveTradePermissionResult,\n CancelConditionalOrderParams,\n CancelConditionalOrderResult,\n GetConditionalOrdersHistoryForMarginAccountParams,\n GetConditionalOrdersHistoryForMarginAccountResult,\n GetConditionalOrdersHistoryForWalletAddressParams,\n RegisterConditionalOrderParams,\n RegisterConditionalOrderResult,\n UpdateConditionalOrderParams,\n UpdateConditionalOrderResult,\n AlreadyGaveTradePermissionToWalletParams,\n AlreadyGaveTradePermissionToWalletResult,\n} from './types';\n\nexport default class ConditionalOrdersClient extends RestClient {\n private reyaChainId: ReyaChainId;\n\n constructor(reyaChainId: ReyaChainId, host: string) {\n super(host);\n this.reyaChainId = reyaChainId;\n }\n\n // ------ Conditional Orders History ---\n async getConditionalOrdersHistoryForMarginAccount(\n params: GetConditionalOrdersHistoryForMarginAccountParams,\n ): Promise<GetConditionalOrdersHistoryForMarginAccountResult> {\n const uri = `/api/conditional-orders/get-orders-by-account/${params.marginAccountId}`;\n return this.get<GetConditionalOrdersHistoryForMarginAccountResult>(uri, {\n limit: params.limit,\n });\n }\n\n async getConditionalOrdersHistoryForWalletAddress(\n params: GetConditionalOrdersHistoryForWalletAddressParams,\n ): Promise<GetConditionalOrdersHistoryForMarginAccountResult> {\n const uri = `/api/conditional-orders/get-orders-by-wallet/${params.walletAddress}`;\n return this.get<GetConditionalOrdersHistoryForMarginAccountResult>(uri, {\n limit: params.limit,\n });\n }\n\n async alreadyGaveTradePermissions(\n params: AlreadyGaveTradePermissionParams,\n ): Promise<AlreadyGaveTradePermissionResult> {\n const uri = `/api/conditional-orders/gave-trade-permission/${params.accountId}`;\n const response = await this.get<boolean>(uri);\n\n return {\n permissionGiven: response,\n };\n }\n\n async alreadyGaveTradePermissionToWallet(\n params: AlreadyGaveTradePermissionToWalletParams,\n ): Promise<AlreadyGaveTradePermissionToWalletResult> {\n const uri = `/api/conditional-orders/gave-trade-permission-to-wallet/${params.accountId}/${params.targetWalletAddress}`;\n const response = await this.get<boolean>(uri);\n\n return {\n permissionGiven: response,\n };\n }\n\n async cancelConditionalOrder(\n params: CancelConditionalOrderParams,\n ): Promise<CancelConditionalOrderResult> {\n const signature = await signCancelConditionalOrder(\n params.signer,\n params.orderId,\n );\n\n const uri = `/api/conditional-orders/cancel-order`;\n const res = await this.put<ConditionalOrder>(\n uri,\n {},\n {\n orderId: params.orderId,\n userSignature: signature,\n },\n );\n return res;\n }\n\n async registerConditionalOrder(\n params: RegisterConditionalOrderParams,\n ): Promise<RegisterConditionalOrderResult> {\n const inputs = await this.parseConditionalOrderInputs(\n params.signer,\n params.marginAccountId,\n params.marketId,\n params.orderType,\n params.triggerPrice,\n params.supportingParams.exchangeId,\n params.supportingParams.counterpartyAccountIds,\n params.amountInBase,\n );\n\n // create new entry\n const uri = `/api/conditional-orders/create-or-update-order`;\n\n const result = await this.post<ConditionalOrder>(\n uri,\n {},\n {\n accountId: params.marginAccountId,\n poolId: params.supportingParams.counterpartyAccountIds[0],\n deadline: inputs.deadline,\n exchangeId: params.supportingParams.exchangeId,\n isLong: inputs.actualAmountInBase > 0,\n marketId: params.marketId,\n nonce: inputs.nonce.toString(),\n orderPriceLimit: inputs.orderPriceLimit.toString(),\n orderType: params.orderType,\n signature: inputs.signature,\n signerWallet: await params.signer.getAddress(),\n timestampMs: inputs.creationTimestampMs,\n triggerPrice: params.triggerPrice,\n orderBase: params.amountInBase,\n },\n );\n return result;\n }\n\n async updateConditionalOrder(\n params: UpdateConditionalOrderParams,\n ): Promise<UpdateConditionalOrderResult> {\n const inputs = await this.parseConditionalOrderInputs(\n params.signer,\n params.marginAccountId,\n params.marketId,\n params.orderType,\n params.triggerPrice,\n params.supportingParams.exchangeId,\n params.supportingParams.counterpartyAccountIds,\n params.amountInBase,\n );\n\n // create new entry\n const uri = `/api/conditional-orders/create-or-update-order`;\n\n const result = await this.post<ConditionalOrder>(\n uri,\n {},\n {\n accountId: params.marginAccountId,\n poolId: params.supportingParams.counterpartyAccountIds[0],\n deadline: inputs.deadline,\n exchangeId: params.supportingParams.exchangeId,\n isLong: inputs.actualAmountInBase > 0,\n marketId: params.marketId,\n nonce: inputs.nonce.toString(),\n orderPriceLimit: inputs.orderPriceLimit.toString(),\n orderType: params.orderType,\n signature: inputs.signature,\n signerWallet: await params.signer.getAddress(),\n timestampMs: inputs.creationTimestampMs,\n triggerPrice: params.triggerPrice,\n cancelOrderId: params.cancelOrderId,\n orderBase: params.amountInBase,\n },\n );\n return result;\n }\n\n private async getPosition(\n accountId: number,\n marketId: number,\n ): Promise<PositionEntity> {\n const uri = `/api/accounts/marginAccount/position/${accountId}/${marketId}`;\n return this.get<PositionEntity>(uri);\n }\n\n private async parseConditionalOrderInputs(\n signer: Signer | JsonRpcSigner,\n accountId: number,\n marketId: number,\n orderType: ConditionalOrderType,\n triggerPrice: number,\n exchangeId: number,\n counterpartyAccountIds: number[],\n amountInBase?: number,\n ): Promise<{\n signature: string;\n actualAmountInBase: number;\n orderPriceLimit: bigint;\n nonce: bigint;\n deadline: number;\n creationTimestampMs: number;\n }> {\n let inputs: string;\n let actualAmountInBase: number;\n let isLongOrder: boolean;\n let orderPriceLimit: bigint;\n\n if (orderType === ConditionalOrderType.LIMIT_ORDER) {\n if (amountInBase === undefined) {\n throw new Error('Order base is required for limit orders');\n }\n\n if (amountInBase === 0) {\n throw new Error('Cannot create an empty limit order');\n }\n\n actualAmountInBase = amountInBase;\n isLongOrder = actualAmountInBase > 0;\n orderPriceLimit = calculateMaxPriceLimit(isLongOrder);\n\n inputs = AbiCoder.defaultAbiCoder().encode(\n ['int256', 'uint256'],\n [scale(18)(amountInBase), scale(18)(triggerPrice)],\n );\n } else {\n const position = await this.getPosition(accountId, marketId);\n const positionBase = position.base;\n\n if (positionBase === 0) {\n throw new Error('Cannot create SL or TP order for closed positions');\n }\n\n actualAmountInBase = -positionBase;\n isLongOrder = actualAmountInBase > 0;\n orderPriceLimit = calculateMaxPriceLimit(isLongOrder);\n\n inputs = AbiCoder.defaultAbiCoder().encode(\n ['bool', 'uint256', 'uint256'],\n [isLongOrder, scale(18)(triggerPrice), orderPriceLimit],\n );\n }\n\n const creationTimestampMs = Date.now();\n const { serializedSignature, nonce } = await signOrdersGatewayOrder(\n signer,\n this.reyaChainId,\n accountId,\n marketId,\n exchangeId,\n counterpartyAccountIds,\n orderType,\n inputs,\n CONDITIONAL_ORDER_SIG_DEADLINE,\n creationTimestampMs,\n );\n\n return {\n signature: serializedSignature,\n actualAmountInBase,\n orderPriceLimit,\n nonce,\n deadline: CONDITIONAL_ORDER_SIG_DEADLINE,\n creationTimestampMs,\n };\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/conditional-orders/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n ConditionalOrder,\n UnifiedConditionalOrderType,\n ConditionalOrderType,\n} from '@reyaxyz/common';\nimport { Signer, JsonRpcSigner } from 'ethers';\nimport { MarketEntity, Address } from '@reyaxyz/common';\n\nexport type CancelConditionalOrderParams = {\n signer: Signer | JsonRpcSigner;\n orderId: string;\n};\n\nexport type CancelConditionalOrderResult = ConditionalOrder;\n\nexport type ConditionalOrderDetails = {\n accountId: number;\n marketId: number;\n exchangeId: number;\n counterpartyAccountIds: number[];\n orderType: number;\n inputs: string;\n signer: string;\n nonce: bigint;\n};\n\nexport type OrderSupportingParams = {\n exchangeId: MarketEntity['orderInfo']['exchangeId'];\n counterpartyAccountIds: MarketEntity['orderInfo']['counterpartyAccountIds'];\n};\n\nexport type RegisterConditionalOrderParams = {\n signer: Signer | JsonRpcSigner;\n marginAccountId: number;\n triggerPrice: number;\n orderType: ConditionalOrderType;\n marketId: number;\n supportingParams: OrderSupportingParams;\n amountInBase?: number;\n};\n\nexport type UpdateConditionalOrderParams = {\n cancelOrderId: string;\n} & RegisterConditionalOrderParams;\n\nexport type RegisterConditionalOrderResult = ConditionalOrder;\nexport type UpdateConditionalOrderResult = ConditionalOrder;\n\nexport type AlreadyGaveTradePermissionParams = {\n accountId: number;\n};\n\nexport type AlreadyGaveTradePermissionResult = {\n permissionGiven: boolean;\n};\n\nexport type AlreadyGaveTradePermissionToWalletParams = {\n accountId: number;\n targetWalletAddress: Address;\n};\n\nexport type AlreadyGaveTradePermissionToWalletResult = {\n permissionGiven: boolean;\n};\n\n// ---- Conditional Orders History ---\nexport type GetConditionalOrdersHistoryForMarginAccountParams = {\n address: string;\n marginAccountId: number;\n limit?: number;\n};\n\nexport type GetConditionalOrdersHistoryForWalletAddressParams = {\n walletAddress: string;\n limit?: number;\n};\n\nexport type GetConditionalOrdersHistoryForMarginAccountResult =\n UnifiedConditionalOrderType[];\n"]}
@@ -1,16 +0,0 @@
1
- import { RestClient, ReyaChainId } from '@reyaxyz/common';
2
- import { AlreadyGaveTradePermissionParams, AlreadyGaveTradePermissionResult, CancelConditionalOrderParams, CancelConditionalOrderResult, GetConditionalOrdersHistoryForMarginAccountParams, GetConditionalOrdersHistoryForMarginAccountResult, GetConditionalOrdersHistoryForWalletAddressParams, RegisterConditionalOrderParams, RegisterConditionalOrderResult, UpdateConditionalOrderParams, UpdateConditionalOrderResult, AlreadyGaveTradePermissionToWalletParams, AlreadyGaveTradePermissionToWalletResult } from './types';
3
- export default class ConditionalOrdersClient extends RestClient {
4
- private reyaChainId;
5
- constructor(reyaChainId: ReyaChainId, host: string);
6
- getConditionalOrdersHistoryForMarginAccount(params: GetConditionalOrdersHistoryForMarginAccountParams): Promise<GetConditionalOrdersHistoryForMarginAccountResult>;
7
- getConditionalOrdersHistoryForWalletAddress(params: GetConditionalOrdersHistoryForWalletAddressParams): Promise<GetConditionalOrdersHistoryForMarginAccountResult>;
8
- alreadyGaveTradePermissions(params: AlreadyGaveTradePermissionParams): Promise<AlreadyGaveTradePermissionResult>;
9
- alreadyGaveTradePermissionToWallet(params: AlreadyGaveTradePermissionToWalletParams): Promise<AlreadyGaveTradePermissionToWalletResult>;
10
- cancelConditionalOrder(params: CancelConditionalOrderParams): Promise<CancelConditionalOrderResult>;
11
- registerConditionalOrder(params: RegisterConditionalOrderParams): Promise<RegisterConditionalOrderResult>;
12
- updateConditionalOrder(params: UpdateConditionalOrderParams): Promise<UpdateConditionalOrderResult>;
13
- private getPosition;
14
- private parseConditionalOrderInputs;
15
- }
16
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/conditional-orders/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,WAAW,EAOZ,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,4BAA4B,EAC5B,4BAA4B,EAC5B,iDAAiD,EACjD,iDAAiD,EACjD,iDAAiD,EACjD,8BAA8B,EAC9B,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,EAC5B,wCAAwC,EACxC,wCAAwC,EACzC,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU;IAC7D,OAAO,CAAC,WAAW,CAAc;gBAErB,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAM5C,2CAA2C,CAC/C,MAAM,EAAE,iDAAiD,GACxD,OAAO,CAAC,iDAAiD,CAAC;IAOvD,2CAA2C,CAC/C,MAAM,EAAE,iDAAiD,GACxD,OAAO,CAAC,iDAAiD,CAAC;IAOvD,2BAA2B,CAC/B,MAAM,EAAE,gCAAgC,GACvC,OAAO,CAAC,gCAAgC,CAAC;IAStC,kCAAkC,CACtC,MAAM,EAAE,wCAAwC,GAC/C,OAAO,CAAC,wCAAwC,CAAC;IAS9C,sBAAsB,CAC1B,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,4BAA4B,CAAC;IAkBlC,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,8BAA8B,CAAC;IAsCpC,sBAAsB,CAC1B,MAAM,EAAE,4BAA4B,GACnC,OAAO,CAAC,4BAA4B,CAAC;YAuC1B,WAAW;YAQX,2BAA2B;CAgF1C"}
@@ -1,60 +0,0 @@
1
- import { ConditionalOrder, UnifiedConditionalOrderType, ConditionalOrderType } from '@reyaxyz/common';
2
- import { Signer, JsonRpcSigner } from 'ethers';
3
- import { MarketEntity, Address } from '@reyaxyz/common';
4
- export type CancelConditionalOrderParams = {
5
- signer: Signer | JsonRpcSigner;
6
- orderId: string;
7
- };
8
- export type CancelConditionalOrderResult = ConditionalOrder;
9
- export type ConditionalOrderDetails = {
10
- accountId: number;
11
- marketId: number;
12
- exchangeId: number;
13
- counterpartyAccountIds: number[];
14
- orderType: number;
15
- inputs: string;
16
- signer: string;
17
- nonce: bigint;
18
- };
19
- export type OrderSupportingParams = {
20
- exchangeId: MarketEntity['orderInfo']['exchangeId'];
21
- counterpartyAccountIds: MarketEntity['orderInfo']['counterpartyAccountIds'];
22
- };
23
- export type RegisterConditionalOrderParams = {
24
- signer: Signer | JsonRpcSigner;
25
- marginAccountId: number;
26
- triggerPrice: number;
27
- orderType: ConditionalOrderType;
28
- marketId: number;
29
- supportingParams: OrderSupportingParams;
30
- amountInBase?: number;
31
- };
32
- export type UpdateConditionalOrderParams = {
33
- cancelOrderId: string;
34
- } & RegisterConditionalOrderParams;
35
- export type RegisterConditionalOrderResult = ConditionalOrder;
36
- export type UpdateConditionalOrderResult = ConditionalOrder;
37
- export type AlreadyGaveTradePermissionParams = {
38
- accountId: number;
39
- };
40
- export type AlreadyGaveTradePermissionResult = {
41
- permissionGiven: boolean;
42
- };
43
- export type AlreadyGaveTradePermissionToWalletParams = {
44
- accountId: number;
45
- targetWalletAddress: Address;
46
- };
47
- export type AlreadyGaveTradePermissionToWalletResult = {
48
- permissionGiven: boolean;
49
- };
50
- export type GetConditionalOrdersHistoryForMarginAccountParams = {
51
- address: string;
52
- marginAccountId: number;
53
- limit?: number;
54
- };
55
- export type GetConditionalOrdersHistoryForWalletAddressParams = {
56
- walletAddress: string;
57
- limit?: number;
58
- };
59
- export type GetConditionalOrdersHistoryForMarginAccountResult = UnifiedConditionalOrderType[];
60
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/conditional-orders/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,MAAM,4BAA4B,GAAG;IACzC,MA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