diff --git a/metro.config.js b/metro.config.js index c3b0e12..45de989 100644 --- a/metro.config.js +++ b/metro.config.js @@ -2,7 +2,7 @@ const { getDefaultConfig } = require('expo/metro-config'); const config = getDefaultConfig(__dirname); -// Enable debug logging and better error reporting +// Configure supported platforms for module resolution config.resolver.platforms = ['ios', 'android', 'native', 'web']; // Polyfill Node.js modules for React Native @@ -24,13 +24,15 @@ config.transformer.minifierConfig = { config.server = { enhanceMiddleware: (middleware) => { return (req, res, next) => { - console.log(`[Metro] ${req.method} ${req.url}`); + if (process.env.NODE_ENV !== 'production') { + console.log(`[Metro] ${req.method} ${req.url}`); + } return middleware(req, res, next); }; }, }; -// Enable better error handling +// Configure Metro transformer options for imports and inline requires config.transformer.getTransformOptions = async () => ({ transform: { experimentalImportSupport: false, diff --git a/services/rbf-service.ts b/services/rbf-service.ts index 077d4e8..cf114f6 100644 --- a/services/rbf-service.ts +++ b/services/rbf-service.ts @@ -18,6 +18,13 @@ let bip32Module: unknown = null; */ const NON_RBF_SEQUENCE = 0xFFFFFFFF; +/** + * Minimum required fee increase (as a fraction of the original fee) + * to consider a replacement transaction for RBF. + * For example, 0.1 means a 10% minimum fee increase. + */ +const MIN_RBF_FEE_INCREASE_RATE = 0.1; + /** * Validates the given ECC library by checking basic functionality. * Throws an error if validation fails. @@ -36,8 +43,6 @@ function validateECCLibrary(ecc: any): void { if (!publicKey || publicKey.length !== 33) { throw new Error('ECC point generation failed'); } - - console.log('✅ ECC library validation passed'); } export interface RBFTransaction { @@ -54,7 +59,7 @@ export interface RBFValidationResult { isValid: boolean; canReplace: boolean; reason?: string; - originalTx?: any; + originalTx?: Transaction; utxos?: UTXO[]; } @@ -519,7 +524,7 @@ export async function createReplacementTransaction( // Ensure the new fee meets RBF requirements (must be higher than original) // Only apply minimum increase if user's requested fee is too low - const minFeeIncrease = Math.ceil(originalFee * 0.1); // 10% increase minimum for RBF + const minFeeIncrease = Math.ceil(originalFee * MIN_RBF_FEE_INCREASE_RATE); // minimum increase for RBF const actualTargetFee = Math.max(targetFee, originalFee + minFeeIncrease); const feeIncrease = actualTargetFee - originalFee;