@reyaxyz/common 0.155.0 → 0.155.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.
package/README.md CHANGED
@@ -6,5 +6,5 @@
6
6
 
7
7
  | Statements | Branches | Functions | Lines |
8
8
  | --------------------------- | ----------------------- | ------------------------- | ----------------- |
9
- | ![Statements](https://img.shields.io/badge/statements-15.27%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-13.17%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-8.69%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-15.88%25-red.svg?style=flat) |
9
+ | ![Statements](https://img.shields.io/badge/statements-15.24%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-14.03%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-9.09%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-15.84%25-red.svg?style=flat) |
10
10
 
@@ -0,0 +1,477 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "type": "function",
5
+ "name": "batchExecute",
6
+ "inputs": [
7
+ {
8
+ "name": "orders",
9
+ "type": "tuple[]",
10
+ "internalType": "struct ConditionalOrderDetails[]",
11
+ "components": [
12
+ {
13
+ "name": "accountId",
14
+ "type": "uint128",
15
+ "internalType": "uint128"
16
+ },
17
+ {
18
+ "name": "marketId",
19
+ "type": "uint128",
20
+ "internalType": "uint128"
21
+ },
22
+ {
23
+ "name": "exchangeId",
24
+ "type": "uint128",
25
+ "internalType": "uint128"
26
+ },
27
+ {
28
+ "name": "counterpartyAccountIds",
29
+ "type": "uint128[]",
30
+ "internalType": "uint128[]"
31
+ },
32
+ {
33
+ "name": "orderType",
34
+ "type": "uint8",
35
+ "internalType": "enum OrderType"
36
+ },
37
+ {
38
+ "name": "inputs",
39
+ "type": "bytes",
40
+ "internalType": "bytes"
41
+ },
42
+ {
43
+ "name": "signer",
44
+ "type": "address",
45
+ "internalType": "address"
46
+ },
47
+ {
48
+ "name": "nonce",
49
+ "type": "uint256",
50
+ "internalType": "uint256"
51
+ }
52
+ ]
53
+ },
54
+ {
55
+ "name": "signatures",
56
+ "type": "bytes[]",
57
+ "internalType": "bytes[]"
58
+ }
59
+ ],
60
+ "outputs": [
61
+ {
62
+ "name": "outputs",
63
+ "type": "bytes[]",
64
+ "internalType": "bytes[]"
65
+ }
66
+ ],
67
+ "stateMutability": "nonpayable"
68
+ },
69
+ {
70
+ "type": "function",
71
+ "name": "canExecute",
72
+ "inputs": [
73
+ {
74
+ "name": "order",
75
+ "type": "tuple",
76
+ "internalType": "struct ConditionalOrderDetails",
77
+ "components": [
78
+ {
79
+ "name": "accountId",
80
+ "type": "uint128",
81
+ "internalType": "uint128"
82
+ },
83
+ {
84
+ "name": "marketId",
85
+ "type": "uint128",
86
+ "internalType": "uint128"
87
+ },
88
+ {
89
+ "name": "exchangeId",
90
+ "type": "uint128",
91
+ "internalType": "uint128"
92
+ },
93
+ {
94
+ "name": "counterpartyAccountIds",
95
+ "type": "uint128[]",
96
+ "internalType": "uint128[]"
97
+ },
98
+ {
99
+ "name": "orderType",
100
+ "type": "uint8",
101
+ "internalType": "enum OrderType"
102
+ },
103
+ {
104
+ "name": "inputs",
105
+ "type": "bytes",
106
+ "internalType": "bytes"
107
+ },
108
+ {
109
+ "name": "signer",
110
+ "type": "address",
111
+ "internalType": "address"
112
+ },
113
+ {
114
+ "name": "nonce",
115
+ "type": "uint256",
116
+ "internalType": "uint256"
117
+ }
118
+ ]
119
+ },
120
+ {
121
+ "name": "signature",
122
+ "type": "bytes",
123
+ "internalType": "bytes"
124
+ }
125
+ ],
126
+ "outputs": [
127
+ {
128
+ "name": "",
129
+ "type": "bool",
130
+ "internalType": "bool"
131
+ }
132
+ ],
133
+ "stateMutability": "view"
134
+ },
135
+ {
136
+ "type": "function",
137
+ "name": "execute",
138
+ "inputs": [
139
+ {
140
+ "name": "order",
141
+ "type": "tuple",
142
+ "internalType": "struct ConditionalOrderDetails",
143
+ "components": [
144
+ {
145
+ "name": "accountId",
146
+ "type": "uint128",
147
+ "internalType": "uint128"
148
+ },
149
+ {
150
+ "name": "marketId",
151
+ "type": "uint128",
152
+ "internalType": "uint128"
153
+ },
154
+ {
155
+ "name": "exchangeId",
156
+ "type": "uint128",
157
+ "internalType": "uint128"
158
+ },
159
+ {
160
+ "name": "counterpartyAccountIds",
161
+ "type": "uint128[]",
162
+ "internalType": "uint128[]"
163
+ },
164
+ {
165
+ "name": "orderType",
166
+ "type": "uint8",
167
+ "internalType": "enum OrderType"
168
+ },
169
+ {
170
+ "name": "inputs",
171
+ "type": "bytes",
172
+ "internalType": "bytes"
173
+ },
174
+ {
175
+ "name": "signer",
176
+ "type": "address",
177
+ "internalType": "address"
178
+ },
179
+ {
180
+ "name": "nonce",
181
+ "type": "uint256",
182
+ "internalType": "uint256"
183
+ }
184
+ ]
185
+ },
186
+ {
187
+ "name": "signature",
188
+ "type": "bytes",
189
+ "internalType": "bytes"
190
+ }
191
+ ],
192
+ "outputs": [
193
+ {
194
+ "name": "output",
195
+ "type": "bytes",
196
+ "internalType": "bytes"
197
+ }
198
+ ],
199
+ "stateMutability": "nonpayable"
200
+ },
201
+ {
202
+ "type": "function",
203
+ "name": "hasUnorderedNonceBeenUsed",
204
+ "inputs": [
205
+ {
206
+ "name": "accountId",
207
+ "type": "uint128",
208
+ "internalType": "uint128"
209
+ },
210
+ {
211
+ "name": "nonce",
212
+ "type": "uint256",
213
+ "internalType": "uint256"
214
+ }
215
+ ],
216
+ "outputs": [
217
+ {
218
+ "name": "",
219
+ "type": "bool",
220
+ "internalType": "bool"
221
+ }
222
+ ],
223
+ "stateMutability": "view"
224
+ },
225
+ {
226
+ "type": "function",
227
+ "name": "verifySignature",
228
+ "inputs": [
229
+ {
230
+ "name": "order",
231
+ "type": "tuple",
232
+ "internalType": "struct ConditionalOrderDetails",
233
+ "components": [
234
+ {
235
+ "name": "accountId",
236
+ "type": "uint128",
237
+ "internalType": "uint128"
238
+ },
239
+ {
240
+ "name": "marketId",
241
+ "type": "uint128",
242
+ "internalType": "uint128"
243
+ },
244
+ {
245
+ "name": "exchangeId",
246
+ "type": "uint128",
247
+ "internalType": "uint128"
248
+ },
249
+ {
250
+ "name": "counterpartyAccountIds",
251
+ "type": "uint128[]",
252
+ "internalType": "uint128[]"
253
+ },
254
+ {
255
+ "name": "orderType",
256
+ "type": "uint8",
257
+ "internalType": "enum OrderType"
258
+ },
259
+ {
260
+ "name": "inputs",
261
+ "type": "bytes",
262
+ "internalType": "bytes"
263
+ },
264
+ {
265
+ "name": "signer",
266
+ "type": "address",
267
+ "internalType": "address"
268
+ },
269
+ {
270
+ "name": "nonce",
271
+ "type": "uint256",
272
+ "internalType": "uint256"
273
+ }
274
+ ]
275
+ },
276
+ {
277
+ "name": "signature",
278
+ "type": "bytes",
279
+ "internalType": "bytes"
280
+ }
281
+ ],
282
+ "outputs": [
283
+ {
284
+ "name": "",
285
+ "type": "bool",
286
+ "internalType": "bool"
287
+ }
288
+ ],
289
+ "stateMutability": "view"
290
+ },
291
+ {
292
+ "type": "function",
293
+ "name": "verifySigner",
294
+ "inputs": [
295
+ {
296
+ "name": "accountId",
297
+ "type": "uint128",
298
+ "internalType": "uint128"
299
+ },
300
+ {
301
+ "name": "signer",
302
+ "type": "address",
303
+ "internalType": "address"
304
+ }
305
+ ],
306
+ "outputs": [
307
+ {
308
+ "name": "",
309
+ "type": "bool",
310
+ "internalType": "bool"
311
+ }
312
+ ],
313
+ "stateMutability": "view"
314
+ },
315
+ {
316
+ "type": "error",
317
+ "name": "CannotExecuteConditionalOrder",
318
+ "inputs": [
319
+ {
320
+ "name": "order",
321
+ "type": "tuple",
322
+ "internalType": "struct ConditionalOrderDetails",
323
+ "components": [
324
+ {
325
+ "name": "accountId",
326
+ "type": "uint128",
327
+ "internalType": "uint128"
328
+ },
329
+ {
330
+ "name": "marketId",
331
+ "type": "uint128",
332
+ "internalType": "uint128"
333
+ },
334
+ {
335
+ "name": "exchangeId",
336
+ "type": "uint128",
337
+ "internalType": "uint128"
338
+ },
339
+ {
340
+ "name": "counterpartyAccountIds",
341
+ "type": "uint128[]",
342
+ "internalType": "uint128[]"
343
+ },
344
+ {
345
+ "name": "orderType",
346
+ "type": "uint8",
347
+ "internalType": "enum OrderType"
348
+ },
349
+ {
350
+ "name": "inputs",
351
+ "type": "bytes",
352
+ "internalType": "bytes"
353
+ },
354
+ {
355
+ "name": "signer",
356
+ "type": "address",
357
+ "internalType": "address"
358
+ },
359
+ {
360
+ "name": "nonce",
361
+ "type": "uint256",
362
+ "internalType": "uint256"
363
+ }
364
+ ]
365
+ },
366
+ {
367
+ "name": "signature",
368
+ "type": "bytes",
369
+ "internalType": "bytes"
370
+ }
371
+ ]
372
+ },
373
+ {
374
+ "type": "error",
375
+ "name": "FeatureUnavailable",
376
+ "inputs": [
377
+ {
378
+ "name": "which",
379
+ "type": "bytes32",
380
+ "internalType": "bytes32"
381
+ }
382
+ ]
383
+ },
384
+ {
385
+ "type": "error",
386
+ "name": "HigherExecutionPrice",
387
+ "inputs": [
388
+ {
389
+ "name": "executionPrice",
390
+ "type": "uint256",
391
+ "internalType": "UD60x18"
392
+ },
393
+ {
394
+ "name": "priceLimit",
395
+ "type": "uint256",
396
+ "internalType": "UD60x18"
397
+ }
398
+ ]
399
+ },
400
+ {
401
+ "type": "error",
402
+ "name": "LowerExecutionPrice",
403
+ "inputs": [
404
+ {
405
+ "name": "executionPrice",
406
+ "type": "uint256",
407
+ "internalType": "UD60x18"
408
+ },
409
+ {
410
+ "name": "priceLimit",
411
+ "type": "uint256",
412
+ "internalType": "UD60x18"
413
+ }
414
+ ]
415
+ },
416
+ {
417
+ "type": "error",
418
+ "name": "MatchOrderOutputsLengthMismatch",
419
+ "inputs": [
420
+ {
421
+ "name": "outputsLength",
422
+ "type": "uint256",
423
+ "internalType": "uint256"
424
+ }
425
+ ]
426
+ },
427
+ {
428
+ "type": "error",
429
+ "name": "OrderTypeNotFound",
430
+ "inputs": [
431
+ {
432
+ "name": "orderType",
433
+ "type": "uint8",
434
+ "internalType": "enum OrderType"
435
+ }
436
+ ]
437
+ },
438
+ {
439
+ "type": "error",
440
+ "name": "ZeroStopLossOrderSize",
441
+ "inputs": [
442
+ {
443
+ "name": "stopLossOrder",
444
+ "type": "tuple",
445
+ "internalType": "struct StopLossOrderDetails",
446
+ "components": [
447
+ {
448
+ "name": "accountId",
449
+ "type": "uint128",
450
+ "internalType": "uint128"
451
+ },
452
+ {
453
+ "name": "marketId",
454
+ "type": "uint128",
455
+ "internalType": "uint128"
456
+ },
457
+ {
458
+ "name": "exchangeId",
459
+ "type": "uint128",
460
+ "internalType": "uint128"
461
+ },
462
+ {
463
+ "name": "triggerPrice",
464
+ "type": "uint256",
465
+ "internalType": "UD60x18"
466
+ },
467
+ {
468
+ "name": "priceLimit",
469
+ "type": "uint256",
470
+ "internalType": "UD60x18"
471
+ }
472
+ ]
473
+ }
474
+ ]
475
+ }
476
+ ]
477
+ }
@@ -8,17 +8,20 @@ var ContractType;
8
8
  ContractType["CORE_PROXY"] = "core_proxy";
9
9
  ContractType["PASSIVE_POOL_PROXY"] = "passive_pool_proxy";
10
10
  ContractType["PERIPHERY_PROXY"] = "periphery_proxy";
11
+ ContractType["CONDITIONAL_ORDERS_PROXY"] = "conditional_orders_proxy";
11
12
  })(ContractType || (exports.ContractType = ContractType = {}));
12
13
  var addresses = (_a = {},
13
14
  _a[types_1.ReyaChainId.reyaCronos] = (_b = {},
14
15
  _b[ContractType.CORE_PROXY] = '0x20da8f7aa44f858a3a3e3f03ba6ffad039d1eb28',
15
16
  _b[ContractType.PASSIVE_POOL_PROXY] = '0x9afc30bed29d636e566fd9d7dd89d51773724be6',
16
17
  _b[ContractType.PERIPHERY_PROXY] = '0xa45d0566144956b6012d461ad509dad2bacacaaf',
18
+ _b[ContractType.CONDITIONAL_ORDERS_PROXY] = '',
17
19
  _b),
18
20
  _a[types_1.ReyaChainId.reyaNetwork] = (_c = {},
19
21
  _c[ContractType.CORE_PROXY] = '0xa763b6a5e09378434406c003dae6487fbbdc1a80',
20
22
  _c[ContractType.PASSIVE_POOL_PROXY] = '0xb4b77d6180cc14472a9a7bdff01cc2459368d413',
21
23
  _c[ContractType.PERIPHERY_PROXY] = '0xcd2869d1eb1bc8991bc55de9e9b779e912faf736',
24
+ _c[ContractType.CONDITIONAL_ORDERS_PROXY] = '',
22
25
  _c),
23
26
  _a);
24
27
  var getAddress = function (chainId, contractName) {
@@ -1 +1 @@
1
- {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["transactions/contractAddresses.ts"],"names":[],"mappings":";;;;AAAA,kCAAgD;AAEhD,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,yCAAyB,CAAA;IACzB,yDAAyC,CAAA;IACzC,mDAAmC,CAAA;AACrC,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED,IAAM,SAAS;IACb,GAAC,mBAAW,CAAC,UAAU;QACrB,GAAC,YAAY,CAAC,UAAU,IAAG,4CAA4C;QACvE,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;WAC/C;IACD,GAAC,mBAAW,CAAC,WAAW;QACtB,GAAC,YAAY,CAAC,UAAU,IAAG,4CAA4C;QACvE,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;WAC/C;OACF,CAAC;AACK,IAAM,UAAU,GAAG,UACxB,OAAe,EACf,YAA0B;IAE1B,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,6CAAsC,UAAU,CAAE,CAAC,CAAC;IACtE,CAAC;IAED,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAsB,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,kCAA2B,YAAY,cAAW,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB","sourcesContent":["import { Address, ReyaChainId } from '../types';\n\nexport enum ContractType {\n CORE_PROXY = 'core_proxy',\n PASSIVE_POOL_PROXY = 'passive_pool_proxy',\n PERIPHERY_PROXY = 'periphery_proxy',\n}\n\nconst addresses: Record<ReyaChainId, Record<ContractType, Address>> = {\n [ReyaChainId.reyaCronos]: {\n [ContractType.CORE_PROXY]: '0x20da8f7aa44f858a3a3e3f03ba6ffad039d1eb28',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0x9afc30bed29d636e566fd9d7dd89d51773724be6',\n [ContractType.PERIPHERY_PROXY]:\n '0xa45d0566144956b6012d461ad509dad2bacacaaf',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.CORE_PROXY]: '0xa763b6a5e09378434406c003dae6487fbbdc1a80',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0xb4b77d6180cc14472a9a7bdff01cc2459368d413',\n [ContractType.PERIPHERY_PROXY]:\n '0xcd2869d1eb1bc8991bc55de9e9b779e912faf736',\n },\n};\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): Address => {\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n throw new Error(`Unspecified addresses for chain id ${keyChainId}`);\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n if (!Object.keys(networkAddresses).includes(contractName)) {\n throw new Error(`Unspecified address for ${contractName} contract`);\n }\n\n return networkAddresses[contractName];\n};\n"]}
1
+ {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["transactions/contractAddresses.ts"],"names":[],"mappings":";;;;AAAA,kCAAgD;AAEhD,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,yCAAyB,CAAA;IACzB,yDAAyC,CAAA;IACzC,mDAAmC,CAAA;IACnC,qEAAqD,CAAA;AACvD,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,IAAM,SAAS;IACb,GAAC,mBAAW,CAAC,UAAU;QACrB,GAAC,YAAY,CAAC,UAAU,IAAG,4CAA4C;QACvE,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,wBAAwB,IAAG,EAAE;WAC5C;IACD,GAAC,mBAAW,CAAC,WAAW;QACtB,GAAC,YAAY,CAAC,UAAU,IAAG,4CAA4C;QACvE,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,eAAe,IAC3B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,wBAAwB,IAAG,EAAE;WAC5C;OACF,CAAC;AACK,IAAM,UAAU,GAAG,UACxB,OAAe,EACf,YAA0B;IAE1B,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,6CAAsC,UAAU,CAAE,CAAC,CAAC;IACtE,CAAC;IAED,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAsB,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,kCAA2B,YAAY,cAAW,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB","sourcesContent":["import { Address, ReyaChainId } from '../types';\n\nexport enum ContractType {\n CORE_PROXY = 'core_proxy',\n PASSIVE_POOL_PROXY = 'passive_pool_proxy',\n PERIPHERY_PROXY = 'periphery_proxy',\n CONDITIONAL_ORDERS_PROXY = 'conditional_orders_proxy',\n}\n\nconst addresses: Record<ReyaChainId, Record<ContractType, Address>> = {\n [ReyaChainId.reyaCronos]: {\n [ContractType.CORE_PROXY]: '0x20da8f7aa44f858a3a3e3f03ba6ffad039d1eb28',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0x9afc30bed29d636e566fd9d7dd89d51773724be6',\n [ContractType.PERIPHERY_PROXY]:\n '0xa45d0566144956b6012d461ad509dad2bacacaaf',\n [ContractType.CONDITIONAL_ORDERS_PROXY]: '',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.CORE_PROXY]: '0xa763b6a5e09378434406c003dae6487fbbdc1a80',\n [ContractType.PASSIVE_POOL_PROXY]:\n '0xb4b77d6180cc14472a9a7bdff01cc2459368d413',\n [ContractType.PERIPHERY_PROXY]:\n '0xcd2869d1eb1bc8991bc55de9e9b779e912faf736',\n [ContractType.CONDITIONAL_ORDERS_PROXY]: '',\n },\n};\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): Address => {\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n throw new Error(`Unspecified addresses for chain id ${keyChainId}`);\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n if (!Object.keys(networkAddresses).includes(contractName)) {\n throw new Error(`Unspecified address for ${contractName} contract`);\n }\n\n return networkAddresses[contractName];\n};\n"]}
@@ -14,12 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Socket_VaultWithPayloadAbi = exports.PeripheryAbi = exports.CoreAbi = void 0;
17
+ exports.Socket_VaultWithPayloadAbi = exports.ConditionalOrdersAbi = exports.PeripheryAbi = exports.CoreAbi = void 0;
18
18
  __exportStar(require("./action"), exports);
19
19
  var CoreProxy_json_1 = require("./abis/CoreProxy.json");
20
20
  Object.defineProperty(exports, "CoreAbi", { enumerable: true, get: function () { return CoreProxy_json_1.abi; } });
21
21
  var Periphery_json_1 = require("./abis/Periphery.json");
22
22
  Object.defineProperty(exports, "PeripheryAbi", { enumerable: true, get: function () { return Periphery_json_1.abi; } });
23
+ var ConditionalOrdersGateway_json_1 = require("./abis/ConditionalOrdersGateway.json");
24
+ Object.defineProperty(exports, "ConditionalOrdersAbi", { enumerable: true, get: function () { return ConditionalOrdersGateway_json_1.abi; } });
23
25
  var VaultWithPayload_json_1 = require("./abis/socket/VaultWithPayload.json");
24
26
  Object.defineProperty(exports, "Socket_VaultWithPayloadAbi", { enumerable: true, get: function () { return VaultWithPayload_json_1.abi; } });
25
27
  __exportStar(require("./contractAddresses"), exports);
@@ -29,4 +31,5 @@ __exportStar(require("./trade"), exports);
29
31
  __exportStar(require("./txHelpers"), exports);
30
32
  __exportStar(require("./consts"), exports);
31
33
  __exportStar(require("./executeTransaction"), exports);
34
+ __exportStar(require("./permissions"), exports);
32
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["transactions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,wDAAuD;AAA9C,yGAAA,GAAG,OAAW;AACvB,wDAA4D;AAAnD,8GAAA,GAAG,OAAgB;AAC5B,6EAAwF;AAA/E,mIAAA,GAAG,OAA8B;AAC1C,sDAAoC;AACpC,mDAAiC;AACjC,yCAAuB;AACvB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,uDAAqC","sourcesContent":["export * from './action';\nexport { abi as CoreAbi } from './abis/CoreProxy.json';\nexport { abi as PeripheryAbi } from './abis/Periphery.json';\nexport { abi as Socket_VaultWithPayloadAbi } from './abis/socket/VaultWithPayload.json';\nexport * from './contractAddresses';\nexport * from './routerCommands';\nexport * from './sign';\nexport * from './trade';\nexport * from './txHelpers';\nexport * from './consts';\nexport * from './executeTransaction';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["transactions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,wDAAuD;AAA9C,yGAAA,GAAG,OAAW;AACvB,wDAA4D;AAAnD,8GAAA,GAAG,OAAgB;AAC5B,sFAAmF;AAA1E,qIAAA,GAAG,OAAwB;AACpC,6EAAwF;AAA/E,mIAAA,GAAG,OAA8B;AAC1C,sDAAoC;AACpC,mDAAiC;AACjC,yCAAuB;AACvB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,uDAAqC;AACrC,gDAA8B","sourcesContent":["export * from './action';\nexport { abi as CoreAbi } from './abis/CoreProxy.json';\nexport { abi as PeripheryAbi } from './abis/Periphery.json';\nexport { abi as ConditionalOrdersAbi } from './abis/ConditionalOrdersGateway.json';\nexport { abi as Socket_VaultWithPayloadAbi } from './abis/socket/VaultWithPayload.json';\nexport * from './contractAddresses';\nexport * from './routerCommands';\nexport * from './sign';\nexport * from './trade';\nexport * from './txHelpers';\nexport * from './consts';\nexport * from './executeTransaction';\nexport * from './permissions';\n"]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPermission = exports.CoreAccountPermissionTypes = void 0;
4
+ var ethers_1 = require("ethers");
5
+ var CoreAccountPermissionTypes;
6
+ (function (CoreAccountPermissionTypes) {
7
+ CoreAccountPermissionTypes["ADMIN"] = "ADMIN";
8
+ CoreAccountPermissionTypes["WITHDRAW"] = "WITHDRAW";
9
+ CoreAccountPermissionTypes["TRANSFER"] = "TRANSFER";
10
+ CoreAccountPermissionTypes["DUTCH_LIQUIDATION"] = "DUTCH_LIQUIDATION";
11
+ CoreAccountPermissionTypes["MATCH_ORDER"] = "MATCH_ORDER";
12
+ })(CoreAccountPermissionTypes || (exports.CoreAccountPermissionTypes = CoreAccountPermissionTypes = {}));
13
+ var getPermission = function (permissionName) {
14
+ return ethers_1.ethers.keccak256(ethers_1.ethers.toUtf8Bytes(permissionName));
15
+ };
16
+ exports.getPermission = getPermission;
17
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.js","sourceRoot":"/","sources":["transactions/permissions.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAEhC,IAAY,0BAMX;AAND,WAAY,0BAA0B;IACpC,6CAAe,CAAA;IACf,mDAAqB,CAAA;IACrB,mDAAqB,CAAA;IACrB,qEAAuC,CAAA;IACvC,yDAA2B,CAAA;AAC7B,CAAC,EANW,0BAA0B,0CAA1B,0BAA0B,QAMrC;AAEM,IAAM,aAAa,GAAG,UAC3B,cAA0C;IAE1C,OAAO,eAAM,CAAC,SAAS,CAAC,eAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AAJW,QAAA,aAAa,iBAIxB","sourcesContent":["import { ethers } from 'ethers';\n\nexport enum CoreAccountPermissionTypes {\n ADMIN = 'ADMIN',\n WITHDRAW = 'WITHDRAW',\n TRANSFER = 'TRANSFER',\n DUTCH_LIQUIDATION = 'DUTCH_LIQUIDATION',\n MATCH_ORDER = 'MATCH_ORDER',\n}\n\nexport const getPermission = (\n permissionName: CoreAccountPermissionTypes,\n): string => {\n return ethers.keccak256(ethers.toUtf8Bytes(permissionName));\n};\n"]}
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.signPoolRemoveLiquidity = exports.signCoreCommands = void 0;
39
+ exports.signGrantPermission = exports.signConditionalOrder = exports.signPoolRemoveLiquidity = exports.signCoreCommands = void 0;
40
40
  var ethers_1 = require("ethers");
41
41
  var contractAddresses_1 = require("./contractAddresses");
42
42
  var ethers_2 = require("ethers");
@@ -143,4 +143,86 @@ value) {
143
143
  });
144
144
  });
145
145
  }
146
+ function signConditionalOrder(signer, reyaChainId, accountId, marketId, exchangeId, counterpartyAccountIds, orderType, inputs, nonce, deadline) {
147
+ return __awaiter(this, void 0, void 0, function () {
148
+ var signature, _a, _b;
149
+ var _c;
150
+ return __generator(this, function (_d) {
151
+ switch (_d.label) {
152
+ case 0:
153
+ _a = signReyaTypedData;
154
+ _b = [signer,
155
+ (0, contractAddresses_1.getAddress)(reyaChainId, contractAddresses_1.ContractType.CONDITIONAL_ORDERS_PROXY),
156
+ {
157
+ ConditionalOrderDetails: [
158
+ { name: 'accountId', type: 'uint128' },
159
+ { name: 'marketId', type: 'uint128' },
160
+ { name: 'exchangeId', type: 'uint128' },
161
+ { name: 'counterpartyAccountIds', type: 'uint128[]' },
162
+ { name: 'orderType', type: 'uint8' },
163
+ { name: 'inputs', type: 'bytes' },
164
+ { name: 'signer', type: 'address' },
165
+ { name: 'nonce', type: 'uint256' },
166
+ ],
167
+ }];
168
+ _c = {
169
+ accountId: accountId,
170
+ marketId: marketId,
171
+ exchangeId: exchangeId,
172
+ counterpartyAccountIds: counterpartyAccountIds,
173
+ orderType: orderType,
174
+ inputs: inputs
175
+ };
176
+ return [4 /*yield*/, signer.getAddress()];
177
+ case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([(_c.signer = _d.sent(),
178
+ _c.nonce = nonce,
179
+ _c)]))];
180
+ case 2:
181
+ signature = _d.sent();
182
+ return [2 /*return*/, convertEthersSignatureToEIP712Signature(signature, deadline)];
183
+ }
184
+ });
185
+ });
186
+ }
187
+ exports.signConditionalOrder = signConditionalOrder;
188
+ function signGrantPermission(signer, reyaChainId, accountId, permission, user, nonce, deadline) {
189
+ return __awaiter(this, void 0, void 0, function () {
190
+ var signature, _a, _b;
191
+ var _c;
192
+ return __generator(this, function (_d) {
193
+ switch (_d.label) {
194
+ case 0:
195
+ _a = signReyaTypedData;
196
+ _b = [signer,
197
+ (0, contractAddresses_1.getAddress)(reyaChainId, contractAddresses_1.ContractType.CORE_PROXY),
198
+ {
199
+ GrantAccountPermissionBySig: [
200
+ { name: 'verifyingChainId', type: 'uint256' },
201
+ { name: 'caller', type: 'address' },
202
+ { name: 'accountId', type: 'uint128' },
203
+ { name: 'permission', type: 'bytes32' },
204
+ { name: 'user', type: 'address' },
205
+ { name: 'nonce', type: 'uint256' },
206
+ { name: 'deadline', type: 'uint256' },
207
+ ],
208
+ }];
209
+ _c = {
210
+ verifyingChainId: reyaChainId
211
+ };
212
+ return [4 /*yield*/, signer.getAddress()];
213
+ case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([(_c.caller = _d.sent(),
214
+ _c.accountId = accountId,
215
+ _c.permission = permission,
216
+ _c.user = user,
217
+ _c.nonce = nonce,
218
+ _c.deadline = deadline,
219
+ _c)]))];
220
+ case 2:
221
+ signature = _d.sent();
222
+ return [2 /*return*/, convertEthersSignatureToEIP712Signature(signature, deadline)];
223
+ }
224
+ });
225
+ });
226
+ }
227
+ exports.signGrantPermission = signGrantPermission;
146
228
  //# sourceMappingURL=sign.js.map