mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-10 20:42:32 +02:00
reserve fee added
This commit is contained in:
@@ -3,7 +3,7 @@ import json
|
|||||||
from os import getenv, path
|
from os import getenv, path
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from pydantic import BaseSettings, Field, validator
|
from pydantic import BaseSettings, Field
|
||||||
|
|
||||||
wallets_module = importlib.import_module("lnbits.wallets")
|
wallets_module = importlib.import_module("lnbits.wallets")
|
||||||
wallet_class = getattr(
|
wallet_class = getattr(
|
||||||
@@ -30,6 +30,8 @@ class Settings(BaseSettings):
|
|||||||
data_folder: str = Field(default=None, env="LNBITS_DATA_FOLDER")
|
data_folder: str = Field(default=None, env="LNBITS_DATA_FOLDER")
|
||||||
database_url: str = Field(default=None, env="LNBITS_DATABASE_URL")
|
database_url: str = Field(default=None, env="LNBITS_DATABASE_URL")
|
||||||
force_https: bool = Field(default=True, env="LNBITS_FORCE_HTTPS")
|
force_https: bool = Field(default=True, env="LNBITS_FORCE_HTTPS")
|
||||||
|
reserve_fee_min: int = Field(default=4000, env="LNBITS_RESERVE_FEE_MIN")
|
||||||
|
reserve_fee_pct: float = Field(default=1.0, env="LNBITS_RESERVE_FEE_PERCENT")
|
||||||
service_fee: float = Field(default=0, env="LNBITS_SERVICE_FEE")
|
service_fee: float = Field(default=0, env="LNBITS_SERVICE_FEE")
|
||||||
hide_api: bool = Field(default=False, env="LNBITS_HIDE_API")
|
hide_api: bool = Field(default=False, env="LNBITS_HIDE_API")
|
||||||
denomination: str = Field(default="sats", env="LNBITS_DENOMINATION")
|
denomination: str = Field(default="sats", env="LNBITS_DENOMINATION")
|
||||||
|
@@ -32,6 +32,8 @@ async def m001_create_admin_table(db):
|
|||||||
data_folder = conf.data_folder
|
data_folder = conf.data_folder
|
||||||
database_url = conf.database_url
|
database_url = conf.database_url
|
||||||
force_https = conf.force_https
|
force_https = conf.force_https
|
||||||
|
reserve_fee_min = conf.reserve_fee_min
|
||||||
|
reserve_fee_pct = conf.reserve_fee_pct
|
||||||
service_fee = conf.service_fee
|
service_fee = conf.service_fee
|
||||||
hide_api = conf.hide_api
|
hide_api = conf.hide_api
|
||||||
denomination = conf.denomination
|
denomination = conf.denomination
|
||||||
@@ -56,6 +58,8 @@ async def m001_create_admin_table(db):
|
|||||||
data_folder TEXT,
|
data_folder TEXT,
|
||||||
database_url TEXT,
|
database_url TEXT,
|
||||||
force_https BOOLEAN,
|
force_https BOOLEAN,
|
||||||
|
reserve_fee_min INT,
|
||||||
|
reserve_fee_pct REAL,
|
||||||
service_fee REAL,
|
service_fee REAL,
|
||||||
hide_api BOOLEAN,
|
hide_api BOOLEAN,
|
||||||
denomination TEXT,
|
denomination TEXT,
|
||||||
@@ -81,6 +85,8 @@ async def m001_create_admin_table(db):
|
|||||||
data_folder,
|
data_folder,
|
||||||
database_url,
|
database_url,
|
||||||
force_https,
|
force_https,
|
||||||
|
reserve_fee_min,
|
||||||
|
reserve_fee_pct,
|
||||||
service_fee,
|
service_fee,
|
||||||
hide_api,
|
hide_api,
|
||||||
denomination,
|
denomination,
|
||||||
@@ -91,7 +97,7 @@ async def m001_create_admin_table(db):
|
|||||||
theme,
|
theme,
|
||||||
custom_logo,
|
custom_logo,
|
||||||
ad_space)
|
ad_space)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
""",
|
""",
|
||||||
(
|
(
|
||||||
user,
|
user,
|
||||||
@@ -103,6 +109,8 @@ async def m001_create_admin_table(db):
|
|||||||
data_folder,
|
data_folder,
|
||||||
database_url,
|
database_url,
|
||||||
force_https,
|
force_https,
|
||||||
|
reserve_fee_min,
|
||||||
|
reserve_fee_pct,
|
||||||
service_fee,
|
service_fee,
|
||||||
hide_api,
|
hide_api,
|
||||||
denomination,
|
denomination,
|
||||||
|
@@ -14,6 +14,8 @@ class UpdateAdminSettings(BaseModel):
|
|||||||
funding_source: str = Query(None)
|
funding_source: str = Query(None)
|
||||||
# ops
|
# ops
|
||||||
force_https: bool = Query(None)
|
force_https: bool = Query(None)
|
||||||
|
reserve_fee_min: int = Query(None, ge=0)
|
||||||
|
reserve_fee_pct: float = Query(None, ge=0)
|
||||||
service_fee: float = Query(None, ge=0)
|
service_fee: float = Query(None, ge=0)
|
||||||
hide_api: bool = Query(None)
|
hide_api: bool = Query(None)
|
||||||
# Change theme
|
# Change theme
|
||||||
@@ -38,7 +40,9 @@ class Admin(BaseModel):
|
|||||||
data_folder: Optional[str]
|
data_folder: Optional[str]
|
||||||
database_url: Optional[str]
|
database_url: Optional[str]
|
||||||
force_https: bool = Field(default=True)
|
force_https: bool = Field(default=True)
|
||||||
service_fee: float = Field(default=0)
|
reserve_fee_min: Optional[int]
|
||||||
|
reserve_fee_pct: Optional[float]
|
||||||
|
service_fee: float = Optional[float]
|
||||||
hide_api: bool = Field(default=False)
|
hide_api: bool = Field(default=False)
|
||||||
# Change theme
|
# Change theme
|
||||||
site_title: Optional[str]
|
site_title: Optional[str]
|
||||||
|
@@ -51,16 +51,47 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row q-col-gutter-md">
|
<div class="row q-col-gutter-md">
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<p>
|
<div class="row">
|
||||||
Active Funding<small> (Requires server restart)</small>
|
<div class="col-12">
|
||||||
</p>
|
<p>
|
||||||
<q-select
|
Active Funding<small>
|
||||||
filled
|
(Requires server restart)</small
|
||||||
v-model="data.admin.funding_source"
|
>
|
||||||
hint="Select the active funding wallet"
|
</p>
|
||||||
:options="data.funding_source"
|
<q-select
|
||||||
></q-select>
|
filled
|
||||||
<br />
|
v-model="data.admin.funding_source"
|
||||||
|
hint="Select the active funding wallet"
|
||||||
|
:options="data.funding_source"
|
||||||
|
></q-select>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<p>Minimum wallet reserve</p>
|
||||||
|
<div class="row q-col-gutter-md">
|
||||||
|
<div class="col-6">
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
type="number"
|
||||||
|
filled
|
||||||
|
v-model="data.admin.reserve_fee_min"
|
||||||
|
label="Reserve fee in msats"
|
||||||
|
></q-input>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
type="number"
|
||||||
|
filled
|
||||||
|
v-model="data.admin.reserve_fee_pct"
|
||||||
|
label="Reserve fee in percentage"
|
||||||
|
step="0.1"
|
||||||
|
></q-input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<!-- <q-form @submit="topupWallet"> -->
|
<!-- <q-form @submit="topupWallet"> -->
|
||||||
@@ -1292,6 +1323,8 @@
|
|||||||
disabled_ext,
|
disabled_ext,
|
||||||
funding_source,
|
funding_source,
|
||||||
force_https,
|
force_https,
|
||||||
|
reserve_fee_min,
|
||||||
|
reserve_fee_pct,
|
||||||
service_fee,
|
service_fee,
|
||||||
hide_api,
|
hide_api,
|
||||||
site_title,
|
site_title,
|
||||||
@@ -1311,6 +1344,8 @@
|
|||||||
disabled_ext: disabled_ext.toString(),
|
disabled_ext: disabled_ext.toString(),
|
||||||
funding_source,
|
funding_source,
|
||||||
force_https,
|
force_https,
|
||||||
|
reserve_fee_min,
|
||||||
|
reserve_fee_pct,
|
||||||
service_fee,
|
service_fee,
|
||||||
hide_api,
|
hide_api,
|
||||||
site_title,
|
site_title,
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import importlib
|
import importlib
|
||||||
import subprocess
|
import subprocess
|
||||||
from email.policy import default
|
|
||||||
from os import path
|
from os import path
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user