Skip to content

Commit bca7c98

Browse files
committed
Add send raw transaction request && replace tx.input to legacy tx.data
(cherry picked from commit 9b4ae32)
1 parent 3604041 commit bca7c98

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ethclient/ethclient.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,14 @@ func (ec *Client) SendTransaction(ctx context.Context, tx *types.Transaction) er
696696
return ec.c.CallContext(ctx, nil, "eth_sendRawTransaction", hexutil.Encode(data))
697697
}
698698

699+
// SendRawTransaction injects a raw transaction into the pending pool for execution.
700+
//
701+
// If the transaction was a contract creation use the TransactionReceipt method to get the
702+
// contract address after the transaction has been mined.
703+
func (ec *Client) SendRawTransaction(ctx context.Context, rawTx string) error {
704+
return ec.c.CallContext(ctx, nil, "eth_sendRawTransaction", rawTx)
705+
}
706+
699707
// RevertErrorData returns the 'revert reason' data of a contract call.
700708
//
701709
// This can be used with CallContract and EstimateGas, and only when the server is Geth.
@@ -734,7 +742,7 @@ func toCallArg(msg ethereum.CallMsg) interface{} {
734742
"to": msg.To,
735743
}
736744
if len(msg.Data) > 0 {
737-
arg["input"] = hexutil.Bytes(msg.Data)
745+
arg["data"] = hexutil.Bytes(msg.Data)
738746
}
739747
if msg.Value != nil {
740748
arg["value"] = (*hexutil.Big)(msg.Value)

0 commit comments

Comments
 (0)