import { P2P } from '@shardeum-foundation/lib-types';
import { Ordering } from '..';
import { Response } from 'express-serve-static-core';
import { NodeWithRank } from '../../shardus/shardus-types';
/**
 * Checks if the input string is a valid IPv4 address
 */
export declare const isValidIPv4: (ip: string) => boolean;
/**
 * this helper replacer is lossy and only for logging
 * @param _key
 * @param value
 * @returns
 */
export declare const appdata_replacer: <T, K, V>(_key: any, value: T | Map<K, V>) => string | T | {
    dataType: 'stringifyReduce_map_2_array';
    value: [K, V][];
};
export declare const deepCopy: <T>(obj: T) => T;
export declare const mod: (n: any, m: any) => number;
/**
 * lerp from v0 to v1 by a
 * @param v0 the start value
 * @param v1 the end value
 * @param a the amount to lerp by (0-1) 0 being v0 and 1 being v1. 0.5 being halfway between v0 and v1
 * @returns
 */
export declare const lerp: (v0: number, v1: number, a: number) => number;
export declare function propComparator<T>(prop: keyof T): (a: T, b: T) => Ordering;
export declare function propComparator2<T>(prop: keyof T, prop2: keyof T): (a: T, b: T) => Ordering;
export declare const XOR: (hexString1: any, hexString2: any) => number;
export declare const getClosestHash: (targetHash: any, hashes: any) => string;
export declare const makeShortHash: (x: any, n?: number) => string;
/**
 * short
 * grab the first n (default=4) hex bytes of a string (4 bytes == 8 char hex string)
 * @param x
 * @param n
 */
export declare const short: (x: string, n?: number) => string;
export declare const debugExpand: (value: string) => string;
export declare const selectNeighbors: (array: any[], ourIndex: number, neighborsOnEachSide: number) => any[];
export declare function validateTypes(inp: any, def: any): string;
export declare function errorToStringFull(error: any): string;
export declare function sumObject(sumObject: any, toAddObject: any): void;
export declare function generateObjectSchema(obj: any, options?: {
    arrTypeDiversity: boolean;
}): object;
export declare function generateArraySchema(arr: unknown[], options?: {
    diversity: boolean;
}): string;
export declare function compareObjectShape(idol: any, admirer: any): {
    isValid: true;
    error?: {
        defectoChain: string[];
        defectiveChain: Array<string>;
    };
};
export declare function humanFileSize(size: number): string;
export declare function fastIsPicked(ourIndex: number, groupSize: number, numToPick: number, offset?: number): boolean;
/**
 * Returns a random index based on a hash and group size.
 * This is useful for picking a random index from a group of nodes based on txId or similar,
 * to ensure all nodes in the group pick the same index.
 * @param groupSize
 * @param hash
 */
export declare function pickIndexBasedOnHash(groupSize: number, hash: string): number;
export declare function getIndexesPicked(groupSize: number, numToPick: number, offset?: number): number[];
export declare function selectIndexesWithOffeset(arraySize: number, numberToPick: number, offset: number): number[];
/**
 * Try to print a variety of possible erros for debug purposes
 * @param err
 * @param printStack
 * @returns
 */
export declare function formatErrorMessage(err: unknown, printStack?: boolean): string;
/**
 * checks if a hex-string is a valid shardus address by
 * checking if it's 64 chars long & 32-bytes in size
 */
export declare function isValidShardusAddress(hexStrings: string[]): boolean;
export declare function logNode(node: P2P.NodeListTypes.Node | NodeWithRank): string;
/**
 * Equivalent to .json() but gets the size for us
 * @param res
 * @param obj
 * @returns
 */
export declare function jsonHttpResWithSize(res: Response<unknown, Record<string, unknown>, number>, obj: object): number;
/**
 * Returns a string for the given object, using the given keys, usually for logging and debugging purposes.
 * Keys can be null or undefined, in which case all keys are used.
 * Keys can be a single string of comma- or space-separated keys.
 * Keys can be an array of keys.
 * If the object is an array, the keys are applied to each element of the array.
 * Do not pass in data with circular references.
 * Does not throw exceptions which would be bad for logging, but instead returns a string with the exception info.
 * Examples:
 * stringForKeys(node, 'publicKey ip host')
 * stringForKeys(nodelist, 'publicKey ip host')
 */
export declare function stringForKeys(obj: unknown, keys?: ArrayLike<string> | string | null): string;
export declare function getPrefixInt(hexAddress: string, length?: number): number;
/**
 * test once at the given probability to fail.  If it fails, log the message and return true.  If it doesnt fail, return false.
 * @param failChance
 * @param debugName
 * @param key
 * @param message
 * @param verboseRequired
 * @returns
 */
export declare function testFailChance(failChance: number, debugName: string, key: string, message: string, verboseRequired: boolean): boolean;
