@reyaxyz/common 0.224.2 → 0.225.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/README.md +1 -1
- package/dist/transactions/abis/Errors.json +42 -0
- package/dist/transactions/consts.js +2 -1
- package/dist/transactions/consts.js.map +1 -1
- package/dist/transactions/routerCommands.js +4 -2
- package/dist/transactions/routerCommands.js.map +1 -1
- package/dist/types/transactions/consts.d.ts +1 -0
- package/dist/types/transactions/consts.d.ts.map +1 -1
- package/dist/types/transactions/routerCommands.d.ts +1 -1
- package/dist/types/transactions/routerCommands.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/transactions/abis/Errors.json +43 -1
- package/src/transactions/consts.ts +1 -0
- package/src/transactions/routerCommands.ts +4 -2
package/README.md
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
|
|
7
7
|
| Statements | Branches | Functions | Lines |
|
|
8
8
|
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
|
|
9
|
-
|  |  |  |  |
|
|
10
10
|
|
|
@@ -3842,6 +3842,48 @@
|
|
|
3842
3842
|
"internalType": "uint32"
|
|
3843
3843
|
}
|
|
3844
3844
|
]
|
|
3845
|
+
},
|
|
3846
|
+
{
|
|
3847
|
+
"inputs": [],
|
|
3848
|
+
"type": "error",
|
|
3849
|
+
"name": "ZeroCamelotSwapAmountIn"
|
|
3850
|
+
},
|
|
3851
|
+
{
|
|
3852
|
+
"type": "error",
|
|
3853
|
+
"name": "InvalidCamelotSwapPathLength",
|
|
3854
|
+
"inputs": [
|
|
3855
|
+
{
|
|
3856
|
+
"name": "pathLength",
|
|
3857
|
+
"type": "uint256",
|
|
3858
|
+
"internalType": "uint256"
|
|
3859
|
+
}
|
|
3860
|
+
]
|
|
3861
|
+
}, {
|
|
3862
|
+
"type": "error",
|
|
3863
|
+
"name": "CamelotSwapMinAmountOutBreached",
|
|
3864
|
+
"inputs": [
|
|
3865
|
+
{
|
|
3866
|
+
"name": "minAmountOut",
|
|
3867
|
+
"type": "uint256",
|
|
3868
|
+
"internalType": "uint256"
|
|
3869
|
+
},
|
|
3870
|
+
{
|
|
3871
|
+
"name": "executedAmountOut",
|
|
3872
|
+
"type": "uint256",
|
|
3873
|
+
"internalType": "uint256"
|
|
3874
|
+
}
|
|
3875
|
+
]
|
|
3876
|
+
},
|
|
3877
|
+
{
|
|
3878
|
+
"type": "error",
|
|
3879
|
+
"name": "UnauthorizedCamelotSwapPublisher",
|
|
3880
|
+
"inputs": [
|
|
3881
|
+
{
|
|
3882
|
+
"name": "publisher",
|
|
3883
|
+
"type": "address",
|
|
3884
|
+
"internalType": "address"
|
|
3885
|
+
}
|
|
3886
|
+
]
|
|
3845
3887
|
}
|
|
3846
3888
|
]
|
|
3847
3889
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONDITIONAL_ORDER_SIG_DEADLINE = exports.RELAYER_ACCOUNT = exports.CORE_DEADLINE_IN_SECONDS = exports.BRIDGE_DEADLINE_IN_SECONDS = void 0;
|
|
3
|
+
exports.CONDITIONAL_ORDER_SIG_DEADLINE = exports.PUBLISHER_ACCOUNT = exports.RELAYER_ACCOUNT = exports.CORE_DEADLINE_IN_SECONDS = exports.BRIDGE_DEADLINE_IN_SECONDS = void 0;
|
|
4
4
|
exports.BRIDGE_DEADLINE_IN_SECONDS = 15 * 60; // 15 minutes
|
|
5
5
|
exports.CORE_DEADLINE_IN_SECONDS = 60; // 1 minute
|
|
6
6
|
exports.RELAYER_ACCOUNT = '0xb43c317c9c9215d268881d7d6b59c2d3d0247da1'; // @todo update value
|
|
7
|
+
exports.PUBLISHER_ACCOUNT = '0xb43c317c9c9215d268881d7d6b59c2d3d0247da1'; // @todo update value
|
|
7
8
|
exports.CONDITIONAL_ORDER_SIG_DEADLINE = Math.pow(10, 18); // very big number for timestamp
|
|
8
9
|
//# sourceMappingURL=consts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"/","sources":["transactions/consts.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa;AACnD,QAAA,wBAAwB,GAAG,EAAE,CAAC,CAAC,WAAW;AAC1C,QAAA,eAAe,GAAG,4CAA4C,CAAC,CAAC,qBAAqB;AACrF,QAAA,8BAA8B,GAAG,SAAA,EAAE,EAAI,EAAE,CAAA,CAAC,CAAC,gCAAgC","sourcesContent":["export const BRIDGE_DEADLINE_IN_SECONDS = 15 * 60; // 15 minutes\nexport const CORE_DEADLINE_IN_SECONDS = 60; // 1 minute\nexport const RELAYER_ACCOUNT = '0xb43c317c9c9215d268881d7d6b59c2d3d0247da1'; // @todo update value\nexport const CONDITIONAL_ORDER_SIG_DEADLINE = 10 ** 18; // very big number for timestamp\n"]}
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"/","sources":["transactions/consts.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa;AACnD,QAAA,wBAAwB,GAAG,EAAE,CAAC,CAAC,WAAW;AAC1C,QAAA,eAAe,GAAG,4CAA4C,CAAC,CAAC,qBAAqB;AACrF,QAAA,iBAAiB,GAAG,4CAA4C,CAAC,CAAC,qBAAqB;AACvF,QAAA,8BAA8B,GAAG,SAAA,EAAE,EAAI,EAAE,CAAA,CAAC,CAAC,gCAAgC","sourcesContent":["export const BRIDGE_DEADLINE_IN_SECONDS = 15 * 60; // 15 minutes\nexport const CORE_DEADLINE_IN_SECONDS = 60; // 1 minute\nexport const RELAYER_ACCOUNT = '0xb43c317c9c9215d268881d7d6b59c2d3d0247da1'; // @todo update value\nexport const PUBLISHER_ACCOUNT = '0xb43c317c9c9215d268881d7d6b59c2d3d0247da1'; // @todo update value\nexport const CONDITIONAL_ORDER_SIG_DEADLINE = 10 ** 18; // very big number for timestamp\n"]}
|
|
@@ -15,7 +15,7 @@ var CommandType;
|
|
|
15
15
|
CommandType[CommandType["DUTCH_LIQUIDATION"] = 2] = "DUTCH_LIQUIDATION";
|
|
16
16
|
CommandType[CommandType["MATCH_ORDER"] = 3] = "MATCH_ORDER";
|
|
17
17
|
CommandType[CommandType["TRANSFER_MARGIN_ACCOUNT"] = 4] = "TRANSFER_MARGIN_ACCOUNT";
|
|
18
|
-
CommandType[CommandType["
|
|
18
|
+
CommandType[CommandType["CAMELOT_SWAP"] = 5] = "CAMELOT_SWAP";
|
|
19
19
|
})(CommandType || (exports.CommandType = CommandType = {}));
|
|
20
20
|
var ABI_DEFINITION = (_a = {},
|
|
21
21
|
_a[CommandType.DEPOSIT] = ['address', 'uint256'],
|
|
@@ -23,7 +23,9 @@ var ABI_DEFINITION = (_a = {},
|
|
|
23
23
|
_a[CommandType.MATCH_ORDER] = ['uint128[]', 'bytes'],
|
|
24
24
|
_a[CommandType.DUTCH_LIQUIDATION] = ['tuple(uint128,address,uint128[],bytes[])'],
|
|
25
25
|
_a[CommandType.TRANSFER_MARGIN_ACCOUNT] = ['tuple(uint128,address,uint256)'],
|
|
26
|
-
_a[CommandType.
|
|
26
|
+
_a[CommandType.CAMELOT_SWAP] = [
|
|
27
|
+
'tuple(uint256,uint256,address[],address[],address[])',
|
|
28
|
+
],
|
|
27
29
|
_a);
|
|
28
30
|
function createCommand(type, parameters, marketId, exchangeId) {
|
|
29
31
|
var encodedInput = ethers_1.AbiCoder.defaultAbiCoder().encode(ABI_DEFINITION[type], parameters);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerCommands.js","sourceRoot":"/","sources":["transactions/routerCommands.ts"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAGlC;;;;GAIG;AACH,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,mDAAO,CAAA;IACP,qDAAQ,CAAA;IACR,uEAAiB,CAAA;IACjB,2DAAW,CAAA;IACX,mF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AE;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 CAMELOT_SWAP,\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)'],\n [CommandType.CAMELOT_SWAP]: [\n 'tuple(uint256,uint256,address[],address[],address[])',\n ],\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,5 +1,6 @@
|
|
|
1
1
|
export declare const BRIDGE_DEADLINE_IN_SECONDS: number;
|
|
2
2
|
export declare const CORE_DEADLINE_IN_SECONDS = 60;
|
|
3
3
|
export declare const RELAYER_ACCOUNT = "0xb43c317c9c9215d268881d7d6b59c2d3d0247da1";
|
|
4
|
+
export declare const PUBLISHER_ACCOUNT = "0xb43c317c9c9215d268881d7d6b59c2d3d0247da1";
|
|
4
5
|
export declare const CONDITIONAL_ORDER_SIG_DEADLINE: number;
|
|
5
6
|
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"/","sources":["transactions/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,QAAU,CAAC;AAClD,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,eAAe,+CAA+C,CAAC;AAC5E,eAAO,MAAM,8BAA8B,QAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"/","sources":["transactions/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,QAAU,CAAC;AAClD,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,eAAe,+CAA+C,CAAC;AAC5E,eAAO,MAAM,iBAAiB,+CAA+C,CAAC;AAC9E,eAAO,MAAM,8BAA8B,QAAW,CAAC"}
|
|
@@ -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,uBAAuB,IAAA;IACvB,
|
|
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;IACvB,YAAY,IAAA;CACb;AAaD,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.225.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
44
44
|
},
|
|
45
45
|
"packageManager": "pnpm@8.3.1",
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "40183aa8b374c7c7d7a15a7bbf860d6086847990"
|
|
47
47
|
}
|
|
@@ -3842,6 +3842,48 @@
|
|
|
3842
3842
|
"internalType": "uint32"
|
|
3843
3843
|
}
|
|
3844
3844
|
]
|
|
3845
|
-
}
|
|
3845
|
+
},
|
|
3846
|
+
{
|
|
3847
|
+
"inputs": [],
|
|
3848
|
+
"type": "error",
|
|
3849
|
+
"name": "ZeroCamelotSwapAmountIn"
|
|
3850
|
+
},
|
|
3851
|
+
{
|
|
3852
|
+
"type": "error",
|
|
3853
|
+
"name": "InvalidCamelotSwapPathLength",
|
|
3854
|
+
"inputs": [
|
|
3855
|
+
{
|
|
3856
|
+
"name": "pathLength",
|
|
3857
|
+
"type": "uint256",
|
|
3858
|
+
"internalType": "uint256"
|
|
3859
|
+
}
|
|
3860
|
+
]
|
|
3861
|
+
},{
|
|
3862
|
+
"type": "error",
|
|
3863
|
+
"name": "CamelotSwapMinAmountOutBreached",
|
|
3864
|
+
"inputs": [
|
|
3865
|
+
{
|
|
3866
|
+
"name": "minAmountOut",
|
|
3867
|
+
"type": "uint256",
|
|
3868
|
+
"internalType": "uint256"
|
|
3869
|
+
},
|
|
3870
|
+
{
|
|
3871
|
+
"name": "executedAmountOut",
|
|
3872
|
+
"type": "uint256",
|
|
3873
|
+
"internalType": "uint256"
|
|
3874
|
+
}
|
|
3875
|
+
]
|
|
3876
|
+
},
|
|
3877
|
+
{
|
|
3878
|
+
"type": "error",
|
|
3879
|
+
"name": "UnauthorizedCamelotSwapPublisher",
|
|
3880
|
+
"inputs": [
|
|
3881
|
+
{
|
|
3882
|
+
"name": "publisher",
|
|
3883
|
+
"type": "address",
|
|
3884
|
+
"internalType": "address"
|
|
3885
|
+
}
|
|
3886
|
+
]
|
|
3887
|
+
}
|
|
3846
3888
|
]
|
|
3847
3889
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
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 PUBLISHER_ACCOUNT = '0xb43c317c9c9215d268881d7d6b59c2d3d0247da1'; // @todo update value
|
|
4
5
|
export const CONDITIONAL_ORDER_SIG_DEADLINE = 10 ** 18; // very big number for timestamp
|
|
@@ -12,7 +12,7 @@ export enum CommandType {
|
|
|
12
12
|
DUTCH_LIQUIDATION,
|
|
13
13
|
MATCH_ORDER,
|
|
14
14
|
TRANSFER_MARGIN_ACCOUNT,
|
|
15
|
-
|
|
15
|
+
CAMELOT_SWAP,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const ABI_DEFINITION: { [key in CommandType]: string[] } = {
|
|
@@ -21,7 +21,9 @@ const ABI_DEFINITION: { [key in CommandType]: string[] } = {
|
|
|
21
21
|
[CommandType.MATCH_ORDER]: ['uint128[]', 'bytes'],
|
|
22
22
|
[CommandType.DUTCH_LIQUIDATION]: ['tuple(uint128,address,uint128[],bytes[])'],
|
|
23
23
|
[CommandType.TRANSFER_MARGIN_ACCOUNT]: ['tuple(uint128,address,uint256)'],
|
|
24
|
-
[CommandType.
|
|
24
|
+
[CommandType.CAMELOT_SWAP]: [
|
|
25
|
+
'tuple(uint256,uint256,address[],address[],address[])',
|
|
26
|
+
],
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
export type RouterCommand = {
|