diff --git a/service/operator/try_pay_user_op_execute.go b/service/operator/try_pay_user_op_execute.go index 3f3d5d58..1c343d1b 100644 --- a/service/operator/try_pay_user_op_execute.go +++ b/service/operator/try_pay_user_op_execute.go @@ -133,7 +133,7 @@ func getPayMasterSignature(strategy *model.Strategy, userOp *model.UserOperation } func packUserOp(userOp *model.UserOperation) (string, error) { abiEncoder, err := abi.JSON(strings.NewReader(`[ -{ + { "inputs": [ { "components": [ @@ -194,7 +194,7 @@ func packUserOp(userOp *model.UserOperation) (string, error) { } ], "internalType": "struct UserOperation", - "name": "op", + "name": "userOp", "type": "tuple" } ], @@ -203,14 +203,12 @@ func packUserOp(userOp *model.UserOperation) (string, error) { "stateMutability": "nonpayable", "type": "function" } - ]`)) +]`)) if err != nil { return "", err } - encoded, err := abiEncoder.Pack("test", userOp.Sender.String(), userOp.Nonce, userOp.InitCode, - userOp.CallData, userOp.CallGasLimit, userOp.VerificationGasLimit, userOp.PreVerificationGas, - userOp.MaxFeePerGas, userOp.MaxPriorityFeePerGas) + encoded, err := abiEncoder.Pack("test", userOp) if err != nil { return "", err } diff --git a/service/operator/try_pay_user_op_execute_test.go b/service/operator/try_pay_user_op_execute_test.go index 72a7a707..b9da05e5 100644 --- a/service/operator/try_pay_user_op_execute_test.go +++ b/service/operator/try_pay_user_op_execute_test.go @@ -35,12 +35,13 @@ func TestGenerateTestData(t *testing.T) { } func TestPackUserOp(t *testing.T) { userOp, _ := model.NewUserOp(utils.GenerateMockUserOperation()) - userOp.Signature = nil userOp.PaymasterAndData = nil - + userOp.Signature = nil res, err := packUserOp(userOp) + assert.NoError(t, err) fmt.Println(res) + } func TestPackUserOpV2(t *testing.T) { userOp, _ := model.NewUserOp(utils.GenerateMockUserOperation())