From 6f44b755e4509c9deae24492b55e3450558967e8 Mon Sep 17 00:00:00 2001 From: arcbtc Date: Thu, 19 Dec 2024 13:22:06 +0000 Subject: [PATCH] default in create_wallet --- lnbits/core/crud/wallets.py | 1 + lnbits/core/migrations.py | 21 +-------------------- lnbits/static/js/wallet.js | 3 ++- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/lnbits/core/crud/wallets.py b/lnbits/core/crud/wallets.py index f3f3f2039..e63a6991a 100644 --- a/lnbits/core/crud/wallets.py +++ b/lnbits/core/crud/wallets.py @@ -23,6 +23,7 @@ async def create_wallet( user=user_id, adminkey=uuid4().hex, inkey=uuid4().hex, + currency='USD', ) await (conn or db).insert("wallets", wallet) return wallet diff --git a/lnbits/core/migrations.py b/lnbits/core/migrations.py index b20835cb4..99bb00575 100644 --- a/lnbits/core/migrations.py +++ b/lnbits/core/migrations.py @@ -683,23 +683,4 @@ async def m029_create_audit_table(db: Connection): created_at TIMESTAMP NOT NULL DEFAULT {db.timestamp_now} ); """ - ) - - -async def m030_add_currency_to_wallet(db: Connection): - """ - Setting currency to default is heavy, so easier just to add a trigger. - """ - await db.execute( - """ - CREATE TRIGGER IF NOT EXISTS set_default_currency - AFTER INSERT ON wallets - FOR EACH ROW - WHEN NEW.currency IS NULL - BEGIN - UPDATE wallets - SET currency = 'USD' - WHERE id = NEW.id; - END; - """ - ) + ) \ No newline at end of file diff --git a/lnbits/static/js/wallet.js b/lnbits/static/js/wallet.js index daf82d185..11dfabd74 100644 --- a/lnbits/static/js/wallet.js +++ b/lnbits/static/js/wallet.js @@ -679,6 +679,7 @@ window.app = Vue.createApp({ if (this.fiatTracking === false) { this.update.currency = '' this.$q.localStorage.setItem('lnbits.isPrioritySwapped', false) + this.isPrioritySwapped = false this.$q.localStorage.remove(`lnbits.exchangeRate`) } } @@ -726,7 +727,7 @@ window.app = Vue.createApp({ this.$q.localStorage.set('lnbits.disclaimerShown', true) } // check blanace priority - if (this.$q.localStorage.getItem('lnbits.isPrioritySwapped')) { + if (this.$q.localStorage.getItem('lnbits.isPrioritySwapped') && this.g.wallet.currenc) { this.isPrioritySwapped = this.$q.localStorage.getItem( 'lnbits.isPrioritySwapped' )