Skip to content

Commit

Permalink
accounts/abi/bind: add NoSend transact option (ethereum#22446)
Browse files Browse the repository at this point in the history
This adds a new option to avoid sending the transaction which is
created by calling a bound contract method.
  • Loading branch information
reds authored and gzliudan committed Sep 9, 2024
1 parent 39783bf commit 689f6e7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions accounts/abi/bind/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ type TransactOpts struct {
GasLimit uint64 // Gas limit to set for the transaction execution (0 = estimate)

Context context.Context // Network context to support cancellation and timeouts (nil = no timeout)

NoSend bool // Do all transact steps but do not send the transaction
}

// FilterOpts is the collection of options to fine tune filtering for events
Expand Down Expand Up @@ -242,6 +244,9 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
if err != nil {
return nil, err
}
if opts.NoSend {
return signedTx, nil
}
if err := c.transactor.SendTransaction(ensureContext(opts.Context), signedTx); err != nil {
return nil, err
}
Expand Down

0 comments on commit 689f6e7

Please sign in to comment.