thencc / algonautjs

A front end friendly Algorand utility
MIT License
10 stars 1 forks source link

api design: atomic vs non-atomic txn funcs #69

Closed spencercap closed 10 months ago

spencercap commented 1 year ago

for the sake of simplicity and onboarding new users without introducing tooo many new terms, is there a way we can combine the atomic and non-atomic txn methods?

or do we not care abt this so much? @youraerials @lanidelrey

lanidelrey commented 1 year ago

I like it as it is, but my preference is lightly held!

spencercap commented 1 year ago

k just bookmarking to talk about tuesday / next week sometime

enceladus commented 1 year ago

I don't think onboarding is the issue here, as anyone using algonautjs will be deep enough in Algorand to have probably read this documentation.

BUT I do agree there's an opportunity for improvement and DRYness here. I haven't given this too much thought, but I think this would be the goal:

// calls sendTransaction() automatically
const result = await algonaut.optInAsset(1234567);

// the same method, without async, returns an unsigned transaction
const result = await algonaut.sendTransaction([
  algonaut.optInAsset(1234567),
  algonaut.optInAsset(2345678)
]);
enceladus commented 1 year ago

That said, I don't think this is super high priority. It's a very consistent pattern as it is. And it will probably require some significant refactoring and JS magic.