portal.simulateTransaction
, which gives you insights into what will happen upon executing the transaction.
Here’s how it works:
- changes: An array detailing all the potential transaction outcomes. Each change has the following structure:
- amount: The amount being transferred.
- assetType: The type of asset being dealt with (
NATIVE
orERC20
orERC721
orERC1155
orSPECIAL_NFT
). - changeType: The type of change (
APPROVE
orTRANSFER
). - contractAddress: Address of the contract being interacted with (null for native transactions).
- decimals: Decimals used in the asset.
- from: The sender address.
- name: The name of the asset.
- rawAmount: The unformatted amount being transferred.
- symbol: The asset’s symbol.
- to: The receiver’s address.
- tokenId: An identifier for tokens (null for assets that are not tokens).
- gasUsed: The gas used by the transaction.
- error: An object that contains the error message if the transaction would fail upon execution.
- requestError: An object that contains the error message if there was an issue with the request, such as a malformed transaction argument being provided.