accounts/abi/abigen: add ABI method to v2 bindings

Expose the parsed abi.ABI held by generated v2 contract bindings via a
public ABI() method. This lets callers access event and error metadata
(for example to build FilterQuery topics spanning multiple contracts)
without re-parsing the ABI via ContractMetaData.ParseABI().

The method is named ABI() rather than GetABI() (as originally proposed in
the issue) to follow the Go getter naming convention used elsewhere in
this repository and in the standard library.

Closes #34705.
This commit is contained in:
Moshe Malawach 2026-04-21 21:30:47 +02:00
parent d422ab39d5
commit fd862fb6df
27 changed files with 245 additions and 0 deletions

View file

@ -68,6 +68,13 @@ var (
return &{{.Type}}{abi: *parsed} return &{{.Type}}{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *{{.Type}}) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *{{.Type}}) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *{{.Type}}) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewCallbackParam() *CallbackParam {
return &CallbackParam{abi: *parsed} return &CallbackParam{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *CallbackParam) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewCrowdsale() *Crowdsale {
return &Crowdsale{abi: *parsed} return &Crowdsale{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Crowdsale) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Crowdsale) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Crowdsale) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewDAO() *DAO {
return &DAO{abi: *parsed} return &DAO{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *DAO) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *DAO) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *DAO) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewDeeplyNestedArray() *DeeplyNestedArray {
return &DeeplyNestedArray{abi: *parsed} return &DeeplyNestedArray{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *DeeplyNestedArray) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewEmpty() *Empty {
return &Empty{abi: *parsed} return &Empty{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Empty) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Empty) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Empty) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -44,6 +44,13 @@ func NewEventChecker() *EventChecker {
return &EventChecker{abi: *parsed} return &EventChecker{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *EventChecker) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *EventChecker) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *EventChecker) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewGetter() *Getter {
return &Getter{abi: *parsed} return &Getter{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Getter) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Getter) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Getter) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewIdentifierCollision() *IdentifierCollision {
return &IdentifierCollision{abi: *parsed} return &IdentifierCollision{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *IdentifierCollision) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *IdentifierCollision) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *IdentifierCollision) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -44,6 +44,13 @@ func NewInputChecker() *InputChecker {
return &InputChecker{abi: *parsed} return &InputChecker{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *InputChecker) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *InputChecker) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewInteractor() *Interactor {
return &Interactor{abi: *parsed} return &Interactor{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Interactor) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Interactor) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Interactor) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -51,6 +51,13 @@ func NewNameConflict() *NameConflict {
return &NameConflict{abi: *parsed} return &NameConflict{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *NameConflict) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *NameConflict) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewNumericMethodName() *NumericMethodName {
return &NumericMethodName{abi: *parsed} return &NumericMethodName{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *NumericMethodName) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *NumericMethodName) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *NumericMethodName) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -44,6 +44,13 @@ func NewOutputChecker() *OutputChecker {
return &OutputChecker{abi: *parsed} return &OutputChecker{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *OutputChecker) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *OutputChecker) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *OutputChecker) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewOverload() *Overload {
return &Overload{abi: *parsed} return &Overload{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Overload) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewRangeKeyword() *RangeKeyword {
return &RangeKeyword{abi: *parsed} return &RangeKeyword{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *RangeKeyword) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewSlicer() *Slicer {
return &Slicer{abi: *parsed} return &Slicer{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Slicer) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Slicer) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -50,6 +50,13 @@ func NewStructs() *Structs {
return &Structs{abi: *parsed} return &Structs{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Structs) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Structs) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewToken() *Token {
return &Token{abi: *parsed} return &Token{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Token) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Token) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Token) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -70,6 +70,13 @@ func NewTuple() *Tuple {
return &Tuple{abi: *parsed} return &Tuple{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Tuple) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewTupler() *Tupler {
return &Tupler{abi: *parsed} return &Tupler{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Tupler) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Tupler) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Tupler) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewUnderscorer() *Underscorer {
return &Underscorer{abi: *parsed} return &Underscorer{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *Underscorer) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *Underscorer) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *Underscorer) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -52,6 +52,13 @@ func NewDB() *DB {
return &DB{abi: *parsed} return &DB{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *DB) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *DB) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewC() *C {
return &C{abi: *parsed} return &C{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *C) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -49,6 +49,13 @@ func NewC1() *C1 {
return &C1{abi: *parsed} return &C1{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *C1) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *C1) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *C1) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
@ -127,6 +134,13 @@ func NewC2() *C2 {
return &C2{abi: *parsed} return &C2{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *C2) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
@ -201,6 +215,13 @@ func NewL1() *L1 {
return &L1{abi: *parsed} return &L1{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *L1) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *L1) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
@ -266,6 +287,13 @@ func NewL2() *L2 {
return &L2{abi: *parsed} return &L2{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *L2) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *L2) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
@ -331,6 +359,13 @@ func NewL2b() *L2b {
return &L2b{abi: *parsed} return &L2b{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *L2b) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *L2b) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
@ -393,6 +428,13 @@ func NewL3() *L3 {
return &L3{abi: *parsed} return &L3{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *L3) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *L3) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
@ -459,6 +501,13 @@ func NewL4() *L4 {
return &L4{abi: *parsed} return &L4{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *L4) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *L4) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
@ -524,6 +573,13 @@ func NewL4b() *L4b {
return &L4b{abi: *parsed} return &L4b{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *L4b) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *L4b) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewC() *C {
return &C{abi: *parsed} return &C{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *C) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *C) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {
@ -182,6 +189,13 @@ func NewC2() *C2 {
return &C2{abi: *parsed} return &C2{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *C2) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *C2) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {

View file

@ -45,6 +45,13 @@ func NewMyContract() *MyContract {
return &MyContract{abi: *parsed} return &MyContract{abi: *parsed}
} }
// ABI returns the parsed ABI of the contract. The returned value shares
// its internal maps (Methods, Events, Errors) with the binding, so callers
// must not mutate it.
func (c *MyContract) ABI() abi.ABI {
return c.abi
}
// Instance creates a wrapper for a deployed contract instance at the given address. // Instance creates a wrapper for a deployed contract instance at the given address.
// Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc. // Use this to create the instance object passed to abigen v2 library functions Call, Transact, etc.
func (c *MyContract) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract { func (c *MyContract) Instance(backend bind.ContractBackend, addr common.Address) *bind.BoundContract {