More dapp samples
* Info DApp, coin DApp * Additional rpc methods
This commit is contained in:
		| @@ -35,20 +35,31 @@ func NewObject(state *state.StateObject) *Object { | ||||
|  | ||||
| func (self *Object) StorageString(str string) *ethutil.Value { | ||||
| 	if ethutil.IsHex(str) { | ||||
| 		return self.Storage(ethutil.Hex2Bytes(str[2:])) | ||||
| 		return self.storage(ethutil.Hex2Bytes(str[2:])) | ||||
| 	} else { | ||||
| 		return self.Storage(ethutil.RightPadBytes([]byte(str), 32)) | ||||
| 		return self.storage(ethutil.RightPadBytes([]byte(str), 32)) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (self *Object) StorageValue(addr *ethutil.Value) *ethutil.Value { | ||||
| 	return self.Storage(addr.Bytes()) | ||||
| 	return self.storage(addr.Bytes()) | ||||
| } | ||||
|  | ||||
| func (self *Object) Storage(addr []byte) *ethutil.Value { | ||||
| func (self *Object) storage(addr []byte) *ethutil.Value { | ||||
| 	return self.StateObject.GetStorage(ethutil.BigD(addr)) | ||||
| } | ||||
|  | ||||
| func (self *Object) Storage() (storage map[string]string) { | ||||
| 	storage = make(map[string]string) | ||||
|  | ||||
| 	it := self.StateObject.Trie().Iterator() | ||||
| 	for it.Next() { | ||||
| 		storage[toHex(it.Key)] = toHex(it.Value) | ||||
| 	} | ||||
|  | ||||
| 	return | ||||
| } | ||||
|  | ||||
| // Block interface exposed to QML | ||||
| type Block struct { | ||||
| 	//Transactions string `json:"transactions"` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user