aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/types.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
committerobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
commitb5234413611ce5984292f85a01de1f56c045b490 (patch)
treee6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /xeth/types.go
parent0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff)
downloaddexon-b5234413611ce5984292f85a01de1f56c045b490.tar.gz
dexon-b5234413611ce5984292f85a01de1f56c045b490.tar.zst
dexon-b5234413611ce5984292f85a01de1f56c045b490.zip
Moved ethutil => common
Diffstat (limited to 'xeth/types.go')
-rw-r--r--xeth/types.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/xeth/types.go b/xeth/types.go
index 3dc25a2ea..e15305481 100644
--- a/xeth/types.go
+++ b/xeth/types.go
@@ -8,14 +8,14 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/state"
)
func toHex(b []byte) string {
- return "0x" + ethutil.Bytes2Hex(b)
+ return "0x" + common.Bytes2Hex(b)
}
type Object struct {
@@ -26,20 +26,20 @@ func NewObject(state *state.StateObject) *Object {
return &Object{state}
}
-func (self *Object) StorageString(str string) *ethutil.Value {
- if ethutil.IsHex(str) {
- return self.storage(ethutil.Hex2Bytes(str[2:]))
+func (self *Object) StorageString(str string) *common.Value {
+ if common.IsHex(str) {
+ return self.storage(common.Hex2Bytes(str[2:]))
} else {
- return self.storage(ethutil.RightPadBytes([]byte(str), 32))
+ return self.storage(common.RightPadBytes([]byte(str), 32))
}
}
-func (self *Object) StorageValue(addr *ethutil.Value) *ethutil.Value {
+func (self *Object) StorageValue(addr *common.Value) *common.Value {
return self.storage(addr.Bytes())
}
-func (self *Object) storage(addr []byte) *ethutil.Value {
- return self.StateObject.GetStorage(ethutil.BigD(addr))
+func (self *Object) storage(addr []byte) *common.Value {
+ return self.StateObject.GetStorage(common.BigD(addr))
}
func (self *Object) Storage() (storage map[string]string) {
@@ -62,8 +62,8 @@ type Block struct {
Size string `json:"size"`
Number int `json:"number"`
Hash string `json:"hash"`
- Transactions *ethutil.List `json:"transactions"`
- Uncles *ethutil.List `json:"uncles"`
+ Transactions *common.List `json:"transactions"`
+ Uncles *common.List `json:"uncles"`
Time int64 `json:"time"`
Coinbase string `json:"coinbase"`
Name string `json:"name"`
@@ -84,13 +84,13 @@ func NewBlock(block *types.Block) *Block {
for i, tx := range block.Transactions() {
ptxs[i] = NewTx(tx)
}
- txlist := ethutil.NewList(ptxs)
+ txlist := common.NewList(ptxs)
puncles := make([]*Block, len(block.Uncles()))
for i, uncle := range block.Uncles() {
puncles[i] = NewBlock(types.NewBlockWithHeader(uncle))
}
- ulist := ethutil.NewList(puncles)
+ ulist := common.NewList(puncles)
return &Block{
ref: block, Size: block.Size().String(),
@@ -114,7 +114,7 @@ func (self *Block) ToString() string {
}
func (self *Block) GetTransaction(hash string) *Transaction {
- tx := self.ref.Transaction(ethutil.FromHex(hash))
+ tx := self.ref.Transaction(common.FromHex(hash))
if tx == nil {
return nil
}
@@ -154,7 +154,7 @@ func NewTx(tx *types.Transaction) *Transaction {
data = toHex(tx.Data())
}
- return &Transaction{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value()), Address: receiver, Contract: createsContract, Gas: tx.Gas().String(), GasPrice: tx.GasPrice().String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: toHex(tx.Data())}
+ return &Transaction{ref: tx, Hash: hash, Value: common.CurrencyToString(tx.Value()), Address: receiver, Contract: createsContract, Gas: tx.Gas().String(), GasPrice: tx.GasPrice().String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: toHex(tx.Data())}
}
func (self *Transaction) ToString() string {