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

feat: add the option to mint public notes with the faucet #339

Merged
merged 15 commits into from
May 3, 2024

Conversation

tomyrd
Copy link
Collaborator

@tomyrd tomyrd commented May 2, 2024

closes #329

The previous faucet only minted private notes which had to be downloaded and imported into the client. Now with the implementation of public notes the flow can be much simpler. Just mint the note, sync and consume. This PR adds the option to mint public notes with the faucet and adds some useful information about how to consume it.

The initial screen looks like this:
Screenshot 2024-05-02 at 14-48-05 Miden Faucet

After minting a private note this information box is showed:
Screenshot 2024-05-02 at 14-47-27 Miden Faucet

If the note is public the commands are slightly different:
Screenshot 2024-05-02 at 14-47-50 Miden Faucet

@tomyrd tomyrd changed the title feat: add the option to mint public notes with te faucet feat: add the option to mint public notes with the faucet May 2, 2024
@tomyrd
Copy link
Collaborator Author

tomyrd commented May 2, 2024

Which type of note (public or private) do you think should be selected by default?

@igamigo igamigo requested a review from Dominik1999 May 2, 2024 15:12
@tomyrd tomyrd linked an issue May 2, 2024 that may be closed by this pull request
@tomyrd tomyrd marked this pull request as ready for review May 2, 2024 15:15
bin/faucet/src/static/index.js Outdated Show resolved Hide resolved
bin/faucet/src/static/index.js Outdated Show resolved Hide resolved
downloadBlob(blob, 'note.mno');
}

const noteId = response.headers.get('Content-Disposition').split('filename=')[1].replace(/"/g, '');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a bit complicated but also it might be fine for now. I guess an alternative would be for the name could be sent directly through a custom header to make it a bit simpler.
Alternatively the server could return a JSON response that contains the type of response, and (depending on the user selection) the encoded note details.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Didn't know about custom headers.

@bobbinth
Copy link
Contributor

bobbinth commented May 2, 2024

One suggestions:

I would make the amount selectable (and maybe give a few options there), but would make public note and private notes into separate button.

So, basically:

  • We'd have 1 drop-down with amount selections - something like: 100, 500, 1000 (default 100).
  • We'd have 2 buttons - "Send public note" and "Send private note".

@igamigo igamigo requested a review from mFragaBA May 2, 2024 15:56
@mFragaBA
Copy link
Contributor

mFragaBA commented May 2, 2024

* We'd have 1 drop-down with amount selections - something like: 100, 500, 1000 (default 100).

If this is done, we should validate these amounts on the server side so no one consumes an arbitrary amount of tokens, shouldn't we?

@bobbinth
Copy link
Contributor

bobbinth commented May 2, 2024

If this is done, we should validate these amounts on the server side so no one consumes an arbitrary amount of tokens, shouldn't we?

I would just hard-code a few amounts and not allow free entry (mostly for simplicity). But I guess we will need to have a check on the server side if we send amounts with the request.

@tomyrd
Copy link
Collaborator Author

tomyrd commented May 2, 2024

I would make the amount selectable (and maybe give a few options there), but would make public note and private notes into separate button.

Done! The new screenshots are pasted in the PR description.

If this is done, we should validate these amounts on the server side so no one consumes an arbitrary amount of tokens, shouldn't we?

I added the possible options to the miden-faucet.toml file and the amount requested is always checked we should be safe from arbitrary requests.

bin/faucet/src/handlers.rs Outdated Show resolved Hide resolved
bin/faucet/src/static/index.js Outdated Show resolved Hide resolved
@bobbinth
Copy link
Contributor

bobbinth commented May 2, 2024

I would make the amount selectable (and maybe give a few options there), but would make public note and private notes into separate button.

Done! The new screenshots are pasted in the PR description.

Looks great! Thank you!

Probably not for this PR: we should add some basic explanations about what public vs. private notes are (maybe on hover of the respective buttons, but maybe in some other way).

@tomyrd tomyrd marked this pull request as draft May 3, 2024 13:26
@tomyrd tomyrd marked this pull request as ready for review May 3, 2024 14:08
Copy link
Contributor

@mFragaBA mFragaBA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested locally and had no issues. I left a small comment regarding the commands used to consume the note.
Also on a side note, now we'll need to keep in mind that changes to the client might impact here as well

@bobbinth
Copy link
Contributor

bobbinth commented May 3, 2024

we'll need to keep in mind that changes to the client might impact here as well

Agreed. In the long term, we should not have this dependency. Created #343 for this.

@igamigo - if all looks good to you, let's merge (after @tomyrd makes the small correction).

@bobbinth
Copy link
Contributor

bobbinth commented May 3, 2024

@tomyrd - oh, and let's update changelog.

Copy link
Collaborator

@igamigo igamigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, let's merge after the changelog is updated.

Copy link
Contributor

@mFragaBA mFragaBA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed on the changelog

@@ -2,6 +2,7 @@

## 0.2.1 (2024-04-27)

* Added option to mint pulic notes in the faucet (#339).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go into v0.3.0 section (you may need to rebase from the latest next).

@bobbinth
Copy link
Contributor

bobbinth commented May 3, 2024

The tests are failing because of the recent changes in miden-base. I'll merge this PR as is and we'll fix tests in a separate issue.

@bobbinth bobbinth merged commit 33ad0ef into next May 3, 2024
4 of 5 checks passed
@bobbinth bobbinth deleted the tomyrd-faucet-public-notes branch May 3, 2024 21:56
@phklive
Copy link
Contributor

phklive commented May 17, 2024

Great job @tomyrd, love the new UI. One thing I believe that this PR has removed the loading spinner when the user clicks on one of the buttons.

This creates a UX where the user does not know if the app is loading waiting for a response from the rollup or if the website is broken.

I believe that we should add it back in another PR.

@tomyrd
Copy link
Collaborator Author

tomyrd commented May 17, 2024

I believe that we should add it back in another PR.

Done. The PR is #362 .

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.

[Feature]: Add public notes to the faucet
5 participants