Begin of moving objects to types package

* Block(s)
* Transaction(s)
This commit is contained in:
obscuren
2014-11-18 16:58:22 +01:00
parent 62cd9946ee
commit a1b6a9ac29
33 changed files with 189 additions and 151 deletions

View File

@ -6,6 +6,7 @@ import (
"strings"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
@ -14,7 +15,7 @@ import (
// Block interface exposed to QML
type JSBlock struct {
//Transactions string `json:"transactions"`
ref *chain.Block
ref *types.Block
Size string `json:"size"`
Number int `json:"number"`
Hash string `json:"hash"`
@ -31,7 +32,7 @@ type JSBlock struct {
}
// Creates a new QML Block from a chain block
func NewJSBlock(block *chain.Block) *JSBlock {
func NewJSBlock(block *types.Block) *JSBlock {
if block == nil {
return &JSBlock{}
}
@ -79,7 +80,7 @@ func (self *JSBlock) GetTransaction(hash string) *JSTransaction {
}
type JSTransaction struct {
ref *chain.Transaction
ref *types.Transaction
Value string `json:"value"`
Gas string `json:"gas"`
@ -94,7 +95,7 @@ type JSTransaction struct {
Confirmations int `json:"confirmations"`
}
func NewJSTx(tx *chain.Transaction, state *state.State) *JSTransaction {
func NewJSTx(tx *types.Transaction, state *state.State) *JSTransaction {
hash := ethutil.Bytes2Hex(tx.Hash())
receiver := ethutil.Bytes2Hex(tx.Recipient)
if receiver == "0000000000000000000000000000000000000000" {