@dynamic-labs/utils 4.0.0-alpha.26 → 4.0.0-alpha.27

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/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ## [4.0.0-alpha.27](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.26...v4.0.0-alpha.27) (2024-11-06)
3
+
4
+
5
+ ### Features
6
+
7
+ * allows adding connection configuration for solana connectors ([#7354](https://github.com/dynamic-labs/dynamic-auth/issues/7354)) ([01e35ee](https://github.com/dynamic-labs/dynamic-auth/commit/01e35ee5bfe4605df48e4188a753111efe483048))
8
+ * allows passing solana connection config to dynamic client ([#7357](https://github.com/dynamic-labs/dynamic-auth/issues/7357)) ([6da14ce](https://github.com/dynamic-labs/dynamic-auth/commit/6da14ceb481147aea31d192fe268be43a8af80e9))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * check legacy vs eip1599 tx in global connectivity ([#7341](https://github.com/dynamic-labs/dynamic-auth/issues/7341)) ([b223ea7](https://github.com/dynamic-labs/dynamic-auth/commit/b223ea7a5ed5637e11da1040c631c48bc23ba76d))
14
+ * global connectivity multiple transactions in a row ([#7342](https://github.com/dynamic-labs/dynamic-auth/issues/7342)) ([d13c1af](https://github.com/dynamic-labs/dynamic-auth/commit/d13c1afec6b3680961621d8317f55549b3ed428f))
15
+
2
16
  ## [4.0.0-alpha.26](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.25...v4.0.0-alpha.26) (2024-11-04)
3
17
 
4
18
  ## [4.0.0-alpha.25](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.24...v4.0.0-alpha.25) (2024-11-01)
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.0.0-alpha.26";
6
+ var version = "4.0.0-alpha.27";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.0.0-alpha.26";
2
+ var version = "4.0.0-alpha.27";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "4.0.0-alpha.26",
3
+ "version": "4.0.0-alpha.27",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@dynamic-labs/sdk-api-core": "0.0.559",
22
22
  "tldts": "6.0.16",
23
- "@dynamic-labs/assert-package-version": "4.0.0-alpha.26",
24
- "@dynamic-labs/logger": "4.0.0-alpha.26",
25
- "@dynamic-labs/types": "4.0.0-alpha.26",
23
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.27",
24
+ "@dynamic-labs/logger": "4.0.0-alpha.27",
25
+ "@dynamic-labs/types": "4.0.0-alpha.27",
26
26
  "buffer": "6.0.3",
27
27
  "eventemitter3": "5.0.1"
28
28
  },
@@ -0,0 +1,41 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * The EventTimeline is a utility that allows you to track the timeline of events
8
+ * that occur in your application. It is useful to post events and query when
9
+ * some event was last fired.
10
+ */
11
+ const createEventTimeline = () => {
12
+ // Map to store event names and their corresponding timestamps
13
+ const eventTimelines = new Map();
14
+ return {
15
+ clear: () => {
16
+ eventTimelines.clear();
17
+ },
18
+ isEventRecent: (eventName, timeSince) => {
19
+ const now = Date.now();
20
+ let timestamps = eventTimelines.get(eventName);
21
+ if (!timestamps) {
22
+ return false;
23
+ }
24
+ const cutoff = now - timeSince;
25
+ // Remove timestamps older than the cutoff time
26
+ timestamps = timestamps.filter((timestamp) => timestamp >= cutoff);
27
+ // Check if there are any timestamps within the timeframe
28
+ return timestamps.length > 0;
29
+ },
30
+ postEvent: (event) => {
31
+ var _a;
32
+ const now = Date.now();
33
+ if (!eventTimelines.has(event)) {
34
+ eventTimelines.set(event, []);
35
+ }
36
+ (_a = eventTimelines.get(event)) === null || _a === void 0 ? void 0 : _a.push(now);
37
+ },
38
+ };
39
+ };
40
+
41
+ exports.createEventTimeline = createEventTimeline;
@@ -0,0 +1,18 @@
1
+ export type EventTimeline<T extends string> = {
2
+ clear: () => void;
3
+ postEvent: (event: T) => void;
4
+ /**
5
+ * Checks if a specific event was fired within the given timeframe relative to the current time.
6
+ *
7
+ * @param {string} eventName - The name of the event to check.
8
+ * @param {number} timeSince - The timeframe in milliseconds.
9
+ * @returns {boolean} - Returns `true` if the event was fired within the given timeframe, otherwise `false`.
10
+ */
11
+ isEventRecent: (eventName: T, timeSince: number) => boolean;
12
+ };
13
+ /**
14
+ * The EventTimeline is a utility that allows you to track the timeline of events
15
+ * that occur in your application. It is useful to post events and query when
16
+ * some event was last fired.
17
+ */
18
+ export declare const createEventTimeline: <T extends string>() => EventTimeline<T>;
@@ -0,0 +1,37 @@
1
+ 'use client'
2
+ /**
3
+ * The EventTimeline is a utility that allows you to track the timeline of events
4
+ * that occur in your application. It is useful to post events and query when
5
+ * some event was last fired.
6
+ */
7
+ const createEventTimeline = () => {
8
+ // Map to store event names and their corresponding timestamps
9
+ const eventTimelines = new Map();
10
+ return {
11
+ clear: () => {
12
+ eventTimelines.clear();
13
+ },
14
+ isEventRecent: (eventName, timeSince) => {
15
+ const now = Date.now();
16
+ let timestamps = eventTimelines.get(eventName);
17
+ if (!timestamps) {
18
+ return false;
19
+ }
20
+ const cutoff = now - timeSince;
21
+ // Remove timestamps older than the cutoff time
22
+ timestamps = timestamps.filter((timestamp) => timestamp >= cutoff);
23
+ // Check if there are any timestamps within the timeframe
24
+ return timestamps.length > 0;
25
+ },
26
+ postEvent: (event) => {
27
+ var _a;
28
+ const now = Date.now();
29
+ if (!eventTimelines.has(event)) {
30
+ eventTimelines.set(event, []);
31
+ }
32
+ (_a = eventTimelines.get(event)) === null || _a === void 0 ? void 0 : _a.push(now);
33
+ },
34
+ };
35
+ };
36
+
37
+ export { createEventTimeline };
@@ -0,0 +1 @@
1
+ export { createEventTimeline, type EventTimeline } from './eventTimeline';
package/src/index.cjs CHANGED
@@ -64,6 +64,7 @@ var ceil = require('./ceil/ceil.cjs');
64
64
  var trimEnd = require('./trimEnd/trimEnd.cjs');
65
65
  var isLedgerAddressViaVerifiedCredentials = require('./isLedgerAddressViaVerifiedCredentials.cjs');
66
66
  var eip6963Provider = require('./eip6963/eip6963Provider.cjs');
67
+ var eventTimeline = require('./eventTimeline/eventTimeline.cjs');
67
68
  var runSafe = require('./runSafe/runSafe.cjs');
68
69
  var PlatformService = require('./services/PlatformService/PlatformService.cjs');
69
70
  var createBrowserPlatformService = require('./services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs');
@@ -158,6 +159,7 @@ exports.trimEnd = trimEnd.trimEnd;
158
159
  exports.isLedgerAddressViaVerifiedCredentials = isLedgerAddressViaVerifiedCredentials.isLedgerAddressViaVerifiedCredentials;
159
160
  exports.Eip6963Provider = eip6963Provider.Eip6963Provider;
160
161
  exports.Eip6963ProviderSingleton = eip6963Provider.Eip6963ProviderSingleton;
162
+ exports.createEventTimeline = eventTimeline.createEventTimeline;
161
163
  exports.runSafe = runSafe.runSafe;
162
164
  exports.PlatformService = PlatformService.PlatformService;
163
165
  exports.createBrowserPlatformService = createBrowserPlatformService.createBrowserPlatformService;
package/src/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export * from './ceil';
21
21
  export * from './trimEnd';
22
22
  export * from './isLedgerAddressViaVerifiedCredentials';
23
23
  export * from './eip6963';
24
+ export * from './eventTimeline';
24
25
  export { runSafe } from './runSafe';
25
26
  export { PlatformService, createBrowserPlatformService, type IPlatformService, } from './services/PlatformService';
26
27
  export { FetchService } from './services/FetchService';
package/src/index.js CHANGED
@@ -60,6 +60,7 @@ export { ceil } from './ceil/ceil.js';
60
60
  export { trimEnd } from './trimEnd/trimEnd.js';
61
61
  export { isLedgerAddressViaVerifiedCredentials } from './isLedgerAddressViaVerifiedCredentials.js';
62
62
  export { Eip6963Provider, Eip6963ProviderSingleton } from './eip6963/eip6963Provider.js';
63
+ export { createEventTimeline } from './eventTimeline/eventTimeline.js';
63
64
  export { runSafe } from './runSafe/runSafe.js';
64
65
  export { PlatformService } from './services/PlatformService/PlatformService.js';
65
66
  export { createBrowserPlatformService } from './services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js';