Passing a tuple/object with argument keys when invoking a endpoint
Description
In the current implementation of cocolang, developers must explicitly mention argument variable names, even when passing a single argument to a function, as demonstrated by the following syntax:
someFunc(name: bhim)
Inspired by this approach, there is a proposal to enhance the js-moi-sdk by adopting a similar convention. The idea is to use tuples instead of arrays when passing arguments to endpoints, aligning the SDK syntax more closely with the cocolang convention.
The current syntax for passing arguments in the SDK looks like this:
logicDriver.routines.someFunc(["bhim"])
The proposed syntax, on the other hand, suggests using a more structured and readable format:
logicDriver.routines.someFunc({name: "Bhim"})
In this proposed change, each argument is explicitly labeled with its corresponding parameter name. To ensure code integrity, the SDK should implement thorough validation. If there is a mistake in the number of arguments provided, an invalid argument name, or a datatype mismatch, the SDK should check against the manifest and throw an appropriate error.
Passing a tuple/object with argument keys when invoking a endpoint
Description
In the current implementation of cocolang, developers must explicitly mention argument variable names, even when passing a single argument to a function, as demonstrated by the following syntax:
Inspired by this approach, there is a proposal to enhance the js-moi-sdk by adopting a similar convention. The idea is to use tuples instead of arrays when passing arguments to endpoints, aligning the SDK syntax more closely with the cocolang convention.
The current syntax for passing arguments in the SDK looks like this:
The proposed syntax, on the other hand, suggests using a more structured and readable format:
In this proposed change, each argument is explicitly labeled with its corresponding parameter name. To ensure code integrity, the SDK should implement thorough validation. If there is a mistake in the number of arguments provided, an invalid argument name, or a datatype mismatch, the SDK should check against the manifest and throw an appropriate error.