@dynamic-labs/utils 1.0.3 → 1.0.5

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,22 @@
1
1
 
2
+ ### [1.0.5](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.4...v1.0.5) (2024-01-10)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * trigger onAuthSuccess before embedded wallet creation ([eff7166](https://github.com/dynamic-labs/DynamicAuth/commit/eff7166902e851e726d5ee7a6bf51f9a9a85dba1))
8
+ * turnkeyWalletConnector is not an email otp connector and uses dynamic otp ([#4314](https://github.com/dynamic-labs/DynamicAuth/issues/4314)) ([446b536](https://github.com/dynamic-labs/DynamicAuth/commit/446b536c83ab2ff9d2bc727047dd2ff2601fa2a6))
9
+
10
+ ### [1.0.4](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.3...v1.0.4) (2024-01-04)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * edge case with unlinking wallet ([#4285](https://github.com/dynamic-labs/DynamicAuth/issues/4285)) ([#4293](https://github.com/dynamic-labs/DynamicAuth/issues/4293)) ([85eb4ea](https://github.com/dynamic-labs/DynamicAuth/commit/85eb4ea0fa4521d37ee3901dbb1fa6d88a8cf8f7))
16
+ * phantom solana not connecting on mobile ([#4287](https://github.com/dynamic-labs/DynamicAuth/issues/4287)) ([0d85e24](https://github.com/dynamic-labs/DynamicAuth/commit/0d85e2429f2dc0a92c293cf57dc0e241c4b948be))
17
+ * prevent error message when mobile wallet app is open ([#4301](https://github.com/dynamic-labs/DynamicAuth/issues/4301)) ([#4303](https://github.com/dynamic-labs/DynamicAuth/issues/4303)) ([0ba145e](https://github.com/dynamic-labs/DynamicAuth/commit/0ba145e6d1145fecc3e7bc2e60d127106be9aa54))
18
+ * **useFetchBalance:** ensure the latest wallet balance is fetched ([#4288](https://github.com/dynamic-labs/DynamicAuth/issues/4288)) ([#4294](https://github.com/dynamic-labs/DynamicAuth/issues/4294)) ([3fa0d60](https://github.com/dynamic-labs/DynamicAuth/commit/3fa0d60552082dffd032317368d20b87cdab9c6d))
19
+
2
20
  ### [1.0.3](https://github.com/dynamic-labs/DynamicAuth/compare/v1.0.2...v1.0.3) (2023-12-28)
3
21
 
4
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -29,7 +29,7 @@
29
29
  "viem": "^1.19.13"
30
30
  },
31
31
  "dependencies": {
32
- "@dynamic-labs/logger": "1.0.3",
33
- "@dynamic-labs/types": "1.0.3"
32
+ "@dynamic-labs/logger": "1.0.5",
33
+ "@dynamic-labs/types": "1.0.5"
34
34
  }
35
35
  }
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class MissingPublicAddressError extends DynamicError.DynamicError {
8
+ constructor() {
9
+ super('Missing public address', 'missing-public-address');
10
+ }
11
+ }
12
+
13
+ exports.MissingPublicAddressError = MissingPublicAddressError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class MissingPublicAddressError extends DynamicError {
3
+ constructor();
4
+ }
@@ -0,0 +1,9 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class MissingPublicAddressError extends DynamicError {
4
+ constructor() {
5
+ super('Missing public address', 'missing-public-address');
6
+ }
7
+ }
8
+
9
+ export { MissingPublicAddressError };
@@ -17,3 +17,4 @@ export * from './SocialAccountAlreadyExistsError';
17
17
  export * from './TransactionGasCannotBeSponsoredError';
18
18
  export * from './InsufficientFundsError';
19
19
  export * from './PasskeyError';
20
+ export * from './MissingPublicAddressError';
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('../errors/TransactionGasCannotBeSponsoredError.cjs');
6
+ require('../errors/InsufficientFundsError.cjs');
7
+ require('../logger/logger.cjs');
8
+ var isMobile = require('../isMobile.cjs');
9
+ require('viem/chains');
10
+
11
+ const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
12
+ const url = encodeURIComponent(window.location.toString());
13
+ const ref = encodeURIComponent(window.location.origin);
14
+ // samsung browser only supports native links, not universal links
15
+ if (isMobile.isSamsungBrowser()) {
16
+ window.location.assign(`${nativeLink}/${url}?ref=${ref}`);
17
+ }
18
+ else {
19
+ window.location.assign(`${universalLink}/${url}?ref=${ref}`);
20
+ }
21
+ };
22
+
23
+ exports.handleMobileWalletRedirect = handleMobileWalletRedirect;
@@ -0,0 +1,4 @@
1
+ export declare const handleMobileWalletRedirect: ({ nativeLink, universalLink, }: {
2
+ nativeLink: string;
3
+ universalLink: string;
4
+ }) => void;
@@ -0,0 +1,19 @@
1
+ import '../errors/TransactionGasCannotBeSponsoredError.js';
2
+ import '../errors/InsufficientFundsError.js';
3
+ import '../logger/logger.js';
4
+ import { isSamsungBrowser } from '../isMobile.js';
5
+ import 'viem/chains';
6
+
7
+ const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
8
+ const url = encodeURIComponent(window.location.toString());
9
+ const ref = encodeURIComponent(window.location.origin);
10
+ // samsung browser only supports native links, not universal links
11
+ if (isSamsungBrowser()) {
12
+ window.location.assign(`${nativeLink}/${url}?ref=${ref}`);
13
+ }
14
+ else {
15
+ window.location.assign(`${universalLink}/${url}?ref=${ref}`);
16
+ }
17
+ };
18
+
19
+ export { handleMobileWalletRedirect };
@@ -0,0 +1 @@
1
+ export * from './handleMobileWalletRedirect';
package/src/index.cjs CHANGED
@@ -22,6 +22,7 @@ var UserHasAccountWithEmailError = require('./errors/UserHasAccountWithEmailErro
22
22
  var SocialAccountAlreadyExistsError = require('./errors/SocialAccountAlreadyExistsError.cjs');
23
23
  var TransactionGasCannotBeSponsoredError = require('./errors/TransactionGasCannotBeSponsoredError.cjs');
24
24
  var InsufficientFundsError = require('./errors/InsufficientFundsError.cjs');
25
+ var MissingPublicAddressError = require('./errors/MissingPublicAddressError.cjs');
25
26
  var CancellablePromise = require('./CancellablePromise/CancellablePromise.cjs');
26
27
  var isFunction = require('./isFunction/isFunction.cjs');
27
28
  var isMobile = require('./isMobile.cjs');
@@ -34,6 +35,7 @@ var getOrMapViemChain = require('./getOrMapViemChain.cjs');
34
35
  var retryableFn = require('./retryableFn.cjs');
35
36
  var wrapMethodWithCallback = require('./wrapMethodWithCallback/wrapMethodWithCallback.cjs');
36
37
  var DeferredPromise = require('./DeferredPromise/DeferredPromise.cjs');
38
+ var handleMobileWalletRedirect = require('./handleMobileWalletRedirect/handleMobileWalletRedirect.cjs');
37
39
 
38
40
 
39
41
 
@@ -57,6 +59,7 @@ exports.UserHasAccountWithEmailError = UserHasAccountWithEmailError.UserHasAccou
57
59
  exports.SocialAccountAlreadyExistsError = SocialAccountAlreadyExistsError.SocialAccountAlreadyExistsError;
58
60
  exports.TransactionGasCannotBeSponsoredError = TransactionGasCannotBeSponsoredError.TransactionGasCannotBeSponsoredError;
59
61
  exports.InsufficientFundsError = InsufficientFundsError.InsufficientFundsError;
62
+ exports.MissingPublicAddressError = MissingPublicAddressError.MissingPublicAddressError;
60
63
  exports.CancellablePromise = CancellablePromise.CancellablePromise;
61
64
  exports.isFunction = isFunction.isFunction;
62
65
  exports.getAndroidVersion = isMobile.getAndroidVersion;
@@ -83,3 +86,4 @@ exports.FALLBACK_UNDEFINED = retryableFn.FALLBACK_UNDEFINED;
83
86
  exports.retryableFn = retryableFn.retryableFn;
84
87
  exports.wrapMethodWithCallback = wrapMethodWithCallback.wrapMethodWithCallback;
85
88
  exports.DeferredPromise = DeferredPromise.DeferredPromise;
89
+ exports.handleMobileWalletRedirect = handleMobileWalletRedirect.handleMobileWalletRedirect;
package/src/index.d.ts CHANGED
@@ -13,3 +13,4 @@ export * from './getOrMapViemChain';
13
13
  export * from './retryableFn';
14
14
  export * from './wrapMethodWithCallback';
15
15
  export * from './DeferredPromise';
16
+ export * from './handleMobileWalletRedirect';
package/src/index.js CHANGED
@@ -18,6 +18,7 @@ export { UserHasAccountWithEmailError } from './errors/UserHasAccountWithEmailEr
18
18
  export { SocialAccountAlreadyExistsError } from './errors/SocialAccountAlreadyExistsError.js';
19
19
  export { TransactionGasCannotBeSponsoredError } from './errors/TransactionGasCannotBeSponsoredError.js';
20
20
  export { InsufficientFundsError } from './errors/InsufficientFundsError.js';
21
+ export { MissingPublicAddressError } from './errors/MissingPublicAddressError.js';
21
22
  export { CancellablePromise } from './CancellablePromise/CancellablePromise.js';
22
23
  export { isFunction } from './isFunction/isFunction.js';
23
24
  export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSamsungBrowser, isWindows } from './isMobile.js';
@@ -30,3 +31,4 @@ export { getChain, getOrMapViemChain, mapChain } from './getOrMapViemChain.js';
30
31
  export { FALLBACK_UNDEFINED, retryableFn } from './retryableFn.js';
31
32
  export { wrapMethodWithCallback } from './wrapMethodWithCallback/wrapMethodWithCallback.js';
32
33
  export { DeferredPromise } from './DeferredPromise/DeferredPromise.js';
34
+ export { handleMobileWalletRedirect } from './handleMobileWalletRedirect/handleMobileWalletRedirect.js';