Add typing on views layer

Co-authored-by: geovanne97 <geovannessaraiva97@gmail.com>
This commit is contained in:
RcleydsonR
2023-01-18 23:12:40 -03:00
parent f87434debe
commit 846fa82f04
9 changed files with 47 additions and 38 deletions

View File

@@ -11,6 +11,8 @@ import { addLock, releaseLock } from "@/blockchain/buyerMethods";
import { updateWalletStatus } from "@/blockchain/wallet";
import { getNetworksLiquidity } from "@/blockchain/events";
import { listReleaseTransactionByWalletAddress } from "@/blockchain/wallet";
import type { Event } from "ethers";
import type { ValidDeposit } from "@/model/ValidDeposit";
enum Step {
Search,
@@ -28,10 +30,13 @@ const pixTarget = ref<string>("");
const tokenAmount = ref<number>();
const lockTransactionHash = ref<string>("");
const lockId = ref<string>("");
const loadingRelease = ref<Boolean>(false);
const lastWalletReleaseTransactions = ref<any[]>([]);
const loadingRelease = ref<boolean>(false);
const lastWalletReleaseTransactions = ref<Event[]>([]);
const confirmBuyClick = async (selectedDeposit: any, tokenValue: number) => {
const confirmBuyClick = async (
selectedDeposit: ValidDeposit,
tokenValue: number
) => {
// finish buy screen
pixTarget.value = selectedDeposit.pixKey;
tokenAmount.value = tokenValue;
@@ -54,13 +59,13 @@ const confirmBuyClick = async (selectedDeposit: any, tokenValue: number) => {
}
};
const releaseTransaction = async ({ e2eId }: any) => {
const releaseTransaction = async (e2eId: string) => {
flowStep.value = Step.List;
loadingRelease.value = true;
const findLock = locksAddedList.value.find((element) => {
if (element.transactionHash === lockTransactionHash.value) {
lockId.value = element.args.lockID;
lockId.value = element.args?.lockID;
return true;
}
return false;

View File

@@ -2,15 +2,16 @@
import { useEtherStore } from "@/store/ether";
import { storeToRefs } from "pinia";
import ListingComponent from "@/components/ListingComponent.vue";
import type { BigNumber } from "ethers";
import type { BigNumber, Event } from "ethers";
import { ref, watch } from "vue";
import { cancelDeposit, withdrawDeposit } from "@/blockchain/buyerMethods";
import { listValidDepositTransactionsByWalletAddress } from "@/blockchain/wallet";
import type { ValidDeposit } from "@/model/ValidDeposit";
const etherStore = useEtherStore();
const { walletAddress } = storeToRefs(etherStore);
const depositList = ref<any[]>([]);
const depositList = ref<ValidDeposit[]>([]);
if (walletAddress.value) {
const walletDeposits = await listValidDepositTransactionsByWalletAddress(

View File

@@ -23,11 +23,11 @@ const offerValue = ref<number>();
const pixKeyBuyer = ref<string>("");
// Verificar tipagem
const approveOffer = async ({ offer, pixKey }: any) => {
const approveOffer = async (args: { offer: number; pixKey: string }) => {
loading.value = true;
try {
offerValue.value = offer;
pixKeyBuyer.value = pixKey;
offerValue.value = args.offer;
pixKeyBuyer.value = args.pixKey;
await approveTokens(String(offerValue.value));
flowStep.value = Step.Network;
loading.value = false;

View File

@@ -4,10 +4,12 @@ import { storeToRefs } from "pinia";
import { ref, watch } from "vue";
import ListingComponent from "@/components/ListingComponent.vue";
import { listAllTransactionByWalletAddress } from "@/blockchain/wallet";
import type { Event } from "ethers";
import type { ValidDeposit } from "@/model/ValidDeposit";
const etherStore = useEtherStore();
const { walletAddress } = storeToRefs(etherStore);
const allUserTransactions = ref<any[]>([]);
const allUserTransactions = ref<(Event | ValidDeposit)[]>([]);
if (walletAddress.value) {
await listAllTransactionByWalletAddress(walletAddress.value).then((res) => {