@@ -5,10 +5,10 @@ import (
55 "fmt"
66 "strings"
77
8+ "github.com/ethereum/go-ethereum/common"
89 "github.com/ethereum/go-ethereum/core"
910 "github.com/ethereum/go-ethereum/core/types"
1011 "github.com/ethereum/go-ethereum/crypto"
11- "github.com/ethereum/go-ethereum/common"
1212 "github.com/ethereum/go-ethereum/p2p"
1313 "github.com/ethereum/go-ethereum/rlp"
1414 "github.com/ethereum/go-ethereum/state"
@@ -59,19 +59,19 @@ func (self *Object) Storage() (storage map[string]string) {
5959type Block struct {
6060 //Transactions string `json:"transactions"`
6161 ref * types.Block
62- Size string `json:"size"`
63- Number int `json:"number"`
64- Hash string `json:"hash"`
62+ Size string `json:"size"`
63+ Number int `json:"number"`
64+ Hash string `json:"hash"`
6565 Transactions * common.List `json:"transactions"`
6666 Uncles * common.List `json:"uncles"`
67- Time int64 `json:"time"`
68- Coinbase string `json:"coinbase"`
69- Name string `json:"name"`
70- GasLimit string `json:"gasLimit"`
71- GasUsed string `json:"gasUsed"`
72- PrevHash string `json:"prevHash"`
73- Bloom string `json:"bloom"`
74- Raw string `json:"raw"`
67+ Time int64 `json:"time"`
68+ Coinbase string `json:"coinbase"`
69+ Name string `json:"name"`
70+ GasLimit string `json:"gasLimit"`
71+ GasUsed string `json:"gasUsed"`
72+ PrevHash string `json:"prevHash"`
73+ Bloom string `json:"bloom"`
74+ Raw string `json:"raw"`
7575}
7676
7777// Creates a new QML Block from a chain block
@@ -95,12 +95,12 @@ func NewBlock(block *types.Block) *Block {
9595 return & Block {
9696 ref : block , Size : block .Size ().String (),
9797 Number : int (block .NumberU64 ()), GasUsed : block .GasUsed ().String (),
98- GasLimit : block .GasLimit ().String (), Hash : toHex (block .Hash ()),
98+ GasLimit : block .GasLimit ().String (), Hash : toHex (block .Hash (). Bytes () ),
9999 Transactions : txlist , Uncles : ulist ,
100100 Time : block .Time (),
101- Coinbase : toHex (block .Coinbase ()),
102- PrevHash : toHex (block .ParentHash ()),
103- Bloom : toHex (block .Bloom ()),
101+ Coinbase : toHex (block .Coinbase (). Bytes () ),
102+ PrevHash : toHex (block .ParentHash (). Bytes () ),
103+ Bloom : toHex (block .Bloom (). Bytes () ),
104104 Raw : block .String (),
105105 }
106106}
@@ -114,7 +114,7 @@ func (self *Block) ToString() string {
114114}
115115
116116func (self * Block ) GetTransaction (hash string ) * Transaction {
117- tx := self .ref .Transaction (common .FromHex (hash ))
117+ tx := self .ref .Transaction (common .HexToHash (hash ))
118118 if tx == nil {
119119 return nil
120120 }
@@ -139,8 +139,8 @@ type Transaction struct {
139139}
140140
141141func NewTx (tx * types.Transaction ) * Transaction {
142- hash := toHex ( tx .Hash ())
143- receiver := toHex ( tx .To ())
142+ hash := tx .Hash (). Hex ( )
143+ receiver := tx .To (). Hex ( )
144144 if len (receiver ) == 0 {
145145 receiver = toHex (core .AddressFromMessage (tx ))
146146 }
0 commit comments