aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 05:35:42 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-27 05:35:42 +0800
commitbb12dbe233db2e064715b329b7ba987c76ba3bfa (patch)
tree5297b21e7cbcfc4ab04b51ea0f7dc9b622948393 /rpc/api.go
parent7eed7e1d965ed7194ca42e4637754b63fb4502a5 (diff)
downloadgo-tangerine-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar
go-tangerine-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.gz
go-tangerine-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.bz2
go-tangerine-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.lz
go-tangerine-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.xz
go-tangerine-bb12dbe233db2e064715b329b7ba987c76ba3bfa.tar.zst
go-tangerine-bb12dbe233db2e064715b329b7ba987c76ba3bfa.zip
Prefer args as strings not objects
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go36
1 files changed, 18 insertions, 18 deletions
diff --git a/rpc/api.go b/rpc/api.go
index cdd95c888..76fa9b9df 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -94,7 +94,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- v := api.xethAtStateNum(args.BlockNumber).State().SafeGet(args.Address.Hex()).Balance()
+ v := api.xethAtStateNum(args.BlockNumber).State().SafeGet(args.Address).Balance()
*reply = common.ToHex(v.Bytes())
case "eth_getStorage", "eth_storageAt":
args := new(GetStorageArgs)
@@ -102,15 +102,15 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- *reply = api.xethAtStateNum(args.BlockNumber).State().SafeGet(args.Address.Hex()).Storage()
+ *reply = api.xethAtStateNum(args.BlockNumber).State().SafeGet(args.Address).Storage()
case "eth_getStorageAt":
args := new(GetStorageAtArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- state := api.xethAtStateNum(args.BlockNumber).State().SafeGet(args.Address.Hex())
- value := state.StorageString(args.Key.Hex())
+ state := api.xethAtStateNum(args.BlockNumber).State().SafeGet(args.Address)
+ value := state.StorageString(args.Key)
*reply = common.Bytes2Hex(value.Bytes())
case "eth_getTransactionCount":
@@ -119,14 +119,14 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- *reply = api.xethAtStateNum(args.BlockNumber).TxCountAt(args.Address.Hex())
+ *reply = api.xethAtStateNum(args.BlockNumber).TxCountAt(args.Address)
case "eth_getBlockTransactionCountByHash":
args := new(GetBlockByHashArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- block := NewBlockRes(api.xeth().EthBlockByHash(args.BlockHash.Hex()))
+ block := NewBlockRes(api.xeth().EthBlockByHash(args.BlockHash))
*reply = common.ToHex(big.NewInt(int64(len(block.Transactions))).Bytes())
case "eth_getBlockTransactionCountByNumber":
args := new(GetBlockByNumberArgs)
@@ -142,7 +142,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- block := api.xeth().EthBlockByHash(args.BlockHash.Hex())
+ block := api.xeth().EthBlockByHash(args.BlockHash)
br := NewBlockRes(block)
*reply = common.ToHex(big.NewInt(int64(len(br.Uncles))).Bytes())
case "eth_getUncleCountByBlockNumber":
@@ -159,14 +159,14 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- *reply = api.xethAtStateNum(args.BlockNumber).CodeAt(args.Address.Hex())
+ *reply = api.xethAtStateNum(args.BlockNumber).CodeAt(args.Address)
case "eth_sendTransaction", "eth_transact":
args := new(NewTxArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- v, err := api.xeth().Transact(args.From.Hex(), args.To.Hex(), args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data)
+ v, err := api.xeth().Transact(args.From, args.To, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data)
if err != nil {
return err
}
@@ -177,7 +177,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- v, err := api.xethAtStateNum(args.BlockNumber).Call(args.From.Hex(), args.To.Hex(), args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data)
+ v, err := api.xethAtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data)
if err != nil {
return err
}
@@ -191,7 +191,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- block := api.xeth().EthBlockByHash(args.BlockHash.Hex())
+ block := api.xeth().EthBlockByHash(args.BlockHash)
br := NewBlockRes(block)
br.fullTx = args.IncludeTxs
@@ -222,7 +222,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- block := api.xeth().EthBlockByHash(args.Hash.Hex())
+ block := api.xeth().EthBlockByHash(args.Hash)
br := NewBlockRes(block)
br.fullTx = true
@@ -250,14 +250,14 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
- br := NewBlockRes(api.xeth().EthBlockByHash(args.Hash.Hex()))
+ br := NewBlockRes(api.xeth().EthBlockByHash(args.Hash))
if args.Index > int64(len(br.Uncles)) || args.Index < 0 {
return NewValidationError("Index", "does not exist")
}
- uhash := br.Uncles[args.Index].Hex()
- uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash))
+ uhash := br.Uncles[args.Index]
+ uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash.Hex()))
*reply = uncle
case "eth_getUncleByBlockNumberAndIndex":
@@ -274,8 +274,8 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return NewValidationError("Index", "does not exist")
}
- uhash := v.Uncles[args.Index].Hex()
- uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash))
+ uhash := v.Uncles[args.Index]
+ uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash.Hex()))
*reply = uncle
case "eth_getCompilers":
@@ -332,7 +332,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- *reply = api.xeth().RemoteMining().SubmitWork(args.Nonce, args.Digest, args.Header)
+ *reply = api.xeth().RemoteMining().SubmitWork(args.Nonce, common.HexToHash(args.Digest), common.HexToHash(args.Header))
case "db_putString":
args := new(DbArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {