-
Notifications
You must be signed in to change notification settings - Fork 17
Propose SIP-34 onActivityItem handler / hook #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| ```json | ||
| { | ||
| "initialPermissions": { | ||
| "endowment:activity-item-insight": { |
There was a problem hiding this comment.
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.
| "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"; |
There was a problem hiding this comment.
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?
| // should this be `activityItem` instead or is `Activity` only ever transactions? | ||
| // `transaction` param should also include details about tx / block confirmations |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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>
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.