From f1a148c03b536587a1e00324c457d52a278e86c0 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 22 Jan 2024 15:28:15 -0800 Subject: [PATCH 1/5] Add address-annotation permission SIP first draft --- SIPS/sip-x.md | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 SIPS/sip-x.md diff --git a/SIPS/sip-x.md b/SIPS/sip-x.md new file mode 100644 index 00000000..956bde3d --- /dev/null +++ b/SIPS/sip-x.md @@ -0,0 +1,89 @@ +### Snap Improvement Proposal (SIP) + +**Title:** Custom Permission for Address Annotation in MetaMask Snaps + +**SIP Number:** [To be assigned] + +**Author:** Dan Finlay + +#### Abstract + +This SIP proposes a new custom permission for MetaMask Snaps. The permission will enable Snaps to provide additional UI annotations when an Ethereum address is presented within the MetaMask interface. The Snap will respond to events involving Ethereum addresses with a custom UI, enhancing user experience with contextual information or actions related to the address. + +#### Specification + +1. **Permission Name:** `endowment:address-annotation` + +2. **Permission Description:** + + - Allows a Snap to receive events containing Ethereum addresses. + - Snap can provide UI annotations or additional information for these addresses. +3. **Manifest Configuration:** + + json + +1. `"initialPermissions": { + "endowment:address-annotation": {} + }` + +2. **Event Handling:** + + - Implement an event listener in the Snap to handle incoming Ethereum addresses. + - The event will provide the Ethereum address as an argument. +3. **UI Annotation:** + + - Utilize the `@metamask/snaps-ui` module to create custom UI components. + - Example components: `panel`, `heading`, `text`, `image`. + - The UI should be contextually relevant to the address provided. +4. **Use Cases:** + + - Displaying additional information about an address, like its trustworthiness or associated metadata. + - Providing quick actions related to an address, such as adding it to a watchlist or checking its transaction history. + +**Rich Example:** + +    javascript + +`import { panel, heading, text, image, divider } from '@metamask/snaps-ui'; + +function handleAddressEvent(address) {\ +  // Example logic to generate insights based on the address\ +  const addressInsight = getAddressInsight(address); + +  // Custom UI components\ +  const addressPanel = panel([\ +    heading(`Details for ${address}`),\ +    text(`Insight: ${addressInsight.description}`),\ +    divider(),\ +    image(addressInsight.imageUrl),\ +    text(`Additional Info: ${addressInsight.additionalInfo}`)\ +  ]); + +  return addressPanel;\ +} + +function getAddressInsight(address) {\ +  // Placeholder for logic to fetch or compute insights about the address\ +  return {\ +    description: "Trusted Address with High Volume Transactions",\ +    imageUrl: "data:image/svg+xml;base64,...", // Base64 encoded SVG or data URI\ +    additionalInfo: "This address is associated with a well-known NFT marketplace."\ +  };\ +}` + +a new permission that does not affect existing permissions or Snap functionalities. It is fully backward compatible. + + +#### Rationale + +This permission extends the functionality of MetaMask Snaps by allowing developers to create more interactive and informative experiences. Address-related context is crucial in blockchain interactions, and providing users with additional insights directly within MetaMask can enhance security and usability. + +#### Backward Compatibility + +This SIP introduces a new permission that does not affect existing permissions or Snap functionalities. It is fully backward compatible. + +#### Security Considerations + +- Security frame these annotations when they are displayed. +- May need to truncate excessive length messages. + From 754873a7b91b123094954fa5b9a1bafbe11f94fa Mon Sep 17 00:00:00 2001 From: Dan Finlay <542863+danfinlay@users.noreply.github.com> Date: Mon, 22 Jan 2024 22:47:26 -0800 Subject: [PATCH 2/5] Update SIPS/sip-x.md Co-authored-by: Hassan Malik <41640681+hmalik88@users.noreply.github.com> --- SIPS/sip-x.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SIPS/sip-x.md b/SIPS/sip-x.md index 956bde3d..7317f2e2 100644 --- a/SIPS/sip-x.md +++ b/SIPS/sip-x.md @@ -1,6 +1,6 @@ ### Snap Improvement Proposal (SIP) -**Title:** Custom Permission for Address Annotation in MetaMask Snaps +**Title:** Address Insights **SIP Number:** [To be assigned] From 7b33d12d18efa9b86bc58c007d532ae44e4364a9 Mon Sep 17 00:00:00 2001 From: Dan Finlay <542863+danfinlay@users.noreply.github.com> Date: Mon, 22 Jan 2024 22:47:39 -0800 Subject: [PATCH 3/5] Update SIPS/sip-x.md Co-authored-by: Hassan Malik <41640681+hmalik88@users.noreply.github.com> --- SIPS/sip-x.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SIPS/sip-x.md b/SIPS/sip-x.md index 7317f2e2..ee357c1f 100644 --- a/SIPS/sip-x.md +++ b/SIPS/sip-x.md @@ -2,7 +2,7 @@ **Title:** Address Insights -**SIP Number:** [To be assigned] +**SIP Number:** 22 **Author:** Dan Finlay From 4110fb1e2b548e367e5fce3730c81cf9f25ee442 Mon Sep 17 00:00:00 2001 From: Dan Finlay <542863+danfinlay@users.noreply.github.com> Date: Mon, 22 Jan 2024 22:47:51 -0800 Subject: [PATCH 4/5] Update SIPS/sip-x.md Co-authored-by: Hassan Malik <41640681+hmalik88@users.noreply.github.com> --- SIPS/sip-x.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SIPS/sip-x.md b/SIPS/sip-x.md index ee357c1f..0de6e8b2 100644 --- a/SIPS/sip-x.md +++ b/SIPS/sip-x.md @@ -8,7 +8,7 @@ #### Abstract -This SIP proposes a new custom permission for MetaMask Snaps. The permission will enable Snaps to provide additional UI annotations when an Ethereum address is presented within the MetaMask interface. The Snap will respond to events involving Ethereum addresses with a custom UI, enhancing user experience with contextual information or actions related to the address. +This SIP proposes a new permission for MetaMask Snaps. The permission will enable Snaps to provide additional UI annotations when an Ethereum address is presented within the MetaMask interface. The Snap will respond to events involving Ethereum addresses with a custom UI, enhancing user experience with contextual information or actions related to the address. #### Specification From 8449c306f9e4dcf0f21d212b2b6798a3b2c6933f Mon Sep 17 00:00:00 2001 From: Dan Finlay <542863+danfinlay@users.noreply.github.com> Date: Mon, 22 Jan 2024 22:48:00 -0800 Subject: [PATCH 5/5] Update SIPS/sip-x.md Co-authored-by: Hassan Malik <41640681+hmalik88@users.noreply.github.com> --- SIPS/sip-x.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SIPS/sip-x.md b/SIPS/sip-x.md index 0de6e8b2..d71bc007 100644 --- a/SIPS/sip-x.md +++ b/SIPS/sip-x.md @@ -12,7 +12,7 @@ This SIP proposes a new permission for MetaMask Snaps. The permission will enabl #### Specification -1. **Permission Name:** `endowment:address-annotation` +1. **Permission Name:** `address-insights` 2. **Permission Description:**