Skip to content

Commit 38ea7f2

Browse files
authored
accounts/abi/bind: add NoSend transact option (#22446)
This adds a new option to avoid sending the transaction which is created by calling a bound contract method.
1 parent aa8b218 commit 38ea7f2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

accounts/abi/bind/base.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ type TransactOpts struct {
5454
GasLimit uint64 // Gas limit to set for the transaction execution (0 = estimate)
5555

5656
Context context.Context // Network context to support cancellation and timeouts (nil = no timeout)
57+
58+
NoSend bool // Do all transact steps but do not send the transaction
5759
}
5860

5961
// FilterOpts is the collection of options to fine tune filtering for events
@@ -260,6 +262,9 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
260262
if err != nil {
261263
return nil, err
262264
}
265+
if opts.NoSend {
266+
return signedTx, nil
267+
}
263268
if err := c.transactor.SendTransaction(ensureContext(opts.Context), signedTx); err != nil {
264269
return nil, err
265270
}

0 commit comments

Comments
 (0)