Propose SIP-34 onActivityItem handler / hook#179
Open
smilingkylan wants to merge 3 commits intomainfrom
Open
Conversation
Mrtenz
reviewed
Oct 30, 2025
| ```json | ||
| { | ||
| "initialPermissions": { | ||
| "endowment:activity-item-insight": { |
Member
There was a problem hiding this comment.
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"; |
Member
There was a problem hiding this comment.
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 |
Member
There was a problem hiding this comment.
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) |
Author
There was a problem hiding this comment.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
onTransactionandonSignature) at the bottom of the modal below:This
onActivityItemhook 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-usersNote
Introduces SIP-34 describing an
onActivityItemlifecycle hook for activity items and a newendowment:activity-item-insightpermission.SIPS/sip-34.mdonActivityItemlifecycle hook triggered on activity item (transaction) click, with confirmations and optional origin.endowment:activity-item-insightpermission (allowActivityItemOriginoption) for accessing activity item details.Written by Cursor Bugbot for commit 660de5a. This will update automatically on new commits. Configure here.