Skip to main content
Portal provides the function portal.api.evaluateTransaction, which gives you insights into what will happen upon executing a transaction. This function can perform transaction simulation, security validation, or both. Here’s how it works:
The operationType parameter determines what type of evaluation is performed. It can be one of the following values:
  • EvaluateTransactionOperationType.SIMULATION: Perform transaction simulation only
  • EvaluateTransactionOperationType.VALIDATION: Perform security validation only
  • EvaluateTransactionOperationType.ALL: Perform both validation and simulation
This function returns a BlockaidValidateTrxRes containing:
  • simulation: Transaction simulation results including:
    • accountAddress: Address being analyzed
    • accountSummary: Summary of account state changes
    • addressDetails: Detailed information about involved addresses
    • assetsDiffs: Asset balance changes, containing:
      • asset: Asset information
      • in: Incoming transfers
      • out: Outgoing transfers
    • exposures: Risk exposure analysis
    • status: Simulation status
    • totalUsdDiff: Total USD value change
    • totalUsdExposure: Total USD value at risk
  • validation: Security validation results (when operationType is 'VALIDATION' or 'ALL') including:
    • classification: Type of potential security issue
    • description: Detailed description of the validation results
    • features: Array of detected security features
    • status: Validation status
  • block: Block number used for evaluation
  • chain: Chain identifier
By incorporating transaction simulations, you can provide your users with a preview of the transaction outcomes and preemptively detect and handle errors, ensuring a smoother user experience.
And now you are evaluating transactions with Portal! 🙌 🚀 Next, we’ll explore how to back up the wallet for recovery if the user loses device access.