UNPKG

544 BTypeScriptView Raw
1/// <reference types="bn.js" />
2import type { U8aLike } from '../types';
3import { BN } from '../bn';
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];