From df2a56908b0a4f99c76e1810030b1d675ca10f26 Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Fri, 26 Apr 2024 21:35:57 +0530 Subject: [PATCH] core: move transaction Attribute value to a designated interface Signed-off-by: Ekaterina Pavlova --- pkg/core/transaction/attribute.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pkg/core/transaction/attribute.go b/pkg/core/transaction/attribute.go index 0044f4b5f..187c8b185 100644 --- a/pkg/core/transaction/attribute.go +++ b/pkg/core/transaction/attribute.go @@ -8,17 +8,20 @@ import ( "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. type Attribute struct { Type AttrType - Value 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) - } + Value AttrValue } // attrJSON is used for JSON I/O of Attribute.