Swaps

Predict Transaction

Changed on

Simulate the spot swap and changes in token balances, in addition to the fee estimation.

post/api/v1/swaps/predict

Request

  • Base URL: https://api.fordefi.com
  • URL: https://api.fordefi.com/api/v1/swaps/predict
  • Auth: HTTP bearer

Request body

quote_idstring uuid required

The ID of the quote.

vault_idstring uuid required

The unique identifier of the vault.

amountstring required

The amount to swap.

slippage_bpsstring

The slippage tolerance in basis points.

should_run_policy_checkboolean

Should run a policy check

fail_on_prediction_failureboolean

True if transaction creation should fail in case prediction failed, False otherwise. <br> In case simulation has failed upon continuation, the expected result of the transaction will be partial and policy will be applied on information that can be extracted statically from the transaction only. This might result in falling back to the default policy rule.

use_mev_protected_nodeboolean

Use a MEV protected node to send the transaction. By using a MEV protected node, you avoid maximal extractable value (MEV) attacks.

Example request

{
  "input_asset_identifier": {
    "details": {
      "token": {
        "base58_repr": "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
      }
    }
  },
  "output_asset_identifier": {
    "details": {
      "token": {
        "base58_repr": "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
      }
    }
  },
  "amount": "1000000000000000000",
  "slippage_bps": "1000000000000000000",
  "fee": {
    "details": {
      "gas_limit": "1000000000000000000"
    }
  }
}

Response

Successful Response

OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR
OR

Changes

    • breaking

      added to the / response property oneOf list for the response status

    • info

      added the optional property /// to the response with the status

    • info

      added withdraw_transfer discriminator mapping keys to the / response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status

    • warning

      added the new first_time_transfer_destination enum value to the /// response property for the response status