@@ -426,6 +426,12 @@ func TestABIUnmarshalStringValues(t *testing.T) {
426426 assert .Len (t , values , 0 )
427427 }
428428
429+ {
430+ values , err := ABIUnmarshalStringValues ([]string {"bytes" , "uint" }, []string {"0" , "2" })
431+ assert .Error (t , err )
432+ assert .Len (t , values , 0 )
433+ }
434+
429435 {
430436 values , err := ABIUnmarshalStringValues ([]string {"bytes" , "uint256" }, []string {"0z" , "2" })
431437 assert .Error (t , err )
@@ -632,3 +638,22 @@ func TestEncodeContractCall(t *testing.T) {
632638 require .Nil (t , err )
633639 require .Equal (t , "0x6365f1646bd55a2877890bd58871eefe886770a7734077a74981910a75d7b1f044b5bf280000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000008541d65829f98f7d71a4655ccd7b2bb8494673bf000000000000000000000000000000000000000000000000000000000000008446c421fa000000000000000000000000000000000000000000000000000000005f5e10000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000d4e6f76203173742c20323032300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" , res )
634640}
641+
642+ func TestEncodeContractCall2 (t * testing.T ) {
643+ jsonContractCall := `{
644+ "abi": "testTuple((address,string),(string,address,bytes,uint),int)",
645+ "args": [
646+ ["0x8f408550720b268b0ea0969c527ac997d969a638", "firstWord"],
647+ ["secondWord", "0x38104f7bb130756dcdd24d804e3e2d2e9df25d7d", "U29tZXRoaW5n", "3"],
648+ "7"
649+ ]
650+ }`
651+
652+ var contractCall ContractCallDef
653+ err := json .Unmarshal ([]byte (jsonContractCall ), & contractCall )
654+ require .NoError (t , err )
655+
656+ res , err := EncodeContractCall (contractCall )
657+ require .Nil (t , err )
658+ require .Equal (t , "0xxx" , res )
659+ }
0 commit comments