1 |
|
2 |
|
3 | import { BN } from 'ethereumjs-util';
|
4 | import { BufferLike, PrefixedHexString, TxData, TransactionOptions } from './types';
|
5 |
|
6 |
|
7 |
|
8 | export default class Transaction {
|
9 | raw: Buffer[];
|
10 | nonce: Buffer;
|
11 | gasLimit: Buffer;
|
12 | gasPrice: Buffer;
|
13 | to: Buffer;
|
14 | value: Buffer;
|
15 | data: Buffer;
|
16 | v: Buffer;
|
17 | r: Buffer;
|
18 | s: Buffer;
|
19 | private _common;
|
20 | private _senderPubKey?;
|
21 | protected _from?: Buffer;
|
22 | |
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | constructor(data?: Buffer | PrefixedHexString | BufferLike[] | TxData, opts?: TransactionOptions);
|
52 | /**
|
53 | * If the tx's `to` is to the creation address
|
54 | */
|
55 | toCreationAddress(): boolean;
|
56 | /**
|
57 | * Computes a sha3-256 hash of the serialized tx
|
58 | * @param includeSignature - Whether or not to include the signature
|
59 | */
|
60 | hash(includeSignature?: boolean): Buffer;
|
61 | /**
|
62 | * returns chain ID
|
63 | */
|
64 | getChainId(): number;
|
65 | /**
|
66 | * returns the sender's address
|
67 | */
|
68 | getSenderAddress(): Buffer;
|
69 | /**
|
70 | * returns the public key of the sender
|
71 | */
|
72 | getSenderPublicKey(): Buffer;
|
73 | /**
|
74 | * Determines if the signature is valid
|
75 | */
|
76 | verifySignature(): boolean;
|
77 | /**
|
78 | * sign a transaction with a given private key
|
79 | * @param privateKey - Must be 32 bytes in length
|
80 | */
|
81 | sign(privateKey: Buffer): void;
|
82 | /**
|
83 | * The amount of gas paid for the data in this tx
|
84 | */
|
85 | getDataFee(): BN;
|
86 | /**
|
87 | * the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)
|
88 | */
|
89 | getBaseFee(): BN;
|
90 | /**
|
91 | * the up front amount that an account must have for this transaction to be valid
|
92 | */
|
93 | getUpfrontCost(): BN;
|
94 | /**
|
95 | * Validates the signature and checks to see if it has enough gas.
|
96 | */
|
97 | validate(): boolean;
|
98 | validate(stringError: false): boolean;
|
99 | validate(stringError: true): string;
|
100 | /**
|
101 | * Returns the rlp encoding of the transaction
|
102 | */
|
103 | serialize(): Buffer;
|
104 | /**
|
105 | * Returns the transaction in JSON format
|
106 | * @see {@link https:
|
107 | */
|
108 | toJSON(labels?: boolean): {
|
109 | [key: string]: string;
|
110 | } | string[];
|
111 | private _validateV;
|
112 | private _isSigned;
|
113 | private _overrideVSetterWithValidation;
|
114 | private _implementsEIP155;
|
115 | }
|