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]

Victor Hugo and others added 30 commits October 13, 2025 18:22
…up 🧹

- Deleted `index.ts` from `src/pool/` as it was exporting an unused module.
- Removed `index.ts`, `types.ts`, and `index.unit.test.ts` from `src/pool/pool-engine/` to eliminate unnecessary code and improve maintainability.
…ts and types

- Added constants for AuthReadMethods and AuthInvokeMethods in `src/channel-auth/constants.ts`.
- Introduced `PrivacyChannel` class in `src/privacy-channel/index.ts` to manage channel interactions.
- Created types for channel operations in `src/privacy-channel/types.ts`, including read and invoke methods.
- Established contract specifications using `Spec` for both authentication and channel operations.
- Added JSDoc comments to the `require`, `getclient`, `getAuthId`, `getNetworkConfig`, `getDerivator`, and `getChannelId` methods.
- Improved documentation clarity by specifying return types and potential errors for better developer understanding and usage.
… clarity in channel authentication context 🔧
… client initialization, contract interaction, and provider management
fazzatti and others added 11 commits November 11, 2025 18:01
…tation

- Updated import statement in src/operation/index.ts to reference the correct deposit-auth-entry.ts file.
- Deleted obsolete src/utils/auth/deposit-auth-entry copy.ts file.
- Renamed function in src/utils/auth/deposit-auth-entry.ts from generateDepositAuthEntry to buildDepositAuthEntry for consistency.
…e retrieval

- Introduced a new method `getBalancesFetcher` in the `PrivacyChannel` class.
- This method returns a function that fetches balances for given UTXO public keys.
- Updated imports to include `UTXOPublicKey` and `Buffer` for handling UTXO data.
- Enhanced readability by updating comments in the code.
…ount management

- Implemented getUTXOAccountHandler in PrivacyChannel to create and return a UtxoBasedStellarAccount handler pre-configured for the privacy channel.
- Added GetUTXOAccountHandlerArgs type to define the arguments required for the new method.
- Updated types.ts to include Ed25519SecretKey in imports and defined the new GetUTXOAccountHandlerArgs type.
- Modified index.ts in utxo-based-account to adjust the constructor to accept UTXOBasedAccountContructorArgs.
…r, and getUTXOAccountHandler methods in PrivacyChannel; change import to type for UTXOBasedAccountContructorArgs
@fazzatti fazzatti requested a review from toruguera November 13, 2025 12:23
@fazzatti fazzatti self-assigned this Nov 13, 2025
Copilot AI review requested due to automatic review settings November 13, 2025 12:23
@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 80.95238% with 8 lines in your changes missing coverage. Please review.

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

📢 Thoughts on this report? Let us know!

Copilot finished reviewing on behalf of fazzatti November 13, 2025 12:25
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 release (0.5.0) enhances the Moonlight SDK with new convenience methods for PrivacyChannel and improved type safety through extracted constructor argument types for UTXO-based accounts.

  • Added three helper methods to PrivacyChannel for easier integration with UTXO-based accounts: getBalancesFetcher, getTransactionBuilder, and getUTXOAccountHandler
  • Extracted UTXOBasedAccountConstructorArgs type for improved code maintainability and type reuse
  • Introduced GetUTXOAccountHandlerArgs type for type-safe UTXO account handler construction

Reviewed Changes

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

Show a summary per file
File Description
deno.json Bumped SDK version from 0.4.0 to 0.5.0 to reflect new features
src/utxo-based-account/types.ts Added UTXOBasedAccountConstructorArgs type definition and imported BaseDerivator
src/utxo-based-account/index.ts Refactored constructor to use extracted UTXOBasedAccountConstructorArgs type
src/privacy-channel/types.ts Added GetUTXOAccountHandlerArgs type and imported necessary dependencies
src/privacy-channel/index.ts Added three new helper methods (getBalancesFetcher, getTransactionBuilder, getUTXOAccountHandler) to facilitate UTXO-based account operations

toruguera
toruguera previously approved these changes Nov 13, 2025
fazzatti and others added 6 commits November 13, 2025 09:49
- 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.
@fazzatti fazzatti merged commit 774b95c into main Nov 13, 2025
3 checks passed
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