Skip to content

Commit

Permalink
Merge pull request #367 from zkLinkProtocol/fix/category-tvl
Browse files Browse the repository at this point in the history
Fix/category tvl
  • Loading branch information
MickWang authored Oct 10, 2024
2 parents b365fc9 + 6e7a1b7 commit 5629351
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
13 changes: 12 additions & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ export interface TvlCategoryMilestone {
name: string;
data: string;
type: string;
zkl: number
}

interface TvlCategoryMilestoneResponse {
Expand All @@ -696,11 +697,15 @@ interface TvlCategoryMilestoneResponse {
data: TvlCategoryMilestone[];
}

export const getTvlCategoryMilestone = (params: {
export const getTvlCategoryMilestoneBySeason = (params: {
season: number;
}): Promise<TvlCategoryMilestoneResponse> =>
http.get(`${BASE_URL_LRT_POINTS}/tvl/category/milestone/season`, { params });

export const getTvlCategoryMilestone =
(): Promise<TvlCategoryMilestoneResponse> =>
http.get(`${BASE_URL_LRT_POINTS}/tvl/category/milestone`);

export const modifyUsername = (userName: string): Promise<APIResponse> =>
http.post(`${BASE_URL_API}/invite/modify/username`, { userName });

Expand Down Expand Up @@ -832,6 +837,12 @@ export const getCategoryZKL = (): Promise<CategoryZKLResponse> => {
return http.get(`${BASE_URL_LRT_POINTS}/tvl/category/milestone/s2-1`);
};

export const getCategoryZKLE2 = (): Promise<CategoryZKLResponse> => {
return http.get(
`${BASE_URL_LRT_POINTS}/tvl/category/milestone/season?season=2`
);
};

export interface PortocolSpinItem {
projectName: string;
remainSpinNum: number;
Expand Down
15 changes: 12 additions & 3 deletions src/pages/DashboardS2/index2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
TvlCategoryMilestone,
getAccountTvl,
getCategoryZKL,
getCategoryZKLE2,
getExplorerTokenTvl,
getNovaCategoryPoints,
getNovaCategoryUserPoints,
Expand All @@ -18,6 +19,7 @@ import {
getTokenPrice,
getTotalTvlByToken,
getTvlCategoryMilestone,
getTvlCategoryMilestoneBySeason,
} from "@/api";
import { useAccount } from "wagmi";
import EcoDApps from "@/components/DashboardS2/Tabs/EcoDApps";
Expand Down Expand Up @@ -421,7 +423,7 @@ export default function Dashboard() {
TvlCategoryMilestone[]
>([]);
const getTvlCategoryMilestoneFunc = async () => {
const res = await getTvlCategoryMilestone({ season });
const res = await getTvlCategoryMilestone();
console.log("getTvlCategory", res);
setTvlCategoryMilestone(res?.data || []);
};
Expand Down Expand Up @@ -452,7 +454,11 @@ export default function Dashboard() {
const [categoryZKLs, setCategoryZKLs] = useState<CategoryZKLItem[]>([]);

const getCategoryZKLFunc = async () => {
const { data } = await getCategoryZKL();
console.log("epoch", epochActive);
const { data } =
epochActive === 1
? await getTvlCategoryMilestoneBySeason({ season: 2 })
: await getCategoryZKL();
setCategoryZKLs(data || []);
};

Expand Down Expand Up @@ -624,9 +630,12 @@ export default function Dashboard() {
getNovaCategoryPointsFunc();
getNovaCategoryUserPointsFunc();
getNovaCategoryUserPointsTotalFunc();
getCategoryZKLFunc();
}, [address, season]);

useEffect(() => {
getCategoryZKLFunc();
}, [address, epochActive]);

const allSupportedPoints = [
{
name: "Nova Points",
Expand Down
28 changes: 5 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4230,9 +4230,9 @@ camelize@^1.0.0:
integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==

caniuse-lite@^1.0.30001587, caniuse-lite@^1.0.30001599:
version "1.0.30001599"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001599.tgz#571cf4f3f1506df9bf41fcbb6d10d5d017817bce"
integrity sha512-LRAQHZ4yT1+f9LemSMeqdMpMxZcc4RMWdj4tiFe3G8tNkWK+E58g+/tzotb5cU6TbcVJLr4fySiAW7XmxQvZQA==
version "1.0.30001666"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001666.tgz"
integrity sha512-gD14ICmoV5ZZM1OdzPWmpx+q4GyefaK06zi8hmfHV5xe4/2nOQX3+Dw5o+fSqOws2xVwL9j+anOPFwHzdEdV4g==

chalk@^2.4.2:
version "2.4.2"
Expand Down Expand Up @@ -7152,16 +7152,7 @@ strict-uri-encode@^2.0.0:
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -7733,7 +7724,7 @@ which@^2.0.1:
dependencies:
isexe "^2.0.0"

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -7751,15 +7742,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 5629351

Please sign in to comment.