github.com/Bytom/bytom@v1.1.2-0.20210127130405-ae40204c0b09/blockchain/query/annotated.go (about)

     1  package query
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	"github.com/bytom/bytom/crypto/ed25519/chainkd"
     7  	chainjson "github.com/bytom/bytom/encoding/json"
     8  	"github.com/bytom/bytom/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  	IssuanceProgram  chainjson.HexBytes   `json:"issuance_program,omitempty"`
    33  	ControlProgram   chainjson.HexBytes   `json:"control_program,omitempty"`
    34  	Address          string               `json:"address,omitempty"`
    35  	SpentOutputID    *bc.Hash             `json:"spent_output_id,omitempty"`
    36  	AccountID        string               `json:"account_id,omitempty"`
    37  	AccountAlias     string               `json:"account_alias,omitempty"`
    38  	Arbitrary        chainjson.HexBytes   `json:"arbitrary,omitempty"`
    39  	InputID          bc.Hash              `json:"input_id"`
    40  	WitnessArguments []chainjson.HexBytes `json:"witness_arguments"`
    41  	SignData         bc.Hash              `json:"sign_data,omitempty"`
    42  }
    43  
    44  //AnnotatedOutput means an annotated transaction output.
    45  type AnnotatedOutput struct {
    46  	Type            string             `json:"type"`
    47  	OutputID        bc.Hash            `json:"id"`
    48  	TransactionID   *bc.Hash           `json:"transaction_id,omitempty"`
    49  	Position        int                `json:"position"`
    50  	AssetID         bc.AssetID         `json:"asset_id"`
    51  	AssetAlias      string             `json:"asset_alias,omitempty"`
    52  	AssetDefinition *json.RawMessage   `json:"asset_definition,omitempty"`
    53  	Amount          uint64             `json:"amount"`
    54  	AccountID       string             `json:"account_id,omitempty"`
    55  	AccountAlias    string             `json:"account_alias,omitempty"`
    56  	ControlProgram  chainjson.HexBytes `json:"control_program"`
    57  	Address         string             `json:"address,omitempty"`
    58  }
    59  
    60  //AnnotatedAccount means an annotated account.
    61  type AnnotatedAccount struct {
    62  	ID         string         `json:"id"`
    63  	Alias      string         `json:"alias,omitempty"`
    64  	XPubs      []chainkd.XPub `json:"xpubs"`
    65  	Quorum     int            `json:"quorum"`
    66  	KeyIndex   uint64         `json:"key_index"`
    67  	DeriveRule uint8          `json:"derive_rule"`
    68  }
    69  
    70  //AnnotatedAsset means an annotated asset.
    71  type AnnotatedAsset struct {
    72  	AnnotatedSigner
    73  	ID                bc.AssetID         `json:"id"`
    74  	Alias             string             `json:"alias"`
    75  	VMVersion         uint64             `json:"vm_version"`
    76  	IssuanceProgram   chainjson.HexBytes `json:"issue_program"`
    77  	RawDefinitionByte chainjson.HexBytes `json:"raw_definition_byte"`
    78  	Definition        *json.RawMessage   `json:"definition"`
    79  	LimitHeight       int64              `json:"limit_height"`
    80  }
    81  
    82  //AnnotatedSigner means an annotated signer for asset.
    83  type AnnotatedSigner struct {
    84  	Type       string         `json:"type"`
    85  	XPubs      []chainkd.XPub `json:"xpubs"`
    86  	Quorum     int            `json:"quorum"`
    87  	KeyIndex   uint64         `json:"key_index"`
    88  	DeriveRule uint8          `json:"derive_rule"`
    89  }
    90  
    91  //AnnotatedUTXO means an annotated utxo.
    92  type AnnotatedUTXO struct {
    93  	Alias               string `json:"account_alias"`
    94  	OutputID            string `json:"id"`
    95  	AssetID             string `json:"asset_id"`
    96  	AssetAlias          string `json:"asset_alias"`
    97  	Amount              uint64 `json:"amount"`
    98  	AccountID           string `json:"account_id"`
    99  	Address             string `json:"address"`
   100  	ControlProgramIndex uint64 `json:"control_program_index"`
   101  	Program             string `json:"program"`
   102  	SourceID            string `json:"source_id"`
   103  	SourcePos           uint64 `json:"source_pos"`
   104  	ValidHeight         uint64 `json:"valid_height"`
   105  	Change              bool   `json:"change"`
   106  	DeriveRule          uint8  `json:"derive_rule"`
   107  }