fix lint errors
Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
parent
d5467286b0
commit
15e5fed07b
@ -5,7 +5,7 @@ import TopBar from "./components/TopBar.vue";
|
||||
<template>
|
||||
<TopBar />
|
||||
|
||||
<RouterView/>
|
||||
<RouterView />
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -11,7 +11,7 @@ const connectMetaMask = () => {
|
||||
ethers.connectProvider();
|
||||
};
|
||||
|
||||
const formatWalletAddress = (): string => {
|
||||
const formatWalletAddress = (): string => {
|
||||
const walletAddressLength = walletAddress.value.length;
|
||||
const initialText = walletAddress.value.substring(0, 5);
|
||||
const finalText = walletAddress.value.substring(
|
||||
@ -39,12 +39,7 @@ const formatWalletBalance = (): string => {
|
||||
height="75"
|
||||
/>
|
||||
<div class="flex gap-4 items-center">
|
||||
<button
|
||||
type="button"
|
||||
class="default-button"
|
||||
>
|
||||
Quero vender
|
||||
</button>
|
||||
<button type="button" class="default-button">Quero vender</button>
|
||||
<button
|
||||
type="button"
|
||||
v-if="!walletAddress"
|
||||
@ -55,31 +50,19 @@ const formatWalletBalance = (): string => {
|
||||
</button>
|
||||
<div v-if="walletAddress" class="account-info">
|
||||
<div class="top-bar-info">
|
||||
<img
|
||||
alt="Ethereum image"
|
||||
src="@/assets/ethereum.svg"
|
||||
/>
|
||||
<span class="default-text">
|
||||
Ethereum
|
||||
</span>
|
||||
<img
|
||||
alt="Chevron Down"
|
||||
src="@/assets/chevronDown.svg"
|
||||
/>
|
||||
<img alt="Ethereum image" src="@/assets/ethereum.svg" />
|
||||
<span class="default-text"> Ethereum </span>
|
||||
<img alt="Chevron Down" src="@/assets/chevronDown.svg" />
|
||||
</div>
|
||||
<div class="top-bar-info">
|
||||
<img
|
||||
alt="Account image"
|
||||
src="@/assets/account.svg"
|
||||
/>
|
||||
<img alt="Account image" src="@/assets/account.svg" />
|
||||
<span class="default-text text-sm">{{ formatWalletAddress() }}</span>
|
||||
<img
|
||||
alt="Chevron Down"
|
||||
src="@/assets/chevronDown.svg"
|
||||
/>
|
||||
<img alt="Chevron Down" src="@/assets/chevronDown.svg" />
|
||||
</div>
|
||||
<div class="top-bar-info">
|
||||
<span class="default-text text-sm"> MBRZ: {{ formatWalletBalance() }} </span>
|
||||
<div class="top-bar-info">
|
||||
<span class="default-text text-sm">
|
||||
MBRZ: {{ formatWalletBalance() }}
|
||||
</span>
|
||||
</div>
|
||||
<!-- Temporary div, just to show a wallet's balance -->
|
||||
</div>
|
||||
@ -92,18 +75,18 @@ header {
|
||||
@apply flex flex-row justify-between w-full items-center;
|
||||
}
|
||||
|
||||
.default-button{
|
||||
@apply px-4 py-2 rounded text-gray-50 font-semibold text-base
|
||||
.default-button {
|
||||
@apply px-4 py-2 rounded text-gray-50 font-semibold text-base;
|
||||
}
|
||||
.account-info{
|
||||
@apply flex items-center gap-6
|
||||
.account-info {
|
||||
@apply flex items-center gap-6;
|
||||
}
|
||||
|
||||
.default-text{
|
||||
@apply text-gray-50 font-semibold text-base
|
||||
.default-text {
|
||||
@apply text-gray-50 font-semibold text-base;
|
||||
}
|
||||
|
||||
.top-bar-info{
|
||||
@apply flex justify-between gap-2 px-4 py-2 border-amber-500 border-2 rounded
|
||||
.top-bar-info {
|
||||
@apply flex justify-between gap-2 px-4 py-2 border-amber-500 border-2 rounded;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,11 +1,11 @@
|
||||
export type Pix = {
|
||||
pixKey: string;
|
||||
merchantCity?: string;
|
||||
merchantName?: string;
|
||||
value?: number;
|
||||
transactionId?: string;
|
||||
message?: string;
|
||||
cep?: string;
|
||||
currency?: number;
|
||||
countryCode?: string;
|
||||
};
|
||||
pixKey: string;
|
||||
merchantCity?: string;
|
||||
merchantName?: string;
|
||||
value?: number;
|
||||
transactionId?: string;
|
||||
message?: string;
|
||||
cep?: string;
|
||||
currency?: number;
|
||||
countryCode?: string;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import qrcode from "qrcode";
|
||||
import type { QRCodeToDataURLOptions } from "qrcode";
|
||||
import { crc16ccitt } from "crc";
|
||||
import {type Pix } from "@/model/Pix";
|
||||
import { type Pix } from "@/model/Pix";
|
||||
|
||||
const pix = ({
|
||||
pixKey,
|
||||
|
@ -2,16 +2,15 @@ import { useEtherStore } from "@/store/ether";
|
||||
import { ethers } from "ethers";
|
||||
|
||||
// smart contract imports
|
||||
import mockToken from "./smart_contract_files/MockToken.json"
|
||||
import p2pix from "./smart_contract_files/P2PIX.json"
|
||||
import addresses from "./smart_contract_files/localhost.json"
|
||||
|
||||
import mockToken from "./smart_contract_files/MockToken.json";
|
||||
//import p2pix from "./smart_contract_files/P2PIX.json";
|
||||
import addresses from "./smart_contract_files/localhost.json";
|
||||
|
||||
const updateWalletStatus = async (walletAddress: string) => {
|
||||
const etherStore = useEtherStore();
|
||||
const provider = getProvider();
|
||||
if(!provider) return;
|
||||
|
||||
if (!provider) return;
|
||||
|
||||
const signer = provider.getSigner();
|
||||
const contract = new ethers.Contract(addresses.token, mockToken.abi, signer);
|
||||
|
||||
@ -46,14 +45,17 @@ const connectProvider = async () => {
|
||||
const makeTransaction = async () => {
|
||||
const etherStore = useEtherStore();
|
||||
const provider = getProvider();
|
||||
if(!provider) return;
|
||||
if (!provider) return;
|
||||
|
||||
const signer = provider.getSigner();
|
||||
const contract = new ethers.Contract(addresses.token, mockToken.abi, signer);
|
||||
|
||||
const fixedAccount1Address = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||
const tx = await contract.transfer(fixedAccount1Address, ethers.utils.parseEther("100.0"));
|
||||
await tx.wait()
|
||||
const fixedAccount1Address = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8";
|
||||
const tx = await contract.transfer(
|
||||
fixedAccount1Address,
|
||||
ethers.utils.parseEther("100.0")
|
||||
);
|
||||
await tx.wait();
|
||||
|
||||
updateWalletStatus(etherStore.walletAddress);
|
||||
};
|
||||
@ -70,6 +72,6 @@ const getProvider = (): ethers.providers.Web3Provider | null => {
|
||||
if (!connection) return null;
|
||||
|
||||
return new ethers.providers.Web3Provider(connection);
|
||||
}
|
||||
};
|
||||
|
||||
export default { connectProvider, formatEther, makeTransaction };
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<h2 v-bind:hidden="true">Home View</h2>
|
||||
</template>
|
||||
|
@ -88,7 +88,9 @@ const submit = () => {
|
||||
</div>
|
||||
<div class="col-div">
|
||||
<div class="mb-2">
|
||||
<label for="city" class="form-label">Cidade do beneficiário</label>
|
||||
<label for="city" class="form-label"
|
||||
>Cidade do beneficiário</label
|
||||
>
|
||||
<span v-if="errors['cityRequiredError']" class="required-error"
|
||||
>(Esse campo é obrigatório)</span
|
||||
>
|
||||
@ -167,9 +169,7 @@ const submit = () => {
|
||||
>
|
||||
<span class="text-gray-700">{{ pixModel.value }}</span>
|
||||
</div>
|
||||
<div
|
||||
class="flex flex-col w-auto break-all justify-center items-center"
|
||||
>
|
||||
<div class="flex flex-col w-auto break-all justify-center items-center">
|
||||
<span class="text-black font-semibold mb-2">Código QR Code:</span>
|
||||
<span class="text-gray-700">{{ qrCodePayload }}</span>
|
||||
</div>
|
||||
@ -179,10 +179,7 @@ const submit = () => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="toggleModal"
|
||||
class="fixed z-40 inset-0 opacity-25 bg-black"
|
||||
></div>
|
||||
<div v-if="toggleModal" class="fixed z-40 inset-0 opacity-25 bg-black"></div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@ -190,9 +187,9 @@ const submit = () => {
|
||||
@apply mt-8 w-full flex justify-center self-center;
|
||||
}
|
||||
|
||||
.form-container{
|
||||
.form-container {
|
||||
background-color: var(--color-background-indigo);
|
||||
@apply rounded-md w-full p-2 w-1/2
|
||||
@apply rounded-md w-full p-2 w-1/2;
|
||||
}
|
||||
|
||||
.col-div {
|
||||
|
Loading…
x
Reference in New Issue
Block a user