@reyaxyz/common 0.205.0 → 0.206.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,538 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "type": "function",
5
+ "name": "execute",
6
+ "inputs": [
7
+ {
8
+ "name": "accountId",
9
+ "type": "uint128",
10
+ "internalType": "uint128"
11
+ },
12
+ {
13
+ "name": "commands",
14
+ "type": "tuple[]",
15
+ "internalType": "struct Command[]",
16
+ "components": [
17
+ {
18
+ "name": "commandType",
19
+ "type": "uint8",
20
+ "internalType": "enum CommandType"
21
+ },
22
+ {
23
+ "name": "inputs",
24
+ "type": "bytes",
25
+ "internalType": "bytes"
26
+ },
27
+ {
28
+ "name": "marketId",
29
+ "type": "uint128",
30
+ "internalType": "uint128"
31
+ },
32
+ {
33
+ "name": "exchangeId",
34
+ "type": "uint128",
35
+ "internalType": "uint128"
36
+ }
37
+ ]
38
+ }
39
+ ],
40
+ "outputs": [
41
+ {
42
+ "name": "outputs",
43
+ "type": "bytes[]",
44
+ "internalType": "bytes[]"
45
+ },
46
+ {
47
+ "name": "usdNodeMarginInfo",
48
+ "type": "tuple",
49
+ "internalType": "struct MarginInfo",
50
+ "components": [
51
+ {
52
+ "name": "collateral",
53
+ "type": "address",
54
+ "internalType": "address"
55
+ },
56
+ {
57
+ "name": "marginBalance",
58
+ "type": "int256",
59
+ "internalType": "int256"
60
+ },
61
+ {
62
+ "name": "realBalance",
63
+ "type": "int256",
64
+ "internalType": "int256"
65
+ },
66
+ {
67
+ "name": "initialDelta",
68
+ "type": "int256",
69
+ "internalType": "int256"
70
+ },
71
+ {
72
+ "name": "maintenanceDelta",
73
+ "type": "int256",
74
+ "internalType": "int256"
75
+ },
76
+ {
77
+ "name": "liquidationDelta",
78
+ "type": "int256",
79
+ "internalType": "int256"
80
+ },
81
+ {
82
+ "name": "dutchDelta",
83
+ "type": "int256",
84
+ "internalType": "int256"
85
+ },
86
+ {
87
+ "name": "adlDelta",
88
+ "type": "int256",
89
+ "internalType": "int256"
90
+ },
91
+ {
92
+ "name": "initialBufferDelta",
93
+ "type": "int256",
94
+ "internalType": "int256"
95
+ },
96
+ {
97
+ "name": "liquidationMarginRequirement",
98
+ "type": "uint256",
99
+ "internalType": "uint256"
100
+ }
101
+ ]
102
+ }
103
+ ],
104
+ "stateMutability": "nonpayable"
105
+ },
106
+ {
107
+ "type": "function",
108
+ "name": "batchExecute",
109
+ "inputs": [
110
+ {
111
+ "name": "orders",
112
+ "type": "tuple[]",
113
+ "internalType": "struct ConditionalOrderDetails[]",
114
+ "components": [
115
+ {
116
+ "name": "accountId",
117
+ "type": "uint128",
118
+ "internalType": "uint128"
119
+ },
120
+ {
121
+ "name": "marketId",
122
+ "type": "uint128",
123
+ "internalType": "uint128"
124
+ },
125
+ {
126
+ "name": "exchangeId",
127
+ "type": "uint128",
128
+ "internalType": "uint128"
129
+ },
130
+ {
131
+ "name": "counterpartyAccountIds",
132
+ "type": "uint128[]",
133
+ "internalType": "uint128[]"
134
+ },
135
+ {
136
+ "name": "orderType",
137
+ "type": "uint8",
138
+ "internalType": "enum OrderType"
139
+ },
140
+ {
141
+ "name": "inputs",
142
+ "type": "bytes",
143
+ "internalType": "bytes"
144
+ },
145
+ {
146
+ "name": "signer",
147
+ "type": "address",
148
+ "internalType": "address"
149
+ },
150
+ {
151
+ "name": "nonce",
152
+ "type": "uint256",
153
+ "internalType": "uint256"
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "name": "signatures",
159
+ "type": "tuple[]",
160
+ "internalType": "struct EIP712Signature[]",
161
+ "components": [
162
+ {
163
+ "name": "v",
164
+ "type": "uint8",
165
+ "internalType": "uint8"
166
+ },
167
+ {
168
+ "name": "r",
169
+ "type": "bytes32",
170
+ "internalType": "bytes32"
171
+ },
172
+ {
173
+ "name": "s",
174
+ "type": "bytes32",
175
+ "internalType": "bytes32"
176
+ },
177
+ {
178
+ "name": "deadline",
179
+ "type": "uint256",
180
+ "internalType": "uint256"
181
+ }
182
+ ]
183
+ }
184
+ ],
185
+ "outputs": [
186
+ {
187
+ "name": "outputs",
188
+ "type": "bytes[]",
189
+ "internalType": "bytes[]"
190
+ }
191
+ ],
192
+ "stateMutability": "nonpayable"
193
+ },
194
+ {
195
+ "type": "event",
196
+ "name": "SuccessfulOrder",
197
+ "inputs": [
198
+ {
199
+ "name": "orderIndex",
200
+ "type": "uint256",
201
+ "indexed": false,
202
+ "internalType": "uint256"
203
+ },
204
+ {
205
+ "name": "order",
206
+ "type": "tuple",
207
+ "indexed": false,
208
+ "internalType": "struct ConditionalOrderDetails",
209
+ "components": [
210
+ {
211
+ "name": "accountId",
212
+ "type": "uint128",
213
+ "internalType": "uint128"
214
+ },
215
+ {
216
+ "name": "marketId",
217
+ "type": "uint128",
218
+ "internalType": "uint128"
219
+ },
220
+ {
221
+ "name": "exchangeId",
222
+ "type": "uint128",
223
+ "internalType": "uint128"
224
+ },
225
+ {
226
+ "name": "counterpartyAccountIds",
227
+ "type": "uint128[]",
228
+ "internalType": "uint128[]"
229
+ },
230
+ {
231
+ "name": "orderType",
232
+ "type": "uint8",
233
+ "internalType": "enum OrderType"
234
+ },
235
+ {
236
+ "name": "inputs",
237
+ "type": "bytes",
238
+ "internalType": "bytes"
239
+ },
240
+ {
241
+ "name": "signer",
242
+ "type": "address",
243
+ "internalType": "address"
244
+ },
245
+ {
246
+ "name": "nonce",
247
+ "type": "uint256",
248
+ "internalType": "uint256"
249
+ }
250
+ ]
251
+ },
252
+ {
253
+ "name": "output",
254
+ "type": "bytes",
255
+ "indexed": false,
256
+ "internalType": "bytes"
257
+ },
258
+ {
259
+ "name": "blockTimestamp",
260
+ "type": "uint256",
261
+ "indexed": false,
262
+ "internalType": "uint256"
263
+ }
264
+ ],
265
+ "anonymous": false
266
+ },
267
+ {
268
+ "type": "event",
269
+ "name": "FailedOrderMessage",
270
+ "inputs": [
271
+ {
272
+ "name": "orderIndex",
273
+ "type": "uint256",
274
+ "indexed": false,
275
+ "internalType": "uint256"
276
+ },
277
+ {
278
+ "name": "order",
279
+ "type": "tuple",
280
+ "indexed": false,
281
+ "internalType": "struct ConditionalOrderDetails",
282
+ "components": [
283
+ {
284
+ "name": "accountId",
285
+ "type": "uint128",
286
+ "internalType": "uint128"
287
+ },
288
+ {
289
+ "name": "marketId",
290
+ "type": "uint128",
291
+ "internalType": "uint128"
292
+ },
293
+ {
294
+ "name": "exchangeId",
295
+ "type": "uint128",
296
+ "internalType": "uint128"
297
+ },
298
+ {
299
+ "name": "counterpartyAccountIds",
300
+ "type": "uint128[]",
301
+ "internalType": "uint128[]"
302
+ },
303
+ {
304
+ "name": "orderType",
305
+ "type": "uint8",
306
+ "internalType": "enum OrderType"
307
+ },
308
+ {
309
+ "name": "inputs",
310
+ "type": "bytes",
311
+ "internalType": "bytes"
312
+ },
313
+ {
314
+ "name": "signer",
315
+ "type": "address",
316
+ "internalType": "address"
317
+ },
318
+ {
319
+ "name": "nonce",
320
+ "type": "uint256",
321
+ "internalType": "uint256"
322
+ }
323
+ ]
324
+ },
325
+ {
326
+ "name": "reason",
327
+ "type": "string",
328
+ "indexed": false,
329
+ "internalType": "string"
330
+ },
331
+ {
332
+ "name": "blockTimestamp",
333
+ "type": "uint256",
334
+ "indexed": false,
335
+ "internalType": "uint256"
336
+ }
337
+ ],
338
+ "anonymous": false
339
+ },
340
+ {
341
+ "type": "event",
342
+ "name": "FailedOrderBytes",
343
+ "inputs": [
344
+ {
345
+ "name": "orderIndex",
346
+ "type": "uint256",
347
+ "indexed": false,
348
+ "internalType": "uint256"
349
+ },
350
+ {
351
+ "name": "order",
352
+ "type": "tuple",
353
+ "indexed": false,
354
+ "internalType": "struct ConditionalOrderDetails",
355
+ "components": [
356
+ {
357
+ "name": "accountId",
358
+ "type": "uint128",
359
+ "internalType": "uint128"
360
+ },
361
+ {
362
+ "name": "marketId",
363
+ "type": "uint128",
364
+ "internalType": "uint128"
365
+ },
366
+ {
367
+ "name": "exchangeId",
368
+ "type": "uint128",
369
+ "internalType": "uint128"
370
+ },
371
+ {
372
+ "name": "counterpartyAccountIds",
373
+ "type": "uint128[]",
374
+ "internalType": "uint128[]"
375
+ },
376
+ {
377
+ "name": "orderType",
378
+ "type": "uint8",
379
+ "internalType": "enum OrderType"
380
+ },
381
+ {
382
+ "name": "inputs",
383
+ "type": "bytes",
384
+ "internalType": "bytes"
385
+ },
386
+ {
387
+ "name": "signer",
388
+ "type": "address",
389
+ "internalType": "address"
390
+ },
391
+ {
392
+ "name": "nonce",
393
+ "type": "uint256",
394
+ "internalType": "uint256"
395
+ }
396
+ ]
397
+ },
398
+ {
399
+ "name": "reason",
400
+ "type": "bytes",
401
+ "indexed": false,
402
+ "internalType": "bytes"
403
+ },
404
+ {
405
+ "name": "blockTimestamp",
406
+ "type": "uint256",
407
+ "indexed": false,
408
+ "internalType": "uint256"
409
+ }
410
+ ],
411
+ "anonymous": false
412
+ },
413
+ {
414
+ "type": "event",
415
+ "name": "ConditionalOrderExecuted",
416
+ "inputs": [
417
+ {
418
+ "name": "order",
419
+ "type": "tuple",
420
+ "indexed": false,
421
+ "internalType": "struct ConditionalOrderDetails",
422
+ "components": [
423
+ {
424
+ "name": "accountId",
425
+ "type": "uint128",
426
+ "internalType": "uint128"
427
+ },
428
+ {
429
+ "name": "marketId",
430
+ "type": "uint128",
431
+ "internalType": "uint128"
432
+ },
433
+ {
434
+ "name": "exchangeId",
435
+ "type": "uint128",
436
+ "internalType": "uint128"
437
+ },
438
+ {
439
+ "name": "counterpartyAccountIds",
440
+ "type": "uint128[]",
441
+ "internalType": "uint128[]"
442
+ },
443
+ {
444
+ "name": "orderType",
445
+ "type": "uint8",
446
+ "internalType": "enum OrderType"
447
+ },
448
+ {
449
+ "name": "inputs",
450
+ "type": "bytes",
451
+ "internalType": "bytes"
452
+ },
453
+ {
454
+ "name": "signer",
455
+ "type": "address",
456
+ "internalType": "address"
457
+ },
458
+ {
459
+ "name": "nonce",
460
+ "type": "uint256",
461
+ "internalType": "uint256"
462
+ }
463
+ ]
464
+ },
465
+ {
466
+ "name": "output",
467
+ "type": "bytes",
468
+ "indexed": false,
469
+ "internalType": "bytes"
470
+ },
471
+ {
472
+ "name": "blockTimestamp",
473
+ "type": "uint256",
474
+ "indexed": false,
475
+ "internalType": "uint256"
476
+ }
477
+ ],
478
+ "anonymous": false
479
+ },
480
+ {
481
+ "type": "event",
482
+ "name": "StorkSignedPayloadDataType",
483
+ "inputs": [
484
+ {
485
+ "name": "payload",
486
+ "type": "tuple",
487
+ "indexed": false,
488
+ "internalType": "struct StorkSignedPayload",
489
+ "components": [
490
+ {
491
+ "name": "oraclePubKey",
492
+ "type": "address",
493
+ "internalType": "address"
494
+ },
495
+ {
496
+ "name": "pricePayload",
497
+ "type": "tuple",
498
+ "internalType": "struct StorkPricePayload",
499
+ "components": [
500
+ {
501
+ "name": "assetPairId",
502
+ "type": "string",
503
+ "internalType": "string"
504
+ },
505
+ {
506
+ "name": "timestamp",
507
+ "type": "uint256",
508
+ "internalType": "uint256"
509
+ },
510
+ {
511
+ "name": "price",
512
+ "type": "uint256",
513
+ "internalType": "uint256"
514
+ }
515
+ ]
516
+ },
517
+ {
518
+ "name": "r",
519
+ "type": "bytes32",
520
+ "internalType": "bytes32"
521
+ },
522
+ {
523
+ "name": "s",
524
+ "type": "bytes32",
525
+ "internalType": "bytes32"
526
+ },
527
+ {
528
+ "name": "v",
529
+ "type": "uint8",
530
+ "internalType": "uint8"
531
+ }
532
+ ]
533
+ }
534
+ ],
535
+ "anonymous": false
536
+ }
537
+ ]
538
+ }
@@ -1,4 +1,4 @@
1
1
  export const BRIDGE_DEADLINE_IN_SECONDS = 15 * 60; // 15 minutes
2
2
  export const CORE_DEADLINE_IN_SECONDS = 60; // 1 minute
3
3
  export const RELAYER_ACCOUNT = '0xb43c317c9c9215d268881d7d6b59c2d3d0247da1'; // @todo update value
4
- export const CONDITIONAL_ORDER_SIG_DEADLINE = 10 ** 18; // very big number for timestamp
4
+ export const CONDITIONAL_ORDER_SIG_DEADLINE = BigInt(10 ** 18); // very big number for timestamp
@@ -4,6 +4,7 @@ export { abi as MulticallAbi } from './abis/CustomMulticall3.json';
4
4
  export { abi as OracleAdaptersAbi } from './abis/OracleAdaptersProxy.json';
5
5
  export { abi as PeripheryAbi } from './abis/Periphery.json';
6
6
  export { abi as Socket_VaultWithPayloadAbi } from './abis/socket/VaultWithPayload.json';
7
+ export { abi as OrdersGatewayAbi } from './abis/OrdersGateway.json';
7
8
  export * from './contractAddresses';
8
9
  export * from './routerCommands';
9
10
  export * from './sign';
@@ -13,18 +13,18 @@ export type EIP712Signature = {
13
13
  v: number;
14
14
  r: string;
15
15
  s: string;
16
- deadline: number;
16
+ deadline: bigint;
17
17
  };
18
18
 
19
19
  export function convertEthersSignatureToEIP712Signature(
20
20
  signature: Signature,
21
- deadline: number,
21
+ deadline: bigint | number,
22
22
  ): EIP712Signature {
23
23
  return {
24
24
  v: signature.v,
25
25
  r: signature.r,
26
26
  s: signature.s,
27
- deadline: deadline,
27
+ deadline: BigInt(deadline),
28
28
  };
29
29
  }
30
30
 
@@ -181,7 +181,7 @@ export async function signConditionalOrder(
181
181
  orderType: number,
182
182
  inputs: string,
183
183
  nonce: bigint,
184
- deadline: number,
184
+ deadline: bigint,
185
185
  ): Promise<string> {
186
186
  const signature = await signReyaTypedData(
187
187
  signer,
@@ -189,7 +189,7 @@ export async function signConditionalOrder(
189
189
  conditionalOrderTypes,
190
190
  {
191
191
  verifyingChainId: reyaChainId,
192
- deadline: BigInt(deadline),
192
+ deadline,
193
193
  order: {
194
194
  accountId: accountId,
195
195
  marketId: marketId,
package/src/types.ts CHANGED
@@ -1026,6 +1026,9 @@ export type ConditionalOrder = {
1026
1026
  creationTimestampMs: number;
1027
1027
  lastUpdateTimestampMs: number;
1028
1028
  base: number;
1029
+ exchangeId: number;
1030
+ inputs: string;
1031
+ counterpartyAccountId: number;
1029
1032
  };
1030
1033
 
1031
1034
  export type UnifiedConditionalOrderType = {