@reyaxyz/common 0.100.1 → 0.101.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.
- package/dist/transactions/abis/Periphery.json +101 -5
- package/dist/transactions/routerCommands.js +1 -3
- package/dist/transactions/routerCommands.js.map +1 -1
- package/dist/types/transactions/routerCommands.d.ts +1 -2
- package/dist/types/transactions/routerCommands.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/transactions/abis/Periphery.json +101 -5
- package/src/transactions/routerCommands.ts +0 -2
|
@@ -202,10 +202,6 @@
|
|
|
202
202
|
"name": "ZeroAddress",
|
|
203
203
|
"inputs": []
|
|
204
204
|
},
|
|
205
|
-
{
|
|
206
|
-
"type": "receive",
|
|
207
|
-
"stateMutability": "payable"
|
|
208
|
-
},
|
|
209
205
|
{
|
|
210
206
|
"type": "function",
|
|
211
207
|
"name": "getGlobalConfiguration",
|
|
@@ -322,6 +318,13 @@
|
|
|
322
318
|
],
|
|
323
319
|
"stateMutability": "view"
|
|
324
320
|
},
|
|
321
|
+
{
|
|
322
|
+
"type": "function",
|
|
323
|
+
"name": "receiveEth",
|
|
324
|
+
"inputs": [],
|
|
325
|
+
"outputs": [],
|
|
326
|
+
"stateMutability": "payable"
|
|
327
|
+
},
|
|
325
328
|
{
|
|
326
329
|
"type": "function",
|
|
327
330
|
"name": "rescueErc20",
|
|
@@ -684,6 +687,80 @@
|
|
|
684
687
|
}
|
|
685
688
|
]
|
|
686
689
|
},
|
|
690
|
+
{
|
|
691
|
+
"type": "function",
|
|
692
|
+
"name": "execute",
|
|
693
|
+
"inputs": [
|
|
694
|
+
{
|
|
695
|
+
"name": "inputs",
|
|
696
|
+
"type": "tuple",
|
|
697
|
+
"internalType": "struct PeripheryExecutionInputs",
|
|
698
|
+
"components": [
|
|
699
|
+
{
|
|
700
|
+
"name": "accountId",
|
|
701
|
+
"type": "uint128",
|
|
702
|
+
"internalType": "uint128"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"name": "commands",
|
|
706
|
+
"type": "tuple[]",
|
|
707
|
+
"internalType": "struct Command[]",
|
|
708
|
+
"components": [
|
|
709
|
+
{
|
|
710
|
+
"name": "commandType",
|
|
711
|
+
"type": "uint8",
|
|
712
|
+
"internalType": "enum CommandType"
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"name": "inputs",
|
|
716
|
+
"type": "bytes",
|
|
717
|
+
"internalType": "bytes"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"name": "marketId",
|
|
721
|
+
"type": "uint128",
|
|
722
|
+
"internalType": "uint128"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"name": "exchangeId",
|
|
726
|
+
"type": "uint128",
|
|
727
|
+
"internalType": "uint128"
|
|
728
|
+
}
|
|
729
|
+
]
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
"name": "sig",
|
|
733
|
+
"type": "tuple",
|
|
734
|
+
"internalType": "struct EIP712Signature",
|
|
735
|
+
"components": [
|
|
736
|
+
{
|
|
737
|
+
"name": "v",
|
|
738
|
+
"type": "uint8",
|
|
739
|
+
"internalType": "uint8"
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
"name": "r",
|
|
743
|
+
"type": "bytes32",
|
|
744
|
+
"internalType": "bytes32"
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"name": "s",
|
|
748
|
+
"type": "bytes32",
|
|
749
|
+
"internalType": "bytes32"
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
"name": "deadline",
|
|
753
|
+
"type": "uint256",
|
|
754
|
+
"internalType": "uint256"
|
|
755
|
+
}
|
|
756
|
+
]
|
|
757
|
+
}
|
|
758
|
+
]
|
|
759
|
+
}
|
|
760
|
+
],
|
|
761
|
+
"outputs": [],
|
|
762
|
+
"stateMutability": "nonpayable"
|
|
763
|
+
},
|
|
687
764
|
{
|
|
688
765
|
"type": "function",
|
|
689
766
|
"name": "executeMatchOrders",
|
|
@@ -758,9 +835,28 @@
|
|
|
758
835
|
"outputs": [],
|
|
759
836
|
"stateMutability": "nonpayable"
|
|
760
837
|
},
|
|
838
|
+
{
|
|
839
|
+
"type": "function",
|
|
840
|
+
"name": "isCommandAllowed",
|
|
841
|
+
"inputs": [
|
|
842
|
+
{
|
|
843
|
+
"name": "command",
|
|
844
|
+
"type": "uint8",
|
|
845
|
+
"internalType": "enum CommandType"
|
|
846
|
+
}
|
|
847
|
+
],
|
|
848
|
+
"outputs": [
|
|
849
|
+
{
|
|
850
|
+
"name": "",
|
|
851
|
+
"type": "bool",
|
|
852
|
+
"internalType": "bool"
|
|
853
|
+
}
|
|
854
|
+
],
|
|
855
|
+
"stateMutability": "pure"
|
|
856
|
+
},
|
|
761
857
|
{
|
|
762
858
|
"type": "error",
|
|
763
|
-
"name": "
|
|
859
|
+
"name": "InvalidPeripheryExecution",
|
|
764
860
|
"inputs": []
|
|
765
861
|
},
|
|
766
862
|
{
|
|
@@ -14,14 +14,12 @@ var CommandType;
|
|
|
14
14
|
CommandType[CommandType["WITHDRAW"] = 1] = "WITHDRAW";
|
|
15
15
|
CommandType[CommandType["DUTCH_LIQUIDATION"] = 2] = "DUTCH_LIQUIDATION";
|
|
16
16
|
CommandType[CommandType["MATCH_ORDER"] = 3] = "MATCH_ORDER";
|
|
17
|
-
CommandType[CommandType["
|
|
18
|
-
CommandType[CommandType["TRANSFER_MARGIN_ACCOUNT"] = 5] = "TRANSFER_MARGIN_ACCOUNT";
|
|
17
|
+
CommandType[CommandType["TRANSFER_MARGIN_ACCOUNT"] = 4] = "TRANSFER_MARGIN_ACCOUNT";
|
|
19
18
|
})(CommandType || (exports.CommandType = CommandType = {}));
|
|
20
19
|
var ABI_DEFINITION = (_a = {},
|
|
21
20
|
_a[CommandType.DEPOSIT] = ['address', 'uint256'],
|
|
22
21
|
_a[CommandType.WITHDRAW] = ['address', 'uint256'],
|
|
23
22
|
_a[CommandType.MATCH_ORDER] = ['uint128[]', 'bytes'],
|
|
24
|
-
_a[CommandType.PROPAGATE_CACHE_FLOW] = [],
|
|
25
23
|
_a[CommandType.DUTCH_LIQUIDATION] = ['tuple(uint128,address,uint128[],bytes)'],
|
|
26
24
|
_a[CommandType.TRANSFER_MARGIN_ACCOUNT] = ['tuple(uint128,address,uint256)'],
|
|
27
25
|
_a);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerCommands.js","sourceRoot":"/","sources":["transactions/routerCommands.ts"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAGlC;;;;GAIG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"routerCommands.js","sourceRoot":"/","sources":["transactions/routerCommands.ts"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAGlC;;;;GAIG;AACH,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,mDAAO,CAAA;IACP,qDAAQ,CAAA;IACR,uEAAiB,CAAA;IACjB,2DAAW,CAAA;IACX,mFAAuB,CAAA;AACzB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAED,IAAM,cAAc;IAClB,GAAC,WAAW,CAAC,OAAO,IAAG,CAAC,SAAS,EAAE,SAAS,CAAC;IAC7C,GAAC,WAAW,CAAC,QAAQ,IAAG,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9C,GAAC,WAAW,CAAC,WAAW,IAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IACjD,GAAC,WAAW,CAAC,iBAAiB,IAAG,CAAC,wCAAwC,CAAC;IAC3E,GAAC,WAAW,CAAC,uBAAuB,IAAG,CAAC,gCAAgC,CAAC;OAC1E,CAAC;AASF,SAAgB,aAAa,CAC3B,IAAiB,EACjB,UAAqB,EACrB,QAAgB,EAChB,UAAkB;IAElB,IAAM,YAAY,GAAG,iBAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CACpD,cAAc,CAAC,IAAI,CAAC,EACpB,UAAU,CACX,CAAC;IACF,OAAO,EAAE,IAAI,MAAA,EAAE,YAAY,cAAA,EAAE,QAAQ,UAAA,EAAE,UAAU,YAAA,EAAE,CAAC;AACtD,CAAC;AAXD,sCAWC;AAED,SAAgB,UAAU,CACxB,IAAiB,EACjB,UAAqB,EACrB,QAAgB,EAChB,UAAkB;IAElB,IAAM,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtE,OAAO;QACL,OAAO,EAAE;YACP,WAAW,EAAE,OAAO,CAAC,IAAI;YACzB,MAAM,EAAE,OAAO,CAAC,YAAY;YAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B;KACF,CAAC;AACJ,CAAC;AAfD,gCAeC","sourcesContent":["import { AbiCoder } from 'ethers';\nimport { SingleAction } from './action';\n\n/**\n * CommandTypes\n * @description Flags that modify a command's execution\n * @enum {number}\n */\nexport enum CommandType {\n DEPOSIT,\n WITHDRAW,\n DUTCH_LIQUIDATION,\n MATCH_ORDER,\n TRANSFER_MARGIN_ACCOUNT,\n}\n\nconst ABI_DEFINITION: { [key in CommandType]: string[] } = {\n [CommandType.DEPOSIT]: ['address', 'uint256'],\n [CommandType.WITHDRAW]: ['address', 'uint256'],\n [CommandType.MATCH_ORDER]: ['uint128[]', 'bytes'],\n [CommandType.DUTCH_LIQUIDATION]: ['tuple(uint128,address,uint128[],bytes)'],\n [CommandType.TRANSFER_MARGIN_ACCOUNT]: ['tuple(uint128,address,uint256)'], // @todo update once needed\n};\n\nexport type RouterCommand = {\n type: CommandType;\n encodedInput: string;\n marketId: number;\n exchangeId: number;\n};\n\nexport function createCommand(\n type: CommandType,\n parameters: unknown[],\n marketId: number,\n exchangeId: number,\n): RouterCommand {\n const encodedInput = AbiCoder.defaultAbiCoder().encode(\n ABI_DEFINITION[type],\n parameters,\n );\n return { type, encodedInput, marketId, exchangeId };\n}\n\nexport function getCommand(\n type: CommandType,\n parameters: unknown[],\n marketId: number,\n exchangeId: number,\n): SingleAction {\n const command = createCommand(type, parameters, marketId, exchangeId);\n return {\n command: {\n commandType: command.type,\n inputs: command.encodedInput,\n marketId: command.marketId,\n exchangeId: command.exchangeId,\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerCommands.d.ts","sourceRoot":"/","sources":["transactions/routerCommands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;;GAIG;AACH,oBAAY,WAAW;IACrB,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,iBAAiB,IAAA;IACjB,WAAW,IAAA;IACX,
|
|
1
|
+
{"version":3,"file":"routerCommands.d.ts","sourceRoot":"/","sources":["transactions/routerCommands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;;GAIG;AACH,oBAAY,WAAW;IACrB,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,iBAAiB,IAAA;IACjB,WAAW,IAAA;IACX,uBAAuB,IAAA;CACxB;AAUD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,aAAa,CAC3B,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,OAAO,EAAE,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,aAAa,CAMf;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,OAAO,EAAE,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,YAAY,CAUd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.101.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
43
43
|
},
|
|
44
44
|
"packageManager": "pnpm@8.3.1",
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "28b1a475082b95ac0954c766d404a9c91946d31b"
|
|
46
46
|
}
|
|
@@ -202,10 +202,6 @@
|
|
|
202
202
|
"name": "ZeroAddress",
|
|
203
203
|
"inputs": []
|
|
204
204
|
},
|
|
205
|
-
{
|
|
206
|
-
"type": "receive",
|
|
207
|
-
"stateMutability": "payable"
|
|
208
|
-
},
|
|
209
205
|
{
|
|
210
206
|
"type": "function",
|
|
211
207
|
"name": "getGlobalConfiguration",
|
|
@@ -322,6 +318,13 @@
|
|
|
322
318
|
],
|
|
323
319
|
"stateMutability": "view"
|
|
324
320
|
},
|
|
321
|
+
{
|
|
322
|
+
"type": "function",
|
|
323
|
+
"name": "receiveEth",
|
|
324
|
+
"inputs": [],
|
|
325
|
+
"outputs": [],
|
|
326
|
+
"stateMutability": "payable"
|
|
327
|
+
},
|
|
325
328
|
{
|
|
326
329
|
"type": "function",
|
|
327
330
|
"name": "rescueErc20",
|
|
@@ -684,6 +687,80 @@
|
|
|
684
687
|
}
|
|
685
688
|
]
|
|
686
689
|
},
|
|
690
|
+
{
|
|
691
|
+
"type": "function",
|
|
692
|
+
"name": "execute",
|
|
693
|
+
"inputs": [
|
|
694
|
+
{
|
|
695
|
+
"name": "inputs",
|
|
696
|
+
"type": "tuple",
|
|
697
|
+
"internalType": "struct PeripheryExecutionInputs",
|
|
698
|
+
"components": [
|
|
699
|
+
{
|
|
700
|
+
"name": "accountId",
|
|
701
|
+
"type": "uint128",
|
|
702
|
+
"internalType": "uint128"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"name": "commands",
|
|
706
|
+
"type": "tuple[]",
|
|
707
|
+
"internalType": "struct Command[]",
|
|
708
|
+
"components": [
|
|
709
|
+
{
|
|
710
|
+
"name": "commandType",
|
|
711
|
+
"type": "uint8",
|
|
712
|
+
"internalType": "enum CommandType"
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"name": "inputs",
|
|
716
|
+
"type": "bytes",
|
|
717
|
+
"internalType": "bytes"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"name": "marketId",
|
|
721
|
+
"type": "uint128",
|
|
722
|
+
"internalType": "uint128"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"name": "exchangeId",
|
|
726
|
+
"type": "uint128",
|
|
727
|
+
"internalType": "uint128"
|
|
728
|
+
}
|
|
729
|
+
]
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
"name": "sig",
|
|
733
|
+
"type": "tuple",
|
|
734
|
+
"internalType": "struct EIP712Signature",
|
|
735
|
+
"components": [
|
|
736
|
+
{
|
|
737
|
+
"name": "v",
|
|
738
|
+
"type": "uint8",
|
|
739
|
+
"internalType": "uint8"
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
"name": "r",
|
|
743
|
+
"type": "bytes32",
|
|
744
|
+
"internalType": "bytes32"
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"name": "s",
|
|
748
|
+
"type": "bytes32",
|
|
749
|
+
"internalType": "bytes32"
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
"name": "deadline",
|
|
753
|
+
"type": "uint256",
|
|
754
|
+
"internalType": "uint256"
|
|
755
|
+
}
|
|
756
|
+
]
|
|
757
|
+
}
|
|
758
|
+
]
|
|
759
|
+
}
|
|
760
|
+
],
|
|
761
|
+
"outputs": [],
|
|
762
|
+
"stateMutability": "nonpayable"
|
|
763
|
+
},
|
|
687
764
|
{
|
|
688
765
|
"type": "function",
|
|
689
766
|
"name": "executeMatchOrders",
|
|
@@ -758,9 +835,28 @@
|
|
|
758
835
|
"outputs": [],
|
|
759
836
|
"stateMutability": "nonpayable"
|
|
760
837
|
},
|
|
838
|
+
{
|
|
839
|
+
"type": "function",
|
|
840
|
+
"name": "isCommandAllowed",
|
|
841
|
+
"inputs": [
|
|
842
|
+
{
|
|
843
|
+
"name": "command",
|
|
844
|
+
"type": "uint8",
|
|
845
|
+
"internalType": "enum CommandType"
|
|
846
|
+
}
|
|
847
|
+
],
|
|
848
|
+
"outputs": [
|
|
849
|
+
{
|
|
850
|
+
"name": "",
|
|
851
|
+
"type": "bool",
|
|
852
|
+
"internalType": "bool"
|
|
853
|
+
}
|
|
854
|
+
],
|
|
855
|
+
"stateMutability": "pure"
|
|
856
|
+
},
|
|
761
857
|
{
|
|
762
858
|
"type": "error",
|
|
763
|
-
"name": "
|
|
859
|
+
"name": "InvalidPeripheryExecution",
|
|
764
860
|
"inputs": []
|
|
765
861
|
},
|
|
766
862
|
{
|
|
@@ -11,7 +11,6 @@ export enum CommandType {
|
|
|
11
11
|
WITHDRAW,
|
|
12
12
|
DUTCH_LIQUIDATION,
|
|
13
13
|
MATCH_ORDER,
|
|
14
|
-
PROPAGATE_CACHE_FLOW,
|
|
15
14
|
TRANSFER_MARGIN_ACCOUNT,
|
|
16
15
|
}
|
|
17
16
|
|
|
@@ -19,7 +18,6 @@ const ABI_DEFINITION: { [key in CommandType]: string[] } = {
|
|
|
19
18
|
[CommandType.DEPOSIT]: ['address', 'uint256'],
|
|
20
19
|
[CommandType.WITHDRAW]: ['address', 'uint256'],
|
|
21
20
|
[CommandType.MATCH_ORDER]: ['uint128[]', 'bytes'],
|
|
22
|
-
[CommandType.PROPAGATE_CACHE_FLOW]: [], // @todo Check if correct
|
|
23
21
|
[CommandType.DUTCH_LIQUIDATION]: ['tuple(uint128,address,uint128[],bytes)'],
|
|
24
22
|
[CommandType.TRANSFER_MARGIN_ACCOUNT]: ['tuple(uint128,address,uint256)'], // @todo update once needed
|
|
25
23
|
};
|