Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: new changes #52

Merged
merged 58 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
ef9f0ac
fix: some type errors
clmntsnr Dec 5, 2024
69eccd9
add: services model draft
clmntsnr Dec 6, 2024
910b806
change: more opportunity types
clmntsnr Dec 6, 2024
1586467
Merge remote-tracking branch 'merkl-lite/fix-errors-update-dappkit' i…
clmntsnr Dec 6, 2024
d14a6e8
fix: lint
clmntsnr Dec 6, 2024
8550018
Merge pull request #1 from AngleProtocol/sync-merkl-lite-chores
clmntsnr Dec 6, 2024
f3c7aa1
add: themes and theme switcher in dev mode (#4)
clmntsnr Dec 6, 2024
48bb14f
Tabs sync (#5)
indaviande Dec 6, 2024
6f6f09a
feat: re add CI (#6)
Picodes Dec 6, 2024
e2ce35f
Feat/leaderboard display (#7)
hugolxt Dec 9, 2024
4a37697
update: dashboard styling (#8)
clmntsnr Dec 9, 2024
473343a
add(front): modal, hero, select, tabs/tags, pagination (#9)
indaviande Dec 9, 2024
08ad823
update: opportunity campaigns/leaderboard view (#11)
clmntsnr Dec 9, 2024
33d71cf
feat: add APR modal and table components for opportunity details on h…
hugolxt Dec 10, 2024
1d89597
Feat Hero campaign and protocol (#13)
hugolxt Dec 11, 2024
1c7f143
feat(opportunity): new hero, tableRow, OpportunityFilters (#15)
indaviande Dec 11, 2024
2b5d86f
:sparkles: sum daily rewards fora protocol (#16)
hugolxt Dec 11, 2024
831344e
Fix/campaign page (#17)
hugolxt Dec 11, 2024
f768483
update: opportunities pages (#14)
clmntsnr Dec 11, 2024
2f57dcf
apr (#18)
indaviande Dec 11, 2024
d777c3f
Fix/campaign page (#20)
hugolxt Dec 13, 2024
b7f1feb
add lastSnapshot
hugolxt Dec 13, 2024
f19898d
add lastSnapshot (#21)
hugolxt Dec 13, 2024
21e1cee
Merge branch 'main' of https://github.com/AngleProtocol/merkl-app
hugolxt Dec 13, 2024
97552af
fixes: feedback, mainly opportunities & dashboard (#22)
clmntsnr Dec 13, 2024
8114fd1
add: cache on static resoruces (#23)
clmntsnr Dec 13, 2024
81ed915
Enhance opportunity data retrieval with APR and daily rewards metrics…
hugolxt Dec 13, 2024
0123bd9
fix: pagination defaulting & cache (#25)
clmntsnr Dec 13, 2024
50cd360
clean wip: comment out static sideDatas for dynamic implementation (#26)
hugolxt Dec 13, 2024
8cc70a9
fix: protocl filter (#27)
clmntsnr Dec 13, 2024
e32b466
fix: protocol desc (#28)
clmntsnr Dec 13, 2024
6e1438e
token stats + cleaning (#29)
hugolxt Dec 13, 2024
d942f68
Small APR Fix (#19)
indaviande Dec 16, 2024
39be322
Fixes on protocol, chain, token and campaign pages (#30)
hugolxt Dec 16, 2024
2d0abd2
add: depositor (#31)
clmntsnr Dec 16, 2024
d319b3f
update: dappkit (#33)
clmntsnr Dec 16, 2024
86c043e
feat(front): apr modal, layermenu, issues !!! (#32)
indaviande Dec 16, 2024
6d5358f
rename homepage to home (#34)
indaviande Dec 16, 2024
cf2ead8
feat(front): change header logo & selects (#35)
indaviande Dec 16, 2024
03337fe
fix: update Dropdown component to use onHover for APR and TVL columns…
hugolxt Dec 16, 2024
7506e2d
add: fonts config (#37)
clmntsnr Dec 16, 2024
cacc837
feat: icons & uuid (#41)
indaviande Dec 18, 2024
66cc17e
chore: add test filter (#38)
Picodes Dec 18, 2024
37ddfa0
add: deposit modal (#42)
clmntsnr Dec 18, 2024
7a12049
wip display zk rewards (#39)
hugolxt Dec 18, 2024
1f66aa4
feat(api): enhance ProtocolService to include tags from config in API…
hugolxt Dec 18, 2024
b1e0465
update: dappkit
clmntsnr Dec 18, 2024
6f3921d
fix(campaign): update chain reference in CampaignTableRow component (…
hugolxt Dec 18, 2024
3308e7f
feat(rewards): add rewards navigation mode configuration and update C…
hugolxt Dec 18, 2024
37e807b
chore: historical claim tab
Picodes Dec 18, 2024
e6f329e
chore: historical claims
Picodes Dec 18, 2024
48ebc22
chore: lint
Picodes Dec 19, 2024
5158f72
fix: add auto linting
Picodes Dec 19, 2024
7c274a8
chore: remove useless type
Picodes Dec 19, 2024
a3f3a46
fix: lint
Picodes Dec 19, 2024
de6c327
feat: position route (#47)
Picodes Dec 19, 2024
44db095
chore: syncing last changes
Picodes Dec 19, 2024
1d7c611
rmv workflows
Picodes Dec 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": [],
"unwantedRecommendations": []
}
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit"
},
"editor.defaultFormatter": "biomejs.biome",
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.formatOnSave": true,
"editor.formatOnType": false,
"editor.foldingImportsByDefault": true,
"editor.foldingHighlight": true,
"editor.foldingStrategy": "auto",
"files.eol": "\n"
}
Binary file modified bun.lockb
Binary file not shown.
23 changes: 14 additions & 9 deletions merkl.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { createColoring } from "dappkit";
import { createConfig } from "src/config/type";
import hero from "src/customer/assets/images/hero.jpg?url";
import { v4 as uuidv4 } from "uuid";
import { http, createClient, custom } from "viem";

import {
arbitrum,
astar,
Expand Down Expand Up @@ -45,7 +47,10 @@ export default createConfig({
appName: "Merkl",
modes: ["dark", "light"],
defaultTheme: "ignite",
deposit: false,
tags: [],
opportunityNavigationMode: "direct",
rewardsNavigationMode: "chain",
deposit: true,
themes: {
ignite: {
base: createColoring(["#1755F4", "#FF7900", "#0D1530"], ["#1755F4", "#FF7900", "#FFFFFF"]),
Expand Down Expand Up @@ -88,43 +93,43 @@ export default createConfig({
home: {
icon: "RiHomeFill",
route: "/",
key: crypto.randomUUID(),
key: uuidv4(),
},
opportunities: {
icon: "RiPlanetFill",
route: "/opportunities",
key: crypto.randomUUID(),
key: uuidv4(),
},
// protocols: {
// icon: "RiVipCrown2Fill",
// route: "/protocols",
// key: crypto.randomUUID(),
// key: uuidv4(),
// },
// bridge: {
// icon: "RiCompassesLine",
// route: "/bridge",
// key: crypto.randomUUID(),
// key: uuidv4(),
// },
docs: {
icon: "RiFile4Fill",
external: true,
route: "https://docs.merkl.xyz/",
key: crypto.randomUUID(),
key: uuidv4(),
},
faq: {
icon: "RiQuestionFill",
route: "/faq",
key: crypto.randomUUID(),
key: uuidv4(),
},
// terms: {
// icon: "RiCompassesLine",
// route: "/terms",
// key: crypto.randomUUID(),
// key: uuidv4(),
// },
// privacy: {
// icon: "RiInformationFill",
// route: "/privacy",
// key: crypto.randomUUID(),
// key: uuidv4(),
// },
},
socials: {
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
"serve": "remix-serve ./build/server/index.js",
"typecheck": "tsc"
},
"workspaces": [
"packages/*"
],
"workspaces": ["packages/*"],
"dependencies": {
"@acab/ecsstatic": "^0.8.0",
"@ariakit/react": "^0.4.12",
"@elysiajs/eden": "^1.1.3",
"@emotion/css": "^11.13.4",
"@merkl/api": "0.10.156",
"@merkl/api": "0.10.188",
"@radix-ui/react-accordion": "^1.2.1",
"@radix-ui/react-scroll-area": "^1.2.0",
"@remix-run/dev": "^2.11.2",
Expand Down Expand Up @@ -49,6 +47,7 @@
"tailwindcss": "^3.4.12",
"tailwindcss-animate": "^1.0.7",
"typedoc": "^0.26.7",
"uuid": "^11.0.3",
"viem": "2.21.54",
"vite-plugin-dts": "^4.2.1",
"wagmi": "^2.12.29",
Expand Down
43 changes: 0 additions & 43 deletions src/api/opportunity/opportunity.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/api/services/campaigns/campaign.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export abstract class CampaignService {
const action = new URL(request.url).searchParams.get("action");
const chainId = new URL(request.url).searchParams.get("chain");
const page = new URL(request.url).searchParams.get("page");

const test = new URL(request.url).searchParams.get("test") ?? undefined;
const items = new URL(request.url).searchParams.get("items");
const search = new URL(request.url).searchParams.get("search");
const [sort, order] = new URL(request.url).searchParams.get("sort")?.split("-") ?? [];

const filters = Object.assign(
{ status, action, chainId, items, sort, order, name: search, page },
{ status, action, chainId, items, sort, order, name: search, page, test },
override ?? {},
page !== null && { page: Number(page) - 1 },
);
Expand Down
20 changes: 20 additions & 0 deletions src/api/services/claims.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { api } from "../index.server";
import { fetchWithLogs } from "../utils";

export abstract class ClaimsService {
static async #fetch<R, T extends { data: R; status: number; response: Response }>(
call: () => Promise<T>,
resource = "Claims",
): Promise<NonNullable<T["data"]>> {
const { data, status } = await fetchWithLogs(call);

if (status === 404) throw new Response(`${resource} not found`, { status });
if (status === 500) throw new Response(`${resource} unavailable`, { status });
if (data == null) throw new Response(`${resource} unavailable`, { status });
return data;
}

static async getForUser(address: string) {
return await ClaimsService.#fetch(async () => api.v4.claims({ address }).get());
}
}
56 changes: 56 additions & 0 deletions src/api/services/interaction.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { api as clientApi } from "src/api/index.client";
import { fetchWithLogs } from "../utils";

export abstract class InteractionService {
static async #fetch<R, T extends { data: R; status: number; response: Response }>(
call: () => Promise<T>,
resource = "Chain",
): Promise<NonNullable<T["data"]>> {
const { data, status } = await fetchWithLogs(call);

if (status === 404) throw new Response(`${resource} not found`, { status });
if (status === 500) throw new Response(`${resource} unavailable`, { status });
if (data == null) throw new Response(`${resource} unavailable`, { status });
return data;
}

/**
* Client side
* @param chainId
* @param protocolId
* @param identifier
*/
static async getTarget(chainId: number, protocolId: string, identifier: string) {
const targets = await InteractionService.#fetch(() =>
clientApi.v4.interaction.targets.get({
query: { chainId, protocolId, identifier },
}),
);

//TODO: opportunity/:id/target instead of taking the first result and expecting unique
return targets?.[0];
}

/**
* Client side
*/
static async getTransaction(payload: Parameters<typeof clientApi.v4.interaction.transaction.get>[0]["query"]) {
const transaction = await InteractionService.#fetch(() =>
clientApi.v4.interaction.transaction.get({
query: payload,
}),
);

return transaction;
}

static async getBalances(chainId: number, address: string) {
const tokens = await InteractionService.#fetch(() =>
clientApi.v4.tokens.balances.get({
query: { chainId: chainId, userAddress: address },
}),
);

return tokens;
}
}
20 changes: 20 additions & 0 deletions src/api/services/liquidity.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { api } from "../index.server";
import { fetchWithLogs } from "../utils";

export abstract class LiquidityService {
static async #fetch<R, T extends { data: R; status: number; response: Response }>(
call: () => Promise<T>,
resource = "Positions",
): Promise<NonNullable<T["data"]>> {
const { data, status } = await fetchWithLogs(call);

if (status === 404) throw new Response(`${resource} not found`, { status });
if (status === 500) throw new Response(`${resource} unavailable`, { status });
if (data == null) throw new Response(`${resource} unavailable`, { status });
return data;
}

static async getForUser(query: Parameters<typeof api.v4.liquidity.index.get>["0"]["query"]) {
return await LiquidityService.#fetch(async () => api.v4.liquidity.index.get({ query }));
}
}
3 changes: 2 additions & 1 deletion src/api/services/opportunity/opportunity.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export abstract class OpportunityService {

//TODO: updates tags to take an array
if (config.tags && !opportunityWithCampaigns.tags.includes(config.tags?.[0]))
throw new Response("Opportunity inacessible", { status: 403 });
throw new Response("Opportunity inaccessible", { status: 403 });

return opportunityWithCampaigns;
}
Expand Down Expand Up @@ -96,6 +96,7 @@ export abstract class OpportunityService {
sort: url.searchParams.get("sort")?.split("-")[0],
order: url.searchParams.get("sort")?.split("-")[1],
name: url.searchParams.get("search") ?? undefined,
test: url.searchParams.get("test") ?? undefined,
page: url.searchParams.get("page") ? Math.max(Number(url.searchParams.get("page")) - 1, 0) : undefined,
...override,
};
Expand Down
22 changes: 18 additions & 4 deletions src/api/services/protocol.service.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
import config from "merkl.config";
import { api } from "../index.server";
import { fetchWithLogs } from "../utils";

export abstract class ProtocolService {
// ─── Get Many Protocols ──────────────────────────────────────────────

static async get(query: Parameters<typeof api.v4.protocols.index.get>[0]["query"]) {
return await ProtocolService.#fetch(async () => api.v4.protocols.index.get({ query }));
return await ProtocolService.#fetch(async () =>
api.v4.protocols.index.get({
query: Object.assign({ ...query }, config.tags?.[0] ? { tags: config.tags?.[0] } : {}),
}),
);
}

// ─── Get Many Protocols from request ──────────────────────────────────

static async getManyFromRequest(request: Request) {
const query = ProtocolService.#getQueryFromRequest(request);
const protocols = await ProtocolService.#fetch(async () => api.v4.protocols.index.get({ query }));
const count = await ProtocolService.#fetch(async () => api.v4.protocols.count.get({ query }));
const query: Parameters<typeof api.v4.protocols.index.get>[0]["query"] =
ProtocolService.#getQueryFromRequest(request);
const protocols = await ProtocolService.#fetch(async () =>
api.v4.protocols.index.get({
query: Object.assign({ ...query }, config.tags?.[0] ? { tags: config.tags?.[0] } : {}),
}),
);
const count = await ProtocolService.#fetch(async () =>
api.v4.protocols.count.get({
query: Object.assign({ ...query }, config.tags?.[0] ? { tags: config.tags?.[0] } : {}),
}),
);

return { protocols, count };
}
Expand Down
Loading
Loading