Skip to content

Commit

Permalink
update PackUserOp
Browse files Browse the repository at this point in the history
  • Loading branch information
cherry-yl-sh committed Mar 18, 2024
1 parent fd48082 commit 2480c96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions service/operator/try_pay_user_op_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -194,7 +194,7 @@ func packUserOp(userOp *model.UserOperation) (string, error) {
}
],
"internalType": "struct UserOperation",
"name": "op",
"name": "userOp",
"type": "tuple"
}
],
Expand All @@ -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
}
Expand Down
5 changes: 3 additions & 2 deletions service/operator/try_pay_user_op_execute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 2480c96

Please sign in to comment.