Skip to content

Commit

Permalink
Merge branch 'master' into dylan/dat-2535
Browse files Browse the repository at this point in the history
  • Loading branch information
steegecs authored Jul 3, 2024
2 parents 42da2dd + 8abbdf9 commit d9f707a
Show file tree
Hide file tree
Showing 922 changed files with 223,910 additions and 15,348 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bug report
about: Report a bug in our subgraphs or data
title: "#bug; concise title"
labels: bug
assignees: bye43
assignees: ishraq8
---

**Describe the bug**
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Feature request
about: Suggest an idea for this project
title: "#feature; concise title"
labels: enhancement
assignees: bye43

assignees: ishraq8
---

**What do you think is missing?**
A clear and concise description of what the problem (or solution) is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

- new subgraph?
- new schema support?
- update schema?
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/subgraph_qa.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Subgraph QA
about: QA a subgraph
title: "#qa; protocol name"
labels: "data quality"
assignees: bye43
assignees: ishraq8
---

## Review Info
Expand Down
4 changes: 1 addition & 3 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# pull the base image
FROM node:lts-alpine

RUN apk update && apk upgrade
FROM node:20

# set the working direction
WORKDIR /app
Expand Down
4 changes: 2 additions & 2 deletions dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"@types/react": "^17.0.20",
"@types/react-dom": "^17.0.9",
"@types/react-dom": "^18.3.0",
"bignumber.js": "^9.0.2",
"chart.js": "^3.7.1",
"graphql": "^16.3.0",
Expand All @@ -44,7 +44,7 @@
"eslint-plugin-n": "^15.2.5",
"eslint-plugin-promise": "^6.0.1",
"eslint-plugin-react": "^7.31.8",
"gh-pages": "^3.2.3",
"gh-pages": "^5.0.0",
"prettier": "2.6.1",
"typescript": "^4.8.3"
},
Expand Down
66 changes: 35 additions & 31 deletions dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,38 +98,42 @@ function App() {
subgraphEndpoints[schemaType][protocolName] = {};
}
}
Object.values(protocol.deployments).forEach((depoData: any) => {
if (!depoData?.services) {
return;
}
if (
schemaType &&
(!!depoData["services"]["hosted-service"] || !!depoData["services"]["decentralized-network"])
) {
if (!!subgraphEndpoints[schemaType][protocolName][depoData.network]) {
const protocolKeyArr = depoData["services"]["hosted-service"]["slug"].split("-");
const networkKey = protocolKeyArr.pop();
subgraphEndpoints[schemaType][protocolKeyArr.join("-")] = {};
subgraphEndpoints[schemaType][protocolKeyArr.join("-")][networkKey] =
process.env.REACT_APP_GRAPH_BASE_URL! +
"/subgraphs/name/messari/" +
depoData["services"]["hosted-service"]["slug"];
} else {
subgraphEndpoints[schemaType][protocolName][depoData.network] =
process.env.REACT_APP_GRAPH_BASE_URL! +
"/subgraphs/name/messari/" +
depoData["services"]["hosted-service"]["slug"];
if (protocol.deployments && typeof protocol.deployments === 'object') {
Object.values(protocol.deployments).forEach((depoData: any) => {
if (!depoData?.services) {
return;
}
}
if (!depoCount[schemaType]) {
depoCount[schemaType] = { totalCount: 0, prodCount: 0, devCount: 0 };
}
depoCount.all.totalCount += 1;
depoCount[schemaType].totalCount += 1;
if (depoData?.status === "dev") {
isDev = true;
}
});
if (
schemaType &&
(!!depoData["services"]["hosted-service"] || !!depoData["services"]["decentralized-network"])
) {
if (!!subgraphEndpoints[schemaType][protocolName][depoData.network]) {
const protocolKeyArr = depoData["services"]["hosted-service"]["slug"].split("-");
const networkKey = protocolKeyArr.pop();
subgraphEndpoints[schemaType][protocolKeyArr.join("-")] = {};
subgraphEndpoints[schemaType][protocolKeyArr.join("-")][networkKey] =
process.env.REACT_APP_GRAPH_BASE_URL! +
"/subgraphs/name/messari/" +
depoData["services"]["hosted-service"]["slug"];
} else {
subgraphEndpoints[schemaType][protocolName][depoData.network] =
process.env.REACT_APP_GRAPH_BASE_URL! +
"/subgraphs/name/messari/" +
depoData["services"]["hosted-service"]["slug"];
}
}
if (!depoCount[schemaType]) {
depoCount[schemaType] = { totalCount: 0, prodCount: 0, devCount: 0 };
}
depoCount.all.totalCount += 1;
depoCount[schemaType].totalCount += 1;
if (depoData?.status === "dev") {
isDev = true;
}
});
} else {
console.warn(`Deployments for protocol ${protocolName} is not a valid object`);
}
if (isDev) {
depoCount.all.devCount += 1;
depoCount[schemaType].devCount += 1;
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/common/DashboardVersion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DashboardTag = styled("div")`
z-index: 2;
`;

export const dashboardVersion = "v2.3.0";
export const dashboardVersion = "v2.4.0";

export const DashboardVersion = () => {
return <DashboardTag>{dashboardVersion}</DashboardTag>;
Expand Down
8 changes: 6 additions & 2 deletions dashboard/src/common/chartComponents/TableChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,12 @@ export const TableChart = ({
},
}}
onSortModelChange={(x) => {
setSortColumn(x[0].field);
setSortOrderAsc(x[0].sort === "asc");
if (x && x.length > 0 && x[0].hasOwnProperty('field') && x[0].hasOwnProperty('sort')) {
setSortColumn(x[0].field);
setSortOrderAsc(x[0].sort === "asc");
} else {
console.error('Sort model change event received invalid data:', x);
}
}}
rows={tableData}
columns={columns}
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/common/utilComponents/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const DatePicker = ({ dates, setDates }: DatePickerProps) => {
}
}}
value={datesValue}
renderDay={(day, _selectedDates, pickersDayProps) => {
renderDay={(day: Moment, _selectedDates: any, pickersDayProps: any) => {
return (
<div
key={day.format("l")}
Expand All @@ -38,7 +38,7 @@ export const DatePicker = ({ dates, setDates }: DatePickerProps) => {
</div>
);
}}
renderInput={(params) => <TextField {...params} />}
renderInput={(params: any) => <TextField {...params} />}
/>
</LocalizationProvider>
<Box display="flex" flexWrap="wrap" gap={1} sx={{ padding: 1, backgroundColor: "Window" }}>
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/common/utilComponents/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const DateRangePicker = ({ dates, setDates }: DateRangePickerProps) => {
}
}}
value={dates}
renderDay={(day, _selectedDates, pickersDayProps) => {
renderDay={(day: Moment, _selectedDates: any, pickersDayProps: any) => {
return (
<div key={day.format("l")}>
<PickersDay
Expand All @@ -37,7 +37,7 @@ export const DateRangePicker = ({ dates, setDates }: DateRangePickerProps) => {
</div>
);
}}
renderInput={(params) => <TextField {...params} />}
renderInput={(params: any) => <TextField {...params} />}
/>
</LocalizationProvider>
<Box display="flex" flexWrap="wrap" gap={1} sx={{ padding: 1, backgroundColor: "Window" }}>
Expand Down
6 changes: 4 additions & 2 deletions dashboard/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ export namespace Versions {
export const Schema110 = "1.1.0";
export const Schema120 = "1.2.0";
export const Schema130 = "1.3.0";
export const Schema140 = "1.4.0";
export const Schema200 = "2.0.0";
export const Schema201 = "2.0.1";
export const Schema210 = "2.1.0";
export const Schema300 = "3.0.0";
export const Schema301 = "3.0.1";
export const Schema302 = "3.0.2";
Expand All @@ -45,7 +47,7 @@ export const latestSchemaVersions = (schemaType: string, versionStr: string) =>
return true;
}
} else if (schema === "generic") {
if (["2.1.1"].includes(versionStr)) {
if (["3.0.0"].includes(versionStr)) {
return true;
}
} else if (schema === "bridge") {
Expand Down Expand Up @@ -146,7 +148,7 @@ export interface Schema {
protocolFields: { [x: string]: string };
query: string;
financialsQuery: string;
hourlyUsageQuery: string;
hourlyUsageQuery?: string;
dailyUsageQuery: string;
protocolTableQuery: string;
poolsQuery: string;
Expand Down
10 changes: 8 additions & 2 deletions dashboard/src/interfaces/ProtocolDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,18 @@ function ProtocolDashboard({ protocolJSON, getData, subgraphEndpoints, decentral
`,
{ client },
);

let placeholderQuery = `query MyQuery {
_meta {
deployment
}
}`;
const [
getHourlyUsageData,
{ data: hourlyUsageData, loading: hourlyUsageLoading, error: hourlyUsageError, refetch: hourlyUsageRefetch },
] = useLazyQuery(
gql`
${hourlyUsageQuery}
${hourlyUsageQuery ? hourlyUsageQuery : placeholderQuery}
`,
{ client },
);
Expand Down Expand Up @@ -324,7 +330,7 @@ function ProtocolDashboard({ protocolJSON, getData, subgraphEndpoints, decentral
);
const [getOverlayHourlyUsageData, { data: overlayHourlyUsageData }] = useLazyQuery(
gql`
${overlayHourlyUsageQuery}
${overlayHourlyUsageQuery ? overlayHourlyUsageQuery : placeholderQuery}
`,
{ client: overlayDeploymentClient },
);
Expand Down
31 changes: 23 additions & 8 deletions dashboard/src/queries/generic/poolOverview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ export const schema = (version: string): string => {
versionGroupArr.pop();
const versionGroup = versionGroupArr.join(".") + ".0";
switch (versionGroup) {
case Versions.Schema120:
return schema120();
case Versions.Schema130:
return schema130();
case Versions.Schema140:
return schema140();
case Versions.Schema210:
return schema210();
case Versions.Schema300:
return schema300();
default:
return schema130();
return schema300();
}
};

export const schema120 = (): string => {
export const schema140 = (): string => {
return `
query Data($skipAmt: Int!) {
pools(first: 10, skip: $skipAmt, orderBy:totalValueLockedUSD, orderDirection: desc) {
Expand All @@ -30,17 +32,30 @@ export const schema120 = (): string => {
}`;
};

export const schema130 = (): string => {
export const schema210 = (): string => {
return `
query Data($skipAmt: Int!) {
pools(first: 10, skip: $skipAmt, orderBy:totalValueLockedUSD, orderDirection: desc) {
id
name
symbol
totalValueLockedUSD
outputTokenSupply
stakedOutputTokenAmount
rewardTokenEmissionsUSD
}
}`;
};

export const schema300 = (): string => {
return `
query Data($skipAmt: Int!) {
pools(first: 10, skip: $skipAmt, orderBy:totalValueLockedUSD, orderDirection: desc) {
id
name
symbol
totalValueLockedUSD
outputTokenSupply
}
}`;
};
Loading

0 comments on commit d9f707a

Please sign in to comment.