@reyaxyz/common 0.242.0 → 0.243.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-16.41%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-17.07%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-10.28%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-17.04%25-red.svg?style=flat) |
9
+ | ![Statements](https://img.shields.io/badge/statements-16.37%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-16.82%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-10.11%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-16.99%25-red.svg?style=flat) |
10
10
 
@@ -0,0 +1,8 @@
1
+ export declare class CooldownInterval {
2
+ private readonly cooldownIntervalMS;
3
+ private lastExecutionTimeMS;
4
+ constructor(cooldownIntervalMS: number);
5
+ isCooldownPeriodOver(): boolean;
6
+ reset(): void;
7
+ }
8
+ //# sourceMappingURL=cooldown-interval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cooldown-interval.d.ts","sourceRoot":"/","sources":["utils/cooldown-interval.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IACpC,OAAO,CAAC,mBAAmB,CAAgB;gBAE/B,kBAAkB,EAAE,MAAM;IAK/B,oBAAoB,IAAI,OAAO;IAQ/B,KAAK,IAAI,IAAI;CAGrB"}
@@ -1,4 +1,5 @@
1
1
  export * from './consts';
2
+ export * from './cooldown-interval';
2
3
  export * from './network';
3
4
  export * from './number';
4
5
  export * from './retry';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CooldownInterval = void 0;
4
+ var CooldownInterval = /** @class */ (function () {
5
+ function CooldownInterval(cooldownIntervalMS) {
6
+ this.cooldownIntervalMS = cooldownIntervalMS;
7
+ this.lastExecutionTimeMS = null;
8
+ }
9
+ CooldownInterval.prototype.isCooldownPeriodOver = function () {
10
+ if (this.lastExecutionTimeMS === null || this.cooldownIntervalMS === 0) {
11
+ return true;
12
+ }
13
+ return this.lastExecutionTimeMS + this.cooldownIntervalMS <= Date.now();
14
+ };
15
+ CooldownInterval.prototype.reset = function () {
16
+ this.lastExecutionTimeMS = Date.now();
17
+ };
18
+ return CooldownInterval;
19
+ }());
20
+ exports.CooldownInterval = CooldownInterval;
21
+ //# sourceMappingURL=cooldown-interval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cooldown-interval.js","sourceRoot":"/","sources":["utils/cooldown-interval.ts"],"names":[],"mappings":";;;AAAA;IAIE,0BAAY,kBAA0B;QACpC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAClC,CAAC;IAEM,+CAAoB,GAA3B;QACE,IAAI,IAAI,CAAC,mBAAmB,KAAK,IAAI,IAAI,IAAI,CAAC,kBAAkB,KAAK,CAAC,EAAE,CAAC;YACvE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IAC1E,CAAC;IAEM,gCAAK,GAAZ;QACE,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACxC,CAAC;IACH,uBAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,4CAAgB","sourcesContent":["export class CooldownInterval {\n private readonly cooldownIntervalMS;\n private lastExecutionTimeMS: number | null;\n\n constructor(cooldownIntervalMS: number) {\n this.cooldownIntervalMS = cooldownIntervalMS;\n this.lastExecutionTimeMS = null;\n }\n\n public isCooldownPeriodOver(): boolean {\n if (this.lastExecutionTimeMS === null || this.cooldownIntervalMS === 0) {\n return true;\n }\n\n return this.lastExecutionTimeMS + this.cooldownIntervalMS <= Date.now();\n }\n\n public reset(): void {\n this.lastExecutionTimeMS = Date.now();\n }\n}\n"]}
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./consts"), exports);
18
+ __exportStar(require("./cooldown-interval"), exports);
18
19
  __exportStar(require("./network"), exports);
19
20
  __exportStar(require("./number"), exports);
20
21
  __exportStar(require("./retry"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,0CAAwB;AACxB,iDAA+B;AAC/B,wDAAsC;AACtC,8CAA4B","sourcesContent":["export * from './consts';\nexport * from './network';\nexport * from './number';\nexport * from './retry';\nexport * from './timestamp';\nexport * from './token';\nexport * from './task-wrapper';\nexport * from './whitelisted-wallets';\nexport * from './stringify';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,sDAAoC;AACpC,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,0CAAwB;AACxB,iDAA+B;AAC/B,wDAAsC;AACtC,8CAA4B","sourcesContent":["export * from './consts';\nexport * from './cooldown-interval';\nexport * from './network';\nexport * from './number';\nexport * from './retry';\nexport * from './timestamp';\nexport * from './token';\nexport * from './task-wrapper';\nexport * from './whitelisted-wallets';\nexport * from './stringify';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/common",
3
- "version": "0.242.0",
3
+ "version": "0.243.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -44,5 +44,5 @@
44
44
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
45
45
  },
46
46
  "packageManager": "pnpm@8.3.1",
47
- "gitHead": "87a2fb9eb2d0f992ab9ba89eceed85554f62a378"
47
+ "gitHead": "c8491b85be7a2d1eb8d874dce8f2a755eeb98282"
48
48
  }
@@ -0,0 +1,21 @@
1
+ export class CooldownInterval {
2
+ private readonly cooldownIntervalMS;
3
+ private lastExecutionTimeMS: number | null;
4
+
5
+ constructor(cooldownIntervalMS: number) {
6
+ this.cooldownIntervalMS = cooldownIntervalMS;
7
+ this.lastExecutionTimeMS = null;
8
+ }
9
+
10
+ public isCooldownPeriodOver(): boolean {
11
+ if (this.lastExecutionTimeMS === null || this.cooldownIntervalMS === 0) {
12
+ return true;
13
+ }
14
+
15
+ return this.lastExecutionTimeMS + this.cooldownIntervalMS <= Date.now();
16
+ }
17
+
18
+ public reset(): void {
19
+ this.lastExecutionTimeMS = Date.now();
20
+ }
21
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './consts';
2
+ export * from './cooldown-interval';
2
3
  export * from './network';
3
4
  export * from './number';
4
5
  export * from './retry';