default in create_wallet

This commit is contained in:
arcbtc
2024-12-19 13:22:06 +00:00
parent 5997fd74fa
commit 6f44b755e4
3 changed files with 4 additions and 21 deletions
+1
View File
@@ -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
+1 -20
View File
@@ -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;
"""
)
)
+2 -1
View File
@@ -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'
)