aboutsummaryrefslogtreecommitdiffstats
path: root/ethclient
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-23 12:12:10 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:18 +0800
commit41c03e07c6ad09b30c336c929442087618fefd66 (patch)
treefb685c2f7411c03504b9f32dbf66e1effc644fbb /ethclient
parentfc2df4ef1c189accd7a4c4ed90d8e3562b5d9e60 (diff)
downloadgo-tangerine-41c03e07c6ad09b30c336c929442087618fefd66.tar
go-tangerine-41c03e07c6ad09b30c336c929442087618fefd66.tar.gz
go-tangerine-41c03e07c6ad09b30c336c929442087618fefd66.tar.bz2
go-tangerine-41c03e07c6ad09b30c336c929442087618fefd66.tar.lz
go-tangerine-41c03e07c6ad09b30c336c929442087618fefd66.tar.xz
go-tangerine-41c03e07c6ad09b30c336c929442087618fefd66.tar.zst
go-tangerine-41c03e07c6ad09b30c336c929442087618fefd66.zip
api: allow sending batch of raw transactions
Diffstat (limited to 'ethclient')
-rw-r--r--ethclient/ethclient.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go
index 12eeaf0f6..c8a8e5eb5 100644
--- a/ethclient/ethclient.go
+++ b/ethclient/ethclient.go
@@ -506,6 +506,22 @@ func (ec *Client) SendTransaction(ctx context.Context, tx *types.Transaction) er
return ec.c.CallContext(ctx, nil, "eth_sendRawTransaction", common.ToHex(data))
}
+// SendTransactions injects a batch of signed transactions into the pending pool for execution.
+//
+// If a transaction was a contract creation use the TransactionReceipt method to get the
+// contract address after the transaction has been mined.
+func (ec *Client) SendTransactions(ctx context.Context, txs []*types.Transaction) error {
+ txData := make([]interface{}, len(txs))
+ for i, tx := range txs {
+ data, err := rlp.EncodeToBytes(tx)
+ if err != nil {
+ return err
+ }
+ txData[i] = common.ToHex(data)
+ }
+ return ec.c.CallContext(ctx, nil, "eth_sendRawTransactions", txData)
+}
+
func toCallArg(msg ethereum.CallMsg) interface{} {
arg := map[string]interface{}{
"from": msg.From,