Skip to content

Commit

Permalink
Merge branch 'main' into builder-sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
codenamejason authored May 6, 2024
2 parents c78ee44 + 1c827b0 commit 9f646e3
Show file tree
Hide file tree
Showing 36 changed files with 760 additions and 238 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/icons/Discord.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function Discord() {
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g clip-path="url(#clip0_578_29)">
<g clipPath="url(#clip0_578_29)">
<path
d="M12.11 10C12.11 10.61 11.66 11.11 11.09 11.11C10.53 11.11 10.07 10.61 10.07 10C10.07 9.39 10.52 8.89 11.09 8.89C11.66 8.89 12.11 9.39 12.11 10ZM7.44 8.89C6.87 8.89 6.42 9.39 6.42 10C6.42 10.61 6.88 11.11 7.44 11.11C8.01 11.11 8.46 10.61 8.46 10C8.47 9.39 8.01 8.89 7.44 8.89ZM18 2.56V20.5C15.4807 18.2737 16.2864 19.0106 13.36 16.29L13.89 18.14H2.55C1.42 18.14 0.5 17.22 0.5 16.08V2.56C0.5 1.42 1.42 0.5 2.55 0.5H15.95C17.08 0.5 18 1.42 18 2.56ZM15.15 12.04C15.15 8.82 13.71 6.21 13.71 6.21C12.27 5.13 10.9 5.16 10.9 5.16L10.76 5.32C12.46 5.84 13.25 6.59 13.25 6.59C10.8746 5.28809 8.08422 5.28785 5.78 6.3C5.41 6.47 5.19 6.59 5.19 6.59C5.19 6.59 6.02 5.8 7.82 5.28L7.72 5.16C7.72 5.16 6.35 5.13 4.91 6.21C4.91 6.21 3.47 8.82 3.47 12.04C3.47 12.04 4.31 13.49 6.52 13.56C6.52 13.56 6.89 13.11 7.19 12.73C5.92 12.35 5.44 11.55 5.44 11.55C5.58711 11.653 5.82969 11.7864 5.85 11.8C7.53789 12.7452 9.93547 13.0549 12.09 12.15C12.44 12.02 12.83 11.83 13.24 11.56C13.24 11.56 12.74 12.38 11.43 12.75C11.73 13.13 12.09 13.56 12.09 13.56C14.3 13.49 15.15 12.04 15.15 12.04Z"
fill="white"
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/icons/Gitbook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function Gitbook() {
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g clip-path="url(#clip0_578_41)">
<g clipPath="url(#clip0_578_41)">
<path
d="M10.8001 18.2749C11.1751 18.2749 11.5126 18.5749 11.5126 18.9874C11.5126 19.3624 11.2126 19.6999 10.8001 19.6999C10.4251 19.6999 10.0876 19.3999 10.0876 18.9874C10.0876 18.5749 10.4251 18.2749 10.8001 18.2749ZM21.8251 13.9249C21.4501 13.9249 21.1126 13.6249 21.1126 13.2124C21.1126 12.8374 21.4126 12.4999 21.8251 12.4999C22.2001 12.4999 22.5376 12.7999 22.5376 13.2124C22.5376 13.5874 22.2001 13.9249 21.8251 13.9249ZM21.8251 11.0374C20.6251 11.0374 19.6501 12.0124 19.6501 13.2124C19.6501 13.4374 19.6876 13.6624 19.7626 13.8874L12.6001 17.7124C12.1876 17.1124 11.5126 16.7749 10.8001 16.7749C9.97505 16.7749 9.22505 17.2624 8.85005 17.9749L2.40005 14.5999C1.72505 14.2249 1.20005 13.1374 1.27505 12.0874C1.31255 11.5624 1.50005 11.1499 1.76255 10.9999C1.95005 10.8874 2.13755 10.9249 2.40005 11.0374L2.43755 11.0749C4.16255 11.9749 9.75005 14.8999 9.97505 15.0124C10.3501 15.1624 10.5376 15.2374 11.1751 14.9374L22.7251 8.93744C22.9126 8.86244 23.1001 8.71244 23.1001 8.44994C23.1001 8.11244 22.7626 7.96244 22.7626 7.96244C22.0876 7.66244 21.0751 7.17494 20.1001 6.72494C18.0001 5.74994 15.6001 4.62494 14.5501 4.06244C13.6501 3.57494 12.9001 3.98744 12.7876 4.06244L12.5251 4.17494C7.76255 6.57494 1.46255 9.68744 1.08755 9.91244C0.450053 10.2874 0.0375525 11.0749 5.2521e-05 12.0499C-0.0749475 13.5874 0.712552 15.1999 1.83755 15.7624L8.66255 19.2874C8.81255 20.3374 9.75005 21.1624 10.8001 21.1624C12.0001 21.1624 12.9376 20.2249 12.9751 19.0249L20.4751 14.9749C20.8501 15.2749 21.3376 15.4249 21.8251 15.4249C23.0251 15.4249 24.0001 14.4499 24.0001 13.2499C24.0001 12.0124 23.0251 11.0374 21.8251 11.0374Z"
fill="white"
Expand Down
4 changes: 2 additions & 2 deletions packages/common/src/icons/Github.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function Github() {
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
fillRule="evenodd"
clipRule="evenodd"
d="M10.2567 2.16669C8.21671 2.16775 6.24365 2.89026 4.69029 4.20502C3.13692 5.51979 2.10455 7.34108 1.77776 9.34323C1.45097 11.3454 1.85107 13.3978 2.90653 15.1336C3.962 16.8693 5.60398 18.1752 7.5389 18.8177C7.96577 18.8969 8.12656 18.6323 8.12656 18.4074C8.12656 18.1824 8.11802 17.5302 8.11517 16.8171C5.72468 17.3335 5.21955 15.8083 5.21955 15.8083C4.82968 14.818 4.2662 14.5577 4.2662 14.5577C3.48645 14.0285 4.32455 14.0384 4.32455 14.0384C5.18825 14.0992 5.64216 14.9198 5.64216 14.9198C6.40769 16.2257 7.65273 15.848 8.14221 15.6273C8.21904 15.0741 8.44245 14.6977 8.68861 14.4841C6.77906 14.269 4.77276 13.5362 4.77276 10.2623C4.76092 9.4132 5.0778 8.59211 5.65781 7.96885C5.56959 7.7538 5.27504 6.8851 5.74176 5.70514C5.74176 5.70514 6.46318 5.47594 8.10522 6.58092C9.51365 6.19795 10.9997 6.19795 12.4081 6.58092C14.0487 5.47594 14.7687 5.70514 14.7687 5.70514C15.2368 6.88227 14.9423 7.75097 14.8541 7.96885C15.4359 8.59221 15.7535 9.41474 15.7405 10.2651C15.7405 13.5461 13.73 14.269 11.8176 14.4798C12.1249 14.7458 12.3996 15.2651 12.3996 16.063C12.3996 17.2062 12.3896 18.1258 12.3896 18.4074C12.3896 18.6352 12.5447 18.9011 12.9801 18.8177C14.9152 18.1751 16.5574 16.869 17.6128 15.133C18.6683 13.3969 19.0682 11.3442 18.741 9.34184C18.4138 7.3395 17.381 5.51819 15.8271 4.20365C14.2732 2.88911 12.2997 2.16707 10.2595 2.16669H10.2567Z"
fill="white"
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ const passportLiteRounds = [
{ roundId: "23", chainId: 42161 }, // Hackathon Alumni
{ roundId: "24", chainId: 42161 }, // ENS
{ roundId: "25", chainId: 42161 }, // dApps & Apps
{ roundId: "26", chainId: 42161 }, // WEB3 Infrastructurre
{ roundId: "26", chainId: 42161 }, // WEB3 Infrastructure
{ roundId: "27", chainId: 42161 }, // Developer Tooling
{ roundId: "28", chainId: 42161 }, // Hypercerts Ecosystem
{ roundId: "29", chainId: 42161 }, // Climate Solutions
Expand Down
25 changes: 16 additions & 9 deletions packages/data-layer/src/data-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
SearchResult,
} from "./openapi-search-client/index";
import {
getApplication,
getApprovedApplication,
getApplicationsByProjectIds,
getApplicationsByRoundIdAndProjectIds,
getApplicationsForManager,
Expand Down Expand Up @@ -347,7 +347,7 @@ export class DataLayer {
* Returns a single application as identified by its id, round name and chain name
* @param projectId
*/
async getApplication({
async getApprovedApplication({
roundId,
chainId,
applicationId,
Expand All @@ -362,13 +362,17 @@ export class DataLayer {
applicationId,
};

const response: { application: Application } = await request(
const response: { applications: Application[] } = await request(
this.gsIndexerEndpoint,
getApplication,
getApprovedApplication,
requestVariables,
);

return response.application ?? null;
if (response.applications.length === 0) {
return null;
}

return response.applications[0];
}

async getApplicationsForExplorer({
Expand Down Expand Up @@ -396,7 +400,7 @@ export class DataLayer {
* Returns a list of applications identified by their chainId, roundId, and id.
* @param expandedRefs
*/
async getApplicationsByExpandedRefs(
async getApprovedApplicationsByExpandedRefs(
expandedRefs: Array<ExpandedApplicationRef>,
): Promise<ApplicationSummary[]> {
if (expandedRefs.length === 0) {
Expand All @@ -422,8 +426,9 @@ export class DataLayer {
applications(
first: 100
filter: {
or: [
${filters}
and: [
{ status: { equalTo: APPROVED } },
{ or: [ ${filters} ] }
]
}
) {
Expand Down Expand Up @@ -678,7 +683,9 @@ export class DataLayer {
);

return response.donations.filter((donation) => {
return donation.application.project !== null;
return (
donation.application !== null && donation.application?.project !== null
);
});
}

Expand Down
12 changes: 10 additions & 2 deletions packages/data-layer/src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,21 @@ export const getApplicationStatusByRoundIdAndCID = gql`
}
`;

export const getApplication = gql`
export const getApprovedApplication = gql`
query Application(
$chainId: Int!
$applicationId: String!
$roundId: String!
) {
application(chainId: $chainId, id: $applicationId, roundId: $roundId) {
applications(
first: 1
condition: {
status: APPROVED
chainId: $chainId
id: $applicationId
roundId: $roundId
}
) {
id
chainId
roundId
Expand Down
9 changes: 8 additions & 1 deletion packages/grant-explorer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@ REACT_APP_EXPLORER_DISABLE_MATCHING_ESTIMATES=false
REACT_APP_PASSPORT_API_KEY="test-key"
REACT_APP_PASSPORT_AVALANCHE_API_KEY="test-key"
REACT_APP_PASSPORT_API_COMMUNITY_ID="0000"
REACT_APP_PASSPORT_API_COMMUNITY_ID_AVALANCHE="0000"
REACT_APP_PASSPORT_API_COMMUNITY_ID_AVALANCHE="0000"

# create key following https://www.opensource.observer/docs/get-started/
REACT_APP_OSO_API_KEY=

# https://posthog.com/docs/libraries/react
REACT_APP_POSTHOG_KEY="<ph_project_api_key>"
REACT_APP_POSTHOG_HOST="<ph_client_api_host>"
4 changes: 3 additions & 1 deletion packages/grant-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
"ethereum-blockies": "^0.1.1",
"ethers": "^5.7.2",
"framer-motion": "^10.15.0",
"graphql": "^16.8.1",
"graphql-request": "^6.1.0",
"history": "^5.3.0",
"html-react-parser": "^3.0.7",
"https-browserify": "^1.0.0",
Expand All @@ -90,7 +92,7 @@
"moment": "^2.29.3",
"node-fetch": "^3.3.1",
"os-browserify": "^0.3.0",
"posthog-js": "^1.89.0",
"posthog-js": "^1.90.0",
"process": "^0.11.10",
"react": "^18.1.0",
"react-datetime": "^3.1.1",
Expand Down
48 changes: 3 additions & 45 deletions packages/grant-explorer/src/checkoutStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ export const useCheckoutStore = create<CheckoutState>()(
checkout: async (
chainsToCheckout: { chainId: ChainId; permitDeadline: number }[],
walletClient: WalletClient,
allo: Allo,
dataLayer: DataLayer
allo: Allo
) => {
const chainIdsToCheckOut = chainsToCheckout.map((chain) => chain.chainId);
get().setChainsToCheckout(
Expand Down Expand Up @@ -238,50 +237,9 @@ export const useCheckoutStore = create<CheckoutState>()(
const groupedEncodedVotes: Record<string, Hex[]> = {};

for (const roundId in groupedDonations) {
const allProjectIds = groupedDonations[roundId].map(
(d) => d.projectRegistryId
);
const response =
await dataLayer.getApplicationsByRoundIdAndProjectIds({
chainId,
roundId,
projectIds: allProjectIds,
});

const roundDonations: {
roundId: string;
chainId: number;
amount: string;
recipient: string;
projectRegistryId: string;
applicationIndex: number;
anchorAddress: string;
}[] = [];

groupedDonations[roundId].map((d) => {
const app = response.find(
(r) => r.projectId === d.projectRegistryId
);

if (!app) {
throw new Error(
`Application not found for projectRegistryId ${d.projectRegistryId} in round ${roundId} on chain ${chainId}`
);
}
roundDonations.push({
roundId: d.roundId,
chainId: d.chainId,
amount: d.amount,
recipient: d.recipient,
projectRegistryId: d.projectRegistryId,
applicationIndex: Number(app.id),
anchorAddress: app.anchorAddress,
});
});

groupedEncodedVotes[roundId] = isV2
? encodedQFAllocation(token, roundDonations)
: encodeQFVotes(token, roundDonations);
? encodedQFAllocation(token, groupedDonations[roundId])
: encodeQFVotes(token, groupedDonations[roundId]);
}

const groupedAmounts: Record<string, bigint> = {};
Expand Down
Loading

0 comments on commit 9f646e3

Please sign in to comment.