UNPKG

3.24 kBTypeScriptView Raw
1import type { HexString } from '@polkadot/util/types';
2import type { EcdsaSignature, Ed25519Signature, ExtrinsicEra, ExtrinsicSignature, Sr25519Signature } from '../../interfaces/extrinsics/index.js';
3import type { Address, Call } from '../../interfaces/runtime/index.js';
4import type { ExtrinsicPayloadValue, ICompact, IExtrinsicSignature, IKeyringPair, INumber, Registry, SignatureOptions } from '../../types/index.js';
5import type { ExtrinsicSignatureOptions } from '../types.js';
6import { Struct } from '@polkadot/types-codec';
7import { GenericExtrinsicPayloadV4 } from './ExtrinsicPayload.js';
8/**
9 * @name GenericExtrinsicSignatureV4
10 * @description
11 * A container for the [[Signature]] associated with a specific [[Extrinsic]]
12 */
13export declare class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSignature {
14 #private;
15 constructor(registry: Registry, value?: GenericExtrinsicSignatureV4 | Uint8Array, { isSigned }?: ExtrinsicSignatureOptions);
16 /** @internal */
17 static decodeExtrinsicSignature(value?: GenericExtrinsicSignatureV4 | Uint8Array, isSigned?: boolean): GenericExtrinsicSignatureV4 | Uint8Array;
18 /**
19 * @description The length of the value when encoded as a Uint8Array
20 */
21 get encodedLength(): number;
22 /**
23 * @description `true` if the signature is valid
24 */
25 get isSigned(): boolean;
26 /**
27 * @description The [[ExtrinsicEra]] (mortal or immortal) this signature applies to
28 */
29 get era(): ExtrinsicEra;
30 /**
31 * @description The [[Index]] for the signature
32 */
33 get nonce(): ICompact<INumber>;
34 /**
35 * @description The actual [[EcdsaSignature]], [[Ed25519Signature]] or [[Sr25519Signature]]
36 */
37 get signature(): EcdsaSignature | Ed25519Signature | Sr25519Signature;
38 /**
39 * @description The raw [[ExtrinsicSignature]]
40 */
41 get multiSignature(): ExtrinsicSignature;
42 /**
43 * @description The [[Address]] that signed
44 */
45 get signer(): Address;
46 /**
47 * @description The [[Balance]] tip
48 */
49 get tip(): ICompact<INumber>;
50 protected _injectSignature(signer: Address, signature: ExtrinsicSignature, payload: GenericExtrinsicPayloadV4): IExtrinsicSignature;
51 /**
52 * @description Adds a raw signature
53 */
54 addSignature(signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString): IExtrinsicSignature;
55 /**
56 * @description Creates a payload from the supplied options
57 */
58 createPayload(method: Call, options: SignatureOptions): GenericExtrinsicPayloadV4;
59 /**
60 * @description Generate a payload and applies the signature from a keypair
61 */
62 sign(method: Call, account: IKeyringPair, options: SignatureOptions): IExtrinsicSignature;
63 /**
64 * @description Generate a payload and applies a fake signature
65 */
66 signFake(method: Call, address: Address | Uint8Array | string, options: SignatureOptions): IExtrinsicSignature;
67 /**
68 * @description Encodes the value as a Uint8Array as per the SCALE specifications
69 * @param isBare true when the value has none of the type-specific prefixes (internal)
70 */
71 toU8a(isBare?: boolean): Uint8Array;
72}