cURL
Intents (Advanced)
PrepareIntentRecovery
POST
cURL
Overview
ThePrepareIntentRecovery endpoint returns a backend-prepared payload and typed data that the user signs to recover funds stranded in an intent wallet. Combined with BuildIntentRecoveryTransaction, this endpoint enables clients to drain recoverable balances from origin or destination intent addresses after an intent has failed, expired, or otherwise left funds behind.
Use Cases
- Recover an intent’s origin deposit when the route became unfillable
- Sweep dust or leftover balances from an intent wallet
- Refund a user from a stranded intent address
Request Parameters
Required Fields
- intentId (string): The unique ID of the intent to recover.
Optional Fields
- intentAddress (string): If omitted, the backend auto-selects the origin or destination intent address by recoverable balance.
- refundToAddress (string): Defaults to the intent owner address when omitted.
- tokenAddress (string): Constrain recovery token selection when multiple recoverable tokens exist.
Response
- intentId (string)
- intentProtocol (
IntentProtocolVersion) - intentAddress (string): The intent wallet being recovered.
- chainId (number): Chain ID of the intent wallet.
- intentSource (string):
"origin"or"destination"— which intent wallet was selected for recovery. - recoveryTokens (array of
IntentTokenBalance, optional): The token balances eligible for recovery. - payload (any): Payload to be signed.
- typedData (any): EIP-712 typed data for client signing.
- payloadHash (string)
Flow
- Call
PrepareIntentRecoveryto get the payload and typed data. - Have the user sign the typed data with their wallet.
- Call
BuildIntentRecoveryTransactionwith the signed payload to receive the executable transaction. - Broadcast the transaction.
Example
Next Steps
BuildIntentRecoveryTransaction
Build the executable recovery transaction
AbortIntent
Notify Trails of an on-chain abort
Body
application/json
Response
OK
Represented as string on the server side
Available options:
v1, v1_5 []IntentTokenBalance