15
15
* limitations under the License.
16
16
********************************************************************************/
17
17
18
- #ifndef _ETHUSTREAM_H_
19
- #define _ETHUSTREAM_H_
18
+ #pragma once
20
19
21
20
#include <stdbool.h>
22
21
#include <stdint.h>
23
22
24
23
#include "os.h"
25
24
#include "cx.h"
25
+ #include "common_utils.h"
26
+ #include "tx_content.h"
26
27
27
28
struct txContext_t ;
28
29
@@ -35,10 +36,7 @@ typedef enum customStatus_e {
35
36
36
37
typedef customStatus_e (* ustreamProcess_t )(struct txContext_t * context );
37
38
38
- #define TX_FLAG_TYPE 0x01
39
- #define ADDRESS_LENGTH 20
40
- #define INT128_LENGTH 16
41
- #define INT256_LENGTH 32
39
+ #define TX_FLAG_TYPE 0x01
42
40
43
41
// First variant of every Tx enum.
44
42
#define RLP_NONE 0
@@ -114,24 +112,6 @@ typedef enum parserStatus_e {
114
112
USTREAM_CONTINUE // Used internally to signify we can keep on parsing
115
113
} parserStatus_e ;
116
114
117
- typedef struct txInt256_t {
118
- uint8_t value [INT256_LENGTH ];
119
- uint8_t length ;
120
- } txInt256_t ;
121
-
122
- typedef struct txContent_t {
123
- txInt256_t gasprice ; // Used as MaxFeePerGas when dealing with EIP1559 transactions.
124
- txInt256_t startgas ; // Also known as `gasLimit`.
125
- txInt256_t value ;
126
- txInt256_t nonce ;
127
- txInt256_t chainID ;
128
- uint8_t destination [ADDRESS_LENGTH ];
129
- uint8_t destinationLength ;
130
- uint8_t v [8 ];
131
- uint8_t vLength ;
132
- bool dataPresent ;
133
- } txContent_t ;
134
-
135
115
typedef struct txContext_t {
136
116
uint8_t currentField ;
137
117
cx_sha3_t * sha3 ;
@@ -164,5 +144,3 @@ parserStatus_e processTx(txContext_t *context,
164
144
parserStatus_e continueTx (txContext_t * context );
165
145
void copyTxData (txContext_t * context , uint8_t * out , uint32_t length );
166
146
uint8_t readTxByte (txContext_t * context );
167
-
168
- #endif // _ETHUSTREAM_H_
0 commit comments