Skip to content

Commit 22df290

Browse files
authored
fix: give extra budget to ZapPlanner apps to avoid 80% budget usage warning (#1099)
* fix: give extra budget to ZapPlanner apps to avoid 80% budget usage warning * fix: zapplanner budget max amount
1 parent 4d7a4dd commit 22df290

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

frontend/src/screens/alby/SupportAlby.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ function SupportAlby() {
7070
return;
7171
}
7272

73-
const maxAmount = Math.floor(parsedAmount * 1.01) + 10; // with fee reserve
73+
// TODO: extract below code as is duplicated with ZapPlanner
74+
// with fee reserve of max(1% or 10 sats) + 30% to avoid nwc_budget_warning (see transactions service)
75+
const maxAmount = Math.floor((parsedAmount * 1.01 + 10) * 1.3);
7476
const isolated = false;
7577

7678
const createAppRequest: CreateAppRequest = {

frontend/src/screens/internal-apps/ZapPlanner.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ export function ZapPlanner() {
118118
throw new Error("Invalid amount");
119119
}
120120

121-
const maxAmount = Math.floor(parsedAmount * 1.01) + 10; // with fee reserve
121+
// with fee reserve of max(1% or 10 sats) + 30% to avoid nwc_budget_warning (see transactions service)
122+
const maxAmount = Math.floor((parsedAmount * 1.01 + 10) * 1.3);
122123
const isolated = false;
123124

124125
const createAppRequest: CreateAppRequest = {

0 commit comments

Comments
 (0)