From 4391c3821567b1f5718b39ed660afb6cf65eeba3 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 1 Apr 2015 23:22:03 +0200 Subject: Changed getters on account objects. Closes #610 * GetCode * GetNonce * GetStorage * GetBalance --- xeth/xeth.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index 5936c0fb2..0a813ec99 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -308,21 +308,19 @@ func (self *XEth) NumberToHuman(balance string) string { } func (self *XEth) StorageAt(addr, storageAddr string) string { - storage := self.State().SafeGet(addr).StorageString(storageAddr) - - return common.ToHex(storage.Bytes()) + return common.ToHex(self.State().state.GetState(common.HexToAddress(addr), common.HexToHash(storageAddr))) } func (self *XEth) BalanceAt(addr string) string { - return self.State().SafeGet(addr).Balance().String() + return self.State().state.GetBalance(common.HexToAddress(addr)).String() } func (self *XEth) TxCountAt(address string) int { - return int(self.State().SafeGet(address).Nonce()) + return int(self.State().state.GetNonce(common.HexToAddress(address))) } func (self *XEth) CodeAt(address string) string { - return common.ToHex(self.State().SafeGet(address).Code()) + return common.ToHex(self.State().state.GetCode(common.HexToAddress(address))) } func (self *XEth) IsContract(address string) bool { -- cgit From 0f3bf7ef4de95b8012eb9bba717323b9e89c5908 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 2 Apr 2015 12:57:04 +0200 Subject: Fixes for balance --- xeth/xeth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index 0a813ec99..d9a34695a 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -312,7 +312,7 @@ func (self *XEth) StorageAt(addr, storageAddr string) string { } func (self *XEth) BalanceAt(addr string) string { - return self.State().state.GetBalance(common.HexToAddress(addr)).String() + return common.ToHex(self.State().state.GetBalance(common.HexToAddress(addr)).Bytes()) } func (self *XEth) TxCountAt(address string) int { -- cgit