@reyaxyz/common 0.361.1 → 0.362.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 CHANGED
@@ -6,5 +6,5 @@
6
6
 
7
7
  | Statements | Branches | Functions | Lines |
8
8
  | --------------------------- | ----------------------- | ------------------------- | ----------------- |
9
- | ![Statements](https://img.shields.io/badge/statements-35.31%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-30.98%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-21.92%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-36.67%25-red.svg?style=flat) |
9
+ | ![Statements](https://img.shields.io/badge/statements-35.92%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-32.56%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-22.6%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-37.27%25-red.svg?style=flat) |
10
10
 
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLegacyExecutionType = exports.CanonicalExecutionType = void 0;
4
+ // Matches reya-network's V3 ExecutionType. Legacy event ordinals are different.
5
+ var CanonicalExecutionType;
6
+ (function (CanonicalExecutionType) {
7
+ CanonicalExecutionType[CanonicalExecutionType["MATCH_ORDER"] = 0] = "MATCH_ORDER";
8
+ CanonicalExecutionType[CanonicalExecutionType["DUTCH_LIQUIDATION"] = 1] = "DUTCH_LIQUIDATION";
9
+ CanonicalExecutionType[CanonicalExecutionType["RANKED_LIQUIDATION"] = 2] = "RANKED_LIQUIDATION";
10
+ CanonicalExecutionType[CanonicalExecutionType["BACKSTOP_LIQUIDATION"] = 3] = "BACKSTOP_LIQUIDATION";
11
+ CanonicalExecutionType[CanonicalExecutionType["ADL"] = 4] = "ADL";
12
+ CanonicalExecutionType[CanonicalExecutionType["MARKET_CLOSE"] = 5] = "MARKET_CLOSE";
13
+ })(CanonicalExecutionType || (exports.CanonicalExecutionType = CanonicalExecutionType = {}));
14
+ // All pre-V3 events use the same LiquidationType. Match orders historically
15
+ // stored either -1 or 0; the explicit match flag takes precedence.
16
+ function getLegacyExecutionType(isMatchOrder, liquidationType) {
17
+ if (isMatchOrder)
18
+ return CanonicalExecutionType.MATCH_ORDER;
19
+ switch (Number(liquidationType)) {
20
+ case 0:
21
+ return CanonicalExecutionType.RANKED_LIQUIDATION;
22
+ case 1:
23
+ return CanonicalExecutionType.DUTCH_LIQUIDATION;
24
+ case 2:
25
+ return CanonicalExecutionType.BACKSTOP_LIQUIDATION;
26
+ case 3:
27
+ return CanonicalExecutionType.ADL;
28
+ case 4:
29
+ return CanonicalExecutionType.MARKET_CLOSE;
30
+ default:
31
+ throw new Error("Unknown legacy liquidation type: ".concat(liquidationType));
32
+ }
33
+ }
34
+ exports.getLegacyExecutionType = getLegacyExecutionType;
35
+ //# sourceMappingURL=canonical-execution-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-execution-type.js","sourceRoot":"/","sources":["canonical-execution-type.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,iFAAe,CAAA;IACf,6FAAqB,CAAA;IACrB,+FAAsB,CAAA;IACtB,mGAAwB,CAAA;IACxB,iEAAO,CAAA;IACP,mFAAgB,CAAA;AAClB,CAAC,EAPW,sBAAsB,sCAAtB,sBAAsB,QAOjC;AAED,4EAA4E;AAC5E,mEAAmE;AACnE,SAAgB,sBAAsB,CACpC,YAAqB,EACrB,eAAgC;IAEhC,IAAI,YAAY;QAAE,OAAO,sBAAsB,CAAC,WAAW,CAAC;IAE5D,QAAQ,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;QAChC,KAAK,CAAC;YACJ,OAAO,sBAAsB,CAAC,kBAAkB,CAAC;QACnD,KAAK,CAAC;YACJ,OAAO,sBAAsB,CAAC,iBAAiB,CAAC;QAClD,KAAK,CAAC;YACJ,OAAO,sBAAsB,CAAC,oBAAoB,CAAC;QACrD,KAAK,CAAC;YACJ,OAAO,sBAAsB,CAAC,GAAG,CAAC;QACpC,KAAK,CAAC;YACJ,OAAO,sBAAsB,CAAC,YAAY,CAAC;QAC7C;YACE,MAAM,IAAI,KAAK,CAAC,2CAAoC,eAAe,CAAE,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC;AApBD,wDAoBC","sourcesContent":["// Matches reya-network's V3 ExecutionType. Legacy event ordinals are different.\nexport enum CanonicalExecutionType {\n MATCH_ORDER = 0,\n DUTCH_LIQUIDATION = 1,\n RANKED_LIQUIDATION = 2,\n BACKSTOP_LIQUIDATION = 3,\n ADL = 4,\n MARKET_CLOSE = 5,\n}\n\n// All pre-V3 events use the same LiquidationType. Match orders historically\n// stored either -1 or 0; the explicit match flag takes precedence.\nexport function getLegacyExecutionType(\n isMatchOrder: boolean,\n liquidationType: bigint | number,\n): CanonicalExecutionType {\n if (isMatchOrder) return CanonicalExecutionType.MATCH_ORDER;\n\n switch (Number(liquidationType)) {\n case 0:\n return CanonicalExecutionType.RANKED_LIQUIDATION;\n case 1:\n return CanonicalExecutionType.DUTCH_LIQUIDATION;\n case 2:\n return CanonicalExecutionType.BACKSTOP_LIQUIDATION;\n case 3:\n return CanonicalExecutionType.ADL;\n case 4:\n return CanonicalExecutionType.MARKET_CLOSE;\n default:\n throw new Error(`Unknown legacy liquidation type: ${liquidationType}`);\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -25,4 +25,5 @@ __exportStar(require("./modules"), exports);
25
25
  __exportStar(require("./rest"), exports);
26
26
  __exportStar(require("./decorators"), exports);
27
27
  __exportStar(require("./transactions"), exports);
28
+ __exportStar(require("./canonical-execution-type"), exports);
28
29
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B;AAC5B,sDAAoC;AACpC,yDAAuC;AACvC,6CAA2B;AAC3B,0CAAwB;AACxB,6CAA2B;AAC3B,4CAA0B;AAC1B,yCAAuB;AACvB,+CAA6B;AAC7B,iDAA+B","sourcesContent":["export * from './types';\nexport * from './api-types';\nexport * from './trading-api-types';\nexport * from './incentives-api-types';\nexport * from './commands';\nexport * from './utils';\nexport * from './services';\nexport * from './modules';\nexport * from './rest';\nexport * from './decorators';\nexport * from './transactions';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B;AAC5B,sDAAoC;AACpC,yDAAuC;AACvC,6CAA2B;AAC3B,0CAAwB;AACxB,6CAA2B;AAC3B,4CAA0B;AAC1B,yCAAuB;AACvB,+CAA6B;AAC7B,iDAA+B;AAC/B,6DAA2C","sourcesContent":["export * from './types';\nexport * from './api-types';\nexport * from './trading-api-types';\nexport * from './incentives-api-types';\nexport * from './commands';\nexport * from './utils';\nexport * from './services';\nexport * from './modules';\nexport * from './rest';\nexport * from './decorators';\nexport * from './transactions';\nexport * from './canonical-execution-type';\n"]}
@@ -0,0 +1,10 @@
1
+ export declare enum CanonicalExecutionType {
2
+ MATCH_ORDER = 0,
3
+ DUTCH_LIQUIDATION = 1,
4
+ RANKED_LIQUIDATION = 2,
5
+ BACKSTOP_LIQUIDATION = 3,
6
+ ADL = 4,
7
+ MARKET_CLOSE = 5
8
+ }
9
+ export declare function getLegacyExecutionType(isMatchOrder: boolean, liquidationType: bigint | number): CanonicalExecutionType;
10
+ //# sourceMappingURL=canonical-execution-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical-execution-type.d.ts","sourceRoot":"/","sources":["canonical-execution-type.ts"],"names":[],"mappings":"AACA,oBAAY,sBAAsB;IAChC,WAAW,IAAI;IACf,iBAAiB,IAAI;IACrB,kBAAkB,IAAI;IACtB,oBAAoB,IAAI;IACxB,GAAG,IAAI;IACP,YAAY,IAAI;CACjB;AAID,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,OAAO,EACrB,eAAe,EAAE,MAAM,GAAG,MAAM,GAC/B,sBAAsB,CAiBxB"}
@@ -9,4 +9,5 @@ export * from './modules';
9
9
  export * from './rest';
10
10
  export * from './decorators';
11
11
  export * from './transactions';
12
+ export * from './canonical-execution-type';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/common",
3
- "version": "0.361.1",
3
+ "version": "0.362.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -45,5 +45,5 @@
45
45
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
46
46
  },
47
47
  "packageManager": "pnpm@8.3.1",
48
- "gitHead": "be293415791df1f0cb1f394fd3575f7672c91b3a"
48
+ "gitHead": "a691ef73599e2d5d76b73f1e1f4e570ae45b0842"
49
49
  }
@@ -0,0 +1,33 @@
1
+ // Matches reya-network's V3 ExecutionType. Legacy event ordinals are different.
2
+ export enum CanonicalExecutionType {
3
+ MATCH_ORDER = 0,
4
+ DUTCH_LIQUIDATION = 1,
5
+ RANKED_LIQUIDATION = 2,
6
+ BACKSTOP_LIQUIDATION = 3,
7
+ ADL = 4,
8
+ MARKET_CLOSE = 5,
9
+ }
10
+
11
+ // All pre-V3 events use the same LiquidationType. Match orders historically
12
+ // stored either -1 or 0; the explicit match flag takes precedence.
13
+ export function getLegacyExecutionType(
14
+ isMatchOrder: boolean,
15
+ liquidationType: bigint | number,
16
+ ): CanonicalExecutionType {
17
+ if (isMatchOrder) return CanonicalExecutionType.MATCH_ORDER;
18
+
19
+ switch (Number(liquidationType)) {
20
+ case 0:
21
+ return CanonicalExecutionType.RANKED_LIQUIDATION;
22
+ case 1:
23
+ return CanonicalExecutionType.DUTCH_LIQUIDATION;
24
+ case 2:
25
+ return CanonicalExecutionType.BACKSTOP_LIQUIDATION;
26
+ case 3:
27
+ return CanonicalExecutionType.ADL;
28
+ case 4:
29
+ return CanonicalExecutionType.MARKET_CLOSE;
30
+ default:
31
+ throw new Error(`Unknown legacy liquidation type: ${liquidationType}`);
32
+ }
33
+ }
package/src/index.ts CHANGED
@@ -9,3 +9,4 @@ export * from './modules';
9
9
  export * from './rest';
10
10
  export * from './decorators';
11
11
  export * from './transactions';
12
+ export * from './canonical-execution-type';