mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
core: move transaction Attribute value to a designated interface
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
198af7f3ae
commit
df2a56908b
1 changed files with 11 additions and 8 deletions
|
@ -8,17 +8,20 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// AttrValue represents a Transaction Attribute value.
|
||||||
|
type AttrValue interface {
|
||||||
|
io.Serializable
|
||||||
|
// toJSONMap is used for embedded json struct marshalling.
|
||||||
|
// Anonymous interface fields are not considered anonymous by
|
||||||
|
// json lib and marshaling Value together with type makes code
|
||||||
|
// harder to follow.
|
||||||
|
toJSONMap(map[string]any)
|
||||||
|
}
|
||||||
|
|
||||||
// Attribute represents a Transaction attribute.
|
// Attribute represents a Transaction attribute.
|
||||||
type Attribute struct {
|
type Attribute struct {
|
||||||
Type AttrType
|
Type AttrType
|
||||||
Value interface {
|
Value AttrValue
|
||||||
io.Serializable
|
|
||||||
// toJSONMap is used for embedded json struct marshalling.
|
|
||||||
// Anonymous interface fields are not considered anonymous by
|
|
||||||
// json lib and marshaling Value together with type makes code
|
|
||||||
// harder to follow.
|
|
||||||
toJSONMap(map[string]any)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// attrJSON is used for JSON I/O of Attribute.
|
// attrJSON is used for JSON I/O of Attribute.
|
||||||
|
|
Loading…
Reference in a new issue