UNPKG

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