Transaction Pre-Sign
Understand what a transaction will do, before it executes.
Introduction
We all know what the default user experience is like: you initiate a smart contract transaction through your wallet, and (at best) you get the name of the function that you're about to call.
Sometimes, the function name is descriptive (for example, claimRewards
). Other times, the function name doesn't say anything useful (for example, multicall
).
Even if the function name is descriptive, it begs the question: is the claimRewards
function really going to claim some rewards? Or is it going to do something else, and I have no way of knowing?
Existing Solutions
Currently, multiple providers offer a similar way of tackling this UX problem: transaction simulations.
The concept is simple: the wallet sends the unsigned transaction object to a backend API. That API simulates the transaction in an offline fork of the chain, and returns a raw transaction object including any ERC/native/internal transfers that would occur if the transaction were actually executed.
At that point, the user can be shown a prompt saying (for example): "If you execute this transaction, 2 ETH will leave your wallet and 3000 USDC will enter your wallet".
But something important is missing:
Context.
Tokens leaving/entering the user wallet have very different implications depending on whether the transaction is a swap, a claim rewards, a stake, or something else.
A "traditional" simulation will not give the user that context, because it is insufficient for identifying the underlying action that is taking place.
The Noves Approach
Foresight is our core product for transaction pre-sign. It's an API that will give you the real-world meaning of what a transaction is about to do.
It takes an unsigned transaction object in JSON and returns an English description of what is about to take place.
It's offered in two different endpoints: Describe and Preview for "regular" transactions, with bespoke versions for full account abstraction support.
You'll learn how to implement both Describe and Preview for your wallet in the next few pages.
Account Abstraction Support
We're proud to be the first solution in the market for enhanced ERC-4337 pre-sign.
We offer account abstraction versions for both Describe and Preview, specifically designed for converting a userOp
into a fully-fledged transaction preview.
You will find tutorials later in this guide for implementing the Describe4337 and Preview4337 endpoints.
Updated about 1 year ago