Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var OnChainUserOpCmd = &cobra.Command{ Use: "onchain", Short: "Submit a signed userOp on-chain bypassing the bundler", Run: func(cmd *cobra.Command, args []string) { userOp := utils.GetUserOps(cmd) SubmitOnChain(userOp) }, }
OnChainUserOpCmd represents the command to submit user operations on-chain.
View Source
var SendAndSignUserOpCmd = &cobra.Command{ Use: "sign-send", Short: "Sign and send a userOp with JSON input", Run: func(cmd *cobra.Command, args []string) { nodeUrl, bundlerUrl, entrypointAddr, eoaSigner := config.ReadConf() userOp := utils.GetUserOps(cmd) fmt.Println("send and sign userOp:", userOp) sender := userOp.Sender fmt.Println("sender address: ", sender) ethClient := ethclient.NewClient(nodeUrl) nonce, err := ethClient.GetNonce(sender) if err != nil { panic(err) } unsignedUserOp := utils.UpdateUserOp(userOp, nonce) chainID, err := ethClient.EthClient.ChainID(context.Background()) if err != nil { panic(err) } fmt.Printf("\nchain-id:%s\n", chainID) fmt.Printf("userOp:%s\n\n", unsignedUserOp.GetUserOpHash(entrypointAddr, chainID).String()) fmt.Printf("userOp:%s\n\n", unsignedUserOp.GetUserOpHash(entrypointAddr, chainID).String()) calldata, err := abi.PrepareHandleOpCalldata([]model.UserOperation{*unsignedUserOp}, eoaSigner.Address) if err != nil { panic(errors.Wrap(err, "error preparing userOp calldata")) } fmt.Printf("Entrypoint handleOps calldata: \n%s\n\n", calldata) signAndSendUserOp(chainID, bundlerUrl, entrypointAddr, eoaSigner, unsignedUserOp) utils.PrintSignature(userOp) }, }
SendAndSignUserOpCmd represents the command to sign and send user operations.
View Source
var SendUserOpCmd = &cobra.Command{ Use: "send", Short: "Send a userOp with JSON input", Run: func(cmd *cobra.Command, args []string) { nodeUrl, bundlerUrl, entrypointAddr, eoaSigner := config.ReadConf() userOp := utils.GetUserOps(cmd) fmt.Println("send userOp:", userOp) sender := userOp.Sender fmt.Println("sender address: ", sender) ethClient := ethclient.NewClient(nodeUrl) nonce, err := ethClient.GetNonce(sender) if err != nil { panic(err) } unsignedUserOp := utils.UpdateUserOp(userOp, nonce) chainID, err := ethClient.EthClient.ChainID(context.Background()) if err != nil { panic(err) } fmt.Printf("userOp:%s\n\n", unsignedUserOp.GetUserOpHash(entrypointAddr, chainID).String()) calldata, err := abi.PrepareHandleOpCalldata([]model.UserOperation{*unsignedUserOp}, eoaSigner.Address) if err != nil { panic(errors.Wrap(err, "error preparing userOp calldata")) } fmt.Printf("Entrypoint handleOps calldata: \n%s\n\n", calldata) sendUserOp(chainID, bundlerUrl, entrypointAddr, eoaSigner, unsignedUserOp) utils.PrintSignature(userOp) }, }
SendUserOpCmd represents the command to send user operations.
View Source
var SignUserOpCmd = &cobra.Command{ Use: "sign", Short: "Sign a userOp with JSON input", Run: func(cmd *cobra.Command, args []string) { nodeUrl, _, entrypointAddr, eoaSigner := config.ReadConf() userOp := utils.GetUserOps(cmd) sender := userOp.Sender fmt.Println("sender address: ", sender) ethClient := ethclient.NewClient(nodeUrl) nonce, err := ethClient.GetNonce(sender) if err != nil { panic(err) } fmt.Println("nonce: ", nonce) unsignedUserOp := utils.UpdateUserOp(userOp, nonce) fmt.Println("unsignedUserOp: ", unsignedUserOp.String()) chainID, err := ethClient.EthClient.ChainID(context.Background()) if err != nil { panic(err) } fmt.Printf("\nchain-id:%s\n", chainID) fmt.Printf("userOp:%s\n\n", unsignedUserOp.GetUserOpHash(entrypointAddr, chainID).String()) calldata, err := abi.PrepareHandleOpCalldata([]model.UserOperation{*unsignedUserOp}, eoaSigner.Address) if err != nil { panic(errors.Wrap(err, "error preparing userOp calldata")) } fmt.Printf("Entrypoint handleOps calldata: \n%s\n\n", calldata) signUserOp(chainID, entrypointAddr, eoaSigner, userOp) utils.PrintSignature(userOp) }, }
SignUserOpCmd represents the command to sign user operations.
Functions ¶
func SubmitOnChain ¶
func SubmitOnChain(userOp *model.UserOperation)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.