Adds on-chain Bitcoin payment support

Adds support for on-chain Bitcoin payments by:
- Introducing a new `Assets:Bitcoin:OnChain` account.
- Updating the `SettleReceivable` and `PayUser` models to include `txid` for storing transaction IDs.
- Modifying the API endpoints to handle `btc_onchain` as a valid payment method and associate it with the new account.

This allows tracking on-chain Bitcoin transactions separately from Lightning Network payments.
This commit is contained in:
padreug 2025-11-01 23:45:28 +01:00
parent 8b16ead5b1
commit e2472d13a2
3 changed files with 75 additions and 39 deletions

View file

@ -332,3 +332,34 @@ async def m008_rename_lightning_account(db):
WHERE name = 'Assets:Lightning:Balance'
"""
)
async def m009_add_onchain_bitcoin_account(db):
"""
Add Assets:Bitcoin:OnChain account for on-chain Bitcoin transactions.
This allows tracking on-chain Bitcoin separately from Lightning Network payments.
"""
import uuid
# Check if the account already exists
existing = await db.fetchone(
"""
SELECT id FROM accounts
WHERE name = 'Assets:Bitcoin:OnChain'
"""
)
if not existing:
# Create the on-chain Bitcoin asset account
await db.execute(
f"""
INSERT INTO accounts (id, name, account_type, description, created_at)
VALUES (:id, :name, :type, :description, {db.timestamp_now})
""",
{
"id": str(uuid.uuid4()),
"name": "Assets:Bitcoin:OnChain",
"type": "asset",
"description": "On-chain Bitcoin wallet"
}
)