diff --git a/package.json b/package.json
index 7c2f06f..d5f105e 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,7 @@
"lint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
+ "@floating-ui/vue": "^0.2.1",
"@headlessui/vue": "^1.7.3",
"@heroicons/vue": "^2.0.12",
"@vueuse/core": "^9.12.0",
diff --git a/src/App.vue b/src/App.vue
index 176d6a0..28dfc5b 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,5 +1,6 @@
@@ -8,6 +9,11 @@ import TopBar from "@/components/TopBar/TopBar.vue";
+
+
+
+
+
diff --git a/src/assets/info.svg b/src/assets/info.svg
new file mode 100644
index 0000000..0f60765
--- /dev/null
+++ b/src/assets/info.svg
@@ -0,0 +1,5 @@
+
diff --git a/src/blockchain/wallet.ts b/src/blockchain/wallet.ts
index 15271d8..51146ce 100644
--- a/src/blockchain/wallet.ts
+++ b/src/blockchain/wallet.ts
@@ -155,6 +155,22 @@ const listLockTransactionByWalletAddress = async (
});
};
+const listLockTransactionBySellerAddress = async (
+ sellerAddress: string
+): Promise => {
+ const p2pContract = getContract(true);
+
+ const filterAddedLocks = p2pContract.filters.LockAdded();
+ const eventsReleasedLocks = await p2pContract.queryFilter(filterAddedLocks);
+
+ return eventsReleasedLocks.filter((lock) =>
+ lock.args?.seller
+ .toHexString()
+ .substring(3)
+ .includes(sellerAddress.substring(2).toLowerCase())
+ );
+};
+
const checkUnreleasedLock = async (
walletAddress: string
): Promise => {
@@ -187,10 +203,37 @@ const checkUnreleasedLock = async (
}
};
+const getActiveLockAmount = async (walletAddress: string): Promise => {
+ const p2pContract = getContract();
+ const lockSeller = await listLockTransactionBySellerAddress(walletAddress);
+
+ const lockStatus = await p2pContract.getLocksStatus(
+ lockSeller.map((lock) => lock.args?.lockID)
+ );
+
+ const activeLockAmount = await lockStatus[1].reduce(
+ async (sumValue: Promise, currentStatus: number, index: number) => {
+ const currValue = await sumValue;
+ let valueToSum = 0;
+
+ if (currentStatus == 1) {
+ const lock = await p2pContract.mapLocks(lockStatus[0][index]);
+ valueToSum = Number(formatEther(lock?.amount));
+ }
+
+ return currValue + valueToSum;
+ },
+ Promise.resolve(0)
+ );
+
+ return activeLockAmount;
+};
+
export {
updateWalletStatus,
listValidDepositTransactionsByWalletAddress,
listAllTransactionByWalletAddress,
listReleaseTransactionByWalletAddress,
checkUnreleasedLock,
+ getActiveLockAmount,
};
diff --git a/src/components/BuyConfirmedComponent/BuyConfirmedComponent.vue b/src/components/BuyConfirmedComponent/BuyConfirmedComponent.vue
index db63dff..92ec39c 100644
--- a/src/components/BuyConfirmedComponent/BuyConfirmedComponent.vue
+++ b/src/components/BuyConfirmedComponent/BuyConfirmedComponent.vue
@@ -1,13 +1,81 @@
@@ -33,10 +101,7 @@ const emit = defineEmits(["makeAnotherTransaction"]);
cadastrar o BRZ em sua carteira.
- {}"
- />
+ {}" />