@dynamic-labs/wallet-book 4.0.0-alpha.4 → 4.0.0-alpha.6
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 +34 -0
- package/package.cjs +8 -0
- package/package.js +4 -0
- package/package.json +7 -13
- package/src/hooks/fetchWalletBook/fetchWalletBook.cjs +49 -0
- package/src/hooks/fetchWalletBook/fetchWalletBook.d.ts +97 -0
- package/src/hooks/fetchWalletBook/fetchWalletBook.js +39 -0
- package/src/hooks/fetchWalletBook/index.d.ts +1 -0
- package/src/hooks/useWalletBookCdn.cjs +9 -38
- package/src/hooks/useWalletBookCdn.js +9 -38
- package/src/index.cjs +3 -1
- package/src/index.js +4 -0
- package/src/schemas/walletConnectSourceSchema.cjs +0 -78
- package/src/schemas/walletConnectSourceSchema.js +0 -74
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
|
|
2
|
+
## [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)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* remove support to magic ([#7033](https://github.com/dynamic-labs/dynamic-auth/issues/7033)) ([0fdc41f](https://github.com/dynamic-labs/dynamic-auth/commit/0fdc41f05f87b32f56b73db068f984f18bdf69a0))
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* global connectivity disconnect ([#7008](https://github.com/dynamic-labs/dynamic-auth/issues/7008)) ([80d705b](https://github.com/dynamic-labs/dynamic-auth/commit/80d705ba252aa3b01cbf4861507fed00e460215f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* 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))
|
|
17
|
+
* add retry to useConnectWithOtp ([#7012](https://github.com/dynamic-labs/dynamic-auth/issues/7012)) ([d551d72](https://github.com/dynamic-labs/dynamic-auth/commit/d551d72a463f8a03964858b30ec174d41985a7b1))
|
|
18
|
+
* 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))
|
|
19
|
+
* 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))
|
|
20
|
+
* 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))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [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)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* 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))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **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))
|
|
34
|
+
* react-native-extension to include esm ([#6965](https://github.com/dynamic-labs/DynamicAuth/issues/6965)) ([336825b](https://github.com/dynamic-labs/DynamicAuth/commit/336825b50142002bbc67c6f8850bd63030bf384b))
|
|
35
|
+
|
|
2
36
|
## [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)
|
|
3
37
|
|
|
4
38
|
|
package/package.cjs
ADDED
package/package.js
ADDED
package/package.json
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/wallet-book",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
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.6",
|
|
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/
|
|
30
|
-
"@dynamic-labs/
|
|
31
|
-
"@dynamic-labs/
|
|
20
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.6",
|
|
21
|
+
"@dynamic-labs/iconic": "4.0.0-alpha.6",
|
|
22
|
+
"@dynamic-labs/logger": "4.0.0-alpha.6",
|
|
23
|
+
"@dynamic-labs/utils": "4.0.0-alpha.6",
|
|
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"
|
|
@@ -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
|
|
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 [
|
|
12
|
+
const [walletBookState, setWalletBookState] = react.useState(fetchWalletBook.walletBookCache.current);
|
|
19
13
|
react.useEffect(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
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 {
|
|
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 [
|
|
8
|
+
const [walletBookState, setWalletBookState] = useState(walletBookCache.current);
|
|
15
9
|
useEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
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);
|
|
@@ -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 };
|