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

# Integrating Veda with Privy

Offer yield on Veda's [BoringVault](https://docs.veda.tech/) strategies through Privy [earn](/wallets/actions/earn/overview). Your app deposits, withdraws, and reads positions through the standard earn API, and Privy handles the Veda-specific contract interactions (Teller, Accountant, and BoringVault share token) for you.

<Info>
  Veda is an **enterprise integration**. Veda deploys and operates the vault contracts, and Privy
  registers them for your app — there is no self-serve vault deployment. Contact
  [sales@privy.io](mailto:sales@privy.io) to enable a Veda vault for your app.
</Info>

## Resources

<CardGroup cols={2}>
  <Card title="Veda Docs" icon="arrow-up-right-from-square" href="https://docs.veda.tech/" arrow>
    Official documentation for Veda and the BoringVault architecture.
  </Card>

  <Card title="Earn" icon="vault" href="/wallets/actions/earn/overview" arrow>
    Deposit, withdraw, and track positions across yield vaults with a single API.
  </Card>
</CardGroup>

***

## How Veda works with Privy

Veda is served through Privy's native earn API. Once a Veda vault is registered for your app, you interact with it through the standard earn endpoints — pass a `vault_id` to the deposit, withdraw, position, and vault-details endpoints.

Under the hood, Veda differs from an ERC-4626 vault in a few ways:

* **BoringVault share token.** A Veda vault is a [BoringVault](https://docs.veda.tech/): the vault contract is also its own ERC-20 share token. It is *not* ERC-4626, so there is no fee-wrapper contract — the vault you deposit into is the underlying vault itself.
* **Teller entry point.** Deposits and withdrawals route through a **Teller** contract, and pricing comes from an **Accountant** contract rather than ERC-4626's `convertToAssets`. Privy handles all of this internally.
* **Instant deposits and withdrawals.** Both operations settle synchronously in a single transaction.
* **Rewards auto-compound.** Veda compounds reward incentives into the vault's share price automatically. There is **no separate incentive claim step** for Veda vaults.
* **Share lock period.** After a deposit, shares are locked for a short, vault-configured period. Withdrawals revert until the lock expires. See [Withdraw with accrued yield](#withdraw-with-accrued-yield).

<Tip>
  Because Veda goes through the standard earn API, the [earn product
  docs](/wallets/actions/earn/overview) — [deposit](/wallets/actions/earn/deposit),
  [withdraw](/wallets/actions/earn/withdraw), [get vault
  details](/wallets/actions/earn/get-vault-details), and [get vault
  position](/wallets/actions/earn/get-vault-position) — all apply to Veda vaults. This guide
  highlights what's specific to Veda.
</Tip>

### Supported chains

Veda vaults are available across major EVM chains, including Ethereum, Base, Tempo, Arbitrum, Optimism, and Linea. Contact [sales@privy.io](mailto:sales@privy.io) for the current list of enabled vaults and chains for your app.

***

## Prerequisites

* A Privy app with [server-side wallets](/wallets/overview) configured
* API credentials (your app ID and app secret)
* A Veda vault enabled for your app — reach out to [sales@privy.io](mailto:sales@privy.io). Privy will register the vault and provide a `vault_id`
* A [webhook endpoint](/api-reference/webhooks/overview) registered in the Privy Dashboard (recommended, to track action status)

<Info>
  All examples below use the Node SDK. Set up the client once with your credentials:

  ```typescript theme={"system"}
  import {PrivyClient} from '@privy-io/server-auth';

  const privy = new PrivyClient('<your-app-id>', '<your-app-secret>');
  ```
</Info>

***

## Deposit into a Veda vault

Deposits use the [deposit](/wallets/actions/earn/deposit) endpoint. Privy approves the vault to spend the wallet's tokens and calls the Veda Teller to mint shares — in a single call. The action is created with status `pending` and moves to `succeeded` once confirmed onchain.

<Tabs>
  <Tab title="Node SDK">
    ```typescript theme={"system"}
    const response = await privy.wallets().earn().ethereum().deposit('<wallet-id>', {
      vault_id: '<your-veda-vault-id>',
      amount: '100', // 100 USDC
      authorization_context: {
        authorization_private_keys: ['<authorization-private-key>'],
      },
    });
    ```

    The method returns an `EarnDepositActionResponse` with the pending wallet action. Poll the status with [get wallet action](/api-reference/wallets/actions/get), or listen for the [`wallet_action.earn_deposit.succeeded`](/api-reference/webhooks/wallet-action/earn-deposit/succeeded) webhook. The `share_amount` in the response is `null` until the action succeeds.
  </Tab>

  <Tab title="REST API">
    ```bash theme={"system"}
    curl -X POST https://api.privy.io/api/v1/wallets/{wallet_id}/earn/ethereum/deposit \
      -H "privy-app-id: <your-app-id>" \
      -H "Authorization: Basic <credentials>" \
      -H "Content-Type: application/json" \
      -d '{
        "vault_id": "<your-veda-vault-id>",
        "amount": "100"
      }'
    ```

    Pass either `amount` (human-readable decimal) or `raw_amount` (smallest unit) — exactly one is required. See the full [deposit reference](/wallets/actions/earn/deposit) for all fields.
  </Tab>
</Tabs>

<Info>
  If your app has [gas sponsorship](/wallets/actions/overview#gas-management) enabled, Veda deposits
  and withdrawals are gas-sponsored by default — no extra parameters required.
</Info>

***

## Read vault details and positions

### Vault details

Fetch APY and TVL to display before a user deposits, using the [get vault details](/wallets/actions/earn/get-vault-details) endpoint. The response uses `provider: "veda"`.

```bash theme={"system"}
curl https://api.privy.io/api/v1/earn/ethereum/vaults/{vault_id} \
  -H "privy-app-id: <your-app-id>" \
  -H "Authorization: Basic <credentials>"
```

<Warning>
  For Veda vaults, `user_apy`, `app_apy`, and `tvl_usd` are sourced from Veda's analytics API and
  may be **`null`** — most commonly for a newly enabled vault, whose performance data takes roughly
  7–10 days to populate. Your app should handle `null` gracefully rather than rendering `0`.
  `available_liquidity_usd` is always `null` for Veda vaults; use the withdrawal pre-checks below
  instead.
</Warning>

### Wallet position

Query a wallet's holdings with the [get vault position](/wallets/actions/earn/get-vault-position) endpoint. The `assets_in_vault` field is the current redeemable value, including accrued yield.

```bash theme={"system"}
curl "https://api.privy.io/api/v1/wallets/{wallet_id}/earn/ethereum/vaults?vault_id={vault_id}" \
  -H "privy-app-id: <your-app-id>" \
  -H "Authorization: Basic <credentials>"
```

<Info>
  For Veda vaults, `total_deposited` and `total_withdrawn` are computed from the deposits and
  withdrawals **initiated through Privy**, not reconstructed from all onchain activity. They are
  accurate as a cost basis for Privy-initiated positions. `assets_in_vault` and `shares_in_vault`
  are always read live from the vault contract.
</Info>

***

## Withdraw with accrued yield

Withdrawals redeem shares back to assets — plus accrued yield — via the [withdraw](/wallets/actions/earn/withdraw) endpoint. Withdraw up to the wallet's current `assets_in_vault`; for a full exit, read the position first and pass `assets_in_vault` as `raw_amount`.

<Tabs>
  <Tab title="Node SDK">
    ```typescript theme={"system"}
    const response = await privy.wallets().earn().ethereum().withdraw('<wallet-id>', {
      vault_id: '<your-veda-vault-id>',
      amount: '105', // withdraw 105 USDC (deposit + yield)
      authorization_context: {
        authorization_private_keys: ['<authorization-private-key>'],
      },
    });
    ```
  </Tab>

  <Tab title="REST API">
    ```bash theme={"system"}
    curl -X POST https://api.privy.io/api/v1/wallets/{wallet_id}/earn/ethereum/withdraw \
      -H "privy-app-id: <your-app-id>" \
      -H "Authorization: Basic <credentials>" \
      -H "Content-Type: application/json" \
      -d '{
        "vault_id": "<your-veda-vault-id>",
        "amount": "105"
      }'
    ```
  </Tab>
</Tabs>

<Warning title="Share lock period">
  Veda locks a wallet's shares for a short, vault-configured period after each deposit, and a **new
  deposit resets the lock on the entire position**. A withdrawal requested while shares are still
  locked is `rejected` before any transaction is broadcast, with an error indicating when the shares
  unlock. Wait until the lock expires (or surface the unlock time to your user) before retrying.
</Warning>

<Info>
  A `rejected` status means the action failed before any transaction was signed — for example,
  insufficient shares or a still-locked position — and is safe to retry once the underlying
  condition clears. A `failed` status means a transaction was broadcast but reverted onchain;
  inspect the action's `steps` for details.
</Info>

***

## Key integration tips

1. **No incentive claim.** Veda auto-compounds rewards into the share price. Do not call the [incentive claim](/wallets/actions/earn/claim) endpoint for Veda vaults; yield shows up directly in `assets_in_vault`.
2. **Respect the share lock.** Gate your withdraw UI on the lock, especially right after a deposit. Handle the `rejected` status and its unlock timestamp instead of assuming an immediate withdrawal will succeed.
3. **Handle `null` analytics.** Treat `user_apy`, `app_apy`, and `tvl_usd` as optional — render a fallback while a newly enabled vault's data populates.
4. **Track status asynchronously.** Deposits and withdrawals are created as `pending` wallet actions. Poll [get wallet action](/api-reference/wallets/actions/get) or subscribe to the [earn webhooks](/wallets/actions/earn/webhooks) to know when they confirm onchain.

***

## Conclusion

With Privy, offering Veda's BoringVault yield strategies is as simple as pointing your existing earn integration at a Veda `vault_id`. Privy manages the Teller, Accountant, and share-token mechanics so your app keeps a single, provider-agnostic API.

To enable a Veda vault for your app, contact [sales@privy.io](mailto:sales@privy.io) or reach out in [Slack](https://privy.io/slack).

<Warning title="Disclaimer">
  Privy does not control DeFi vaults or underlying protocols. Vault information is provided for
  reference only and may change or be inaccurate. Earnings are generated from third-party vaults and
  are not guaranteed. Using vaults involves risk, including loss of funds. These materials are for
  general information purposes only and are not investment advice or a recommendation or
  solicitation to engage in any specific transaction. You are responsible for evaluating vaults at
  your own discretion. Privy does not provide investment, financial, legal, or tax advice.
</Warning>
