UNPKG

781 BTypeScriptView Raw
1/// <reference types="bn.js" />
2import type { U8aLike } from '../types.js';
3import { BN } from '../bn/index.js';
4/**
5 * @name compactFromU8a
6 * @description Retrives the offset and encoded length from a compact-prefixed value
7 * @example
8 * <BR>
9 *
10 * ```javascript
11 * import { compactFromU8a } from '@polkadot/util';
12 *
13 * const [offset, length] = compactFromU8a(new Uint8Array([254, 255, 3, 0]));
14 *
15 * console.log('value offset=', offset, 'length=', length); // 4, 0xffff
16 * ```
17 */
18export declare function compactFromU8a(input: U8aLike): [number, BN];
19/**
20 * @name compactFromU8aLim
21 * @description A limited version of [[compactFromU8a]], accepting only Uint8Array inputs for values <= 48 bits
22 */
23export declare function compactFromU8aLim(u8a: Uint8Array): [number, number];