Skip to content
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

Create SIP-22: Deep Links #134

Merged
merged 18 commits into from
Sep 24, 2024
Merged

Create SIP-22: Deep Links #134

merged 18 commits into from
Sep 24, 2024

Conversation

Montoya
Copy link
Contributor

@Montoya Montoya commented Mar 21, 2024

I have attempted to describe a URL schema for deep links as well as a method for using them.

@Montoya Montoya requested review from ziad-saab and a team as code owners March 21, 2024 04:20
SIPS/sip-22.md Outdated Show resolved Hide resolved
SIPS/sip-22.md Outdated Show resolved Hide resolved
SIPS/sip-22.md Outdated Show resolved Hide resolved
SIPS/sip-22.md Outdated Show resolved Hide resolved
SIPS/sip-22.md Outdated Show resolved Hide resolved
@Montoya
Copy link
Contributor Author

Montoya commented Mar 22, 2024

I think I have a different idea about how to do this now. Will make a different proposal.

@Montoya
Copy link
Contributor Author

Montoya commented May 20, 2024

OK I have updated this based on what I think is the right approach. The only thing that is missing is that ideally the request to open a page could also pass along some parameters. For example, let's say a Snap has multiple features in its home page, like 1) swap 2) bridge 3) stake. If a Snap wants to open its home page and navigate to one of those interfaces, it will need to be able to pass a parameter that can be processed by the homepage. The request could look like this:

await snap.request({
  method: 'snap_open',
  params: {
    url: 'npm:@consensys/starknet-snap/page/home',
    params: {...}
  },
});

Would that be a good approach?

@hmalik88
Copy link
Contributor

OK I have updated this based on what I think is the right approach. The only thing that is missing is that ideally the request to open a page could also pass along some parameters. For example, let's say a Snap has multiple features in its home page, like 1) swap 2) bridge 3) stake. If a Snap wants to open its home page and navigate to one of those interfaces, it will need to be able to pass a parameter that can be processed by the homepage. The request could look like this:

await snap.request({
  method: 'snap_open',
  params: {
    url: 'npm:@consensys/starknet-snap/page/home',
    params: {...}
  },
});

Would that be a good approach?

You can have the params in the url, condense the request a little.

It makes sense to have params for the urls, we might have to update the SIP that defines pages to accommodate params.

@hmalik88
Copy link
Contributor

On second thought you can just use anchors if all you're looking for out of the params is to navigate to a certain part of a page

@hmalik88
Copy link
Contributor

Changed the URL scheme based on some more convos and reduced the scope of the SIP to just define the scheme, in a later SIP (or MIP?) we can spec the RPC navigation method.

SIPS/sip-22.md Outdated Show resolved Hide resolved
SIPS/sip-22.md Outdated Show resolved Hide resolved
SIPS/sip-22.md Outdated Show resolved Hide resolved
SIPS/sip-22.md Outdated Show resolved Hide resolved
SIPS/sip-22.md Outdated Show resolved Hide resolved
SIPS/sip-22.md Outdated Show resolved Hide resolved
@hmalik88 hmalik88 merged commit d5ef36d into main Sep 24, 2024
3 checks passed
@hmalik88 hmalik88 deleted the deep-linking branch September 24, 2024 14:46
hmalik88 added a commit to MetaMask/snaps that referenced this pull request Sep 24, 2024
Validation logic has been updated to allow for an `Icon` to also be
included as a `Link` child. A new URL scheme is also introduced
`metamask:` (see [SIP-22](MetaMask/SIPs#134)),
this scheme will allow a snap to navigate to the extension and other
snap pages through a `metamask:` schemed URL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants