js-moi-sdk icon indicating copy to clipboard operation
js-moi-sdk copied to clipboard

feat: enhance `ManifestCoder` for encoding/decoding routine arguments and returned values

Open sarvalabs-harshrastogi opened this issue 10 months ago • 0 comments

Enhance ManifestCoder for Encoding/Decoding Routine Arguments and Returned Values

This pull request enhances the ManifestCoder class by introducing new methods and improvements to existing ones. These changes aim to simplify the process of encoding and decoding routine arguments and returned values, improving the overall developer experience.

Changes:

  1. ElementDescriptor:
  • The ElementDescriptor class has been relocated from js-moi-logic to js-moi-manifest.
  • Developers can now instantiate an ElementDescriptor object with a manifest object, providing more flexibility and integration with the manifest data.
  1. Manifest.encodeArguments:
  • This method now supports extracting routine type fields from arguments based on the routine name.
  • It can encode arguments into the POLO format, simplifying the developer experience.
  • The existing functionality remains unaffected, ensuring backward compatibility.
  1. ManifestCoder.decodeArguments:
  • This new method enables extracting the type of the returned value from a routine.
  • It can decode the POLO output passed as an argument, facilitating the processing of routine results.

These changes streamline the process of working with routine arguments and returned values within the ManifestCoder class.

  • closes #62

Changes include

  • [ ] Bugfix (non-breaking change that solves an issue)
  • [X] New feature (non-breaking change that adds functionality)
  • [ ] Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • [X] I have assigned this PR to myself
  • [X] I have added at least 1 reviewer
  • [X] I have tested this code
  • [X] I have updated the README and other relevant documents (guides...)

sarvalabs-harshrastogi avatar Apr 11 '24 09:04 sarvalabs-harshrastogi