Learn more about the Transaction Preview feature for wallets and how to integrate it using the Tenderly Simulation Infrastructure.
Transaction Preview is an implementation of the Tenderly Simulation Infrastructure in wallets. It allows users to simulate individual or chained transactions and preview their execution without sending them on-chain.
By previewing exact transaction outcomes, wallet users can avoid failed transactions, unnecessary gas costs, and hidden security risks. They also receive detailed, human-readable information about transaction simulations. This way, users get a better overall experience and increased security when using wallets.
Additionally, since Tenderly supports all major EVM-compatible chains, the Tenderly Simulation Infrastructure offers reliable results in a multi-chain environment. This also enables wallet users to switch between different networks seamlessly.
To add Transaction Preview to your wallet, you need to integrate the Tenderly Simulation API. This way, you can reduce the number of failed transactions and improve your users' experience in multiple ways.
By allowing users to dry-run transactions, you help them avoid paying gas fees for reverted transactions. You can also provide accurate gas estimates across multiple networks, ensuring they don't underpay or overpay for gas.
Additionally, you can display human-readable warnings against transaction failures caused by other types of issues other than insufficient gas. This way, you can save valuable resources and minimize the number of failed transactions in your wallet.
Enable your users to make informed and confident decisions when sending transactions on-chain. Help them understand the financial implications of their transactions with greater visibility and predictability into their outcomes.
You can achieve this by displaying:
- Asset changes: Show all token transfers, including fungible, non-fungible, and native tokens, with their exact dollar values.
- Balance changes: Give an aggregated view of asset changes per address, with the corresponding dollar amount adjustments.
- Fully decoded logs: Provide decoded information about emitted events, log names, and related parameters for comprehensive insights into transaction execution.
- Validate transaction workflows on DeFi platforms when executing and approving swaps that entail multiple intermediate steps. This can prevent potential mistakes or unintended consequences before submitting transactions on-chain.
- Identify security risks and/or vulnerabilities by surfacing all smart contracts a transaction interacts with.
- Validate the NFT minting and trading process, including token metadata handling and associated fees. This ensures that NFT minting and trading are seamless for users and minimizes risks related to incorrect data or token ownership.
Follow the step-by-step guides below to learn how to implement Transaction Preview into example wallets.
Integrate Transaction Preview into a MetaMask Snap wallet using the Tenderly Simulation API. Enable users to preview the exact outcomes of ERC-20 and ERC-721 transactions. Show detailed information about asset changes with dollar values, native-asset balance changes, output values, storage changes, event logs, and call traces.
Watch the example overview video:
Tenderly MetaMask Snap Demo
See the open-source GitHub repository here:
GitHub - Tenderly/tenderly-metamask-snap-simulate-asset-changes: Tenderly MetaMask Snap using the Tenderly Simulation API to showcase transaction asset changes.
See an open-source implementation of the Tenderly Snap
Follow a step-by-step tutorial to learn how to connect the Tenderly Simulation API, send transaction data, retrieve simulation results, and display them to the user via the MetaMask Snap UI.
A successful ERC20 token transfer of 1 USDC to demo.eth
A successful ERC721 (NFT) token transfer of 1 Crypto Bull to other address.
See the preview of an ERC-20 transaction in this video:
Transaction Preview in Rabby Wallet for ERC20 Token Transfers
Watch the example with an ERC-721 transaction preview:
Transaction Preview in Rabby Wallet for NFT Token Transfers
Find an open-source GitHub repository here:
GitHub - Tenderly/tenderly-rabby-transaction-preview: Integrate the Tenderly Simulation API into Rabby Wallet to enable a transaction preview option for wallet users.
See an open-source implementation of the Tenderly Rabby Transaction Preview
Here you can find a step-by-step tutorial for building your own Rabby Wallet Chrome extension with tranasction preview feature powered by Tenderly Simulation API:
Transaction Preview in Rabby Wallet on Uniswap ERC20 Swap Example
Transaction Preview in Rabby Wallet on Joepegs NFT Example
To learn more about the Tenderly Simulation API, check out these helpful links: