Remove JsonWrapper
This commit is contained in:
16
rpc/util.go
16
rpc/util.go
@ -19,9 +19,7 @@ package rpc
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/big"
|
||||
// "net/http"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
@ -33,8 +31,6 @@ import (
|
||||
|
||||
var rpclogger = logger.NewLogger("RPC")
|
||||
|
||||
type JsonWrapper struct{}
|
||||
|
||||
// Unmarshal state is a helper method which has the ability to decode messsages
|
||||
// that use the `defaultBlock` (https://github.com/ethereum/wiki/wiki/JSON-RPC#the-default-block-parameter)
|
||||
// For example a `call`: [{to: "0x....", data:"0x..."}, "latest"]. The first argument is the transaction
|
||||
@ -94,18 +90,6 @@ func UnmarshalRawMessages(b []byte, iface interface{}, number *int64) (err error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self JsonWrapper) Send(writer io.Writer, v interface{}) (n int, err error) {
|
||||
var payload []byte
|
||||
payload, err = json.MarshalIndent(v, "", "\t")
|
||||
if err != nil {
|
||||
rpclogger.Fatalln("Error marshalling JSON", err)
|
||||
return 0, err
|
||||
}
|
||||
rpclogger.DebugDetailf("Sending payload: %s", payload)
|
||||
|
||||
return writer.Write(payload)
|
||||
}
|
||||
|
||||
func toHex(b []byte) string {
|
||||
hex := common.Bytes2Hex(b)
|
||||
// Prefer output of "0x0" instead of "0x"
|
||||
|
Reference in New Issue
Block a user