Object-oriented Spell API
PandaWhisperer opened this issue · 1 comments
PandaWhisperer commented
I find the current Spell API a little bit awkward and I would prefer a more object-oriented interface. As JavaScript is an object-oriented language, I think that would feel more "natural".
I'm thinking something like this:
spell = new dsa.Spell(); // create spell
spell.add({ ... }); // add connectors
await spell.estimateCastGas(); // estimate gas
await spell.cast(); // cast spell
What do you think?
It seems that it would be possible to offer this API without breaking backwards compatibility, simply by extracting the ad-hoc spell class from src/index.js
into a standalone class and binding the existing methods to it.
I can try working this out and submit a PR if interested.
Sowmayjain commented
Thank you. Its implemented on our new SDK: https://github.com/instadapp/dsa-connect