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

[gnoweb/realms] Standardize hyperlink structure #2602

Closed
leohhhn opened this issue Jul 17, 2024 · 7 comments
Closed

[gnoweb/realms] Standardize hyperlink structure #2602

leohhhn opened this issue Jul 17, 2024 · 7 comments
Assignees
Labels
🌍 gnoweb Issues & PRs related to gnoweb and render

Comments

@leohhhn
Copy link
Contributor

leohhhn commented Jul 17, 2024

Description

With the revamp of gnoweb coming along, we should think about how we can standardize links so that they can be used by other apps.

For example, currently we can get the help page of gnoweb to display all available realm functions with simply pkgpath?help - example here.
We can also specify a concrete function name, as well as its parameters: pkgpath?help&__func=ModAddPost&title=NewBlogPost - example here. This will show only the specified function with the prefilled arguments to it from the link.

Standardizing this link pattern would also allow other apps, such as GnoStudio Connect, to directly be able to lead users to a specific function call with a specific argument set - which would be very useful for people who do not know how to use gnokey or the CLI altogether.

@ilgooz @salmad3 - do you think we could support this link structure in Connect?

I would like to be able to display, say, an EDIT button on gnoweb for a specific blog post. The blog realm could have a base link for Connect, where clicking EDIT would lead the user to the specific function call with arguments embedded in the realm, such as the post ID, which would be needed to run the actual function. For example, the EDIT button could lead to gno.studio/connect&pkgpath=blogrealm&func=EditPost&id=1 or similar. I understand its a bit more complex due to having to include the chainID and other info in the link, but this feature would be super useful. Let's discuss.

@grepsuzette
Copy link
Contributor

grepsuzette commented Jul 19, 2024

Since connecting a wallet to gno.land seems on standby ATM (#1803),
it's obvious both the current ?help page (helper to create tx from the cli) and gno.studio can be useful.

The current markdown production which can point to ?help is like:

  • [button](?help...).
  • <form method="get" action="?help..."><input type="submit" /></form>.
  • <a href="?help...">...</a>

Assuming we kept the ?help syntax for the moment, the user clicking on a link could be:

  1. brought to current ?help - Drawback: As leohhhn said it can scare non-technical people.
  2. taken to https://gno.studio - Drawback: jumping across domains is unconventional, some people may prefer solution 1.
  3. popped up a choice between 1, 2, 3 - Drawback: Invasive?
  4. given the choice the first time, by going to a special page on gno.land, to choose between 1, 2, 3, 4 - Drawback: Feasibility?

If we don't think about the technology, I like the idea of first being taken to a page on gno.land,
to set up what I'd like to do. From where... I would probably ask to get a popup at first, to see what I use the most :)


(In addition to those there is another thing that could be done, which I hope will come true.
The current ?help could easily be a large popup, especially when it's showing only 1 function.
And one day, you could connect Adena or Keplr on this help popup, to one-time do a tx from there).

@leohhhn
Copy link
Contributor Author

leohhhn commented Jul 21, 2024

@grepsuzette Thanks for the considerations.

Since currently we do not want to include non-core-developed products in gnoweb (such as Adena), I think a good way to go forward would be to include a button/hyperlink in each ?help function that could take you to gno.studio/connect to execute that exact function. This is non-invasive, and it's simply a suggestion to the user that could make their life a little easier if they do not use CLI.

This would still need link standardization between gnoweb & Connect.

@grepsuzette
Copy link
Contributor

Oh do you mean on the help page itself, like this?

contract Draw(...)
params seed __________ uint64
results _ string
command ### INSECURE BUT QUICK ### <link/button to gno.studio/connect>
contract SetBlah(...)
params text __________ string
results _ string
command ### INSECURE BUT QUICK ### <link/btn to gno.studio/connect>

(Or the link is on a new line, or even on a new row).

I like it!


About the connection.

If we take art/millipede as a case study, it has a func Call(size int) string. These URLs work already:

So what you're after seems to be how to prefill parameters like size int with what was entered in the ?help page.

@grepsuzette
Copy link
Contributor

grepsuzette commented Jul 25, 2024

There is a temptation to use a <form method=POST> with various <submit> buttons.

<form> is simple, there may be no javascript involved and practically nothing to change in our help page.

Security considerations need to be double-checked but:

  1. parameters are not stored in history with POST (for regular webbrowsers),
  2. parameters are not transiting in clear text on the network if HTTPS is used.

Some plugins could have access to what's typed, but if you care you would just type everything in a terminal and use gnokey (plus that risk would not just concern gnoweb).

@leohhhn something like this?

@grepsuzette
Copy link
Contributor

grepsuzette commented Sep 11, 2024

Norman mentionned during the Core contributors weekly meeting: "

https://eips.ethereum.org/EIPS/eip-6963
https://eips.ethereum.org/EIPS/eip-2255

I think something like eip-6963 is better than a custom uri scheme since the communication between the page and the wallet is quite complex but it could work for basic signing."

@moul
Copy link
Member

moul commented Oct 2, 2024

Related with #2876
Related with #2887

@moul moul added this to the 🚀 Mainnet launch milestone Oct 24, 2024
thehowl pushed a commit that referenced this issue Oct 25, 2024
This PR aimed to promote the use of a `p/` library for managing special
help links from contracts.

It also provided an opportunity for me to realize that our discussion
about changing the `$` symbol would require some parsing and detection
from the `gnoweb` perspective. If we want a simple library like this
one, the goal should be to ideally craft a link to the current package
without specifying the realm path. Relative URLs worked well with `?`,
but they won't function with `$`.

As an alternative, we can have this package look for
`std.PrevRealm().PkgAddr` if it is not specified.

cc @jeronimoalbi @thehowl @leohhhn 

Related with #2602
Related with #2876

---------

Signed-off-by: moul <[email protected]>
Co-authored-by: Leon Hudak <[email protected]>
@Kouteki Kouteki moved this to Teritori (unconfirmed) in 🍜 Seoul triage Nov 15, 2024
@Kouteki Kouteki moved this from Teritori (unconfirmed) to Core in 🍜 Seoul triage Nov 19, 2024
@Kouteki Kouteki added the 🌍 gnoweb Issues & PRs related to gnoweb and render label Nov 22, 2024
@moul
Copy link
Member

moul commented Dec 6, 2024

Txlink has been released and addresses most, if not all, of the maketx call. Perhaps we can close this issue.

I have opened a new one to discuss an extension: #3283.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌍 gnoweb Issues & PRs related to gnoweb and render
Projects
Status: Core
Development

No branches or pull requests

5 participants