translate byte32 to common.Hash

This commit is contained in:
maskpp 2024-07-21 11:39:14 +08:00
parent f59d013e40
commit c3a32e9131
2 changed files with 6 additions and 2 deletions

View file

@ -321,7 +321,11 @@ func bindBasicTypeGo(kind abi.Type) string {
} }
return "*big.Int" return "*big.Int"
case abi.FixedBytesTy: case abi.FixedBytesTy:
if kind.Size == 32 {
return "common.Hash"
} else {
return fmt.Sprintf("[%d]byte", kind.Size) return fmt.Sprintf("[%d]byte", kind.Size)
}
case abi.BytesTy: case abi.BytesTy:
return "[]byte" return "[]byte"
case abi.FunctionTy: case abi.FunctionTy:

View file

@ -943,7 +943,7 @@ var bindTests = []struct {
sim.Commit() sim.Commit()
} }
// Test filtering for certain events and ensure they can be found // Test filtering for certain events and ensure they can be found
sit, err := eventer.FilterSimpleEvent(nil, []common.Address{common.Address{1}, common.Address{3}}, [][32]byte{{byte(1)}, {byte(2)}, {byte(3)}}, []bool{true}) sit, err := eventer.FilterSimpleEvent(nil, []common.Address{common.Address{1}, common.Address{3}}, []common.Hash{{1}, {2}, {3}}, []bool{true})
if err != nil { if err != nil {
t.Fatalf("failed to filter for simple events: %v", err) t.Fatalf("failed to filter for simple events: %v", err)
} }