diff --git a/migrations.py b/migrations.py
index 45f570f..dcf6f50 100644
--- a/migrations.py
+++ b/migrations.py
@@ -155,3 +155,40 @@ async def m005_fix_settings_table_drop_mempool(db):
await db.execute("DROP TABLE boltz.settings")
# NOTE using `boltz.settings` for the RENAME TO clause will not work in sqlite
await db.execute("ALTER TABLE boltz.settings_backup RENAME TO settings")
+
+
+async def m006_add_currency_support(db):
+ """
+ Add currency support for fiat conversion in swaps.
+ Stores the currency used and the original display amount entered by user.
+ """
+ # Add currency columns (default to 'sats' for existing swaps)
+ await db.execute(
+ "ALTER TABLE boltz.submarineswap "
+ "ADD COLUMN currency TEXT NOT NULL DEFAULT 'sats'"
+ )
+ await db.execute(
+ "ALTER TABLE boltz.reverse_submarineswap "
+ "ADD COLUMN currency TEXT NOT NULL DEFAULT 'sats'"
+ )
+
+ # Add amount_display columns (stores original fiat amount entered by user)
+ # Using REAL type to store decimal values like 234.56 for fiat
+ await db.execute(
+ "ALTER TABLE boltz.submarineswap "
+ "ADD COLUMN amount_display REAL NOT NULL DEFAULT 0"
+ )
+ await db.execute(
+ "ALTER TABLE boltz.reverse_submarineswap "
+ "ADD COLUMN amount_display REAL NOT NULL DEFAULT 0"
+ )
+
+ # For existing rows, set amount_display = amount (they're all in sats)
+ await db.execute(
+ "UPDATE boltz.submarineswap "
+ "SET amount_display = amount WHERE amount_display = 0"
+ )
+ await db.execute(
+ "UPDATE boltz.reverse_submarineswap "
+ "SET amount_display = amount WHERE amount_display = 0"
+ )
diff --git a/models.py b/models.py
index f65b0dd..643475c 100644
--- a/models.py
+++ b/models.py
@@ -30,6 +30,8 @@ class SubmarineSwap(BaseModel):
bip21: str
redeem_script: str
blinding_key: str | None = None
+ currency: str = "sats"
+ amount_display: float = 0
class CreateSubmarineSwap(BaseModel):
@@ -40,6 +42,8 @@ class CreateSubmarineSwap(BaseModel):
direction: str = Query("receive")
feerate: bool = Query(None)
feerate_value: int | None = Query(None)
+ currency: str = Query("sats")
+ amount_display: float = Query(0)
class ReverseSubmarineSwap(BaseModel):
@@ -63,6 +67,8 @@ class ReverseSubmarineSwap(BaseModel):
timeout_block_height: int
redeem_script: str
blinding_key: str | None = None
+ currency: str = "sats"
+ amount_display: float = 0
class CreateReverseSubmarineSwap(BaseModel):
@@ -74,6 +80,8 @@ class CreateReverseSubmarineSwap(BaseModel):
onchain_address: str = Query(...)
feerate: bool = Query(None)
feerate_value: int | None = Query(None)
+ currency: str = Query("sats")
+ amount_display: float = Query(0)
class AutoReverseSubmarineSwap(BaseModel):
diff --git a/templates/boltz/_reverseSubmarineSwapDialog.html b/templates/boltz/_reverseSubmarineSwapDialog.html
index af7d3f3..5d1443d 100644
--- a/templates/boltz/_reverseSubmarineSwapDialog.html
+++ b/templates/boltz/_reverseSubmarineSwapDialog.html
@@ -26,15 +26,32 @@
>
-