- Standardized the use of quotes and spacing in various files. - Removed unnecessary line breaks and trailing spaces in components. - Improved the structure of computed properties and methods for better clarity. - Enhanced the consistency of prop definitions and emit events in Vue components. - Updated the GraphQL composable to streamline error handling and data processing. - Refactored network configuration files for better organization and readability. - Cleaned up model files by removing redundant lines and ensuring consistent formatting. - Adjusted router configuration for improved readability. - Enhanced utility functions for better maintainability and clarity.
41 lines
987 B
TypeScript
41 lines
987 B
TypeScript
import type { ValidDeposit } from "@/model/ValidDeposit";
|
|
import type { Address } from "viem";
|
|
|
|
const verifyNetworkLiquidity = (
|
|
tokenValue: number,
|
|
walletAddress: Address,
|
|
validDepositList: ValidDeposit[],
|
|
): ValidDeposit[] => {
|
|
const filteredDepositList = validDepositList
|
|
.filter((element) => {
|
|
const remaining = element.remaining;
|
|
if (
|
|
tokenValue! <= remaining &&
|
|
tokenValue! != 0 &&
|
|
element.seller !== walletAddress
|
|
) {
|
|
return true;
|
|
}
|
|
return false;
|
|
})
|
|
.sort((a, b) => {
|
|
return b.remaining - a.remaining;
|
|
});
|
|
|
|
const uniqueNetworkDeposits = filteredDepositList.reduce(
|
|
(acc: ValidDeposit[], current) => {
|
|
const existingNetwork = acc.find(
|
|
(deposit) => deposit.network === current.network,
|
|
);
|
|
if (!existingNetwork) {
|
|
acc.push(current);
|
|
}
|
|
return acc;
|
|
},
|
|
[],
|
|
);
|
|
return uniqueNetworkDeposits;
|
|
};
|
|
|
|
export { verifyNetworkLiquidity };
|