> For the complete documentation index, see [llms.txt](https://docs.enzyme.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enzyme.finance/enzyme-blue-sdk/examples/selling-shares-in-an-enzyme-vault.md).

# Redeeming Shares in an Enzyme Vault

Selling your shares in a vault

There are two distinct functions for redeeming shares in an Enzyme vault; one is used if you want to redeem all of your shares, and another is used if you want to redeem a specific amount.

```typescript
import { ComptrollerLib, StandardToken } from '@enzymefinance/protocol';
import { providers, BigNumber, Wallet, constants, utils } from 'ethers';

const provider = providers.StaticJsonRpcProvider(ethNodeAddress, ethNetwork); 
const signer = new Wallet(investorsEthPrivateKey, provider);

// the vault's address, available on the vault's dashboard in the Enzyme app
const vaultAddress = '0x8syweo...';

// instantiate the vault token contract
const vaultToken = new StandardToken(vaultAddress, provider);

// check the investor's current balance
const sharesBalance = await vaultToken.balanceOf(signer.address);

// this is an arbitrary number
const sharesToRedeem = utils.parseUnits('1', 18);

// the vault's comptroller address, available on the vault's dashboard in the Enzyme app
const comptrollerAddress = '0x8syweo...'

const comptrollerContract = new ComptrollerLib(comptrollerAddress, signer);

const redeemTx = sharesBalance.gt(sharesToRedeem) 
    ? comptrollerContract.redeemSharesDetailed.args(
        sharesToRedeem,
        [], // additional assets 
        [], // assets to skip. These two parameters are adjustable but most commonly left empty
      ) 
    : comptrollerContract.redeemShares();


const redeemTxReceipt = await redeemTx.send();
console.log('Pending transaction:', redeemTxReceipt.transactionHash);
console.log('Transaction included in block number:', redeemTxReceipt.blockNumber);

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.enzyme.finance/enzyme-blue-sdk/examples/selling-shares-in-an-enzyme-vault.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
