Closed Bhimgouda closed 10 months ago
The existing code structure appears as follows:
let ixResponse = await logicDriver.routines.GetPosts() let { allPosts } = (await ixResponse.result()).output;
This proposal suggests simplifying it to the following form:
let { allPosts } = await logicDriver.routines.GetPosts().unwrap();
With this proposed change, devs can use .unwrap() to directly retrieve the returned object if they are not concerned about the ixResponse data.
This proposal draws inspiration from the approach taken by ethers.js in simplifying their call methods:
await erc20.decimals(); // you get 18
The intention is to streamline the code structure and enhance the developer experience with a more readable syntax.
resolved in https://github.com/sarvalabs/js-moi-sdk/pull/36
Proposal to Simplify Code Structure in SDK for .call() Routine
Description
The existing code structure appears as follows:
This proposal suggests simplifying it to the following form:
With this proposed change, devs can use .unwrap() to directly retrieve the returned object if they are not concerned about the ixResponse data.
Comparison
This proposal draws inspiration from the approach taken by ethers.js in simplifying their call methods:
The intention is to streamline the code structure and enhance the developer experience with a more readable syntax.