Clean up app strucutre deleting blockchain file and add methods on blockchain folder

Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
RcleydsonR
2023-01-17 19:31:25 -03:00
parent d78f7f1fdf
commit 8338064dcd
7 changed files with 155 additions and 304 deletions

View File

@@ -2,7 +2,6 @@
import SearchComponent from "../components/SearchComponent.vue";
import ValidationComponent from "../components/LoadingComponent.vue";
import BuyConfirmedComponent from "@/components/BuyConfirmedComponent.vue";
import blockchain from "../utils/blockchain";
import { ref, onMounted } from "vue";
import { useEtherStore } from "@/store/ether";
@@ -11,6 +10,8 @@ import { storeToRefs } from "pinia";
import { addLock, releaseLock } from "@/blockchain/buyerMethods";
import { updateWalletStatus } from "@/blockchain/wallet";
import { getNetworksLiquidity } from "@/blockchain/events";
import { listReleaseTransactionByWalletAddress } from "@/blockchain/wallet"
enum Step {
Search,
Buy,
@@ -74,8 +75,7 @@ const releaseTransaction = async ({ e2eId }: any) => {
);
release.wait();
await blockchain
.listReleaseTransactionByWalletAddress(walletAddress.value.toLowerCase())
await listReleaseTransactionByWalletAddress(walletAddress.value.toLowerCase())
.then((releaseTransactions) => {
if (releaseTransactions)
lastWalletReleaseTransactions.value = releaseTransactions;

View File

@@ -1,11 +1,11 @@
<script setup lang="ts">
import { useEtherStore } from "@/store/ether";
import { storeToRefs } from "pinia";
import blockchain from "../utils/blockchain";
import ListingComponent from "@/components/ListingComponent.vue";
import type { BigNumber } from "ethers";
import { ref, watch } from "vue";
import { cancelDeposit, withdrawDeposit } from "@/blockchain/buyerMethods";
import { listValidDepositTransactionsByWalletAddress } from "@/blockchain/wallet"
const etherStore = useEtherStore();
@@ -14,7 +14,7 @@ const depositList = ref<any[]>([]);
if (walletAddress.value) {
const walletDeposits =
await blockchain.listValidDepositTransactionsByWalletAddress(
await listValidDepositTransactionsByWalletAddress(
walletAddress.value
);
if (walletDeposits) {
@@ -40,7 +40,7 @@ const handleWithDrawDeposit = async (depositID: BigNumber, index: number) => {
watch(walletAddress, async () => {
const walletDeposits =
await blockchain.listValidDepositTransactionsByWalletAddress(
await listValidDepositTransactionsByWalletAddress(
walletAddress.value
);
if (walletDeposits) {

View File

@@ -3,22 +3,21 @@ import { useEtherStore } from "@/store/ether";
import { storeToRefs } from "pinia";
import { ref, watch } from "vue";
import ListingComponent from "@/components/ListingComponent.vue";
import blockchain from "../utils/blockchain";
import { listAllTransactionByWalletAddress } from "@/blockchain/wallet";
const etherStore = useEtherStore();
const { walletAddress } = storeToRefs(etherStore);
const allUserTransactions = ref<any[]>([]);
if (walletAddress.value) {
await blockchain
.listAllTransactionByWalletAddress(walletAddress.value)
await listAllTransactionByWalletAddress(walletAddress.value)
.then((res) => {
if (res) allUserTransactions.value = res;
});
}
watch(walletAddress, async (newValue) => {
await blockchain.listAllTransactionByWalletAddress(newValue).then((res) => {
await listAllTransactionByWalletAddress(newValue).then((res) => {
if (res) allUserTransactions.value = res;
});
});