@reyaxyz/api-sdk 0.168.26 → 0.169.1

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.js +0 -32
  2. package/dist/clients/api-client.js.map +1 -1
  3. package/dist/clients/modules/account/index.js +0 -22
  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/types.js +1 -3
  7. package/dist/clients/types.js.map +1 -1
  8. package/dist/types/clients/api-client.d.ts +0 -20
  9. package/dist/types/clients/api-client.d.ts.map +1 -1
  10. package/dist/types/clients/modules/account/index.d.ts +1 -3
  11. package/dist/types/clients/modules/account/index.d.ts.map +1 -1
  12. package/dist/types/clients/modules/account/types.d.ts +2 -14
  13. package/dist/types/clients/modules/account/types.d.ts.map +1 -1
  14. package/dist/types/clients/types.d.ts +1 -2
  15. package/dist/types/clients/types.d.ts.map +1 -1
  16. package/package.json +5 -5
  17. package/src/clients/api-client.ts +0 -31
  18. package/src/clients/modules/account/index.ts +0 -22
  19. package/src/clients/modules/account/types.ts +0 -19
  20. package/src/clients/types.ts +0 -5
  21. package/dist/clients/modules/conditional-orders/index.js +0 -259
  22. package/dist/clients/modules/conditional-orders/index.js.map +0 -1
  23. package/dist/clients/modules/conditional-orders/types.js +0 -3
  24. package/dist/clients/modules/conditional-orders/types.js.map +0 -1
  25. package/dist/clients/modules/referral/index.js +0 -76
  26. package/dist/clients/modules/referral/index.js.map +0 -1
  27. package/dist/types/clients/modules/conditional-orders/index.d.ts +0 -15
  28. package/dist/types/clients/modules/conditional-orders/index.d.ts.map +0 -1
  29. package/dist/types/clients/modules/conditional-orders/types.d.ts +0 -53
  30. package/dist/types/clients/modules/conditional-orders/types.d.ts.map +0 -1
  31. package/dist/types/clients/modules/referral/index.d.ts +0 -5
  32. package/dist/types/clients/modules/referral/index.d.ts.map +0 -1
  33. package/src/clients/modules/conditional-orders/index.ts +0 -256
  34. package/src/clients/modules/conditional-orders/types.ts +0 -70
  35. package/src/clients/modules/referral/index.ts +0 -16
@@ -7,8 +7,6 @@ export {
7
7
  OrderHistoryEntity,
8
8
  PositionEntity,
9
9
  TransactionHistoryType,
10
- MarginAccountTransactionHistoryType,
11
- MarginAccountTransactionHistoryEntity,
12
10
  StrippedMarginAccountEntity,
13
11
  LpPoolEntity,
14
12
  ReyaChainId,
@@ -23,11 +21,8 @@ export {
23
21
  GetFundingRateChartDataResult,
24
22
  FundingRateHistoryGranularity,
25
23
  MoneyInOutConfigurationPerTokenName,
26
- UnifiedConditionalOrderType,
27
- ConditionalOrderType,
28
24
  } from '@reyaxyz/common';
29
25
  export * from './modules/account/types';
30
- export * from './modules/conditional-orders/types';
31
26
  export * from './modules/lp/types';
32
27
  export * from './modules/markets/types';
33
28
  export * from './modules/tokens/types';
@@ -1,259 +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.cancelConditionalOrder = function (params) {
104
- return __awaiter(this, void 0, void 0, function () {
105
- var signature, uri, res;
106
- return __generator(this, function (_a) {
107
- switch (_a.label) {
108
- case 0: return [4 /*yield*/, (0, common_1.signCancelConditionalOrder)(params.signer, params.orderId)];
109
- case 1:
110
- signature = _a.sent();
111
- uri = "/api/conditional-orders/cancel-order";
112
- return [4 /*yield*/, this.put(uri, {}, {
113
- orderId: params.orderId,
114
- userSignature: signature,
115
- })];
116
- case 2:
117
- res = _a.sent();
118
- return [2 /*return*/, res];
119
- }
120
- });
121
- });
122
- };
123
- ConditionalOrdersClient.prototype.registerConditionalOrder = function (params) {
124
- return __awaiter(this, void 0, void 0, function () {
125
- var inputs, uri, result, _a, _b;
126
- var _c;
127
- return __generator(this, function (_d) {
128
- switch (_d.label) {
129
- 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)];
130
- case 1:
131
- inputs = _d.sent();
132
- uri = "/api/conditional-orders/create-or-update-order";
133
- _a = this.post;
134
- _b = [uri,
135
- {}];
136
- _c = {
137
- accountId: params.marginAccountId,
138
- poolId: params.supportingParams.counterpartyAccountIds[0],
139
- deadline: inputs.deadline,
140
- exchangeId: params.supportingParams.exchangeId,
141
- isLong: inputs.actualAmountInBase > 0,
142
- marketId: params.marketId,
143
- nonce: inputs.nonce.toString(),
144
- orderPriceLimit: inputs.orderPriceLimit.toString(),
145
- orderType: params.orderType,
146
- signature: inputs.signature
147
- };
148
- return [4 /*yield*/, params.signer.getAddress()];
149
- case 2: return [4 /*yield*/, _a.apply(this, _b.concat([(_c.signerWallet = _d.sent(),
150
- _c.timestampMs = inputs.creationTimestampMs,
151
- _c.triggerPrice = params.triggerPrice,
152
- _c.orderBase = params.amountInBase,
153
- _c)]))];
154
- case 3:
155
- result = _d.sent();
156
- return [2 /*return*/, result];
157
- }
158
- });
159
- });
160
- };
161
- ConditionalOrdersClient.prototype.updateConditionalOrder = function (params) {
162
- return __awaiter(this, void 0, void 0, function () {
163
- var inputs, uri, result, _a, _b;
164
- var _c;
165
- return __generator(this, function (_d) {
166
- switch (_d.label) {
167
- 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)];
168
- case 1:
169
- inputs = _d.sent();
170
- uri = "/api/conditional-orders/create-or-update-order";
171
- _a = this.post;
172
- _b = [uri,
173
- {}];
174
- _c = {
175
- accountId: params.marginAccountId,
176
- poolId: params.supportingParams.counterpartyAccountIds[0],
177
- deadline: inputs.deadline,
178
- exchangeId: params.supportingParams.exchangeId,
179
- isLong: inputs.actualAmountInBase > 0,
180
- marketId: params.marketId,
181
- nonce: inputs.nonce.toString(),
182
- orderPriceLimit: inputs.orderPriceLimit.toString(),
183
- orderType: params.orderType,
184
- signature: inputs.signature
185
- };
186
- return [4 /*yield*/, params.signer.getAddress()];
187
- case 2: return [4 /*yield*/, _a.apply(this, _b.concat([(_c.signerWallet = _d.sent(),
188
- _c.timestampMs = inputs.creationTimestampMs,
189
- _c.triggerPrice = params.triggerPrice,
190
- _c.cancelOrderId = params.cancelOrderId,
191
- _c.orderBase = params.amountInBase,
192
- _c)]))];
193
- case 3:
194
- result = _d.sent();
195
- return [2 /*return*/, result];
196
- }
197
- });
198
- });
199
- };
200
- ConditionalOrdersClient.prototype.getPosition = function (accountId, marketId) {
201
- return __awaiter(this, void 0, void 0, function () {
202
- var uri;
203
- return __generator(this, function (_a) {
204
- uri = "/api/accounts/marginAccount/position/".concat(accountId, "/").concat(marketId);
205
- return [2 /*return*/, this.get(uri)];
206
- });
207
- });
208
- };
209
- ConditionalOrdersClient.prototype.parseConditionalOrderInputs = function (signer, accountId, marketId, orderType, triggerPrice, exchangeId, counterpartyAccountIds, amountInBase) {
210
- return __awaiter(this, void 0, void 0, function () {
211
- var inputs, actualAmountInBase, isLongOrder, orderPriceLimit, position, positionBase, creationTimestampMs, _a, serializedSignature, nonce;
212
- return __generator(this, function (_b) {
213
- switch (_b.label) {
214
- case 0:
215
- if (!(orderType === common_1.ConditionalOrderType.LIMIT_ORDER)) return [3 /*break*/, 1];
216
- if (amountInBase === undefined) {
217
- throw new Error('Order base is required for limit orders');
218
- }
219
- if (amountInBase === 0) {
220
- throw new Error('Cannot create an empty limit order');
221
- }
222
- actualAmountInBase = amountInBase;
223
- isLongOrder = actualAmountInBase > 0;
224
- orderPriceLimit = (0, common_1.calculateMaxPriceLimit)(isLongOrder);
225
- inputs = ethers_1.AbiCoder.defaultAbiCoder().encode(['int256', 'uint256'], [(0, common_1.scale)(18)(amountInBase), (0, common_1.scale)(18)(triggerPrice)]);
226
- return [3 /*break*/, 3];
227
- case 1: return [4 /*yield*/, this.getPosition(accountId, marketId)];
228
- case 2:
229
- position = _b.sent();
230
- positionBase = position.base;
231
- if (positionBase === 0) {
232
- throw new Error('Cannot create SL or TP order for closed positions');
233
- }
234
- actualAmountInBase = -positionBase;
235
- isLongOrder = actualAmountInBase > 0;
236
- orderPriceLimit = (0, common_1.calculateMaxPriceLimit)(isLongOrder);
237
- inputs = ethers_1.AbiCoder.defaultAbiCoder().encode(['bool', 'uint256', 'uint256'], [isLongOrder, (0, common_1.scale)(18)(triggerPrice), orderPriceLimit]);
238
- _b.label = 3;
239
- case 3:
240
- creationTimestampMs = Date.now();
241
- return [4 /*yield*/, (0, common_1.signOrdersGatewayOrder)(signer, this.reyaChainId, accountId, marketId, exchangeId, counterpartyAccountIds, orderType, inputs, common_1.CONDITIONAL_ORDER_SIG_DEADLINE, creationTimestampMs)];
242
- case 4:
243
- _a = _b.sent(), serializedSignature = _a.serializedSignature, nonce = _a.nonce;
244
- return [2 /*return*/, {
245
- signature: serializedSignature,
246
- actualAmountInBase: actualAmountInBase,
247
- orderPriceLimit: orderPriceLimit,
248
- nonce: nonce,
249
- deadline: common_1.CONDITIONAL_ORDER_SIG_DEADLINE,
250
- creationTimestampMs: creationTimestampMs,
251
- }];
252
- }
253
- });
254
- });
255
- };
256
- return ConditionalOrdersClient;
257
- }(common_1.RestClient));
258
- exports.default = ConditionalOrdersClient;
259
- //# 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,iCAA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;wBAED,kBAAkB,GAAG,CAAC,YAAY,CAAC;wBACnC,WAAW,GAAG,kBAAkB,GAAG,CAAC,CAAC;wBACrC,eAAe,GAAG,IAAA,+BAAsB,EAAC,WAAW,CAAC,CAAC;wBAEtD,MAAM,GAAG,iBAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CACxC,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,EAC9B,CAAC,WAAW,EAAE,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC,CACxD,CAAC;;;wBAGE,mBAAmB,GAAG,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,AAnOD,CAAqD,mBAAU,GAmO9D","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} 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 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 } 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\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,76 +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 ReferralClient = /** @class */ (function (_super) {
56
- __extends(ReferralClient, _super);
57
- function ReferralClient() {
58
- return _super !== null && _super.apply(this, arguments) || this;
59
- }
60
- ReferralClient.prototype.propagateReferralOnChain = function (walletAddress, accountId, marketId) {
61
- return __awaiter(this, void 0, void 0, function () {
62
- var uri;
63
- return __generator(this, function (_a) {
64
- uri = "/api/referral/propagate-referral-on-chain";
65
- return [2 /*return*/, this.post(uri, {
66
- walletAddress: walletAddress,
67
- accountId: accountId,
68
- marketId: marketId,
69
- })];
70
- });
71
- });
72
- };
73
- return ReferralClient;
74
- }(common_1.RestClient));
75
- exports.default = ReferralClient;
76
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/referral/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;AAE7C;IAA4C,kCAAU;IAAtD;;IAaA,CAAC;IAZO,iDAAwB,GAA9B,UACE,aAAqB,EACrB,SAAkB,EAClB,QAAiB;;;;gBAEX,GAAG,GAAG,2CAA2C,CAAC;gBACxD,sBAAO,IAAI,CAAC,IAAI,CAAO,GAAG,EAAE;wBAC1B,aAAa,eAAA;wBACb,SAAS,WAAA;wBACT,QAAQ,UAAA;qBACT,CAAC,EAAC;;;KACJ;IACH,qBAAC;AAAD,CAAC,AAbD,CAA4C,mBAAU,GAarD","sourcesContent":["import { RestClient } from '@reyaxyz/common';\n\nexport default class ReferralClient extends RestClient {\n async propagateReferralOnChain(\n walletAddress: string,\n accountId?: number,\n marketId?: number,\n ) {\n const uri = `/api/referral/propagate-referral-on-chain`;\n return this.post<void>(uri, {\n walletAddress,\n accountId,\n marketId,\n });\n }\n}\n"]}
@@ -1,15 +0,0 @@
1
- import { RestClient, ReyaChainId } from '@reyaxyz/common';
2
- import { AlreadyGaveTradePermissionParams, AlreadyGaveTradePermissionResult, CancelConditionalOrderParams, CancelConditionalOrderResult, GetConditionalOrdersHistoryForMarginAccountParams, GetConditionalOrdersHistoryForMarginAccountResult, GetConditionalOrdersHistoryForWalletAddressParams, RegisterConditionalOrderParams, RegisterConditionalOrderResult, UpdateConditionalOrderParams, UpdateConditionalOrderResult } 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
- cancelConditionalOrder(params: CancelConditionalOrderParams): Promise<CancelConditionalOrderResult>;
10
- registerConditionalOrder(params: RegisterConditionalOrderParams): Promise<RegisterConditionalOrderResult>;
11
- updateConditionalOrder(params: UpdateConditionalOrderParams): Promise<UpdateConditionalOrderResult>;
12
- private getPosition;
13
- private parseConditionalOrderInputs;
14
- }
15
- //# 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,EAC7B,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,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,53 +0,0 @@
1
- import { ConditionalOrder, UnifiedConditionalOrderType, ConditionalOrderType } from '@reyaxyz/common';
2
- import { Signer, JsonRpcSigner } from 'ethers';
3
- import { MarketEntity } 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 GetConditionalOrdersHistoryForMarginAccountParams = {
44
- address: string;
45
- marginAccountId: number;
46
- limit?: number;
47
- };
48
- export type GetConditionalOrdersHistoryForWalletAddressParams = {
49
- walletAddress: string;
50
- limit?: number;
51
- };
52
- export type GetConditionalOrdersHistoryForMarginAccountResult = UnifiedConditionalOrderType[];
53
- //# 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,O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AEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAGF,MAAM,MAAM,iDAAiD,GAAG;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iDAAiD,GAAG;IAC9D,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iDAAiD,GAC3D,2BAA2B,EAAE,CAAC"}
@@ -1,5 +0,0 @@
1
- import { RestClient } from '@reyaxyz/common';
2
- export default class ReferralClient extends RestClient {
3
- propagateReferralOnChain(walletAddress: string, accountId?: number, marketId?: number): Promise<void>;
4
- }
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/referral/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU;IAC9C,wBAAwB,CAC5B,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM;CASpB"}