Comparing version 0.8.5 to 0.8.6
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '0.8.5'; | ||
exports.version = '0.8.6'; | ||
//# 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.AbiEventParameter = 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.Address = 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"); | ||
@@ -16,2 +16,3 @@ Object.defineProperty(exports, "Abi", { enumerable: true, get: function () { return zod_js_1.Abi; } }); | ||
Object.defineProperty(exports, "AbiStateMutability", { enumerable: true, get: function () { return zod_js_1.AbiStateMutability; } }); | ||
Object.defineProperty(exports, "Address", { enumerable: true, get: function () { return zod_js_1.Address; } }); | ||
Object.defineProperty(exports, "SolidityAddress", { enumerable: true, get: function () { return zod_js_1.SolidityAddress; } }); | ||
@@ -18,0 +19,0 @@ Object.defineProperty(exports, "SolidityArray", { enumerable: true, get: function () { return zod_js_1.SolidityArray; } }); |
"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.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; | ||
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 = exports.Address = void 0; | ||
const zod_1 = require("zod"); | ||
const regex_js_1 = require("../regex.js"); | ||
exports.Address = zod_1.z.string().transform((val, ctx) => { | ||
const regex = /^0x[a-fA-F0-9]{40}$/; | ||
if (!regex.test(val)) { | ||
ctx.addIssue({ | ||
code: zod_1.z.ZodIssueCode.custom, | ||
message: `Invalid Address ${val}`, | ||
}); | ||
} | ||
return val; | ||
}); | ||
exports.SolidityAddress = zod_1.z.literal('address'); | ||
@@ -7,0 +17,0 @@ exports.SolidityBool = zod_1.z.literal('bool'); |
@@ -1,2 +0,2 @@ | ||
export const version = '0.8.5'; | ||
export const version = '0.8.6'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
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'; | ||
export { Abi, AbiConstructor, AbiEvent, AbiEventParameter, AbiError, AbiFallback, AbiFunction, AbiItemType, AbiParameter, AbiReceive, AbiStateMutability, Address, SolidityAddress, SolidityArray, SolidityArrayWithoutTuple, SolidityArrayWithTuple, SolidityBool, SolidityBytes, SolidityFunction, SolidityInt, SolidityString, SolidityTuple, } from './zod.js'; | ||
//# sourceMappingURL=index.js.map |
import { z } from 'zod'; | ||
import { bytesRegex, integerRegex } from '../regex.js'; | ||
export const Address = z.string().transform((val, ctx) => { | ||
const regex = /^0x[a-fA-F0-9]{40}$/; | ||
if (!regex.test(val)) { | ||
ctx.addIssue({ | ||
code: z.ZodIssueCode.custom, | ||
message: `Invalid Address ${val}`, | ||
}); | ||
} | ||
return val; | ||
}); | ||
export const SolidityAddress = z.literal('address'); | ||
@@ -4,0 +14,0 @@ export const SolidityBool = z.literal('bool'); |
@@ -1,2 +0,2 @@ | ||
export declare const version = "0.8.5"; | ||
export declare const version = "0.8.6"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
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'; | ||
export { Abi, AbiConstructor, AbiEvent, AbiEventParameter, AbiError, AbiFallback, AbiFunction, AbiItemType, AbiParameter, AbiReceive, AbiStateMutability, Address, SolidityAddress, SolidityArray, SolidityArrayWithoutTuple, SolidityArrayWithTuple, SolidityBool, SolidityBytes, SolidityFunction, SolidityInt, SolidityString, SolidityTuple, } from './zod.js'; | ||
//# sourceMappingURL=index.d.ts.map |
import { z } from 'zod'; | ||
import type { AbiParameter as AbiParameterType } from '../abi.js'; | ||
export declare const Address: z.ZodEffects<z.ZodString, `0x${string}`, string>; | ||
export declare const SolidityAddress: z.ZodLiteral<"address">; | ||
@@ -4,0 +5,0 @@ export declare const SolidityBool: z.ZodLiteral<"bool">; |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "0.8.5", | ||
"version": "0.8.6", | ||
"files": [ | ||
@@ -16,0 +16,0 @@ "dist", |
@@ -1,1 +0,1 @@ | ||
export const version = '0.8.5' | ||
export const version = '0.8.6' |
@@ -13,2 +13,3 @@ export { | ||
AbiStateMutability, | ||
Address, | ||
SolidityAddress, | ||
@@ -15,0 +16,0 @@ SolidityArray, |
@@ -9,5 +9,19 @@ import { z } from 'zod' | ||
AbiReceive as AbiReceiveType, | ||
Address as AddressType, | ||
} from '../abi.js' | ||
import { bytesRegex, integerRegex } from '../regex.js' | ||
export const Address = z.string().transform((val, ctx) => { | ||
const regex = /^0x[a-fA-F0-9]{40}$/ | ||
if (!regex.test(val)) { | ||
ctx.addIssue({ | ||
code: z.ZodIssueCode.custom, | ||
message: `Invalid Address ${val}`, | ||
}) | ||
} | ||
return val as AddressType | ||
}) | ||
// From https://docs.soliditylang.org/en/latest/abi-spec.html#types | ||
@@ -14,0 +28,0 @@ export const SolidityAddress = z.literal('address') |
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
1118690
23035