snaps icon indicating copy to clipboard operation
snaps copied to clipboard

Address component

Open eriknson opened this issue 1 year ago • 2 comments

Let's introduce a component to parse any arbitrary account address so it can be displayed in a variety of ways depending on the props. E.g. "Gaming Account 1" or the truncated address (e.g. "0xEqT...83x")

Specification

  • Unformatted so it can be populated within other components such as Cell, Row, plain text, etc

Props

  • address: String
  • raw: Boolean
  • jazzicon: Boolean
  • displayName: Boolean
  • truncate: Boolean

To be defined

  • accountID: String

Figma

eriknson avatar Sep 25 '24 09:09 eriknson

I think we should add a requirement for the address to be a CAIP-10 address. We may also need the chain ID information if we decide to customize the address display per chain.

danroc avatar Oct 07 '24 14:10 danroc

The accountId is a good addition if account Snaps will use this component to display managed accounts, as it's the preferred way to identify managed accounts within MetaMask and account Snaps.

danroc avatar Oct 07 '24 15:10 danroc

I think we should add a requirement for the address to be a CAIP-10 address. We may also need the chain ID information if we decide to customize the address display per chain.

The address prop already supports CAIP-10 addresses, so we should be good on that front.

The accountId is a good addition if account Snaps will use this component to display managed accounts, as it's the preferred way to identify managed accounts within MetaMask and account Snaps.

Curious if it wouldn't be better for the Snap to explicitly choose the CAIP-10 address it wants to display, instead of us maintaining the logic to choose that based on an account ID. At least that seems to match better what we were planning for AccountSelector etc. WDYT?

FrederikBolding avatar Oct 11 '24 07:10 FrederikBolding

Curious if it wouldn't be better for the Snap to explicitly choose the CAIP-10 address it wants to display, instead of us maintaining the logic to choose that based on an account ID. At least that seems to match better what we were planning for AccountSelector etc. WDYT?

Agreed, it makes sense for the Address component to expect an address. I think I confused it with the Account component, which could have an accountId prop.

danroc avatar Oct 14 '24 08:10 danroc