Skip to content

Conversation

@fazzatti
Copy link
Contributor

This pull request introduces several enhancements and refactorings to the privacy channel and UTXO-based account modules, focusing on better type safety, extensibility, and convenience for users of the SDK. The most notable changes are the addition of new helper methods to the PrivacyChannel class for easier integration with UTXO-based accounts, and the extraction of constructor argument types to improve code maintainability.

Privacy channel enhancements:

  • Added getBalancesFetcher, getTransactionBuilder, and getUTXOAccountHandler helper methods to the PrivacyChannel class, making it easier to interact with UTXO-based Stellar accounts and build transactions in a pre-configured manner. (src/privacy-channel/index.ts src/privacy-channel/index.tsR153-R219)

  • Introduced the GetUTXOAccountHandlerArgs type for the getUTXOAccountHandler method, enabling type-safe construction of UTXO-based account handlers with customizable options. (src/privacy-channel/types.ts src/privacy-channel/types.tsR81-R96)

UTXO-based account refactoring:

  • Extracted the UTXOBasedAccountConstructorArgs type to a dedicated type definition, and updated the UtxoBasedAccount constructor to use this type, improving clarity and extensibility for account instantiation. (src/utxo-based-account/types.ts [1] src/utxo-based-account/index.ts [2]

Dependency and version updates:

  • Bumped the SDK version from 0.4.0 to 0.5.0 to reflect the new features and API changes. (deno.json deno.jsonL3-R3)

Type import improvements:

  • Improved and consolidated type imports across modules for better type safety and maintainability. (src/privacy-channel/index.ts [1] src/privacy-channel/types.ts [2] src/utxo-based-account/index.ts [3] src/utxo-based-account/types.ts [4]…accurate reporting

- Removed unused properties and methods from PrivacyChannel, including _derivator and related methods.
- Simplified getDerivator method to create a new StellarDerivator instance directly.
- Added static methods in UtxoBasedStellarAccount and MoonlightTransactionBuilder to create instances from PrivacyChannel, enhancing integration.
- Updated integration tests to utilize new static methods for creating transaction builders and UTXO account handlers, improving test clarity and maintainability.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the privacy channel and UTXO-based account modules to improve usability and maintainability by introducing static factory methods (fromPrivacyChannel) that simplify integration. The refactoring removes helper methods from PrivacyChannel in favor of static factory methods on UtxoBasedStellarAccount and MoonlightTransactionBuilder, making the API more intuitive and aligned with best practices. Additionally, the codecov configuration is updated from patch to project coverage reporting.

Key changes:

  • Added static factory methods fromPrivacyChannel to UtxoBasedStellarAccount and MoonlightTransactionBuilder for easier instantiation
  • Refactored PrivacyChannel to remove stateful _derivator field and deprecated helper methods
  • Updated integration tests to demonstrate the new API usage patterns

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
codecov.yml Changed coverage status from patch to project for more accurate reporting
src/privacy-channel/index.ts Removed _derivator field and helper methods; refactored getDerivator() to create instances on-demand
src/privacy-channel/types.ts Removed deprecated GetUTXOAccountHandlerArgs type and cleaned up imports
src/transaction-builder/index.ts Added fromPrivacyChannel static factory method for convenient builder instantiation
src/utxo-based-account/utxo-based-stellar-account/index.ts Added fromPrivacyChannel static factory method for creating account handlers
test/integration/privacy-channel.integration.test.ts Updated tests to use new MoonlightTransactionBuilder.fromPrivacyChannel() API
test/integration/utxo-based-account.integration.test.ts Updated tests to use new UtxoBasedStellarAccount.fromPrivacyChannel() API

@Moonlight-Protocol Moonlight-Protocol deleted a comment from codecov bot Nov 13, 2025
@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 87.09677% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/privacy-channel/index.ts 62.50% 3 Missing ⚠️
...-based-account/utxo-based-stellar-account/index.ts 92.30% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@fazzatti fazzatti merged commit 82a0725 into dev Nov 13, 2025
2 checks passed
@fazzatti fazzatti deleted the fix/static-initiators branch November 13, 2025 13:18
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

Successfully merging this pull request may close these issues.

3 participants