|
|
@ -8,16 +8,26 @@ import ( |
|
|
|
|
|
|
|
|
|
|
|
// Block interface exposed to QML
|
|
|
|
// Block interface exposed to QML
|
|
|
|
type PBlock struct { |
|
|
|
type PBlock struct { |
|
|
|
|
|
|
|
ref *ethchain.Block |
|
|
|
Number int `json:"number"` |
|
|
|
Number int `json:"number"` |
|
|
|
Hash string `json:"hash"` |
|
|
|
Hash string `json:"hash"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Creates a new QML Block from a chain block
|
|
|
|
// Creates a new QML Block from a chain block
|
|
|
|
func NewPBlock(block *ethchain.Block) *PBlock { |
|
|
|
func NewPBlock(block *ethchain.Block) *PBlock { |
|
|
|
info := block.BlockInfo() |
|
|
|
if block == nil { |
|
|
|
hash := hex.EncodeToString(block.Hash()) |
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return &PBlock{ref: block, Number: int(block.Number.Uint64()), Hash: ethutil.Hex(block.Hash())} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return &PBlock{Number: int(info.Number), Hash: hash} |
|
|
|
func (self *PBlock) ToString() string { |
|
|
|
|
|
|
|
if self.ref != nil { |
|
|
|
|
|
|
|
return self.ref.String() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return "" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type PTx struct { |
|
|
|
type PTx struct { |
|
|
|