-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add SIP-23: JSX for Snap interfaces #136
base: main
Are you sure you want to change the base?
Conversation
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.
LGTM
|
||
```typescript | ||
type AddressProps = { | ||
address: `0x${string}`; |
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.
Why not make this a CAIP address?
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.
This is based on the current API, and we have no way to properly show CAIP addresses in the extension.
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.
Ah okay, the underlying components expect that type...it's just for the identicons. We should change components in the extension to allow for other account strings. Also I meant the account id portion of the caip address, not the whole string. I was thinking we were limiting it to ethereum because of validation reasons or something.
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.
Perhaps this change would be the time to swap to CAIP? 🤔
We could support the old format when not using JSX though. But even if we support CAIP addresses the underlying components don't yet, so we will need to validate that they are Ethereum-like addresses.
|
||
```typescript | ||
type AddressProps = { | ||
address: `0x${string}`; |
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.
Perhaps this change would be the time to swap to CAIP? 🤔
We could support the old format when not using JSX though. But even if we support CAIP addresses the underlying components don't yet, so we will need to validate that they are Ethereum-like addresses.
Co-authored-by: Frederik Bolding <[email protected]>
|
||
```typescript jsx | ||
<Footer> | ||
<Button onClick={handleCancel}>Cancel</Button> |
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 need to figure out how to handle this given that @eriknson want to keep the default Cancel button on all dialogs but allow two customizable footer buttons in home pages.
Not sure if it should be part of the spec? 🤔
type DropdownProps = { | ||
name: string; | ||
value?: string | undefined; | ||
children: OptionElement | OptionElement[]; | ||
}; |
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.
missing onChange
?
type RowProps = { | ||
label: string; | ||
children: AddressElement | ImageElement | TextElement | ValueElement; | ||
variant?: 'default' | 'warning' | 'error'; |
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.
variant?: 'default' | 'warning' | 'error'; | |
variant?: 'default' | 'warning' | 'critical'; |
address, image, text, or value element. | ||
|
||
In addition, the component accepts an optional `variant` prop which can be | ||
`'default'`, `'warning'`, or `'error'`. The default value is `'default'`. |
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.
`'default'`, `'warning'`, or `'error'`. The default value is `'default'`. | |
`'default'`, `'warning'`, or `'critical'`. The default value is `'default'`. |
This adds a SIP outlining JSX support for Snap interfaces.
Closes #133.