55 lines
2.1 KiB
TypeScript
55 lines
2.1 KiB
TypeScript
/// <reference types="node" />
|
|
/**
|
|
* Pads the front of the given hex string with zeroes until it reaches the
|
|
* target length. If the input string is already longer than or equal to the
|
|
* target length, it is returned unmodified.
|
|
*
|
|
* If the input string is "0x"-prefixed or not a hex string, an error will be
|
|
* thrown.
|
|
*
|
|
* @param hexString - The hexadecimal string to pad with zeroes.
|
|
* @param targetLength - The target length of the hexadecimal string.
|
|
* @returns The input string front-padded with zeroes, or the original string
|
|
* if it was already greater than or equal to to the target length.
|
|
*/
|
|
export declare function padWithZeroes(hexString: string, targetLength: number): string;
|
|
/**
|
|
* Returns `true` if the given value is nullish.
|
|
*
|
|
* @param value - The value being checked.
|
|
* @returns Whether the value is nullish.
|
|
*/
|
|
export declare function isNullish(value: any): boolean;
|
|
/**
|
|
* Convert a value to a Buffer. This function should be equivalent to the `toBuffer` function in
|
|
* `ethereumjs-util@5.2.1`.
|
|
*
|
|
* @param value - The value to convert to a Buffer.
|
|
* @returns The given value as a Buffer.
|
|
*/
|
|
export declare function legacyToBuffer(value: unknown): Buffer;
|
|
/**
|
|
* Concatenate an extended ECDSA signature into a single '0x'-prefixed hex string.
|
|
*
|
|
* @param v - The 'v' portion of the signature.
|
|
* @param r - The 'r' portion of the signature.
|
|
* @param s - The 's' portion of the signature.
|
|
* @returns The concatenated ECDSA signature as a '0x'-prefixed string.
|
|
*/
|
|
export declare function concatSig(v: Buffer, r: Buffer, s: Buffer): string;
|
|
/**
|
|
* Recover the public key from the given signature and message hash.
|
|
*
|
|
* @param messageHash - The hash of the signed message.
|
|
* @param signature - The signature.
|
|
* @returns The public key of the signer.
|
|
*/
|
|
export declare function recoverPublicKey(messageHash: Buffer, signature: string): Buffer;
|
|
/**
|
|
* Normalize the input to a lower-cased '0x'-prefixed hex string.
|
|
*
|
|
* @param input - The value to normalize.
|
|
* @returns The normalized value.
|
|
*/
|
|
export declare function normalize(input: number | string): string;
|