1515 * limitations under the License.
1616 ********************************************************************************/
1717
18- #ifndef _ETHUSTREAM_H_
19- #define _ETHUSTREAM_H_
18+ #pragma once
2019
2120#include <stdbool.h>
2221#include <stdint.h>
2322
2423#include "os.h"
2524#include "cx.h"
25+ #include "common_utils.h"
26+ #include "tx_content.h"
2627
2728struct txContext_t ;
2829
@@ -35,10 +36,7 @@ typedef enum customStatus_e {
3536
3637typedef customStatus_e (* ustreamProcess_t )(struct txContext_t * context );
3738
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
4240
4341// First variant of every Tx enum.
4442#define RLP_NONE 0
@@ -114,24 +112,6 @@ typedef enum parserStatus_e {
114112 USTREAM_CONTINUE // Used internally to signify we can keep on parsing
115113} parserStatus_e ;
116114
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-
135115typedef struct txContext_t {
136116 uint8_t currentField ;
137117 cx_sha3_t * sha3 ;
@@ -164,5 +144,3 @@ parserStatus_e processTx(txContext_t *context,
164144parserStatus_e continueTx (txContext_t * context );
165145void copyTxData (txContext_t * context , uint8_t * out , uint32_t length );
166146uint8_t readTxByte (txContext_t * context );
167-
168- #endif // _ETHUSTREAM_H_
0 commit comments