Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Add cw20 usage documentation #73

Merged
merged 6 commits into from
Aug 14, 2020
Merged

Add cw20 usage documentation #73

merged 6 commits into from
Aug 14, 2020

Conversation

ethanfrey
Copy link
Member

In this section, we fire up @cosmjs/cli and go deep with the cw20 contract.

Please check it out (also with yarn serve). I would like to publish this to all testnet users Friday (today). And we can link it from a medium article.

Let me know if anything doesn't make sense... I stayed up too late working on this, it probably gets a bit hard to follow.

@ethanfrey ethanfrey requested a review from orkunkl August 13, 2020 22:33
(in addition to all the general helpers it has).

```shell
npx @cosmjs/cli --init https://raw.githubusercontent.com/CosmWasm/cosmwasm-plus/master/contracts/cw20-base/helpers.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

I really like this helpers existence. Very useful. Maybe we can add embed contract helpers URL inside tx msg like source and builder. And in the wasm.glass as well
image

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice idea. We should make this more extensible somehow.

There was already the request to upload all json schemas (and maybe all source) along with the wasm.
A URL for some cosmjs helpers is a good idea.

What do you think @webmaster128 ?

Copy link
Member

Choose a reason for hiding this comment

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

Allowing untrusted "helpers" besically means contract uploaders can trick a user to execute any command they want on their local machine (such as uploading ~/.ssh/id_rsa to a server or do nasty things with your metamask storage).

What I could imagine having is an autogenerated helpers script that is generated by a trusted service like wasm.glass, which is a template with only few well validated variables.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just made an issue to discuss this more: CosmWasm/wasmd#251

Feel free to comment there

Copy link
Contributor

@orkunkl orkunkl left a comment

Choose a reason for hiding this comment

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

Looks good. Just a few comments


### Try this at home: MINE

Now that we have that uploaded, we can easily make a second contract. This one, please
Copy link
Contributor

Choose a reason for hiding this comment

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

I found great vuepress gems today. https://v1.vuepress.vuejs.org/guide/markdown.html#custom-containers. We can use warning, tip containers to point out warning. I'll go through the documentation after this PR and add containers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, cool. Happy for any design improvements.

I would merge this PR once I address the comments, then let you add another PR to make it cleaner.

@ethanfrey
Copy link
Member Author

Hey @orkunkl thanks for the review.

As I was merging this in, I realize I didn't push my last commits (from 1 am), but just did now. This pulls out the .type stuff and more into an "advanced" directory, and fixes token_info => tokenInfo. Can you read through the new advanced usage section.

I do expect this to get refactored again as we add more contracts, but it would be great to have a read through

Copy link
Contributor

@orkunkl orkunkl left a comment

Choose a reason for hiding this comment

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

Good work! I liked the way the document is written. Grabs your attention.

@ethanfrey ethanfrey merged commit e9c1171 into master Aug 14, 2020
@ethanfrey ethanfrey deleted the add-cw20-example branch August 14, 2020 09:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants