aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api.go22
-rw-r--r--rpc/args.go42
-rw-r--r--rpc/util.go4
3 files changed, 34 insertions, 34 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 2137de356..1846e7db5 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -13,7 +13,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/state"
@@ -43,7 +43,7 @@ type EthereumApi struct {
regmut sync.Mutex
register map[string][]*NewTxArgs
- db ethutil.Database
+ db common.Database
}
func NewEthereumApi(eth *xeth.XEth, dataDir string) *EthereumApi {
@@ -241,7 +241,7 @@ func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) (err error)
// p.register[args.From] = append(p.register[args.From], args)
//} else {
/*
- account := accounts.Get(ethutil.FromHex(args.From))
+ account := accounts.Get(common.FromHex(args.From))
if account != nil {
if account.Unlocked() {
if !unlockAccount(account) {
@@ -249,7 +249,7 @@ func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) (err error)
}
}
- result, _ := account.Transact(ethutil.FromHex(args.To), ethutil.FromHex(args.Value), ethutil.FromHex(args.Gas), ethutil.FromHex(args.GasPrice), ethutil.FromHex(args.Data))
+ result, _ := account.Transact(common.FromHex(args.To), common.FromHex(args.Value), common.FromHex(args.Gas), common.FromHex(args.GasPrice), common.FromHex(args.Data))
if len(result) > 0 {
*reply = toHex(result)
}
@@ -258,7 +258,7 @@ func (p *EthereumApi) Transact(args *NewTxArgs, reply *interface{}) (err error)
}
*/
// TODO: align default values to have the same type, e.g. not depend on
- // ethutil.Value conversions later on
+ // common.Value conversions later on
if args.Gas.Cmp(big.NewInt(0)) == 0 {
args.Gas = defaultGas
}
@@ -316,7 +316,7 @@ func (p *EthereumApi) GetStorageAt(args *GetStorageAtArgs, reply *interface{}) e
} else {
// Convert the incoming string (which is a bigint) into hex
i, _ := new(big.Int).SetString(args.Key, 10)
- hx = ethutil.Bytes2Hex(i.Bytes())
+ hx = common.Bytes2Hex(i.Bytes())
}
rpclogger.Debugf("GetStateAt(%s, %s)\n", args.Address, hx)
*reply = map[string]string{args.Key: value.Str()}
@@ -480,7 +480,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- *reply = toHex(crypto.Sha3(ethutil.FromHex(args.Data)))
+ *reply = toHex(crypto.Sha3(common.FromHex(args.Data)))
case "web3_clientVersion":
*reply = p.xeth().Backend().Version()
case "net_version":
@@ -821,12 +821,12 @@ func toFilterOptions(options *FilterOptions) core.FilterOptions {
// Convert optional address slice/string to byte slice
if str, ok := options.Address.(string); ok {
- opts.Address = [][]byte{ethutil.FromHex(str)}
+ opts.Address = [][]byte{common.FromHex(str)}
} else if slice, ok := options.Address.([]interface{}); ok {
bslice := make([][]byte, len(slice))
for i, addr := range slice {
if saddr, ok := addr.(string); ok {
- bslice[i] = ethutil.FromHex(saddr)
+ bslice[i] = common.FromHex(saddr)
}
}
opts.Address = bslice
@@ -840,11 +840,11 @@ func toFilterOptions(options *FilterOptions) core.FilterOptions {
if slice, ok := topicDat.([]interface{}); ok {
topics[i] = make([][]byte, len(slice))
for j, topic := range slice {
- topics[i][j] = ethutil.FromHex(topic.(string))
+ topics[i][j] = common.FromHex(topic.(string))
}
} else if str, ok := topicDat.(string); ok {
topics[i] = make([][]byte, 1)
- topics[i][0] = ethutil.FromHex(str)
+ topics[i][0] = common.FromHex(str)
}
}
opts.Topics = topics
diff --git a/rpc/args.go b/rpc/args.go
index b935c5007..7ed482c30 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -5,7 +5,7 @@ import (
"encoding/json"
"math/big"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
)
func blockNumber(raw json.RawMessage, number *int64) (err error) {
@@ -20,7 +20,7 @@ func blockNumber(raw json.RawMessage, number *int64) (err error) {
case "pending":
*number = 0
default:
- *number = ethutil.String2Big(str).Int64()
+ *number = common.String2Big(str).Int64()
}
return nil
}
@@ -73,7 +73,7 @@ func (args *GetBlockByNumberArgs) UnmarshalJSON(b []byte) (err error) {
if v, ok := obj[0].(float64); ok {
args.BlockNumber = int64(v)
} else {
- args.BlockNumber = ethutil.Big(obj[0].(string)).Int64()
+ args.BlockNumber = common.Big(obj[0].(string)).Int64()
}
if len(obj) > 1 {
@@ -102,9 +102,9 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
args.From = obj.From
args.To = obj.To
- args.Value = ethutil.Big(obj.Value)
- args.Gas = ethutil.Big(obj.Gas)
- args.GasPrice = ethutil.Big(obj.GasPrice)
+ args.Value = common.Big(obj.Value)
+ args.Gas = common.Big(obj.Gas)
+ args.GasPrice = common.Big(obj.GasPrice)
args.Data = obj.Data
return nil
@@ -208,7 +208,7 @@ func (args *GetBalanceArgs) UnmarshalJSON(b []byte) (err error) {
if obj[1].(string) == "latest" {
args.BlockNumber = -1
} else {
- args.BlockNumber = ethutil.Big(obj[1].(string)).Int64()
+ args.BlockNumber = common.Big(obj[1].(string)).Int64()
}
}
@@ -266,14 +266,14 @@ func (args *BlockNumIndexArgs) UnmarshalJSON(b []byte) (err error) {
if !ok {
return NewDecodeParamError("BlockNumber is not string")
}
- args.BlockNumber = ethutil.Big(arg0).Int64()
+ args.BlockNumber = common.Big(arg0).Int64()
if len(obj) > 1 {
arg1, ok := obj[1].(string)
if !ok {
return NewDecodeParamError("Index not a string")
}
- args.Index = ethutil.Big(arg1).Int64()
+ args.Index = common.Big(arg1).Int64()
}
return nil
@@ -306,7 +306,7 @@ func (args *HashIndexArgs) UnmarshalJSON(b []byte) (err error) {
if !ok {
return NewDecodeParamError("Index not a string")
}
- args.Index = ethutil.Big(arg1).Int64()
+ args.Index = common.Big(arg1).Int64()
}
return nil
@@ -357,10 +357,10 @@ func (args *Sha3Args) UnmarshalJSON(b []byte) (err error) {
// if len(obj) < 1 {
// return errArguments
// }
-// args.FromBlock = uint64(ethutil.Big(obj[0].FromBlock).Int64())
-// args.ToBlock = uint64(ethutil.Big(obj[0].ToBlock).Int64())
-// args.Limit = uint64(ethutil.Big(obj[0].Limit).Int64())
-// args.Offset = uint64(ethutil.Big(obj[0].Offset).Int64())
+// args.FromBlock = uint64(common.Big(obj[0].FromBlock).Int64())
+// args.ToBlock = uint64(common.Big(obj[0].ToBlock).Int64())
+// args.Limit = uint64(common.Big(obj[0].Limit).Int64())
+// args.Offset = uint64(common.Big(obj[0].Offset).Int64())
// args.Address = obj[0].Address
// args.Topics = obj[0].Topics
@@ -394,10 +394,10 @@ func (args *FilterOptions) UnmarshalJSON(b []byte) (err error) {
return NewInsufficientParamsError(len(obj), 1)
}
- args.Earliest = int64(ethutil.Big(obj[0].FromBlock).Int64())
- args.Latest = int64(ethutil.Big(obj[0].ToBlock).Int64())
- args.Max = int(ethutil.Big(obj[0].Limit).Int64())
- args.Skip = int(ethutil.Big(obj[0].Offset).Int64())
+ args.Earliest = int64(common.Big(obj[0].FromBlock).Int64())
+ args.Latest = int64(common.Big(obj[0].ToBlock).Int64())
+ args.Max = int(common.Big(obj[0].Limit).Int64())
+ args.Skip = int(common.Big(obj[0].Offset).Int64())
args.Address = obj[0].Address
args.Topics = obj[0].Topics
@@ -474,8 +474,8 @@ func (args *WhisperMessageArgs) UnmarshalJSON(b []byte) (err error) {
args.To = obj[0].To
args.From = obj[0].From
args.Topics = obj[0].Topics
- args.Priority = uint32(ethutil.Big(obj[0].Priority).Int64())
- args.Ttl = uint32(ethutil.Big(obj[0].Ttl).Int64())
+ args.Priority = uint32(common.Big(obj[0].Priority).Int64())
+ args.Ttl = uint32(common.Big(obj[0].Ttl).Int64())
return nil
}
@@ -538,7 +538,7 @@ func (args *FilterIdArgs) UnmarshalJSON(b []byte) (err error) {
return NewInsufficientParamsError(len(obj), 1)
}
- args.Id = int(ethutil.Big(obj[0]).Int64())
+ args.Id = int(common.Big(obj[0]).Int64())
return nil
}
diff --git a/rpc/util.go b/rpc/util.go
index 4acd90284..08f404c99 100644
--- a/rpc/util.go
+++ b/rpc/util.go
@@ -25,7 +25,7 @@ import (
"reflect"
"time"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/xeth"
@@ -120,7 +120,7 @@ func (self JsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error)
}
func toHex(b []byte) string {
- hex := ethutil.Bytes2Hex(b)
+ hex := common.Bytes2Hex(b)
// Prefer output of "0x0" instead of "0x"
if len(hex) == 0 {
hex = "0"