-
+
{{ getRemaining() }} BRZ
-
+
+
{{
+ activeLockAmount != 0 ? `com ${activeLockAmount} BRZ em lock` : ""
+ }}
+

+
diff --git a/src/components/ListingComponent/__tests__/ListingComponent.spec.ts b/src/components/ListingComponent/__tests__/ListingComponent.spec.ts
index 114530e..eba306d 100644
--- a/src/components/ListingComponent/__tests__/ListingComponent.spec.ts
+++ b/src/components/ListingComponent/__tests__/ListingComponent.spec.ts
@@ -17,6 +17,7 @@ describe("ListingComponent.vue", () => {
props: {
validDeposits: [],
walletTransactions: [],
+ activeLockAmount: 0,
},
});
@@ -28,6 +29,7 @@ describe("ListingComponent.vue", () => {
props: {
validDeposits: [],
walletTransactions: MockWalletTransactions,
+ activeLockAmount: 0,
},
});
@@ -41,6 +43,7 @@ describe("ListingComponent.vue", () => {
props: {
validDeposits: MockValidDeposits,
walletTransactions: MockWalletTransactions,
+ activeLockAmount: 0,
},
});
const btn = wrapper.find("button");
@@ -60,6 +63,7 @@ describe("ListingComponent.vue", () => {
props: {
validDeposits: MockValidDeposits,
walletTransactions: MockWalletTransactions,
+ activeLockAmount: 0,
},
});
wrapper.vm.$emit("depositWithdrawn");
@@ -68,4 +72,16 @@ describe("ListingComponent.vue", () => {
expect(wrapper.emitted("depositWithdrawn")).toBeTruthy();
});
+
+ test("Test should render lock info when active lock amount is greater than 0", () => {
+ const wrapper = mount(ListingComponent, {
+ props: {
+ validDeposits: MockValidDeposits,
+ walletTransactions: [],
+ activeLockAmount: 50,
+ },
+ });
+
+ expect(wrapper.html()).toContain("com 50 BRZ em lock");
+ });
});
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index 199fd68..b3b534f 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -18,6 +18,7 @@ import {
listAllTransactionByWalletAddress,
checkUnreleasedLock,
listValidDepositTransactionsByWalletAddress,
+ getActiveLockAmount,
} from "@/blockchain/wallet";
import { getNetworksLiquidity } from "@/blockchain/events";
import type { ValidDeposit } from "@/model/ValidDeposit";
@@ -42,6 +43,7 @@ const loadingRelease = ref(false);
const showModal = ref(false);
const lastWalletTransactions = ref([]);
const depositList = ref([]);
+const activeLockAmount = ref(0);
const confirmBuyClick = async (
selectedDeposit: ValidDeposit,
@@ -100,6 +102,8 @@ const getWalletTransactions = async () => {
walletAddress.value
);
+ activeLockAmount.value = await getActiveLockAmount(walletAddress.value);
+
if (walletDeposits) {
depositList.value = walletDeposits;
}
@@ -191,6 +195,7 @@ onMounted(async () => {
diff --git a/src/views/ManageBidsView.vue b/src/views/ManageBidsView.vue
index 94096c7..c02984f 100644
--- a/src/views/ManageBidsView.vue
+++ b/src/views/ManageBidsView.vue
@@ -7,6 +7,7 @@ import { ref, watch, onMounted } from "vue";
import {
listValidDepositTransactionsByWalletAddress,
listAllTransactionByWalletAddress,
+ getActiveLockAmount,
} from "@/blockchain/wallet";
import { withdrawDeposit } from "@/blockchain/buyerMethods";
import type { ValidDeposit } from "@/model/ValidDeposit";
@@ -21,6 +22,7 @@ const loadingWithdraw = ref(false);
const depositList = ref([]);
const transactionsList = ref([]);
+const activeLockAmount = ref(0);
const callWithdraw = async (amount: string) => {
if (amount) {
@@ -53,6 +55,8 @@ const getWalletTransactions = async () => {
walletAddress.value
);
+ activeLockAmount.value = await getActiveLockAmount(walletAddress.value);
+
if (walletDeposits) {
depositList.value = walletDeposits;
}
@@ -92,6 +96,7 @@ watch(networkName, async () => {
v-if="!loadingWithdraw && walletAddress"
:valid-deposits="depositList"
:wallet-transactions="transactionsList"
+ :active-lock-amount="activeLockAmount"
@deposit-withdrawn="callWithdraw"
>