eth: Implement SendUnsignedTransaction for eth.ContractBackend

This commit is contained in:
Maxwell Koo 2017-10-23 11:37:22 -04:00
parent c2295074a7
commit e1b437e471

View file

@ -136,3 +136,21 @@ func (b *ContractBackend) SendTransaction(ctx context.Context, tx *types.Transac
_, err := b.txapi.SendRawTransaction(ctx, raw)
return err
}
// SendUnsignedTransaction implements bind.ContractTransactor injects an
// unsigned transaction into the pending pool for execution
func (b *ContractBackend) SendUnsignedTransaction(ctx context.Context, tx *types.Transaction, sender common.Address) error {
// Convert our transaction + sender into internal struct SendTxArgs
nonce := tx.Nonce()
args := ethapi.SendTxArgs{
From: sender,
To: tx.To(),
Gas: (*hexutil.Big)(tx.Gas()),
GasPrice: (*hexutil.Big)(tx.GasPrice()),
Value: (*hexutil.Big)(tx.Value()),
Data: tx.Data(),
Nonce: (*hexutil.Uint64)(&nonce),
}
_, err := b.txapi.SendTransaction(ctx, args)
return err
}