Skip to content

Conversation

@smilingkylan
Copy link

@smilingkylan smilingkylan commented Oct 27, 2025

Related to issue: MetaMask/snaps#3520

The purpose of this SIP is to add a new Snap lifecycle hook: onActivityItem

(feel free to use your own name for it).

This event will be triggered when someone clicks on an activity item (ie past transaction) and will optionally provide Snap developers with an area (like onTransaction and onSignature) at the bottom of the modal below:

Screenshot 2025-10-27 at 1 47 22 PM

This onActivityItem hook will pass the Snap developer information about the transaction, as well as information about the transactions status (eg confirmed, rejected / failed, pending, etc) which a Snap developer can use to provider insights to end-users


Note

Introduces SIP-34 describing an onActivityItem lifecycle hook for activity items and a new endowment:activity-item-insight permission.

  • SIPs:
    • New: SIPS/sip-34.md
      • Proposes onActivityItem lifecycle hook triggered on activity item (transaction) click, with confirmations and optional origin.
      • Introduces endowment:activity-item-insight permission (allowActivityItemOrigin option) for accessing activity item details.
      • Includes example handler and notes on security, UX, and backward compatibility.

Written by Cursor Bugbot for commit 660de5a. This will update automatically on new commits. Configure here.

@smilingkylan smilingkylan requested review from a team and Montoya as code owners October 27, 2025 20:46
```json
{
"initialPermissions": {
"endowment:activity-item-insight": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop the -item here.

Suggested change
"endowment:activity-item-insight": {
"endowment:activity-insight": {

2. The parameters passed to the `onActivityItem` function should also include information about confirmations for the activity item / transaction

```
import type { OnActivityItemHandler } from "@metamask/snaps-sdk";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a definition for this type?

Comment on lines +33 to +34
// should this be `activityItem` instead or is `Activity` only ever transactions?
// `transaction` param should also include details about tx / block confirmations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should figure this out before merging. 😅


One of the perks of this proposal is that we can more or less mimic the `onTransaction` and `onSignature` handlers. The main two differences will be the following:

1. Different entry-point (I will leave this part to you)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by this?

Copy link
Author

@smilingkylan smilingkylan Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By "entry point" I just meant the area in the code / UI where the on_____ hooks into. I expect much of the parameters to be the same as onTransaction and onSignature (transaction, transactionOrigin, chainId), just with some extra information about confirmations and whatever other info developers want. Maybe currentStatus, timestamps (submitted and confirmation time), block number and block hash, info about gas used, transaction hash and nonce,

Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants