Skip to content

Commit

Permalink
fix bridge, add listing purchase information
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBeardEth committed Feb 2, 2024
1 parent c3c110e commit aca9129
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const L2ActivityCard = ({ activity }: ActivityCardProps) => {
#{activity.token.token_id}
</span>{" "}
<br />
{activity.token.name}
{decodeURIComponent(activity.token.name ?? "")}
</span>
</Link>
)}
Expand Down
3 changes: 3 additions & 0 deletions apps/nextjs/src/app/collection/[id]/(list)/analytics/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { TopOwners } from "./TopOwners";

export default async function Page({ params }: { params: { id: string } }) {
const tokenAddresses = getCollectionAddresses(params.id);
if (!tokenAddresses[SUPPORTED_L1_CHAIN_ID]) {
return <h3 className="mt-8 text-center">Coming Soon</h3>;
}
const ownersDistributionData = getOwnersDistribution({
collection: tokenAddresses[SUPPORTED_L1_CHAIN_ID] ?? params.id,
}) as Promise<
Expand Down
5 changes: 2 additions & 3 deletions apps/nextjs/src/app/providers/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import { mainnet, sepolia } from "wagmi/chains";

import { TransferLogProvider } from "./TransferLogProvider";

const starkProvider =
/*process.env.NEXT_PUBLIC_BLAST_API
const starkProvider = process.env.NEXT_PUBLIC_BLAST_API
? blastProvider({
apiKey: process.env.NEXT_PUBLIC_BLAST_API,
})
:*/ starkPublicProvider();
: starkPublicProvider();
const starkConnectors = [
new InjectedConnector({ options: { id: "braavos", name: "Braavos" } }),
new InjectedConnector({ options: { id: "argentX", name: "Argent X" } }),
Expand Down
10 changes: 6 additions & 4 deletions apps/nextjs/src/hooks/useBridgeContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ export const useBridgeContract = () => {

const calls: Call[] = useMemo(() => {
if (!amount || !addressL1) return [];
return contract?.populateTransaction.initiate_withdrawal!(addressL1, {
low: parseEther(amount),
high: 0,
});
return [
contract?.populateTransaction.initiate_withdrawal!(addressL1, {
low: parseEther(amount),
high: 0,
}),
];

/*const tx = {
contractAddress: l2BridgeAddress as `0x${string}`,
Expand Down
6 changes: 5 additions & 1 deletion packages/api/src/router/erc721MarketEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export const erc721MarketEventsRouter = createTRPCRouter({
where: and(...whereFilter),
orderBy: orderByFilter,
with: {
token: true,
token: {
//@ts-expect-error should allow where on relationship
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
where: (token, { sql }) => sql`upper_inf(_cursor)`,
},
},
});
console.log(items);
Expand Down
2 changes: 2 additions & 0 deletions packages/apibara/src/erc721_market_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export default function transform({ header, events }: Block) {
id: orderId,
},
update: {
finalize_hash: receipt.transactionHash,
purchaser: receipt.events[0].data[0],
active: Boolean(BigInt(event.data[5])),
status: "filled",
updated_at: header?.timestamp,
Expand Down
6 changes: 3 additions & 3 deletions packages/db/src/schema/erc721_attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export const erc721Attributes = pgSqlTable(
"erc721_attributes",
{
id: serial("id"),
value: text("value"),
key: text("key"),
value: text("value").notNull(),
key: text("key").notNull(),
kind: text("kind"),
collectionId: text("collection_id"),
collectionId: text("collection_id").notNull(),
attributeKeyId: integer("attribute_key_id"),
tokenCount: integer("token_count").default(0),
/*on_sale_count: number;
Expand Down
2 changes: 2 additions & 0 deletions packages/db/src/schema/erc721_market_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ export const erc721MarketEvents = pgSqlTable("erc721_market_events", {
_cursor: int8range("_cursor"),
id: integer("id").notNull(),
hash: text("hash"),
finalize_hash: text("finalize_hash"),
token_key: text("token_key"),
token_id: integer("token_id"),
collection_id: integer("collection_id"),
created_by: text("created_by"),
purchaser: text("purchaser"),
price: numeric("price"),
expiration: integer("expiration"),
active: boolean("active"),
Expand Down
6 changes: 3 additions & 3 deletions packages/db/src/schema/erc721_token_attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { erc721Tokens } from "./erc721_tokens";
export const erc721TokenAttributes = pgSqlTable(
"erc721_token_attributes",
{
token_key: text("token_key"),
value: text("value"),
key: text("key"),
token_key: text("token_key").notNull(),
value: text("value").notNull(),
key: text("key").notNull(),
collectionId: text("collection_id"),
attributeId: integer("attribute_id"),
},
Expand Down

0 comments on commit aca9129

Please sign in to comment.