-
Notifications
You must be signed in to change notification settings - Fork 651
Add new method to dialogs snap #3173
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?
Changes from 1 commit
a08c8dd
cb06ad0
83ae413
62ec423
3ce3251
c5df060
98d4964
ef523a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| export * from './custom'; | ||
| export * from './require-scroll-content'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { | ||
| Box, | ||
| Button, | ||
| Container, | ||
| Footer, | ||
| Text, | ||
| type SnapComponent, | ||
| } from '@metamask/snaps-sdk/jsx'; | ||
|
|
||
| /** | ||
| * Long content that requires scrolling. | ||
| * | ||
| * @returns The long content component. | ||
| */ | ||
| export const RequireScrollContent: SnapComponent = () => ( | ||
| <Container> | ||
| <Box direction="vertical"> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
|
hmalik88 marked this conversation as resolved.
Outdated
|
||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| <Text>lorem ipsum dolor sit amet</Text> | ||
| </Box> | ||
| <Footer requireScroll> | ||
| <Button name="reject">Reject</Button> | ||
| <Button name="accept">Yes</Button> | ||
|
hmalik88 marked this conversation as resolved.
|
||
| </Footer> | ||
| </Container> | ||
| ); | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,7 @@ import { | |||||
| UserInputEventType, | ||||||
| } from '@metamask/snaps-sdk'; | ||||||
|
|
||||||
| import { CustomDialog } from './components'; | ||||||
| import { CustomDialog, RequireScrollContent } from './components'; | ||||||
|
|
||||||
| /** | ||||||
| * Handle incoming JSON-RPC requests from the dapp, sent through the | ||||||
|
|
@@ -90,6 +90,12 @@ export const onRpcRequest: OnRpcRequestHandler = async ({ request }) => { | |||||
| }, | ||||||
| }); | ||||||
|
|
||||||
| case 'showRequireScrollContent': | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to update the JSDoc too.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use this naming instead ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, updated: 98d4964 |
||||||
| return snap.request({ | ||||||
| method: 'snap_dialog', | ||||||
| params: { content: <RequireScrollContent /> }, | ||||||
| }); | ||||||
|
|
||||||
| default: | ||||||
| throw new MethodNotFoundError({ method: request.method }); | ||||||
| } | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.