Skip to main content
This guide shows you how to attach a contract call to an intent. When funds reach the destination, OMS calls your contract with them in the same intent. The customer confirms once, and there is no second transaction for the deposit, mint, or purchase. You need an OMS publishable key (pk_...) and the SDK installed.

Encode the call with the arrived amount

The amount that arrives can differ slightly from the quote because of fees and price movement. Put TRAILS_HYDRATE_PLACEHOLDER_AMOUNT wherever the amount belongs in your call. At execution, OMS replaces it with the exact amount that arrived.
If your call takes a fixed amount, such as a purchase at a set price, encode the real value and use an exact-output flow so that amount arrives.

Attach it in the widget

Pass the calldata as to.calldata, with your contract as to.recipient. Fund, Pay, Earn, and Swap all accept it.

From your server

Set destinationToAddress to your contract and destinationCallData to the encoded call. If the contract pulls tokens with transferFrom, also set destinationApproveAddress to the contract.
Then deposit and execute as in quotes and execution.

Common destinations

  • Vault deposits: ERC-4626 deposit(assets, receiver), with the customer as receiver. See earn.
  • Lending supply: a lending pool’s supply call on behalf of the customer.
  • Purchases and mints: a contract call priced in the destination token, used with checkout.
If the destination call fails, inspect the intent receipt for a refundTransaction. When funds remain at an intent address without a refund, the owner can use the recovery flow.