mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-15 00:13:46 +00:00
accounts/abi/bind/v2: change interface{} -> any
This commit is contained in:
parent
5387d49400
commit
c9da576739
1 changed files with 10 additions and 10 deletions
|
|
@ -139,7 +139,7 @@ func NewBoundContract(address common.Address, abi abi.ABI, caller ContractCaller
|
||||||
|
|
||||||
// DeployContract deploys a contract onto the Ethereum blockchain and binds the
|
// DeployContract deploys a contract onto the Ethereum blockchain and binds the
|
||||||
// deployment address with a Go wrapper.
|
// deployment address with a Go wrapper.
|
||||||
func DeployContract(opts *TransactOpts, abi abi.ABI, bytecode []byte, backend ContractBackend, params ...interface{}) (common.Address, *types.Transaction, *BoundContract, error) {
|
func DeployContract(opts *TransactOpts, abi abi.ABI, bytecode []byte, backend ContractBackend, params ...any) (common.Address, *types.Transaction, *BoundContract, error) {
|
||||||
// Otherwise try to deploy the contract
|
// Otherwise try to deploy the contract
|
||||||
c := NewBoundContract(common.Address{}, abi, backend, backend, backend)
|
c := NewBoundContract(common.Address{}, abi, backend, backend, backend)
|
||||||
|
|
||||||
|
|
@ -159,9 +159,9 @@ func DeployContract(opts *TransactOpts, abi abi.ABI, bytecode []byte, backend Co
|
||||||
// sets the output to result. The result type might be a single field for simple
|
// sets the output to result. The result type might be a single field for simple
|
||||||
// returns, a slice of interfaces for anonymous returns and a struct for named
|
// returns, a slice of interfaces for anonymous returns and a struct for named
|
||||||
// returns.
|
// returns.
|
||||||
func (c *BoundContract) Call(opts *CallOpts, results *[]interface{}, method string, params ...interface{}) error {
|
func (c *BoundContract) Call(opts *CallOpts, results *[]any, method string, params ...any) error {
|
||||||
if results == nil {
|
if results == nil {
|
||||||
results = new([]interface{})
|
results = new([]any)
|
||||||
}
|
}
|
||||||
// Pack the input, call and unpack the results
|
// Pack the input, call and unpack the results
|
||||||
input, err := c.abi.Pack(method, params...)
|
input, err := c.abi.Pack(method, params...)
|
||||||
|
|
@ -253,7 +253,7 @@ func (c *BoundContract) call(opts *CallOpts, input []byte) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transact invokes the (paid) contract method with params as input values.
|
// Transact invokes the (paid) contract method with params as input values.
|
||||||
func (c *BoundContract) Transact(opts *TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
|
func (c *BoundContract) Transact(opts *TransactOpts, method string, params ...any) (*types.Transaction, error) {
|
||||||
// Otherwise pack up the parameters and invoke the contract
|
// Otherwise pack up the parameters and invoke the contract
|
||||||
input, err := c.abi.Pack(method, params...)
|
input, err := c.abi.Pack(method, params...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -454,13 +454,13 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
|
||||||
|
|
||||||
// FilterLogs filters contract logs for past blocks, returning the necessary
|
// FilterLogs filters contract logs for past blocks, returning the necessary
|
||||||
// channels to construct a strongly typed bound iterator on top of them.
|
// channels to construct a strongly typed bound iterator on top of them.
|
||||||
func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]interface{}) (chan types.Log, event.Subscription, error) {
|
func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]any) (chan types.Log, event.Subscription, error) {
|
||||||
// Don't crash on a lazy user
|
// Don't crash on a lazy user
|
||||||
if opts == nil {
|
if opts == nil {
|
||||||
opts = new(FilterOpts)
|
opts = new(FilterOpts)
|
||||||
}
|
}
|
||||||
// Append the event selector to the query parameters and construct the topic set
|
// Append the event selector to the query parameters and construct the topic set
|
||||||
query = append([][]interface{}{{c.abi.Events[name].ID}}, query...)
|
query = append([][]any{{c.abi.Events[name].ID}}, query...)
|
||||||
topics, err := abi.MakeTopics(query...)
|
topics, err := abi.MakeTopics(query...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|
@ -499,13 +499,13 @@ func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]int
|
||||||
|
|
||||||
// WatchLogs filters subscribes to contract logs for future blocks, returning a
|
// WatchLogs filters subscribes to contract logs for future blocks, returning a
|
||||||
// subscription object that can be used to tear down the watcher.
|
// subscription object that can be used to tear down the watcher.
|
||||||
func (c *BoundContract) WatchLogs(opts *WatchOpts, name string, query ...[]interface{}) (chan types.Log, event.Subscription, error) {
|
func (c *BoundContract) WatchLogs(opts *WatchOpts, name string, query ...[]any) (chan types.Log, event.Subscription, error) {
|
||||||
// Don't crash on a lazy user
|
// Don't crash on a lazy user
|
||||||
if opts == nil {
|
if opts == nil {
|
||||||
opts = new(WatchOpts)
|
opts = new(WatchOpts)
|
||||||
}
|
}
|
||||||
// Append the event selector to the query parameters and construct the topic set
|
// Append the event selector to the query parameters and construct the topic set
|
||||||
query = append([][]interface{}{{c.abi.Events[name].ID}}, query...)
|
query = append([][]any{{c.abi.Events[name].ID}}, query...)
|
||||||
|
|
||||||
topics, err := abi.MakeTopics(query...)
|
topics, err := abi.MakeTopics(query...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -529,7 +529,7 @@ func (c *BoundContract) WatchLogs(opts *WatchOpts, name string, query ...[]inter
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnpackLog unpacks a retrieved log into the provided output structure.
|
// UnpackLog unpacks a retrieved log into the provided output structure.
|
||||||
func (c *BoundContract) UnpackLog(out interface{}, event string, log types.Log) error {
|
func (c *BoundContract) UnpackLog(out any, event string, log types.Log) error {
|
||||||
// Anonymous events are not supported.
|
// Anonymous events are not supported.
|
||||||
if len(log.Topics) == 0 {
|
if len(log.Topics) == 0 {
|
||||||
return errNoEventSignature
|
return errNoEventSignature
|
||||||
|
|
@ -552,7 +552,7 @@ func (c *BoundContract) UnpackLog(out interface{}, event string, log types.Log)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnpackLogIntoMap unpacks a retrieved log into the provided map.
|
// UnpackLogIntoMap unpacks a retrieved log into the provided map.
|
||||||
func (c *BoundContract) UnpackLogIntoMap(out map[string]interface{}, event string, log types.Log) error {
|
func (c *BoundContract) UnpackLogIntoMap(out map[string]any, event string, log types.Log) error {
|
||||||
// Anonymous events are not supported.
|
// Anonymous events are not supported.
|
||||||
if len(log.Topics) == 0 {
|
if len(log.Topics) == 0 {
|
||||||
return errNoEventSignature
|
return errNoEventSignature
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue