@dynamic-labs/wallet-book 1.1.0-alpha.9 → 1.1.0
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 +198 -0
- package/README.md +46 -1
- package/_virtual/_tslib.cjs +6 -1
- package/_virtual/_tslib.js +6 -1
- package/package.json +4 -2
- package/src/build/index.d.ts +4 -0
- package/src/build/sources/walletConnect/index.d.ts +28 -24
- package/src/build/sources/walletConnectOverrides/index.d.ts +12 -0
- package/src/components/BrandIcon.cjs +25 -0
- package/src/components/BrandIcon.d.ts +8 -0
- package/src/components/BrandIcon.js +21 -0
- package/src/components/WalletIcon.cjs +2 -1
- package/src/components/WalletIcon.js +2 -1
- package/src/components/index.d.ts +1 -0
- package/src/helpers/findWalletBookWallet.cjs +0 -2
- package/src/helpers/findWalletBookWallet.d.ts +4 -1
- package/src/helpers/findWalletBookWallet.js +0 -2
- package/src/helpers/findWalletGroup.d.ts +9 -0
- package/src/helpers/findWalletGroupOverride.cjs +13 -0
- package/src/helpers/findWalletGroupOverride.d.ts +3 -0
- package/src/helpers/findWalletGroupOverride.js +9 -0
- package/src/helpers/getBrandIconUrl.cjs +17 -0
- package/src/helpers/getBrandIconUrl.d.ts +2 -0
- package/src/helpers/getBrandIconUrl.js +13 -0
- package/src/helpers/getWalletBookWallet.cjs +18 -6
- package/src/helpers/getWalletBookWallet.js +18 -6
- package/src/helpers/getWalletIconUrl.cjs +3 -6
- package/src/helpers/getWalletIconUrl.js +3 -6
- package/src/helpers/index.d.ts +2 -0
- package/src/helpers/normalizeWalletName.cjs +7 -0
- package/src/helpers/normalizeWalletName.js +3 -0
- package/src/hooks/useWalletBookCdn.cjs +22 -16
- package/src/hooks/useWalletBookCdn.d.ts +13 -1
- package/src/hooks/useWalletBookCdn.js +22 -16
- package/src/hooks/useWalletBookContext.cjs +2 -0
- package/src/hooks/useWalletBookContext.js +2 -0
- package/src/index.cjs +6 -0
- package/src/index.d.ts +2 -2
- package/src/index.js +3 -0
- package/src/schemas/walletBookSchema.d.ts +213 -20
- package/src/schemas/walletGroup.cjs +6 -0
- package/src/schemas/walletGroup.d.ts +112 -2
- package/src/schemas/walletGroup.js +6 -0
- package/src/schemas/walletSchema.cjs +39 -20
- package/src/schemas/walletSchema.d.ts +77 -4
- package/src/schemas/walletSchema.js +39 -21
- package/wallet-book-fallbacks.cjs +217 -9
- package/wallet-book-fallbacks.js +217 -9
|
@@ -1,4 +1,49 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
declare const WalletOverrideEntrySchema: z.ZodObject<{
|
|
3
|
+
brand: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
4
|
+
alt: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
5
|
+
imageId: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
6
|
+
primaryColor: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
7
|
+
spriteId: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
alt?: string | undefined;
|
|
10
|
+
imageId?: string | undefined;
|
|
11
|
+
primaryColor?: string | undefined;
|
|
12
|
+
spriteId?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
alt?: unknown;
|
|
15
|
+
imageId?: unknown;
|
|
16
|
+
primaryColor?: unknown;
|
|
17
|
+
spriteId?: unknown;
|
|
18
|
+
}>, {
|
|
19
|
+
alt?: string | undefined;
|
|
20
|
+
imageId?: string | undefined;
|
|
21
|
+
primaryColor?: string | undefined;
|
|
22
|
+
spriteId?: string | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
alt?: unknown;
|
|
25
|
+
imageId?: unknown;
|
|
26
|
+
primaryColor?: unknown;
|
|
27
|
+
spriteId?: unknown;
|
|
28
|
+
}>>;
|
|
29
|
+
name: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
brand?: {
|
|
32
|
+
alt?: string | undefined;
|
|
33
|
+
imageId?: string | undefined;
|
|
34
|
+
primaryColor?: string | undefined;
|
|
35
|
+
spriteId?: string | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
name?: string | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
brand?: {
|
|
40
|
+
alt?: unknown;
|
|
41
|
+
imageId?: unknown;
|
|
42
|
+
primaryColor?: unknown;
|
|
43
|
+
spriteId?: unknown;
|
|
44
|
+
} | undefined;
|
|
45
|
+
name?: unknown;
|
|
46
|
+
}>;
|
|
2
47
|
export declare const walletGroupSchema: z.ZodObject<{
|
|
3
48
|
brand: z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
4
49
|
alt: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
@@ -28,23 +73,88 @@ export declare const walletGroupSchema: z.ZodObject<{
|
|
|
28
73
|
} | undefined>;
|
|
29
74
|
key: z.ZodString;
|
|
30
75
|
name: z.ZodString;
|
|
76
|
+
walletOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
77
|
+
brand: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
78
|
+
alt: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
79
|
+
imageId: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
80
|
+
primaryColor: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
81
|
+
spriteId: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
alt?: string | undefined;
|
|
84
|
+
imageId?: string | undefined;
|
|
85
|
+
primaryColor?: string | undefined;
|
|
86
|
+
spriteId?: string | undefined;
|
|
87
|
+
}, {
|
|
88
|
+
alt?: unknown;
|
|
89
|
+
imageId?: unknown;
|
|
90
|
+
primaryColor?: unknown;
|
|
91
|
+
spriteId?: unknown;
|
|
92
|
+
}>, {
|
|
93
|
+
alt?: string | undefined;
|
|
94
|
+
imageId?: string | undefined;
|
|
95
|
+
primaryColor?: string | undefined;
|
|
96
|
+
spriteId?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
alt?: unknown;
|
|
99
|
+
imageId?: unknown;
|
|
100
|
+
primaryColor?: unknown;
|
|
101
|
+
spriteId?: unknown;
|
|
102
|
+
}>>;
|
|
103
|
+
name: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
brand?: {
|
|
106
|
+
alt?: string | undefined;
|
|
107
|
+
imageId?: string | undefined;
|
|
108
|
+
primaryColor?: string | undefined;
|
|
109
|
+
spriteId?: string | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
name?: string | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
brand?: {
|
|
114
|
+
alt?: unknown;
|
|
115
|
+
imageId?: unknown;
|
|
116
|
+
primaryColor?: unknown;
|
|
117
|
+
spriteId?: unknown;
|
|
118
|
+
} | undefined;
|
|
119
|
+
name?: unknown;
|
|
120
|
+
}>>>;
|
|
31
121
|
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
key: string;
|
|
33
122
|
name: string;
|
|
123
|
+
key: string;
|
|
34
124
|
brand?: {
|
|
35
125
|
alt?: string | undefined;
|
|
36
126
|
imageId?: string | undefined;
|
|
37
127
|
primaryColor?: string | undefined;
|
|
38
128
|
spriteId?: string | undefined;
|
|
39
129
|
} | undefined;
|
|
130
|
+
walletOverrides?: Record<string, {
|
|
131
|
+
brand?: {
|
|
132
|
+
alt?: string | undefined;
|
|
133
|
+
imageId?: string | undefined;
|
|
134
|
+
primaryColor?: string | undefined;
|
|
135
|
+
spriteId?: string | undefined;
|
|
136
|
+
} | undefined;
|
|
137
|
+
name?: string | undefined;
|
|
138
|
+
}> | undefined;
|
|
40
139
|
}, {
|
|
41
|
-
key: string;
|
|
42
140
|
name: string;
|
|
141
|
+
key: string;
|
|
43
142
|
brand?: {
|
|
44
143
|
alt?: unknown;
|
|
45
144
|
imageId?: unknown;
|
|
46
145
|
primaryColor?: unknown;
|
|
47
146
|
spriteId?: unknown;
|
|
48
147
|
} | undefined;
|
|
148
|
+
walletOverrides?: Record<string, {
|
|
149
|
+
brand?: {
|
|
150
|
+
alt?: unknown;
|
|
151
|
+
imageId?: unknown;
|
|
152
|
+
primaryColor?: unknown;
|
|
153
|
+
spriteId?: unknown;
|
|
154
|
+
} | undefined;
|
|
155
|
+
name?: unknown;
|
|
156
|
+
}> | undefined;
|
|
49
157
|
}>;
|
|
50
158
|
export type WalletGroupSchema = z.infer<typeof walletGroupSchema>;
|
|
159
|
+
export type WalletGroupOverride = z.infer<typeof WalletOverrideEntrySchema>;
|
|
160
|
+
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { nonEmptyString } from './utils/nonEmptyString.js';
|
|
3
|
+
import { brandSchema } from './walletSchema.js';
|
|
3
4
|
|
|
5
|
+
const WalletOverrideEntrySchema = z.object({
|
|
6
|
+
brand: brandSchema.optional(),
|
|
7
|
+
name: nonEmptyString,
|
|
8
|
+
});
|
|
4
9
|
const walletGroupSchema = z.object({
|
|
5
10
|
brand: z
|
|
6
11
|
.object({
|
|
@@ -23,6 +28,7 @@ const walletGroupSchema = z.object({
|
|
|
23
28
|
}),
|
|
24
29
|
key: z.string(),
|
|
25
30
|
name: z.string(),
|
|
31
|
+
walletOverrides: z.record(WalletOverrideEntrySchema).optional(),
|
|
26
32
|
});
|
|
27
33
|
|
|
28
34
|
export { walletGroupSchema };
|
|
@@ -18,6 +18,16 @@ const injectedConfigSchema = zod.z.object({
|
|
|
18
18
|
flag: zod.z.string(),
|
|
19
19
|
value: zod.z.boolean().optional().default(true),
|
|
20
20
|
})),
|
|
21
|
+
/**
|
|
22
|
+
* Allows declaring which interface, if any, this wallet's implementation follows
|
|
23
|
+
* ex. Leather with https://btckit.org/
|
|
24
|
+
*/
|
|
25
|
+
providerInterface: zod.z.string().optional(),
|
|
26
|
+
/**
|
|
27
|
+
* Allows declaring that this wallet is discoverable through the the Wallet Standard
|
|
28
|
+
* See https://github.com/wallet-standard/wallet-standard
|
|
29
|
+
* Also allows ignoring wallets that don't support the provided features
|
|
30
|
+
*/
|
|
21
31
|
walletStandard: zod.z
|
|
22
32
|
.object({ features: zod.z.array(zod.z.string()), name: zod.z.string() })
|
|
23
33
|
.optional(),
|
|
@@ -35,28 +45,28 @@ const injectedConfigSchema = zod.z.object({
|
|
|
35
45
|
path: ['config'],
|
|
36
46
|
}),
|
|
37
47
|
});
|
|
48
|
+
const brandSchema = zod.z
|
|
49
|
+
.object({
|
|
50
|
+
alt: nonEmptyString.nonEmptyString,
|
|
51
|
+
imageId: nonEmptyString.nonEmptyString,
|
|
52
|
+
primaryColor: nonEmptyString.nonEmptyString,
|
|
53
|
+
spriteId: nonEmptyString.nonEmptyString,
|
|
54
|
+
})
|
|
55
|
+
.refine((val) => {
|
|
56
|
+
if (!val)
|
|
57
|
+
return true;
|
|
58
|
+
if (!(val.spriteId && val.imageId) && (val.spriteId || val.imageId)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}, {
|
|
63
|
+
message: 'Only one of spriteId or imageId can be defined',
|
|
64
|
+
path: ['brand'],
|
|
65
|
+
});
|
|
38
66
|
const walletSchema = zod.z
|
|
39
67
|
.preprocess((val) => val, zod.z.object({
|
|
40
|
-
brand:
|
|
41
|
-
|
|
42
|
-
alt: nonEmptyString.nonEmptyString,
|
|
43
|
-
imageId: nonEmptyString.nonEmptyString,
|
|
44
|
-
primaryColor: nonEmptyString.nonEmptyString,
|
|
45
|
-
spriteId: nonEmptyString.nonEmptyString,
|
|
46
|
-
})
|
|
47
|
-
.optional()
|
|
48
|
-
.refine((val) => {
|
|
49
|
-
if (!val)
|
|
50
|
-
return true;
|
|
51
|
-
if (!(val.spriteId && val.imageId) &&
|
|
52
|
-
(val.spriteId || val.imageId)) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
return false;
|
|
56
|
-
}, {
|
|
57
|
-
message: 'Only one of spriteId or imageId can be defined',
|
|
58
|
-
path: ['brand'],
|
|
59
|
-
}),
|
|
68
|
+
brand: brandSchema.optional(),
|
|
69
|
+
chainGroup: zod.z.string().optional(),
|
|
60
70
|
chains: zod.z.array(zod.z.string()).optional(),
|
|
61
71
|
desktop: zod.z
|
|
62
72
|
.object({
|
|
@@ -73,6 +83,10 @@ const walletSchema = zod.z
|
|
|
73
83
|
eip6963Config: zod.z.object({ rdns: zod.z.string() }).optional(),
|
|
74
84
|
filterFromWalletConnect: zod.z.boolean().optional(),
|
|
75
85
|
group: zod.z.string().optional(),
|
|
86
|
+
/**
|
|
87
|
+
* Indicates which hardware wallets are enabled for this wallet
|
|
88
|
+
*/
|
|
89
|
+
hardwareWallets: zod.z.array(zod.z.string()).optional(),
|
|
76
90
|
injectedConfig: zod.z.array(injectedConfigSchema).optional(),
|
|
77
91
|
mobile: zod.z
|
|
78
92
|
.object({
|
|
@@ -95,9 +109,13 @@ const walletSchema = zod.z
|
|
|
95
109
|
})
|
|
96
110
|
.optional()
|
|
97
111
|
.transform(filterEmptyObject.filterEmptyObject),
|
|
112
|
+
walletGroup: zod.z.string().optional(),
|
|
98
113
|
}))
|
|
99
114
|
.transform((val) => {
|
|
100
115
|
var _a, _b, _c, _d, _e, _f;
|
|
116
|
+
if (val.group) {
|
|
117
|
+
val.chainGroup = val.group;
|
|
118
|
+
}
|
|
101
119
|
if (((_a = val.mobile) === null || _a === void 0 ? void 0 : _a.iosId) || ((_b = val.mobile) === null || _b === void 0 ? void 0 : _b.ios) === null) {
|
|
102
120
|
(_c = val.mobile) === null || _c === void 0 ? true : delete _c.ios;
|
|
103
121
|
}
|
|
@@ -107,4 +125,5 @@ const walletSchema = zod.z
|
|
|
107
125
|
return val;
|
|
108
126
|
});
|
|
109
127
|
|
|
128
|
+
exports.brandSchema = brandSchema;
|
|
110
129
|
exports.walletSchema = walletSchema;
|
|
@@ -11,6 +11,16 @@ declare const injectedConfigSchema: z.ZodObject<{
|
|
|
11
11
|
flag: string;
|
|
12
12
|
value?: boolean | undefined;
|
|
13
13
|
}>, "many">;
|
|
14
|
+
/**
|
|
15
|
+
* Allows declaring which interface, if any, this wallet's implementation follows
|
|
16
|
+
* ex. Leather with https://btckit.org/
|
|
17
|
+
*/
|
|
18
|
+
providerInterface: z.ZodOptional<z.ZodString>;
|
|
19
|
+
/**
|
|
20
|
+
* Allows declaring that this wallet is discoverable through the the Wallet Standard
|
|
21
|
+
* See https://github.com/wallet-standard/wallet-standard
|
|
22
|
+
* Also allows ignoring wallets that don't support the provided features
|
|
23
|
+
*/
|
|
14
24
|
walletStandard: z.ZodOptional<z.ZodObject<{
|
|
15
25
|
features: z.ZodArray<z.ZodString, "many">;
|
|
16
26
|
name: z.ZodString;
|
|
@@ -28,6 +38,7 @@ declare const injectedConfigSchema: z.ZodObject<{
|
|
|
28
38
|
value: boolean;
|
|
29
39
|
flag: string;
|
|
30
40
|
}[];
|
|
41
|
+
providerInterface?: string | undefined;
|
|
31
42
|
walletStandard?: {
|
|
32
43
|
features: string[];
|
|
33
44
|
name: string;
|
|
@@ -39,14 +50,41 @@ declare const injectedConfigSchema: z.ZodObject<{
|
|
|
39
50
|
flag: string;
|
|
40
51
|
value?: boolean | undefined;
|
|
41
52
|
}[];
|
|
53
|
+
providerInterface?: string | undefined;
|
|
42
54
|
walletStandard?: {
|
|
43
55
|
features: string[];
|
|
44
56
|
name: string;
|
|
45
57
|
} | undefined;
|
|
46
58
|
windowLocations?: string[] | undefined;
|
|
47
59
|
}>;
|
|
60
|
+
export declare const brandSchema: z.ZodEffects<z.ZodObject<{
|
|
61
|
+
alt: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
62
|
+
imageId: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
63
|
+
primaryColor: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
64
|
+
spriteId: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
alt?: string | undefined;
|
|
67
|
+
imageId?: string | undefined;
|
|
68
|
+
primaryColor?: string | undefined;
|
|
69
|
+
spriteId?: string | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
alt?: unknown;
|
|
72
|
+
imageId?: unknown;
|
|
73
|
+
primaryColor?: unknown;
|
|
74
|
+
spriteId?: unknown;
|
|
75
|
+
}>, {
|
|
76
|
+
alt?: string | undefined;
|
|
77
|
+
imageId?: string | undefined;
|
|
78
|
+
primaryColor?: string | undefined;
|
|
79
|
+
spriteId?: string | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
alt?: unknown;
|
|
82
|
+
imageId?: unknown;
|
|
83
|
+
primaryColor?: unknown;
|
|
84
|
+
spriteId?: unknown;
|
|
85
|
+
}>;
|
|
48
86
|
export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
49
|
-
brand: z.
|
|
87
|
+
brand: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
50
88
|
alt: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
51
89
|
imageId: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
52
90
|
primaryColor: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
@@ -61,17 +99,18 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
61
99
|
imageId?: unknown;
|
|
62
100
|
primaryColor?: unknown;
|
|
63
101
|
spriteId?: unknown;
|
|
64
|
-
}
|
|
102
|
+
}>, {
|
|
65
103
|
alt?: string | undefined;
|
|
66
104
|
imageId?: string | undefined;
|
|
67
105
|
primaryColor?: string | undefined;
|
|
68
106
|
spriteId?: string | undefined;
|
|
69
|
-
}
|
|
107
|
+
}, {
|
|
70
108
|
alt?: unknown;
|
|
71
109
|
imageId?: unknown;
|
|
72
110
|
primaryColor?: unknown;
|
|
73
111
|
spriteId?: unknown;
|
|
74
|
-
}
|
|
112
|
+
}>>;
|
|
113
|
+
chainGroup: z.ZodOptional<z.ZodString>;
|
|
75
114
|
chains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
76
115
|
desktop: z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
77
116
|
chromeId: z.ZodEffects<z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>, string | undefined, unknown>;
|
|
@@ -123,6 +162,10 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
123
162
|
}>>;
|
|
124
163
|
filterFromWalletConnect: z.ZodOptional<z.ZodBoolean>;
|
|
125
164
|
group: z.ZodOptional<z.ZodString>;
|
|
165
|
+
/**
|
|
166
|
+
* Indicates which hardware wallets are enabled for this wallet
|
|
167
|
+
*/
|
|
168
|
+
hardwareWallets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
126
169
|
injectedConfig: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
127
170
|
chain: z.ZodString;
|
|
128
171
|
extensionLocators: z.ZodArray<z.ZodObject<{
|
|
@@ -135,6 +178,16 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
135
178
|
flag: string;
|
|
136
179
|
value?: boolean | undefined;
|
|
137
180
|
}>, "many">;
|
|
181
|
+
/**
|
|
182
|
+
* Allows declaring which interface, if any, this wallet's implementation follows
|
|
183
|
+
* ex. Leather with https://btckit.org/
|
|
184
|
+
*/
|
|
185
|
+
providerInterface: z.ZodOptional<z.ZodString>;
|
|
186
|
+
/**
|
|
187
|
+
* Allows declaring that this wallet is discoverable through the the Wallet Standard
|
|
188
|
+
* See https://github.com/wallet-standard/wallet-standard
|
|
189
|
+
* Also allows ignoring wallets that don't support the provided features
|
|
190
|
+
*/
|
|
138
191
|
walletStandard: z.ZodOptional<z.ZodObject<{
|
|
139
192
|
features: z.ZodArray<z.ZodString, "many">;
|
|
140
193
|
name: z.ZodString;
|
|
@@ -152,6 +205,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
152
205
|
value: boolean;
|
|
153
206
|
flag: string;
|
|
154
207
|
}[];
|
|
208
|
+
providerInterface?: string | undefined;
|
|
155
209
|
walletStandard?: {
|
|
156
210
|
features: string[];
|
|
157
211
|
name: string;
|
|
@@ -163,6 +217,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
163
217
|
flag: string;
|
|
164
218
|
value?: boolean | undefined;
|
|
165
219
|
}[];
|
|
220
|
+
providerInterface?: string | undefined;
|
|
166
221
|
walletStandard?: {
|
|
167
222
|
features: string[];
|
|
168
223
|
name: string;
|
|
@@ -220,6 +275,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
220
275
|
} | undefined, {
|
|
221
276
|
sdks?: unknown;
|
|
222
277
|
} | undefined>;
|
|
278
|
+
walletGroup: z.ZodOptional<z.ZodString>;
|
|
223
279
|
}, "strip", z.ZodTypeAny, {
|
|
224
280
|
name: string;
|
|
225
281
|
brand?: {
|
|
@@ -228,6 +284,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
228
284
|
primaryColor?: string | undefined;
|
|
229
285
|
spriteId?: string | undefined;
|
|
230
286
|
} | undefined;
|
|
287
|
+
chainGroup?: string | undefined;
|
|
231
288
|
chains?: string[] | undefined;
|
|
232
289
|
desktop?: {
|
|
233
290
|
chromeId?: string | undefined;
|
|
@@ -243,12 +300,14 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
243
300
|
} | undefined;
|
|
244
301
|
filterFromWalletConnect?: boolean | undefined;
|
|
245
302
|
group?: string | undefined;
|
|
303
|
+
hardwareWallets?: string[] | undefined;
|
|
246
304
|
injectedConfig?: {
|
|
247
305
|
chain: string;
|
|
248
306
|
extensionLocators: {
|
|
249
307
|
value: boolean;
|
|
250
308
|
flag: string;
|
|
251
309
|
}[];
|
|
310
|
+
providerInterface?: string | undefined;
|
|
252
311
|
walletStandard?: {
|
|
253
312
|
features: string[];
|
|
254
313
|
name: string;
|
|
@@ -269,6 +328,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
269
328
|
walletConnect?: {
|
|
270
329
|
sdks?: string[] | undefined;
|
|
271
330
|
} | undefined;
|
|
331
|
+
walletGroup?: string | undefined;
|
|
272
332
|
}, {
|
|
273
333
|
name: string;
|
|
274
334
|
brand?: {
|
|
@@ -277,6 +337,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
277
337
|
primaryColor?: unknown;
|
|
278
338
|
spriteId?: unknown;
|
|
279
339
|
} | undefined;
|
|
340
|
+
chainGroup?: string | undefined;
|
|
280
341
|
chains?: string[] | undefined;
|
|
281
342
|
desktop?: {
|
|
282
343
|
chromeId?: unknown;
|
|
@@ -292,12 +353,14 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
292
353
|
} | undefined;
|
|
293
354
|
filterFromWalletConnect?: boolean | undefined;
|
|
294
355
|
group?: string | undefined;
|
|
356
|
+
hardwareWallets?: string[] | undefined;
|
|
295
357
|
injectedConfig?: {
|
|
296
358
|
chain: string;
|
|
297
359
|
extensionLocators: {
|
|
298
360
|
flag: string;
|
|
299
361
|
value?: boolean | undefined;
|
|
300
362
|
}[];
|
|
363
|
+
providerInterface?: string | undefined;
|
|
301
364
|
walletStandard?: {
|
|
302
365
|
features: string[];
|
|
303
366
|
name: string;
|
|
@@ -318,6 +381,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
318
381
|
walletConnect?: {
|
|
319
382
|
sdks?: unknown;
|
|
320
383
|
} | undefined;
|
|
384
|
+
walletGroup?: string | undefined;
|
|
321
385
|
}>, {
|
|
322
386
|
name: string;
|
|
323
387
|
brand?: {
|
|
@@ -326,6 +390,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
326
390
|
primaryColor?: string | undefined;
|
|
327
391
|
spriteId?: string | undefined;
|
|
328
392
|
} | undefined;
|
|
393
|
+
chainGroup?: string | undefined;
|
|
329
394
|
chains?: string[] | undefined;
|
|
330
395
|
desktop?: {
|
|
331
396
|
chromeId?: string | undefined;
|
|
@@ -341,12 +406,14 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
341
406
|
} | undefined;
|
|
342
407
|
filterFromWalletConnect?: boolean | undefined;
|
|
343
408
|
group?: string | undefined;
|
|
409
|
+
hardwareWallets?: string[] | undefined;
|
|
344
410
|
injectedConfig?: {
|
|
345
411
|
chain: string;
|
|
346
412
|
extensionLocators: {
|
|
347
413
|
value: boolean;
|
|
348
414
|
flag: string;
|
|
349
415
|
}[];
|
|
416
|
+
providerInterface?: string | undefined;
|
|
350
417
|
walletStandard?: {
|
|
351
418
|
features: string[];
|
|
352
419
|
name: string;
|
|
@@ -367,6 +434,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
367
434
|
walletConnect?: {
|
|
368
435
|
sdks?: string[] | undefined;
|
|
369
436
|
} | undefined;
|
|
437
|
+
walletGroup?: string | undefined;
|
|
370
438
|
}, unknown>, {
|
|
371
439
|
name: string;
|
|
372
440
|
brand?: {
|
|
@@ -375,6 +443,7 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
375
443
|
primaryColor?: string | undefined;
|
|
376
444
|
spriteId?: string | undefined;
|
|
377
445
|
} | undefined;
|
|
446
|
+
chainGroup?: string | undefined;
|
|
378
447
|
chains?: string[] | undefined;
|
|
379
448
|
desktop?: {
|
|
380
449
|
chromeId?: string | undefined;
|
|
@@ -390,12 +459,14 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
390
459
|
} | undefined;
|
|
391
460
|
filterFromWalletConnect?: boolean | undefined;
|
|
392
461
|
group?: string | undefined;
|
|
462
|
+
hardwareWallets?: string[] | undefined;
|
|
393
463
|
injectedConfig?: {
|
|
394
464
|
chain: string;
|
|
395
465
|
extensionLocators: {
|
|
396
466
|
value: boolean;
|
|
397
467
|
flag: string;
|
|
398
468
|
}[];
|
|
469
|
+
providerInterface?: string | undefined;
|
|
399
470
|
walletStandard?: {
|
|
400
471
|
features: string[];
|
|
401
472
|
name: string;
|
|
@@ -416,7 +487,9 @@ export declare const walletSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
416
487
|
walletConnect?: {
|
|
417
488
|
sdks?: string[] | undefined;
|
|
418
489
|
} | undefined;
|
|
490
|
+
walletGroup?: string | undefined;
|
|
419
491
|
}, unknown>;
|
|
420
492
|
export type WalletSchema = z.infer<typeof walletSchema>;
|
|
421
493
|
export type WalletInjectedConfigSchema = z.infer<typeof injectedConfigSchema>;
|
|
494
|
+
export type WalletBrand = z.infer<typeof brandSchema>;
|
|
422
495
|
export {};
|
|
@@ -14,6 +14,16 @@ const injectedConfigSchema = z.object({
|
|
|
14
14
|
flag: z.string(),
|
|
15
15
|
value: z.boolean().optional().default(true),
|
|
16
16
|
})),
|
|
17
|
+
/**
|
|
18
|
+
* Allows declaring which interface, if any, this wallet's implementation follows
|
|
19
|
+
* ex. Leather with https://btckit.org/
|
|
20
|
+
*/
|
|
21
|
+
providerInterface: z.string().optional(),
|
|
22
|
+
/**
|
|
23
|
+
* Allows declaring that this wallet is discoverable through the the Wallet Standard
|
|
24
|
+
* See https://github.com/wallet-standard/wallet-standard
|
|
25
|
+
* Also allows ignoring wallets that don't support the provided features
|
|
26
|
+
*/
|
|
17
27
|
walletStandard: z
|
|
18
28
|
.object({ features: z.array(z.string()), name: z.string() })
|
|
19
29
|
.optional(),
|
|
@@ -31,28 +41,28 @@ const injectedConfigSchema = z.object({
|
|
|
31
41
|
path: ['config'],
|
|
32
42
|
}),
|
|
33
43
|
});
|
|
44
|
+
const brandSchema = z
|
|
45
|
+
.object({
|
|
46
|
+
alt: nonEmptyString,
|
|
47
|
+
imageId: nonEmptyString,
|
|
48
|
+
primaryColor: nonEmptyString,
|
|
49
|
+
spriteId: nonEmptyString,
|
|
50
|
+
})
|
|
51
|
+
.refine((val) => {
|
|
52
|
+
if (!val)
|
|
53
|
+
return true;
|
|
54
|
+
if (!(val.spriteId && val.imageId) && (val.spriteId || val.imageId)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}, {
|
|
59
|
+
message: 'Only one of spriteId or imageId can be defined',
|
|
60
|
+
path: ['brand'],
|
|
61
|
+
});
|
|
34
62
|
const walletSchema = z
|
|
35
63
|
.preprocess((val) => val, z.object({
|
|
36
|
-
brand:
|
|
37
|
-
|
|
38
|
-
alt: nonEmptyString,
|
|
39
|
-
imageId: nonEmptyString,
|
|
40
|
-
primaryColor: nonEmptyString,
|
|
41
|
-
spriteId: nonEmptyString,
|
|
42
|
-
})
|
|
43
|
-
.optional()
|
|
44
|
-
.refine((val) => {
|
|
45
|
-
if (!val)
|
|
46
|
-
return true;
|
|
47
|
-
if (!(val.spriteId && val.imageId) &&
|
|
48
|
-
(val.spriteId || val.imageId)) {
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
return false;
|
|
52
|
-
}, {
|
|
53
|
-
message: 'Only one of spriteId or imageId can be defined',
|
|
54
|
-
path: ['brand'],
|
|
55
|
-
}),
|
|
64
|
+
brand: brandSchema.optional(),
|
|
65
|
+
chainGroup: z.string().optional(),
|
|
56
66
|
chains: z.array(z.string()).optional(),
|
|
57
67
|
desktop: z
|
|
58
68
|
.object({
|
|
@@ -69,6 +79,10 @@ const walletSchema = z
|
|
|
69
79
|
eip6963Config: z.object({ rdns: z.string() }).optional(),
|
|
70
80
|
filterFromWalletConnect: z.boolean().optional(),
|
|
71
81
|
group: z.string().optional(),
|
|
82
|
+
/**
|
|
83
|
+
* Indicates which hardware wallets are enabled for this wallet
|
|
84
|
+
*/
|
|
85
|
+
hardwareWallets: z.array(z.string()).optional(),
|
|
72
86
|
injectedConfig: z.array(injectedConfigSchema).optional(),
|
|
73
87
|
mobile: z
|
|
74
88
|
.object({
|
|
@@ -91,9 +105,13 @@ const walletSchema = z
|
|
|
91
105
|
})
|
|
92
106
|
.optional()
|
|
93
107
|
.transform(filterEmptyObject),
|
|
108
|
+
walletGroup: z.string().optional(),
|
|
94
109
|
}))
|
|
95
110
|
.transform((val) => {
|
|
96
111
|
var _a, _b, _c, _d, _e, _f;
|
|
112
|
+
if (val.group) {
|
|
113
|
+
val.chainGroup = val.group;
|
|
114
|
+
}
|
|
97
115
|
if (((_a = val.mobile) === null || _a === void 0 ? void 0 : _a.iosId) || ((_b = val.mobile) === null || _b === void 0 ? void 0 : _b.ios) === null) {
|
|
98
116
|
(_c = val.mobile) === null || _c === void 0 ? true : delete _c.ios;
|
|
99
117
|
}
|
|
@@ -103,4 +121,4 @@ const walletSchema = z
|
|
|
103
121
|
return val;
|
|
104
122
|
});
|
|
105
123
|
|
|
106
|
-
export { walletSchema };
|
|
124
|
+
export { brandSchema, walletSchema };
|