UNPKG

1.89 kBTypeScriptView Raw
1import type { Inspect, Registry } from '@polkadot/types-codec/types';
2import type { BN } from '@polkadot/util';
3import type { HexString } from '@polkadot/util/types';
4import { AbstractBase } from '@polkadot/types-codec';
5import { GenericAccountId } from './AccountId.js';
6import { GenericAccountIndex } from './AccountIndex.js';
7type AnyAddress = bigint | BN | GenericLookupSource | GenericAccountId | GenericAccountIndex | number[] | Uint8Array | number | string;
8export declare const ACCOUNT_ID_PREFIX: Uint8Array;
9/**
10 * @name LookupSource
11 * @description
12 * A wrapper around an AccountId and/or AccountIndex that is encoded with a prefix.
13 * Since we are dealing with underlying publicKeys (or shorter encoded addresses),
14 * we extend from Base with an AccountId/AccountIndex wrapper. Basically the Address
15 * is encoded as `[ <prefix-byte>, ...publicKey/...bytes ]` as per spec
16 */
17export declare class GenericLookupSource extends AbstractBase<GenericAccountId | GenericAccountIndex> {
18 constructor(registry: Registry, value?: AnyAddress);
19 /**
20 * @description The length of the value when encoded as a Uint8Array
21 */
22 get encodedLength(): number;
23 /**
24 * @description The length of the raw value, either AccountIndex or AccountId
25 */
26 protected get _rawLength(): number;
27 /**
28 * @description Returns a breakdown of the hex encoding for this Codec
29 */
30 inspect(): Inspect;
31 /**
32 * @description Returns a hex string representation of the value
33 */
34 toHex(): HexString;
35 /**
36 * @description Returns the base runtime type name for this instance
37 */
38 toRawType(): string;
39 /**
40 * @description Encodes the value as a Uint8Array as per the SCALE specifications
41 * @param isBare true when the value has none of the type-specific prefixes (internal)
42 */
43 toU8a(isBare?: boolean): Uint8Array;
44}
45export {};