github.com/turingchain2020/turingchain@v1.1.21/system/dapp/commands/types/types.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package types commands中结构体定义
     6  package types
     7  
     8  import (
     9  	rpctypes "github.com/turingchain2020/turingchain/rpc/types"
    10  )
    11  
    12  // AccountsResult defines accountsresult command
    13  type AccountsResult struct {
    14  	Wallets []*WalletResult `json:"wallets"`
    15  }
    16  
    17  // WalletResult defines walletresult command
    18  type WalletResult struct {
    19  	Acc   *AccountResult `json:"acc,omitempty"`
    20  	Label string         `json:"label,omitempty"`
    21  }
    22  
    23  // AccountResult defines account result command
    24  type AccountResult struct {
    25  	Currency int32  `json:"currency,omitempty"`
    26  	Balance  string `json:"balance,omitempty"`
    27  	Frozen   string `json:"frozen,omitempty"`
    28  	Addr     string `json:"addr,omitempty"`
    29  }
    30  
    31  // TokenAccountResult defines accounts result of token command
    32  type TokenAccountResult struct {
    33  	Token    string `json:"Token,omitempty"`
    34  	Currency int32  `json:"currency,omitempty"`
    35  	Balance  string `json:"balance,omitempty"`
    36  	Frozen   string `json:"frozen,omitempty"`
    37  	Addr     string `json:"addr,omitempty"`
    38  }
    39  
    40  // TxListResult defines txlist result command
    41  type TxListResult struct {
    42  	Txs []*TxResult `json:"txs"`
    43  }
    44  
    45  // TxResult defines txresult command
    46  type TxResult struct {
    47  	Execer     string              `json:"execer"`
    48  	Payload    interface{}         `json:"payload"`
    49  	RawPayload string              `json:"rawpayload"`
    50  	Signature  *rpctypes.Signature `json:"signature"`
    51  	Fee        string              `json:"fee"`
    52  	Expire     int64               `json:"expire"`
    53  	Nonce      int64               `json:"nonce"`
    54  	To         string              `json:"to"`
    55  	Amount     string              `json:"amount,omitempty"`
    56  	From       string              `json:"from,omitempty"`
    57  	GroupCount int32               `json:"groupCount,omitempty"`
    58  	Header     string              `json:"header,omitempty"`
    59  	Next       string              `json:"next,omitempty"`
    60  	Hash       string              `json:"hash,omitempty"`
    61  	ChainID    int32               `json:"chainID,"`
    62  }
    63  
    64  // ReceiptAccountTransfer defines receipt account transfer
    65  type ReceiptAccountTransfer struct {
    66  	Prev    *AccountResult `protobuf:"bytes,1,opt,name=prev" json:"prev,omitempty"`
    67  	Current *AccountResult `protobuf:"bytes,2,opt,name=current" json:"current,omitempty"`
    68  }
    69  
    70  // ReceiptExecAccountTransfer defines account transfer of exec command
    71  type ReceiptExecAccountTransfer struct {
    72  	ExecAddr string         `protobuf:"bytes,1,opt,name=execAddr" json:"execAddr,omitempty"`
    73  	Prev     *AccountResult `protobuf:"bytes,2,opt,name=prev" json:"prev,omitempty"`
    74  	Current  *AccountResult `protobuf:"bytes,3,opt,name=current" json:"current,omitempty"`
    75  }
    76  
    77  // TxDetailResult defines txdetail result command
    78  type TxDetailResult struct {
    79  	Tx         *TxResult                   `json:"tx"`
    80  	Receipt    *rpctypes.ReceiptDataResult `json:"receipt"`
    81  	Proofs     []string                    `json:"proofs,omitempty"`
    82  	Height     int64                       `json:"height"`
    83  	Index      int64                       `json:"index"`
    84  	Blocktime  int64                       `json:"blocktime"`
    85  	Amount     string                      `json:"amount"`
    86  	Fromaddr   string                      `json:"fromaddr"`
    87  	ActionName string                      `json:"actionname"`
    88  	Assets     []*rpctypes.Asset           `json:"assets"`
    89  	TxProofs   []*rpctypes.TxProof         `json:"txProofs"`
    90  	FullHash   string                      `json:"fullHash"`
    91  }
    92  
    93  // TxDetailsResult defines txdetails result command
    94  type TxDetailsResult struct {
    95  	Txs []*TxDetailResult `json:"txs"`
    96  }
    97  
    98  // BlockResult defines blockresult rpc command
    99  type BlockResult struct {
   100  	Version    int64       `json:"version"`
   101  	ParentHash string      `json:"parenthash"`
   102  	TxHash     string      `json:"txhash"`
   103  	StateHash  string      `json:"statehash"`
   104  	Height     int64       `json:"height"`
   105  	BlockTime  int64       `json:"blocktime"`
   106  	Txs        []*TxResult `json:"txs"`
   107  }
   108  
   109  // BlockDetailResult defines blockdetailresult rpc command
   110  type BlockDetailResult struct {
   111  	Block    *BlockResult                  `json:"block"`
   112  	Receipts []*rpctypes.ReceiptDataResult `json:"receipts"`
   113  }
   114  
   115  // BlockDetailsResult defines blockdetails result rpc command
   116  type BlockDetailsResult struct {
   117  	Items []*BlockDetailResult `json:"items"`
   118  }
   119  
   120  // WalletTxDetailsResult defines walletexdetails result rpc command
   121  type WalletTxDetailsResult struct {
   122  	TxDetails []*WalletTxDetailResult `json:"txDetails"`
   123  }
   124  
   125  // WalletTxDetailResult  defines wallettxdetail result rpc command
   126  type WalletTxDetailResult struct {
   127  	Tx         *TxResult                   `json:"tx"`
   128  	Receipt    *rpctypes.ReceiptDataResult `json:"receipt"`
   129  	Height     int64                       `json:"height"`
   130  	Index      int64                       `json:"index"`
   131  	Blocktime  int64                       `json:"blocktime"`
   132  	Amount     string                      `json:"amount"`
   133  	Fromaddr   string                      `json:"fromaddr"`
   134  	Txhash     string                      `json:"txhash"`
   135  	ActionName string                      `json:"actionname"`
   136  }
   137  
   138  // AddrOverviewResult defines address overview result rpc command
   139  type AddrOverviewResult struct {
   140  	Receiver string `json:"receiver"`
   141  	Balance  string `json:"balance"`
   142  	TxCount  int64  `json:"txCount"`
   143  }
   144  
   145  // GetTotalCoinsResult defines totalcoinsresult rpc command
   146  type GetTotalCoinsResult struct {
   147  	TxCount          int64  `json:"txCount"`
   148  	AccountCount     int64  `json:"accountCount"`
   149  	TotalAmount      string `json:"totalAmount"`
   150  	ActualAmount     string `json:"actualAmount,omitempty"`
   151  	DifferenceAmount string `json:"differenceAmount,omitempty"`
   152  }
   153  
   154  // AllExecBalance defines all balance of exec command
   155  type AllExecBalance struct {
   156  	Addr        string         `json:"addr"`
   157  	ExecAccount []*ExecAccount `json:"execAccount"`
   158  }
   159  
   160  // ExecAccount defines account of exec command
   161  type ExecAccount struct {
   162  	Execer  string         `json:"execer"`
   163  	Account *AccountResult `json:"account"`
   164  }
   165  
   166  // GetExecBalanceResult  defines balance of exec result rpc command
   167  type GetExecBalanceResult struct {
   168  	Amount       string         `json:"totalAmount"`
   169  	AmountFrozen string         `json:"frozenAmount"`
   170  	AmountActive string         `json:"activeAmount"`
   171  	ExecBalances []*ExecBalance `json:"execBalances,omitempty"`
   172  }
   173  
   174  // ExecBalance defines exec balance rpc command
   175  type ExecBalance struct {
   176  	ExecAddr string `json:"execAddr,omitempty"`
   177  	Frozen   string `json:"frozen"`
   178  	Active   string `json:"active"`
   179  }