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