> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.io/llms.txt
> Use this file to discover all available pages before exploring further.

# How-to: Preview Earn operations

> Inspect the expected outcome of a deposit or withdrawal before submitting a transaction

Each Earn write operation has a paired quote method that returns the expected
outcome without submitting a transaction. Use quotes to display expected values
to your users before they sign.

| Operation  | Quote method         | Returns                                                                                                                                    |
| ---------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `deposit`  | `getDepositQuote`    | Vault details, deposit and expected shares, share price, current APY, applicable fees, and estimated gas fees per transaction in the flow. |
| `withdraw` | `getWithdrawalQuote` | Withdrawal amount and shares to redeem, max withdrawable, share price, applicable fees, estimated gas fees, and optional warnings.         |

## Prerequisites

Before you begin, ensure that you've:

* [Installed the App Kit SDK](/app-kit/tutorials/installation)
* [Configured an adapter](/app-kit/tutorials/adapter-setups)

These are required so any example below runs with a valid `kit` and `adapter`.

## Preview a deposit

This example quotes a 10.00 USDC deposit into a vault on Arc Testnet:

<Note>
  Pass `amount` as a positive decimal string (for example `"10.00"`). Zero and
  negative values are rejected. For USDC and EURC, use at most 6 decimal places.
  Leading zeros and leading-dot forms (for example `"00.5"` or `".5"`) are
  rejected.
</Note>

```typescript TypeScript theme={null}
const quote = await kit.earn.getDepositQuote({
  from: { adapter, chain: "Arc_Testnet" },
  vaultAddress: process.env.VAULT_ADDRESS as string,
  amount: "10.00",
});

console.dir(quote, { depth: null });
```

You will see an output similar to:

```bash Shell theme={null}
{
  vaultAddress: "0x...",
  vaultName: "Steakhouse USDC",
  deposit: { symbol: "USDC", amount: "1.0" },
  expectedShares: { ... },
  sharePrice: "1.000617",
  currentApy: 0.042,
  fees: [],
  gasFees: [ ... ],
}
```

<Note>
  `gasFees` includes one entry per transaction in the deposit flow. On a
  first-time deposit, the `Deposit` entry may show `fees: null` with an allowance
  error because the approval has not been submitted yet. The `Approve` entry still
  carries a real estimate. Show a fallback such as "available after approval"
  rather than treating that as a hard failure.
</Note>

## Preview a crosschain deposit

Pass `to` and (optionally) `transferSpeed` to quote a crosschain deposit. The
returned fees break out the source-blockchain charges (such as `FORWARD` and
`PRE_FINALITY`). Same-chain quotes return `fees: []`. See
[How Earn fees work](/app-kit/concepts/earn-fees#deposit-fees) for the full fee
breakdown:

```typescript TypeScript theme={null}
const quote = await kit.earn.getDepositQuote({
  from: { adapter, chain: "Ethereum_Sepolia" },
  to: {
    chain: "Arc_Testnet",
    recipientAddress: process.env.RECIPIENT_ADDRESS as `0x${string}`,
  },
  vaultAddress: process.env.VAULT_ADDRESS as string,
  amount: "100.00",
  transferSpeed: "FAST",
});
```

`transferSpeed` accepts `"FAST"` or `"SLOW"`. FAST uses CCTP's pre-finality lane
and adds a `PRE_FINALITY` fee. SLOW uses standard finality with only the
`FORWARD` fee. Omit `transferSpeed` to use the service default.

## Preview a withdrawal

This example quotes a 10.00 USDC withdrawal from a vault on Arc Testnet:

```typescript TypeScript theme={null}
const quote = await kit.earn.getWithdrawalQuote({
  from: { adapter, chain: "Arc_Testnet" },
  vaultAddress: process.env.VAULT_ADDRESS as string,
  amount: "10.00",
});

const circleFee = quote.fees.find((fee) => fee.type === "circle");
console.log(
  circleFee
    ? `Circle fee: ${circleFee.amount} ${circleFee.symbol}`
    : "Circle fee: 0",
);
console.log(`Expected withdrawal: ${quote.withdrawal.amount}`);
console.dir(quote, { depth: null });
```

You will see an output similar to:

```bash Shell theme={null}
{
  vaultAddress: "0x...",
  vaultName: "Steakhouse USDC",
  withdrawal: { symbol: "USDC", amount: "1.0" },
  sharesToRedeem: { ... },
  sharePrice: "1.000617",
  maxWithdrawable: { ... },
  fees: [],
  gasFees: [ ... ],
}
```

When a Circle withdrawal fee applies, `fees` includes an entry with
`type: "circle"`. When no Circle fee applies, that entry is absent. Treat the
fee as 0. See [How Earn fees work](/app-kit/concepts/earn-fees#withdrawal-fee).

<Note>
  `gasFees` includes one entry per transaction in the withdrawal flow. On a
  first-time withdrawal, the `Withdraw` entry may show `fees: null` with a
  simulation error because the vault-share approval has not been submitted yet.
  The `Approve` entry still carries a real estimate. Show a fallback such as
  "available after approval" rather than treating that as a hard failure.

  Non-empty `earnKitWarnings` indicate non-blocking issues such as reduced
  liquidity. Surface them to the user before they commit to the withdrawal.
</Note>
