6 "github.com/vapor/blockchain/query"
7 chainjson "github.com/vapor/encoding/json"
10 //Annotated annotate the asset
11 func Annotated(a *Asset) (*query.AnnotatedAsset, error) {
12 jsonDefinition := json.RawMessage(`{}`)
14 // a.RawDefinitionByte is the asset definition as it appears on the
15 // blockchain, so it's untrusted and may not be valid json.
16 if chainjson.IsValidJSON(a.RawDefinitionByte) {
17 jsonDefinition = json.RawMessage(a.RawDefinitionByte)
20 annotatedAsset := &query.AnnotatedAsset{
23 VMVersion: a.VMVersion,
24 RawDefinitionByte: a.RawDefinitionByte,
25 Definition: &jsonDefinition,
28 return annotatedAsset, nil