OSDN Git Service

Try (#1165)
[bytom/bytom.git] / account / indexer.go
1 package account
2
3 import (
4         "github.com/bytom/blockchain/query"
5         "github.com/bytom/protocol/bc"
6 )
7
8 const (
9         //UTXOPreFix is StandardUTXOKey prefix
10         UTXOPreFix = "ACU:"
11         //SUTXOPrefix is ContractUTXOKey prefix
12         SUTXOPrefix = "SCU:"
13 )
14
15 // StandardUTXOKey makes an account unspent outputs key to store
16 func StandardUTXOKey(id bc.Hash) []byte {
17         name := id.String()
18         return []byte(UTXOPreFix + name)
19 }
20
21 // ContractUTXOKey makes a smart contract unspent outputs key to store
22 func ContractUTXOKey(id bc.Hash) []byte {
23         name := id.String()
24         return []byte(SUTXOPrefix + name)
25 }
26
27 //Annotated init an annotated account object
28 func Annotated(a *Account) *query.AnnotatedAccount {
29         return &query.AnnotatedAccount{
30                 ID:       a.ID,
31                 Alias:    a.Alias,
32                 Quorum:   a.Quorum,
33                 XPubs:    a.XPubs,
34                 KeyIndex: a.KeyIndex,
35         }
36 }