Skip to main content

Transaction confirmations

Transaction confirmations allow users to review a transaction before it gets processed by Immutable. A confirmation will automatically be requested from the user when you invoke a function on the IMX provider generated by the Immutable SDK.

A transaction confirmation may look like below:

Transaction confirmation screen

How does it work?

Transaction confirmations are rendered by the Immutable SDK by opening a browser pop-up when you call a function on Passport provider. The pop-up renders the transaction details necessary for the user to validate the legitimacy of the transaction.

After the user confirms or declines the transaction, Immutable X will process or reject the transaction accordingly.

When do confirmations appear?

Transaction confirmations appear whenever an action is taken in your app that requires a transaction to be signed. This includes transferring assets, listing NFTs for sale, and canceling sell orders, among others. Users will be prompted to review and confirm the transaction before it is processed on Immutable X.

All supported IMX Provider functions, with the exception of getAddress, require user confirmation. Therefore, it's crucial to design your application with transaction confirmations in mind as this is a critical component of the user experience.

Additionally, it's important to note that users can choose to cancel a transaction at any time during the confirmation process, so be sure to handle this edge case accordingly.

For example:

const transferRequest: UnsignedTransferRequest = {
type: 'ETH',
amount: '1',
receiver: '0x0000000000000000000000000000000000000000',
};

try {
const transferResponse = await provider.transfer(transferRequest);
// User approved the transaction
} catch (err) {
if (err.message.includes('Transaction rejected by user')) {
// Handle user rejection
}
// Handle other error types
}