mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-08 03:46:52 +01:00
Implement tx pool endpoints
This commit is contained in:
16
common/tx.go
16
common/tx.go
@@ -73,6 +73,22 @@ func NewTxIDFromString(idStr string) (TxID, error) {
|
||||
return txid, nil
|
||||
}
|
||||
|
||||
// MarshalText marshals a TxID
|
||||
func (txid TxID) MarshalText() ([]byte, error) {
|
||||
return []byte(txid.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText unmarshals a TxID
|
||||
func (txid *TxID) UnmarshalText(data []byte) error {
|
||||
idStr := string(data)
|
||||
id, err := NewTxIDFromString(idStr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*txid = id
|
||||
return nil
|
||||
}
|
||||
|
||||
// TxType is a string that represents the type of a Hermez network transaction
|
||||
type TxType string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user