# Delete Quest

This function Deletes a given quest and withdraws any remainder ERC20 token rewards left in your Escrow contract that have not yet been claimed by a Player upon milestone completion.

Upon activation of this function, your Quest will be deleted from both your Quest Data contract and the Lens protocol feed.

{% code overflow="wrap" fullWidth="true" %}

```typescript
const {txHash, error, errorMessage } = await newEnvoker.deleteQuest(
    1,
);
```

{% endcode %}

### Terminate & Withdraw Props

{% code overflow="wrap" fullWidth="true" %}

```typescript
/* The Quest Id to close. If you need to find the Quest Id from the Lens Publication Id, you can call getQuestIdFromPublication from the Helpers functions or call getQuestIdFromLensData directly to the KinoraQuestData contract. */
questId: number;

/* (Optional) Existing Kinora Escrow Contract from a previously  Factory instantiation. */
kinoraEscrowContract?: `0x${string}`;

/* (Optional) Wallet instance for Polygon Network. If you have passed the wallet object to the constructor, it is not necessary here. */
wallet?: ethers.Wallet;
```

{% endcode %}

### Response Object

{% code overflow="wrap" fullWidth="true" %}

```typescript
/* Transaction hash for Quest deletion. */
txHash?: string;

/* Boolean to indicate whether an error was encountered during termination. */
error: boolean;

/* Message of the encountered error. */
errorMessage?: string;
```

{% endcode %}


---

# 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://codex.irrevocable.dev/sdk-reference/envoker/delete-quest.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.
