OSDN Git Service

modify import path (#1805)
[bytom/bytom.git] / asset / annotate.go
index 167c7e8..1b7ded3 100644 (file)
@@ -3,10 +3,9 @@ package asset
 import (
        "encoding/json"
 
-       "github.com/bytom/blockchain/query"
-       "github.com/bytom/blockchain/signers"
-       chainjson "github.com/bytom/encoding/json"
-       "github.com/bytom/protocol/vm/vmutil"
+       "github.com/bytom/bytom/blockchain/query"
+       chainjson "github.com/bytom/bytom/encoding/json"
+       "github.com/bytom/bytom/protocol/vm/vmutil"
 )
 
 func isValidJSON(b []byte) bool {
@@ -28,27 +27,21 @@ func Annotated(a *Asset) (*query.AnnotatedAsset, error) {
        annotatedAsset := &query.AnnotatedAsset{
                ID:                a.AssetID,
                Alias:             *a.Alias,
+               VMVersion:         a.VMVersion,
                RawDefinitionByte: a.RawDefinitionByte,
                Definition:        &jsonDefinition,
                IssuanceProgram:   chainjson.HexBytes(a.IssuanceProgram),
        }
 
-       annotatedAsset.LimitHeight, _ = vmutil.GetIssuanceProgramRestrictHeight(a.IssuanceProgram)
+       annotatedAsset.LimitHeight = vmutil.GetIssuanceProgramRestrictHeight(a.IssuanceProgram)
        if a.Signer != nil {
-               path := signers.GetBip0032Path(a.Signer, signers.AssetKeySpace)
-               var jsonPath []chainjson.HexBytes
-               for _, p := range path {
-                       jsonPath = append(jsonPath, p)
+               annotatedAsset.AnnotatedSigner = query.AnnotatedSigner{
+                       Type:       a.Signer.Type,
+                       XPubs:      a.Signer.XPubs,
+                       Quorum:     a.Signer.Quorum,
+                       KeyIndex:   a.Signer.KeyIndex,
+                       DeriveRule: a.Signer.DeriveRule,
                }
-               for _, xpub := range a.Signer.XPubs {
-                       derived := xpub.Derive(path)
-                       annotatedAsset.Keys = append(annotatedAsset.Keys, &query.AssetKey{
-                               RootXPub:            xpub,
-                               AssetPubkey:         derived[:],
-                               AssetDerivationPath: jsonPath,
-                       })
-               }
-               annotatedAsset.Quorum = a.Signer.Quorum
        }
        return annotatedAsset, nil
 }