diff --git a/services/construction/contract_call_data.go b/services/construction/contract_call_data.go index 3e2ac36..57fb46e 100644 --- a/services/construction/contract_call_data.go +++ b/services/construction/contract_call_data.go @@ -199,11 +199,11 @@ func encodeMethodArgsStrings(methodID []byte, methodSig string, methodArgs []str { // No fixed size set as it would make it an "array" instead // of a "slice" when encoding. We want it to be a slice. - value := []byte{} bytes, err := hexutil.Decode(methodArgs[i]) if err != nil { log.Fatal(err) } + value := make([]byte, len(bytes)) copy(value[:], bytes) // nolint:gocritic argData = value } diff --git a/services/construction/contract_call_data_test.go b/services/construction/contract_call_data_test.go index 385ee5d..796c8f0 100644 --- a/services/construction/contract_call_data_test.go +++ b/services/construction/contract_call_data_test.go @@ -62,6 +62,12 @@ func TestConstruction_ContractCallData(t *testing.T) { methodArgs: []interface{}{"[\"0x000000000000000000000000911a81c0a2cd632fd4c45461541bf8973d11870a\",\"0x0000000000000000000000006ecb18183838265968039955f1e8829480db5329\",\"0x0000000000000000000000000bfc799df7e440b7c88cc2454f12c58f8a29d986\"]", "0"}, expectedResponse: "0x3ffba36f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000911a81c0a2cd632fd4c45461541bf8973d11870a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000006ecb18183838265968039955f1e8829480db532900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000bfc799df7e440b7c88cc2454f12c58f8a29d986", }, + // https://sepolia.basescan.org/tx/0x9c6854169cccd609225bec508ca11ec0fe84620493488b54d638e54350422b79 + "happy path: address and bytes": { + methodSig: "createRecoverySigner(address,address,bytes)", + methodArgs: []string{"0x4e7E5249d2Cb9255367C716e1452752A1390e44A", "0x2149ada7A6B036c0C5215A88921856D9974D810C", "0x9ba55864842d7142d780c93c0112994ba08ce5fed82d574ec864eb0f16fb6b767b69030cec56ec2662e483ae6fbddf1f4d233b9dad4bb4190d9178fc1cdfaa951c"}, + expectedResponse: "0x25cb56700000000000000000000000004e7e5249d2cb9255367c716e1452752a1390e44a0000000000000000000000002149ada7a6b036c0c5215a88921856d9974d810c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000419ba55864842d7142d780c93c0112994ba08ce5fed82d574ec864eb0f16fb6b767b69030cec56ec2662e483ae6fbddf1f4d233b9dad4bb4190d9178fc1cdfaa951c00000000000000000000000000000000000000000000000000000000000000", + }, "happy path: method sig is NO-METHOD-SIG and args is a list of interface": { methodSig: NoMethodSig, methodArgs: []interface{}{"0xaabbcc112233"},