*This task depends on this other spike task
Discussion: #166 (comment)
The TS Wallet SDK currently has a mix of functions taking several parameters as input and functions taking a single object as input.
E.g.:
// Multiple input params:
swap(
fromAsset: StellarAssetId,
toAsset: StellarAssetId,
amount: string,
destMin?: string,
): TransactionBuilder { ... }
// Single object as input:
pathPay({
destinationAddress,
sendAsset,
destAsset,
sendAmount,
destAmount,
destMin,
sendMax,
}: PathPayParams): TransactionBuilder { ... }
Having an object as input considerably improves the code robustness and scalability as devs won't ever need to worry about in which order they are adding the input parameters.
E.g. on the swap function the first 2 and the last 2 parameters have the same type, so they could be easily swapped without resulting in obvious errors. Which means subtle changes in code could be missed. Whereas if we had an object as input this would most likely never happen without being noticed.
This task is about moving all functions to the single-object-input pattern and follow this code convention moving forwards.
Since this refactor would result in lots of BREAKING CHANGES it seems to merit a 2.0 release.
*This task depends on this other spike task
Discussion: #166 (comment)
The TS Wallet SDK currently has a mix of functions taking several parameters as input and functions taking a single object as input.
E.g.:
Having an object as input considerably improves the code robustness and scalability as devs won't ever need to worry about in which order they are adding the input parameters.
E.g. on the
swapfunction the first 2 and the last 2 parameters have the sametype, so they could be easily swapped without resulting in obvious errors. Which means subtle changes in code could be missed. Whereas if we had an object as input this would most likely never happen without being noticed.This task is about moving
all functionsto thesingle-object-input patternand follow this code convention moving forwards.Since this refactor would result in lots of
BREAKING CHANGESit seems to merit a2.0release.