UNPKG

3.48 kBTypeScriptView Raw
1import type { AnyU8a, Registry } from '@polkadot/types-codec/types';
2import type { BN } from '@polkadot/util';
3import type { IExtrinsicEra, INumber } from '../types/index.js';
4import { Enum, Raw, Tuple } from '@polkadot/types-codec';
5interface MortalMethod {
6 current: number;
7 period: number;
8}
9/**
10 * @name ImmortalEra
11 * @description
12 * The ImmortalEra for an extrinsic
13 */
14export declare class ImmortalEra extends Raw {
15 constructor(registry: Registry, _value?: AnyU8a);
16}
17/**
18 * @name MortalEra
19 * @description
20 * The MortalEra for an extrinsic, indicating period and phase
21 */
22export declare class MortalEra extends Tuple {
23 constructor(registry: Registry, value?: MortalMethod | Uint8Array | number[] | string);
24 /**
25 * @description Encoded length for mortals occupy 2 bytes, different from the actual Tuple since it is encoded. This is a shortcut fro `toU8a().length`
26 */
27 get encodedLength(): number;
28 /**
29 * @description The period of this Mortal wraps as a [[U64]]
30 */
31 get period(): INumber;
32 /**
33 * @description The phase of this Mortal wraps as a [[U64]]
34 */
35 get phase(): INumber;
36 /**
37 * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
38 */
39 toHuman(): any;
40 /**
41 * @description Returns a JSON representation of the actual value
42 */
43 toJSON(): any;
44 /**
45 * @description Encodes the value as a Uint8Array as per the parity-codec specifications
46 * @param isBare true when the value has none of the type-specific prefixes (internal)
47 * Period and phase are encoded:
48 * - The period of validity from the block hash found in the signing material.
49 * - The phase in the period that this transaction's lifetime begins (and, importantly,
50 * implies which block hash is included in the signature material). If the `period` is
51 * greater than 1 << 12, then it will be a factor of the times greater than 1<<12 that
52 * `period` is.
53 */
54 toU8a(_isBare?: boolean): Uint8Array;
55 /**
56 * @description Get the block number of the start of the era whose properties this object describes that `current` belongs to.
57 */
58 birth(current: BN | bigint | number | string): number;
59 /**
60 * @description Get the block number of the first block at which the era has ended.
61 */
62 death(current: BN | bigint | number | string): number;
63}
64/**
65 * @name GenericExtrinsicEra
66 * @description
67 * The era for an extrinsic, indicating either a mortal or immortal extrinsic
68 */
69export declare class GenericExtrinsicEra extends Enum implements IExtrinsicEra {
70 constructor(registry: Registry, value?: unknown);
71 /**
72 * @description Override the encoded length method
73 */
74 get encodedLength(): number;
75 /**
76 * @description Returns the item as a [[ImmortalEra]]
77 */
78 get asImmortalEra(): ImmortalEra;
79 /**
80 * @description Returns the item as a [[MortalEra]]
81 */
82 get asMortalEra(): MortalEra;
83 /**
84 * @description `true` if Immortal
85 */
86 get isImmortalEra(): boolean;
87 /**
88 * @description `true` if Mortal
89 */
90 get isMortalEra(): boolean;
91 /**
92 * @description Encodes the value as a Uint8Array as per the parity-codec specifications
93 * @param isBare true when the value has none of the type-specific prefixes (internal)
94 */
95 toU8a(isBare?: boolean): Uint8Array;
96}
97export {};