Refactor methods from blockchain to use new code structure

Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
RcleydsonR
2023-01-13 19:35:17 -03:00
parent f40db935d3
commit 6fd2120b63
11 changed files with 186 additions and 171 deletions

View File

@@ -8,6 +8,8 @@ import { ref } from "vue";
import { useEtherStore } from "@/store/ether";
import QrCodeComponent from "../components/QrCodeComponent.vue";
import { storeToRefs } from "pinia";
import { addLock, releaseLock } from "@/blockchain/methods";
import { updateWalletStatus } from "@/blockchain/wallet";
enum Step {
Search,
@@ -40,10 +42,9 @@ const confirmBuyClick = async ({ selectedDeposit, tokenValue }: any) => {
flowStep.value = Step.Buy;
etherStore.setLoadingLock(true);
await blockchain
.addLock(depositId, tokenValue)
await addLock(depositId, tokenValue)
.then((lock) => {
lockTransactionHash.value = lock.hash;
lockTransactionHash.value = lock.transactionHash;
})
.catch(() => {
flowStep.value = Step.Search;
@@ -66,7 +67,7 @@ const releaseTransaction = async ({ e2eId }: any) => {
});
if (findLock && tokenAmount.value) {
const release = await blockchain.releaseLock(
const release = await releaseLock(
pixTarget.value,
tokenAmount.value,
e2eId,
@@ -81,7 +82,7 @@ const releaseTransaction = async ({ e2eId }: any) => {
lastWalletReleaseTransactions.value = releaseTransactions;
});
await blockchain.updateWalletStatus();
await updateWalletStatus();
loadingRelease.value = false;
}
};