Skip to content

Conversation

JHTAchilles
Copy link

Thank you for contributing to Mesh! We appreciate your effort and dedication to improving this project. To ensure that your contribution is in line with the project's guidelines and can be reviewed efficiently, please fill out the template below.

Remember to follow our Contributing Guide before submitting your pull request.

Summary

Please provide a brief, concise summary of the changes in your pull request. Explain the problem you are trying to solve and the solution you have implemented.

Adding and improving inline doc to value.ts in mesh-common/data.

Affect components

Please indicate which part of the Mesh Repo

  • @meshsdk/common
  • @meshsdk/contract
  • @meshsdk/core
  • @meshsdk/core-csl
  • @meshsdk/core-cst
  • @meshsdk/hydra
  • @meshsdk/provider
  • @meshsdk/react
  • @meshsdk/svelte
  • @meshsdk/transaction
  • @meshsdk/wallet
  • Mesh playground (i.e. https://meshjs.dev/)
  • Mesh CLI

Type of Change

Please mark the relevant option(s) for your pull request:

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Bug fix (non-breaking change which fixes an issue)
  • Code refactoring (improving code quality without changing its behavior)
  • Documentation update (adding or updating documentation related to the project)

Related Issues

Please add the related issue here if any

Checklist

Please ensure that your pull request meets the following criteria:

  • My code is appropriately commented and includes relevant documentation, if necessary
  • I have added tests to cover my changes, if necessary
  • I have updated the documentation, if necessary
  • All new and existing tests pass (i.e. npm run test)
  • The build is pass (i.e. npm run build)

Additional Information

If you have any additional information or context to provide, such as screenshots, relevant issues, or other details, please include them here.

Copy link
Member

@HinsonSIDAN HinsonSIDAN left a 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.
Copy link
Member

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
Copy link
Member

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.
Copy link
Member

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]])]
Copy link
Member

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

Copy link
Member

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).
Copy link
Member

Choose a reason for hiding this comment

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

Same for policyId

Copy link
Member

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

Copy link
Member

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

Copy link
Author

@JHTAchilles JHTAchilles Sep 14, 2025

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" }
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

same as value

Copy link
Member

@HinsonSIDAN HinsonSIDAN left a 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

@JHTAchilles JHTAchilles merged commit a6abb74 into inline-doc-enhancement Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants