diff --git a/public/libra.png b/public/libra.png new file mode 100644 index 00000000..c115fefc Binary files /dev/null and b/public/libra.png differ diff --git a/src/App.svelte b/src/App.svelte index 4ab3dff6..f591e616 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -45,6 +45,8 @@ import UpgradeApp from './components/about/UpgradeApp.svelte' import { tryUpdate } from './modules/updater' import { isLoading } from 'svelte-i18n' + import { isBooted } from './modules/boot' + import SplashScreen from './components/layout/SplashScreen.svelte' // black magic with I18n here // temporarily set up here otherwise... issues @@ -117,6 +119,10 @@ + +{#if loading} +
+ +

Carpe Libra

+
+{/if} diff --git a/src/components/settings/AccountSettings.svelte b/src/components/settings/AccountSettings.svelte index ada764b3..8b6cf373 100644 --- a/src/components/settings/AccountSettings.svelte +++ b/src/components/settings/AccountSettings.svelte @@ -5,7 +5,7 @@ import { raise_error } from '../../modules/carpeError' import { notify_success } from '../../modules/carpeNotify' import { responses } from '../../modules/debug' - import { watchAccounts } from '../../modules/accounts' + import { watchAccounts, pendingAccounts } from '../../modules/accounts' const removeAccounts = async () => { resetSigningAccount() @@ -14,6 +14,7 @@ responses.set(res) notify_success('Accounts removed successfully') watchAccounts.set([]) + pendingAccounts.set([]) localStorage.removeItem('watchAccounts') refreshAccounts() }) diff --git a/src/components/wallet/AccountsList.svelte b/src/components/wallet/AccountsList.svelte index 8466fbf6..2a72d5fb 100644 --- a/src/components/wallet/AccountsList.svelte +++ b/src/components/wallet/AccountsList.svelte @@ -3,7 +3,7 @@ import UIkit from 'uikit' import Icons from 'uikit/dist/js/uikit-icons' import { allAccounts, formatAccount, signingAccount } from '../../modules/accounts' - import { printCoins, unscaledCoins } from '../../modules/coinHelpers' + import { printCoins } from '../../modules/coinHelpers' import { connected } from '../../modules/networks' import { setAccount } from '../../modules/accountActions' import Actions from './Actions.svelte' @@ -91,6 +91,23 @@ // Re-sort when preferences change $: sortColumn && $allAccounts.length > 0 && privateSortAccounts(sortColumn) + + const printAmount = (account, balance, isConnected) => { + const balanceFormatted = printCoins(balance); + if (!isConnected) { + return (balance > 0) + ? `${balanceFormatted} ` + : ``; + } + if (account.on_chain != null && account.on_chain == false) { + return $_('wallet.account_list.account_on_chain'); + } + if (account.on_chain) { + return balanceFormatted; + } + return $_('wallet.account_list.account_on_chain'); + } +
@@ -188,27 +205,11 @@ - {printCoins(a.balance.unlocked)} - {#if a.on_chain != null && a.on_chain == false} - {$_('wallet.account_list.account_on_chain')} - {:else if a.on_chain} -
- {#if unscaledCoins(a.balance) < 1} - -
- {$_('wallet.account_list.message')} -
- {/if} - {printCoins(a.balance.total)} -
- {:else if a.balance == null} - {$_('wallet.account_list.loading')}... - {:else if !$connected} - {$_('wallet.account_list.offline')}... - {:else} - {$_('wallet.account_list.account_on_chain')} - {/if} + {@html printAmount(a, a.balance.unlocked, $connected)} + + + {@html printAmount(a, a.balance.total, $connected)} {/if} diff --git a/src/components/wallet/AddWatchAccount.svelte b/src/components/wallet/AddWatchAccount.svelte index c1d8af66..b5e0be3f 100644 --- a/src/components/wallet/AddWatchAccount.svelte +++ b/src/components/wallet/AddWatchAccount.svelte @@ -3,11 +3,18 @@ import { addWatchAccount } from '../../modules/accountActions' let address: string + let isSubmitting = false - const initAccount = (address: string) => { + const initAccount = async (address: string) => { + isSubmitting=true address = address.trim() let isLegacy = address.length === 32 || address.startsWith('0'.padStart(32, '0')) - addWatchAccount(address, isLegacy) + try { + await addWatchAccount(address, isLegacy); + } finally { + isSubmitting = false; + } + } @@ -30,9 +37,14 @@
diff --git a/src/modules/accountActions.ts b/src/modules/accountActions.ts index aaa18b4b..2ecd963b 100644 --- a/src/modules/accountActions.ts +++ b/src/modules/accountActions.ts @@ -423,7 +423,7 @@ export function addWatchAccount(address: string, isLegacy: boolean = true) { addAccountOptimistic('loading...', true) - invoke('add_watch_account', { + return invoke('add_watch_account', { address, isLegacy, }) diff --git a/src/modules/boot.ts b/src/modules/boot.ts index ad5fd45a..176d78b7 100644 --- a/src/modules/boot.ts +++ b/src/modules/boot.ts @@ -44,6 +44,7 @@ export const bootUp = async () => { } else { logger(Level.Warn, 'carpe settings not initialized') await isLegacy().finally(() => { + isBooted.set(true) navigate('wallet') }) }