neo-go/_pkg.dev/wire/payload/mtx.go

36 lines
782 B
Go
Raw Normal View History

2019-02-25 22:44:14 +00:00
package payload
import (
"io"
"github.com/CityOfZion/neo-go/pkg/wire/command"
"github.com/CityOfZion/neo-go/pkg/wire/payload/transaction"
)
// TXMessage represents a transaction message on the neo-network
2019-02-25 22:44:14 +00:00
type TXMessage struct {
Tx transaction.Transactioner
}
//NewTXMessage returns a new tx object
2019-02-25 22:44:14 +00:00
func NewTXMessage(tx transaction.Transactioner) (*TXMessage, error) {
Tx := &TXMessage{tx}
return Tx, nil
}
// DecodePayload Implements Messager interface
2019-02-25 22:44:14 +00:00
func (t *TXMessage) DecodePayload(r io.Reader) error {
return t.Tx.Decode(r)
}
// EncodePayload Implements messager interface
2019-02-25 22:44:14 +00:00
func (t *TXMessage) EncodePayload(w io.Writer) error {
return t.Tx.Encode(w)
}
// Command Implements messager interface
func (t *TXMessage) Command() command.Type {
2019-02-25 22:44:14 +00:00
return command.TX
}