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 { AbstractBase } from '@polkadot/types-codec';
|
10 | import { EXTRINSIC_VERSION as LATEST_EXTRINSIC_VERSION } from './v4/Extrinsic';
|
11 | interface CreateOptions {
|
12 | version?: number;
|
13 | }
|
14 | type ExtrinsicVx = ExtrinsicV4;
|
15 | type ExtrinsicValue = ExtrinsicValueV4;
|
16 | export { LATEST_EXTRINSIC_VERSION };
|
17 | declare abstract class ExtrinsicBase<A extends AnyTuple> extends AbstractBase<ExtrinsicVx | ExtrinsicUnknown> {
|
18 | constructor(registry: Registry, value: ExtrinsicV4 | ExtrinsicUnknown, initialU8aLength?: number);
|
19 | /**
|
20 | * @description The arguments passed to for the call, exposes args so it is compatible with [[Call]]
|
21 | */
|
22 | get args(): A;
|
23 | /**
|
24 | * @description The argument definitions, compatible with [[Call]]
|
25 | */
|
26 | get argsDef(): ArgsDef;
|
27 | /**
|
28 | * @description The actual `[sectionIndex, methodIndex]` as used in the Call
|
29 | */
|
30 | get callIndex(): Uint8Array;
|
31 | /**
|
32 | * @description The actual data for the Call
|
33 | */
|
34 | get data(): Uint8Array;
|
35 | /**
|
36 | * @description The era for this extrinsic
|
37 | */
|
38 | get era(): GenericExtrinsicEra;
|
39 | /**
|
40 | * @description The length of the value when encoded as a Uint8Array
|
41 | */
|
42 | get encodedLength(): number;
|
43 | /**
|
44 | * @description `true` id the extrinsic is signed
|
45 | */
|
46 | get isSigned(): boolean;
|
47 | /**
|
48 | * @description The length of the actual data, excluding prefix
|
49 | */
|
50 | get length(): number;
|
51 | /**
|
52 | * @description The [[FunctionMetadataLatest]] that describes the extrinsic
|
53 | */
|
54 | get meta(): FunctionMetadataLatest;
|
55 | /**
|
56 | * @description The [[Call]] this extrinsic wraps
|
57 | */
|
58 | get method(): CallBase<A>;
|
59 | /**
|
60 | * @description The nonce for this extrinsic
|
61 | */
|
62 | get nonce(): ICompact<INumber>;
|
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 | static LATEST_EXTRINSIC_VERSION: number;
|
105 | constructor(registry: Registry, value?: GenericExtrinsic | ExtrinsicValue | AnyU8a | Call, { version }?: CreateOptions);
|
106 | /**
|
107 | * @description returns a hash of the contents
|
108 | */
|
109 | get hash(): CodecHash;
|
110 | /**
|
111 | * @description Injects an already-generated signature into the extrinsic
|
112 | */
|
113 | addSignature(signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString): GenericExtrinsic<A>;
|
114 | /**
|
115 | * @description Returns a breakdown of the hex encoding for this Codec
|
116 | */
|
117 | inspect(): Inspect;
|
118 | /**
|
119 | * @description Sign the extrinsic with a specific keypair
|
120 | */
|
121 | sign(account: IKeyringPair, options: SignatureOptions): GenericExtrinsic<A>;
|
122 | /**
|
123 | * @describe Adds a fake signature to the extrinsic
|
124 | */
|
125 | signFake(signer: Address | Uint8Array | string, options: SignatureOptions): GenericExtrinsic<A>;
|
126 | /**
|
127 | * @description Returns a hex string representation of the value
|
128 | */
|
129 | toHex(isBare?: boolean): HexString;
|
130 | /**
|
131 | * @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
132 | */
|
133 | toHuman(isExpanded?: boolean): AnyJson;
|
134 | /**
|
135 | * @description Converts the Object to JSON, typically used for RPC transfers
|
136 | */
|
137 | toJSON(): string;
|
138 | /**
|
139 | * @description Returns the base runtime type name for this instance
|
140 | */
|
141 | toRawType(): string;
|
142 | /**
|
143 | * @description Encodes the value as a Uint8Array as per the SCALE specifications
|
144 | * @param isBare true when the value is not length-prefixed
|
145 | */
|
146 | toU8a(isBare?: boolean): Uint8Array;
|
147 | toU8aInner(): Uint8Array[];
|
148 | }
|