From c0f388f46eddb1120476472dd03e51e1b48fa81a Mon Sep 17 00:00:00 2001 From: RcleydsonR Date: Thu, 16 Feb 2023 19:53:26 -0300 Subject: [PATCH] Add loading for listing component and add validation to show withdraw box only when a wallet has atleast one deposit --- src/blockchain/events.ts | 3 -- .../ListingComponent/ListingComponent.vue | 31 +++++++++-- .../__tests__/ListingComponent.spec.ts | 12 +++-- src/model/mock/WalletTransactionMock.ts | 54 +++++++++++++++++++ src/store/ether.ts | 4 ++ src/views/ManageBidsView.vue | 42 ++++----------- 6 files changed, 102 insertions(+), 44 deletions(-) create mode 100644 src/model/mock/WalletTransactionMock.ts diff --git a/src/blockchain/events.ts b/src/blockchain/events.ts index 59608f6..64c896b 100644 --- a/src/blockchain/events.ts +++ b/src/blockchain/events.ts @@ -10,7 +10,6 @@ import { NetworkEnum } from "@/model/NetworkEnum"; const getNetworksLiquidity = async (): Promise => { const etherStore = useEtherStore(); - console.log("Loading events"); const goerliProvider = new ethers.providers.JsonRpcProvider( import.meta.env.VITE_GOERLI_API_URL, @@ -43,10 +42,8 @@ const getNetworksLiquidity = async (): Promise => { ); etherStore.setDepositsValidListGoerli(depositListGoerli); - console.log(depositListGoerli); etherStore.setDepositsValidListMumbai(depositListMumbai); - console.log(depositListMumbai); }; const getValidDeposits = async ( diff --git a/src/components/ListingComponent/ListingComponent.vue b/src/components/ListingComponent/ListingComponent.vue index ce28390..afa4a4b 100644 --- a/src/components/ListingComponent/ListingComponent.vue +++ b/src/components/ListingComponent/ListingComponent.vue @@ -4,8 +4,11 @@ import { NetworkEnum } from "@/model/NetworkEnum"; import type { ValidDeposit } from "@/model/ValidDeposit"; import type { WalletTransaction } from "@/model/WalletTransaction"; import { useEtherStore } from "@/store/ether"; +import { storeToRefs } from "pinia"; import { ref, watch } from "vue"; +const etherStore = useEtherStore(); + // props const props = defineProps<{ validDeposits: ValidDeposit[]; @@ -14,8 +17,7 @@ const props = defineProps<{ const emit = defineEmits(["depositWithdrawn"]); -const etherStore = useEtherStore(); - +const { loadingWalletTransactions } = storeToRefs(etherStore); const itemsToShow = ref([]); const withdrawAmount = ref(""); const withdrawButtonOpacity = ref(0.6); @@ -108,8 +110,29 @@ showInitialItems();