From 6048768a9149f81cfa44661bdd6bb9565d450fc8 Mon Sep 17 00:00:00 2001 From: Anubhav Dash <83800189+AnubhavDash@users.noreply.github.com> Date: Mon, 2 Mar 2026 22:44:23 +0530 Subject: [PATCH 1/3] Change docker-compose commands to docker compose (#3291) * Change docker-compose commands to docker compose Updated README to use 'docker compose' instead of 'docker-compose'. * Switch from docker-compose to docker compose * Update docker-compose command to docker compose --- .env.local.example | 2 +- README.md | 10 +++++----- scripts/setup.sh | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.env.local.example b/.env.local.example index a572ed9126..cff2c05989 100644 --- a/.env.local.example +++ b/.env.local.example @@ -2,7 +2,7 @@ # # QUICK START: # 1. cp .env.local.example .env -# 2. docker-compose up -d +# 2. docker compose up -d # 3. npm run setup # # That's it! The setup script will: diff --git a/README.md b/README.md index f33e4ce46d..86d9c5d972 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ npm install cp .env.local.example .env # 3. Start database -docker-compose up -d +docker compose up -d # 4. Run setup (generates seeds, starts API, registers admin) npm run setup @@ -251,10 +251,10 @@ Seed data is stored in `migration/seed/` and can be customized as needed. ### Docker Commands ```bash -docker-compose up -d # Start database -docker-compose logs db-init # Check if database was created -docker-compose down # Stop database -docker-compose down -v # Stop and delete data +docker compose up -d # Start database +docker compose logs db-init # Check if database was created +docker compose down # Stop database +docker compose down -v # Stop and delete data docker logs dfx-mssql # View database logs ``` diff --git a/scripts/setup.sh b/scripts/setup.sh index 08bf88e798..156a6764e2 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -76,12 +76,12 @@ fi # Start database echo "" echo "🗄️ Starting database..." -docker-compose up -d +docker compose up -d # Wait for database initialization echo "⏳ Waiting for database initialization..." for i in {1..30}; do - if docker-compose logs db-init 2>&1 | grep -q "Database 'dfx' ready"; then + if docker compose logs db-init 2>&1 | grep -q "Database 'dfx' ready"; then echo "✅ Database ready" break fi From 68a87a0977090142aa0c46a241c06f197ad04584 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Mon, 2 Mar 2026 18:25:38 +0100 Subject: [PATCH 2/3] fix: remove manual fee handling from Binance Lightning withdrawal (#3313) The Lightning withdrawal failed with Binance error -4103 because getWithdrawalFee returned the wrong fee for Lightning (CCXT network key mismatch), causing the amount sent to not match invoice + fee. Fix: send only the invoice amount to Binance and let Binance deduct the fee from the balance separately, like it does for all other withdrawal networks. --- .../adapters/actions/binance.adapter.ts | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/subdomains/core/liquidity-management/adapters/actions/binance.adapter.ts b/src/subdomains/core/liquidity-management/adapters/actions/binance.adapter.ts index 02726136ae..d46367395c 100644 --- a/src/subdomains/core/liquidity-management/adapters/actions/binance.adapter.ts +++ b/src/subdomains/core/liquidity-management/adapters/actions/binance.adapter.ts @@ -58,38 +58,28 @@ export class BinanceAdapter extends CcxtExchangeAdapter { const network = this.exchangeService.mapNetwork(Blockchain.LIGHTNING) || undefined; const balance = await this.exchangeService.getAvailableBalance(asset); - const withdrawalFee = await this.exchangeService.getWithdrawalFee(asset, network); - - const amount = Util.floor( - Math.min(order.maxAmount, balance - withdrawalFee, BINANCE_LIGHTNING_MAX_WITHDRAWAL_BTC), - 8, - ); + const amount = Util.floor(Math.min(order.maxAmount, balance, BINANCE_LIGHTNING_MAX_WITHDRAWAL_BTC), 8); if (amount <= 0) throw new OrderNotProcessableException( `${this.exchangeService.name}: not enough balance for ${asset} (balance: ${balance}, min. requested: ${order.minAmount}, max. requested: ${order.maxAmount})`, ); + const amountSats = LightningHelper.btcToSat(amount); - // Generate invoice via LnBits for the target amount (excluding fee) + // Generate invoice via LnBits for the target amount const invoice = await this.lightningClient.getLnBitsWalletPayment({ amount: amountSats, memo: `LM Order ${order.id}`, expirySec: 1800, // 30 min (Binance limit) }); - order.inputAmount = amount + withdrawalFee; + order.inputAmount = amount; order.inputAsset = asset; order.outputAsset = asset; - // Send invoice to Binance - amount must be invoice_amount + withdrawal_fee - const response = await this.exchangeService.withdrawFunds( - asset, - amount + withdrawalFee, - invoice.pr, - undefined, - network, - ); + // Send only the invoice amount — Binance deducts the fee from the balance separately + const response = await this.exchangeService.withdrawFunds(asset, amount, invoice.pr, undefined, network); return response.id; } From c975f725e26eca7596310894705a3768b05666ac Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Mon, 2 Mar 2026 18:35:21 +0100 Subject: [PATCH 3/3] fix: reserve 1% balance buffer for Binance Lightning withdrawal fee (#3315) Prevent InsufficientFunds error when the full balance is used for a Lightning withdrawal by capping the amount at 99% of the available balance, leaving room for Binance to deduct the withdrawal fee. --- .../liquidity-management/adapters/actions/binance.adapter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subdomains/core/liquidity-management/adapters/actions/binance.adapter.ts b/src/subdomains/core/liquidity-management/adapters/actions/binance.adapter.ts index d46367395c..d01d5964eb 100644 --- a/src/subdomains/core/liquidity-management/adapters/actions/binance.adapter.ts +++ b/src/subdomains/core/liquidity-management/adapters/actions/binance.adapter.ts @@ -58,7 +58,7 @@ export class BinanceAdapter extends CcxtExchangeAdapter { const network = this.exchangeService.mapNetwork(Blockchain.LIGHTNING) || undefined; const balance = await this.exchangeService.getAvailableBalance(asset); - const amount = Util.floor(Math.min(order.maxAmount, balance, BINANCE_LIGHTNING_MAX_WITHDRAWAL_BTC), 8); + const amount = Util.floor(Math.min(order.maxAmount, balance * 0.99, BINANCE_LIGHTNING_MAX_WITHDRAWAL_BTC), 8); if (amount <= 0) throw new OrderNotProcessableException(