refactor: standardize quote styles to single quotes across all files
This commit is contained in:
18
src/App.vue
18
src/App.vue
@@ -1,13 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from "vue-router";
|
||||
import TopBar from "@/components/TopBar/TopBar.vue";
|
||||
import SpinnerComponent from "@/components/ui/SpinnerComponent.vue";
|
||||
import ToasterComponent from "@/components/ui/ToasterComponent.vue";
|
||||
import VersionFooter from "@/components/ui/VersionFooter.vue";
|
||||
import { init, useOnboard } from "@web3-onboard/vue";
|
||||
import injectedModule from "@web3-onboard/injected-wallets";
|
||||
import { Networks, DEFAULT_NETWORK } from "@/config/networks";
|
||||
import { ref } from "vue";
|
||||
import { useRoute } from 'vue-router';
|
||||
import TopBar from '@/components/TopBar/TopBar.vue';
|
||||
import SpinnerComponent from '@/components/ui/SpinnerComponent.vue';
|
||||
import ToasterComponent from '@/components/ui/ToasterComponent.vue';
|
||||
import VersionFooter from '@/components/ui/VersionFooter.vue';
|
||||
import { init, useOnboard } from '@web3-onboard/vue';
|
||||
import injectedModule from '@web3-onboard/injected-wallets';
|
||||
import { Networks, DEFAULT_NETWORK } from '@/config/networks';
|
||||
import { ref } from 'vue';
|
||||
|
||||
const route = useRoute();
|
||||
const injected = injectedModule();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
import { getContract } from "./provider";
|
||||
import { ChainContract } from "viem";
|
||||
import { parseEther, type Address, type TransactionReceipt } from "viem";
|
||||
import { getContract } from './provider';
|
||||
import { ChainContract } from 'viem';
|
||||
import { parseEther, type Address, type TransactionReceipt } from 'viem';
|
||||
|
||||
export const addLock = async (
|
||||
sellerAddress: Address,
|
||||
@@ -11,13 +11,13 @@ export const addLock = async (
|
||||
const parsedAmount = parseEther(amount.toString());
|
||||
|
||||
if (!wallet) {
|
||||
throw new Error("Wallet not connected");
|
||||
throw new Error('Wallet not connected');
|
||||
}
|
||||
|
||||
const { result, request } = await client.simulateContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "lock",
|
||||
functionName: 'lock',
|
||||
args: [sellerAddress, tokenAddress, parsedAmount, [], []],
|
||||
account,
|
||||
});
|
||||
@@ -25,7 +25,7 @@ export const addLock = async (
|
||||
const receipt = await client.waitForTransactionReceipt({ hash });
|
||||
|
||||
if (!receipt.status)
|
||||
throw new Error("Transaction failed: " + receipt.transactionHash);
|
||||
throw new Error('Transaction failed: ' + receipt.transactionHash);
|
||||
|
||||
return result;
|
||||
};
|
||||
@@ -37,13 +37,13 @@ export const withdrawDeposit = async (
|
||||
const { address, abi, wallet, client, account } = await getContract();
|
||||
|
||||
if (!wallet) {
|
||||
throw new Error("Wallet not connected");
|
||||
throw new Error('Wallet not connected');
|
||||
}
|
||||
|
||||
const { request } = await client.simulateContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "withdraw",
|
||||
functionName: 'withdraw',
|
||||
args: [token, parseEther(amount), []],
|
||||
account,
|
||||
});
|
||||
@@ -51,7 +51,7 @@ export const withdrawDeposit = async (
|
||||
const hash = await wallet.writeContract(request);
|
||||
const receipt = await client.waitForTransactionReceipt({ hash });
|
||||
|
||||
return receipt.status === "success";
|
||||
return receipt.status === 'success';
|
||||
};
|
||||
|
||||
export const releaseLock = async (
|
||||
@@ -62,13 +62,13 @@ export const releaseLock = async (
|
||||
const { address, abi, wallet, client, account } = await getContract();
|
||||
|
||||
if (!wallet) {
|
||||
throw new Error("Wallet not connected");
|
||||
throw new Error('Wallet not connected');
|
||||
}
|
||||
|
||||
const { request } = await client.simulateContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "release",
|
||||
functionName: 'release',
|
||||
args: [BigInt(lockID), pixTimestamp, signature],
|
||||
account,
|
||||
});
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { formatEther, toHex, stringToHex } from "viem";
|
||||
import type { PublicClient, Address } from "viem";
|
||||
import { Networks } from "@/config/networks";
|
||||
import { getContract } from "./provider";
|
||||
import { p2PixAbi } from "./abi";
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import type { NetworkConfig } from "@/model/NetworkEnum";
|
||||
import type { UnreleasedLock } from "@/model/UnreleasedLock";
|
||||
import { ChainContract } from "viem";
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import { formatEther, toHex, stringToHex } from 'viem';
|
||||
import type { PublicClient, Address } from 'viem';
|
||||
import { Networks } from '@/config/networks';
|
||||
import { getContract } from './provider';
|
||||
import { p2PixAbi } from './abi';
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import type { NetworkConfig } from '@/model/NetworkEnum';
|
||||
import type { UnreleasedLock } from '@/model/UnreleasedLock';
|
||||
import { ChainContract } from 'viem';
|
||||
|
||||
const getNetworksLiquidity = async (): Promise<void> => {
|
||||
const user = useUser();
|
||||
@@ -37,16 +37,16 @@ const getParticipantID = async (
|
||||
const participantIDHex = await client.readContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "getPixTarget",
|
||||
functionName: 'getPixTarget',
|
||||
args: [seller, token],
|
||||
});
|
||||
|
||||
// Remove '0x' prefix and convert hex to UTF-8 string
|
||||
const hexString =
|
||||
typeof participantIDHex === "string"
|
||||
typeof participantIDHex === 'string'
|
||||
? participantIDHex
|
||||
: toHex(participantIDHex as bigint);
|
||||
if (!hexString) throw new Error("Participant ID not found");
|
||||
if (!hexString) throw new Error('Participant ID not found');
|
||||
const bytes = new Uint8Array(
|
||||
hexString
|
||||
.slice(2)
|
||||
@@ -54,7 +54,7 @@ const getParticipantID = async (
|
||||
.map((byte: string) => parseInt(byte, 16)),
|
||||
);
|
||||
// Remove null bytes from the end of the string
|
||||
return new TextDecoder().decode(bytes).replace(/\0/g, "");
|
||||
return new TextDecoder().decode(bytes).replace(/\0/g, '');
|
||||
};
|
||||
|
||||
const getValidDeposits = async (
|
||||
@@ -85,9 +85,9 @@ const getValidDeposits = async (
|
||||
};
|
||||
|
||||
const depositLogs = await fetch(network.subgraphUrls[0], {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
@@ -95,7 +95,7 @@ const getValidDeposits = async (
|
||||
// remove doubles from sellers list
|
||||
const depositData = await depositLogs.json();
|
||||
if (!depositData.data) {
|
||||
console.error("Error fetching deposit logs");
|
||||
console.error('Error fetching deposit logs');
|
||||
return [];
|
||||
}
|
||||
const depositAddeds = depositData.data.depositAddeds;
|
||||
@@ -119,7 +119,7 @@ const getValidDeposits = async (
|
||||
const balanceCalls = sellersList.map((seller) => ({
|
||||
address: (network.contracts?.p2pix as ChainContract).address,
|
||||
abi,
|
||||
functionName: "getBalance",
|
||||
functionName: 'getBalance',
|
||||
args: [seller, token],
|
||||
}));
|
||||
|
||||
@@ -138,7 +138,7 @@ const getValidDeposits = async (
|
||||
remaining: Number(formatEther(mappedBalance.result as bigint)),
|
||||
seller,
|
||||
network,
|
||||
participantID: "",
|
||||
participantID: '',
|
||||
};
|
||||
depositList[seller + token] = validDeposit;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ const getUnreleasedLockById = async (
|
||||
const [, , , amount, token, seller] = await client.readContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "mapLocks",
|
||||
functionName: 'mapLocks',
|
||||
args: [lockID],
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { p2PixAbi } from "./abi";
|
||||
import { updateWalletStatus } from "./wallet";
|
||||
import { p2PixAbi } from './abi';
|
||||
import { updateWalletStatus } from './wallet';
|
||||
import {
|
||||
createPublicClient,
|
||||
createWalletClient,
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
http,
|
||||
PublicClient,
|
||||
WalletClient,
|
||||
} from "viem";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import type { NetworkConfig } from "@/model/NetworkEnum";
|
||||
import type { ChainContract } from "viem";
|
||||
} from 'viem';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import type { NetworkConfig } from '@/model/NetworkEnum';
|
||||
import type { ChainContract } from 'viem';
|
||||
|
||||
let walletClient: WalletClient | null = null;
|
||||
|
||||
@@ -38,7 +38,7 @@ const getContract = async (onlyRpcProvider = false) => {
|
||||
const wallet = onlyRpcProvider ? null : getWalletClient();
|
||||
|
||||
if (!client) {
|
||||
throw new Error("Public client not initialized");
|
||||
throw new Error('Public client not initialized');
|
||||
}
|
||||
|
||||
const [account] = wallet ? await wallet.getAddresses() : [null];
|
||||
@@ -50,7 +50,7 @@ const connectProvider = async (p: any): Promise<void> => {
|
||||
const user = useUser();
|
||||
const chain = user.network.value;
|
||||
|
||||
const [account] = await p!.request({ method: "eth_requestAccounts" });
|
||||
const [account] = await p!.request({ method: 'eth_requestAccounts' });
|
||||
|
||||
walletClient = createWalletClient({
|
||||
account,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { getContract, getPublicClient, getWalletClient } from "./provider";
|
||||
import { parseEther, toHex, ChainContract } from "viem";
|
||||
import { mockTokenAbi } from "./abi";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { createParticipant } from "@/utils/bbPay";
|
||||
import type { Participant } from "@/utils/bbPay";
|
||||
import type { Address } from "viem";
|
||||
import { getContract, getPublicClient, getWalletClient } from './provider';
|
||||
import { parseEther, toHex, ChainContract } from 'viem';
|
||||
import { mockTokenAbi } from './abi';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import { createParticipant } from '@/utils/bbPay';
|
||||
import type { Participant } from '@/utils/bbPay';
|
||||
import type { Address } from 'viem';
|
||||
|
||||
const getP2PixAddress = (): Address => {
|
||||
const user = useUser();
|
||||
@@ -17,7 +17,7 @@ const approveTokens = async (participant: Participant): Promise<any> => {
|
||||
const walletClient = getWalletClient();
|
||||
|
||||
if (!publicClient || !walletClient) {
|
||||
throw new Error("Clients not initialized");
|
||||
throw new Error('Clients not initialized');
|
||||
}
|
||||
|
||||
user.setSeller(participant);
|
||||
@@ -31,7 +31,7 @@ const approveTokens = async (participant: Participant): Promise<any> => {
|
||||
const allowance = await publicClient.readContract({
|
||||
address: tokenAddress,
|
||||
abi: mockTokenAbi,
|
||||
functionName: "allowance",
|
||||
functionName: 'allowance',
|
||||
args: [account, getP2PixAddress()],
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ const approveTokens = async (participant: Participant): Promise<any> => {
|
||||
const hash = await walletClient.writeContract({
|
||||
address: tokenAddress,
|
||||
abi: mockTokenAbi,
|
||||
functionName: "approve",
|
||||
functionName: 'approve',
|
||||
args: [getP2PixAddress(), parseEther(participant.offer.toString())],
|
||||
account,
|
||||
chain,
|
||||
@@ -59,7 +59,7 @@ const addDeposit = async (): Promise<any> => {
|
||||
const user = useUser();
|
||||
|
||||
if (!walletClient) {
|
||||
throw new Error("Wallet client not initialized");
|
||||
throw new Error('Wallet client not initialized');
|
||||
}
|
||||
|
||||
const [account] = await walletClient.getAddresses();
|
||||
@@ -67,16 +67,16 @@ const addDeposit = async (): Promise<any> => {
|
||||
const sellerId = await createParticipant(user.seller.value);
|
||||
user.setSellerId(sellerId.id);
|
||||
if (!sellerId.id) {
|
||||
throw new Error("Failed to create participant");
|
||||
throw new Error('Failed to create participant');
|
||||
}
|
||||
const chain = user.network.value;
|
||||
const hash = await walletClient.writeContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "deposit",
|
||||
functionName: 'deposit',
|
||||
args: [
|
||||
user.network.value.id + "-" + sellerId.id,
|
||||
toHex("", { size: 32 }),
|
||||
user.network.value.id + '-' + sellerId.id,
|
||||
toHex('', { size: 32 }),
|
||||
user.network.value.tokens[user.selectedToken.value].address,
|
||||
parseEther(user.seller.value.offer.toString()),
|
||||
true,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { formatEther, type Address } from "viem";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { formatEther, type Address } from 'viem';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
|
||||
import { getPublicClient, getWalletClient, getContract } from "./provider";
|
||||
import { getPublicClient, getWalletClient, getContract } from './provider';
|
||||
|
||||
import { getValidDeposits, getUnreleasedLockById } from "./events";
|
||||
import { getValidDeposits, getUnreleasedLockById } from './events';
|
||||
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import type { WalletTransaction } from "@/model/WalletTransaction";
|
||||
import type { UnreleasedLock } from "@/model/UnreleasedLock";
|
||||
import { LockStatus } from "@/model/LockStatus";
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import type { WalletTransaction } from '@/model/WalletTransaction';
|
||||
import type { UnreleasedLock } from '@/model/UnreleasedLock';
|
||||
import { LockStatus } from '@/model/LockStatus';
|
||||
|
||||
export const updateWalletStatus = async (): Promise<void> => {
|
||||
const user = useUser();
|
||||
@@ -17,7 +17,7 @@ export const updateWalletStatus = async (): Promise<void> => {
|
||||
const walletClient = getWalletClient();
|
||||
|
||||
if (!publicClient || !walletClient) {
|
||||
console.error("Client not initialized");
|
||||
console.error('Client not initialized');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ const getLockStatus = async (id: bigint): Promise<LockStatus> => {
|
||||
const [sortedIDs, status] = await client.readContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "getLocksStatus",
|
||||
functionName: 'getLocksStatus',
|
||||
args: [[id]],
|
||||
});
|
||||
return status[0];
|
||||
@@ -109,9 +109,9 @@ export const listAllTransactionByWalletAddress = async (
|
||||
};
|
||||
|
||||
const response = await fetch(network.subgraphUrls[0], {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(subgraphQuery),
|
||||
});
|
||||
@@ -129,8 +129,8 @@ export const listAllTransactionByWalletAddress = async (
|
||||
blockTimestamp: parseInt(deposit.blockTimestamp),
|
||||
amount: parseFloat(formatEther(BigInt(deposit.amount))),
|
||||
seller: deposit.seller,
|
||||
buyer: "",
|
||||
event: "DepositAdded",
|
||||
buyer: '',
|
||||
event: 'DepositAdded',
|
||||
lockStatus: undefined,
|
||||
transactionHash: deposit.transactionHash,
|
||||
});
|
||||
@@ -150,7 +150,7 @@ export const listAllTransactionByWalletAddress = async (
|
||||
amount: parseFloat(formatEther(BigInt(lock.amount))),
|
||||
seller: lock.seller,
|
||||
buyer: lock.buyer,
|
||||
event: "LockAdded",
|
||||
event: 'LockAdded',
|
||||
lockStatus: lockStatus,
|
||||
transactionHash: lock.transactionHash,
|
||||
transactionID: lock.lockID.toString(),
|
||||
@@ -166,9 +166,9 @@ export const listAllTransactionByWalletAddress = async (
|
||||
blockNumber: parseInt(release.blockNumber),
|
||||
blockTimestamp: parseInt(release.blockTimestamp),
|
||||
amount: -1, // Amount not available in this event
|
||||
seller: "",
|
||||
seller: '',
|
||||
buyer: release.buyer,
|
||||
event: "LockReleased",
|
||||
event: 'LockReleased',
|
||||
lockStatus: undefined,
|
||||
transactionHash: release.transactionHash,
|
||||
transactionID: release.lockId.toString(),
|
||||
@@ -185,8 +185,8 @@ export const listAllTransactionByWalletAddress = async (
|
||||
blockTimestamp: parseInt(withdrawal.blockTimestamp),
|
||||
amount: parseFloat(formatEther(BigInt(withdrawal.amount))),
|
||||
seller: withdrawal.seller,
|
||||
buyer: "",
|
||||
event: "DepositWithdrawn",
|
||||
buyer: '',
|
||||
event: 'DepositWithdrawn',
|
||||
lockStatus: undefined,
|
||||
transactionHash: withdrawal.transactionHash,
|
||||
});
|
||||
@@ -222,9 +222,9 @@ export const listReleaseTransactionByWalletAddress = async (
|
||||
|
||||
// Fetch data from subgraph
|
||||
const response = await fetch(network.subgraphUrls[0], {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(subgraphQuery),
|
||||
});
|
||||
@@ -245,7 +245,7 @@ export const listReleaseTransactionByWalletAddress = async (
|
||||
try {
|
||||
// Create a structure similar to the decoded event log
|
||||
return {
|
||||
eventName: "LockReleased",
|
||||
eventName: 'LockReleased',
|
||||
args: {
|
||||
buyer: release.buyer,
|
||||
lockID: BigInt(release.lockId),
|
||||
@@ -256,7 +256,7 @@ export const listReleaseTransactionByWalletAddress = async (
|
||||
transactionHash: release.transactionHash,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error processing subgraph data", error);
|
||||
console.error('Error processing subgraph data', error);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
@@ -287,9 +287,9 @@ const listLockTransactionByWalletAddress = async (walletAddress: Address) => {
|
||||
try {
|
||||
// Fetch data from subgraph
|
||||
const response = await fetch(network.subgraphUrls[0], {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(subgraphQuery),
|
||||
});
|
||||
@@ -309,7 +309,7 @@ const listLockTransactionByWalletAddress = async (walletAddress: Address) => {
|
||||
try {
|
||||
// Create a structure similar to the decoded event log
|
||||
return {
|
||||
eventName: "LockAdded",
|
||||
eventName: 'LockAdded',
|
||||
args: {
|
||||
buyer: lock.buyer,
|
||||
lockID: BigInt(lock.lockID),
|
||||
@@ -322,13 +322,13 @@ const listLockTransactionByWalletAddress = async (walletAddress: Address) => {
|
||||
transactionHash: lock.transactionHash,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error processing subgraph data", error);
|
||||
console.error('Error processing subgraph data', error);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter((decoded: any) => decoded !== null);
|
||||
} catch (error) {
|
||||
console.error("Error fetching from subgraph:", error);
|
||||
console.error('Error fetching from subgraph:', error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -356,9 +356,9 @@ const listLockTransactionBySellerAddress = async (sellerAddress: Address) => {
|
||||
try {
|
||||
// Fetch data from subgraph
|
||||
const response = await fetch(network.subgraphUrls[0], {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(subgraphQuery),
|
||||
});
|
||||
@@ -378,7 +378,7 @@ const listLockTransactionBySellerAddress = async (sellerAddress: Address) => {
|
||||
try {
|
||||
// Create a structure similar to the decoded event log
|
||||
return {
|
||||
eventName: "LockAdded",
|
||||
eventName: 'LockAdded',
|
||||
args: {
|
||||
buyer: lock.buyer,
|
||||
lockID: BigInt(lock.lockID),
|
||||
@@ -391,13 +391,13 @@ const listLockTransactionBySellerAddress = async (sellerAddress: Address) => {
|
||||
transactionHash: lock.transactionHash,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error processing subgraph data", error);
|
||||
console.error('Error processing subgraph data', error);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter((decoded: any) => decoded !== null);
|
||||
} catch (error) {
|
||||
console.error("Error fetching from subgraph:", error);
|
||||
console.error('Error fetching from subgraph:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
@@ -415,7 +415,7 @@ export const checkUnreleasedLock = async (
|
||||
const [sortedIDs, status] = await client.readContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "getLocksStatus",
|
||||
functionName: 'getLocksStatus',
|
||||
args: [lockIds],
|
||||
});
|
||||
|
||||
@@ -440,7 +440,7 @@ export const getActiveLockAmount = async (
|
||||
const [sortedIDs, status] = await client.readContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "getLocksStatus",
|
||||
functionName: 'getLocksStatus',
|
||||
args: [lockIds],
|
||||
});
|
||||
|
||||
@@ -448,7 +448,7 @@ export const getActiveLockAmount = async (
|
||||
client.readContract({
|
||||
address: address,
|
||||
abi,
|
||||
functionName: "mapLocks",
|
||||
functionName: 'mapLocks',
|
||||
args: [BigInt(id)],
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { withdrawDeposit } from "@/blockchain/buyerMethods";
|
||||
import { withdrawDeposit } from '@/blockchain/buyerMethods';
|
||||
import {
|
||||
getActiveLockAmount,
|
||||
listAllTransactionByWalletAddress,
|
||||
listValidDepositTransactionsByWalletAddress,
|
||||
} from "@/blockchain/wallet";
|
||||
import CustomButton from "@/components/ui/CustomButton.vue";
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import type { WalletTransaction } from "@/model/WalletTransaction";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
import ListingComponent from "@/components/ListingComponent/ListingComponent.vue";
|
||||
} from '@/blockchain/wallet';
|
||||
import CustomButton from '@/components/ui/CustomButton.vue';
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import type { WalletTransaction } from '@/model/WalletTransaction';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import ListingComponent from '@/components/ListingComponent/ListingComponent.vue';
|
||||
|
||||
// props
|
||||
const props = defineProps<{
|
||||
@@ -58,17 +58,17 @@ const callWithdraw = async (amount: string) => {
|
||||
user.network.value.tokens[user.selectedToken.value].address,
|
||||
);
|
||||
if (withdraw) {
|
||||
console.log("Saque realizado!");
|
||||
console.log('Saque realizado!');
|
||||
await getWalletTransactions();
|
||||
} else {
|
||||
console.log("Não foi possível realizar o saque!");
|
||||
console.log('Não foi possível realizar o saque!');
|
||||
}
|
||||
user.setLoadingWalletTransactions(false);
|
||||
}
|
||||
};
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(["makeAnotherTransaction"]);
|
||||
const emit = defineEmits(['makeAnotherTransaction']);
|
||||
|
||||
// observer
|
||||
watch(props, async (): Promise<void> => {
|
||||
@@ -153,8 +153,8 @@ p {
|
||||
@apply font-medium text-base text-gray-900;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
input[type='number']::-webkit-inner-spin-button,
|
||||
input[type='number']::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed } from "vue";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import SpinnerComponent from "@/components/ui/SpinnerComponent.vue";
|
||||
import CustomButton from "@/components/ui/CustomButton.vue";
|
||||
import { debounce } from "@/utils/debounce";
|
||||
import { verifyNetworkLiquidity } from "@/utils/networkLiquidity";
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import { decimalCount } from "@/utils/decimalCount";
|
||||
import { getTokenImage, getNetworkImage } from "@/utils/imagesPath";
|
||||
import { onClickOutside } from "@vueuse/core";
|
||||
import { Networks } from "@/config/networks";
|
||||
import { TokenEnum } from "@/model/NetworkEnum";
|
||||
import { getContract } from "@/blockchain/provider";
|
||||
import { reputationAbi } from "@/blockchain/abi";
|
||||
import { type Address } from "viem";
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import SpinnerComponent from '@/components/ui/SpinnerComponent.vue';
|
||||
import CustomButton from '@/components/ui/CustomButton.vue';
|
||||
import { debounce } from '@/utils/debounce';
|
||||
import { verifyNetworkLiquidity } from '@/utils/networkLiquidity';
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import { decimalCount } from '@/utils/decimalCount';
|
||||
import { getTokenImage, getNetworkImage } from '@/utils/imagesPath';
|
||||
import { onClickOutside } from '@vueuse/core';
|
||||
import { Networks } from '@/config/networks';
|
||||
import { TokenEnum } from '@/model/NetworkEnum';
|
||||
import { getContract } from '@/blockchain/provider';
|
||||
import { reputationAbi } from '@/blockchain/abi';
|
||||
import { type Address } from 'viem';
|
||||
|
||||
// Store reference
|
||||
const user = useUser();
|
||||
@@ -35,17 +35,17 @@ const tokenValue = ref<number>(0);
|
||||
const enableConfirmButton = ref<boolean>(false);
|
||||
const hasLiquidity = ref<boolean>(true);
|
||||
const validDecimals = ref<boolean>(true);
|
||||
const identification = ref<string>("");
|
||||
const identification = ref<string>('');
|
||||
const selectedDeposits = ref<ValidDeposit[]>();
|
||||
const reputationLimit = ref<number | null>(null);
|
||||
const exceedsReputationLimit = ref<boolean>(false);
|
||||
|
||||
import ChevronDown from "@/assets/chevronDown.svg";
|
||||
import { useOnboard } from "@web3-onboard/vue";
|
||||
import { getParticipantID } from "@/blockchain/events";
|
||||
import ChevronDown from '@/assets/chevronDown.svg';
|
||||
import { useOnboard } from '@web3-onboard/vue';
|
||||
import { getParticipantID } from '@/blockchain/events';
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(["tokenBuy"]);
|
||||
const emit = defineEmits(['tokenBuy']);
|
||||
|
||||
const castAddrToKey = (address: Address): bigint => {
|
||||
return BigInt(address) << BigInt(12);
|
||||
@@ -59,13 +59,13 @@ const getUserCredit = async (userAddress: Address): Promise<bigint> => {
|
||||
const userCredit = await client.readContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "userRecord",
|
||||
functionName: 'userRecord',
|
||||
args: [userKey],
|
||||
});
|
||||
|
||||
return userCredit as bigint;
|
||||
} catch (error) {
|
||||
console.error("Error fetching user credit:", error);
|
||||
console.error('Error fetching user credit:', error);
|
||||
return BigInt(0);
|
||||
}
|
||||
};
|
||||
@@ -77,12 +77,12 @@ const getReputationAddress = async (): Promise<Address | null> => {
|
||||
const reputationAddr = await client.readContract({
|
||||
address,
|
||||
abi,
|
||||
functionName: "reputation",
|
||||
functionName: 'reputation',
|
||||
});
|
||||
|
||||
return reputationAddr as Address;
|
||||
} catch (error) {
|
||||
console.error("Error fetching reputation address:", error);
|
||||
console.error('Error fetching reputation address:', error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -97,13 +97,13 @@ const getSpendLimit = async (userCredit: bigint): Promise<bigint> => {
|
||||
const spendLimit = await client.readContract({
|
||||
address: reputationAddr,
|
||||
abi: reputationAbi,
|
||||
functionName: "limiter",
|
||||
functionName: 'limiter',
|
||||
args: [userCredit],
|
||||
});
|
||||
|
||||
return spendLimit as bigint;
|
||||
} catch (error) {
|
||||
console.error("Error fetching spend limit:", error);
|
||||
console.error('Error fetching spend limit:', error);
|
||||
return BigInt(0);
|
||||
}
|
||||
};
|
||||
@@ -130,7 +130,7 @@ const checkReputationLimit = async (inputValue: number): Promise<void> => {
|
||||
exceedsReputationLimit.value = spendLimitNumber < inputValue;
|
||||
enableConfirmButton.value = !exceedsReputationLimit.value;
|
||||
} catch (error) {
|
||||
console.error("Error checking reputation limit:", error);
|
||||
console.error('Error checking reputation limit:', error);
|
||||
reputationLimit.value = null;
|
||||
exceedsReputationLimit.value = false;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ const emitConfirmButton = async (): Promise<void> => {
|
||||
);
|
||||
if (!deposit) return;
|
||||
deposit.participantID = await getParticipantID(deposit.seller, deposit.token);
|
||||
emit("tokenBuy", deposit, tokenValue.value);
|
||||
emit('tokenBuy', deposit, tokenValue.value);
|
||||
};
|
||||
|
||||
// Debounce methods
|
||||
@@ -440,12 +440,12 @@ const handleSubmit = async (e: Event): Promise<void> => {
|
||||
@apply text-white text-center;
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
input[type='number']::-webkit-inner-spin-button,
|
||||
input[type='number']::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted } from "vue";
|
||||
import CustomButton from "@/components/ui/CustomButton.vue";
|
||||
import CustomModal from "@/components/ui/CustomModal.vue";
|
||||
import SpinnerComponent from "@/components/ui/SpinnerComponent.vue";
|
||||
import { createSolicitation, getSolicitation, type Offer } from "@/utils/bbPay";
|
||||
import { getParticipantID } from "@/blockchain/events";
|
||||
import { getUnreleasedLockById } from "@/blockchain/events";
|
||||
import QRCode from "qrcode";
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import CustomButton from '@/components/ui/CustomButton.vue';
|
||||
import CustomModal from '@/components/ui/CustomModal.vue';
|
||||
import SpinnerComponent from '@/components/ui/SpinnerComponent.vue';
|
||||
import { createSolicitation, getSolicitation, type Offer } from '@/utils/bbPay';
|
||||
import { getParticipantID } from '@/blockchain/events';
|
||||
import { getUnreleasedLockById } from '@/blockchain/events';
|
||||
import QRCode from 'qrcode';
|
||||
|
||||
// Props
|
||||
interface Props {
|
||||
@@ -15,11 +15,11 @@ interface Props {
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const qrCode = ref<string>("");
|
||||
const qrCodeSvg = ref<string>("");
|
||||
const qrCode = ref<string>('');
|
||||
const qrCodeSvg = ref<string>('');
|
||||
const showWarnModal = ref<boolean>(true);
|
||||
const pixTimestamp = ref<string>("");
|
||||
const releaseSignature = ref<string>("");
|
||||
const pixTimestamp = ref<string>('');
|
||||
const releaseSignature = ref<string>('');
|
||||
const solicitationData = ref<any>(null);
|
||||
const pollingInterval = ref<NodeJS.Timeout | null>(null);
|
||||
const copyFeedback = ref<boolean>(false);
|
||||
@@ -29,22 +29,22 @@ const copyFeedbackTimeout = ref<NodeJS.Timeout | null>(null);
|
||||
const generateQrCodeSvg = async (text: string) => {
|
||||
try {
|
||||
const svgString = await QRCode.toString(text, {
|
||||
type: "svg",
|
||||
type: 'svg',
|
||||
width: 192, // 48 * 4 for better quality
|
||||
margin: 2,
|
||||
color: {
|
||||
dark: "#000000",
|
||||
light: "#FFFFFF",
|
||||
dark: '#000000',
|
||||
light: '#FFFFFF',
|
||||
},
|
||||
});
|
||||
qrCodeSvg.value = svgString;
|
||||
} catch (error) {
|
||||
console.error("Error generating QR code SVG:", error);
|
||||
console.error('Error generating QR code SVG:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(["pixValidated"]);
|
||||
const emit = defineEmits(['pixValidated']);
|
||||
|
||||
// Function to check solicitation status
|
||||
const checkSolicitationStatus = async () => {
|
||||
@@ -67,7 +67,7 @@ const checkSolicitationStatus = async () => {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error checking solicitation status:", error);
|
||||
console.error('Error checking solicitation status:', error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const copyToClipboard = async () => {
|
||||
copyFeedback.value = false;
|
||||
}, 2000);
|
||||
} catch (error) {
|
||||
console.error("Error copying to clipboard:", error);
|
||||
console.error('Error copying to clipboard:', error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -130,7 +130,7 @@ onMounted(async () => {
|
||||
// Start polling for solicitation status
|
||||
startPolling();
|
||||
} catch (error) {
|
||||
console.error("Error creating solicitation:", error);
|
||||
console.error('Error creating solicitation:', error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -268,13 +268,13 @@ h2 {
|
||||
@apply flex flex-col justify-center items-center px-8 py-6 gap-2 rounded-lg shadow-md shadow-gray-600 backdrop-blur-md mt-6 max-w-screen-sm;
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
input[type='number'] {
|
||||
appearance: textfield;
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
input[type='number']::-webkit-inner-spin-button,
|
||||
input[type='number']::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ interface Props {
|
||||
title: string;
|
||||
value: string;
|
||||
change?: string;
|
||||
changeType?: "positive" | "negative" | "neutral";
|
||||
changeType?: 'positive' | 'negative' | 'neutral';
|
||||
icon?: string;
|
||||
loading?: boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
changeType: "neutral",
|
||||
changeType: 'neutral',
|
||||
loading: false,
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { ref } from 'vue';
|
||||
|
||||
interface Transaction {
|
||||
id: string;
|
||||
type: "deposit" | "lock" | "release" | "return";
|
||||
type: 'deposit' | 'lock' | 'release' | 'return';
|
||||
timestamp: string;
|
||||
seller?: string;
|
||||
buyer?: string | null;
|
||||
@@ -25,27 +25,27 @@ const copyFeedbackTimeout = ref<{ [key: string]: NodeJS.Timeout | null }>({});
|
||||
|
||||
const getTransactionTypeInfo = (type: string) => {
|
||||
const typeMap = {
|
||||
deposit: { label: "Depósito", status: "completed" as const },
|
||||
lock: { label: "Bloqueio", status: "open" as const },
|
||||
release: { label: "Liberação", status: "completed" as const },
|
||||
return: { label: "Retorno", status: "expired" as const },
|
||||
deposit: { label: 'Depósito', status: 'completed' as const },
|
||||
lock: { label: 'Bloqueio', status: 'open' as const },
|
||||
release: { label: 'Liberação', status: 'completed' as const },
|
||||
return: { label: 'Retorno', status: 'expired' as const },
|
||||
};
|
||||
return (
|
||||
typeMap[type as keyof typeof typeMap] || {
|
||||
label: type,
|
||||
status: "pending" as const,
|
||||
status: 'pending' as const,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const getTransactionTypeColor = (type: string) => {
|
||||
const colorMap = {
|
||||
deposit: "text-emerald-600",
|
||||
lock: "text-amber-600",
|
||||
release: "text-emerald-600",
|
||||
return: "text-gray-600",
|
||||
deposit: 'text-emerald-600',
|
||||
lock: 'text-amber-600',
|
||||
release: 'text-emerald-600',
|
||||
return: 'text-gray-600',
|
||||
};
|
||||
return colorMap[type as keyof typeof colorMap] || "text-gray-600";
|
||||
return colorMap[type as keyof typeof colorMap] || 'text-gray-600';
|
||||
};
|
||||
|
||||
const formatAddress = (address: string) => {
|
||||
@@ -79,7 +79,7 @@ const copyToClipboard = async (address: string, key: string) => {
|
||||
copyFeedback.value[key] = false;
|
||||
}, 2000);
|
||||
} catch (error) {
|
||||
console.error("Error copying to clipboard:", error);
|
||||
console.error('Error copying to clipboard:', error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import { ref, watch, onMounted, computed } from "vue";
|
||||
import { debounce } from "@/utils/debounce";
|
||||
import { decimalCount } from "@/utils/decimalCount";
|
||||
import { useFloating, arrow, offset, flip, shift } from "@floating-ui/vue";
|
||||
import IconButton from "../ui/IconButton.vue";
|
||||
import withdrawIcon from "@/assets/withdraw.svg?url";
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import { ref, watch, onMounted, computed } from 'vue';
|
||||
import { debounce } from '@/utils/debounce';
|
||||
import { decimalCount } from '@/utils/decimalCount';
|
||||
import { useFloating, arrow, offset, flip, shift } from '@floating-ui/vue';
|
||||
import IconButton from '../ui/IconButton.vue';
|
||||
import withdrawIcon from '@/assets/withdraw.svg?url';
|
||||
|
||||
const props = defineProps<{
|
||||
validDeposits: ValidDeposit[];
|
||||
@@ -17,7 +17,7 @@ const emit = defineEmits<{
|
||||
withdraw: [amount: string];
|
||||
}>();
|
||||
|
||||
const withdrawAmount = ref<string>("");
|
||||
const withdrawAmount = ref<string>('');
|
||||
const isCollapsibleOpen = ref<boolean>(false);
|
||||
const validDecimals = ref<boolean>(true);
|
||||
const validWithdrawAmount = ref<boolean>(true);
|
||||
@@ -58,9 +58,9 @@ const handleInputEvent = (event: any): void => {
|
||||
|
||||
const callWithdraw = () => {
|
||||
if (enableConfirmButton.value && withdrawAmount.value) {
|
||||
emit("withdraw", withdrawAmount.value);
|
||||
emit('withdraw', withdrawAmount.value);
|
||||
// Reset form after withdraw
|
||||
withdrawAmount.value = "";
|
||||
withdrawAmount.value = '';
|
||||
isCollapsibleOpen.value = false;
|
||||
}
|
||||
};
|
||||
@@ -71,7 +71,7 @@ const openWithdrawForm = () => {
|
||||
|
||||
const cancelWithdraw = () => {
|
||||
isCollapsibleOpen.value = false;
|
||||
withdrawAmount.value = "";
|
||||
withdrawAmount.value = '';
|
||||
validDecimals.value = true;
|
||||
validWithdrawAmount.value = true;
|
||||
enableConfirmButton.value = false;
|
||||
@@ -79,7 +79,7 @@ const cancelWithdraw = () => {
|
||||
|
||||
onMounted(() => {
|
||||
useFloating(reference, floating, {
|
||||
placement: "right",
|
||||
placement: 'right',
|
||||
middleware: [
|
||||
offset(10),
|
||||
flip(),
|
||||
@@ -194,13 +194,13 @@ p {
|
||||
@apply bg-white text-gray-900 font-medium text-xs md:text-base px-3 py-2 rounded border-2 border-emerald-500 left-5 top-[-3rem];
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
input[type='number'] {
|
||||
appearance: textfield;
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
input[type='number']::-webkit-inner-spin-button,
|
||||
input[type='number']::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import type { WalletTransaction } from "@/model/WalletTransaction";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { ref, watch } from "vue";
|
||||
import SpinnerComponent from "../ui/SpinnerComponent.vue";
|
||||
import BalanceCard from "./BalanceCard.vue";
|
||||
import TransactionCard from "./TransactionCard.vue";
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import type { WalletTransaction } from '@/model/WalletTransaction';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import { ref, watch } from 'vue';
|
||||
import SpinnerComponent from '../ui/SpinnerComponent.vue';
|
||||
import BalanceCard from './BalanceCard.vue';
|
||||
import TransactionCard from './TransactionCard.vue';
|
||||
|
||||
const user = useUser();
|
||||
|
||||
@@ -16,14 +16,14 @@ const props = defineProps<{
|
||||
activeLockAmount: number;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits(["depositWithdrawn"]);
|
||||
const emit = defineEmits(['depositWithdrawn']);
|
||||
|
||||
const { loadingWalletTransactions } = user;
|
||||
|
||||
const itemsToShow = ref<WalletTransaction[]>([]);
|
||||
|
||||
const callWithdraw = (amount: string) => {
|
||||
emit("depositWithdrawn", amount);
|
||||
emit('depositWithdrawn', amount);
|
||||
};
|
||||
|
||||
const showInitialItems = (): void => {
|
||||
@@ -33,7 +33,7 @@ const showInitialItems = (): void => {
|
||||
const openEtherscanUrl = (transactionHash: string): void => {
|
||||
const networkUrl = user.network.value.blockExplorers?.default.url;
|
||||
const url = `https://${networkUrl}/tx/${transactionHash}`;
|
||||
window.open(url, "_blank");
|
||||
window.open(url, '_blank');
|
||||
};
|
||||
|
||||
const loadMore = (): void => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import type { WalletTransaction } from "@/model/WalletTransaction";
|
||||
import { TokenEnum } from "@/model/NetworkEnum";
|
||||
import { computed } from "vue";
|
||||
import StatusBadge, { type StatusType } from "../ui/StatusBadge.vue";
|
||||
import { Networks } from "@/config/networks";
|
||||
import type { WalletTransaction } from '@/model/WalletTransaction';
|
||||
import { TokenEnum } from '@/model/NetworkEnum';
|
||||
import { computed } from 'vue';
|
||||
import StatusBadge, { type StatusType } from '../ui/StatusBadge.vue';
|
||||
import { Networks } from '@/config/networks';
|
||||
|
||||
const props = defineProps<{
|
||||
transaction: WalletTransaction;
|
||||
@@ -16,16 +16,16 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
const eventName = computed(() => {
|
||||
if (!props.transaction.event) return "Desconhecido";
|
||||
if (!props.transaction.event) return 'Desconhecido';
|
||||
|
||||
const possibleEventName: { [key: string]: string } = {
|
||||
DepositAdded: "Oferta",
|
||||
LockAdded: "Reserva",
|
||||
LockReleased: "Compra",
|
||||
DepositWithdrawn: "Retirada",
|
||||
DepositAdded: 'Oferta',
|
||||
LockAdded: 'Reserva',
|
||||
LockReleased: 'Compra',
|
||||
DepositWithdrawn: 'Retirada',
|
||||
};
|
||||
|
||||
return possibleEventName[props.transaction.event] || "Desconhecido";
|
||||
return possibleEventName[props.transaction.event] || 'Desconhecido';
|
||||
});
|
||||
|
||||
const explorerName = computed(() => {
|
||||
@@ -34,46 +34,46 @@ const explorerName = computed(() => {
|
||||
});
|
||||
|
||||
const statusType = computed((): StatusType => {
|
||||
if (eventName.value === "Reserva") {
|
||||
if (eventName.value === 'Reserva') {
|
||||
switch (props.transaction.lockStatus) {
|
||||
case 1:
|
||||
return "open";
|
||||
return 'open';
|
||||
case 2:
|
||||
return "expired";
|
||||
return 'expired';
|
||||
case 3:
|
||||
return "completed";
|
||||
return 'completed';
|
||||
default:
|
||||
return "completed";
|
||||
return 'completed';
|
||||
}
|
||||
}
|
||||
return "completed";
|
||||
return 'completed';
|
||||
});
|
||||
|
||||
const showExplorerLink = computed(() => {
|
||||
return eventName.value !== "Reserva" || props.transaction.lockStatus !== 1;
|
||||
return eventName.value !== 'Reserva' || props.transaction.lockStatus !== 1;
|
||||
});
|
||||
|
||||
const showContinueButton = computed(() => {
|
||||
return eventName.value === "Reserva" && props.transaction.lockStatus === 1;
|
||||
return eventName.value === 'Reserva' && props.transaction.lockStatus === 1;
|
||||
});
|
||||
|
||||
const formattedDate = computed(() => {
|
||||
if (!props.transaction.blockTimestamp) return "";
|
||||
if (!props.transaction.blockTimestamp) return '';
|
||||
|
||||
const timestamp = props.transaction.blockTimestamp;
|
||||
const date = new Date(timestamp * 1000);
|
||||
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const year = date.getFullYear();
|
||||
const hours = String(date.getHours()).padStart(2, "0");
|
||||
const minutes = String(date.getMinutes()).padStart(2, "0");
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
|
||||
return `${day}/${month}/${year} ${hours}:${minutes}`;
|
||||
});
|
||||
|
||||
const handleExplorerClick = () => {
|
||||
emit("openExplorer", props.transaction.transactionHash);
|
||||
emit('openExplorer', props.transaction.transactionHash);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from "vue";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import CustomButton from "@/components/ui/CustomButton.vue";
|
||||
import { postProcessKey } from "@/utils/pixKeyFormat";
|
||||
import { TokenEnum } from "@/model/NetworkEnum";
|
||||
import { getTokenImage } from "@/utils/imagesPath";
|
||||
import { useOnboard } from "@web3-onboard/vue";
|
||||
import ChevronDown from "@/assets/chevron.svg";
|
||||
import { ref, computed } from 'vue';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import CustomButton from '@/components/ui/CustomButton.vue';
|
||||
import { postProcessKey } from '@/utils/pixKeyFormat';
|
||||
import { TokenEnum } from '@/model/NetworkEnum';
|
||||
import { getTokenImage } from '@/utils/imagesPath';
|
||||
import { useOnboard } from '@web3-onboard/vue';
|
||||
import ChevronDown from '@/assets/chevron.svg';
|
||||
|
||||
// Import the bank list
|
||||
import bankList from "@/utils/files/isbpList.json";
|
||||
import type { Participant } from "@/utils/bbPay";
|
||||
import bankList from '@/utils/files/isbpList.json';
|
||||
import type { Participant } from '@/utils/bbPay';
|
||||
|
||||
// Define Bank interface
|
||||
interface Bank {
|
||||
@@ -26,17 +26,17 @@ const formRef = ref<HTMLFormElement | null>(null);
|
||||
const user = useUser();
|
||||
const { walletAddress, selectedToken } = user;
|
||||
|
||||
const offer = ref<string>("");
|
||||
const identification = ref<string>("");
|
||||
const account = ref<string>("");
|
||||
const branch = ref<string>("");
|
||||
const accountType = ref<string>("");
|
||||
const offer = ref<string>('');
|
||||
const identification = ref<string>('');
|
||||
const account = ref<string>('');
|
||||
const branch = ref<string>('');
|
||||
const accountType = ref<string>('');
|
||||
const selectTokenToggle = ref<boolean>(false);
|
||||
const savingsVariation = ref<string>("");
|
||||
const savingsVariation = ref<string>('');
|
||||
const errors = ref<{ [key: string]: string }>({});
|
||||
|
||||
// Bank selection
|
||||
const bankSearchQuery = ref<string>("");
|
||||
const bankSearchQuery = ref<string>('');
|
||||
const showBankList = ref<boolean>(false);
|
||||
const selectedBank = ref<Bank | null>(null);
|
||||
|
||||
@@ -56,7 +56,7 @@ const handleBankSelect = (bank: Bank) => {
|
||||
};
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(["approveTokens"]);
|
||||
const emit = defineEmits(['approveTokens']);
|
||||
|
||||
// Methods
|
||||
const connectAccount = async (): Promise<void> => {
|
||||
@@ -77,10 +77,10 @@ const handleSubmit = (e: Event): void => {
|
||||
accountType: accountType.value,
|
||||
account: account.value,
|
||||
branch: branch.value,
|
||||
savingsVariation: savingsVariation.value || "",
|
||||
savingsVariation: savingsVariation.value || '',
|
||||
};
|
||||
|
||||
emit("approveTokens", data);
|
||||
emit('approveTokens', data);
|
||||
};
|
||||
|
||||
// Token selection
|
||||
@@ -328,13 +328,13 @@ const handleSelectedToken = (token: TokenEnum): void => {
|
||||
@apply text-white text-center;
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
appearance: textfield;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
input[type='number']::-webkit-inner-spin-button,
|
||||
input[type='number']::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import CustomButton from "@/components/ui/CustomButton.vue";
|
||||
import { debounce } from "@/utils/debounce";
|
||||
import { decimalCount } from "@/utils/decimalCount";
|
||||
import { getTokenImage } from "@/utils/imagesPath";
|
||||
import { useOnboard } from "@web3-onboard/vue";
|
||||
import { ref } from 'vue';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import CustomButton from '@/components/ui/CustomButton.vue';
|
||||
import { debounce } from '@/utils/debounce';
|
||||
import { decimalCount } from '@/utils/decimalCount';
|
||||
import { getTokenImage } from '@/utils/imagesPath';
|
||||
import { useOnboard } from '@web3-onboard/vue';
|
||||
|
||||
// Store
|
||||
const user = useUser();
|
||||
@@ -18,7 +18,7 @@ const hasLiquidity = ref<boolean>(true);
|
||||
const validDecimals = ref<boolean>(true);
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(["tokenBuy"]);
|
||||
const emit = defineEmits(['tokenBuy']);
|
||||
|
||||
// Blockchain methods
|
||||
const connectAccount = async (): Promise<void> => {
|
||||
@@ -152,8 +152,8 @@ const handleInputEvent = (event: any): void => {
|
||||
@apply text-white text-center;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
input[type='number']::-webkit-inner-spin-button,
|
||||
input[type='number']::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import CustomButton from "@/components/ui/CustomButton.vue";
|
||||
import CustomButton from '@/components/ui/CustomButton.vue';
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(["sendNetwork"]);
|
||||
const emit = defineEmits(['sendNetwork']);
|
||||
|
||||
// props and store references
|
||||
const props = defineProps({
|
||||
@@ -80,8 +80,8 @@ p {
|
||||
@apply font-medium text-base;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
input[type='number']::-webkit-inner-spin-button,
|
||||
input[type='number']::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from "vue";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { onClickOutside } from "@vueuse/core";
|
||||
import { getNetworkImage } from "@/utils/imagesPath";
|
||||
import { Networks } from "@/config/networks";
|
||||
import { useOnboard } from "@web3-onboard/vue";
|
||||
import { ref, watch } from 'vue';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import { onClickOutside } from '@vueuse/core';
|
||||
import { getNetworkImage } from '@/utils/imagesPath';
|
||||
import { Networks } from '@/config/networks';
|
||||
import { useOnboard } from '@web3-onboard/vue';
|
||||
|
||||
import ChevronDown from "@/assets/chevronDown.svg";
|
||||
import TwitterIcon from "@/assets/twitterIcon.svg";
|
||||
import LinkedinIcon from "@/assets/linkedinIcon.svg";
|
||||
import GithubIcon from "@/assets/githubIcon.svg";
|
||||
import { connectProvider } from "@/blockchain/provider";
|
||||
import { DEFAULT_NETWORK } from "@/config/networks";
|
||||
import type { NetworkConfig } from "@/model/NetworkEnum";
|
||||
import ChevronDown from '@/assets/chevronDown.svg';
|
||||
import TwitterIcon from '@/assets/twitterIcon.svg';
|
||||
import LinkedinIcon from '@/assets/linkedinIcon.svg';
|
||||
import GithubIcon from '@/assets/githubIcon.svg';
|
||||
import { connectProvider } from '@/blockchain/provider';
|
||||
import { DEFAULT_NETWORK } from '@/config/networks';
|
||||
import type { NetworkConfig } from '@/model/NetworkEnum';
|
||||
|
||||
interface MenuOption {
|
||||
label: string;
|
||||
@@ -47,7 +47,7 @@ const connnectWallet = async (): Promise<void> => {
|
||||
|
||||
watch(connectedWallet, async (newVal: any) => {
|
||||
connectProvider(newVal.provider);
|
||||
const addresses = await newVal.provider.request({ method: "eth_accounts" });
|
||||
const addresses = await newVal.provider.request({ method: 'eth_accounts' });
|
||||
user.setWalletAddress(addresses.shift());
|
||||
});
|
||||
|
||||
@@ -58,7 +58,7 @@ watch(connectedChain, (newVal: any) => {
|
||||
!Object.values(Networks).some((network) => network.id === Number(newVal.id))
|
||||
) {
|
||||
console.log(
|
||||
"Invalid or unsupported network detected, defaulting to Sepolia",
|
||||
'Invalid or unsupported network detected, defaulting to Sepolia',
|
||||
);
|
||||
user.setNetwork(DEFAULT_NETWORK);
|
||||
return;
|
||||
@@ -67,7 +67,7 @@ watch(connectedChain, (newVal: any) => {
|
||||
});
|
||||
|
||||
const formatWalletAddress = (): string => {
|
||||
if (!walletAddress.value) throw new Error("Wallet not connected");
|
||||
if (!walletAddress.value) throw new Error('Wallet not connected');
|
||||
const walletAddressLength = walletAddress.value.length;
|
||||
const initialText = walletAddress.value.substring(0, 5);
|
||||
const finalText = walletAddress.value.substring(
|
||||
@@ -79,7 +79,7 @@ const formatWalletAddress = (): string => {
|
||||
|
||||
const disconnectUser = async (): Promise<void> => {
|
||||
user.setWalletAddress(null);
|
||||
await disconnectWallet({ label: connectedWallet.value?.label || "" });
|
||||
await disconnectWallet({ label: connectedWallet.value?.label || '' });
|
||||
closeMenu();
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ const networkChange = async (network: NetworkConfig): Promise<void> => {
|
||||
});
|
||||
user.setNetwork(network);
|
||||
} catch (error) {
|
||||
console.log("Error changing network", error);
|
||||
console.log('Error changing network', error);
|
||||
}
|
||||
} else {
|
||||
// If no wallet connected, just update the network state
|
||||
@@ -122,20 +122,20 @@ onClickOutside(infoMenuRef, () => {
|
||||
|
||||
const infoMenuOptions: MenuOption[] = [
|
||||
{
|
||||
label: "Explorar Transações",
|
||||
route: "/explore",
|
||||
label: 'Explorar Transações',
|
||||
route: '/explore',
|
||||
showInDesktop: true,
|
||||
showInMobile: false,
|
||||
},
|
||||
{
|
||||
label: "Perguntas frequentes",
|
||||
route: "/faq",
|
||||
label: 'Perguntas frequentes',
|
||||
route: '/faq',
|
||||
showInDesktop: true,
|
||||
showInMobile: false,
|
||||
},
|
||||
{
|
||||
label: "Versões",
|
||||
route: "/versions",
|
||||
label: 'Versões',
|
||||
route: '/versions',
|
||||
showInDesktop: true,
|
||||
showInMobile: false,
|
||||
},
|
||||
@@ -143,40 +143,40 @@ const infoMenuOptions: MenuOption[] = [
|
||||
|
||||
const walletMenuOptions: MenuOption[] = [
|
||||
{
|
||||
label: "Quero vender",
|
||||
label: 'Quero vender',
|
||||
isDynamic: true,
|
||||
dynamicLabel: () => (sellerView.value ? "Quero comprar" : "Quero vender"),
|
||||
dynamicRoute: () => (sellerView.value ? "/" : "/seller"),
|
||||
dynamicLabel: () => (sellerView.value ? 'Quero comprar' : 'Quero vender'),
|
||||
dynamicRoute: () => (sellerView.value ? '/' : '/seller'),
|
||||
showInDesktop: false,
|
||||
showInMobile: true,
|
||||
},
|
||||
{
|
||||
label: "Explorar Transações",
|
||||
route: "/explore",
|
||||
label: 'Explorar Transações',
|
||||
route: '/explore',
|
||||
showInDesktop: false,
|
||||
showInMobile: true,
|
||||
},
|
||||
{
|
||||
label: "Gerenciar Ofertas",
|
||||
route: "/manage_bids",
|
||||
label: 'Gerenciar Ofertas',
|
||||
route: '/manage_bids',
|
||||
showInDesktop: true,
|
||||
showInMobile: true,
|
||||
},
|
||||
{
|
||||
label: "Perguntas frequentes",
|
||||
route: "/faq",
|
||||
label: 'Perguntas frequentes',
|
||||
route: '/faq',
|
||||
showInDesktop: false,
|
||||
showInMobile: true,
|
||||
},
|
||||
{
|
||||
label: "Versões",
|
||||
route: "/versions",
|
||||
label: 'Versões',
|
||||
route: '/versions',
|
||||
showInDesktop: false,
|
||||
showInMobile: true,
|
||||
},
|
||||
{
|
||||
label: "Desconectar",
|
||||
route: "/",
|
||||
label: 'Desconectar',
|
||||
route: '/',
|
||||
action: disconnectUser,
|
||||
showInDesktop: true,
|
||||
showInMobile: true,
|
||||
@@ -330,7 +330,7 @@ const handleMenuOptionClick = (option: MenuOption): void => {
|
||||
class="default-button whitespace-nowrap w-40 sm:w-44 md:w-36 hidden md:inline-block"
|
||||
>
|
||||
<div class="topbar-text topbar-link text-center mx-auto inline-block">
|
||||
{{ sellerView ? "Quero comprar" : "Quero vender" }}
|
||||
{{ sellerView ? 'Quero comprar' : 'Quero vender' }}
|
||||
</div>
|
||||
</RouterLink>
|
||||
<div class="flex flex-col relative">
|
||||
@@ -354,7 +354,7 @@ const handleMenuOptionClick = (option: MenuOption): void => {
|
||||
class="default-text hidden sm:inline-block text-gray-50 group-hover:text-gray-900 transition-all duration-500 ease-in-out whitespace-nowrap text-ellipsis overflow-hidden"
|
||||
:class="{ '!text-gray-900': currencyMenuOpenToggle }"
|
||||
>
|
||||
{{ user.network.value.name || "Invalid Chain" }}
|
||||
{{ user.network.value.name || 'Invalid Chain' }}
|
||||
</span>
|
||||
<div
|
||||
class="transition-all duration-500 ease-in-out mt-1"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed } from "vue";
|
||||
import { TokenEnum } from "@/model/NetworkEnum";
|
||||
import { decimalCount } from "@/utils/decimalCount";
|
||||
import { debounce } from "@/utils/debounce";
|
||||
import TokenSelector from "./TokenSelector.vue";
|
||||
import ErrorMessage from "./ErrorMessage.vue";
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { TokenEnum } from '@/model/NetworkEnum';
|
||||
import { decimalCount } from '@/utils/decimalCount';
|
||||
import { debounce } from '@/utils/debounce';
|
||||
import TokenSelector from './TokenSelector.vue';
|
||||
import ErrorMessage from './ErrorMessage.vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -20,7 +20,7 @@ const props = withDefaults(
|
||||
required?: boolean;
|
||||
}>(),
|
||||
{
|
||||
placeholder: "0",
|
||||
placeholder: '0',
|
||||
showTokenSelector: true,
|
||||
showConversion: true,
|
||||
conversionRate: 1,
|
||||
@@ -31,13 +31,13 @@ const props = withDefaults(
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: number];
|
||||
"update:selectedToken": [token: TokenEnum];
|
||||
'update:modelValue': [value: number];
|
||||
'update:selectedToken': [token: TokenEnum];
|
||||
error: [message: string | null];
|
||||
valid: [isValid: boolean];
|
||||
}>();
|
||||
|
||||
const inputValue = ref<string>(String(props.modelValue || ""));
|
||||
const inputValue = ref<string>(String(props.modelValue || ''));
|
||||
const validDecimals = ref(true);
|
||||
const validRange = ref(true);
|
||||
|
||||
@@ -47,7 +47,7 @@ const convertedValue = computed(() => {
|
||||
|
||||
const errorMessage = computed(() => {
|
||||
if (!validDecimals.value) {
|
||||
return "Por favor utilize no máximo 2 casas decimais";
|
||||
return 'Por favor utilize no máximo 2 casas decimais';
|
||||
}
|
||||
if (!validRange.value) {
|
||||
if (props.minValue && props.modelValue < props.minValue) {
|
||||
@@ -74,8 +74,8 @@ const handleInput = (event: Event) => {
|
||||
// Validar decimais
|
||||
if (decimalCount(value) > 2) {
|
||||
validDecimals.value = false;
|
||||
emit("error", "Por favor utilize no máximo 2 casas decimais");
|
||||
emit("valid", false);
|
||||
emit('error', 'Por favor utilize no máximo 2 casas decimais');
|
||||
emit('valid', false);
|
||||
return;
|
||||
}
|
||||
validDecimals.value = true;
|
||||
@@ -83,34 +83,34 @@ const handleInput = (event: Event) => {
|
||||
// Validar range
|
||||
if (props.minValue !== undefined && numValue < props.minValue) {
|
||||
validRange.value = false;
|
||||
emit("error", `Valor mínimo: ${props.minValue}`);
|
||||
emit("valid", false);
|
||||
emit('error', `Valor mínimo: ${props.minValue}`);
|
||||
emit('valid', false);
|
||||
return;
|
||||
}
|
||||
if (props.maxValue !== undefined && numValue > props.maxValue) {
|
||||
validRange.value = false;
|
||||
emit("error", `Valor máximo: ${props.maxValue}`);
|
||||
emit("valid", false);
|
||||
emit('error', `Valor máximo: ${props.maxValue}`);
|
||||
emit('valid', false);
|
||||
return;
|
||||
}
|
||||
validRange.value = true;
|
||||
|
||||
emit("update:modelValue", numValue);
|
||||
emit("error", null);
|
||||
emit("valid", true);
|
||||
emit('update:modelValue', numValue);
|
||||
emit('error', null);
|
||||
emit('valid', true);
|
||||
};
|
||||
|
||||
const debouncedHandleInput = debounce(handleInput, 500);
|
||||
|
||||
const handleTokenChange = (token: TokenEnum) => {
|
||||
emit("update:selectedToken", token);
|
||||
emit('update:selectedToken', token);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
if (newVal !== Number(inputValue.value)) {
|
||||
inputValue.value = String(newVal || "");
|
||||
inputValue.value = String(newVal || '');
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import bankList from "@/utils/files/isbpList.json";
|
||||
import { computed } from 'vue';
|
||||
import bankList from '@/utils/files/isbpList.json';
|
||||
|
||||
export interface Bank {
|
||||
ISPB: string;
|
||||
@@ -15,12 +15,12 @@ const props = withDefaults(
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
placeholder: "Busque e selecione seu banco",
|
||||
placeholder: 'Busque e selecione seu banco',
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: string];
|
||||
'update:modelValue': [value: string];
|
||||
change: [bank: Bank];
|
||||
}>();
|
||||
|
||||
@@ -38,7 +38,7 @@ const selectedItem = computed(() => {
|
||||
});
|
||||
|
||||
const searchQuery = computed({
|
||||
get: () => selectedItem.value?.label || "",
|
||||
get: () => selectedItem.value?.label || '',
|
||||
set: (value: string) => {
|
||||
// Handled by input
|
||||
},
|
||||
@@ -58,8 +58,8 @@ const showBankList = computed(() => {
|
||||
});
|
||||
|
||||
const selectBank = (bank: Bank) => {
|
||||
emit("update:modelValue", bank.ISPB);
|
||||
emit("change", bank);
|
||||
emit('update:modelValue', bank.ISPB);
|
||||
emit('change', bank);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { ref } from 'vue';
|
||||
const props = defineProps<{
|
||||
type: string;
|
||||
}>();
|
||||
|
||||
const alertText = ref<string>("");
|
||||
const alertPaddingLeft = ref<string>("18rem");
|
||||
const alertText = ref<string>('');
|
||||
const alertPaddingLeft = ref<string>('18rem');
|
||||
|
||||
if (props.type === "sell") {
|
||||
alertPaddingLeft.value = "30%";
|
||||
} else if (props.type === "buy") {
|
||||
alertPaddingLeft.value = "30%";
|
||||
} else if (props.type === "withdraw") {
|
||||
alertPaddingLeft.value = "40%";
|
||||
} else if (props.type === "redirect") {
|
||||
alertPaddingLeft.value = "35%";
|
||||
if (props.type === 'sell') {
|
||||
alertPaddingLeft.value = '30%';
|
||||
} else if (props.type === 'buy') {
|
||||
alertPaddingLeft.value = '30%';
|
||||
} else if (props.type === 'withdraw') {
|
||||
alertPaddingLeft.value = '40%';
|
||||
} else if (props.type === 'redirect') {
|
||||
alertPaddingLeft.value = '35%';
|
||||
}
|
||||
|
||||
switch (props.type) {
|
||||
case "buy":
|
||||
case 'buy':
|
||||
alertText.value =
|
||||
"Tudo certo! Os tokens já foram retirados da oferta e estão disponíveis na sua carteira.";
|
||||
'Tudo certo! Os tokens já foram retirados da oferta e estão disponíveis na sua carteira.';
|
||||
break;
|
||||
case "sell":
|
||||
case 'sell':
|
||||
alertText.value =
|
||||
"Tudo certo! Os tokens já foram reservados e sua oferta está disponível.";
|
||||
'Tudo certo! Os tokens já foram reservados e sua oferta está disponível.';
|
||||
break;
|
||||
case "redirect":
|
||||
alertText.value = "Existe uma compra em aberto. Continuar?";
|
||||
case 'redirect':
|
||||
alertText.value = 'Existe uma compra em aberto. Continuar?';
|
||||
break;
|
||||
case "withdraw":
|
||||
alertText.value = "Tudo certo! Saque realizado com sucesso!";
|
||||
case 'withdraw':
|
||||
alertText.value = 'Tudo certo! Saque realizado com sucesso!';
|
||||
break;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost";
|
||||
export type ButtonSize = "sm" | "md" | "lg" | "xl";
|
||||
export type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost';
|
||||
export type ButtonSize = 'sm' | 'md' | 'lg' | 'xl';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -9,25 +9,25 @@ const props = withDefaults(
|
||||
variant?: ButtonVariant;
|
||||
size?: ButtonSize;
|
||||
icon?: string;
|
||||
iconPosition?: "left" | "right";
|
||||
iconPosition?: 'left' | 'right';
|
||||
fullWidth?: boolean;
|
||||
loading?: boolean;
|
||||
}>(),
|
||||
{
|
||||
isDisabled: false,
|
||||
variant: "primary",
|
||||
size: "xl",
|
||||
iconPosition: "left",
|
||||
variant: 'primary',
|
||||
size: 'xl',
|
||||
iconPosition: 'left',
|
||||
fullWidth: true,
|
||||
loading: false,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits(["buttonClicked"]);
|
||||
const emit = defineEmits(['buttonClicked']);
|
||||
|
||||
const handleClick = () => {
|
||||
if (!props.isDisabled && !props.loading) {
|
||||
emit("buttonClicked");
|
||||
emit('buttonClicked');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
isRedirectModal: Boolean,
|
||||
});
|
||||
|
||||
const modalColor = ref<string>("white");
|
||||
const modalHeight = ref<string>("250px");
|
||||
const pFontSize = ref<string>("16px");
|
||||
const modalColor = ref<string>('white');
|
||||
const modalHeight = ref<string>('250px');
|
||||
const pFontSize = ref<string>('16px');
|
||||
|
||||
if (props.isRedirectModal) {
|
||||
modalColor.value = "rgba(251, 191, 36, 1)";
|
||||
modalHeight.value = "150px";
|
||||
pFontSize.value = "20px";
|
||||
modalColor.value = 'rgba(251, 191, 36, 1)';
|
||||
modalHeight.value = '150px';
|
||||
pFontSize.value = '20px';
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts" generic="T">
|
||||
import { ref, computed } from "vue";
|
||||
import { onClickOutside } from "@vueuse/core";
|
||||
import ChevronDown from "@/assets/chevronDown.svg";
|
||||
import { ref, computed } from 'vue';
|
||||
import { onClickOutside } from '@vueuse/core';
|
||||
import ChevronDown from '@/assets/chevronDown.svg';
|
||||
|
||||
defineOptions({ name: "UiDropdown" });
|
||||
defineOptions({ name: 'UiDropdown' });
|
||||
|
||||
export interface DropdownItem<T = any> {
|
||||
value: T;
|
||||
@@ -19,25 +19,25 @@ const props = withDefaults(
|
||||
placeholder?: string;
|
||||
searchable?: boolean;
|
||||
disabled?: boolean;
|
||||
size?: "sm" | "md" | "lg";
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
showIcon?: boolean;
|
||||
}>(),
|
||||
{
|
||||
placeholder: "Selecione...",
|
||||
placeholder: 'Selecione...',
|
||||
searchable: false,
|
||||
disabled: false,
|
||||
size: "md",
|
||||
size: 'md',
|
||||
showIcon: true,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: T];
|
||||
'update:modelValue': [value: T];
|
||||
change: [value: T];
|
||||
}>();
|
||||
|
||||
const isOpen = ref(false);
|
||||
const searchQuery = ref("");
|
||||
const searchQuery = ref('');
|
||||
const dropdownRef = ref<HTMLElement | null>(null);
|
||||
|
||||
const selectedItem = computed(() => {
|
||||
@@ -57,23 +57,23 @@ const toggleDropdown = () => {
|
||||
if (!props.disabled) {
|
||||
isOpen.value = !isOpen.value;
|
||||
if (!isOpen.value) {
|
||||
searchQuery.value = "";
|
||||
searchQuery.value = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const selectItem = (item: DropdownItem<T>) => {
|
||||
if (!item.disabled) {
|
||||
emit("update:modelValue", item.value);
|
||||
emit("change", item.value);
|
||||
emit('update:modelValue', item.value);
|
||||
emit('change', item.value);
|
||||
isOpen.value = false;
|
||||
searchQuery.value = "";
|
||||
searchQuery.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
onClickOutside(dropdownRef, () => {
|
||||
isOpen.value = false;
|
||||
searchQuery.value = "";
|
||||
searchQuery.value = '';
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
export type ErrorType = "error" | "warning" | "info";
|
||||
export type ErrorType = 'error' | 'warning' | 'info';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -9,16 +9,16 @@ const props = withDefaults(
|
||||
icon?: boolean;
|
||||
}>(),
|
||||
{
|
||||
type: "error",
|
||||
type: 'error',
|
||||
centered: true,
|
||||
icon: false,
|
||||
},
|
||||
);
|
||||
|
||||
const colorClasses = {
|
||||
error: "text-red-500",
|
||||
warning: "text-amber-500",
|
||||
info: "text-blue-500",
|
||||
error: 'text-red-500',
|
||||
warning: 'text-amber-500',
|
||||
info: 'text-blue-500',
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
export type FormCardPadding = "sm" | "md" | "lg";
|
||||
export type FormCardPadding = 'sm' | 'md' | 'lg';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -8,7 +8,7 @@ const props = withDefaults(
|
||||
noBorder?: boolean;
|
||||
}>(),
|
||||
{
|
||||
padding: "md",
|
||||
padding: 'md',
|
||||
fullWidth: true,
|
||||
noBorder: false,
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
export type IconButtonVariant = "primary" | "secondary" | "outline" | "ghost";
|
||||
export type IconButtonSize = "sm" | "md" | "lg";
|
||||
export type IconPosition = "left" | "right";
|
||||
export type IconButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost';
|
||||
export type IconButtonSize = 'sm' | 'md' | 'lg';
|
||||
export type IconPosition = 'left' | 'right';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -14,9 +14,9 @@ const props = withDefaults(
|
||||
fullWidth?: boolean;
|
||||
}>(),
|
||||
{
|
||||
variant: "outline",
|
||||
size: "md",
|
||||
iconPosition: "left",
|
||||
variant: 'outline',
|
||||
size: 'md',
|
||||
iconPosition: 'left',
|
||||
disabled: false,
|
||||
fullWidth: false,
|
||||
},
|
||||
@@ -28,7 +28,7 @@ const emit = defineEmits<{
|
||||
|
||||
const handleClick = () => {
|
||||
if (!props.disabled) {
|
||||
emit("click");
|
||||
emit('click');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useFloating, arrow, offset, flip, shift } from "@floating-ui/vue";
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useFloating, arrow, offset, flip, shift } from '@floating-ui/vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
text: string;
|
||||
placement?: "top" | "bottom" | "left" | "right";
|
||||
placement?: 'top' | 'bottom' | 'left' | 'right';
|
||||
iconSrc?: string;
|
||||
showOnHover?: boolean;
|
||||
}>(),
|
||||
{
|
||||
placement: "right",
|
||||
iconSrc: "",
|
||||
placement: 'right',
|
||||
iconSrc: '',
|
||||
showOnHover: true,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ const props = defineProps({
|
||||
<span
|
||||
class="text font-bold sm:text-3xl text-2xl sm:max-w-[29rem] max-w-[20rem]"
|
||||
>
|
||||
{{ props.title ? props.title : "Confirme em sua carteira" }}
|
||||
{{ props.title ? props.title : 'Confirme em sua carteira' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="main-container max-w-md">
|
||||
@@ -61,12 +61,12 @@ const props = defineProps({
|
||||
@apply text-white text-center;
|
||||
}
|
||||
|
||||
input[type="number"] {
|
||||
input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
input[type='number']::-webkit-inner-spin-button,
|
||||
input[type='number']::-webkit-outer-spin-button {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import SpinnerComponent from "./SpinnerComponent.vue";
|
||||
import SpinnerComponent from './SpinnerComponent.vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
message?: string;
|
||||
size?: "sm" | "md" | "lg";
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
centered?: boolean;
|
||||
inline?: boolean;
|
||||
}>(),
|
||||
{
|
||||
message: "Carregando...",
|
||||
size: "md",
|
||||
message: 'Carregando...',
|
||||
size: 'md',
|
||||
centered: true,
|
||||
inline: false,
|
||||
},
|
||||
);
|
||||
|
||||
const sizeMap = {
|
||||
sm: { spinner: "4", text: "text-sm" },
|
||||
md: { spinner: "6", text: "text-base" },
|
||||
lg: { spinner: "8", text: "text-lg" },
|
||||
sm: { spinner: '4', text: 'text-sm' },
|
||||
md: { spinner: '6', text: 'text-base' },
|
||||
lg: { spinner: '8', text: 'text-lg' },
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { getNetworkImage } from "@/utils/imagesPath";
|
||||
import type { NetworkConfig } from "@/model/NetworkEnum";
|
||||
import { computed } from 'vue';
|
||||
import { getNetworkImage } from '@/utils/imagesPath';
|
||||
import type { NetworkConfig } from '@/model/NetworkEnum';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
networks: NetworkConfig[];
|
||||
size?: "sm" | "md" | "lg";
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
showLabel?: boolean;
|
||||
}>(),
|
||||
{
|
||||
size: "md",
|
||||
size: 'md',
|
||||
showLabel: false,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { Networks } from "@/config/networks";
|
||||
import type { NetworkConfig } from "@/model/NetworkEnum";
|
||||
import { getNetworkImage } from "@/utils/imagesPath";
|
||||
import Dropdown, { type DropdownItem } from "./Dropdown.vue";
|
||||
import { computed } from 'vue';
|
||||
import { Networks } from '@/config/networks';
|
||||
import type { NetworkConfig } from '@/model/NetworkEnum';
|
||||
import { getNetworkImage } from '@/utils/imagesPath';
|
||||
import Dropdown, { type DropdownItem } from './Dropdown.vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: NetworkConfig;
|
||||
disabled?: boolean;
|
||||
size?: "sm" | "md" | "lg";
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
availableNetworks?: NetworkConfig[];
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
size: "md",
|
||||
size: 'md',
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: NetworkConfig];
|
||||
'update:modelValue': [value: NetworkConfig];
|
||||
change: [value: NetworkConfig];
|
||||
}>();
|
||||
|
||||
@@ -32,8 +32,8 @@ const networkItems = computed((): DropdownItem<NetworkConfig>[] => {
|
||||
});
|
||||
|
||||
const handleChange = (value: NetworkConfig) => {
|
||||
emit("update:modelValue", value);
|
||||
emit("change", value);
|
||||
emit('update:modelValue', value);
|
||||
emit('change', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
export type HeaderSize = "sm" | "md" | "lg";
|
||||
export type HeaderSize = 'sm' | 'md' | 'lg';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -9,7 +9,7 @@ const props = withDefaults(
|
||||
centered?: boolean;
|
||||
}>(),
|
||||
{
|
||||
size: "lg",
|
||||
size: 'lg',
|
||||
centered: true,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -10,10 +10,10 @@ const getCustomClass = () => {
|
||||
return [
|
||||
`w-${props.width}`,
|
||||
`h-${props.height}`,
|
||||
`fill-white`,
|
||||
"text-gray-200",
|
||||
"animate-spin",
|
||||
"dark:text-gray-600",
|
||||
'fill-white',
|
||||
'text-gray-200',
|
||||
'animate-spin',
|
||||
'dark:text-gray-600',
|
||||
];
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { computed } from 'vue';
|
||||
|
||||
export type StatusType = "open" | "expired" | "completed" | "pending";
|
||||
export type StatusType = 'open' | 'expired' | 'completed' | 'pending';
|
||||
|
||||
const props = defineProps<{
|
||||
status: StatusType;
|
||||
@@ -11,20 +11,20 @@ const props = defineProps<{
|
||||
const statusConfig = computed(() => {
|
||||
const configs: Record<StatusType, { text: string; color: string }> = {
|
||||
open: {
|
||||
text: "Em Aberto",
|
||||
color: "bg-amber-300",
|
||||
text: 'Em Aberto',
|
||||
color: 'bg-amber-300',
|
||||
},
|
||||
expired: {
|
||||
text: "Expirado",
|
||||
color: "bg-[#94A3B8]",
|
||||
text: 'Expirado',
|
||||
color: 'bg-[#94A3B8]',
|
||||
},
|
||||
completed: {
|
||||
text: "Finalizado",
|
||||
color: "bg-emerald-300",
|
||||
text: 'Finalizado',
|
||||
color: 'bg-emerald-300',
|
||||
},
|
||||
pending: {
|
||||
text: "Pendente",
|
||||
color: "bg-gray-300",
|
||||
text: 'Pendente',
|
||||
color: 'bg-gray-300',
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch, onMounted } from "vue";
|
||||
import { useOnboard } from "@web3-onboard/vue";
|
||||
import { Networks } from "@/config/networks";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { ref, computed, watch, onMounted } from 'vue';
|
||||
import { useOnboard } from '@web3-onboard/vue';
|
||||
import { Networks } from '@/config/networks';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
|
||||
const { connectedWallet } = useOnboard();
|
||||
const user = useUser();
|
||||
@@ -25,7 +25,7 @@ const switchNetwork = async () => {
|
||||
if (connectedWallet.value && connectedWallet.value.provider) {
|
||||
const chainId = network.value.id.toString(16);
|
||||
await connectedWallet.value.provider.request({
|
||||
method: "wallet_switchEthereumChain",
|
||||
method: 'wallet_switchEthereumChain',
|
||||
params: [
|
||||
{
|
||||
chainId: `0x${chainId}`,
|
||||
@@ -34,7 +34,7 @@ const switchNetwork = async () => {
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to switch network:", error);
|
||||
console.error('Failed to switch network:', error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { TokenEnum } from "@/model/NetworkEnum";
|
||||
import { getTokenImage } from "@/utils/imagesPath";
|
||||
import Dropdown, { type DropdownItem } from "./Dropdown.vue";
|
||||
import { computed } from 'vue';
|
||||
import { TokenEnum } from '@/model/NetworkEnum';
|
||||
import { getTokenImage } from '@/utils/imagesPath';
|
||||
import Dropdown, { type DropdownItem } from './Dropdown.vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: TokenEnum;
|
||||
disabled?: boolean;
|
||||
size?: "sm" | "md" | "lg";
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
size: "md",
|
||||
size: 'md',
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:modelValue": [value: TokenEnum];
|
||||
'update:modelValue': [value: TokenEnum];
|
||||
change: [value: TokenEnum];
|
||||
}>();
|
||||
|
||||
@@ -30,8 +30,8 @@ const tokenItems = computed((): DropdownItem<TokenEnum>[] => {
|
||||
});
|
||||
|
||||
const handleChange = (value: TokenEnum) => {
|
||||
emit("update:modelValue", value);
|
||||
emit("change", value);
|
||||
emit('update:modelValue', value);
|
||||
emit('change', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
const version = typeof __APP_VERSION__ !== "undefined" ? __APP_VERSION__ : "dev";
|
||||
const version =
|
||||
typeof __APP_VERSION__ !== 'undefined' ? __APP_VERSION__ : 'dev';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from "vue";
|
||||
import { onClickOutside } from "@vueuse/core";
|
||||
import CustomButton from "./CustomButton.vue";
|
||||
import { ref, computed } from 'vue';
|
||||
import { onClickOutside } from '@vueuse/core';
|
||||
import CustomButton from './CustomButton.vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
walletAddress: string | null;
|
||||
variant?: "primary" | "secondary" | "outline";
|
||||
variant?: 'primary' | 'secondary' | 'outline';
|
||||
showMenu?: boolean;
|
||||
}>(),
|
||||
{
|
||||
variant: "primary",
|
||||
variant: 'primary',
|
||||
showMenu: true,
|
||||
},
|
||||
);
|
||||
@@ -29,7 +29,7 @@ const isConnected = computed(() => {
|
||||
});
|
||||
|
||||
const formattedAddress = computed(() => {
|
||||
if (!props.walletAddress) return "";
|
||||
if (!props.walletAddress) return '';
|
||||
|
||||
const address = props.walletAddress;
|
||||
const length = address.length;
|
||||
@@ -40,17 +40,17 @@ const formattedAddress = computed(() => {
|
||||
});
|
||||
|
||||
const handleConnect = () => {
|
||||
emit("connect");
|
||||
emit('connect');
|
||||
};
|
||||
|
||||
const handleDisconnect = () => {
|
||||
menuOpen.value = false;
|
||||
emit("disconnect");
|
||||
emit('disconnect');
|
||||
};
|
||||
|
||||
const handleViewTransactions = () => {
|
||||
menuOpen.value = false;
|
||||
emit("viewTransactions");
|
||||
emit('viewTransactions');
|
||||
};
|
||||
|
||||
const toggleMenu = () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { NetworkConfig } from "@/model/NetworkEnum";
|
||||
import { ref, computed, type Ref } from "vue";
|
||||
import { isTestnetEnvironment } from "@/config/networks";
|
||||
import { sepolia, rootstock, rootstockTestnet } from "viem/chains";
|
||||
import { NetworkConfig } from '@/model/NetworkEnum';
|
||||
import { ref, computed, type Ref } from 'vue';
|
||||
import { isTestnetEnvironment } from '@/config/networks';
|
||||
import { sepolia, rootstock, rootstockTestnet } from 'viem/chains';
|
||||
|
||||
export interface Transaction {
|
||||
id: string;
|
||||
type: "deposit" | "lock" | "release" | "return";
|
||||
type: 'deposit' | 'lock' | 'release' | 'return';
|
||||
timestamp: string;
|
||||
blockTimestamp: string;
|
||||
seller?: string;
|
||||
@@ -25,19 +25,19 @@ export interface AnalyticsData {
|
||||
}
|
||||
|
||||
export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
const searchAddress = ref("");
|
||||
const selectedType = ref("all");
|
||||
const searchAddress = ref('');
|
||||
const selectedType = ref('all');
|
||||
const loading = ref(false);
|
||||
const error = ref<string | null>(null);
|
||||
const analyticsLoading = ref(false);
|
||||
|
||||
const transactionsData = ref<Transaction[]>([]);
|
||||
const analyticsData = ref<AnalyticsData>({
|
||||
totalVolume: "0",
|
||||
totalTransactions: "0",
|
||||
totalLocks: "0",
|
||||
totalDeposits: "0",
|
||||
totalReleases: "0",
|
||||
totalVolume: '0',
|
||||
totalTransactions: '0',
|
||||
totalLocks: '0',
|
||||
totalDeposits: '0',
|
||||
totalReleases: '0',
|
||||
});
|
||||
|
||||
const executeQuery = async (query: string, variables: any = {}) => {
|
||||
@@ -45,9 +45,9 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
query,
|
||||
@@ -62,12 +62,12 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
const data = await response.json();
|
||||
|
||||
if (data.errors) {
|
||||
throw new Error(data.errors[0]?.message || "GraphQL error");
|
||||
throw new Error(data.errors[0]?.message || 'GraphQL error');
|
||||
}
|
||||
|
||||
return data.data;
|
||||
} catch (err) {
|
||||
console.error("GraphQL query error:", err);
|
||||
console.error('GraphQL query error:', err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
@@ -131,7 +131,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
transactionsData.value = processActivityData(data);
|
||||
} catch (err) {
|
||||
error.value =
|
||||
err instanceof Error ? err.message : "Failed to fetch transactions";
|
||||
err instanceof Error ? err.message : 'Failed to fetch transactions';
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
error.value =
|
||||
err instanceof Error
|
||||
? err.message
|
||||
: "Failed to fetch user transactions";
|
||||
: 'Failed to fetch user transactions';
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -207,11 +207,11 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
const clearData = () => {
|
||||
transactionsData.value = [];
|
||||
analyticsData.value = {
|
||||
totalVolume: "0",
|
||||
totalTransactions: "0",
|
||||
totalLocks: "0",
|
||||
totalDeposits: "0",
|
||||
totalReleases: "0",
|
||||
totalVolume: '0',
|
||||
totalTransactions: '0',
|
||||
totalLocks: '0',
|
||||
totalDeposits: '0',
|
||||
totalReleases: '0',
|
||||
};
|
||||
};
|
||||
|
||||
@@ -246,7 +246,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
const data = await executeQuery(query);
|
||||
analyticsData.value = processAnalyticsData(data);
|
||||
} catch (err) {
|
||||
console.error("Failed to fetch analytics:", err);
|
||||
console.error('Failed to fetch analytics:', err);
|
||||
} finally {
|
||||
analyticsLoading.value = false;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
blockNumber: deposit.blockNumber,
|
||||
blockTimestamp: deposit.blockTimestamp,
|
||||
transactionHash: deposit.transactionHash,
|
||||
type: "deposit",
|
||||
type: 'deposit',
|
||||
seller: deposit.seller,
|
||||
buyer: undefined,
|
||||
amount: deposit.amount,
|
||||
@@ -281,7 +281,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
blockNumber: withdrawal.blockNumber,
|
||||
blockTimestamp: withdrawal.blockTimestamp,
|
||||
transactionHash: withdrawal.transactionHash,
|
||||
type: "deposit", // Treat as deposit withdrawal
|
||||
type: 'deposit', // Treat as deposit withdrawal
|
||||
seller: withdrawal.seller,
|
||||
buyer: undefined,
|
||||
amount: withdrawal.amount,
|
||||
@@ -298,7 +298,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
blockNumber: lock.blockNumber,
|
||||
blockTimestamp: lock.blockTimestamp,
|
||||
transactionHash: lock.transactionHash,
|
||||
type: "lock",
|
||||
type: 'lock',
|
||||
seller: lock.seller,
|
||||
buyer: lock.buyer,
|
||||
amount: lock.amount,
|
||||
@@ -315,11 +315,11 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
blockNumber: release.blockNumber,
|
||||
blockTimestamp: release.blockTimestamp,
|
||||
transactionHash: release.transactionHash,
|
||||
type: "release",
|
||||
type: 'release',
|
||||
seller: undefined, // Release doesn't have seller info
|
||||
buyer: release.buyer,
|
||||
amount: release.amount,
|
||||
token: "BRZ", // Default token
|
||||
token: 'BRZ', // Default token
|
||||
timestamp: formatTimestamp(release.blockTimestamp),
|
||||
});
|
||||
});
|
||||
@@ -332,11 +332,11 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
blockNumber: returnTx.blockNumber,
|
||||
blockTimestamp: returnTx.blockTimestamp,
|
||||
transactionHash: returnTx.transactionHash,
|
||||
type: "return",
|
||||
type: 'return',
|
||||
seller: undefined, // Return doesn't have seller info
|
||||
buyer: returnTx.buyer,
|
||||
amount: "0", // Return doesn't have amount
|
||||
token: "BRZ", // Default token
|
||||
amount: '0', // Return doesn't have amount
|
||||
token: 'BRZ', // Default token
|
||||
timestamp: formatTimestamp(returnTx.blockTimestamp),
|
||||
});
|
||||
});
|
||||
@@ -351,7 +351,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
const now = Date.now() / 1000;
|
||||
const diff = now - parseInt(timestamp);
|
||||
|
||||
if (diff < 60) return "Just now";
|
||||
if (diff < 60) return 'Just now';
|
||||
if (diff < 3600) return `${Math.floor(diff / 60)} minutes ago`;
|
||||
if (diff < 86400) return `${Math.floor(diff / 3600)} hours ago`;
|
||||
return `${Math.floor(diff / 86400)} days ago`;
|
||||
@@ -372,11 +372,11 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
const processAnalyticsData = (data: any): AnalyticsData => {
|
||||
if (!data) {
|
||||
return {
|
||||
totalVolume: "0",
|
||||
totalTransactions: "0",
|
||||
totalLocks: "0",
|
||||
totalDeposits: "0",
|
||||
totalReleases: "0",
|
||||
totalVolume: '0',
|
||||
totalTransactions: '0',
|
||||
totalLocks: '0',
|
||||
totalDeposits: '0',
|
||||
totalReleases: '0',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
|
||||
if (data.depositAddeds) {
|
||||
data.depositAddeds.forEach((deposit: any) => {
|
||||
totalVolume += parseFloat(deposit.amount || "0");
|
||||
totalVolume += parseFloat(deposit.amount || '0');
|
||||
totalTransactions++;
|
||||
totalDeposits++;
|
||||
});
|
||||
@@ -396,14 +396,14 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
|
||||
if (data.depositWithdrawns) {
|
||||
data.depositWithdrawns.forEach((withdrawal: any) => {
|
||||
totalVolume += parseFloat(withdrawal.amount || "0");
|
||||
totalVolume += parseFloat(withdrawal.amount || '0');
|
||||
totalTransactions++;
|
||||
});
|
||||
}
|
||||
|
||||
if (data.lockAddeds) {
|
||||
data.lockAddeds.forEach((lock: any) => {
|
||||
totalVolume += parseFloat(lock.amount || "0");
|
||||
totalVolume += parseFloat(lock.amount || '0');
|
||||
totalTransactions++;
|
||||
totalLocks++;
|
||||
});
|
||||
@@ -411,7 +411,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
|
||||
if (data.lockReleaseds) {
|
||||
data.lockReleaseds.forEach((release: any) => {
|
||||
totalVolume += parseFloat(release.amount || "0");
|
||||
totalVolume += parseFloat(release.amount || '0');
|
||||
totalTransactions++;
|
||||
totalReleases++;
|
||||
});
|
||||
@@ -437,7 +437,7 @@ export function useGraphQL(network: Ref<NetworkConfig>) {
|
||||
const filteredTransactions = computed(() => {
|
||||
let filtered = transactionsData.value;
|
||||
|
||||
if (selectedType.value !== "all") {
|
||||
if (selectedType.value !== 'all') {
|
||||
filtered = filtered.filter((tx) => tx.type === selectedType.value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { ref } from "vue";
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import type { Participant } from "../utils/bbPay";
|
||||
import type { Address } from "viem";
|
||||
import { DEFAULT_NETWORK, Networks } from "@/config/networks";
|
||||
import { TokenEnum, NetworkConfig } from "@/model/NetworkEnum";
|
||||
import { ref } from 'vue';
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import type { Participant } from '../utils/bbPay';
|
||||
import type { Address } from 'viem';
|
||||
import { DEFAULT_NETWORK, Networks } from '@/config/networks';
|
||||
import { TokenEnum, NetworkConfig } from '@/model/NetworkEnum';
|
||||
|
||||
const walletAddress = ref<Address | null>(null);
|
||||
const balance = ref("");
|
||||
const balance = ref('');
|
||||
const network = ref(DEFAULT_NETWORK);
|
||||
const selectedToken = ref<TokenEnum>(TokenEnum.BRZ);
|
||||
const loadingLock = ref(false);
|
||||
@@ -15,7 +15,7 @@ const depositsValidList = ref<ValidDeposit[]>([]);
|
||||
const loadingWalletTransactions = ref(false);
|
||||
const loadingNetworkLiquidity = ref(false);
|
||||
const seller = ref<Participant>({} as Participant);
|
||||
const sellerId = ref("");
|
||||
const sellerId = ref('');
|
||||
|
||||
export function useUser() {
|
||||
// Actions become regular functions
|
||||
@@ -38,9 +38,9 @@ export function useUser() {
|
||||
const setNetworkById = (id: string | number) => {
|
||||
let chainId: number;
|
||||
|
||||
if (typeof id === "string") {
|
||||
if (typeof id === 'string') {
|
||||
// Parse hex string or number string to number
|
||||
if (id.startsWith("0x")) {
|
||||
if (id.startsWith('0x')) {
|
||||
chainId = parseInt(id, 16);
|
||||
} else {
|
||||
chainId = parseInt(id, 10);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { mainnet, sepolia, rootstock, rootstockTestnet } from "viem/chains";
|
||||
import { NetworkConfig } from "@/model/NetworkEnum";
|
||||
import { mainnet, sepolia, rootstock, rootstockTestnet } from 'viem/chains';
|
||||
import { NetworkConfig } from '@/model/NetworkEnum';
|
||||
// TODO: import addresses from p2pix-smart-contracts deployments
|
||||
|
||||
export const Networks: { [key: string]: NetworkConfig } = {
|
||||
|
||||
12
src/main.ts
12
src/main.ts
@@ -1,12 +1,12 @@
|
||||
import { createApp } from "vue";
|
||||
import App from "./App.vue";
|
||||
import router from "./router";
|
||||
import { createApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
|
||||
import "./assets/main.css";
|
||||
import "./assets/transitions.css";
|
||||
import './assets/main.css';
|
||||
import './assets/transitions.css';
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
app.use(router);
|
||||
|
||||
app.mount("#app");
|
||||
app.mount('#app');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Address } from "viem";
|
||||
import type { Address } from 'viem';
|
||||
|
||||
export enum LockStatus {
|
||||
// from DataTypes.sol
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Chain, ChainContract } from "viem";
|
||||
import type { Chain, ChainContract } from 'viem';
|
||||
|
||||
export enum TokenEnum {
|
||||
BRZ = "BRZ",
|
||||
BRZ = 'BRZ',
|
||||
// BRX = 'BRX'
|
||||
}
|
||||
export type NetworkConfig = Chain & {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Address } from "viem";
|
||||
import { Address } from 'viem';
|
||||
|
||||
export type UnreleasedLock = {
|
||||
lockID: bigint;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Address } from "viem";
|
||||
import type { NetworkConfig } from "@/model/NetworkEnum";
|
||||
import type { Address } from 'viem';
|
||||
import type { NetworkConfig } from '@/model/NetworkEnum';
|
||||
|
||||
export type ValidDeposit = {
|
||||
token: Address;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { LockStatus } from "@/model/LockStatus";
|
||||
import type { Address } from "viem";
|
||||
import type { LockStatus } from '@/model/LockStatus';
|
||||
import type { Address } from 'viem';
|
||||
|
||||
export type WalletTransaction = {
|
||||
token?: Address;
|
||||
|
||||
@@ -2,54 +2,54 @@ import {
|
||||
createRouter,
|
||||
createWebHistory,
|
||||
createWebHashHistory,
|
||||
} from "vue-router";
|
||||
import HomeView from "@/views/HomeView.vue";
|
||||
import FaqView from "@/views/FaqView.vue";
|
||||
import ManageBidsView from "@/views/ManageBidsView.vue";
|
||||
import SellerView from "@/views/SellerView.vue";
|
||||
import ExploreView from "@/views/ExploreView.vue";
|
||||
import VersionsView from "@/views/VersionsView.vue";
|
||||
} from 'vue-router';
|
||||
import HomeView from '@/views/HomeView.vue';
|
||||
import FaqView from '@/views/FaqView.vue';
|
||||
import ManageBidsView from '@/views/ManageBidsView.vue';
|
||||
import SellerView from '@/views/SellerView.vue';
|
||||
import ExploreView from '@/views/ExploreView.vue';
|
||||
import VersionsView from '@/views/VersionsView.vue';
|
||||
|
||||
const router = createRouter({
|
||||
history:
|
||||
import.meta.env.MODE === "production" && import.meta.env.BASE_URL === "./"
|
||||
import.meta.env.MODE === 'production' && import.meta.env.BASE_URL === './'
|
||||
? createWebHashHistory()
|
||||
: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: HomeView,
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "/:lockID",
|
||||
name: "redirect buy",
|
||||
path: '/:lockID',
|
||||
name: 'redirect buy',
|
||||
component: HomeView,
|
||||
},
|
||||
{
|
||||
path: "/seller",
|
||||
name: "seller",
|
||||
path: '/seller',
|
||||
name: 'seller',
|
||||
component: SellerView,
|
||||
},
|
||||
{
|
||||
path: "/manage_bids",
|
||||
name: "manage bids",
|
||||
path: '/manage_bids',
|
||||
name: 'manage bids',
|
||||
component: ManageBidsView,
|
||||
},
|
||||
{
|
||||
path: "/faq",
|
||||
name: "faq",
|
||||
path: '/faq',
|
||||
name: 'faq',
|
||||
component: FaqView,
|
||||
},
|
||||
{
|
||||
path: "/explore",
|
||||
name: "explore",
|
||||
path: '/explore',
|
||||
name: 'explore',
|
||||
component: ExploreView,
|
||||
},
|
||||
{
|
||||
path: "/versions",
|
||||
name: "versions",
|
||||
path: '/versions',
|
||||
name: 'versions',
|
||||
component: VersionsView,
|
||||
},
|
||||
],
|
||||
|
||||
4
src/shims-vue.d.ts
vendored
4
src/shims-vue.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
declare module "*.vue" {
|
||||
import { DefineComponent } from "vue";
|
||||
declare module '*.vue' {
|
||||
import { DefineComponent } from 'vue';
|
||||
const component: DefineComponent;
|
||||
export default component;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
module.exports = {
|
||||
process() {
|
||||
return {
|
||||
code: `module.exports = {};`,
|
||||
code: 'module.exports = {};',
|
||||
};
|
||||
},
|
||||
getCacheKey() {
|
||||
// The output is always the same.
|
||||
return "svgTransform";
|
||||
return 'svgTransform';
|
||||
},
|
||||
};
|
||||
|
||||
@@ -23,9 +23,9 @@ export interface Offer {
|
||||
|
||||
export const createParticipant = async (participant: Participant) => {
|
||||
const response = await fetch(`${import.meta.env.VITE_APP_API_URL}/register`, {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
chainID: participant.chainID,
|
||||
@@ -49,13 +49,13 @@ export const createParticipant = async (participant: Participant) => {
|
||||
|
||||
export const createSolicitation = async (offer: Offer) => {
|
||||
const response = await fetch(`${import.meta.env.VITE_APP_API_URL}/request`, {
|
||||
method: "POST",
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
amount: offer.amount,
|
||||
pixTarget: offer.sellerId.split("-").pop(),
|
||||
pixTarget: offer.sellerId.split('-').pop(),
|
||||
}),
|
||||
});
|
||||
return response.json();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const decimalCount = (numStr: string): number => {
|
||||
if (numStr.includes(".")) {
|
||||
return numStr.split(".")[1].length;
|
||||
if (numStr.includes('.')) {
|
||||
return numStr.split('.')[1].length;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { TokenEnum } from "@/model/NetworkEnum";
|
||||
import { Networks } from "@/config/networks";
|
||||
import type { TokenEnum } from '@/model/NetworkEnum';
|
||||
import { Networks } from '@/config/networks';
|
||||
|
||||
export const getNetworkImage = (networkName: string): string => {
|
||||
const normalizedName = networkName.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
||||
const normalizedName = networkName.toLowerCase().replace(/[^a-z0-9]/g, '-');
|
||||
return new URL(`../assets/networks/${normalizedName}.svg`, import.meta.url)
|
||||
.href;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import type { Address } from "viem";
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import type { Address } from 'viem';
|
||||
|
||||
const verifyNetworkLiquidity = (
|
||||
tokenValue: number,
|
||||
|
||||
@@ -11,6 +11,6 @@ export const pixFormatValidation = (pixKey: string): boolean => {
|
||||
};
|
||||
|
||||
export const postProcessKey = (pixKey: string): string => {
|
||||
pixKey = pixKey.replace(/[-.()/]/g, "");
|
||||
pixKey = pixKey.replace(/[-.()/]/g, '');
|
||||
return pixKey;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { AppVersion } from "@/model/AppVersion";
|
||||
import type { AppVersion } from '@/model/AppVersion';
|
||||
|
||||
export const appVersions: AppVersion[] = [
|
||||
{
|
||||
tag: "1.1.0",
|
||||
ipfsHash: "bafybeiaffdxrxoex3qh7kirnkkufnvpafb4gmkt7mjxufnnpbrq6tmqoha",
|
||||
releaseDate: "2025-11-06",
|
||||
description: "Explorer and versioning features added",
|
||||
tag: '1.1.0',
|
||||
ipfsHash: 'bafybeiaffdxrxoex3qh7kirnkkufnvpafb4gmkt7mjxufnnpbrq6tmqoha',
|
||||
releaseDate: '2025-11-06',
|
||||
description: 'Explorer and versioning features added',
|
||||
},
|
||||
{
|
||||
tag: "1.0.0",
|
||||
ipfsHash: "bafybeiagfqnxnb5zdrks6dicfm7kxjdtzzzzm2ouluxgdseg2hrrotayzi",
|
||||
releaseDate: "2023-01-28",
|
||||
description: "Initial release",
|
||||
tag: '1.0.0',
|
||||
ipfsHash: 'bafybeiagfqnxnb5zdrks6dicfm7kxjdtzzzzm2ouluxgdseg2hrrotayzi',
|
||||
releaseDate: '2023-01-28',
|
||||
description: 'Initial release',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, watch } from "vue";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { useGraphQL } from "@/composables/useGraphQL";
|
||||
import FormCard from "@/components/ui/FormCard.vue";
|
||||
import LoadingComponent from "@/components/ui/LoadingComponent.vue";
|
||||
import AnalyticsCard from "@/components/Explorer/AnalyticsCard.vue";
|
||||
import TransactionTable from "@/components/Explorer/TransactionTable.vue";
|
||||
import { onMounted, watch } from 'vue';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import { useGraphQL } from '@/composables/useGraphQL';
|
||||
import FormCard from '@/components/ui/FormCard.vue';
|
||||
import LoadingComponent from '@/components/ui/LoadingComponent.vue';
|
||||
import AnalyticsCard from '@/components/Explorer/AnalyticsCard.vue';
|
||||
import TransactionTable from '@/components/Explorer/TransactionTable.vue';
|
||||
|
||||
const user = useUser();
|
||||
const { network } = user;
|
||||
@@ -25,11 +25,11 @@ const {
|
||||
} = useGraphQL(network);
|
||||
|
||||
const transactionTypes = [
|
||||
{ key: "all", label: "Todas" },
|
||||
{ key: "deposit", label: "Depósitos" },
|
||||
{ key: "lock", label: "Bloqueios" },
|
||||
{ key: "release", label: "Liberações" },
|
||||
{ key: "return", label: "Retornos" },
|
||||
{ key: 'all', label: 'Todas' },
|
||||
{ key: 'deposit', label: 'Depósitos' },
|
||||
{ key: 'lock', label: 'Bloqueios' },
|
||||
{ key: 'release', label: 'Liberações' },
|
||||
{ key: 'return', label: 'Retornos' },
|
||||
];
|
||||
|
||||
const handleTypeFilter = (type: string) => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { Faq } from "@/model/Faq";
|
||||
import { ref } from "vue";
|
||||
import { marked } from "marked";
|
||||
import faqContent from "@/utils/files/faqContent.json";
|
||||
import type { Faq } from '@/model/Faq';
|
||||
import { ref } from 'vue';
|
||||
import { marked } from 'marked';
|
||||
import faqContent from '@/utils/files/faqContent.json';
|
||||
|
||||
const faq = ref<Faq>(faqContent);
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import SearchComponent from "@/components/BuyerSteps/BuyerSearchComponent.vue";
|
||||
import LoadingComponent from "@/components/ui/LoadingComponent.vue";
|
||||
import BuyConfirmedComponent from "@/components/BuyerSteps/BuyConfirmedComponent.vue";
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import QrCodeComponent from "@/components/BuyerSteps/QrCodeComponent.vue";
|
||||
import { addLock, releaseLock } from "@/blockchain/buyerMethods";
|
||||
import { updateWalletStatus, checkUnreleasedLock } from "@/blockchain/wallet";
|
||||
import { getNetworksLiquidity } from "@/blockchain/events";
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import { getUnreleasedLockById } from "@/blockchain/events";
|
||||
import CustomAlert from "@/components/ui/CustomAlert.vue";
|
||||
import { getSolicitation } from "@/utils/bbPay";
|
||||
import type { Address } from "viem";
|
||||
import SearchComponent from '@/components/BuyerSteps/BuyerSearchComponent.vue';
|
||||
import LoadingComponent from '@/components/ui/LoadingComponent.vue';
|
||||
import BuyConfirmedComponent from '@/components/BuyerSteps/BuyConfirmedComponent.vue';
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import QrCodeComponent from '@/components/BuyerSteps/QrCodeComponent.vue';
|
||||
import { addLock, releaseLock } from '@/blockchain/buyerMethods';
|
||||
import { updateWalletStatus, checkUnreleasedLock } from '@/blockchain/wallet';
|
||||
import { getNetworksLiquidity } from '@/blockchain/events';
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import { getUnreleasedLockById } from '@/blockchain/events';
|
||||
import CustomAlert from '@/components/ui/CustomAlert.vue';
|
||||
import { getSolicitation } from '@/utils/bbPay';
|
||||
import type { Address } from 'viem';
|
||||
|
||||
enum Step {
|
||||
Search,
|
||||
@@ -29,7 +29,7 @@ const flowStep = ref<Step>(Step.Search);
|
||||
const participantID = ref<string>();
|
||||
const sellerAddress = ref<Address>();
|
||||
const tokenAmount = ref<number>();
|
||||
const lockID = ref<string>("");
|
||||
const lockID = ref<string>('');
|
||||
const loadingRelease = ref<boolean>(false);
|
||||
const showModal = ref<boolean>(false);
|
||||
const showBuyAlert = ref<boolean>(false);
|
||||
@@ -78,7 +78,7 @@ const releaseTransaction = async (params: {
|
||||
};
|
||||
|
||||
const checkForUnreleasedLocks = async (): Promise<void> => {
|
||||
if (!walletAddress.value) throw new Error("Wallet not connected");
|
||||
if (!walletAddress.value) throw new Error('Wallet not connected');
|
||||
const lock = await checkUnreleasedLock(walletAddress.value);
|
||||
if (lock) {
|
||||
lockID.value = String(lock.lockID);
|
||||
@@ -114,7 +114,7 @@ if (paramLockID) {
|
||||
onMounted(async () => {
|
||||
await getNetworksLiquidity();
|
||||
if (walletAddress.value && !paramLockID) await checkForUnreleasedLocks();
|
||||
window.history.state.lockID = "";
|
||||
window.history.state.lockID = '';
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from "vue";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import ListingComponent from "@/components/ListingComponent/ListingComponent.vue";
|
||||
import LoadingComponent from "@/components/ui/LoadingComponent.vue";
|
||||
import CustomAlert from "@/components/ui/CustomAlert.vue";
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import ListingComponent from '@/components/ListingComponent/ListingComponent.vue';
|
||||
import LoadingComponent from '@/components/ui/LoadingComponent.vue';
|
||||
import CustomAlert from '@/components/ui/CustomAlert.vue';
|
||||
import {
|
||||
listValidDepositTransactionsByWalletAddress,
|
||||
listAllTransactionByWalletAddress,
|
||||
getActiveLockAmount,
|
||||
} from "@/blockchain/wallet";
|
||||
import { withdrawDeposit } from "@/blockchain/buyerMethods";
|
||||
import type { ValidDeposit } from "@/model/ValidDeposit";
|
||||
import type { WalletTransaction } from "@/model/WalletTransaction";
|
||||
} from '@/blockchain/wallet';
|
||||
import { withdrawDeposit } from '@/blockchain/buyerMethods';
|
||||
import type { ValidDeposit } from '@/model/ValidDeposit';
|
||||
import type { WalletTransaction } from '@/model/WalletTransaction';
|
||||
|
||||
import router from "@/router/index";
|
||||
import router from '@/router/index';
|
||||
|
||||
const user = useUser();
|
||||
const { walletAddress, network, selectedToken } = user;
|
||||
@@ -38,11 +38,11 @@ const callWithdraw = async (amount: string) => {
|
||||
}
|
||||
|
||||
if (withdraw) {
|
||||
console.log("Saque realizado!");
|
||||
console.log('Saque realizado!');
|
||||
await getWalletTransactions();
|
||||
showAlert.value = true;
|
||||
} else {
|
||||
console.log("Não foi possível realizar o saque!");
|
||||
console.log('Não foi possível realizar o saque!');
|
||||
}
|
||||
loadingWithdraw.value = false;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ const getWalletTransactions = async () => {
|
||||
|
||||
onMounted(async () => {
|
||||
if (!walletAddress.value) {
|
||||
router.push({ name: "home" });
|
||||
router.push({ name: 'home' });
|
||||
}
|
||||
await getWalletTransactions();
|
||||
});
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { ref } from 'vue';
|
||||
|
||||
import SellerComponent from "@/components/SellerSteps/SellerComponent.vue";
|
||||
import SendNetwork from "@/components/SellerSteps/SendNetwork.vue";
|
||||
import LoadingComponent from "@/components/ui/LoadingComponent.vue";
|
||||
import { useUser } from "@/composables/useUser";
|
||||
import { approveTokens, addDeposit } from "@/blockchain/sellerMethods";
|
||||
import CustomAlert from "@/components/ui/CustomAlert.vue";
|
||||
import type { Participant } from "@/utils/bbPay";
|
||||
import SellerComponent from '@/components/SellerSteps/SellerComponent.vue';
|
||||
import SendNetwork from '@/components/SellerSteps/SendNetwork.vue';
|
||||
import LoadingComponent from '@/components/ui/LoadingComponent.vue';
|
||||
import { useUser } from '@/composables/useUser';
|
||||
import { approveTokens, addDeposit } from '@/blockchain/sellerMethods';
|
||||
import CustomAlert from '@/components/ui/CustomAlert.vue';
|
||||
import type { Participant } from '@/utils/bbPay';
|
||||
|
||||
enum Step {
|
||||
Search,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { appVersions, getIpfsUrl, getLatestVersion } from "@/utils/versions";
|
||||
import type { AppVersion } from "@/model/AppVersion";
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { appVersions, getIpfsUrl, getLatestVersion } from '@/utils/versions';
|
||||
import type { AppVersion } from '@/model/AppVersion';
|
||||
|
||||
const versions = ref<AppVersion[]>([]);
|
||||
const latestVersion = ref<AppVersion | null>(null);
|
||||
@@ -17,15 +17,15 @@ onMounted(() => {
|
||||
|
||||
const openIpfsVersion = (ipfsHash: string) => {
|
||||
const url = getIpfsUrl(ipfsHash);
|
||||
window.open(url, "_blank", "noopener,noreferrer");
|
||||
window.open(url, '_blank', 'noopener,noreferrer');
|
||||
};
|
||||
|
||||
const formatDate = (dateString: string): string => {
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString("pt-BR", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
return date.toLocaleDateString('pt-BR', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user