← All posts

Earn or custom destination calls: choosing your vault integration

Trustware supports two ways to route funds into a vault: use Earn for supported vaults, or supply your own destination contract call. The choice depends on who builds the deposit call and how your application handles positions and withdrawals.

Use Earn for supported vaults

Earn lets your application offer supported yield vaults, build deposits, display positions and prepare withdrawals. Your application selects the vault; Trustware builds the destination call.

For a prebuilt interface, enable Earn in the swap widget. Users can select a vault, deposit and view their positions. Choose a curated list of supported vaults or open browsing bounded by your filters. A curated list does not enable arbitrary contracts, and a vault appearing in search does not guarantee a deposit route can be built.

For your own interface, use the headless Earn methods. You can also access the vault endpoints through REST. A custom interface does not require you to encode the deposit call yourself.

See Earn in the swap widget, headless Earn and the vault API.

Use a custom posthook when you supply the contract call

A destination posthook lets your application provide the contract target and encoded calldata through hooks.postHook. Use it for a deposit or another supported contract action that your application defines.

Your application owns the function arguments, beneficiary handling and contract-specific outcome checks. You also handle that contract's position tracking and withdrawals. Sending a posthook does not add the contract to Earn or give it Earn's position and withdrawal methods.

Custom posthooks require the headless SDK or REST API. The widget and runTopUp() do not accept custom hooks. Follow the vault destination guide and destination call options.

Compare the options

DecisionEarnCustom destination posthook
Deposit callTrustware constructs it for a supported vaultYour application supplies target and calldata
InterfacePrebuilt Earn screen, headless SDK or RESTHeadless SDK or REST
Vault selectionSupported vaults, including a curated selectionContract and action selected by your application, subject to compatibility
Positions and withdrawalsEarn methods for supported vaultsYour application's contract-specific integration

The vault's owner does not determine which option to use. A supported vault uses Earn's vault request; a call you encode uses hooks.postHook. Do not combine the two in the same route request.

Understand withdrawals and completion

Earn withdrawals run on the vault's chain and return the vault's asset to the position holder. The widget offers full withdrawals; the headless flow also supports partial withdrawals in vault-share units. Moving the withdrawn funds to another chain, token or vault requires a subsequent route and separate signing.

Both deposit options depend on route and provider compatibility. Earn uses destination-call infrastructure too; it does not bypass those constraints. Your wallet or signing infrastructure retains authorization.

Check the intended vault outcome before recognizing credit. A successful route alone does not prove the expected shares or position were credited to the correct beneficiary. See how to verify a cross-chain vault deposit.

Choose your starting point

Use Earn when its supported vault integration fits, then choose the prebuilt screen or your own interface. Use a custom posthook when your application needs to supply the contract call and manage that contract's accounting and withdrawals.