-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web-wallet: Add option to sync from a custom block height
- Loading branch information
1 parent
6b020c5
commit 2adc828
Showing
5 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
web-wallet/src/routes/(welcome)/setup/restore/NetworkSync.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<script> | ||
import { AppAnchor } from "$lib/components"; | ||
import { ToggleableCard } from "$lib/containers/cards"; | ||
import { Icon, Textbox } from "$lib/dusk/components"; | ||
import { walletStore } from "$lib/stores"; | ||
import { mdiAlertOutline, mdiCubeOutline } from "@mdi/js"; | ||
/** @type {number} */ | ||
export let blockHeight = 0; | ||
/** @type {boolean} */ | ||
export let isValid = false; | ||
/** @type {boolean} */ | ||
export let isToggled = false; | ||
$: currentNetworkBlock = 0; | ||
walletStore.getCurrentBlockHeight().then((block) => { | ||
currentNetworkBlock = block; | ||
}); | ||
$: isValid = | ||
!isToggled || (blockHeight >= 0 && blockHeight <= currentNetworkBlock); | ||
$: if (isToggled) { | ||
blockHeight = 0; | ||
} | ||
</script> | ||
|
||
<ToggleableCard bind:isToggled iconPath={mdiCubeOutline} heading="Block Height"> | ||
<Textbox type="number" bind:value={blockHeight} placeholder="Block Height" /> | ||
</ToggleableCard> | ||
|
||
<div class="notice"> | ||
<Icon path={mdiAlertOutline} size="large" /> | ||
<p> | ||
Syncing from a custom block height is optional. Doing so can significantly | ||
reduce sync times. However, setting a wrong block can lead to wrong balance | ||
or missing transactions. Find out more in our <AppAnchor | ||
href="#" | ||
rel="noopener noreferrer" | ||
target="_blank">documentation</AppAnchor | ||
>. | ||
</p> | ||
</div> |