1 |
|
2 |
|
3 | import { ErrorObject } from "ajv";
|
4 | import { TransactionTypes } from "../enums";
|
5 | import { BigNumber } from "../utils";
|
6 | export interface ITransaction {
|
7 | readonly id: string;
|
8 | readonly type: TransactionTypes;
|
9 | readonly verified: boolean;
|
10 | isVerified: boolean;
|
11 | data: ITransactionData;
|
12 | serialized: Buffer;
|
13 | timestamp: number;
|
14 | serialize(options?: ISerializeOptions): ByteBuffer;
|
15 | deserialize(buf: ByteBuffer): void;
|
16 | verify(): boolean;
|
17 | verifySchema(strict?: boolean): ISchemaValidationResult;
|
18 | toJson(): ITransactionJson;
|
19 | hasVendorField(): boolean;
|
20 | }
|
21 | export interface ITransactionAsset {
|
22 | signature?: {
|
23 | publicKey: string;
|
24 | };
|
25 | delegate?: {
|
26 | username: string;
|
27 | publicKey?: string;
|
28 | };
|
29 | votes?: string[];
|
30 | multiSignatureLegacy?: IMultiSignatureLegacyAsset;
|
31 | multiSignature?: IMultiSignatureAsset;
|
32 | ipfs?: string;
|
33 | payments?: any;
|
34 | [custom: string]: any;
|
35 | }
|
36 | export interface ITransactionData {
|
37 | version?: number;
|
38 | network?: number;
|
39 | type: TransactionTypes;
|
40 | timestamp: number;
|
41 | senderPublicKey: string;
|
42 | fee: BigNumber;
|
43 | amount: BigNumber;
|
44 | expiration?: number;
|
45 | recipientId?: string;
|
46 | asset?: ITransactionAsset;
|
47 | vendorField?: string;
|
48 | vendorFieldHex?: string;
|
49 | id?: string;
|
50 | signature?: string;
|
51 | secondSignature?: string;
|
52 | signSignature?: string;
|
53 | signatures?: string[];
|
54 | blockId?: string;
|
55 | sequence?: number;
|
56 | timelock?: any;
|
57 | timelockType?: number;
|
58 | payments?: {
|
59 | [key: string]: any;
|
60 | };
|
61 | }
|
62 | export interface ITransactionJson {
|
63 | version?: number;
|
64 | network?: number;
|
65 | type: TransactionTypes;
|
66 | timestamp: number;
|
67 | senderPublicKey: string;
|
68 | fee: string;
|
69 | amount: string;
|
70 | expiration?: number;
|
71 | recipientId?: string;
|
72 | asset?: ITransactionAsset;
|
73 | vendorField?: string;
|
74 | vendorFieldHex?: string;
|
75 | id?: string;
|
76 | signature?: string;
|
77 | secondSignature?: string;
|
78 | signSignature?: string;
|
79 | signatures?: string[];
|
80 | blockId?: string;
|
81 | sequence?: number;
|
82 | timelock?: any;
|
83 | timelockType?: number;
|
84 | ipfsHash?: string;
|
85 | payments?: {
|
86 | [key: string]: any;
|
87 | };
|
88 | }
|
89 | export interface ISchemaValidationResult<T = any> {
|
90 | value: T;
|
91 | error: any;
|
92 | errors?: ErrorObject[];
|
93 | }
|
94 | export interface IMultiPaymentItem {
|
95 | amount: BigNumber;
|
96 | recipientId: string;
|
97 | }
|
98 | export interface IMultiSignatureLegacyAsset {
|
99 | min: number;
|
100 | lifetime: number;
|
101 | keysgroup: string[];
|
102 | }
|
103 | export interface IMultiSignatureAsset {
|
104 | min: number;
|
105 | publicKeys: string[];
|
106 | }
|
107 | export interface ISerializeOptions {
|
108 | excludeSignature?: boolean;
|
109 | excludeSecondSignature?: boolean;
|
110 | excludeMultiSignature?: boolean;
|
111 | }
|