aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/eth_args.go
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-06-24 20:56:53 +0800
committerBas van Kervel <bas@ethdev.com>2015-06-30 17:20:31 +0800
commitec866b066ace5d80c3c6a69349dbb1fac4503b46 (patch)
treec87dd0dc6ab981f4e1bdb6c734a7e39293d47e6d /rpc/api/eth_args.go
parent056e9dd393eeb7ddb4f6bf3e508228e1874bc94e (diff)
downloaddexon-ec866b066ace5d80c3c6a69349dbb1fac4503b46.tar
dexon-ec866b066ace5d80c3c6a69349dbb1fac4503b46.tar.gz
dexon-ec866b066ace5d80c3c6a69349dbb1fac4503b46.tar.bz2
dexon-ec866b066ace5d80c3c6a69349dbb1fac4503b46.tar.lz
dexon-ec866b066ace5d80c3c6a69349dbb1fac4503b46.tar.xz
dexon-ec866b066ace5d80c3c6a69349dbb1fac4503b46.tar.zst
dexon-ec866b066ace5d80c3c6a69349dbb1fac4503b46.zip
added eth.resend
Diffstat (limited to 'rpc/api/eth_args.go')
-rw-r--r--rpc/api/eth_args.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go
index 39c003f66..a75fdbdee 100644
--- a/rpc/api/eth_args.go
+++ b/rpc/api/eth_args.go
@@ -892,3 +892,53 @@ func newTx(t *types.Transaction) *tx {
GasPrice: t.GasPrice().String(),
}
}
+
+type ResendArgs struct {
+ Tx *tx
+ GasPrice string
+ GasLimit string
+}
+
+func (args *ResendArgs) UnmarshalJSON(b []byte) (err error) {
+ var obj []interface{}
+ if err = json.Unmarshal(b, &obj); err != nil {
+ return shared.NewDecodeParamError(err.Error())
+ }
+
+ if len(obj) < 1 {
+ return shared.NewInsufficientParamsError(len(obj), 1)
+ }
+
+ data, err := json.Marshal(obj[0])
+ if err != nil {
+ return shared.NewDecodeParamError("Unable to parse transaction object")
+ }
+
+ trans := new(tx)
+ err = json.Unmarshal(data, trans)
+ if err != nil {
+ return shared.NewDecodeParamError("Unable to parse transaction object.")
+ }
+
+ gasLimit, gasPrice := trans.GasLimit, trans.GasPrice
+
+ if len(obj) > 1 && obj[1] != nil {
+ if gp, ok := obj[1].(string); ok {
+ gasPrice = gp
+ } else {
+ return shared.NewInvalidTypeError("gasPrice", "not a string")
+ }
+ }
+ if len(obj) > 2 && obj[2] != nil {
+ if gl, ok := obj[2].(string); ok {
+ gasLimit = gl
+ } else {
+ return shared.NewInvalidTypeError("gasLimit", "not a string")
+ }
+ }
+ args.Tx = trans
+ args.GasPrice = gasPrice
+ args.GasLimit = gasLimit
+
+ return nil
+}