ox
Version:
Ethereum Standard Library
33 lines • 1.19 kB
TypeScript
/** @internal */
export declare const length = 42;
/**
* Combined shape + lowercase classification for an Ethereum address string.
* Avoids the regex / try-catch / error-allocation overhead in the hot path
* and avoids a second pass for callers that need both pieces of metadata
* (e.g. strict validation).
*
* - `0` = invalid shape (not `0x[0-9a-fA-F]{40}`)
* - `1` = valid shape, all-lowercase hex body (no checksum to verify)
* - `2` = valid shape, contains at least one `A-F` upper char
*
* @internal
*/
export declare function classify(value: string): 0 | 1 | 2;
/**
* Manual ASCII shape check for an Ethereum address string. Returns `true`
* when `value` has the shape `0x[0-9a-fA-F]{40}`. Does not verify checksum
* casing.
*
* @internal
*/
export declare function hasShape(value: string): boolean;
/**
* Returns the canonical lowercase form of a shape-validated address, or the
* input unchanged when it is already all-lowercase. Pre-condition: caller has
* already verified the string is shape-valid via {@link hasShape} or
* {@link classify}.
*
* @internal
*/
export declare function lowercase(value: string): string;
//# sourceMappingURL=address.d.ts.map