Fixing amount formatting in release function and adding 'Reserva' to listing component
This commit is contained in:
parent
50835c94ed
commit
51ba98f752
@ -72,7 +72,7 @@ const props = defineProps({
|
|||||||
<div class="blur-container">
|
<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">
|
<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">{{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}`)">
|
<div class="flex gap-2 cursor-pointer items-center" @click="openEtherscanUrl(`https://etherscan.io/tx/${deposit?.transactionHash}`)">
|
||||||
<p class="last-deposit-info">Etherscan</p>
|
<p class="last-deposit-info">Etherscan</p>
|
||||||
<img alt="Redirect image" src="@/assets/redirect.svg"/>
|
<img alt="Redirect image" src="@/assets/redirect.svg"/>
|
||||||
|
@ -55,10 +55,13 @@ const listTransactionByWalletAddress = async (walletAddress: string): Promise<an
|
|||||||
const filterDeposits = p2pContract.filters.DepositAdded([walletAddress]);
|
const filterDeposits = p2pContract.filters.DepositAdded([walletAddress]);
|
||||||
const eventsDeposits = await p2pContract.queryFilter(filterDeposits);
|
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 filterReleasedLocks = p2pContract.filters.LockReleased([walletAddress]);
|
||||||
const eventsReleasedLocks = await p2pContract.queryFilter(filterReleasedLocks);
|
const eventsReleasedLocks = await p2pContract.queryFilter(filterReleasedLocks);
|
||||||
|
|
||||||
return [...eventsDeposits, ...eventsReleasedLocks].sort((a, b) => {
|
return [...eventsDeposits, ...eventsAddedLocks, ...eventsReleasedLocks].sort((a, b) => {
|
||||||
return b.blockNumber - a.blockNumber
|
return b.blockNumber - a.blockNumber
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -232,7 +235,7 @@ const mapLocks = async (lockId: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Releases lock by specific ID and other additional data
|
// 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();
|
const provider = getProvider();
|
||||||
if (!provider) return;
|
if (!provider) return;
|
||||||
|
|
||||||
@ -246,7 +249,7 @@ const releaseLock = async (pixKey: string, amount: Number, e2eId: Number, lockId
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
pixKey,
|
pixKey,
|
||||||
amount,
|
formatEther(amount),
|
||||||
e2eId
|
e2eId
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -44,11 +44,6 @@ const mapDeposit = (depositId: BigNumber) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Lock methods
|
// Lock methods
|
||||||
// (TO DO) Releases lock by specific ID and other additional data
|
|
||||||
const releaseLock = () => {
|
|
||||||
blockchain.releaseLock();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Get specific lock data by its ID
|
// Get specific lock data by its ID
|
||||||
const mapLock = (lockId: string) => {
|
const mapLock = (lockId: string) => {
|
||||||
blockchain.mapLocks(lockId);
|
blockchain.mapLocks(lockId);
|
||||||
@ -81,10 +76,6 @@ const mapLock = (lockId: string) => {
|
|||||||
<button type="button" class="default-button" @click="splitTokens()">
|
<button type="button" class="default-button" @click="splitTokens()">
|
||||||
Dividir tokens
|
Dividir tokens
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button type="button" class="default-button" @click="releaseLock()">
|
|
||||||
Release Lock
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="flex flex-col justify-center items-center gap-4">
|
<ul class="flex flex-col justify-center items-center gap-4">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user