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] Allow -send value to be set via txlink #3919

Open
leohhhn opened this issue Mar 11, 2025 · 2 comments · May be fixed by #3948
Open

[gnoweb] Allow -send value to be set via txlink #3919

leohhhn opened this issue Mar 11, 2025 · 2 comments · May be fixed by #3948
Assignees

Comments

@leohhhn
Copy link
Contributor

leohhhn commented Mar 11, 2025

Description

We should have a way to set a -send amount for via txlink, which would be reflected in gnokey commands in the help page, as well as Adena.

While this is a practical feature, it does pose a certain threat of scamming - this is why we need to make sure that when such a link is clicked, it clearly shows the user what it's doing.

For gnokey help commands, we could highlight the -send flag and the amount in red so that it pops out, or put a warning banner above, while also adding a text field that would allow the user to modify the amount (& denom!) in gnoweb directly, without going near the CLI.

For Adena, we could do something similar.

A suggested way to set this parameter in gnoweb links is .send, as it doesn't conflict with any possible Gno function arguments (function arg names cannot start with .).

Example: $help&func=MyFunc&arg=whatever&.send=10000ugnot

We also need to modify txlink & helplink libraries to match this down the line.

cc @alexiscolin @moul @dongwon8247

@moul
Copy link
Member

moul commented Mar 11, 2025

i suggest not only having a warning, but having an extra action to do, like clicking to apply the suggested amount of sent token.

@alexiscolin alexiscolin linked a pull request Mar 15, 2025 that will close this issue
@leohhhn leohhhn linked a pull request Mar 17, 2025 that will close this issue
@moul
Copy link
Member

moul commented Mar 20, 2025

Just a note for those coming here: I suggest using special arguments with a dot prefix, as they cannot be the variable name of a function. This approach eliminates the risk of matching an actual variable. For example, we can have &send=foo&.send=1999ugnot, which is weird but prevents any mismatch.
Alternatively, we could use another prefix that cannot exist in a variable name. An underscore (_) might be a good option since it is more visually distinct than a dot. However, I'm unsure if we can use it in functions in Go as well. The goal is to find a "special" prefix that avoids any mismatch while remaining visually clear. I'm open to suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

Successfully merging a pull request may close this issue.

3 participants