Socket
Socket
Sign inDemoInstall

web3-validator

Package Overview
Dependencies
Maintainers
5
Versions
325
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-validator - npm Package Compare versions

Comparing version 2.0.7-dev.32c8cc8.0 to 2.0.7-dev.376f192.0

24

lib/commonjs/types.d.ts
import { AbiParameter } from 'web3-types';
import { ZodIssueBase } from 'zod';
export type ValidInputTypes = Uint8Array | bigint | string | number | boolean;
export type EthBaseTypes = 'bool' | 'bytes' | 'string' | 'uint' | 'int' | 'address' | 'tuple';
export type EthBaseTypesWithMeta = `string${string}` | `string${string}[${number}]` | `bytes${string}` | `bytes${string}[${number}]` | `address[${number}]` | `bool[${number}]` | `int${string}` | `int${string}[${number}]` | `uint${string}` | `uint${string}[${number}]` | `tuple[]` | `tuple[${number}]`;
export type EthExtendedTypes = 'hex' | 'number' | 'blockNumber' | 'blockNumberOrTag' | 'filter' | 'bloom';
export type FullValidationSchema = ReadonlyArray<AbiParameter>;
export type ShortValidationSchema = ReadonlyArray<string | EthBaseTypes | EthExtendedTypes | EthBaseTypesWithMeta | ShortValidationSchema>;
export type ValidationSchemaInput = FullValidationSchema | ShortValidationSchema;
export type Web3ValidationOptions = {
export declare type ValidInputTypes = Uint8Array | bigint | string | number | boolean;
export declare type EthBaseTypes = 'bool' | 'bytes' | 'string' | 'uint' | 'int' | 'address' | 'tuple';
export declare type EthBaseTypesWithMeta = `string${string}` | `string${string}[${number}]` | `bytes${string}` | `bytes${string}[${number}]` | `address[${number}]` | `bool[${number}]` | `int${string}` | `int${string}[${number}]` | `uint${string}` | `uint${string}[${number}]` | `tuple[]` | `tuple[${number}]`;
export declare type EthExtendedTypes = 'hex' | 'number' | 'blockNumber' | 'blockNumberOrTag' | 'filter' | 'bloom';
export declare type FullValidationSchema = ReadonlyArray<AbiParameter>;
export declare type ShortValidationSchema = ReadonlyArray<string | EthBaseTypes | EthExtendedTypes | EthBaseTypesWithMeta | ShortValidationSchema>;
export declare type ValidationSchemaInput = FullValidationSchema | ShortValidationSchema;
export declare type Web3ValidationOptions = {
readonly silent: boolean;
};
export type Json = string | number | boolean | Array<Json> | {
export declare type Json = string | number | boolean | Array<Json> | {
[id: string]: Json;
};
export type ValidationError = ZodIssueBase;
export declare type ValidationError = ZodIssueBase;
export interface Validate {

@@ -21,3 +21,3 @@ (value: Json): boolean;

}
export type Schema = {
export declare type Schema = {
$schema?: string;

@@ -106,2 +106,2 @@ $vocabulary?: string;

};
export type JsonSchema = Schema;
export declare type JsonSchema = Schema;
import { FullValidationSchema, ShortValidationSchema, ValidationSchemaInput, ValidInputTypes } from './types.js';
export declare const parseBaseType: <T = string>(type: string) => {
baseType?: T;
baseType?: T | undefined;
baseTypeSize: number | undefined;

@@ -5,0 +5,0 @@ arraySizes: number[];

@@ -19,6 +19,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.padLeft = exports.numberToHex = exports.hexToNumber = exports.codePointToInt = exports.transformJsonDataToAbiFormat = exports.fetchArrayElement = exports.ethAbiToJsonSchema = exports.abiSchemaToJsonSchema = exports.parseBaseType = void 0;
exports.uint8ArrayToHexString = uint8ArrayToHexString;
exports.hexToUint8Array = hexToUint8Array;
exports.ensureIfUint8Array = ensureIfUint8Array;
exports.ensureIfUint8Array = exports.hexToUint8Array = exports.uint8ArrayToHexString = exports.padLeft = exports.numberToHex = exports.hexToNumber = exports.codePointToInt = exports.transformJsonDataToAbiFormat = exports.fetchArrayElement = exports.ethAbiToJsonSchema = exports.abiSchemaToJsonSchema = exports.parseBaseType = void 0;
const web3_errors_1 = require("web3-errors");

@@ -354,2 +351,3 @@ const constants_js_1 = require("./constants.js");

}
exports.uint8ArrayToHexString = uint8ArrayToHexString;
// for optimized technique for hex to bytes conversion

@@ -395,2 +393,3 @@ const charCodeMap = {

}
exports.hexToUint8Array = hexToUint8Array;
// @TODO: Remove this function and its usages once all sub dependencies uses version 1.3.3 or above of @noble/hashes

@@ -405,2 +404,3 @@ function ensureIfUint8Array(data) {

}
exports.ensureIfUint8Array = ensureIfUint8Array;
//# sourceMappingURL=utils.js.map

@@ -1,2 +0,2 @@

export declare const isNullish: (item: unknown) => item is undefined | null;
export declare const isNullish: (item: unknown) => item is null | undefined;
export declare const isObject: (item: unknown) => item is Record<string, unknown>;

@@ -5,3 +5,3 @@ import { ValidInputTypes } from '../types.js';

*/
export declare const isString: (value: ValidInputTypes) => value is string;
export declare const isString: (value: ValidInputTypes) => boolean;
export declare const isHexStrict: (hex: ValidInputTypes) => boolean;

@@ -8,0 +8,0 @@ /**

@@ -19,5 +19,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.validateNoLeadingZeroes = exports.isHexString32Bytes = exports.isHexString8Bytes = exports.isHex = exports.isHexStrict = exports.isString = void 0;
exports.isHexString = isHexString;
exports.isHexPrefixed = isHexPrefixed;
exports.validateNoLeadingZeroes = exports.isHexPrefixed = exports.isHexString32Bytes = exports.isHexString8Bytes = exports.isHex = exports.isHexString = exports.isHexStrict = exports.isString = void 0;
/**

@@ -44,2 +42,3 @@ * checks input if typeof data is valid string input

}
exports.isHexString = isHexString;
const isHex = (hex) => typeof hex === 'number' ||

@@ -65,2 +64,3 @@ typeof hex === 'bigint' ||

}
exports.isHexPrefixed = isHexPrefixed;
/**

@@ -67,0 +67,0 @@ * Checks provided Uint8Array for leading zeroes and throws if found.

@@ -8,4 +8,4 @@ import { Web3ValidationErrorObject } from 'web3-types';

silent?: boolean;
}): Web3ValidationErrorObject[] | undefined;
}): Web3ValidationErrorObject<string, Record<string, any>, unknown>[] | undefined;
private convertErrors;
}
import { AbiParameter } from 'web3-types';
import { ZodIssueBase } from 'zod';
export type ValidInputTypes = Uint8Array | bigint | string | number | boolean;
export type EthBaseTypes = 'bool' | 'bytes' | 'string' | 'uint' | 'int' | 'address' | 'tuple';
export type EthBaseTypesWithMeta = `string${string}` | `string${string}[${number}]` | `bytes${string}` | `bytes${string}[${number}]` | `address[${number}]` | `bool[${number}]` | `int${string}` | `int${string}[${number}]` | `uint${string}` | `uint${string}[${number}]` | `tuple[]` | `tuple[${number}]`;
export type EthExtendedTypes = 'hex' | 'number' | 'blockNumber' | 'blockNumberOrTag' | 'filter' | 'bloom';
export type FullValidationSchema = ReadonlyArray<AbiParameter>;
export type ShortValidationSchema = ReadonlyArray<string | EthBaseTypes | EthExtendedTypes | EthBaseTypesWithMeta | ShortValidationSchema>;
export type ValidationSchemaInput = FullValidationSchema | ShortValidationSchema;
export type Web3ValidationOptions = {
export declare type ValidInputTypes = Uint8Array | bigint | string | number | boolean;
export declare type EthBaseTypes = 'bool' | 'bytes' | 'string' | 'uint' | 'int' | 'address' | 'tuple';
export declare type EthBaseTypesWithMeta = `string${string}` | `string${string}[${number}]` | `bytes${string}` | `bytes${string}[${number}]` | `address[${number}]` | `bool[${number}]` | `int${string}` | `int${string}[${number}]` | `uint${string}` | `uint${string}[${number}]` | `tuple[]` | `tuple[${number}]`;
export declare type EthExtendedTypes = 'hex' | 'number' | 'blockNumber' | 'blockNumberOrTag' | 'filter' | 'bloom';
export declare type FullValidationSchema = ReadonlyArray<AbiParameter>;
export declare type ShortValidationSchema = ReadonlyArray<string | EthBaseTypes | EthExtendedTypes | EthBaseTypesWithMeta | ShortValidationSchema>;
export declare type ValidationSchemaInput = FullValidationSchema | ShortValidationSchema;
export declare type Web3ValidationOptions = {
readonly silent: boolean;
};
export type Json = string | number | boolean | Array<Json> | {
export declare type Json = string | number | boolean | Array<Json> | {
[id: string]: Json;
};
export type ValidationError = ZodIssueBase;
export declare type ValidationError = ZodIssueBase;
export interface Validate {

@@ -21,3 +21,3 @@ (value: Json): boolean;

}
export type Schema = {
export declare type Schema = {
$schema?: string;

@@ -106,3 +106,3 @@ $vocabulary?: string;

};
export type JsonSchema = Schema;
export declare type JsonSchema = Schema;
//# sourceMappingURL=types.d.ts.map
import { FullValidationSchema, ShortValidationSchema, ValidationSchemaInput, ValidInputTypes } from './types.js';
export declare const parseBaseType: <T = string>(type: string) => {
baseType?: T;
baseType?: T | undefined;
baseTypeSize: number | undefined;

@@ -5,0 +5,0 @@ arraySizes: number[];

@@ -1,3 +0,3 @@

export declare const isNullish: (item: unknown) => item is undefined | null;
export declare const isNullish: (item: unknown) => item is null | undefined;
export declare const isObject: (item: unknown) => item is Record<string, unknown>;
//# sourceMappingURL=object.d.ts.map

@@ -5,3 +5,3 @@ import { ValidInputTypes } from '../types.js';

*/
export declare const isString: (value: ValidInputTypes) => value is string;
export declare const isString: (value: ValidInputTypes) => boolean;
export declare const isHexStrict: (hex: ValidInputTypes) => boolean;

@@ -8,0 +8,0 @@ /**

@@ -8,5 +8,5 @@ import { Web3ValidationErrorObject } from 'web3-types';

silent?: boolean;
}): Web3ValidationErrorObject[] | undefined;
}): Web3ValidationErrorObject<string, Record<string, any>, unknown>[] | undefined;
private convertErrors;
}
//# sourceMappingURL=validator.d.ts.map
{
"name": "web3-validator",
"version": "2.0.7-dev.32c8cc8.0+32c8cc8",
"version": "2.0.7-dev.376f192.0+376f192",
"description": "JSON-Schema compatible validator for web3",

@@ -49,4 +49,4 @@ "main": "./lib/commonjs/index.js",

"util": "^0.12.5",
"web3-errors": "1.3.1-dev.32c8cc8.0+32c8cc8",
"web3-types": "1.8.1-dev.32c8cc8.0+32c8cc8",
"web3-errors": "1.3.1-dev.376f192.0+376f192",
"web3-types": "1.8.2-dev.376f192.0+376f192",
"zod": "^3.21.4"

@@ -66,5 +66,5 @@ },

"ts-jest": "^29.1.1",
"typescript": "^5.5.4"
"typescript": "^4.7.4"
},
"gitHead": "32c8cc8cc8cdf0dc6c2e331b6463bccef37c3ce6"
"gitHead": "376f19259deae5424ccc8274f2d7c978456905e0"
}

Sorry, the diff of this file is too big to display

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc