@dfinity/utils
Version:
A collection of utilities and constants for NNS/SNS projects.
23 lines (22 loc) • 1.2 kB
TypeScript
export declare const uint8ArrayToBigInt: (array: Uint8Array) => bigint;
export declare const bigIntToUint8Array: (value: bigint) => Uint8Array;
export declare const numberToUint8Array: (value: number) => Uint8Array;
export declare const arrayBufferToUint8Array: (buffer: ArrayBuffer) => Uint8Array;
export declare const uint8ArrayToArrayOfNumber: (array: Uint8Array) => Array<number>;
export declare const arrayOfNumberToUint8Array: (numbers: Array<number>) => Uint8Array;
export declare const asciiStringToByteArray: (text: string) => Array<number>;
export declare const hexStringToUint8Array: (hexString: string) => Uint8Array;
/**
* Compare two Uint8Arrays for byte-level equality.
*
* @param {Object} params
* @param {Uint8Array} params.a - First Uint8Array to compare.
* @param {Uint8Array} params.b - Second Uint8Array to compare.
* @returns {boolean} True if both arrays have the same length and identical contents.
*/
export declare const uint8ArraysEqual: ({ a, b }: {
a: Uint8Array;
b: Uint8Array;
}) => boolean;
export declare const uint8ArrayToHexString: (bytes: Uint8Array | number[]) => string;
export declare const candidNumberArrayToBigInt: (array: number[]) => bigint;