OSDN Git Service

rename (#465)
[bytom/vapor.git] / blockchain / query / annotated.go
1 package query
2
3 import (
4         "encoding/json"
5
6         "github.com/bytom/vapor/crypto/ed25519/chainkd"
7         chainjson "github.com/bytom/vapor/encoding/json"
8         "github.com/bytom/vapor/protocol/bc"
9 )
10
11 //AnnotatedTx means an annotated transaction.
12 type AnnotatedTx struct {
13         ID                     bc.Hash            `json:"tx_id"`
14         Timestamp              uint64             `json:"block_time"`
15         BlockID                bc.Hash            `json:"block_hash"`
16         BlockHeight            uint64             `json:"block_height"`
17         Position               uint32             `json:"block_index"`
18         BlockTransactionsCount uint32             `json:"block_transactions_count,omitempty"`
19         Inputs                 []*AnnotatedInput  `json:"inputs"`
20         Outputs                []*AnnotatedOutput `json:"outputs"`
21         StatusFail             bool               `json:"status_fail"`
22         Size                   uint64             `json:"size"`
23 }
24
25 //AnnotatedInput means an annotated transaction input.
26 type AnnotatedInput struct {
27         Type             string               `json:"type"`
28         AssetID          bc.AssetID           `json:"asset_id"`
29         AssetAlias       string               `json:"asset_alias,omitempty"`
30         AssetDefinition  *json.RawMessage     `json:"asset_definition,omitempty"`
31         Amount           uint64               `json:"amount"`
32         ControlProgram   chainjson.HexBytes   `json:"control_program,omitempty"`
33         Address          string               `json:"address,omitempty"`
34         SpentOutputID    *bc.Hash             `json:"spent_output_id,omitempty"`
35         AccountID        string               `json:"account_id,omitempty"`
36         AccountAlias     string               `json:"account_alias,omitempty"`
37         Arbitrary        chainjson.HexBytes   `json:"arbitrary,omitempty"`
38         InputID          bc.Hash              `json:"input_id"`
39         WitnessArguments []chainjson.HexBytes `json:"witness_arguments"`
40 }
41
42 //AnnotatedOutput means an annotated transaction output.
43 type AnnotatedOutput struct {
44         Type            string             `json:"type"`
45         OutputID        bc.Hash            `json:"id"`
46         TransactionID   *bc.Hash           `json:"transaction_id,omitempty"`
47         Position        int                `json:"position"`
48         AssetID         bc.AssetID         `json:"asset_id"`
49         AssetAlias      string             `json:"asset_alias,omitempty"`
50         AssetDefinition *json.RawMessage   `json:"asset_definition,omitempty"`
51         Amount          uint64             `json:"amount"`
52         AccountID       string             `json:"account_id,omitempty"`
53         AccountAlias    string             `json:"account_alias,omitempty"`
54         ControlProgram  chainjson.HexBytes `json:"control_program"`
55         Address         string             `json:"address,omitempty"`
56         Vote            chainjson.HexBytes `json:"vote,omitempty"`
57 }
58
59 //AnnotatedAccount means an annotated account.
60 type AnnotatedAccount struct {
61         ID         string         `json:"id"`
62         Alias      string         `json:"alias,omitempty"`
63         XPubs      []chainkd.XPub `json:"xpubs"`
64         Quorum     int            `json:"quorum"`
65         KeyIndex   uint64         `json:"key_index"`
66         DeriveRule uint8          `json:"derive_rule"`
67 }
68
69 //AnnotatedAsset means an annotated asset.
70 type AnnotatedAsset struct {
71         ID                bc.AssetID         `json:"id"`
72         Alias             string             `json:"alias"`
73         VMVersion         uint64             `json:"vm_version"`
74         RawDefinitionByte chainjson.HexBytes `json:"raw_definition_byte"`
75         Definition        *json.RawMessage   `json:"definition"`
76 }
77
78 //AnnotatedUTXO means an annotated utxo.
79 type AnnotatedUTXO struct {
80         Alias               string `json:"account_alias"`
81         OutputID            string `json:"id"`
82         AssetID             string `json:"asset_id"`
83         AssetAlias          string `json:"asset_alias"`
84         Amount              uint64 `json:"amount"`
85         AccountID           string `json:"account_id"`
86         Address             string `json:"address"`
87         ControlProgramIndex uint64 `json:"control_program_index"`
88         Program             string `json:"program"`
89         SourceID            string `json:"source_id"`
90         SourcePos           uint64 `json:"source_pos"`
91         ValidHeight         uint64 `json:"valid_height"`
92         Change              bool   `json:"change"`
93         DeriveRule          uint8  `json:"derive_rule"`
94 }