# GenerateUserOp

With "generateUserOp" on Krypcore, you can easily execute user operations. This powerful feature allows users to establish, customise, and manage numerous operations within their smart contract wallet in a few simple clicks, providing a streamlined and user-friendly experience. Unleash the power of personalised and efficient control over your digital assets.

This deploys GenerateUserOp using this method.&#x20;

## API Specification

## GenerateUserOp Details

<mark style="color:green;">`POST`</mark> `https://web3-proxy-dev.krypcore.com/api/v0/scWallet/generateUserOp`

To generateUserOp under the given instance.&#x20;

#### Headers

| Name                                            | Type   | Description            |
| ----------------------------------------------- | ------ | ---------------------- |
| DappId<mark style="color:red;">\*</mark>        | String | DappId                 |
| Authorization<mark style="color:red;">\*</mark> | String | User Auth key obtained |

#### Request Body

| Name                                            | Type   | Description   |
| ----------------------------------------------- | ------ | ------------- |
| walletName<mark style="color:red;">\*</mark>    | String | Wallet Name   |
| to<mark style="color:red;">\*</mark>            | String | To Address    |
| method<mark style="color:red;">\*</mark>        | String | Method        |
| params<mark style="color:red;">\*</mark>        | String | Params        |
| isContractTxn<mark style="color:red;">\*</mark> | String | IsContractTxn |
| contractABI<mark style="color:red;">\*</mark>   | String | ContractABI   |

{% tabs %}
{% tab title="200: OK SUCCESS" %}

```javascript

{
    "Data": {
        "userOp": {
            "callData": "******",
            "callGasLimit": "0x34b8",
            "initCode": "******",
            "maxFeePerGas": "0xa8621424",
            "maxPriorityFeePerGas": "0xa8621424",
            "nonce": "0x0",
            "paymasterAndData": "0x",
            "preVerificationGas": "0xc57e",
            "sender": "*****",
            "signature": "0x",
            "verificationGasLimit": "0x684eb"
        },
        "userOpHash": "******"
    },
    "Message": "",
    "Status": "SUCCESS"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Key values should be given" %}

```javascript
{
    "message": "Internal Server Error"
}
```

{% endtab %}

{% tab title="401: Unauthorized Failure in authentication" %}

```
{
    "message": "Invalid API key in request"
}
```

{% endtab %}
{% endtabs %}

Take a look at how you might call this method using our official libraries, or via `curl`

{% tabs %}
{% tab title="curl" %}

```bash

curl --location 'https://web3-proxy-dev.krypcore.com/api/v0/scWallet/generateUserOp' \
--header 'DappId: ******' \
--header 'Authorization: ******' \
--header 'Content-Type: application/json' \
--data '{"walletName":"ak10", "to":"0xc2de797fab7d2d2b26246e93fcf2cd5873a90b10","method":"store","params":[{"type":"uint256","value":"35"}],"isContractTxn":true,"contractABI":"[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"store\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"retrieve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]"}'
```

{% endtab %}

{% tab title="Node.js (Fetch)" %}

```javascript

var myHeaders = new Headers();
myHeaders.append("DappId", "******");
myHeaders.append("Authorization", "******");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "walletName": "ak10",
  "to": "0xc2de797fab7d2d2b26246e93fcf2cd5873a90b10",
  "method": "store",
  "params": [
    {
      "type": "uint256",
      "value": "35"
    }
  ],
  "isContractTxn": true,
  "contractABI": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"store\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"retrieve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://web3-proxy-dev.krypcore.com/api/v0/scWallet/generateUserOp", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Python " %}

```python

import requests
import json

url = "https://web3-proxy-dev.krypcore.com/api/v0/scWallet/generateUserOp"

payload = json.dumps({
  "walletName": "ak10",
  "to": "0xc2de797fab7d2d2b26246e93fcf2cd5873a90b10",
  "method": "store",
  "params": [
    {
      "type": "uint256",
      "value": "35"
    }
  ],
  "isContractTxn": True,
  "contractABI": "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"store\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"retrieve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]"
})
headers = {
  'DappId': '******',
  'Authorization': '******',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

{% endtab %}

{% tab title="Golang" %}

```go

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://web3-proxy-dev.krypcore.com/api/v0/scWallet/generateUserOp"
  method := "POST"

  payload := strings.NewReader(`{"walletName":"ak10", "to":"0xc2de797fab7d2d2b26246e93fcf2cd5873a90b10","method":"store","params":[{"type":"uint256","value":"35"}],"isContractTxn":true,"contractABI":"[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"store\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"retrieve\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]"}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("DappId", "******")
  req.Header.Add("Authorization", "******")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.krypcore.com/dev-docs/api-reference/core-service-apis/wallet-manager/smart-contract-wallet-apis/generateuserop.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
