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

UI tutorial #1072

Merged
merged 10 commits into from
May 23, 2024
Merged

UI tutorial #1072

merged 10 commits into from
May 23, 2024

Conversation

samsiegart
Copy link
Contributor

@samsiegart samsiegart commented May 1, 2024

fixes #922

Link to tutorial page: https://ui-tutorial.documentation-7tp.pages.dev/guides/ui-tutorial/#ui-tutorial

Reference repo https://github.com/agoric-labs/ui-tutorial

In general I need to add some reference images, better linking to other docs and repos, and better layout/indexing of pages (in addition to prose and other content from code review/feedback)

Copy link

cloudflare-workers-and-pages bot commented May 1, 2024

Deploying documentation with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7f1c68f
Status: ✅  Deploy successful!
Preview URL: https://5bdf4897.documentation-7tp.pages.dev
Branch Preview URL: https://ui-tutorial.documentation-7tp.pages.dev

View logs

Copy link

github-actions bot commented May 1, 2024

Cloudflare deployment logs are available here

@otoole-brendan
Copy link
Contributor

This is awesome @samsiegart! I might have missed it but I didn't see it reference the current 'Building Client Dapps' (https://docs.agoric.com/guides/getting-started/contract-rpc.html) page. Should it?

@samsiegart
Copy link
Contributor Author

This is awesome @samsiegart! I might have missed it but I didn't see it reference the current 'Building Client Dapps' (https://docs.agoric.com/guides/getting-started/contract-rpc.html) page. Should it?

Yea thanks for calling out, just added links in a few places where the context was appropriate

@Jovonni Jovonni self-requested a review May 16, 2024 17:33
yarn add -D buffer
```

Now, create a new file `src/installSesLockdown.ts`:
Copy link
Contributor

Choose a reason for hiding this comment

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

we could probably link to more documentation on what this file is doing. Even if we just link to docs on lockdown. As now its just "make a new file, and copy/paste this". There an opportunity to explain lockdown briefly here. Although it isnt a blocker for the dev. More informational

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tbh I'm just having a hard time succinctly explaining it. Thinking out loud, it prevents the modification of certain intrinsics in the JS environment, and adds support for harden and assert etc. But that might lead to more questions than answers, as those things aren't really concerns for most UI devs (unless you're using https://github.com/LavaMoat/LavaMoat). It's really just needed so the agoric libraries work, because they're also used in smart contracts where those things actually matter.

We've talking about having a way to use the agoric libraries without hardening, but there hasn't been any movement on that yet. Maybe just linking to endo here is enough for now.

- Scaffolding a new React App.
- Setting up `AgoricProvider` and connecting to a wallet.
- Reading and rendering purse balances.
- Reading contract data with `chainStorageWatcher`.
Copy link
Contributor

Choose a reason for hiding this comment

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

My thought here, and this also was a gotcha for me, but this tutorial is showing how you read data from vstorage in general, as the code is using

[Kind.Data, 'published.agoricNames.instance']
...
[Kind.Data, 'published.agoricNames.brand']

But these aren't storage paths set by the contract. I think the wording can improve here so a brand new dev doesn't think they are reading contract data.

I see an opportunity to even combine/link other resources on how the writing of vstorage works, so they can understand the relationship between how writes work and these storage paths they see in this tutorial.

For this specifically, we could even change this to be

- Reading vstorage data with `chainStorageWatcher`

would love thoughts on this

Copy link
Contributor

@Jovonni Jovonni May 16, 2024

Choose a reason for hiding this comment

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

i also do understand the brand is from the contract, since its minting. Therefore the contract is still reading brand from the asset being minted by the contract, this seems like we can say this more clear. Maybe its just we don't call it contract data here, but more vstorage data... idk.

So maybe, its just some clarity in the tutorial on how those storage paths are where you store data if you want it to be accessible to the outside world.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea that's understandable, I wasn't sure if "vstorage" would sound too unfamiliar but I don't think it's a big concern, just changed it from "contract data" to "vstorage" everywhere.

Also added a link to https://docs.agoric.com/guides/zoe/pub-to-storage.html#publishing-to-chainstorage as well

Copy link
Contributor

@Jovonni Jovonni left a comment

Choose a reason for hiding this comment

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

LGTM, and i was able to use it to get through building the UI. Aside from my minor comments on clarity of vstorage writing, and reading here, this looks good team 🚀

@samsiegart samsiegart marked this pull request as ready for review May 21, 2024 08:48
@samsiegart
Copy link
Contributor Author

@Jovonni I just made some changes as you suggested and added the tutorial pages to the nav bar, mind taking one more look before I merge?

Also, I realized the AgoricProvider API has changed since Agoric/ui-kit#109. I'll go back and update it here and in the example repo since it's kinda a pain to update all the branches in the example, and this tutorial specifies an older version of @agoric/react-components so it should still work.

@samsiegart samsiegart merged commit a9837b9 into main May 23, 2024
4 checks passed
@samsiegart samsiegart deleted the ui-tutorial branch May 23, 2024 01:09
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.

How to build a Client UI - document ui-kit
3 participants