From 1051128bee57fe2ee39eca642b9dde143e177900 Mon Sep 17 00:00:00 2001 From: Norton Andreev Date: Mon, 16 Dec 2024 14:45:25 +0200 Subject: [PATCH] web-wallet: Add Migration Successful Step Resolves #3180 --- .../ExecuteMigration/ExecuteMigration.svelte | 38 +++++++++---------- .../MigrateContract/MigrateContract.svelte | 35 +++++++++++++---- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/web-wallet/src/lib/components/ExecuteMigration/ExecuteMigration.svelte b/web-wallet/src/lib/components/ExecuteMigration/ExecuteMigration.svelte index 442bf43a3..dbf5a1249 100644 --- a/web-wallet/src/lib/components/ExecuteMigration/ExecuteMigration.svelte +++ b/web-wallet/src/lib/components/ExecuteMigration/ExecuteMigration.svelte @@ -8,11 +8,12 @@ } from "@mdi/js"; import { waitForTransactionReceipt } from "@wagmi/core"; import { isHex } from "viem"; - import { AppAnchor } from "$lib/components"; + import { AppAnchor, Banner } from "$lib/components"; import { Button, Icon } from "$lib/dusk/components"; import { account, wagmiConfig } from "$lib/migration/walletConnection"; import { migrate } from "$lib/migration/migration"; import { createDataStore } from "$lib/dusk/svelte-stores"; + import { createEventDispatcher } from "svelte"; /** @type {bigint} */ export let amount; @@ -23,6 +24,8 @@ /** @type {HexString} */ export let migrationContract; + const dispatch = createEventDispatcher(); + /** @type {string} */ let migrationHash = ""; @@ -37,10 +40,15 @@ if (isHex(txHash)) { migrationHash = txHash; - return waitForTransactionReceipt(wagmiConfig, { + const result = await waitForTransactionReceipt(wagmiConfig, { confirmations: 10, hash: txHash, }); + if (result.status === "success") { + dispatch("incrementStep"); + } else { + throw new Error("Could not validate the transaction receipt"); + } } else { throw new Error("txHash is not a hex string"); } @@ -66,19 +74,19 @@ {/if} {#if migrationHash && chain?.blockExplorers}
- + Migration has been submitted
-
- Migration takes some minutes to complete. Your transaction is being - executed and you can check it +

+ Migration takes some minutes to complete. Your transaction is being + executed and you can check its status here. -

+ >. +

+ {/if} {#if (isLoading || !data || error) && !migrationHash}