-
Notifications
You must be signed in to change notification settings - Fork 245
Clarity Values Guide #877
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
Clarity Values Guide #877
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/blockstack/blockstack-docs/mp70yhxmt |
Blockstack DocumentationBlockstack docs have been deployed with Vercel using the code from this PR! 📝 Changed routes:
Built with commit 8a8901e. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be really helpful to document the reverse of constructing Clarity values. For example, if I receive a responseCV from a contract function call. How do I extract the value and how do I work with them in JavaScript?
## Clarity Types | ||
The Clarity type system includes the following types: | ||
|
||
- `(tuple (key-name-0 key-type-0) (key-name-1 key-type-1) ...)` - a typed tuple with named fields. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type corresponds to the ECMAScript Record, an immutable mapping from keys to values. The tuple
type in Clarity is a misnomer, likely to confuse JS devs as TC39 will also introduce a Tuple type in ECMAScript that is more like an immutable array, notably different from the tuple
in Clarity. Consider to clarify that this type is like a record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the additional explanation on utilizing Clarity objects in javascript is helpful.
fd05cb3
to
5ef457d
Compare
A guide for dealing with Clarity values in JS.
#816