diff options
Diffstat (limited to 'ethpub/types.go')
-rw-r--r-- | ethpub/types.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/ethpub/types.go b/ethpub/types.go index 52ea5a6bb..faf75bbe1 100644 --- a/ethpub/types.go +++ b/ethpub/types.go @@ -3,11 +3,13 @@ package ethpub import ( "encoding/json" "fmt" + "strings" + "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethcrypto" + "github.com/ethereum/eth-go/ethstate" "github.com/ethereum/eth-go/ethtrie" "github.com/ethereum/eth-go/ethutil" - "strings" ) // Peer interface exposed to QML @@ -154,10 +156,10 @@ func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) * } type PStateObject struct { - object *ethchain.StateObject + object *ethstate.StateObject } -func NewPStateObject(object *ethchain.StateObject) *PStateObject { +func NewPStateObject(object *ethstate.StateObject) *PStateObject { return &PStateObject{object: object} } @@ -174,9 +176,9 @@ func (c *PStateObject) GetStorage(address string) string { return "" } -func (c *PStateObject) Value() string { +func (c *PStateObject) Balance() string { if c.object != nil { - return c.object.Amount.String() + return c.object.Balance.String() } return "" @@ -200,7 +202,7 @@ func (c *PStateObject) Nonce() int { func (c *PStateObject) Root() string { if c.object != nil { - return ethutil.Bytes2Hex(ethutil.NewValue(c.object.State().Root()).Bytes()) + return ethutil.Bytes2Hex(ethutil.NewValue(c.object.State.Root()).Bytes()) } return "<err>" @@ -208,7 +210,7 @@ func (c *PStateObject) Root() string { func (c *PStateObject) IsContract() bool { if c.object != nil { - return len(c.object.Script()) > 0 + return len(c.object.Code) > 0 } return false @@ -245,7 +247,7 @@ func (c *PStateObject) StateKeyVal(asJson bool) interface{} { func (c *PStateObject) Script() string { if c.object != nil { - return strings.Join(ethchain.Disassemble(c.object.Script()), " ") + return strings.Join(ethchain.Disassemble(c.object.Code), " ") } return "" @@ -253,7 +255,7 @@ func (c *PStateObject) Script() string { func (c *PStateObject) HexScript() string { if c.object != nil { - return ethutil.Bytes2Hex(c.object.Script()) + return ethutil.Bytes2Hex(c.object.Code) } return "" @@ -265,6 +267,6 @@ type PStorageState struct { Value string } -func NewPStorageState(storageObject *ethchain.StorageState) *PStorageState { +func NewPStorageState(storageObject *ethstate.StorageState) *PStorageState { return &PStorageState{ethutil.Bytes2Hex(storageObject.StateAddress), ethutil.Bytes2Hex(storageObject.Address), storageObject.Value.String()} } |