Skip to content

Deprecate infura on prod #514

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ NEXT_PUBLIC_ENVIRONMENT=test
NEXT_PUBLIC_WC_PROJECT_ID=<placeholder wc project id>
NEXT_PUBLIC_ALCHEMY_API_KEY="mock-alchemy-key"
NEXT_PUBLIC_DRPC_API_PKEY="mock-drpc-key"
NEXT_PUBLIC_INFURA_API_KEY="mock-infura-key"
NEXT_PUBLIC_FILECOIN_API_KEY="mock-filecoin-key"
2 changes: 1 addition & 1 deletion app/collections/[collectionId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const CollectionPageInner = async ({
<div>
<h3 className="text-2xl font-medium">{data.name}</h3>
<p className="text-sm text-slate-500 pb-2">
{data.sections.data[0].collection.description}
{data.sections?.data?.[0]?.collections?.[0].description}
</p>

<div className="pt-8 justify-center flex w-full">
Expand Down
6 changes: 3 additions & 3 deletions app/collections/edit/[collectionId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ const EditCollectionPage = async ({

const prefilledValues: CollectionCreateFormValues = {
id: collectionId,
collectionId: data.sections.data[0].collection.id,
collectionId: data.sections?.data?.[0]?.collections?.[0]?.id || "",
title: data.name,
description: data.sections.data[0].collection.description,
description: data.sections?.data?.[0]?.collections?.[0]?.description || "",
borderColor: data.tile_border_color || "#000000",
backgroundImg: data.background_image || "",
entries:
data.sections.data[0].entries?.map((hc) => ({
data.sections?.data?.[0]?.entries?.map((hc) => ({
entryId: hc.id,
factor: hc.display_size,
})) || [],
Expand Down
28 changes: 17 additions & 11 deletions app/profile/[address]/collections-tab-content-inner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,23 @@ export const HyperboardsOverview = ({
</div>
)}
<div className="flex flex-col gap-4">
{hyperboards.map((hyperboard) => (
<HyperboardRow
key={hyperboard.id}
hyperboardId={hyperboard.id}
name={hyperboard.name || ""}
description={
hyperboard.sections?.data?.[0]?.collection.description || ""
}
showEditAndDeleteButtons={isOwnProfile}
/>
))}
{hyperboards.map((hyperboard) => {
if (!hyperboard.id) {
return null;
}
return (
<HyperboardRow
key={hyperboard.id}
hyperboardId={hyperboard.id}
name={hyperboard.name || ""}
description={
hyperboard.sections?.data?.[0]?.collections?.[0].description ||
""
}
showEditAndDeleteButtons={isOwnProfile}
/>
);
})}
</div>
</div>
);
Expand Down
14 changes: 10 additions & 4 deletions attestations/getAttestations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,26 @@ export async function getAttestations({
}: GetAttestationsParams) {
const where: Record<string, any> = {};

if (filter?.chainId) {
where.chain_id = { eq: filter.chainId.toString() };
}
// where: {hypercert: {token_id: {eq: 292983117918928017041965536998752430063616}}, eas_schema: {uid: {eq: "0x2f4f575d5df78ac52e8b124c4c900ec4c540f1d44f5b8825fac0af5308c91449"}, chain_id: {eq: 11155111}}}
if (filter?.contractAddress) {
where.contract_address = { eq: filter.contractAddress };
}

if (filter?.tokenId) {
where.token_id = { eq: filter.tokenId.toString() };
where.hypercert = { token_id: { eq: filter.tokenId } };
}

if (filter?.schemaId) {
where.eas_schema = { uid: { eq: filter.schemaId } };
}

if (filter?.chainId) {
where.eas_schema = {
...(where.eas_schema || {}),
chain_id: { eq: Number(filter.chainId) },
};
}

const res = await request(HYPERCERTS_API_URL_GRAPH, query, {
first,
offset,
Expand Down
15 changes: 10 additions & 5 deletions attestations/getCreatorFeedAttestation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const query = graphql(
query AttestationsQuery($where: AttestationWhereInput) {
attestations(
where: $where
sort: { by: { creation_block_timestamp: descending } }
sortBy: { creation_block_timestamp: descending }
) {
count
data {
Expand Down Expand Up @@ -38,20 +38,25 @@ export async function getCreatorFeedAttestations({
}: GetAttestationsParams) {
const where: Record<string, any> = {};

if (filter?.chainId) {
where.chain_id = { eq: filter.chainId.toString() };
}
if (filter?.contractAddress) {
where.contract_address = { eq: filter.contractAddress };
}

if (filter?.tokenId) {
where.token_id = { eq: filter.tokenId.toString() };
where.hypercert = { token_id: { eq: filter.tokenId } };
}

if (filter?.schemaId) {
where.eas_schema = { uid: { eq: filter.schemaId } };
}

if (filter?.chainId) {
where.eas_schema = {
...(where.eas_schema || {}),
chain_id: { eq: Number(filter.chainId) },
};
}

const res = await request(HYPERCERTS_API_URL_GRAPH, query, {
first,
offset,
Expand Down
2 changes: 1 addition & 1 deletion collections/getCollectionById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HYPERCERTS_API_URL_GRAPH } from "@/configs/hypercerts";

const query = graphql(
`
query Hyperboard($id: UUID!) {
query Hyperboard($id: String!) {
hyperboards(where: { id: { eq: $id } }) {
data {
...HyperboardFragment
Expand Down
2 changes: 1 addition & 1 deletion collections/getCollectionsByAdminAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const query = graphql(
`
query Collection($admin_address: String!, $first: Int, $offset: Int) {
hyperboards(
where: { admin_id: { eq: $admin_address } }
where: { admin_address: { eq: $admin_address } }
first: $first
offset: $offset
) {
Expand Down
30 changes: 18 additions & 12 deletions collections/hyperboard.fragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ export const HyperboardFragment = graphql(`
fragment HyperboardFragment on Hyperboard {
id
admins {
address
chain_id
data {
address
chain_id
}
}
name
background_image
Expand All @@ -15,7 +17,7 @@ export const HyperboardFragment = graphql(`
count
data {
label
collection {
collections {
name
admins {
address
Expand All @@ -32,18 +34,22 @@ export const HyperboardFragment = graphql(`
name
total_units
owners {
percentage
address
units
avatar
display_name
data {
percentage
address
units
avatar
display_name
}
}
}
owners {
percentage_owned
address
display_name
avatar
data {
percentage_owned
address
display_name
avatar
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/hypercert/creator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function Creator({ hypercert }: { hypercert: HypercertState }) {
{hypercert.creator_address && (
<div className="flex space-x-1 items-center">
<span>by</span>
<EthAddress address={hypercert.creator_address} />
<EthAddress address={hypercert.creator_address} showEnsName />
</div>
)}
{hypercert.contract?.chain_id && (
Expand Down
5 changes: 4 additions & 1 deletion components/marketplace/user-listings-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export default function UserListingsList({

const cancelDisabled = Number(order.chainId) !== chainId;
const isCancelled = order.validator_codes?.includes(
OrderValidatorCode.USER_ORDER_NONCE_EXECUTED_OR_CANCELLED.toString(),
OrderValidatorCode.USER_ORDER_NONCE_EXECUTED_OR_CANCELLED,
);

if (!isCancelled) {
Expand Down Expand Up @@ -300,6 +300,9 @@ export default function UserListingsList({
className="ml-2"
onClick={async (e) => {
e.preventDefault();
if (!order.id) {
return;
}
await deleteOrder({
orderId: order.id,
hypercertId: order.hypercert_id,
Expand Down
1 change: 0 additions & 1 deletion configs/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ export const hypercertApiSigningDomainSafe = (

export const alchemyApiKey = process.env.NEXT_PUBLIC_ALCHEMY_API_KEY;
export const drpcApiPkey = process.env.NEXT_PUBLIC_DRPC_API_PKEY;
export const infuraApiKey = process.env.NEXT_PUBLIC_INFURA_API_KEY;
export const filecoinApiKey = process.env.NEXT_PUBLIC_FILECOIN_API_KEY;
4 changes: 2 additions & 2 deletions configs/hypercerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { ENVIRONMENT } from "@/configs/constants";
const HYPERCERT_API_URL =
CONSTANTS.ENDPOINTS[ENVIRONMENT as keyof typeof CONSTANTS.ENDPOINTS];

export const HYPERCERTS_API_URL_REST = `${HYPERCERT_API_URL}/v1`;
export const HYPERCERTS_API_URL_GRAPH = `${HYPERCERT_API_URL}/v1/graphql`;
export const HYPERCERTS_API_URL_REST = `${HYPERCERT_API_URL}/v2`;
export const HYPERCERTS_API_URL_GRAPH = `${HYPERCERT_API_URL}/v2/graphql`;

export const DEFAULT_NUM_UNITS_DECIMALS = 8;
export const DEFAULT_NUM_UNITS = parseUnits("1", DEFAULT_NUM_UNITS_DECIMALS);
Expand Down
Loading
Loading