@dynamic-labs/wallet-book 4.25.5 → 4.25.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 +8 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +6 -6
- package/src/build/index.d.ts +3 -3
- package/src/build/sources/walletConnect/index.d.ts +27 -27
- package/src/components/WalletIcon.d.ts +1 -1
- package/src/helpers/findWalletBookWallet.d.ts +3 -3
- package/src/helpers/findWalletBookWalletByNameAndChain.d.ts +3 -3
- package/src/hooks/fetchWalletBook/fetchWalletBook.d.ts +3 -3
- package/src/hooks/useWalletBookCdn.d.ts +3 -3
- package/src/schemas/utils/nonEmptyString.cjs +23 -2
- package/src/schemas/utils/nonEmptyString.d.ts +2 -2
- package/src/schemas/utils/nonEmptyString.js +3 -2
- package/src/schemas/utils/nonEmptyStringArray.cjs +23 -2
- package/src/schemas/utils/nonEmptyStringArray.d.ts +2 -2
- package/src/schemas/utils/nonEmptyStringArray.js +3 -2
- package/src/schemas/walletBookSchema.cjs +28 -7
- package/src/schemas/walletBookSchema.d.ts +204 -1067
- package/src/schemas/walletBookSchema.js +4 -3
- package/src/schemas/walletConnectSourceSchema.d.ts +119 -511
- package/src/schemas/walletGroup.cjs +30 -11
- package/src/schemas/walletGroup.d.ts +26 -110
- package/src/schemas/walletGroup.js +6 -7
- package/src/schemas/walletSchema.cjs +78 -81
- package/src/schemas/walletSchema.d.ts +108 -441
- package/src/schemas/walletSchema.js +50 -73
- package/wallet-book-fallbacks.cjs +1 -1
- package/wallet-book-fallbacks.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import
|
|
2
|
+
import * as z from 'zod/mini';
|
|
3
3
|
import { filterEmptyObject } from './utils/filterEmptyObject.js';
|
|
4
4
|
import { nonEmptyString } from './utils/nonEmptyString.js';
|
|
5
5
|
import { nonEmptyStringArray } from './utils/nonEmptyStringArray.js';
|
|
@@ -9,36 +9,30 @@ import { transformEdgeExtensionId } from './utils/transformEdgeExtensionId.js';
|
|
|
9
9
|
import { transformFirefoxExtensionId } from './utils/transformFirefoxExtensionId.js';
|
|
10
10
|
import { transformIosId } from './utils/transformIosId.js';
|
|
11
11
|
|
|
12
|
+
// eslint-disable-next-line import/no-extraneous-dependencies, import/no-namespace
|
|
12
13
|
const injectedConfigSchema = z.object({
|
|
13
14
|
chain: z.string(),
|
|
14
15
|
extensionLocators: z.array(z.object({
|
|
15
16
|
flag: z.string(),
|
|
16
|
-
value: z.
|
|
17
|
+
value: z._default(z.optional(z.boolean()), true),
|
|
17
18
|
})),
|
|
18
19
|
/**
|
|
19
20
|
* Allows declaring which interface, if any, this wallet's implementation follows
|
|
20
21
|
* ex. Leather with https://btckit.org/
|
|
21
22
|
*/
|
|
22
|
-
providerInterface: z.
|
|
23
|
+
providerInterface: z.optional(z.string()),
|
|
23
24
|
/**
|
|
24
25
|
* Allows declaring that this wallet is discoverable through the the Wallet Standard
|
|
25
26
|
* See https://github.com/wallet-standard/wallet-standard
|
|
26
27
|
* Also allows ignoring wallets that don't support the provided features
|
|
27
28
|
*/
|
|
28
|
-
walletStandard: z
|
|
29
|
-
.object({
|
|
29
|
+
walletStandard: z.optional(z.object({
|
|
30
30
|
features: z.array(z.string()),
|
|
31
31
|
name: z.string(),
|
|
32
|
-
providerId: z.
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.array(z.object({ locator: z.string(), name: z.string() }))
|
|
37
|
-
.optional(),
|
|
38
|
-
windowLocations: z
|
|
39
|
-
.array(z.string())
|
|
40
|
-
.optional()
|
|
41
|
-
.refine((val) => {
|
|
32
|
+
providerId: z.optional(z.string()),
|
|
33
|
+
})),
|
|
34
|
+
walletStandardLocators: z.optional(z.array(z.object({ locator: z.string(), name: z.string() }))),
|
|
35
|
+
windowLocations: z.optional(z.array(z.string())).check(z.refine((val) => {
|
|
42
36
|
if (!val)
|
|
43
37
|
return true;
|
|
44
38
|
if (!val.some((v) => ['ethereum', 'ethereum.providers'].includes(v)))
|
|
@@ -47,87 +41,70 @@ const injectedConfigSchema = z.object({
|
|
|
47
41
|
}, {
|
|
48
42
|
message: 'windowLocations cannot include ethereum or ethereum.providers as they are included by default',
|
|
49
43
|
path: ['config'],
|
|
50
|
-
}),
|
|
44
|
+
})),
|
|
51
45
|
});
|
|
52
46
|
const brandSchema = z.object({
|
|
53
47
|
alt: nonEmptyString,
|
|
54
48
|
primaryColor: nonEmptyString,
|
|
55
49
|
spriteId: nonEmptyString,
|
|
56
50
|
});
|
|
57
|
-
const walletSchema = z
|
|
58
|
-
.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
edgeId: nonEmptyString.transform(transformEdgeExtensionId),
|
|
66
|
-
firefoxId: nonEmptyString.transform(transformFirefoxExtensionId),
|
|
51
|
+
const walletSchema = z.pipe(z.pipe(z.transform((val) => val), z.object({
|
|
52
|
+
brand: z.optional(brandSchema),
|
|
53
|
+
chainGroup: z.optional(z.string()),
|
|
54
|
+
chains: z.optional(z.array(z.string())),
|
|
55
|
+
desktop: z.optional(z.pipe(z.object({
|
|
56
|
+
chromeId: z.optional(z.pipe(nonEmptyString, z.transform(transformChromeExtensionId))),
|
|
57
|
+
edgeId: z.optional(z.pipe(nonEmptyString, z.transform(transformEdgeExtensionId))),
|
|
58
|
+
firefoxId: z.optional(z.pipe(nonEmptyString, z.transform(transformFirefoxExtensionId))),
|
|
67
59
|
native: nonEmptyString,
|
|
68
60
|
operaId: nonEmptyString,
|
|
69
61
|
safariId: nonEmptyString,
|
|
70
62
|
universal: nonEmptyString,
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
filterFromWalletConnect: z.boolean().optional(),
|
|
76
|
-
group: z.string().optional(),
|
|
63
|
+
}), z.transform(filterEmptyObject))),
|
|
64
|
+
eip6963Config: z.optional(z.object({ rdns: z.string() })),
|
|
65
|
+
filterFromWalletConnect: z.optional(z.boolean()),
|
|
66
|
+
group: z.optional(z.string()),
|
|
77
67
|
/**
|
|
78
68
|
* Indicates which hardware wallets are enabled for this wallet
|
|
79
69
|
*/
|
|
80
|
-
hardwareWallets: z.array(z.string())
|
|
81
|
-
injectedConfig: z.array(injectedConfigSchema)
|
|
82
|
-
mobile: z
|
|
83
|
-
.
|
|
84
|
-
|
|
85
|
-
androidId: nonEmptyString.transform(transformAndroidId),
|
|
70
|
+
hardwareWallets: z.optional(z.array(z.string())),
|
|
71
|
+
injectedConfig: z.optional(z.array(injectedConfigSchema)),
|
|
72
|
+
mobile: z.optional(z.pipe(z.optional(z.object({
|
|
73
|
+
android: z.nullish(z.string()),
|
|
74
|
+
androidId: z.optional(z.pipe(nonEmptyString, z.transform(transformAndroidId))),
|
|
86
75
|
/**
|
|
87
76
|
* @deprecated Use inAppBrowserV2 instead for EVM wallet deep linking
|
|
88
77
|
*/
|
|
89
|
-
inAppBrowser:
|
|
90
|
-
inAppBrowserV2:
|
|
91
|
-
ios:
|
|
92
|
-
iosId: nonEmptyString.transform(transformIosId),
|
|
78
|
+
inAppBrowser: z.nullish(z.string()),
|
|
79
|
+
inAppBrowserV2: z.nullish(z.string()),
|
|
80
|
+
ios: z.nullish(z.string()),
|
|
81
|
+
iosId: z.optional(z.pipe(nonEmptyString, z.transform(transformIosId))),
|
|
93
82
|
native: nonEmptyString,
|
|
94
83
|
universal: nonEmptyString,
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
.transform(filterEmptyObject),
|
|
98
|
-
mobileExperience: z.enum(['in-app-browser', 'redirect']).optional(),
|
|
84
|
+
})), z.transform(filterEmptyObject))),
|
|
85
|
+
mobileExperience: z.optional(z.enum(['in-app-browser', 'redirect'])),
|
|
99
86
|
name: z.string(),
|
|
100
87
|
shortName: nonEmptyString,
|
|
101
|
-
showOnlyIfInstalled: z.
|
|
102
|
-
switchNetworkOnlyFromWallet: z.
|
|
103
|
-
walletConnect: z
|
|
104
|
-
.object({
|
|
88
|
+
showOnlyIfInstalled: z.optional(z.boolean()),
|
|
89
|
+
switchNetworkOnlyFromWallet: z.optional(z.boolean()),
|
|
90
|
+
walletConnect: z.optional(z.pipe(z.optional(z.object({
|
|
105
91
|
sdks: nonEmptyStringArray,
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
.transform(filterEmptyObject),
|
|
109
|
-
walletGroup: z.string().optional(),
|
|
92
|
+
})), z.transform(filterEmptyObject))),
|
|
93
|
+
walletGroup: z.optional(z.string()),
|
|
110
94
|
/**
|
|
111
95
|
* Indicates which connector methods/events are not supported, keyed by wallet type
|
|
112
96
|
*/
|
|
113
|
-
walletLimitations: z
|
|
114
|
-
.object({
|
|
115
|
-
|
|
116
|
-
.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
.optional(),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
unsupportedMethods: z.array(z.string()).optional(),
|
|
125
|
-
})
|
|
126
|
-
.optional(),
|
|
127
|
-
})
|
|
128
|
-
.optional(),
|
|
129
|
-
}))
|
|
130
|
-
.transform((val) => {
|
|
97
|
+
walletLimitations: z.optional(z.object({
|
|
98
|
+
browserExtension: z.optional(z.object({
|
|
99
|
+
unsupportedEvents: z.optional(z.array(z.string())),
|
|
100
|
+
unsupportedMethods: z.optional(z.array(z.string())),
|
|
101
|
+
})),
|
|
102
|
+
mobile: z.optional(z.object({
|
|
103
|
+
unsupportedEvents: z.optional(z.array(z.string())),
|
|
104
|
+
unsupportedMethods: z.optional(z.array(z.string())),
|
|
105
|
+
})),
|
|
106
|
+
})),
|
|
107
|
+
})), z.transform((val) => {
|
|
131
108
|
var _a, _b, _c, _d, _e, _f;
|
|
132
109
|
if (val.group) {
|
|
133
110
|
val.chainGroup = val.group;
|
|
@@ -139,6 +116,6 @@ const walletSchema = z
|
|
|
139
116
|
(_f = val.mobile) === null || _f === void 0 ? true : delete _f.android;
|
|
140
117
|
}
|
|
141
118
|
return val;
|
|
142
|
-
});
|
|
119
|
+
}));
|
|
143
120
|
|
|
144
121
|
export { brandSchema, walletSchema };
|
package/wallet-book-fallbacks.js
CHANGED