Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS Wallet SDK] Consolidate object as function input #168

Open
CassioMG opened this issue Sep 2, 2024 · 0 comments
Open

[TS Wallet SDK] Consolidate object as function input #168

CassioMG opened this issue Sep 2, 2024 · 0 comments
Assignees

Comments

@CassioMG
Copy link
Contributor

CassioMG commented Sep 2, 2024

*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.

@CassioMG CassioMG self-assigned this Sep 2, 2024
@CassioMG CassioMG changed the title [TS Wallet SDK] Release 2.0 to consolidate object as function input [TS Wallet SDK] Consolidate object as function input Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant