Skip to content

Commit 74bbdd2

Browse files
nit: no empty strings in schema
1 parent 8d13799 commit 74bbdd2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/connector/src/config/schemas.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,24 @@ export const walletSchema = z.custom<import('@wallet-standard/base').Wallet>(
143143
{ message: 'Invalid Wallet Standard wallet object' },
144144
);
145145

146+
/**
147+
* Non-empty trimmed string schema for wallet names.
148+
* Trims whitespace and rejects empty strings.
149+
*/
150+
const nonEmptyTrimmedStringSchema = z
151+
.string()
152+
.transform(s => s.trim())
153+
.refine(s => s.length > 0, { message: 'Wallet name cannot be empty or whitespace-only' });
154+
146155
/**
147156
* Wallet list controls for Wallet Standard auto-discovery.
148157
* Matches by wallet display name (case-insensitive, exact match after trimming).
149158
*/
150159
export const walletDisplayConfigSchema = z
151160
.object({
152-
allowList: z.array(z.string()).optional(),
153-
denyList: z.array(z.string()).optional(),
154-
featured: z.array(z.string()).optional(),
161+
allowList: z.array(nonEmptyTrimmedStringSchema).optional(),
162+
denyList: z.array(nonEmptyTrimmedStringSchema).optional(),
163+
featured: z.array(nonEmptyTrimmedStringSchema).optional(),
155164
})
156165
.optional();
157166

0 commit comments

Comments
 (0)