Predict Estimated Results

Fordefi's REST API for simulation lets you predict an estimated outcome once the transaction is executed on the chain, as well as accurately estimate the transaction fees.

Send your request for an estimated prediction to the /api/v1/transactions/predict endpoint.

The simulation status can be extracted from the simulation_status_result.simulation_status field in the response.

Transaction simulation is performed in any case as part of the transaction submission on the platform (manual or programmatic), however using this endpoint allows you to preview the transaction’s details before it is actually submitted on the platform.

Effects

To view the estimated transaction effects, refer to expected_result.effects. The following are the possible effect types:

  • transfers: Shows all the token transfers on any of your vaults as part of this EVM transaction.
  • allowances (EVM only): Shows all the ERC-20 token approvals given in this contact call.
  • balance_changes: Shows the aggregated balance changes per token as part of this transaction.
  • bridge (EVM only): Valid only for bridge transactions with a select number of supported bridges.

Fee estimation

Under expected_result.gas_debit, all the gas-related details for this transaction are listed:

  • gas_used: The exact gas used by this transaction.
  • gas_price: The current gas price (medium level).
  • total_fee: Total fee, calculated according to: gas_used*gas_price.

For a faster and more lightweight fee estimation, we recommend using the describe endpoint.

Revert reason

In case the simulation predicts that this transaction will revert, all the details can be found at expected_result.reversion:

  • state: The revert state of the transaction. It can be not_reverted, but in case the transaction was reverted, this state will indicate the reason for the revert.
  • reason: Additional information for the revert reason.

Policy Matching

As part of simulating the transaction, Fordefi matches it against the policy to show if and which policy rule will apply on the transaction once it is submitted for signature. The matching policy rule details can be found under policy_match , and the required approvers under approval_request.

Risks

The simulation result is also screened by the Fordefi risk engine. The result of this screening can be retrieved through the risks field in the response.

There are several risk types that we identify. They are returned in the type field; one of these is severity, based on our risk engine.