@ -57,7 +57,8 @@ const jsondata = `
{ "type" : "function" , "name" : "fixedArrBytes" , "stateMutability" : "view" , "inputs" : [ { "name" : "bytes" , "type" : "bytes" } , { "name" : "fixedArr" , "type" : "uint256[2]" } ] } ,
{ "type" : "function" , "name" : "mixedArrStr" , "stateMutability" : "view" , "inputs" : [ { "name" : "str" , "type" : "string" } , { "name" : "fixedArr" , "type" : "uint256[2]" } , { "name" : "dynArr" , "type" : "uint256[]" } ] } ,
{ "type" : "function" , "name" : "doubleFixedArrStr" , "stateMutability" : "view" , "inputs" : [ { "name" : "str" , "type" : "string" } , { "name" : "fixedArr1" , "type" : "uint256[2]" } , { "name" : "fixedArr2" , "type" : "uint256[3]" } ] } ,
{ "type" : "function" , "name" : "multipleMixedArrStr" , "stateMutability" : "view" , "inputs" : [ { "name" : "str" , "type" : "string" } , { "name" : "fixedArr1" , "type" : "uint256[2]" } , { "name" : "dynArr" , "type" : "uint256[]" } , { "name" : "fixedArr2" , "type" : "uint256[3]" } ] }
{ "type" : "function" , "name" : "multipleMixedArrStr" , "stateMutability" : "view" , "inputs" : [ { "name" : "str" , "type" : "string" } , { "name" : "fixedArr1" , "type" : "uint256[2]" } , { "name" : "dynArr" , "type" : "uint256[]" } , { "name" : "fixedArr2" , "type" : "uint256[3]" } ] } ,
{ "type" : "function" , "name" : "overloadedNames" , "stateMutability" : "view" , "inputs" : [ { "components" : [ { "internalType" : "uint256" , "name" : "_f" , "type" : "uint256" } , { "internalType" : "uint256" , "name" : "__f" , "type" : "uint256" } , { "internalType" : "uint256" , "name" : "f" , "type" : "uint256" } ] , "internalType" : "struct Overloader.F" , "name" : "f" , "type" : "tuple" } ] }
] `
var (
@ -80,6 +81,10 @@ var (
Uint256ArrNested , _ = NewType ( "uint256[2][2]" , "" , nil )
Uint8ArrNested , _ = NewType ( "uint8[][2]" , "" , nil )
Uint8SliceNested , _ = NewType ( "uint8[][]" , "" , nil )
TupleF , _ = NewType ( "tuple" , "struct Overloader.F" , [ ] ArgumentMarshaling {
{ Name : "_f" , Type : "uint256" } ,
{ Name : "__f" , Type : "uint256" } ,
{ Name : "f" , Type : "uint256" } } )
)
var methods = map [ string ] Method {
@ -108,6 +113,7 @@ var methods = map[string]Method{
"mixedArrStr" : NewMethod ( "mixedArrStr" , "mixedArrStr" , Function , "view" , false , false , [ ] Argument { { "str" , String , false } , { "fixedArr" , Uint256Arr2 , false } , { "dynArr" , Uint256Arr , false } } , nil ) ,
"doubleFixedArrStr" : NewMethod ( "doubleFixedArrStr" , "doubleFixedArrStr" , Function , "view" , false , false , [ ] Argument { { "str" , String , false } , { "fixedArr1" , Uint256Arr2 , false } , { "fixedArr2" , Uint256Arr3 , false } } , nil ) ,
"multipleMixedArrStr" : NewMethod ( "multipleMixedArrStr" , "multipleMixedArrStr" , Function , "view" , false , false , [ ] Argument { { "str" , String , false } , { "fixedArr1" , Uint256Arr2 , false } , { "dynArr" , Uint256Arr , false } , { "fixedArr2" , Uint256Arr3 , false } } , nil ) ,
"overloadedNames" : NewMethod ( "overloadedNames" , "overloadedNames" , Function , "view" , false , false , [ ] Argument { { "f" , TupleF , false } } , nil ) ,
}
func TestReader ( t * testing . T ) {
@ -117,7 +123,7 @@ func TestReader(t *testing.T) {
exp , err := JSON ( strings . NewReader ( jsondata ) )
if err != nil {
t . Error ( err )
t . Fatal ( err )
}
for name , expM := range exp . Methods {