@gearbox-protocol/cli-utils 5.36.12 → 5.36.13
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
export declare const boolLike: z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>;
|
|
3
|
-
export declare const stringArrayLike: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>;
|
|
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>>;
|
|
2
|
+
export declare const boolLike: () => z.ZodPipe<z.ZodAny, z.ZodTransform<boolean, any>>;
|
|
3
|
+
export declare const stringArrayLike: () => z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>]>;
|
|
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
6
|
* Like Address from abitype/zod, but converts an address into an address that is checksum encoded.
|
|
7
7
|
*/
|
|
8
|
-
export declare const addressLike: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
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>>>>;
|
|
10
|
-
export declare const optionalAddressArrayLike: z.ZodPipe<z.ZodOptional<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>>>>>, z.ZodTransform<`0x${string}`[] | undefined, `0x${string}`[] | undefined>>;
|
|
8
|
+
export declare const addressLike: () => z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
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>>>>;
|
|
10
|
+
export declare const optionalAddressArrayLike: () => z.ZodPipe<z.ZodOptional<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>>>>>, z.ZodTransform<`0x${string}`[] | undefined, `0x${string}`[] | undefined>>;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import { getAddress, isAddress } from "viem";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
|
-
export const boolLike = z.any().transform(v => {
|
|
3
|
+
export const boolLike = () => z.any().transform(v => {
|
|
4
4
|
if (typeof v === "string") {
|
|
5
5
|
return ["true", "1"].includes(v.toLowerCase());
|
|
6
6
|
}
|
|
7
7
|
return Boolean(v);
|
|
8
8
|
});
|
|
9
|
-
export const stringArrayLike = z.union([
|
|
10
|
-
|
|
11
|
-
z.string().transform(val => val.split(",")),
|
|
12
|
-
]);
|
|
13
|
-
export const optionalStringArrayLike = stringArrayLike
|
|
9
|
+
export const stringArrayLike = () => z.union([z.array(z.string()), z.string().transform(val => val.split(","))]);
|
|
10
|
+
export const optionalStringArrayLike = () => stringArrayLike()
|
|
14
11
|
.optional()
|
|
15
12
|
.transform(v => (v?.length ? v : undefined));
|
|
16
13
|
/**
|
|
17
14
|
* Like Address from abitype/zod, but converts an address into an address that is checksum encoded.
|
|
18
15
|
*/
|
|
19
|
-
export const addressLike = z.string().transform((val, ctx) => {
|
|
16
|
+
export const addressLike = () => z.string().transform((val, ctx) => {
|
|
20
17
|
if (!isAddress(val)) {
|
|
21
18
|
ctx.issues.push({
|
|
22
19
|
code: "custom",
|
|
@@ -26,8 +23,8 @@ export const addressLike = z.string().transform((val, ctx) => {
|
|
|
26
23
|
}
|
|
27
24
|
return getAddress(val);
|
|
28
25
|
});
|
|
29
|
-
export const addressArrayLike = stringArrayLike.pipe(z.array(addressLike));
|
|
30
|
-
export const optionalAddressArrayLike = stringArrayLike
|
|
31
|
-
.pipe(z.array(addressLike))
|
|
26
|
+
export const addressArrayLike = () => stringArrayLike().pipe(z.array(addressLike()));
|
|
27
|
+
export const optionalAddressArrayLike = () => stringArrayLike()
|
|
28
|
+
.pipe(z.array(addressLike()))
|
|
32
29
|
.optional()
|
|
33
30
|
.transform(v => (v?.length ? v : undefined));
|