hermez-node/common/l2tx.go
common/l2tx.goRaw
1package common
2
3import (
4 "math/big"
5)
6
7// L2Tx is a struct that represents an already forged L2 tx
8type L2Tx struct {
9 // Stored in DB: mandatory fileds
10 TxID TxID `meddler:"tx_id"`
11 BatchNum BatchNum `meddler:"batch_num"` // batchNum in which this tx was forged.
12 Position int `meddler:"position"`
13 FromIdx Idx `meddler:"from_idx"`
14 ToIdx Idx `meddler:"to_idx"`
15 Amount *big.Int `meddler:"amount,bigint"`
16 Fee FeeSelector `meddler:"fee"`
17 Nonce Nonce `meddler:"nonce"`
18 Type TxType `meddler:"tx_type"`
19}
20
21func (tx *L2Tx) Tx() *Tx {
22 return &Tx{
23 TxID: tx.TxID,
24 FromIdx: tx.FromIdx,
25 ToIdx: tx.ToIdx,
26 Amount: tx.Amount,
27 Nonce: tx.Nonce,
28 Fee: tx.Fee,
29 Type: tx.Type,
30 }
31}