@gearbox-protocol/cli-utils 5.36.10 → 5.36.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.
@@ -3,7 +3,7 @@ export declare const boolLike: z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>
3
3
  export declare const stringArrayLike: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>;
4
4
  export declare const optionalStringArrayLike: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>>, z.ZodTransform<string[] | undefined, string[] | undefined>>;
5
5
  /**
6
- * Like Address from abitype/zod, but for zod/v4
6
+ * Like Address from abitype/zod, but converts an address into an address that is checksum encoded.
7
7
  */
8
8
  export declare const addressLike: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
9
9
  export declare const addressArrayLike: z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>, z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
@@ -1,3 +1,4 @@
1
+ import { getAddress, isAddress } from "viem";
1
2
  import { z } from "zod/v4";
2
3
  export const boolLike = z.any().transform(v => {
3
4
  if (typeof v === "string") {
@@ -13,18 +14,17 @@ export const optionalStringArrayLike = stringArrayLike
13
14
  .optional()
14
15
  .transform(v => (v?.length ? v : undefined));
15
16
  /**
16
- * Like Address from abitype/zod, but for zod/v4
17
+ * Like Address from abitype/zod, but converts an address into an address that is checksum encoded.
17
18
  */
18
19
  export const addressLike = z.string().transform((val, ctx) => {
19
- const regex = /^0x[a-fA-F0-9]{40}$/;
20
- if (!regex.test(val)) {
20
+ if (!isAddress(val)) {
21
21
  ctx.issues.push({
22
22
  code: "custom",
23
23
  message: `invalid address ${val}`,
24
24
  input: ctx.value,
25
25
  });
26
26
  }
27
- return val;
27
+ return getAddress(val);
28
28
  });
29
29
  export const addressArrayLike = stringArrayLike.pipe(z.array(addressLike));
30
30
  export const optionalAddressArrayLike = stringArrayLike
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/cli-utils",
3
3
  "description": "Utils for creating cli apps",
4
- "version": "5.36.10",
4
+ "version": "5.36.11",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"