1 | import type { AnyJson, AnyTuple, AnyU8a, ArgsDef, IMethod, Inspect, IOption } from '@polkadot/types-codec/types';
|
2 | import type { HexString } from '@polkadot/util/types';
|
3 | import type { GeneralExtrinsic } from '../index.types.js';
|
4 | import type { EcdsaSignature, Ed25519Signature, ExtrinsicUnknown, ExtrinsicV5, Sr25519Signature } from '../interfaces/extrinsics/index.js';
|
5 | import type { FunctionMetadataLatest } from '../interfaces/metadata/index.js';
|
6 | import type { Address, Call, CodecHash, Hash } from '../interfaces/runtime/index.js';
|
7 | import type { MultiLocation } from '../interfaces/types.js';
|
8 | import type { CallBase, ExtrinsicPayloadValue, ICompact, IExtrinsic, IKeyringPair, INumber, Registry, SignatureOptions } from '../types/index.js';
|
9 | import type { GenericExtrinsicEra } from './ExtrinsicEra.js';
|
10 | import type { Preamble } from './types.js';
|
11 | import type { ExtrinsicValueV5 } from './v5/Extrinsic.js';
|
12 | import { AbstractBase } from '@polkadot/types-codec';
|
13 | import { LATEST_EXTRINSIC_VERSION } from './constants.js';
|
14 | interface CreateOptions {
|
15 | version?: number;
|
16 | preamble?: Preamble;
|
17 | }
|
18 | type ExtrinsicVx = ExtrinsicV5 | GeneralExtrinsic;
|
19 | type ExtrinsicValue = ExtrinsicValueV5;
|
20 | export { LATEST_EXTRINSIC_VERSION };
|
21 | declare abstract class ExtrinsicBase<A extends AnyTuple> extends AbstractBase<ExtrinsicVx | ExtrinsicUnknown> {
|
22 | #private;
|
23 | constructor(registry: Registry, value: ExtrinsicVx | ExtrinsicUnknown, initialU8aLength?: number, preamble?: Preamble);
|
24 | isGeneral(): boolean;
|
25 | /**
|
26 | * @description The arguments passed to for the call, exposes args so it is compatible with [[Call]]
|
27 | */
|
28 | get args(): A;
|
29 | /**
|
30 | * @description The argument definitions, compatible with [[Call]]
|
31 | */
|
32 | get argsDef(): ArgsDef;
|
33 | /**
|
34 | * @description The actual `[sectionIndex, methodIndex]` as used in the Call
|
35 | */
|
36 | get callIndex(): Uint8Array;
|
37 | /**
|
38 | * @description The actual data for the Call
|
39 | */
|
40 | get data(): Uint8Array;
|
41 | /**
|
42 | * @description The era for this extrinsic
|
43 | */
|
44 | get era(): GenericExtrinsicEra;
|
45 | /**
|
46 | * @description The length of the value when encoded as a Uint8Array
|
47 | */
|
48 | get encodedLength(): number;
|
49 | /**
|
50 | * @description `true` id the extrinsic is signed
|
51 | */
|
52 | get isSigned(): boolean;
|
53 | /**
|
54 | * @description The length of the actual data, excluding prefix
|
55 | */
|
56 | get length(): number;
|
57 | /**
|
58 | * @description The [[FunctionMetadataLatest]] that describes the extrinsic
|
59 | */
|
60 | get meta(): FunctionMetadataLatest;
|
61 | /**
|
62 | * @description The [[Call]] this extrinsic wraps
|
63 | */
|
64 | get method(): CallBase<A>;
|
65 | /**
|
66 | * @description The nonce for this extrinsic
|
67 | */
|
68 | get nonce(): ICompact<INumber>;
|
69 | /**
|
70 | * @description The actual [[EcdsaSignature]], [[Ed25519Signature]] or [[Sr25519Signature]]
|
71 | */
|
72 | get signature(): EcdsaSignature | Ed25519Signature | Sr25519Signature;
|
73 | /**
|
74 | * @description The [[Address]] that signed
|
75 | */
|
76 | get signer(): Address;
|
77 | /**
|
78 | * @description Forwards compat
|
79 | */
|
80 | get tip(): ICompact<INumber>;
|
81 | /**
|
82 | * @description Forward compat
|
83 | */
|
84 | get assetId(): IOption<INumber | MultiLocation>;
|
85 | /**
|
86 | * @description Forward compat
|
87 | */
|
88 | get metadataHash(): IOption<Hash>;
|
89 | /**
|
90 | * @description Forward compat
|
91 | */
|
92 | get mode(): INumber;
|
93 | /**
|
94 | * @description Returns the raw transaction version (not flagged with signing information)
|
95 | */
|
96 | get type(): number;
|
97 | get inner(): ExtrinsicVx;
|
98 | /**
|
99 | * @description Returns the encoded version flag
|
100 | */
|
101 | get version(): number;
|
102 | /**
|
103 | * @description Checks if the source matches this in type
|
104 | */
|
105 | is(other: IMethod<AnyTuple>): other is IMethod<A>;
|
106 | unwrap(): ExtrinsicVx;
|
107 | }
|
108 | /**
|
109 | * @name GenericExtrinsic
|
110 | * @description
|
111 | * Representation of an Extrinsic in the system. It contains the actual call,
|
112 | * (optional) signature and encodes with an actual length prefix
|
113 | *
|
114 | * {@link https:
|
115 | *
|
116 | * Can be:
|
117 | * - signed, to create a transaction
|
118 | * - left as is, to create an inherent
|
119 | */
|
120 | export declare class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBase<A> implements IExtrinsic<A> {
|
121 | #private;
|
122 | static LATEST_EXTRINSIC_VERSION: number;
|
123 | constructor(registry: Registry, value?: GenericExtrinsic | ExtrinsicValue | AnyU8a | Call, { preamble, version }?: CreateOptions);
|
124 | /**
|
125 | * @description returns a hash of the contents
|
126 | */
|
127 | get hash(): CodecHash;
|
128 | /**
|
129 | * @description Injects an already-generated signature into the extrinsic
|
130 | */
|
131 | addSignature(signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString): GenericExtrinsic<A>;
|
132 | /**
|
133 | * @description Returns a breakdown of the hex encoding for this Codec
|
134 | */
|
135 | inspect(): Inspect;
|
136 | /**
|
137 | * @description Sign the extrinsic with a specific keypair
|
138 | */
|
139 | sign(account: IKeyringPair, options: SignatureOptions): GenericExtrinsic<A>;
|
140 | /**
|
141 | * @describe Adds a fake signature to the extrinsic
|
142 | */
|
143 | signFake(signer: Address | Uint8Array | string, options: SignatureOptions): GenericExtrinsic<A>;
|
144 | /**
|
145 | * @description Returns a hex string representation of the value
|
146 | */
|
147 | toHex(isBare?: boolean): HexString;
|
148 | /**
|
149 | * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
150 | */
|
151 | toHuman(isExpanded?: boolean, disableAscii?: boolean): AnyJson;
|
152 | /**
|
153 | * @description Converts the Object to JSON, typically used for RPC transfers
|
154 | */
|
155 | toJSON(): string;
|
156 | /**
|
157 | * @description Returns the base runtime type name for this instance
|
158 | */
|
159 | toRawType(): string;
|
160 | /**
|
161 | * @description Encodes the value as a Uint8Array as per the SCALE specifications
|
162 | * @param isBare true when the value is not length-prefixed
|
163 | */
|
164 | toU8a(isBare?: boolean): Uint8Array;
|
165 | toU8aInner(): Uint8Array[];
|
166 | }
|