github.com/okex/exchain@v1.8.0/libs/tendermint/rpc/jsonrpc/client/cm39_converters.go (about) 1 package client 2 3 import ( 4 abci "github.com/okex/exchain/libs/tendermint/abci/types" 5 merkle "github.com/okex/exchain/libs/tendermint/crypto/merkle" 6 "github.com/okex/exchain/libs/tendermint/libs/bytes" 7 coretypes "github.com/okex/exchain/libs/tendermint/rpc/core/types" 8 "github.com/okex/exchain/libs/tendermint/types" 9 ) 10 11 type CM39ResultBroadcastTxCommit struct { 12 CheckTx abci.ResponseCheckTx `json:"check_tx"` 13 DeliverTx CM39ResponseDeliverTx `json:"deliver_tx"` 14 Hash bytes.HexBytes `json:"hash"` 15 Height int64 `json:"height"` 16 } 17 18 type CM39ResponseQuery struct { 19 Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` 20 // bytes data = 2; // use "value" instead. 21 Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"` 22 Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` 23 Index int64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"` 24 Key []byte `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"` 25 Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"` 26 Proof *merkle.Proof `protobuf:"bytes,8,opt,name=proof,proto3" json:"proof,omitempty"` 27 Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` 28 Codespace string `protobuf:"bytes,10,opt,name=codespace,proto3" json:"codespace,omitempty"` 29 } 30 31 type CM39ResponseDeliverTx struct { 32 Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` 33 Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` 34 Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"` 35 Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` 36 GasWanted int64 `protobuf:"varint,5,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"` 37 GasUsed int64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` 38 Events []abci.Event `protobuf:"bytes,7,rep,name=events,proto3" json:"events,omitempty"` 39 Codespace string `protobuf:"bytes,8,opt,name=codespace,proto3" json:"codespace,omitempty"` 40 } 41 42 // Query abci msg 43 type CM39ResultABCIQuery struct { 44 Response CM39ResponseQuery `json:"response"` 45 } 46 47 // Result of querying for a tx 48 type CM39ResultTx struct { 49 Hash bytes.HexBytes `json:"hash"` 50 Height int64 `json:"height"` 51 Index uint32 `json:"index"` 52 TxResult CM39ResponseDeliverTx `json:"tx_result"` 53 Tx types.Tx `json:"tx"` 54 Proof types.TxProof `json:"proof,omitempty"` 55 } 56 57 ///////// 58 59 func ConvTCM39BroadcastCommitTx2CM4(c *CM39ResultBroadcastTxCommit, ret *coretypes.ResultBroadcastTxCommit) { 60 ret.CheckTx = c.CheckTx 61 ret.DeliverTx = abci.ResponseDeliverTx{ 62 Code: c.DeliverTx.Code, 63 Data: c.DeliverTx.Data, 64 Log: c.DeliverTx.Log, 65 Info: c.DeliverTx.Info, 66 GasWanted: c.DeliverTx.GasWanted, 67 GasUsed: c.DeliverTx.GasUsed, 68 Events: c.DeliverTx.Events, 69 Codespace: c.DeliverTx.Codespace, 70 } 71 ret.Hash = c.Hash 72 ret.Height = c.Height 73 } 74 75 func ConvTCM392CM4(c *CM39ResultTx, ret *coretypes.ResultTx) { 76 ret.Hash = c.Hash 77 ret.Height = c.Height 78 ret.Index = c.Index 79 ret.TxResult = abci.ResponseDeliverTx{ 80 Code: c.TxResult.Code, 81 Data: c.TxResult.Data, 82 Log: c.TxResult.Log, 83 Info: c.TxResult.Info, 84 GasWanted: c.TxResult.GasWanted, 85 GasUsed: c.TxResult.GasUsed, 86 Events: c.TxResult.Events, 87 Codespace: c.TxResult.Codespace, 88 } 89 ret.Tx = c.Tx 90 ret.Proof = c.Proof 91 } 92 93 func ConvTCM39ResultABCIQuery2CM4(c *CM39ResultABCIQuery, ret *coretypes.ResultABCIQuery) { 94 ret.Response = abci.ResponseQuery{ 95 Code: c.Response.Code, 96 Log: c.Response.Log, 97 Info: c.Response.Info, 98 Index: c.Response.Index, 99 Key: c.Response.Key, 100 Value: c.Response.Value, 101 Proof: c.Response.Proof, 102 Height: c.Response.Height, 103 Codespace: c.Response.Codespace, 104 } 105 }