UNPKG

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