1 | import type { AnyJson, AnyNumber, AnyTuple, AnyU8a, Codec } from '@polkadot/types-codec/types';
|
2 | import type { HexString } from '@polkadot/util/types';
|
3 | import type { ExtrinsicStatus } from '../interfaces/author';
|
4 | import type { EcdsaSignature, Ed25519Signature, Sr25519Signature } from '../interfaces/extrinsics';
|
5 | import type { Address, Call, H256, Hash } from '../interfaces/runtime';
|
6 | import type { DispatchError, DispatchInfo, EventRecord } from '../interfaces/system';
|
7 | import type { ICompact, IKeyringPair, IMethod, INumber, IRuntimeVersionBase } from './interfaces';
|
8 | import type { Registry } from './registry';
|
9 | export interface ISubmittableResult {
|
10 | readonly dispatchError?: DispatchError;
|
11 | readonly dispatchInfo?: DispatchInfo;
|
12 | readonly events: EventRecord[];
|
13 | readonly internalError?: Error;
|
14 | readonly status: ExtrinsicStatus;
|
15 | readonly isCompleted: boolean;
|
16 | readonly isError: boolean;
|
17 | readonly isFinalized: boolean;
|
18 | readonly isInBlock: boolean;
|
19 | readonly isWarning: boolean;
|
20 | readonly txHash: Hash;
|
21 | readonly txIndex?: number;
|
22 | filterRecords(section: string, method: string): EventRecord[];
|
23 | findRecord(section: string, method: string): EventRecord | undefined;
|
24 | toHuman(isExtended?: boolean): AnyJson;
|
25 | }
|
26 | export interface SignerPayloadJSON {
|
27 | |
28 |
|
29 |
|
30 | address: string;
|
31 | |
32 |
|
33 |
|
34 | blockHash: string;
|
35 | |
36 |
|
37 |
|
38 | blockNumber: string;
|
39 | |
40 |
|
41 |
|
42 | era: string;
|
43 | |
44 |
|
45 |
|
46 | genesisHash: string;
|
47 | |
48 |
|
49 |
|
50 | method: string;
|
51 | |
52 |
|
53 |
|
54 | nonce: string;
|
55 | |
56 |
|
57 |
|
58 | specVersion: string;
|
59 | |
60 |
|
61 |
|
62 | tip: string;
|
63 | |
64 |
|
65 |
|
66 | transactionVersion: string;
|
67 | |
68 |
|
69 |
|
70 | signedExtensions: string[];
|
71 | |
72 |
|
73 |
|
74 | version: number;
|
75 | }
|
76 | export interface SignerPayloadRawBase {
|
77 | |
78 |
|
79 |
|
80 | data: string;
|
81 | |
82 |
|
83 |
|
84 | type?: 'bytes' | 'payload';
|
85 | }
|
86 | export interface SignerPayloadRaw extends SignerPayloadRawBase {
|
87 | |
88 |
|
89 |
|
90 | address: string;
|
91 | |
92 |
|
93 |
|
94 | type: 'bytes' | 'payload';
|
95 | }
|
96 | export interface ISignerPayload {
|
97 | toPayload(): SignerPayloadJSON;
|
98 | toRaw(): SignerPayloadRaw;
|
99 | }
|
100 | export interface SignerResult {
|
101 | |
102 |
|
103 |
|
104 | id: number;
|
105 | |
106 |
|
107 |
|
108 | signature: HexString;
|
109 | }
|
110 | export interface Signer {
|
111 | |
112 |
|
113 |
|
114 | signPayload?: (payload: SignerPayloadJSON) => Promise<SignerResult>;
|
115 | |
116 |
|
117 |
|
118 | signRaw?: (raw: SignerPayloadRaw) => Promise<SignerResult>;
|
119 | |
120 |
|
121 |
|
122 | update?: (id: number, status: H256 | ISubmittableResult) => void;
|
123 | }
|
124 | export interface IExtrinsicEra extends Codec {
|
125 | asImmortalEra: Codec;
|
126 | asMortalEra: Codec;
|
127 | }
|
128 | export interface SignatureOptions {
|
129 | blockHash: Uint8Array | string;
|
130 | era?: IExtrinsicEra;
|
131 | genesisHash: Uint8Array | string;
|
132 | nonce: AnyNumber;
|
133 | runtimeVersion: IRuntimeVersionBase;
|
134 | signedExtensions?: string[];
|
135 | signer?: Signer;
|
136 | tip?: AnyNumber;
|
137 | assetId?: AnyNumber;
|
138 | }
|
139 | interface ExtrinsicSignatureBase {
|
140 | readonly isSigned: boolean;
|
141 | readonly era: IExtrinsicEra;
|
142 | readonly nonce: ICompact<INumber>;
|
143 | readonly signature: EcdsaSignature | Ed25519Signature | Sr25519Signature;
|
144 | readonly signer: Address;
|
145 | readonly tip: ICompact<INumber>;
|
146 | }
|
147 | export interface ExtrinsicPayloadValue {
|
148 | blockHash: AnyU8a;
|
149 | era: AnyU8a | IExtrinsicEra;
|
150 | genesisHash: AnyU8a;
|
151 | method: AnyU8a | IMethod<AnyTuple>;
|
152 | nonce: AnyNumber;
|
153 | specVersion: AnyNumber;
|
154 | tip: AnyNumber;
|
155 | transactionVersion: AnyNumber;
|
156 | assetId?: AnyNumber;
|
157 | }
|
158 | export interface IExtrinsicSignature extends ExtrinsicSignatureBase, Codec {
|
159 | addSignature(signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: Uint8Array | HexString): IExtrinsicSignature;
|
160 | sign(method: Call, account: IKeyringPair, options: SignatureOptions): IExtrinsicSignature;
|
161 | signFake(method: Call, address: Address | Uint8Array | string, options: SignatureOptions): IExtrinsicSignature;
|
162 | readonly registry: Registry;
|
163 | }
|
164 | interface IExtrinsicSignable<T> extends Codec {
|
165 | addSignature(signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString): T;
|
166 | sign(account: IKeyringPair, options: SignatureOptions): T;
|
167 | signFake(address: Address | Uint8Array | string, options: SignatureOptions): T;
|
168 | readonly registry: Registry;
|
169 | }
|
170 | export interface IExtrinsicImpl extends IExtrinsicSignable<IExtrinsicImpl> {
|
171 | readonly method: Call;
|
172 | readonly signature: IExtrinsicSignature;
|
173 | readonly version: number;
|
174 | }
|
175 | export interface IExtrinsic<A extends AnyTuple = AnyTuple> extends IExtrinsicSignable<IExtrinsic<A>>, ExtrinsicSignatureBase, IMethod<A> {
|
176 | readonly length: number;
|
177 | readonly method: IMethod<A>;
|
178 | readonly type: number;
|
179 | readonly version: number;
|
180 | }
|
181 | export {};
|