2020-08-11 21:09:30 +00:00
package commands
import (
"context"
2020-09-26 21:01:11 +00:00
"fmt"
2020-08-11 21:09:30 +00:00
"github.com/ledgerwatch/turbo-geth/common"
"github.com/ledgerwatch/turbo-geth/common/hexutil"
)
2020-10-24 17:03:52 +00:00
// SendRawTransaction implements eth_sendRawTransaction. Creates new message call transaction or a contract creation for previously-signed transactions.
2020-08-11 21:09:30 +00:00
func ( api * APIImpl ) SendRawTransaction ( _ context . Context , encodedTx hexutil . Bytes ) ( common . Hash , error ) {
2020-09-26 21:01:11 +00:00
if api . ethBackend == nil {
// We're running in --chaindata mode or otherwise cannot get the backend
return common . Hash { } , fmt . Errorf ( NotAvailableChainData , "eth_sendRawTransaction" )
}
2020-08-12 13:47:59 +00:00
res , err := api . ethBackend . AddLocal ( encodedTx )
2020-08-11 21:09:30 +00:00
return common . BytesToHash ( res ) , err
}
2020-10-24 17:03:52 +00:00
// SendTransaction implements eth_sendTransaction. Creates new message call transaction or a contract creation if the data field contains code.
2020-11-09 08:52:18 +00:00
func ( api * APIImpl ) SendTransaction ( _ context . Context , txObject interface { } ) ( common . Hash , error ) {
return common . Hash { 0 } , fmt . Errorf ( NotImplemented , "eth_sendTransaction" )
}