@dynamic-labs/utils 3.0.0-alpha.5 → 3.0.0-alpha.7

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,44 @@
1
1
 
2
+ ## [3.0.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.6...v3.0.0-alpha.7) (2024-06-19)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * add selectedTabIndex and helpers (#6040)
8
+
9
+ ### Features
10
+
11
+ * add selectedTabIndex and helpers ([#6040](https://github.com/dynamic-labs/DynamicAuth/issues/6040)) ([ae20b80](https://github.com/dynamic-labs/DynamicAuth/commit/ae20b8081376dce97b18fa69c81c9ab73c1ff317))
12
+ * add useRefreshUser to trigger a user state refresh ([#6079](https://github.com/dynamic-labs/DynamicAuth/issues/6079)) ([1236d35](https://github.com/dynamic-labs/DynamicAuth/commit/1236d35fe9fab44ed2114ad9f3c8c6dca7ec27be))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * always return userWallets when available ([#6080](https://github.com/dynamic-labs/DynamicAuth/issues/6080)) ([#6083](https://github.com/dynamic-labs/DynamicAuth/issues/6083)) ([11992d2](https://github.com/dynamic-labs/DynamicAuth/commit/11992d2af5a401ba4ff1dc6904e2a9f8ef5904ca))
18
+ * less solana rpc calls and improve fee fetching ([#6019](https://github.com/dynamic-labs/DynamicAuth/issues/6019)) ([e2609db](https://github.com/dynamic-labs/DynamicAuth/commit/e2609db962c7708ff5b127cb23260a25bc5032e3))
19
+ * make account change idemopotent ([#6061](https://github.com/dynamic-labs/DynamicAuth/issues/6061)) ([8c87513](https://github.com/dynamic-labs/DynamicAuth/commit/8c8751390ea14888c4889679895e2f06d75717b9))
20
+ * only run multi wallet prompt when user profile or auth flow are open ([#6073](https://github.com/dynamic-labs/DynamicAuth/issues/6073)) ([d48ca10](https://github.com/dynamic-labs/DynamicAuth/commit/d48ca105359018457a78588fd8d9aa8a91583a02))
21
+ * recompute multiwallet state after merging accounts ([#6078](https://github.com/dynamic-labs/DynamicAuth/issues/6078)) ([e08a274](https://github.com/dynamic-labs/DynamicAuth/commit/e08a274c4d848f2a8360be7106cfbfa00b9a8f9b))
22
+ * stop querying okx for accounts while locked ([#6081](https://github.com/dynamic-labs/DynamicAuth/issues/6081)) ([#6084](https://github.com/dynamic-labs/DynamicAuth/issues/6084)) ([34365ac](https://github.com/dynamic-labs/DynamicAuth/commit/34365ac1981fe020b03e666c24535a247645d2ad))
23
+ * update copy for primary wallet not connected modal ([#6069](https://github.com/dynamic-labs/DynamicAuth/issues/6069)) ([4a3f43c](https://github.com/dynamic-labs/DynamicAuth/commit/4a3f43ce5585983f7fea0c5b97e812c0ade80e2c))
24
+
25
+ ## [3.0.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.5...v3.0.0-alpha.6) (2024-06-18)
26
+
27
+
28
+ ### Features
29
+
30
+ * implement useExternalAuth hook to signin using external jwt auth ([#6039](https://github.com/dynamic-labs/DynamicAuth/issues/6039)) ([ba90908](https://github.com/dynamic-labs/DynamicAuth/commit/ba90908509ec21f708a4a0782a7f94861fc3b484))
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * allow sign-in with different ME BTC wallet after initial connection ([a527b46](https://github.com/dynamic-labs/DynamicAuth/commit/a527b464f321b4fc27730f57c3812e996b5ed878))
36
+ * close sign modal when signing in with a wallet when embedded wallet is enabled ([#6013](https://github.com/dynamic-labs/DynamicAuth/issues/6013)) ([0f4f3c8](https://github.com/dynamic-labs/DynamicAuth/commit/0f4f3c83db162f7a1794a3549b60bbad6b03e2c0))
37
+ * custom network without a valid icon should still display its name in network picker ([#6018](https://github.com/dynamic-labs/DynamicAuth/issues/6018)) ([0b10df6](https://github.com/dynamic-labs/DynamicAuth/commit/0b10df68950bfc9b8492443158a6bb030dc1122c))
38
+ * e2e: remove page pause ([#6045](https://github.com/dynamic-labs/DynamicAuth/issues/6045)) ([55bba00](https://github.com/dynamic-labs/DynamicAuth/commit/55bba0034255055d6ae266b1296542f47ed48e2b))
39
+ * more fixes for connect starknet button ([#6046](https://github.com/dynamic-labs/DynamicAuth/issues/6046)) ([0fb570a](https://github.com/dynamic-labs/DynamicAuth/commit/0fb570a44e65f8dd6d4d2bf5edb2ee54985ec9d4))
40
+ * set verified credentials on embedded wallet creation ([#6044](https://github.com/dynamic-labs/DynamicAuth/issues/6044)) ([b52a96d](https://github.com/dynamic-labs/DynamicAuth/commit/b52a96d321e7efdb30dce9cdb3f6f176c24ceb81))
41
+
2
42
  ## [3.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.4...v3.0.0-alpha.5) (2024-06-14)
3
43
 
4
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "3.0.0-alpha.5",
3
+ "version": "3.0.0-alpha.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -26,11 +26,12 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
- "@dynamic-labs/sdk-api-core": "0.0.461",
29
+ "@dynamic-labs/sdk-api-core": "0.0.470",
30
30
  "tldts": "6.0.16",
31
- "@dynamic-labs/logger": "3.0.0-alpha.5",
32
- "@dynamic-labs/types": "3.0.0-alpha.5",
33
- "buffer": "6.0.3"
31
+ "@dynamic-labs/logger": "3.0.0-alpha.7",
32
+ "@dynamic-labs/types": "3.0.0-alpha.7",
33
+ "buffer": "6.0.3",
34
+ "stream": "0.0.2"
34
35
  },
35
36
  "peerDependencies": {}
36
37
  }
@@ -0,0 +1,40 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const isEip9693Event = (event) => event.type === 'eip6963:announceProvider' &&
7
+ event.detail !== undefined;
8
+ class Eip6963Provider {
9
+ constructor() {
10
+ this.providers = [];
11
+ }
12
+ registerProviders() {
13
+ if (typeof window === 'undefined') {
14
+ return;
15
+ }
16
+ window.addEventListener('eip6963:announceProvider', (event) => {
17
+ if (!isEip9693Event(event)) {
18
+ return;
19
+ }
20
+ this.providers.push(event.detail);
21
+ });
22
+ window.dispatchEvent(new Event('eip6963:requestProvider'));
23
+ }
24
+ }
25
+ class Eip6963ProviderSingleton {
26
+ constructor() {
27
+ this.eip6963Provider = new Eip6963Provider();
28
+ }
29
+ static get() {
30
+ var _a;
31
+ if (!((_a = Eip6963ProviderSingleton.instance) === null || _a === void 0 ? void 0 : _a.eip6963Provider)) {
32
+ Eip6963ProviderSingleton.instance = new Eip6963ProviderSingleton();
33
+ Eip6963ProviderSingleton.instance.eip6963Provider.registerProviders();
34
+ }
35
+ return Eip6963ProviderSingleton.instance.eip6963Provider;
36
+ }
37
+ }
38
+
39
+ exports.Eip6963Provider = Eip6963Provider;
40
+ exports.Eip6963ProviderSingleton = Eip6963ProviderSingleton;
@@ -0,0 +1,34 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { EventEmitter } from 'stream';
4
+ export type IEthereum = {
5
+ [key: string]: any;
6
+ providers?: object[];
7
+ request: <T extends string>(params: {
8
+ method: T;
9
+ } | object) => Promise<T extends 'eth_requestAccounts' ? [string] : object>;
10
+ } & EventEmitter;
11
+ /**
12
+ * Represents the assets needed to display a wallet
13
+ */
14
+ type Eip6963ProviderInfo = {
15
+ uuid: string;
16
+ name: string;
17
+ icon: string;
18
+ rdns: string;
19
+ };
20
+ type Eip6963ProviderDetail = {
21
+ info: Eip6963ProviderInfo;
22
+ provider: IEthereum;
23
+ };
24
+ export declare class Eip6963Provider {
25
+ providers: Eip6963ProviderDetail[];
26
+ registerProviders(): void;
27
+ }
28
+ export declare class Eip6963ProviderSingleton {
29
+ readonly eip6963Provider: Eip6963Provider;
30
+ private constructor();
31
+ private static instance;
32
+ static get(): Eip6963Provider;
33
+ }
34
+ export {};
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+ const isEip9693Event = (event) => event.type === 'eip6963:announceProvider' &&
3
+ event.detail !== undefined;
4
+ class Eip6963Provider {
5
+ constructor() {
6
+ this.providers = [];
7
+ }
8
+ registerProviders() {
9
+ if (typeof window === 'undefined') {
10
+ return;
11
+ }
12
+ window.addEventListener('eip6963:announceProvider', (event) => {
13
+ if (!isEip9693Event(event)) {
14
+ return;
15
+ }
16
+ this.providers.push(event.detail);
17
+ });
18
+ window.dispatchEvent(new Event('eip6963:requestProvider'));
19
+ }
20
+ }
21
+ class Eip6963ProviderSingleton {
22
+ constructor() {
23
+ this.eip6963Provider = new Eip6963Provider();
24
+ }
25
+ static get() {
26
+ var _a;
27
+ if (!((_a = Eip6963ProviderSingleton.instance) === null || _a === void 0 ? void 0 : _a.eip6963Provider)) {
28
+ Eip6963ProviderSingleton.instance = new Eip6963ProviderSingleton();
29
+ Eip6963ProviderSingleton.instance.eip6963Provider.registerProviders();
30
+ }
31
+ return Eip6963ProviderSingleton.instance.eip6963Provider;
32
+ }
33
+ }
34
+
35
+ export { Eip6963Provider, Eip6963ProviderSingleton };
@@ -0,0 +1 @@
1
+ export * from './eip6963Provider';
@@ -0,0 +1,14 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var DynamicError = require('./DynamicError.cjs');
7
+
8
+ class ExternalAuthError extends DynamicError.DynamicError {
9
+ constructor(code) {
10
+ super('ExternalAuthError', code);
11
+ }
12
+ }
13
+
14
+ exports.ExternalAuthError = ExternalAuthError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class ExternalAuthError extends DynamicError {
3
+ constructor(code: string);
4
+ }
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ import { DynamicError } from './DynamicError.js';
3
+
4
+ class ExternalAuthError extends DynamicError {
5
+ constructor(code) {
6
+ super('ExternalAuthError', code);
7
+ }
8
+ }
9
+
10
+ export { ExternalAuthError };
@@ -29,3 +29,4 @@ export * from './CookieInvalidError';
29
29
  export * from './AccessBlockedError';
30
30
  export * from './EmbeddedWalletException';
31
31
  export * from './MfaInvalidOtpError';
32
+ export * from './ExternalAuthError';
package/src/index.cjs CHANGED
@@ -35,6 +35,7 @@ var CookieInvalidError = require('./errors/CookieInvalidError.cjs');
35
35
  var AccessBlockedError = require('./errors/AccessBlockedError.cjs');
36
36
  var EmbeddedWalletException = require('./errors/EmbeddedWalletException.cjs');
37
37
  var MfaInvalidOtpError = require('./errors/MfaInvalidOtpError.cjs');
38
+ var ExternalAuthError = require('./errors/ExternalAuthError.cjs');
38
39
  var CancellablePromise = require('./CancellablePromise/CancellablePromise.cjs');
39
40
  var isFunction = require('./isFunction/isFunction.cjs');
40
41
  var isMobile = require('./isMobile.cjs');
@@ -54,6 +55,7 @@ var formatNumberText = require('./formatNumberText/formatNumberText.cjs');
54
55
  var ceil = require('./ceil/ceil.cjs');
55
56
  var trimEnd = require('./trimEnd/trimEnd.cjs');
56
57
  var isLedgerAddressViaVerifiedCredentials = require('./isLedgerAddressViaVerifiedCredentials.cjs');
58
+ var eip6963Provider = require('./eip6963/eip6963Provider.cjs');
57
59
  var runSafe = require('./runSafe/runSafe.cjs');
58
60
  var PlatformService = require('./services/PlatformService/PlatformService.cjs');
59
61
  var createBrowserPlatformService = require('./services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs');
@@ -97,6 +99,7 @@ exports.CookieInvalidError = CookieInvalidError.CookieInvalidError;
97
99
  exports.AccessBlockedError = AccessBlockedError.AccessBlockedError;
98
100
  exports.EmbeddedWalletException = EmbeddedWalletException.EmbeddedWalletException;
99
101
  exports.MfaInvalidOtpError = MfaInvalidOtpError.MfaInvalidOtpError;
102
+ exports.ExternalAuthError = ExternalAuthError.ExternalAuthError;
100
103
  exports.CancellablePromise = CancellablePromise.CancellablePromise;
101
104
  exports.isFunction = isFunction.isFunction;
102
105
  exports.getAndroidVersion = isMobile.getAndroidVersion;
@@ -128,6 +131,8 @@ exports.formatNumberText = formatNumberText.formatNumberText;
128
131
  exports.ceil = ceil.ceil;
129
132
  exports.trimEnd = trimEnd.trimEnd;
130
133
  exports.isLedgerAddressViaVerifiedCredentials = isLedgerAddressViaVerifiedCredentials.isLedgerAddressViaVerifiedCredentials;
134
+ exports.Eip6963Provider = eip6963Provider.Eip6963Provider;
135
+ exports.Eip6963ProviderSingleton = eip6963Provider.Eip6963ProviderSingleton;
131
136
  exports.runSafe = runSafe.runSafe;
132
137
  exports.PlatformService = PlatformService.PlatformService;
133
138
  exports.createBrowserPlatformService = createBrowserPlatformService.createBrowserPlatformService;
package/src/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export * from './formatNumberText';
20
20
  export * from './ceil';
21
21
  export * from './trimEnd';
22
22
  export * from './isLedgerAddressViaVerifiedCredentials';
23
+ export * from './eip6963';
23
24
  export { runSafe } from './runSafe';
24
25
  export { PlatformService, createBrowserPlatformService, type IPlatformService, } from './services/PlatformService';
25
26
  export { FetchService } from './services/FetchService';
package/src/index.js CHANGED
@@ -31,6 +31,7 @@ export { CookieInvalidError } from './errors/CookieInvalidError.js';
31
31
  export { AccessBlockedError } from './errors/AccessBlockedError.js';
32
32
  export { EmbeddedWalletException } from './errors/EmbeddedWalletException.js';
33
33
  export { MfaInvalidOtpError } from './errors/MfaInvalidOtpError.js';
34
+ export { ExternalAuthError } from './errors/ExternalAuthError.js';
34
35
  export { CancellablePromise } from './CancellablePromise/CancellablePromise.js';
35
36
  export { isFunction } from './isFunction/isFunction.js';
36
37
  export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSamsungBrowser, isWindows } from './isMobile.js';
@@ -50,6 +51,7 @@ export { formatNumberText } from './formatNumberText/formatNumberText.js';
50
51
  export { ceil } from './ceil/ceil.js';
51
52
  export { trimEnd } from './trimEnd/trimEnd.js';
52
53
  export { isLedgerAddressViaVerifiedCredentials } from './isLedgerAddressViaVerifiedCredentials.js';
54
+ export { Eip6963Provider, Eip6963ProviderSingleton } from './eip6963/eip6963Provider.js';
53
55
  export { runSafe } from './runSafe/runSafe.js';
54
56
  export { PlatformService } from './services/PlatformService/PlatformService.js';
55
57
  export { createBrowserPlatformService } from './services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js';