@dynamic-labs/wallet-book 4.0.0-alpha.1 → 4.0.0-alpha.11

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,127 @@
1
1
 
2
+ ## [4.0.0-alpha.11](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.10...v4.0.0-alpha.11) (2024-10-15)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * missing null check in property accessor ([#7122](https://github.com/dynamic-labs/dynamic-auth/issues/7122)) ([bbb5e76](https://github.com/dynamic-labs/dynamic-auth/commit/bbb5e76c1284edad2829605444dda24971027a57))
8
+
9
+ ## [4.0.0-alpha.10](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.9...v4.0.0-alpha.10) (2024-10-15)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * epicgames key name without dash ([#7119](https://github.com/dynamic-labs/dynamic-auth/issues/7119)) ([7388d6c](https://github.com/dynamic-labs/dynamic-auth/commit/7388d6cf98f6ee92e12003549dfd1ad81951119e))
15
+
16
+ ## [4.0.0-alpha.9](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.8...v4.0.0-alpha.9) (2024-10-11)
17
+
18
+
19
+ ### Features
20
+
21
+ * add support for fordefi wallet ([#7109](https://github.com/dynamic-labs/dynamic-auth/issues/7109)) ([1adb6b1](https://github.com/dynamic-labs/dynamic-auth/commit/1adb6b15b7f8e9156207ac7addf4368d27c1e371))
22
+ * support ability to define additional oauth scopes ([#7105](https://github.com/dynamic-labs/dynamic-auth/issues/7105)) ([b303203](https://github.com/dynamic-labs/dynamic-auth/commit/b303203e8041c0cbf5f8968df0d3cde04ed1b22a))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * add eip6963 for exodus evm ([#7094](https://github.com/dynamic-labs/dynamic-auth/issues/7094)) ([c1ec5ef](https://github.com/dynamic-labs/dynamic-auth/commit/c1ec5ef4b6a531c563be4b690aa5f2bd4e7e6a16))
28
+
29
+ ## [4.0.0-alpha.8](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.7...v4.0.0-alpha.8) (2024-10-07)
30
+
31
+
32
+ ### Features
33
+
34
+ * add support for dynamic event callbacks in rn ([#6997](https://github.com/dynamic-labs/dynamic-auth/issues/6997)) ([f9ac402](https://github.com/dynamic-labs/dynamic-auth/commit/f9ac40259d9168dfe69dafd5fd44478ba0e69505))
35
+ * add support for dynamic handlers in rn ([#7032](https://github.com/dynamic-labs/dynamic-auth/issues/7032)) ([f61f926](https://github.com/dynamic-labs/dynamic-auth/commit/f61f92666b6df8483dde2c47304fd4fb02690f7d))
36
+ * Support for multi-chain AA ([#6829](https://github.com/dynamic-labs/dynamic-auth/issues/6829)) ([b4a0c0a](https://github.com/dynamic-labs/dynamic-auth/commit/b4a0c0a4de48231a3748826600407c25abf6894d))
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * persist isHardwareWalletEnabled on wallet connector ([#7025](https://github.com/dynamic-labs/dynamic-auth/issues/7025)) ([#7034](https://github.com/dynamic-labs/dynamic-auth/issues/7034)) ([4bfc301](https://github.com/dynamic-labs/dynamic-auth/commit/4bfc301d891f10db8c0bd31e5164c489a882c5c3))
42
+
43
+ ## [4.0.0-alpha.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.6...v4.0.0-alpha.7) (2024-10-03)
44
+
45
+
46
+ ### Features
47
+
48
+ * add account abstraction module to client ([#7002](https://github.com/dynamic-labs/dynamic-auth/issues/7002)) ([2f06975](https://github.com/dynamic-labs/dynamic-auth/commit/2f06975083dfa9d40537ef4a99b414eda1a68e01))
49
+ * add support for wallet events in rn ([#7061](https://github.com/dynamic-labs/dynamic-auth/issues/7061)) ([c7c4ce5](https://github.com/dynamic-labs/dynamic-auth/commit/c7c4ce51f27a2b84a1710c120d7006a00920c1e7))
50
+ * add zerodev extension for react native ([#7028](https://github.com/dynamic-labs/dynamic-auth/issues/7028)) ([858b8a8](https://github.com/dynamic-labs/dynamic-auth/commit/858b8a851cfa0cddc8e4559541b03992cf5ccdfc))
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * do not modify sol tx blockhash as tx could have been signed already ([#7050](https://github.com/dynamic-labs/dynamic-auth/issues/7050)) ([770edb4](https://github.com/dynamic-labs/dynamic-auth/commit/770edb49ddc231b75fb45a9f6d563f22e5185df2))
56
+ * ensure the correct auth mode is used on social redirect ([#7047](https://github.com/dynamic-labs/dynamic-auth/issues/7047)) ([7c27172](https://github.com/dynamic-labs/dynamic-auth/commit/7c271721d5ddf19e3fd1bf56ddb1d49e0e2bca07))
57
+ * prevent react native message timeout before sdk is ready ([#7051](https://github.com/dynamic-labs/dynamic-auth/issues/7051)) ([6421237](https://github.com/dynamic-labs/dynamic-auth/commit/6421237d677d788b824d53432c1a75b9d571aa78))
58
+ * update version error text ([#7054](https://github.com/dynamic-labs/dynamic-auth/issues/7054)) ([713dacb](https://github.com/dynamic-labs/dynamic-auth/commit/713dacb79c2513323c2e6840d7418716011c2dcd))
59
+ * use project settings sdk network for send flow ([#7011](https://github.com/dynamic-labs/dynamic-auth/issues/7011)) ([983e796](https://github.com/dynamic-labs/dynamic-auth/commit/983e79632762f71ee0502c92057a32ea985ae19c))
60
+
61
+ ## [4.0.0-alpha.6](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.5...v4.0.0-alpha.6) (2024-10-01)
62
+
63
+
64
+ ### ⚠ BREAKING CHANGES
65
+
66
+ * remove support to magic ([#7033](https://github.com/dynamic-labs/dynamic-auth/issues/7033)) ([0fdc41f](https://github.com/dynamic-labs/dynamic-auth/commit/0fdc41f05f87b32f56b73db068f984f18bdf69a0))
67
+
68
+ ### Features
69
+
70
+ * global connectivity disconnect ([#7008](https://github.com/dynamic-labs/dynamic-auth/issues/7008)) ([80d705b](https://github.com/dynamic-labs/dynamic-auth/commit/80d705ba252aa3b01cbf4861507fed00e460215f))
71
+
72
+
73
+ ### Bug Fixes
74
+
75
+ * add popper context to send balance ([#7016](https://github.com/dynamic-labs/dynamic-auth/issues/7016)) ([73aa6f1](https://github.com/dynamic-labs/dynamic-auth/commit/73aa6f122afe0db660ebb654f3e018ae7bf445c5))
76
+ * add retry to useConnectWithOtp ([#7012](https://github.com/dynamic-labs/dynamic-auth/issues/7012)) ([d551d72](https://github.com/dynamic-labs/dynamic-auth/commit/d551d72a463f8a03964858b30ec174d41985a7b1))
77
+ * don't re-fetch wallet address on network change ([#7019](https://github.com/dynamic-labs/dynamic-auth/issues/7019)) ([4e7900c](https://github.com/dynamic-labs/dynamic-auth/commit/4e7900cc24b3abda736bc81466eda7512cf7fc61))
78
+ * fix sign message with solana wallet standard provider ([#7014](https://github.com/dynamic-labs/dynamic-auth/issues/7014)) ([ffaf972](https://github.com/dynamic-labs/dynamic-auth/commit/ffaf972e8b190b0b8cd0103e0ef67bfdee6c8f7c))
79
+ * update wallet reference when user switches wallet in connect-only ([#7030](https://github.com/dynamic-labs/dynamic-auth/issues/7030)) ([75d9aa6](https://github.com/dynamic-labs/dynamic-auth/commit/75d9aa66f63fc5536caeff12d8b860c0ba86106f))
80
+
81
+
82
+ ## [4.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.4...v4.0.0-alpha.5) (2024-09-25)
83
+
84
+
85
+ ### Features
86
+
87
+ * add isInstalledOnBrowser prop to wallet options in useWalletOptions ([#6976](https://github.com/dynamic-labs/DynamicAuth/issues/6976)) ([0fda409](https://github.com/dynamic-labs/DynamicAuth/commit/0fda409b293c83d73869d791c3d38ac421dcdecb))
88
+
89
+
90
+ ### Bug Fixes
91
+
92
+ * **client:** return user profile when using sign in with external jwt ([#7004](https://github.com/dynamic-labs/DynamicAuth/issues/7004)) ([927cfb6](https://github.com/dynamic-labs/DynamicAuth/commit/927cfb69f3dd7f8b00e3f0f975277a84c99c830b))
93
+ * react-native-extension to include esm ([#6965](https://github.com/dynamic-labs/DynamicAuth/issues/6965)) ([336825b](https://github.com/dynamic-labs/DynamicAuth/commit/336825b50142002bbc67c6f8850bd63030bf384b))
94
+
95
+ ## [4.0.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.3...v4.0.0-alpha.4) (2024-09-23)
96
+
97
+
98
+ ### Bug Fixes
99
+
100
+ * issue where builtin stream module was a dependency ([#6968](https://github.com/dynamic-labs/DynamicAuth/issues/6968)) ([0661129](https://github.com/dynamic-labs/DynamicAuth/commit/0661129920ba70ebbcd4d17ee5aa988c51d1b477))
101
+ * update in memory secure storage ([#6955](https://github.com/dynamic-labs/DynamicAuth/issues/6955)) ([697fc20](https://github.com/dynamic-labs/DynamicAuth/commit/697fc20740b243fa31ecf06e8b2ed9d09932a544))
102
+
103
+ ## [4.0.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.2...v4.0.0-alpha.3) (2024-09-20)
104
+
105
+
106
+ ### Features
107
+
108
+ * developers provide global connectivity appkit project id ([#6941](https://github.com/dynamic-labs/DynamicAuth/issues/6941)) ([83760ea](https://github.com/dynamic-labs/DynamicAuth/commit/83760ea57591685b12caee945f173f6a7f9312d1))
109
+
110
+
111
+ ### Bug Fixes
112
+
113
+ * don't try to set up event listeners if wallet provider doesn't support it ([#6943](https://github.com/dynamic-labs/DynamicAuth/issues/6943)) ([439f1bb](https://github.com/dynamic-labs/DynamicAuth/commit/439f1bbb3c765959756cfc6eeb8429e4018e0379))
114
+ * dont verify all signatures for solana embedded multisig tx ([#6953](https://github.com/dynamic-labs/DynamicAuth/issues/6953)) ([7a7973e](https://github.com/dynamic-labs/DynamicAuth/commit/7a7973e05f0960421b348a55c6a00c9fd873b0b7))
115
+
116
+ ## [4.0.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.1...v4.0.0-alpha.2) (2024-09-18)
117
+
118
+
119
+ ### Features
120
+
121
+ * add iconVariant prop to DynamicBridgeWidget ([#6915](https://github.com/dynamic-labs/DynamicAuth/issues/6915)) ([8aa0f3d](https://github.com/dynamic-labs/DynamicAuth/commit/8aa0f3d8d8c41c7b5c4796106f611f208010cb6d))
122
+ * allow to create extra embedded wallets in react-native ([#6923](https://github.com/dynamic-labs/DynamicAuth/issues/6923)) ([ba22f7b](https://github.com/dynamic-labs/DynamicAuth/commit/ba22f7bcf41a444a4df0aff9b6aec257457e9402))
123
+ * **client:** add hide method for auth and userProfile ui modules ([#6928](https://github.com/dynamic-labs/DynamicAuth/issues/6928)) ([a11a4a5](https://github.com/dynamic-labs/DynamicAuth/commit/a11a4a5d6e25ce2a916ebd52f0b341020dc1a7e5))
124
+
2
125
  ## [4.0.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.0...v4.0.0-alpha.1) (2024-09-17)
3
126
 
4
127
 
package/package.cjs ADDED
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var version = "4.0.0-alpha.11";
7
+
8
+ exports.version = version;
package/package.js ADDED
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ var version = "4.0.0-alpha.11";
3
+
4
+ export { version };
package/package.json CHANGED
@@ -1,15 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/wallet-book",
3
- "version": "4.0.0-alpha.1",
4
- "repository": {
5
- "type": "git",
6
- "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
7
- "directory": "packages/wallet-book"
8
- },
9
- "bugs": {
10
- "url": "https://github.com/dynamic-labs/DynamicAuth/issues"
11
- },
12
- "homepage": "https://github.com/dynamic-labs/DynamicAuth#readme",
3
+ "version": "4.0.0-alpha.11",
13
4
  "author": "Dynamic Labs, Inc.",
14
5
  "license": "MIT",
15
6
  "main": "./src/index.cjs",
@@ -26,11 +17,14 @@
26
17
  },
27
18
  "dependencies": {
28
19
  "zod": "3.22.4",
29
- "@dynamic-labs/iconic": "4.0.0-alpha.1",
30
- "@dynamic-labs/logger": "4.0.0-alpha.1",
31
- "@dynamic-labs/utils": "4.0.0-alpha.1",
20
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.11",
21
+ "@dynamic-labs/iconic": "4.0.0-alpha.11",
22
+ "@dynamic-labs/logger": "4.0.0-alpha.11",
23
+ "@dynamic-labs/utils": "4.0.0-alpha.11",
24
+ "eventemitter3": "5.0.1",
32
25
  "util": "0.12.5"
33
26
  },
27
+ "homepage": "https://www.dynamic.xyz/",
34
28
  "peerDependencies": {
35
29
  "react": "^18.0.0",
36
30
  "react-dom": "^18.0.0"
@@ -51,6 +51,22 @@ export declare const walletConnectOverrides: {
51
51
  };
52
52
  };
53
53
  };
54
+ fireblocks: {
55
+ brand: {
56
+ spriteId: {
57
+ action: string;
58
+ value: string;
59
+ };
60
+ };
61
+ };
62
+ flowwallet: {
63
+ brand: {
64
+ spriteId: {
65
+ action: string;
66
+ value: string;
67
+ };
68
+ };
69
+ };
54
70
  ledger: {
55
71
  mobile: {
56
72
  action: string;
@@ -0,0 +1,49 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../_virtual/_tslib.cjs');
7
+ var EventEmitter = require('eventemitter3');
8
+ var utils = require('@dynamic-labs/utils');
9
+ var walletBookFallbacks = require('../../../wallet-book-fallbacks.cjs');
10
+ var getWalletBookCdnUrl = require('../../helpers/getWalletBookCdnUrl.cjs');
11
+ var logger = require('../../helpers/logger.cjs');
12
+ var walletBookSchema = require('../../schemas/walletBookSchema.cjs');
13
+
14
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+
16
+ var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
17
+
18
+ const walletBookCache = { current: {} };
19
+ const walletBookEmitter = new EventEmitter__default["default"]();
20
+ const fetchWalletBook = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
21
+ const url = getWalletBookCdnUrl.getWalletBookCdnUrl();
22
+ const fn = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
23
+ const res = yield fetch(url, { mode: 'cors' });
24
+ if (!res.ok) {
25
+ throw new Error(`Failed to fetch wallet book data from ${url} with status code ${res.status}`);
26
+ }
27
+ const json = yield res.json();
28
+ try {
29
+ const parsedData = walletBookSchema.walletBookSchema.parse(json);
30
+ return parsedData;
31
+ }
32
+ catch (e) {
33
+ logger.logger.error('Error parsing wallet book data', e, json);
34
+ throw e;
35
+ }
36
+ });
37
+ walletBookCache.current = yield utils.retryableFn(fn, {
38
+ fallbackValue: walletBookSchema.walletBookSchema.parse(walletBookFallbacks["default"]),
39
+ logger: logger.logger.createLogger('useWalletBookCdn'),
40
+ maxRetries: 3,
41
+ retryStrategy: 'timeout-and-rejection',
42
+ timeoutMs: 30000,
43
+ });
44
+ walletBookEmitter.emit('walletBookLoaded', walletBookCache.current);
45
+ });
46
+
47
+ exports.fetchWalletBook = fetchWalletBook;
48
+ exports.walletBookCache = walletBookCache;
49
+ exports.walletBookEmitter = walletBookEmitter;
@@ -0,0 +1,97 @@
1
+ import EventEmitter from 'eventemitter3';
2
+ import { WalletBookSchema } from '../../schemas/walletBookSchema';
3
+ export declare const walletBookCache: {
4
+ current: {
5
+ groups: Record<string, {
6
+ key: string;
7
+ name: string;
8
+ brand?: {
9
+ alt?: string | undefined;
10
+ primaryColor?: string | undefined;
11
+ spriteId?: string | undefined;
12
+ } | undefined;
13
+ walletOverrides?: Record<string, {
14
+ brand?: {
15
+ alt?: string | undefined;
16
+ primaryColor?: string | undefined;
17
+ spriteId?: string | undefined;
18
+ } | undefined;
19
+ name?: string | undefined;
20
+ }> | undefined;
21
+ }>;
22
+ wallets: Record<string, {
23
+ name: string;
24
+ brand?: {
25
+ alt?: string | undefined;
26
+ primaryColor?: string | undefined;
27
+ spriteId?: string | undefined;
28
+ } | undefined;
29
+ chainGroup?: string | undefined;
30
+ chains?: string[] | undefined;
31
+ desktop?: {
32
+ chromeId?: string | undefined;
33
+ edgeId?: string | undefined;
34
+ firefoxId?: string | undefined;
35
+ native?: string | undefined;
36
+ operaId?: string | undefined;
37
+ safariId?: string | undefined;
38
+ universal?: string | undefined;
39
+ } | undefined;
40
+ eip6963Config?: {
41
+ rdns: string;
42
+ } | undefined;
43
+ filterFromWalletConnect?: boolean | undefined;
44
+ group?: string | undefined;
45
+ hardwareWallets?: string[] | undefined;
46
+ injectedConfig?: {
47
+ chain: string;
48
+ extensionLocators: {
49
+ value: boolean;
50
+ flag: string;
51
+ }[];
52
+ providerInterface?: string | undefined;
53
+ walletStandard?: {
54
+ name: string;
55
+ features: string[];
56
+ providerId?: string | undefined;
57
+ } | undefined;
58
+ walletStandardLocators?: {
59
+ name: string;
60
+ locator: string;
61
+ }[] | undefined;
62
+ windowLocations?: string[] | undefined;
63
+ }[] | undefined;
64
+ mobile?: {
65
+ android?: string | null | undefined;
66
+ androidId?: string | undefined;
67
+ inAppBrowser?: string | null | undefined;
68
+ ios?: string | null | undefined;
69
+ iosId?: string | undefined;
70
+ native?: string | undefined;
71
+ universal?: string | undefined;
72
+ } | undefined;
73
+ mobileExperience?: "in-app-browser" | "redirect" | undefined;
74
+ shortName?: string | undefined;
75
+ showOnlyIfInstalled?: boolean | undefined;
76
+ switchNetworkOnlyFromWallet?: boolean | undefined;
77
+ walletConnect?: {
78
+ sdks?: string[] | undefined;
79
+ } | undefined;
80
+ walletGroup?: string | undefined;
81
+ walletLimitations?: {
82
+ browserExtension?: {
83
+ unsupportedEvents?: string[] | undefined;
84
+ unsupportedMethods?: string[] | undefined;
85
+ } | undefined;
86
+ mobile?: {
87
+ unsupportedEvents?: string[] | undefined;
88
+ unsupportedMethods?: string[] | undefined;
89
+ } | undefined;
90
+ } | undefined;
91
+ }>;
92
+ };
93
+ };
94
+ export declare const walletBookEmitter: EventEmitter<{
95
+ walletBookLoaded: (walletBook: WalletBookSchema) => void;
96
+ }, any>;
97
+ export declare const fetchWalletBook: () => Promise<void>;
@@ -0,0 +1,39 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../_virtual/_tslib.js';
3
+ import EventEmitter from 'eventemitter3';
4
+ import { retryableFn } from '@dynamic-labs/utils';
5
+ import walletBookFallbacks from '../../../wallet-book-fallbacks.js';
6
+ import { getWalletBookCdnUrl } from '../../helpers/getWalletBookCdnUrl.js';
7
+ import { logger } from '../../helpers/logger.js';
8
+ import { walletBookSchema } from '../../schemas/walletBookSchema.js';
9
+
10
+ const walletBookCache = { current: {} };
11
+ const walletBookEmitter = new EventEmitter();
12
+ const fetchWalletBook = () => __awaiter(void 0, void 0, void 0, function* () {
13
+ const url = getWalletBookCdnUrl();
14
+ const fn = () => __awaiter(void 0, void 0, void 0, function* () {
15
+ const res = yield fetch(url, { mode: 'cors' });
16
+ if (!res.ok) {
17
+ throw new Error(`Failed to fetch wallet book data from ${url} with status code ${res.status}`);
18
+ }
19
+ const json = yield res.json();
20
+ try {
21
+ const parsedData = walletBookSchema.parse(json);
22
+ return parsedData;
23
+ }
24
+ catch (e) {
25
+ logger.error('Error parsing wallet book data', e, json);
26
+ throw e;
27
+ }
28
+ });
29
+ walletBookCache.current = yield retryableFn(fn, {
30
+ fallbackValue: walletBookSchema.parse(walletBookFallbacks),
31
+ logger: logger.createLogger('useWalletBookCdn'),
32
+ maxRetries: 3,
33
+ retryStrategy: 'timeout-and-rejection',
34
+ timeoutMs: 30000,
35
+ });
36
+ walletBookEmitter.emit('walletBookLoaded', walletBookCache.current);
37
+ });
38
+
39
+ export { fetchWalletBook, walletBookCache, walletBookEmitter };
@@ -0,0 +1 @@
1
+ export * from './fetchWalletBook';
@@ -3,49 +3,20 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var _tslib = require('../../_virtual/_tslib.cjs');
7
6
  var react = require('react');
8
- var utils = require('@dynamic-labs/utils');
9
- require('../schemas/walletConnectSourceSchema.cjs');
10
- var walletBookSchema = require('../schemas/walletBookSchema.cjs');
11
- require('../schemas/walletSchema.cjs');
12
- require('../helpers/renderTemplate.cjs');
13
- var logger = require('../helpers/logger.cjs');
14
- var getWalletBookCdnUrl = require('../helpers/getWalletBookCdnUrl.cjs');
15
- var walletBookFallbacks = require('../../wallet-book-fallbacks.cjs');
7
+ var fetchWalletBook = require('./fetchWalletBook/fetchWalletBook.cjs');
16
8
 
9
+ // Initiate wallet book fetch immediately
10
+ fetchWalletBook.fetchWalletBook();
17
11
  const useWalletBookCdn = () => {
18
- const [walletBook, setWalletBook] = react.useState({});
12
+ const [walletBookState, setWalletBookState] = react.useState(fetchWalletBook.walletBookCache.current);
19
13
  react.useEffect(() => {
20
- const fetchWalletBook = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
21
- const url = getWalletBookCdnUrl.getWalletBookCdnUrl();
22
- const fn = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
23
- const res = yield fetch(url, { mode: 'cors' });
24
- if (res.ok) {
25
- const json = yield res.json();
26
- try {
27
- const parsedData = walletBookSchema.walletBookSchema.parse(json);
28
- return parsedData;
29
- }
30
- catch (e) {
31
- logger.logger.error('Error parsing wallet book data', e, json);
32
- throw e;
33
- }
34
- }
35
- throw new Error(`Failed to fetch wallet book data from ${url} with status code ${res.status}`);
36
- });
37
- const data = yield utils.retryableFn(fn, {
38
- fallbackValue: walletBookSchema.walletBookSchema.parse(walletBookFallbacks["default"]),
39
- logger: logger.logger.createLogger('useWalletBookCdn'),
40
- maxRetries: 3,
41
- retryStrategy: 'timeout-and-rejection',
42
- timeoutMs: 30000,
43
- });
44
- setWalletBook(data);
45
- });
46
- fetchWalletBook();
14
+ fetchWalletBook.walletBookEmitter.on('walletBookLoaded', setWalletBookState);
15
+ return () => {
16
+ fetchWalletBook.walletBookEmitter.off('walletBookLoaded', setWalletBookState);
17
+ };
47
18
  }, []);
48
- return walletBook;
19
+ return walletBookState;
49
20
  };
50
21
 
51
22
  exports.useWalletBookCdn = useWalletBookCdn;
@@ -1,47 +1,18 @@
1
1
  'use client'
2
- import { __awaiter } from '../../_virtual/_tslib.js';
3
2
  import { useState, useEffect } from 'react';
4
- import { retryableFn } from '@dynamic-labs/utils';
5
- import '../schemas/walletConnectSourceSchema.js';
6
- import { walletBookSchema } from '../schemas/walletBookSchema.js';
7
- import '../schemas/walletSchema.js';
8
- import '../helpers/renderTemplate.js';
9
- import { logger } from '../helpers/logger.js';
10
- import { getWalletBookCdnUrl } from '../helpers/getWalletBookCdnUrl.js';
11
- import walletBookFallbacks from '../../wallet-book-fallbacks.js';
3
+ import { fetchWalletBook, walletBookCache, walletBookEmitter } from './fetchWalletBook/fetchWalletBook.js';
12
4
 
5
+ // Initiate wallet book fetch immediately
6
+ fetchWalletBook();
13
7
  const useWalletBookCdn = () => {
14
- const [walletBook, setWalletBook] = useState({});
8
+ const [walletBookState, setWalletBookState] = useState(walletBookCache.current);
15
9
  useEffect(() => {
16
- const fetchWalletBook = () => __awaiter(void 0, void 0, void 0, function* () {
17
- const url = getWalletBookCdnUrl();
18
- const fn = () => __awaiter(void 0, void 0, void 0, function* () {
19
- const res = yield fetch(url, { mode: 'cors' });
20
- if (res.ok) {
21
- const json = yield res.json();
22
- try {
23
- const parsedData = walletBookSchema.parse(json);
24
- return parsedData;
25
- }
26
- catch (e) {
27
- logger.error('Error parsing wallet book data', e, json);
28
- throw e;
29
- }
30
- }
31
- throw new Error(`Failed to fetch wallet book data from ${url} with status code ${res.status}`);
32
- });
33
- const data = yield retryableFn(fn, {
34
- fallbackValue: walletBookSchema.parse(walletBookFallbacks),
35
- logger: logger.createLogger('useWalletBookCdn'),
36
- maxRetries: 3,
37
- retryStrategy: 'timeout-and-rejection',
38
- timeoutMs: 30000,
39
- });
40
- setWalletBook(data);
41
- });
42
- fetchWalletBook();
10
+ walletBookEmitter.on('walletBookLoaded', setWalletBookState);
11
+ return () => {
12
+ walletBookEmitter.off('walletBookLoaded', setWalletBookState);
13
+ };
43
14
  }, []);
44
- return walletBook;
15
+ return walletBookState;
45
16
  };
46
17
 
47
18
  export { useWalletBookCdn };
package/src/index.cjs CHANGED
@@ -3,6 +3,8 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ var assertPackageVersion = require('@dynamic-labs/assert-package-version');
7
+ var _package = require('../package.cjs');
6
8
  var WalletBookContext = require('./context/WalletBookContext.cjs');
7
9
  var getWalletIconUrl = require('./helpers/getWalletIconUrl.cjs');
8
10
  var getWalletBookWallet = require('./helpers/getWalletBookWallet.cjs');
@@ -23,7 +25,7 @@ var WalletIcon = require('./components/WalletIcon.cjs');
23
25
  var WalletBookContextProvider = require('./components/WalletBookContextProvider.cjs');
24
26
  var BrandIcon = require('./components/BrandIcon.cjs');
25
27
 
26
-
28
+ assertPackageVersion.assertPackageVersion('@dynamic-labs/wallet-book', _package.version);
27
29
 
28
30
  exports.useWalletBookContext = WalletBookContext.useWalletBookContext;
29
31
  exports.getWalletIconUrl = getWalletIconUrl.getWalletIconUrl;
package/src/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  'use client'
2
+ import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
3
+ import { version } from '../package.js';
2
4
  export { useWalletBookContext } from './context/WalletBookContext.js';
3
5
  export { getWalletIconUrl } from './helpers/getWalletIconUrl.js';
4
6
  export { getWalletBookWallet } from './helpers/getWalletBookWallet.js';
@@ -18,3 +20,5 @@ export { useWalletBookCdn } from './hooks/useWalletBookCdn.js';
18
20
  export { WalletIcon } from './components/WalletIcon.js';
19
21
  export { WalletBookContextProvider } from './components/WalletBookContextProvider.js';
20
22
  export { BrandIcon } from './components/BrandIcon.js';
23
+
24
+ assertPackageVersion('@dynamic-labs/wallet-book', version);
@@ -73,6 +73,23 @@ var groups = {
73
73
  key: "exodus",
74
74
  name: "Exodus"
75
75
  },
76
+ fireblocks: {
77
+ brand: {
78
+ alt: "Fireblocks",
79
+ spriteId: "fireblocks"
80
+ },
81
+ key: "fireblocks",
82
+ name: "Fireblocks"
83
+ },
84
+ flowwallet: {
85
+ brand: {
86
+ alt: "Flow Wallet",
87
+ primaryColor: "#2BE829",
88
+ spriteId: "flowwallet"
89
+ },
90
+ key: "flowwallet",
91
+ name: "Flow Wallet"
92
+ },
76
93
  keplr: {
77
94
  brand: {
78
95
  alt: "Keplr",
@@ -811,6 +828,19 @@ var wallets = {
811
828
  filterFromWalletConnect: true,
812
829
  name: "Lilico"
813
830
  },
831
+ flowwalletflow: {
832
+ brand: {
833
+ alt: "Flow Wallet",
834
+ spriteId: "flowwallet"
835
+ },
836
+ chainGroup: "flowwallet",
837
+ desktop: {
838
+ chromeId: "hpclkefagolihohboafpheddmmgdffjm"
839
+ },
840
+ filterFromWalletConnect: true,
841
+ group: "flowwallet",
842
+ name: "Flow Wallet"
843
+ },
814
844
  magicemailotp: {
815
845
  brand: {
816
846
  alt: "Magic Email OTP",
@@ -1011,6 +1041,9 @@ var wallets = {
1011
1041
  desktop: {
1012
1042
  chromeId: "aholpfdialjgjfhomihkjbmgjidlcdno"
1013
1043
  },
1044
+ eip6963Config: {
1045
+ rdns: "com.exodus.web3-wallet"
1046
+ },
1014
1047
  filterFromWalletConnect: true,
1015
1048
  group: "exodus",
1016
1049
  injectedConfig: [
@@ -1158,6 +1191,11 @@ var wallets = {
1158
1191
  ]
1159
1192
  }
1160
1193
  ],
1194
+ mobile: {
1195
+ androidId: "app.backpack.mobile",
1196
+ iosId: "id6445964121",
1197
+ native: "backpack://wc"
1198
+ },
1161
1199
  name: "Backpack",
1162
1200
  walletConnect: {
1163
1201
  sdks: [
@@ -69,6 +69,23 @@ var groups = {
69
69
  key: "exodus",
70
70
  name: "Exodus"
71
71
  },
72
+ fireblocks: {
73
+ brand: {
74
+ alt: "Fireblocks",
75
+ spriteId: "fireblocks"
76
+ },
77
+ key: "fireblocks",
78
+ name: "Fireblocks"
79
+ },
80
+ flowwallet: {
81
+ brand: {
82
+ alt: "Flow Wallet",
83
+ primaryColor: "#2BE829",
84
+ spriteId: "flowwallet"
85
+ },
86
+ key: "flowwallet",
87
+ name: "Flow Wallet"
88
+ },
72
89
  keplr: {
73
90
  brand: {
74
91
  alt: "Keplr",
@@ -807,6 +824,19 @@ var wallets = {
807
824
  filterFromWalletConnect: true,
808
825
  name: "Lilico"
809
826
  },
827
+ flowwalletflow: {
828
+ brand: {
829
+ alt: "Flow Wallet",
830
+ spriteId: "flowwallet"
831
+ },
832
+ chainGroup: "flowwallet",
833
+ desktop: {
834
+ chromeId: "hpclkefagolihohboafpheddmmgdffjm"
835
+ },
836
+ filterFromWalletConnect: true,
837
+ group: "flowwallet",
838
+ name: "Flow Wallet"
839
+ },
810
840
  magicemailotp: {
811
841
  brand: {
812
842
  alt: "Magic Email OTP",
@@ -1007,6 +1037,9 @@ var wallets = {
1007
1037
  desktop: {
1008
1038
  chromeId: "aholpfdialjgjfhomihkjbmgjidlcdno"
1009
1039
  },
1040
+ eip6963Config: {
1041
+ rdns: "com.exodus.web3-wallet"
1042
+ },
1010
1043
  filterFromWalletConnect: true,
1011
1044
  group: "exodus",
1012
1045
  injectedConfig: [
@@ -1154,6 +1187,11 @@ var wallets = {
1154
1187
  ]
1155
1188
  }
1156
1189
  ],
1190
+ mobile: {
1191
+ androidId: "app.backpack.mobile",
1192
+ iosId: "id6445964121",
1193
+ native: "backpack://wc"
1194
+ },
1157
1195
  name: "Backpack",
1158
1196
  walletConnect: {
1159
1197
  sdks: [
@@ -1,78 +0,0 @@
1
- 'use client'
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var zod = require('zod');
7
-
8
- const walletConnectSourceValueSchema = zod.z
9
- .object({
10
- app: zod.z.object({
11
- android: zod.z.string().nullable(),
12
- browser: zod.z.string().nullable(),
13
- chrome: zod.z.string().nullable(),
14
- edge: zod.z.string().nullable(),
15
- firefox: zod.z.string().nullable(),
16
- ios: zod.z.string().nullable(),
17
- linux: zod.z.string().nullable(),
18
- mac: zod.z.string().nullable(),
19
- opera: zod.z.string().nullable(),
20
- safari: zod.z.string().nullable(),
21
- windows: zod.z.string().nullable(),
22
- }),
23
- app_type: zod.z.string(),
24
- category: zod.z.string().nullable(),
25
- chains: zod.z.array(zod.z.string()),
26
- description: zod.z.string().nullable(),
27
- desktop: zod.z.object({
28
- native: zod.z.string().nullable(),
29
- universal: zod.z.string().nullable(),
30
- }),
31
- homepage: zod.z.string(),
32
- id: zod.z.string(),
33
- image_id: zod.z.string(),
34
- image_url: zod.z.object({
35
- lg: zod.z.string(),
36
- md: zod.z.string(),
37
- sm: zod.z.string(),
38
- }),
39
- injected: zod.z
40
- .array(zod.z.object({
41
- injected_id: zod.z.string(),
42
- namespace: zod.z.string(),
43
- }))
44
- .nullable(),
45
- metadata: zod.z.object({
46
- colors: zod.z.object({
47
- primary: zod.z.string().nullable(),
48
- secondary: zod.z.string().nullable(),
49
- }),
50
- shortName: zod.z.string().nullable(),
51
- }),
52
- mobile: zod.z.object({
53
- native: zod.z.string().nullable(),
54
- universal: zod.z.string().nullable(),
55
- }),
56
- name: zod.z.string(),
57
- rdns: zod.z.string().nullable(),
58
- sdks: zod.z.array(zod.z.string()),
59
- slug: zod.z.string(),
60
- supported_standards: zod.z
61
- .array(zod.z.object({
62
- id: zod.z.string(),
63
- standard_id: zod.z.number(),
64
- standard_prefix: zod.z.string(),
65
- title: zod.z.string(),
66
- url: zod.z.string(),
67
- }))
68
- .optional(),
69
- updatedAt: zod.z.string(),
70
- versions: zod.z.array(zod.z.string()),
71
- })
72
- .strict();
73
- /**
74
- * Validates the walletconnect.json file to ensure it is in the correct format
75
- */
76
- zod.z.record(zod.z.string(), walletConnectSourceValueSchema);
77
-
78
- exports.walletConnectSourceValueSchema = walletConnectSourceValueSchema;
@@ -1,74 +0,0 @@
1
- 'use client'
2
- import { z } from 'zod';
3
-
4
- const walletConnectSourceValueSchema = z
5
- .object({
6
- app: z.object({
7
- android: z.string().nullable(),
8
- browser: z.string().nullable(),
9
- chrome: z.string().nullable(),
10
- edge: z.string().nullable(),
11
- firefox: z.string().nullable(),
12
- ios: z.string().nullable(),
13
- linux: z.string().nullable(),
14
- mac: z.string().nullable(),
15
- opera: z.string().nullable(),
16
- safari: z.string().nullable(),
17
- windows: z.string().nullable(),
18
- }),
19
- app_type: z.string(),
20
- category: z.string().nullable(),
21
- chains: z.array(z.string()),
22
- description: z.string().nullable(),
23
- desktop: z.object({
24
- native: z.string().nullable(),
25
- universal: z.string().nullable(),
26
- }),
27
- homepage: z.string(),
28
- id: z.string(),
29
- image_id: z.string(),
30
- image_url: z.object({
31
- lg: z.string(),
32
- md: z.string(),
33
- sm: z.string(),
34
- }),
35
- injected: z
36
- .array(z.object({
37
- injected_id: z.string(),
38
- namespace: z.string(),
39
- }))
40
- .nullable(),
41
- metadata: z.object({
42
- colors: z.object({
43
- primary: z.string().nullable(),
44
- secondary: z.string().nullable(),
45
- }),
46
- shortName: z.string().nullable(),
47
- }),
48
- mobile: z.object({
49
- native: z.string().nullable(),
50
- universal: z.string().nullable(),
51
- }),
52
- name: z.string(),
53
- rdns: z.string().nullable(),
54
- sdks: z.array(z.string()),
55
- slug: z.string(),
56
- supported_standards: z
57
- .array(z.object({
58
- id: z.string(),
59
- standard_id: z.number(),
60
- standard_prefix: z.string(),
61
- title: z.string(),
62
- url: z.string(),
63
- }))
64
- .optional(),
65
- updatedAt: z.string(),
66
- versions: z.array(z.string()),
67
- })
68
- .strict();
69
- /**
70
- * Validates the walletconnect.json file to ensure it is in the correct format
71
- */
72
- z.record(z.string(), walletConnectSourceValueSchema);
73
-
74
- export { walletConnectSourceValueSchema };