Proposal to Simplify Code Structure in SDK for call Routines
Bhimgouda opened this issue · comments
Bhimgouda D Patil commented
Proposal to Simplify Code Structure in SDK for .call() Routine
Description
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.
Comparison
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.
Harsh Rastogi commented
resolved in #36