-
Notifications
You must be signed in to change notification settings - Fork 96
Adding inline doc to mesh-common/data #717
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
Conversation
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 didnt leave exhaustive comments on all methods, but all review comments applicable to all other methods, fix it and good to go
* @typealias Value | ||
* @description | ||
* Represents the Cardano data Value in JSON format as a nested associative map structure. | ||
* Used for off-chain tooling, API responses, and Cardano smart contract interoperability. |
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.
Dont include any lines which are meaningless such as this because AI is a garbage in garbage out things. Include wrong info affect output quality. Include irrelevant stuff reduce accuracy so:
- remove this line.
- combined with above comment, add below line:
Aiken alias, can be converted into Aiken's `Value` type with `from_asset_list` in standard library (https://aiken-lang.github.io/stdlib/cardano/assets.html#from_asset_list).
export type Value = AssocMap<CurrencySymbol, AssocMap<TokenName, Integer>>; | ||
|
||
/** | ||
* Aiken alias |
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 as Value
type above
* @typealias MValue | ||
* @description | ||
* Represents the Cardano data Value in Mesh Data type as a nested map structure. | ||
* Used for on-chain concepts and Cardano smart contract interoperability. |
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 as Value
type above
* @example | ||
* const m: MValue = new Map([ | ||
* ["", new Map([["", 1000000n]])], // lovelace | ||
* ["policyId", new Map([["TokenA", 5n], ["TokenB", 10n]])] |
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.
help remove all "policyId"
and "TokenA"
kind into real policy ID and token name, such as for token:
Policy ID: 7da4e62157841dc60fbe9ace95ec5b2bcd239cb59c0c7d1c58eea6fb
Token Name: 4e45494c
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.
Make sure the representation is a valid example, so the LLM can know never putting mock data in. Can further instruct policy ID is either empty string
for lovelace and 64 length hex string
for other token. The token name is `64 length max hex string, even number (since representing bytes in hex)
* | ||
* @param {Asset[]} assets | ||
* Array of asset objects to convert. | ||
* - Each asset must have a `unit` ("policyId" or "lovelace") and a `quantity` (stringified integer). |
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 for policyId
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.
Description wise, just dont wrap it with "
, LLM might think its actual string 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.
Indeed its policy Id + token name, not only policy Id
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.
would it be better that I replace ("policyId" or "lovelace") with (policyId + tokenName
or lovelace
)?
* // Minimal usage | ||
* const assets = [ | ||
* { unit: "lovelace", quantity: "1000000" }, | ||
* { unit: "policyIdTokenA", quantity: "5" } |
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 for policyIdTokenA
* The utility function to convert assets into Cardano data Value in Mesh Data type | ||
* @param assets The assets to convert | ||
* @returns The Cardano data Value in Mesh Data type | ||
* @function mValue |
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 as 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.
after fixing those, lgtm now
Summary
Adding and improving inline doc to value.ts in mesh-common/data.
Affect components
@meshsdk/common
@meshsdk/contract
@meshsdk/core
@meshsdk/core-csl
@meshsdk/core-cst
@meshsdk/hydra
@meshsdk/provider
@meshsdk/react
@meshsdk/svelte
@meshsdk/transaction
@meshsdk/wallet
Type of Change
Related Issues
Checklist
npm run test
)npm run build
)Additional Information