mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
eth: Implement SendUnsignedTransaction for eth.ContractBackend
This commit is contained in:
parent
c2295074a7
commit
e1b437e471
1 changed files with 18 additions and 0 deletions
18
eth/bind.go
18
eth/bind.go
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue