js-algorand-sdk
js-algorand-sdk copied to clipboard
ATC: addMethodCall, addTransaction returns this
This simply changes the return type of addTransaction and addMethodCall from void to AtomicTransactionCompose so these methods return the ATC.
The goal is to allow chaining of methods when using the ATC rather than having to instantiate an object and call the methods on that object each time.
For example:
const atc = new algosdk.AtomicTransactionComposer();
atc.addTransaction();
atc.addMethodCall();
atc.execute();
vs
new algosdk.AtomicTransactionComposer()
.addTransaction()
.addMethodCall()
.execute();
No major reason other than a nice minor QOL improvement
Note that this is in conflict with @robdmoore's desire to have addMethodCall() return the newly created transaction: https://github.com/algorand/js-algorand-sdk/issues/759#issuecomment-1505550812