Comparing version 0.9.0-canary.20230514T144422 to 0.9.0-canary.20230516T213152
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '0.9.0-canary.20230514T144422'; | ||
exports.version = '0.9.0-canary.20230516T213152'; | ||
//# sourceMappingURL=version.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SolidityTuple = exports.SolidityString = exports.SolidityInt = exports.SolidityFunction = exports.SolidityBytes = exports.SolidityBool = exports.SolidityArrayWithTuple = exports.SolidityArrayWithoutTuple = exports.SolidityArray = exports.SolidityAddress = exports.AbiStateMutability = exports.AbiReceive = exports.AbiParameter = exports.AbiItemType = exports.AbiFunction = exports.AbiFallback = exports.AbiError = exports.AbiEvent = exports.AbiConstructor = exports.Abi = void 0; | ||
exports.SolidityTuple = exports.SolidityString = exports.SolidityInt = exports.SolidityFunction = exports.SolidityBytes = exports.SolidityBool = exports.SolidityArrayWithTuple = exports.SolidityArrayWithoutTuple = exports.SolidityArray = exports.SolidityAddress = exports.AbiStateMutability = exports.AbiReceive = exports.AbiParameter = exports.AbiItemType = exports.AbiFunction = exports.AbiFallback = exports.AbiError = exports.AbiEventParameter = exports.AbiEvent = exports.AbiConstructor = exports.Abi = void 0; | ||
var zod_js_1 = require("./zod.js"); | ||
@@ -8,2 +8,3 @@ Object.defineProperty(exports, "Abi", { enumerable: true, get: function () { return zod_js_1.Abi; } }); | ||
Object.defineProperty(exports, "AbiEvent", { enumerable: true, get: function () { return zod_js_1.AbiEvent; } }); | ||
Object.defineProperty(exports, "AbiEventParameter", { enumerable: true, get: function () { return zod_js_1.AbiEventParameter; } }); | ||
Object.defineProperty(exports, "AbiError", { enumerable: true, get: function () { return zod_js_1.AbiError; } }); | ||
@@ -10,0 +11,0 @@ Object.defineProperty(exports, "AbiFallback", { enumerable: true, get: function () { return zod_js_1.AbiFallback; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Abi = exports.AbiItemType = exports.AbiError = exports.AbiEvent = exports.AbiReceive = exports.AbiFallback = exports.AbiConstructor = exports.AbiFunction = exports.AbiStateMutability = exports.AbiParameter = exports.SolidityArray = exports.SolidityArrayWithTuple = exports.SolidityArrayWithoutTuple = exports.SolidityInt = exports.SolidityTuple = exports.SolidityString = exports.SolidityFunction = exports.SolidityBytes = exports.SolidityBool = exports.SolidityAddress = void 0; | ||
exports.Abi = exports.AbiItemType = exports.AbiError = exports.AbiEvent = exports.AbiReceive = exports.AbiFallback = exports.AbiConstructor = exports.AbiFunction = exports.AbiStateMutability = exports.AbiEventParameter = exports.AbiParameter = exports.SolidityArray = exports.SolidityArrayWithTuple = exports.SolidityArrayWithoutTuple = exports.SolidityInt = exports.SolidityTuple = exports.SolidityString = exports.SolidityFunction = exports.SolidityBytes = exports.SolidityBool = exports.SolidityAddress = void 0; | ||
const zod_1 = require("zod"); | ||
@@ -43,2 +43,3 @@ const regex_js_1 = require("../regex.js"); | ||
]))); | ||
exports.AbiEventParameter = zod_1.z.intersection(exports.AbiParameter, zod_1.z.object({ indexed: zod_1.z.boolean().optional() })); | ||
exports.AbiStateMutability = zod_1.z.union([ | ||
@@ -108,3 +109,3 @@ zod_1.z.literal('pure'), | ||
anonymous: zod_1.z.boolean().optional(), | ||
inputs: zod_1.z.array(zod_1.z.intersection(exports.AbiParameter, zod_1.z.object({ indexed: zod_1.z.boolean().optional() }))), | ||
inputs: zod_1.z.array(exports.AbiEventParameter), | ||
name: zod_1.z.string(), | ||
@@ -111,0 +112,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
export const version = '0.9.0-canary.20230514T144422'; | ||
export const version = '0.9.0-canary.20230516T213152'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
export { Abi, AbiConstructor, AbiEvent, AbiError, AbiFallback, AbiFunction, AbiItemType, AbiParameter, AbiReceive, AbiStateMutability, SolidityAddress, SolidityArray, SolidityArrayWithoutTuple, SolidityArrayWithTuple, SolidityBool, SolidityBytes, SolidityFunction, SolidityInt, SolidityString, SolidityTuple, } from './zod.js'; | ||
export { Abi, AbiConstructor, AbiEvent, AbiEventParameter, AbiError, AbiFallback, AbiFunction, AbiItemType, AbiParameter, AbiReceive, AbiStateMutability, SolidityAddress, SolidityArray, SolidityArrayWithoutTuple, SolidityArrayWithTuple, SolidityBool, SolidityBytes, SolidityFunction, SolidityInt, SolidityString, SolidityTuple, } from './zod.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -40,2 +40,3 @@ import { z } from 'zod'; | ||
]))); | ||
export const AbiEventParameter = z.intersection(AbiParameter, z.object({ indexed: z.boolean().optional() })); | ||
export const AbiStateMutability = z.union([ | ||
@@ -105,3 +106,3 @@ z.literal('pure'), | ||
anonymous: z.boolean().optional(), | ||
inputs: z.array(z.intersection(AbiParameter, z.object({ indexed: z.boolean().optional() }))), | ||
inputs: z.array(AbiEventParameter), | ||
name: z.string(), | ||
@@ -108,0 +109,0 @@ }); |
@@ -39,2 +39,5 @@ import type { ResolvedConfig } from './config.js'; | ||
})>; | ||
export type AbiEventParameter = Prettify<AbiParameter & { | ||
indexed?: boolean | undefined; | ||
}>; | ||
/** | ||
@@ -102,5 +105,3 @@ * State mutability for {@link AbiFunction} | ||
anonymous?: boolean | undefined; | ||
inputs: readonly (AbiParameter & { | ||
indexed?: boolean; | ||
})[]; | ||
inputs: readonly AbiEventParameter[]; | ||
name: string; | ||
@@ -107,0 +108,0 @@ }; |
@@ -1,11 +0,10 @@ | ||
type BaseErrorArgs = { | ||
import type { OneOf, Prettify } from './types.js'; | ||
type BaseErrorArgs = Prettify<{ | ||
docsPath?: string | undefined; | ||
metaMessages?: string[] | undefined; | ||
} & ({ | ||
cause?: never | undefined; | ||
} & OneOf<{ | ||
details?: string | undefined; | ||
} | { | ||
cause?: BaseError | Error; | ||
details?: never | undefined; | ||
}); | ||
}>>; | ||
export declare class BaseError extends Error { | ||
@@ -12,0 +11,0 @@ details: string; |
@@ -1,2 +0,2 @@ | ||
export type { Abi, AbiConstructor, AbiError, AbiEvent, AbiFallback, AbiFunction, AbiInternalType, AbiItemType, AbiParameter, AbiParameterKind, AbiReceive, AbiStateMutability, AbiType, Address, SolidityAddress, SolidityArray, SolidityArrayWithoutTuple, SolidityArrayWithTuple, SolidityBool, SolidityBytes, SolidityFixedArrayRange, SolidityFixedArraySizeLookup, SolidityFunction, SolidityInt, SolidityString, SolidityTuple, TypedData, TypedDataDomain, TypedDataParameter, TypedDataType, } from './abi.js'; | ||
export type { Abi, AbiConstructor, AbiError, AbiEvent, AbiEventParameter, AbiFallback, AbiFunction, AbiInternalType, AbiItemType, AbiParameter, AbiParameterKind, AbiReceive, AbiStateMutability, AbiType, Address, SolidityAddress, SolidityArray, SolidityArrayWithoutTuple, SolidityArrayWithTuple, SolidityBool, SolidityBytes, SolidityFixedArrayRange, SolidityFixedArraySizeLookup, SolidityFunction, SolidityInt, SolidityString, SolidityTuple, TypedData, TypedDataDomain, TypedDataParameter, TypedDataType, } from './abi.js'; | ||
export type { Config, DefaultConfig, ResolvedConfig } from './config.js'; | ||
@@ -3,0 +3,0 @@ export { BaseError } from './errors.js'; |
@@ -52,4 +52,17 @@ /** | ||
/** | ||
* @description Combines members of an intersection into a readable type. | ||
* Makes objects destructurable. | ||
* | ||
* @param Union - Union to distribute. | ||
* | ||
* @example | ||
* type Result = OneOf<{ foo: boolean } | { bar: boolean }> | ||
* // ^? type Result = { foo: boolean; bar?: undefined; } | { bar: boolean; foo?: undefined; } | ||
*/ | ||
export type OneOf<Union extends object, AllKeys extends KeyofUnion<Union> = KeyofUnion<Union>> = Union extends infer Item ? Prettify<Item & { | ||
[K in Exclude<AllKeys, keyof Item>]?: never; | ||
}> : never; | ||
type KeyofUnion<T> = T extends T ? keyof T : never; | ||
/** | ||
* Combines members of an intersection into a readable type. | ||
* | ||
* @link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg | ||
@@ -76,3 +89,3 @@ * @example | ||
/** | ||
* @description Trims empty space from type T. | ||
* Trims empty space from type T. | ||
* | ||
@@ -91,3 +104,3 @@ * @param T - Type to trim | ||
/** | ||
* @description Create tuple of {@link Type} type with {@link Size} size | ||
* Create tuple of {@link Type} type with {@link Size} size | ||
* | ||
@@ -94,0 +107,0 @@ * @param Type - Type of tuple |
@@ -1,2 +0,2 @@ | ||
export declare const version = "0.9.0-canary.20230514T144422"; | ||
export declare const version = "0.9.0-canary.20230516T213152"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export { Abi, AbiConstructor, AbiEvent, AbiError, AbiFallback, AbiFunction, AbiItemType, AbiParameter, AbiReceive, AbiStateMutability, SolidityAddress, SolidityArray, SolidityArrayWithoutTuple, SolidityArrayWithTuple, SolidityBool, SolidityBytes, SolidityFunction, SolidityInt, SolidityString, SolidityTuple, } from './zod.js'; | ||
export { Abi, AbiConstructor, AbiEvent, AbiEventParameter, AbiError, AbiFallback, AbiFunction, AbiItemType, AbiParameter, AbiReceive, AbiStateMutability, SolidityAddress, SolidityArray, SolidityArrayWithoutTuple, SolidityArrayWithTuple, SolidityBool, SolidityBytes, SolidityFunction, SolidityInt, SolidityString, SolidityTuple, } from './zod.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -14,2 +14,9 @@ import { z } from 'zod'; | ||
export declare const AbiParameter: z.ZodType<AbiParameterType>; | ||
export declare const AbiEventParameter: z.ZodIntersection<z.ZodType<AbiParameterType, z.ZodTypeDef, AbiParameterType>, z.ZodObject<{ | ||
indexed: z.ZodOptional<z.ZodBoolean>; | ||
}, "strip", z.ZodTypeAny, { | ||
indexed?: boolean | undefined; | ||
}, { | ||
indexed?: boolean | undefined; | ||
}>>; | ||
export declare const AbiStateMutability: z.ZodUnion<[z.ZodLiteral<"pure">, z.ZodLiteral<"view">, z.ZodLiteral<"nonpayable">, z.ZodLiteral<"payable">]>; | ||
@@ -38,6 +45,6 @@ export declare const AbiFunction: z.ZodEffects<z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
type: "function"; | ||
name: string; | ||
inputs: AbiParameterType[]; | ||
outputs: AbiParameterType[]; | ||
type: "function"; | ||
name: string; | ||
stateMutability: "pure" | "view" | "nonpayable" | "payable"; | ||
@@ -48,6 +55,6 @@ constant?: boolean | undefined; | ||
}, { | ||
type: "function"; | ||
name: string; | ||
inputs: AbiParameterType[]; | ||
outputs: AbiParameterType[]; | ||
type: "function"; | ||
name: string; | ||
stateMutability: "pure" | "view" | "nonpayable" | "payable"; | ||
@@ -58,6 +65,6 @@ constant?: boolean | undefined; | ||
}>, { | ||
type: "function"; | ||
name: string; | ||
inputs: AbiParameterType[]; | ||
outputs: AbiParameterType[]; | ||
type: "function"; | ||
name: string; | ||
stateMutability: "pure" | "view" | "nonpayable" | "payable"; | ||
@@ -82,14 +89,14 @@ constant?: boolean | undefined; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "constructor"; | ||
inputs: AbiParameterType[]; | ||
type: "constructor"; | ||
stateMutability: "nonpayable" | "payable"; | ||
payable?: boolean | undefined; | ||
}, { | ||
type: "constructor"; | ||
inputs: AbiParameterType[]; | ||
type: "constructor"; | ||
stateMutability: "nonpayable" | "payable"; | ||
payable?: boolean | undefined; | ||
}>, { | ||
type: "constructor"; | ||
inputs: AbiParameterType[]; | ||
type: "constructor"; | ||
stateMutability: "nonpayable" | "payable"; | ||
@@ -149,14 +156,14 @@ payable?: boolean | undefined; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "event"; | ||
name: string; | ||
inputs: (AbiParameterType & { | ||
indexed?: boolean | undefined; | ||
})[]; | ||
anonymous?: boolean | undefined; | ||
}, { | ||
type: "event"; | ||
name: string; | ||
anonymous?: boolean | undefined; | ||
}, { | ||
inputs: (AbiParameterType & { | ||
indexed?: boolean | undefined; | ||
})[]; | ||
type: "event"; | ||
name: string; | ||
anonymous?: boolean | undefined; | ||
@@ -169,9 +176,9 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
inputs: AbiParameterType[]; | ||
type: "error"; | ||
name: string; | ||
inputs: AbiParameterType[]; | ||
}, { | ||
inputs: AbiParameterType[]; | ||
type: "error"; | ||
name: string; | ||
inputs: AbiParameterType[]; | ||
}>; | ||
@@ -190,9 +197,9 @@ export declare const AbiItemType: z.ZodUnion<[z.ZodLiteral<"constructor">, z.ZodLiteral<"event">, z.ZodLiteral<"error">, z.ZodLiteral<"fallback">, z.ZodLiteral<"function">, z.ZodLiteral<"receive">]>; | ||
}, "strip", z.ZodTypeAny, { | ||
inputs: AbiParameterType[]; | ||
type: "error"; | ||
name: string; | ||
inputs: AbiParameterType[]; | ||
}, { | ||
inputs: AbiParameterType[]; | ||
type: "error"; | ||
name: string; | ||
inputs: AbiParameterType[]; | ||
}>, z.ZodObject<{ | ||
@@ -210,14 +217,14 @@ type: z.ZodLiteral<"event">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "event"; | ||
name: string; | ||
inputs: (AbiParameterType & { | ||
indexed?: boolean | undefined; | ||
})[]; | ||
anonymous?: boolean | undefined; | ||
}, { | ||
type: "event"; | ||
name: string; | ||
anonymous?: boolean | undefined; | ||
}, { | ||
inputs: (AbiParameterType & { | ||
indexed?: boolean | undefined; | ||
})[]; | ||
type: "event"; | ||
name: string; | ||
anonymous?: boolean | undefined; | ||
@@ -257,11 +264,11 @@ }>, z.ZodEffects<z.ZodIntersection<z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
type: "function"; | ||
name: string; | ||
inputs: AbiParameterType[]; | ||
outputs: AbiParameterType[]; | ||
}, { | ||
type: "function"; | ||
name: string; | ||
}, { | ||
inputs: AbiParameterType[]; | ||
outputs: AbiParameterType[]; | ||
type: "function"; | ||
name: string; | ||
}>, z.ZodObject<{ | ||
@@ -271,7 +278,7 @@ type: z.ZodLiteral<"constructor">; | ||
}, "strip", z.ZodTypeAny, { | ||
type: "constructor"; | ||
inputs: AbiParameterType[]; | ||
}, { | ||
type: "constructor"; | ||
}, { | ||
inputs: AbiParameterType[]; | ||
type: "constructor"; | ||
}>, z.ZodObject<{ | ||
@@ -301,9 +308,9 @@ type: z.ZodLiteral<"fallback">; | ||
} & ({ | ||
type: "function"; | ||
name: string; | ||
inputs: AbiParameterType[]; | ||
outputs: AbiParameterType[]; | ||
type: "function"; | ||
name: string; | ||
} | { | ||
type: "constructor"; | ||
inputs: AbiParameterType[]; | ||
type: "constructor"; | ||
} | { | ||
@@ -310,0 +317,0 @@ type: "fallback"; |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "0.9.0-canary.20230514T144422", | ||
"version": "0.9.0-canary.20230516T213152", | ||
"files": [ | ||
@@ -16,0 +16,0 @@ "dist", |
@@ -113,2 +113,6 @@ import type { ResolvedConfig } from './config.js' | ||
export type AbiEventParameter = Prettify< | ||
AbiParameter & { indexed?: boolean | undefined } | ||
> | ||
/** | ||
@@ -182,3 +186,3 @@ * State mutability for {@link AbiFunction} | ||
anonymous?: boolean | undefined | ||
inputs: readonly (AbiParameter & { indexed?: boolean })[] | ||
inputs: readonly AbiEventParameter[] | ||
name: string | ||
@@ -185,0 +189,0 @@ } |
@@ -0,16 +1,10 @@ | ||
import type { OneOf, Prettify } from './types.js' | ||
import { version } from './version.js' | ||
type BaseErrorArgs = { | ||
docsPath?: string | undefined | ||
metaMessages?: string[] | undefined | ||
} & ( | ||
| { | ||
cause?: never | undefined | ||
details?: string | undefined | ||
} | ||
| { | ||
cause?: BaseError | Error | ||
details?: never | undefined | ||
} | ||
) | ||
type BaseErrorArgs = Prettify< | ||
{ | ||
docsPath?: string | undefined | ||
metaMessages?: string[] | undefined | ||
} & OneOf<{ details?: string | undefined } | { cause?: BaseError | Error }> | ||
> | ||
@@ -17,0 +11,0 @@ export class BaseError extends Error { |
@@ -6,2 +6,3 @@ export type { | ||
AbiEvent, | ||
AbiEventParameter, | ||
AbiFallback, | ||
@@ -8,0 +9,0 @@ AbiFunction, |
@@ -69,4 +69,21 @@ /** | ||
/** | ||
* @description Combines members of an intersection into a readable type. | ||
* Makes objects destructurable. | ||
* | ||
* @param Union - Union to distribute. | ||
* | ||
* @example | ||
* type Result = OneOf<{ foo: boolean } | { bar: boolean }> | ||
* // ^? type Result = { foo: boolean; bar?: undefined; } | { bar: boolean; foo?: undefined; } | ||
*/ | ||
export type OneOf< | ||
Union extends object, | ||
AllKeys extends KeyofUnion<Union> = KeyofUnion<Union>, | ||
> = Union extends infer Item | ||
? Prettify<Item & { [K in Exclude<AllKeys, keyof Item>]?: never }> | ||
: never | ||
type KeyofUnion<T> = T extends T ? keyof T : never | ||
/** | ||
* Combines members of an intersection into a readable type. | ||
* | ||
* @link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg | ||
@@ -112,3 +129,3 @@ * @example | ||
/** | ||
* @description Trims empty space from type T. | ||
* Trims empty space from type T. | ||
* | ||
@@ -135,3 +152,3 @@ * @param T - Type to trim | ||
/** | ||
* @description Create tuple of {@link Type} type with {@link Size} size | ||
* Create tuple of {@link Type} type with {@link Size} size | ||
* | ||
@@ -138,0 +155,0 @@ * @param Type - Type of tuple |
@@ -1,1 +0,1 @@ | ||
export const version = '0.9.0-canary.20230514T144422' | ||
export const version = '0.9.0-canary.20230516T213152' |
@@ -5,2 +5,3 @@ export { | ||
AbiEvent, | ||
AbiEventParameter, | ||
AbiError, | ||
@@ -7,0 +8,0 @@ AbiFallback, |
@@ -60,2 +60,7 @@ import { z } from 'zod' | ||
export const AbiEventParameter = z.intersection( | ||
AbiParameter, | ||
z.object({ indexed: z.boolean().optional() }), | ||
) | ||
export const AbiStateMutability = z.union([ | ||
@@ -163,5 +168,3 @@ z.literal('pure'), | ||
anonymous: z.boolean().optional(), | ||
inputs: z.array( | ||
z.intersection(AbiParameter, z.object({ indexed: z.boolean().optional() })), | ||
), | ||
inputs: z.array(AbiEventParameter), | ||
name: z.string(), | ||
@@ -168,0 +171,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1113289
22973