UNPKG

send-crypto

Version:

A minimal JavaScript library / wallet for sending crypto assets

38 lines (37 loc) 1.35 kB
/** * Remove 0x prefix from a hex string. If the input doesn't have a 0x prefix, * it's returned unchanged. * * @param hex The hex value to be prefixed. */ export declare const strip0x: (hex: string) => string; /** * Convert a Uint8Array to a hex string (with no "0x"-prefix). */ export declare const toHex: (array: Uint8Array) => string; /** * Add a 0x prefix to a hex value, converting to a string first. If the input * is already prefixed, it's returned unchanged. * * @param hexInput The hex value to be prefixed. */ export declare const Ox: (hexInput: Uint8Array | string | number, { prefix }?: { prefix: string; }) => string; /** * Convert a hex string to a Uint8Array. */ export declare const fromHex: (hexString: string) => Uint8Array; /** * https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array/12646864#12646864 * Randomize array element order in-place. * Using Durstenfeld shuffle algorithm. */ export declare const shuffleArray: <T>(...arrayIn: T[] | T[][]) => T[]; export declare const toUTF8String: (input: Uint8Array) => string; export declare const fromUTF8String: (input: string) => Uint8Array; /** * Convert a base64 string to a Uint8Array. */ export declare const fromBase64: (base64String: string) => Uint8Array; export declare const toBase64: (input: Uint8Array) => string;