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