diff --git a/accounts/abi/bind/v2/lib.go b/accounts/abi/bind/v2/lib.go index c9c4da5547..4e9f559e58 100644 --- a/accounts/abi/bind/v2/lib.go +++ b/accounts/abi/bind/v2/lib.go @@ -175,6 +175,12 @@ func Call[T any](c *BoundContract, opts *CallOpts, packedInput []byte, unpack fu return res, err } +// Transact initiates a transaction with the given raw calldata as the input. +func Transact(c *BoundContract, opt *TransactOpts, packedInput []byte) (*types.Transaction, error) { + addr := c.address + return c.transact(opt, &addr, packedInput) +} + // DeployContract deploys a contract onto the Ethereum blockchain and binds the // deployment address with a Go wrapper. It expects its parameters to be abi-encoded // bytes. diff --git a/accounts/abi/bind/v2/lib_test.go b/accounts/abi/bind/v2/lib_test.go index 295b718ed1..5cbc0374b5 100644 --- a/accounts/abi/bind/v2/lib_test.go +++ b/accounts/abi/bind/v2/lib_test.go @@ -236,7 +236,7 @@ func TestEvents(t *testing.T) { defer sub2.Unsubscribe() packedInput := c.PackEmitMulti() - tx, err := instance.RawTransact(defaultTxAuth(), packedInput) + tx, err := bind.Transact(instance, defaultTxAuth(), packedInput) if err != nil { t.Fatalf("failed to send transaction: %v", err) }