@snickerdoodlelabs/common-utils
Version:
Common utils classes used in snickerdoodlelabs projects
22 lines • 1.31 kB
TypeScript
import { EContractStandard } from "@snickerdoodlelabs/objects";
export declare class ValidationUtils {
static isString(value: unknown): value is string;
static isNumber(value: unknown): value is number;
static isNonNegativeNumber(value: unknown): boolean;
static isNonNegativeHexOrNumberString(value: unknown): boolean;
/**
* Checks if the provided Ethereum timestamp is valid.
* The Ethereum blockchain's genesis block is marked with a timestamp of 0,
* which corresponds to the Unix epoch in 1970.
* However, Ethereum was officially launched in 2015, making this timestamp, funny.
* To consider valid Ethereum timestamps, we will accept from 2015, but we will also accept genesis.
*
* @param {number | null} timestamp - The Ethereum timestamp to check.
* @returns {number | null} Returns the timestamp if it happened after 2015 Jan or is 0, otherwise returns null.
*/ static checkValidEVMTimestamp(timestamp: number | null): number | null;
static isValidHex(value: string, length?: number): boolean;
static hexOrNumberStringToNumber(value: string): number | null;
static isValidEthereumAddress(address: string): boolean;
static stringToTokenStandard(value: string): EContractStandard;
}
//# sourceMappingURL=ValidationUtils.d.ts.map