Prerequisites
Before you begin, ensure that you’ve: These are required so any example below runs with a validkit and adapter.
Preview a deposit
This example quotes a 10.00 USDC deposit into a vault on Arc Testnet: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.TypeScript
Shell
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.Preview a crosschain deposit
Passto 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 for the full fee
breakdown:
TypeScript
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
Shell
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.
When an integrator fee applies, fees also includes an entry with
type: "integrator". When you haven’t configured an integrator fee, or the
withdrawal has no returns, that entry is absent. See
How Earn fees work.
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.