sarvalabs / js-moi-sdk

JavaScript library to interact with MOI Protocol via RPC API

Home Page:https://js-moi-sdk.docs.moi.technology/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make Signer Optional in Logic Driver Instance Creation

sarvalabs-harshrastogi opened this issue · comments

Make Signer Optional in Logic Driver Instance Creation

The current implementation requires the inclusion of a Signer instance in the LogicDriver constructor function. However, for non-mutating calls, having a signer instance is unnecessary. This forces developers to pass a dummy wallet (non-initialized wallet) solely for compliance. The request is to refine the implementation by making the signer optional, especially in scenarios where non-mutating calls don't require a signer instance. This enhancement aims to eliminate the need for developers to pass a dummy wallet in such cases.

Solution

The proposed refinement suggests enhancing the LogicDriver constructor to accept either an instance of AbstractProvider or Signer. Specifically, in the case of mutating calls, the SDK should throw an exception if a signer is not provided. This modification aims to provide flexibility by allowing developers to choose between a provider or a signer instance, while enforcing the mandatory presence of a signer during mutating calls through exception handling.