Fixing amount formatting in release function and adding 'Reserva' to listing component

This commit is contained in:
Bruno 2022-12-07 21:52:58 -03:00
parent 50835c94ed
commit 51ba98f752
3 changed files with 7 additions and 13 deletions

View File

@ -72,7 +72,7 @@ const props = defineProps({
<div class="blur-container">
<div class="flex flex-row justify-between w-full bg-white p-5 rounded-lg" v-for="deposit in lastDeposits" :key="deposit?.blockNumber">
<p class="last-deposit-info">{{blockchain.formatBigNumber(deposit?.args.amount)}} BRZ</p>
<p class="last-deposit-info">{{deposit?.event == 'DepositAdded' ? 'Depósito' : 'Compra'}}</p>
<p class="last-deposit-info">{{deposit?.event == 'DepositAdded' ? 'Depósito' : deposit?.event == 'LockAdded' ? 'Reserva' : 'Compra'}}</p>
<div class="flex gap-2 cursor-pointer items-center" @click="openEtherscanUrl(`https://etherscan.io/tx/${deposit?.transactionHash}`)">
<p class="last-deposit-info">Etherscan</p>
<img alt="Redirect image" src="@/assets/redirect.svg"/>

View File

@ -55,10 +55,13 @@ const listTransactionByWalletAddress = async (walletAddress: string): Promise<an
const filterDeposits = p2pContract.filters.DepositAdded([walletAddress]);
const eventsDeposits = await p2pContract.queryFilter(filterDeposits);
const filterAddedLocks = p2pContract.filters.LockAdded([walletAddress]);
const eventsAddedLocks = await p2pContract.queryFilter(filterAddedLocks);
const filterReleasedLocks = p2pContract.filters.LockReleased([walletAddress]);
const eventsReleasedLocks = await p2pContract.queryFilter(filterReleasedLocks);
return [...eventsDeposits, ...eventsReleasedLocks].sort((a, b) => {
return [...eventsDeposits, ...eventsAddedLocks, ...eventsReleasedLocks].sort((a, b) => {
return b.blockNumber - a.blockNumber
})
}
@ -232,7 +235,7 @@ const mapLocks = async (lockId: string) => {
};
// Releases lock by specific ID and other additional data
const releaseLock = async (pixKey: string, amount: Number, e2eId: Number, lockId: string) => {
const releaseLock = async (pixKey: string, amount: string, e2eId: Number, lockId: string) => {
const provider = getProvider();
if (!provider) return;
@ -246,7 +249,7 @@ const releaseLock = async (pixKey: string, amount: Number, e2eId: Number, lockId
],
[
pixKey,
amount,
formatEther(amount),
e2eId
]
)

View File

@ -44,11 +44,6 @@ const mapDeposit = (depositId: BigNumber) => {
};
// Lock methods
// (TO DO) Releases lock by specific ID and other additional data
const releaseLock = () => {
blockchain.releaseLock();
};
// Get specific lock data by its ID
const mapLock = (lockId: string) => {
blockchain.mapLocks(lockId);
@ -81,10 +76,6 @@ const mapLock = (lockId: string) => {
<button type="button" class="default-button" @click="splitTokens()">
Dividir tokens
</button>
<button type="button" class="default-button" @click="releaseLock()">
Release Lock
</button>
</div>
<ul class="flex flex-col justify-center items-center gap-4">