fixed eth sign unittest

pull/1279/head
Bas van Kervel 10 years ago
parent 2e0b56a72b
commit 6d596b1ad1
  1. 4
      rpc/api/eth.go
  2. 12
      rpc/api/eth_args.go
  3. 17
      rpc/api/eth_js.go
  4. 2
      rpc/api/utils.go
  5. 1
      rpc/shared/utils.go

@ -46,7 +46,7 @@ var (
"eth_getData": (*ethApi).GetData, "eth_getData": (*ethApi).GetData,
"eth_getCode": (*ethApi).GetData, "eth_getCode": (*ethApi).GetData,
"eth_sign": (*ethApi).Sign, "eth_sign": (*ethApi).Sign,
"eth_sendRawTransaction": (*ethApi).PushTx, "eth_sendRawTransaction": (*ethApi).SendRawTransaction,
"eth_sendTransaction": (*ethApi).SendTransaction, "eth_sendTransaction": (*ethApi).SendTransaction,
"eth_transact": (*ethApi).SendTransaction, "eth_transact": (*ethApi).SendTransaction,
"eth_estimateGas": (*ethApi).EstimateGas, "eth_estimateGas": (*ethApi).EstimateGas,
@ -250,7 +250,7 @@ func (self *ethApi) Sign(req *shared.Request) (interface{}, error) {
return v, nil return v, nil
} }
func (self *ethApi) PushTx(req *shared.Request) (interface{}, error) { func (self *ethApi) SendRawTransaction(req *shared.Request) (interface{}, error) {
args := new(NewDataArgs) args := new(NewDataArgs)
if err := self.codec.Decode(req.Params, &args); err != nil { if err := self.codec.Decode(req.Params, &args); err != nil {
return nil, shared.NewDecodeParamError(err.Error()) return nil, shared.NewDecodeParamError(err.Error())

@ -466,21 +466,21 @@ func (args *CallArgs) UnmarshalJSON(b []byte) (err error) {
} }
args.Value = num args.Value = num
if ext.Gas == nil { if ext.Gas != nil {
num = big.NewInt(0)
} else {
if num, err = numString(ext.Gas); err != nil { if num, err = numString(ext.Gas); err != nil {
return err return err
} }
} else {
num = nil
} }
args.Gas = num args.Gas = num
if ext.GasPrice == nil { if ext.GasPrice != nil {
num = big.NewInt(0)
} else {
if num, err = numString(ext.GasPrice); err != nil { if num, err = numString(ext.GasPrice); err != nil {
return err return err
} }
} else {
num = nil
} }
args.GasPrice = num args.GasPrice = num

@ -1,3 +1,20 @@
package api package api
// JS api provided by web3.js // 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
})
]
});
`

@ -178,6 +178,8 @@ func Javascript(name string) string {
return Debug_JS return Debug_JS
case shared.DbApiName: case shared.DbApiName:
return Db_JS return Db_JS
case shared.EthApiName:
return Eth_JS
case shared.MinerApiName: case shared.MinerApiName:
return Miner_JS return Miner_JS
case shared.NetApiName: case shared.NetApiName:

@ -25,4 +25,3 @@ var (
ShhApiName, TxPoolApiName, PersonalApiName, Web3ApiName, ShhApiName, TxPoolApiName, PersonalApiName, Web3ApiName,
}, ",") }, ",")
) )

Loading…
Cancel
Save