-
Notifications
You must be signed in to change notification settings - Fork 18
feat: Add Spark blockchain payout support #2459
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
Open
TaprootFreak
wants to merge
17
commits into
develop
Choose a base branch
from
feat/spark-blockchain-payout-support
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Implement SparkClient for blockchain RPC communication - Add SparkFeeService for dynamic fee estimation - Create PayoutSparkService extending Bitcoin-based payout pattern - Implement Spark strategies for prepare and payout operations - Add comprehensive unit tests for Spark services - Register Spark components in payout and blockchain modules - Support batch transactions with up to 100 outputs - Enable UTXO-based transaction handling similar to Bitcoin
- Use environment variables instead of Config.blockchain.spark - Make SparkClient extend BlockchainClient properly - Implement missing abstract methods from BlockchainClient - Fix type conversion issues in PayoutSparkService - Add proper response type handling in RPC calls
- Remove SPARK_WALLET_ADDRESS from .env.example - Remove walletAddress from Config (auto-generated by SDK) - Add SPARK_WALLET_SEED to .env.example with random seed - Update documentation to reflect SDK generates address from seed
- Fix SparkService tests to mock SparkClient instead of HttpService - Fix PayoutSparkService tests to use correct PayoutGroup type (array) - Add comprehensive SparkClient test suite with SDK mocking - Remove UTXO references (Spark is Layer-2, not UTXO-based) - Fix confirmation counts (Spark uses binary: 0=pending, 1=confirmed) - Add tests for error handling, edge cases, and SDK initialization - Fix walletAddress getter to use SDK-generated address - Ensure all tests properly validate Spark-specific behavior
- Import SparkService and SparkClient - Add to type unions for BlockchainClientType and BlockchainServiceType - Add sparkService to constructor dependencies - Handle Blockchain.SPARK case in getService() switch statement This completes the Spark blockchain integration by ensuring it's properly registered in the central blockchain registry service.
- Remove unused config properties (explorerUrl, addressPrefix, fee, minTxAmount) - explorerUrl is managed centrally in blockchain.util.ts - Other properties were never used - Remove unused roundAmount() method from SparkClient - Remove unused Util import - Simplify SparkFeeService by removing irrelevant UTXO-based calculations - Remove transaction size calculations (not relevant for Layer-2) - Remove fee validation (always 0) - Remove historical fee rates (always 0) - Remove unused constants Keep only what's actually needed for Spark Layer-2 operations
…tion - Fix lazy wallet initialization in SparkClient to prevent test failures - Add Config mock for Spark tests - Fix boolean conversion in PayoutSparkService.getPayoutCompletionData - Configure Spark referral reward payout limit (1 EUR) - All 61 Spark tests now passing successfully
…exity - Simplify SparkFeeService to single method (always returns 0) - Remove SparkFeeTarget enum (unnecessary for fee-free system) - Remove validatePayout override (base class validation sufficient) - Remove averageTransactionSize variable (irrelevant for L2) - Remove unnecessary comments about removed features - All 61 tests still passing
- Delete SparkFeeService entirely (unnecessary for fee-free system) - Remove SparkNetwork enum and NETWORK_PREFIXES map - Simplify getAddressPrefix method - Clean up test files to remove fee service references - All 61 tests still passing
- Reduce PayoutSparkService from 77 to 31 lines (-60%) - Remove redundant proxy methods (validateAddress, getBalance, etc.) - Simplify BlockchainClient interface methods (return 0/null for tokens) - Remove unnecessary method duplicates (getWalletBalance) - Simplify fee methods comments - Update tests to match simplified implementation - All 50 tests passing (reduced from 61 due to removed methods)
- Replace require() with ES6 imports in tests - Prefix unused variables with underscore - Remove unused imports
davidleomay
approved these changes
Sep 23, 2025
d06a5a8 to
b4b852e
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Core Implementation
Strategy Pattern
Integration
Features
Testing
Implementation Notes