# Redeeming Shares in an Enzyme 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: 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.enzyme.finance/enzyme-blue-sdk/examples/selling-shares-in-an-enzyme-vault.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.
