2020-11-18 11:26:13 +00:00
|
|
|
package transaction
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NotaryAssisted represents attribute for notary service transactions.
|
|
|
|
type NotaryAssisted struct {
|
|
|
|
NKeys uint8 `json:"nkeys"`
|
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// DecodeBinary implements the io.Serializable interface.
|
2020-11-18 11:26:13 +00:00
|
|
|
func (n *NotaryAssisted) DecodeBinary(br *io.BinReader) {
|
|
|
|
bytes := br.ReadVarBytes(1)
|
|
|
|
if br.Err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if len(bytes) != 1 {
|
|
|
|
br.Err = fmt.Errorf("expected 1 byte, got %d", len(bytes))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
n.NKeys = bytes[0]
|
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// EncodeBinary implements the io.Serializable interface.
|
2020-11-18 11:26:13 +00:00
|
|
|
func (n *NotaryAssisted) EncodeBinary(w *io.BinWriter) {
|
|
|
|
w.WriteVarBytes([]byte{n.NKeys})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *NotaryAssisted) toJSONMap(m map[string]interface{}) {
|
|
|
|
m["nkeys"] = n.NKeys
|
|
|
|
}
|