@dynamic-labs/utils 2.0.0-alpha.22 → 2.0.0-alpha.24

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,57 @@
1
1
 
2
+ ## [2.0.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2024-04-03)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * rename otp verification callbacks (#5180)
8
+ * remove deprecated isVerificationInProgress flag and setter (#5089)
9
+
10
+ ### Features
11
+
12
+ * allow creating embedded wallets even if user signs in with a wallet ([#5093](https://github.com/dynamic-labs/DynamicAuth/issues/5093)) ([ba2dd62](https://github.com/dynamic-labs/DynamicAuth/commit/ba2dd625e0a7bf35018cf8aac8e80bd23b4e3b0f))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * api unit test by removing api and sdk versions for assertion ([#5168](https://github.com/dynamic-labs/DynamicAuth/issues/5168)) ([6d3b8ad](https://github.com/dynamic-labs/DynamicAuth/commit/6d3b8adebe62a4f2a7878630384348b2c491d779))
18
+ * bug when phone input is empty ([#5139](https://github.com/dynamic-labs/DynamicAuth/issues/5139)) ([7155b63](https://github.com/dynamic-labs/DynamicAuth/commit/7155b63518d00ba807bc321c6740b341d0a8b82f))
19
+ * clear error message on otp resend for sms ([#5182](https://github.com/dynamic-labs/DynamicAuth/issues/5182)) ([f40b48c](https://github.com/dynamic-labs/DynamicAuth/commit/f40b48c7f58c8e3dfe73fb124d642c3b8f193cee))
20
+ * link farcaster account ([#5170](https://github.com/dynamic-labs/DynamicAuth/issues/5170)) ([10fe272](https://github.com/dynamic-labs/DynamicAuth/commit/10fe272247605b5f09385f063231e2c881399cc8))
21
+ * show correct otp message for sms verification failure ([#5177](https://github.com/dynamic-labs/DynamicAuth/issues/5177)) ([b3bcd76](https://github.com/dynamic-labs/DynamicAuth/commit/b3bcd7694047dac55ce37babb71684a418633f95))
22
+ * update wagmi connector id when wallet connector changes ([#5185](https://github.com/dynamic-labs/DynamicAuth/issues/5185)) ([14fb83a](https://github.com/dynamic-labs/DynamicAuth/commit/14fb83a22c8e39095b79cc9951cae3f00f4fca2f))
23
+
24
+
25
+ * remove deprecated isVerificationInProgress flag and setter ([#5089](https://github.com/dynamic-labs/DynamicAuth/issues/5089)) ([060fef7](https://github.com/dynamic-labs/DynamicAuth/commit/060fef70df0c497e7a9b6e67ad0bfafef52c2bbb))
26
+ * rename otp verification callbacks ([#5180](https://github.com/dynamic-labs/DynamicAuth/issues/5180)) ([a580eec](https://github.com/dynamic-labs/DynamicAuth/commit/a580eec02d15b46a25c01d5473e4db2db89937e2))
27
+
28
+ ## [2.0.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.22...v2.0.0-alpha.23) (2024-04-01)
29
+
30
+
31
+ ### ⚠ BREAKING CHANGES
32
+
33
+ * implement proper solana embedded wallet signer (#5092)
34
+ * prevent adding temporary wallet connection to userWallets (#5104)
35
+
36
+ ### Bug Fixes
37
+
38
+ * Multiple WC bug fixes ([#5142](https://github.com/dynamic-labs/DynamicAuth/issues/5142)) ([92236e6](https://github.com/dynamic-labs/DynamicAuth/commit/92236e6d74c28516403f6df79c539406ece3d6d0)) ([#5132](https://github.com/dynamic-labs/DynamicAuth/issues/5132)) ([99f564a](https://github.com/dynamic-labs/DynamicAuth/commit/99f564a39e35e28af0be2a03617f12aa19cbeb7f))
39
+
40
+ * Better handling of empty callback queue([#5147](https://github.com/dynamic-labs/DynamicAuth/issues/5147)) ([e2d6bf2](https://github.com/dynamic-labs/DynamicAuth/commit/e2d6bf2444ca01199796ead4136f34b81b6c9b61))
41
+
42
+ * multiple improvements to the wallet list ([#5112](https://github.com/dynamic-labs/DynamicAuth/issues/5112)) ([00eec5f](https://github.com/dynamic-labs/DynamicAuth/commit/00eec5fde70548c3d771260f3d86e5365e73878d))
43
+
44
+ * Improved scroll experience on ios ([#5152](https://github.com/dynamic-labs/DynamicAuth/issues/5152)) ([341704f](https://github.com/dynamic-labs/DynamicAuth/commit/341704f99cb6e06f253309f3a8afb1684bb8ae2a))
45
+
46
+ * better handling of multiwallet state([#5146](https://github.com/dynamic-labs/DynamicAuth/issues/5146)) ([403267b](https://github.com/dynamic-labs/DynamicAuth/commit/403267b3c268d648aba155e0b6fea31d7fdc1b56))
47
+
48
+ * show correct OTP error message ([#5135](https://github.com/dynamic-labs/DynamicAuth/issues/5135)) ([e7494ce](https://github.com/dynamic-labs/DynamicAuth/commit/e7494cee4a1b5132af91058cbcb2dae0b7eac44b))
49
+
50
+ * implement proper solana embedded wallet signer ([#5092](https://github.com/dynamic-labs/DynamicAuth/issues/5092)) ([7749b97](https://github.com/dynamic-labs/DynamicAuth/commit/7749b97db49fb9af8ae0668172f478e1f0c29665))
51
+
52
+ * prevent adding temporary wallet connection to userWallets ([#5104](https://github.com/dynamic-labs/DynamicAuth/issues/5104)) ([3c02b78](https://github.com/dynamic-labs/DynamicAuth/commit/3c02b781c997c63ff11a7f1c255b92d10962327f))
53
+
54
+
2
55
  ## [2.0.0-alpha.22](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.21...v2.0.0-alpha.22) (2024-03-27)
3
56
 
4
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "2.0.0-alpha.22",
3
+ "version": "2.0.0-alpha.24",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "tldts": "6.0.16",
30
- "@dynamic-labs/logger": "2.0.0-alpha.22",
31
- "@dynamic-labs/types": "2.0.0-alpha.22"
30
+ "@dynamic-labs/logger": "2.0.0-alpha.24",
31
+ "@dynamic-labs/types": "2.0.0-alpha.24"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "viem": "^2.7.6"
package/src/index.cjs CHANGED
@@ -47,6 +47,7 @@ var pipe = require('./pipe/pipe.cjs');
47
47
  var formatNumberText = require('./formatNumberText/formatNumberText.cjs');
48
48
  var ceil = require('./ceil/ceil.cjs');
49
49
  var trimEnd = require('./trimEnd/trimEnd.cjs');
50
+ var runSafe = require('./runSafe/runSafe.cjs');
50
51
 
51
52
 
52
53
 
@@ -109,3 +110,4 @@ exports.pipe = pipe.pipe;
109
110
  exports.formatNumberText = formatNumberText.formatNumberText;
110
111
  exports.ceil = ceil.ceil;
111
112
  exports.trimEnd = trimEnd.trimEnd;
113
+ exports.runSafe = runSafe.runSafe;
package/src/index.d.ts CHANGED
@@ -20,3 +20,4 @@ export * from './pipe';
20
20
  export * from './formatNumberText';
21
21
  export * from './ceil';
22
22
  export * from './trimEnd';
23
+ export { runSafe } from './runSafe';
package/src/index.js CHANGED
@@ -43,3 +43,4 @@ export { pipe } from './pipe/pipe.js';
43
43
  export { formatNumberText } from './formatNumberText/formatNumberText.js';
44
44
  export { ceil } from './ceil/ceil.js';
45
45
  export { trimEnd } from './trimEnd/trimEnd.js';
46
+ export { runSafe } from './runSafe/runSafe.js';
@@ -0,0 +1 @@
1
+ export { runSafe } from './runSafe';
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('../../_virtual/_tslib.cjs');
6
+
7
+ /**
8
+ * Safely executes a callback function.
9
+ * @template T The type of the callback's return value.
10
+ * @template E The type of the error.
11
+ * @param {() => Promise<T> | T} callback A function that might throw an error.
12
+ * @returns {Promise<[T | undefined, E | undefined]>} A tuple with either the result or the error.
13
+ */
14
+ const runSafe = (callback) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
15
+ try {
16
+ const resolved = yield callback();
17
+ return [resolved, undefined];
18
+ }
19
+ catch (error) {
20
+ return [undefined, error];
21
+ }
22
+ });
23
+
24
+ exports.runSafe = runSafe;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Safely executes a callback function.
3
+ * @template T The type of the callback's return value.
4
+ * @template E The type of the error.
5
+ * @param {() => Promise<T> | T} callback A function that might throw an error.
6
+ * @returns {Promise<[T | undefined, E | undefined]>} A tuple with either the result or the error.
7
+ */
8
+ export declare const runSafe: <T, E>(callback: () => T | Promise<T>) => Promise<[T | undefined, E | undefined]>;
@@ -0,0 +1,20 @@
1
+ import { __awaiter } from '../../_virtual/_tslib.js';
2
+
3
+ /**
4
+ * Safely executes a callback function.
5
+ * @template T The type of the callback's return value.
6
+ * @template E The type of the error.
7
+ * @param {() => Promise<T> | T} callback A function that might throw an error.
8
+ * @returns {Promise<[T | undefined, E | undefined]>} A tuple with either the result or the error.
9
+ */
10
+ const runSafe = (callback) => __awaiter(void 0, void 0, void 0, function* () {
11
+ try {
12
+ const resolved = yield callback();
13
+ return [resolved, undefined];
14
+ }
15
+ catch (error) {
16
+ return [undefined, error];
17
+ }
18
+ });
19
+
20
+ export { runSafe };