aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-08 06:49:47 +0800
committerobscuren <geffobscura@gmail.com>2014-09-08 06:49:47 +0800
commit0fea62ec6d33a83e602c804ee4b5b0a7896fd9c6 (patch)
tree2d157d219e83112856cf173a7cfbc7a762fddbd5
parenta63b74e345e83d08b7a85b0602c5087ca4b06075 (diff)
downloadgo-tangerine-0fea62ec6d33a83e602c804ee4b5b0a7896fd9c6.tar.gz
go-tangerine-0fea62ec6d33a83e602c804ee4b5b0a7896fd9c6.tar.zst
go-tangerine-0fea62ec6d33a83e602c804ee4b5b0a7896fd9c6.zip
Make use of new list type for transactions instead of json
-rw-r--r--ethpipe/js_types.go34
1 files changed, 19 insertions, 15 deletions
diff --git a/ethpipe/js_types.go b/ethpipe/js_types.go
index d9cbef12d..8d2805f3d 100644
--- a/ethpipe/js_types.go
+++ b/ethpipe/js_types.go
@@ -1,7 +1,6 @@
package ethpipe
import (
- "encoding/json"
"strconv"
"strings"
@@ -13,16 +12,17 @@ import (
// Block interface exposed to QML
type JSBlock struct {
+ //Transactions string `json:"transactions"`
ref *ethchain.Block
- Size string `json:"size"`
- Number int `json:"number"`
- Hash string `json:"hash"`
- Transactions string `json:"transactions"`
- Time int64 `json:"time"`
- Coinbase string `json:"coinbase"`
- Name string `json:"name"`
- GasLimit string `json:"gasLimit"`
- GasUsed string `json:"gasUsed"`
+ Size string `json:"size"`
+ Number int `json:"number"`
+ Hash string `json:"hash"`
+ Transactions *ethutil.List `json:"transactions"`
+ Time int64 `json:"time"`
+ Coinbase string `json:"coinbase"`
+ Name string `json:"name"`
+ GasLimit string `json:"gasLimit"`
+ GasUsed string `json:"gasUsed"`
}
// Creates a new QML Block from a chain block
@@ -36,12 +36,16 @@ func NewJSBlock(block *ethchain.Block) *JSBlock {
ptxs = append(ptxs, *NewJSTx(tx))
}
- txJson, err := json.Marshal(ptxs)
- if err != nil {
- return nil
- }
+ /*
+ txJson, err := json.Marshal(ptxs)
+ if err != nil {
+ return nil
+ }
+ return &JSBlock{ref: block, Size: block.Size().String(), Number: int(block.Number.Uint64()), GasUsed: block.GasUsed.String(), GasLimit: block.GasLimit.String(), Hash: ethutil.Bytes2Hex(block.Hash()), Transactions: string(txJson), Time: block.Time, Coinbase: ethutil.Bytes2Hex(block.Coinbase)}
+ */
+ list := ethutil.NewList(ptxs)
- return &JSBlock{ref: block, Size: block.Size().String(), Number: int(block.Number.Uint64()), GasUsed: block.GasUsed.String(), GasLimit: block.GasLimit.String(), Hash: ethutil.Bytes2Hex(block.Hash()), Transactions: string(txJson), Time: block.Time, Coinbase: ethutil.Bytes2Hex(block.Coinbase)}
+ return &JSBlock{ref: block, Size: block.Size().String(), Number: int(block.Number.Uint64()), GasUsed: block.GasUsed.String(), GasLimit: block.GasLimit.String(), Hash: ethutil.Bytes2Hex(block.Hash()), Transactions: list, Time: block.Time, Coinbase: ethutil.Bytes2Hex(block.Coinbase)}
}
func (self *JSBlock) ToString() string {