Skip to content
LogoLogo

Get Earn Redeem Quote

earn.getRedeemQuote

Gets the asset output for an exact Earn share input, including fees.

Usage

import {  } from './viem.config'
 
const  = await ..({
  : 100_000_000n,
  : '0x0000000000000000000000000000000000000001',
})
99_500_000n

Recipes

Confirm Proceeds Before a Full Exit

Quote the entire balance from earn.getPosition, display the proceeds, then pass the quote to earn.redeemSync so execution cannot drift below the confirmed number.

import {  } from './viem.config'
 
const  = '0x0000000000000000000000000000000000000001'
 
const {  } = await ..({  })
const  = await ..({
  : ,
  ,
})
 
const  = await ..({
  ,
  : ,
  : 25,
  ,
})

Batch Quotes Across Vaults

Use getRedeemQuote.call with multicall to compare redemption value across vaults in one round trip.

import {  } from './viem.config'
 
const  = 100_000_000n
 
const {  } = await .({
  : false,
  : [
    ...({
      ,
      : '0x0000000000000000000000000000000000000001',
    }),
    ...({
      ,
      : '0x0000000000000000000000000000000000000002',
    }),
  ],
})
[99_500_000n, 99_650_000n]

Return Value

bigint

The quoted asset output in base units.

Parameters

shareAmount

  • Type: bigint

Exact number of Earn shares to redeem, in base units.

vault

  • Type: Address

Vault address.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.