|
|
|
@ -6,7 +6,9 @@ import ( |
|
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil" |
|
|
|
|
ethtypes "github.com/ethereum/go-ethereum/core/types" |
|
|
|
|
"github.com/harmony-one/harmony/block" |
|
|
|
|
"github.com/harmony-one/harmony/core/types" |
|
|
|
|
common2 "github.com/harmony-one/harmony/internal/common" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
|
|
|
|
@ -41,6 +43,28 @@ type RPCCXReceipt struct { |
|
|
|
|
Amount *hexutil.Big `json:"value"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// HeaderInformation represents the latest consensus information
|
|
|
|
|
type HeaderInformation struct { |
|
|
|
|
BlockHash common.Hash `json:"blockHash"` |
|
|
|
|
BlockNumber uint64 `json:"blockNumber"` |
|
|
|
|
ShardID uint32 `json:"shardID"` |
|
|
|
|
Leader string `json:"leader"` |
|
|
|
|
ViewID uint64 `json:"viewID"` |
|
|
|
|
Epoch uint64 `json:"epoch"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func newHeaderInformation(header *block.Header) *HeaderInformation { |
|
|
|
|
result := &HeaderInformation{ |
|
|
|
|
BlockHash: header.Hash(), |
|
|
|
|
BlockNumber: header.Number().Uint64(), |
|
|
|
|
ShardID: header.ShardID(), |
|
|
|
|
Leader: common2.MustAddressToBech32(header.Coinbase()), |
|
|
|
|
ViewID: header.ViewID().Uint64(), |
|
|
|
|
Epoch: header.Epoch().Uint64(), |
|
|
|
|
} |
|
|
|
|
return result |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// newRPCCXReceipt returns a CXReceipt that will serialize to the RPC representation
|
|
|
|
|
func newRPCCXReceipt(cx *types.CXReceipt, blockHash common.Hash, blockNumber uint64) *RPCCXReceipt { |
|
|
|
|
result := &RPCCXReceipt{ |
|
|
|
|