-
Notifications
You must be signed in to change notification settings - Fork 116
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
2922 michel codec doc #2972
2922 michel codec doc #2972
Conversation
…2-michel-codec-doc
A new deploy preview is available on Cloudflare Pages at https://ada46418.taquito-test-dapp.pages.dev |
New packages have been deployed to the preview repository at https://npm.preview.tezostaquito.io/. Published packages:
|
const p = new Parser(parserOptions); | ||
``` | ||
|
||
### parseJSON & emitMicheline - Parse JSON Michelson and convert it to Micheline |
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.
redundant title, remove 'parseJSON & emitMicheline`
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.
they are in place so the outline of the doc display the function names
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.
you listed them right below it, I would remove it
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.
Heading titles for documentation should be concise and clear
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.
also having the title of methods as a preface to what it does is not a very good habit when writing technical documentation (it does work in some exceptions, but not in this case)
When writing a heading for a section, you want to explain what this section describes:
Parsing JSON Michelson and converting to Micheline
and then you would describe what methods to use in the content of said section
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 did some reading on writing technical docs outlines and it says it's good idea to have both method name with concise description and I also reference ethereum taquito equivalent tool docs, their outline have method name only. I think this is a preference and i decided to keep them.
.catch((error) => println(`Error: ${JSON.stringify(error, null, 2)}`)); | ||
``` | ||
|
||
### parseMichelineExpression - Parse Micheline and convert it to JSON Michelson |
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.
same here, remove 'parseMichelineExpression - '
|
||
## PACK and UNPACK locally | ||
|
||
### packData & packDataBytes - Pack Michelson data |
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.
same here
// { bytes: "050a0000001901be41ee922ddd2cf33201e49d32da0afec571dce300666f6f" } | ||
``` | ||
|
||
### unpackData & unpackDataBytes - Unpack Michelson data |
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.
same here
docs/michel_codec.md
Outdated
|
||
### packData & packDataBytes - Pack Michelson data | ||
`packData` & `packDataBytes` serialize any value of packable type to its optimized binary representation identical to the one used by PACK Michelson instructions. | ||
Without a type definition (not recommended) the data will be encoded as a binary form of a generic Michelson expression. |
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.
Missing comma after '(not recommended)'.
docs/michel_codec.md
Outdated
``` | ||
|
||
### unpackData & unpackDataBytes - Unpack Michelson data | ||
Deserialize a byte array into the corresponding Michelson value. |
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.
*Deserializes a byte array into *its corresponding Michelson value
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.
grammarly compliants Deserializes but i've updated *its corresponding Michelson value
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.
it is grammatically correct in this context since it's referring to a previous statement
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.
it is akin to saying 'This method deserializes...'
you wouldn't say 'This method deserialize..'
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.
deserialize should work too, but just pointing out that testing that sentence in grammarly will obviously output an error due to the false premise
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.
Complete sentence will be "unpackData
& unpackDataBytes
deserialize..."
docs/michel_codec.md
Outdated
|
||
### unpackData & unpackDataBytes - Unpack Michelson data | ||
Deserialize a byte array into the corresponding Michelson value. | ||
Without a type definition (not recommended) the binary data will be treated as a binary form of a generic Michelson expression and returned as is. |
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.
missing comma after parentheses
docs/michel_codec.md
Outdated
author: Hui-An Yang | ||
--- | ||
|
||
The purpose of the `taquito/michel-codec` package is to convert and validate Michelson expressions between JSON-based Michelson and Micheline. This package also comes with functions like `packData`, `packDataBytes`, `unpackData` and `unpackDataBytes` to serialize any value of packable type to its optimized binary representation locally and vice versa, like Michelson instructions `PACK` and `UNPACK`. |
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 recommend writing in an active tense. for example:
The `taquito/michel-codec` package converts and validates Michelson expressions between JSON-based Michelson and Micheline. It comes with various functions like.....
docs/michel_codec.md
Outdated
The purpose of the `taquito/michel-codec` package is to convert and validate Michelson expressions between JSON-based Michelson and Micheline. This package also comes with functions like `packData`, `packDataBytes`, `unpackData` and `unpackDataBytes` to serialize any value of packable type to its optimized binary representation locally and vice versa, like Michelson instructions `PACK` and `UNPACK`. | ||
|
||
## Parser class | ||
To use the parser class as is, we import it from the package and initialize it. |
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.
*To use the parser class, import it as follows
- not necessary to say as is, you expanded the parameters below.
- we also add a very clear example right below it, so just point to the example instead of mentioning it in text
docs/michel_codec.md
Outdated
const p = new Parser() | ||
``` | ||
### Configuration | ||
If you'd like to customize the parser class to `expandMacros` or `expandGlobalConstant,` you can configure its `ParserOptions` through initialization. |
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'd recommend saying something like, 'You can pass parameters to the parser class to blablabla' instead of 'customizing' the parser class. Customizing implies something like the taquito-http-util customization. This is just extra params.
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.
can you elaborate the difference of extra params and customize?
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.
customize would be to modify the method, refer to this doc https://taquito.io/docs/next/cancel_http_requests
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.
update to this "You can configure the parser class by passing ParserOptions
through initialization with expandMacros
and expandGlobalConstant
properties."
Deploying taquito with Cloudflare Pages
|
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.
some comments not yet addressed
adding michel codec documentation page to website
closes #2922
Thank you for your contribution to Taquito.
Before submitting this PR, please make sure:
In this PR, please also make sure:
closes #TICKETNUMBER
in the description box (when applicable)Release Note Draft Snippet
If relevant, please write a summary of your change that will be suitable for
inclusion in the Release Notes for the next Taquito release.