aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-06-22 19:19:59 +0800
committerBas van Kervel <bas@ethdev.com>2015-06-22 19:19:59 +0800
commit6d596b1ad106db964d4b6a60d35948b588e32b58 (patch)
treebcab096de32eb5f59dc7dd86e453baf5dc9fbc89 /rpc
parent2e0b56a72b3eafc89938003da29c06496ac9ad4e (diff)
downloaddexon-6d596b1ad106db964d4b6a60d35948b588e32b58.tar
dexon-6d596b1ad106db964d4b6a60d35948b588e32b58.tar.gz
dexon-6d596b1ad106db964d4b6a60d35948b588e32b58.tar.bz2
dexon-6d596b1ad106db964d4b6a60d35948b588e32b58.tar.lz
dexon-6d596b1ad106db964d4b6a60d35948b588e32b58.tar.xz
dexon-6d596b1ad106db964d4b6a60d35948b588e32b58.tar.zst
dexon-6d596b1ad106db964d4b6a60d35948b588e32b58.zip
fixed eth sign unittest
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api/eth.go4
-rw-r--r--rpc/api/eth_args.go12
-rw-r--r--rpc/api/eth_js.go17
-rw-r--r--rpc/api/utils.go2
-rw-r--r--rpc/shared/utils.go1
5 files changed, 27 insertions, 9 deletions
diff --git a/rpc/api/eth.go b/rpc/api/eth.go
index 0bb8d449b..0dff138c6 100644
--- a/rpc/api/eth.go
+++ b/rpc/api/eth.go
@@ -46,7 +46,7 @@ var (
"eth_getData": (*ethApi).GetData,
"eth_getCode": (*ethApi).GetData,
"eth_sign": (*ethApi).Sign,
- "eth_sendRawTransaction": (*ethApi).PushTx,
+ "eth_sendRawTransaction": (*ethApi).SendRawTransaction,
"eth_sendTransaction": (*ethApi).SendTransaction,
"eth_transact": (*ethApi).SendTransaction,
"eth_estimateGas": (*ethApi).EstimateGas,
@@ -250,7 +250,7 @@ func (self *ethApi) Sign(req *shared.Request) (interface{}, error) {
return v, nil
}
-func (self *ethApi) PushTx(req *shared.Request) (interface{}, error) {
+func (self *ethApi) SendRawTransaction(req *shared.Request) (interface{}, error) {
args := new(NewDataArgs)
if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, shared.NewDecodeParamError(err.Error())
diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go
index 02f438f0c..bf8ffead6 100644
--- a/rpc/api/eth_args.go
+++ b/rpc/api/eth_args.go
@@ -466,21 +466,21 @@ func (args *CallArgs) UnmarshalJSON(b []byte) (err error) {
}
args.Value = num
- if ext.Gas == nil {
- num = big.NewInt(0)
- } else {
+ if ext.Gas != nil {
if num, err = numString(ext.Gas); err != nil {
return err
}
+ } else {
+ num = nil
}
args.Gas = num
- if ext.GasPrice == nil {
- num = big.NewInt(0)
- } else {
+ if ext.GasPrice != nil {
if num, err = numString(ext.GasPrice); err != nil {
return err
}
+ } else {
+ num = nil
}
args.GasPrice = num
diff --git a/rpc/api/eth_js.go b/rpc/api/eth_js.go
index f7630bdd5..e1268eb76 100644
--- a/rpc/api/eth_js.go
+++ b/rpc/api/eth_js.go
@@ -1,3 +1,20 @@
package api
// JS api provided by web3.js
+// eth_sign not standard
+
+const Eth_JS = `
+web3._extend({
+ property: 'eth',
+ methods:
+ [
+ new web3._extend.Method({
+ name: 'sign',
+ call: 'eth_sign',
+ params: 2,
+ inputFormatter: [web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputString],
+ outputFormatter: web3._extend.formatters.formatOutputString
+ })
+ ]
+});
+`
diff --git a/rpc/api/utils.go b/rpc/api/utils.go
index 9995e1f7c..6e4835de6 100644
--- a/rpc/api/utils.go
+++ b/rpc/api/utils.go
@@ -178,6 +178,8 @@ func Javascript(name string) string {
return Debug_JS
case shared.DbApiName:
return Db_JS
+ case shared.EthApiName:
+ return Eth_JS
case shared.MinerApiName:
return Miner_JS
case shared.NetApiName:
diff --git a/rpc/shared/utils.go b/rpc/shared/utils.go
index 7953d6c22..e5d6ad417 100644
--- a/rpc/shared/utils.go
+++ b/rpc/shared/utils.go
@@ -25,4 +25,3 @@ var (
ShhApiName, TxPoolApiName, PersonalApiName, Web3ApiName,
}, ",")
)
-