Skip to content

Commit 9c2c165

Browse files
author
lizekun
committed
sendRawTransaction
1 parent 5dd7cd6 commit 9c2c165

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ func (c *Client) call(module, action string, param map[string]interface{}, outco
6868
err = fmt.Errorf("[ouch! panic recovered] please report this with what you did and what you expected, panic detail: %v", r)
6969
}
7070
}()
71+
7172
req, err := http.NewRequest(http.MethodGet, c.craftURL(module, action, param), http.NoBody)
7273
if err != nil {
7374
err = wrapErr(err, "http.NewRequest")
7475
return
7576
}
77+
7678
req.Header.Set("User-Agent", "etherscan-api(Go)")
7779
req.Header.Set("Content-Type", "application/json; charset=utf-8")
7880

geth.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ func (c *Client) EstimateGas(from, to string, value, gasPrice *big.Int) (limit u
3131
err = c.call("proxy", "eth_estimateGas", param, &limit)
3232
return
3333
}
34+
35+
func (c *Client) SendRawTransaction(hex string) (hash string, err error) {
36+
param := M{
37+
"hex": hex,
38+
}
39+
err = c.call("proxy", "eth_sendRawTransaction", param, &hash)
40+
return
41+
}

0 commit comments

Comments
 (0)