Improve return from valid deposits to consider multiple deposit reduced in one for same account and consider changing of network and account to verify liquidity on Search Component
Co-authored-by: brunoedcf <brest.dallacosta@outlook.com>
This commit is contained in:
parent
d569294648
commit
11499661ea
@ -63,8 +63,9 @@ const getValidDeposits = async (
|
|||||||
const eventsDeposits = await p2pContract.queryFilter(filterDeposits);
|
const eventsDeposits = await p2pContract.queryFilter(filterDeposits);
|
||||||
|
|
||||||
if (!contract) p2pContract = getContract(); // get metamask provider contract
|
if (!contract) p2pContract = getContract(); // get metamask provider contract
|
||||||
|
const depositList: { [key: string]: ValidDeposit } = {};
|
||||||
|
|
||||||
const depositList = await Promise.all(
|
await Promise.all(
|
||||||
eventsDeposits.map(async (deposit) => {
|
eventsDeposits.map(async (deposit) => {
|
||||||
// Get liquidity only for the selected token
|
// Get liquidity only for the selected token
|
||||||
if (deposit.args?.token != token) return null;
|
if (deposit.args?.token != token) return null;
|
||||||
@ -91,11 +92,11 @@ const getValidDeposits = async (
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return validDeposit;
|
if (validDeposit) depositList[deposit.args?.seller + token] = validDeposit;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
return depositList.filter((deposit) => deposit) as ValidDeposit[];
|
return Object.values(depositList);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { getValidDeposits, getNetworksLiquidity };
|
export { getValidDeposits, getNetworksLiquidity };
|
||||||
|
@ -107,8 +107,13 @@ const enableOrDisableConfirmButton = (): void => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
watch(networkName, (): void => {
|
watch(networkName, (): void => {
|
||||||
|
verifyLiquidity();
|
||||||
enableOrDisableConfirmButton();
|
enableOrDisableConfirmButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(walletAddress, (): void => {
|
||||||
|
verifyLiquidity();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user