Skip to content

Commit

Permalink
Merge pull request #25 from ArkProjectNFTs/yohan/fix-assets-page
Browse files Browse the repository at this point in the history
fix: asset page error
  • Loading branch information
gershon authored Jun 24, 2024
2 parents 270f718 + 1127b54 commit 11eafcd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"use client";

import { useFulfillAuction, useFulfillOffer } from "@ark-project/react";
import {
useFulfillAuction,
useFulfillOffer,
useOrderType,
} from "@ark-project/react";
import { ReloadIcon } from "@radix-ui/react-icons";
import { useAccount } from "@starknet-react/core";

Expand All @@ -14,19 +18,21 @@ interface AcceptOfferProps {
token: Token;
tokenMarketData: TokenMarketData;
offer: Offer;
isAuction: boolean;
}

const AcceptOffer: React.FC<AcceptOfferProps> = ({
token,
tokenMarketData,
offer,
isAuction,
}) => {
const { address, account } = useAccount();
const { fulfillOffer, status } = useFulfillOffer();
const { fulfill: fulfillAuction, status: statusAuction } =
useFulfillAuction();
const type = useOrderType({
orderHash: BigInt(tokenMarketData.order_hash),
});
const isAuction = type === "AUCTION";
const isOwner = areAddressesEqual(token.owner, address);
const isListed = tokenMarketData?.is_listed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import CancelOffer from "./cancel-offer";

interface TokenOffersProps {
token: Token;
tokenMarketData: TokenMarketData;
tokenMarketData: TokenMarketData | null;
}

const TokenOffers: React.FC<TokenOffersProps> = ({
Expand All @@ -48,12 +48,8 @@ const TokenOffers: React.FC<TokenOffersProps> = ({
},
);
const { address, account } = useAccount();
const type = useOrderType({
orderHash: BigInt(tokenMarketData.order_hash),
});

const isOwner = address && areAddressesEqual(token.owner, address);
const isAuction = type === "AUCTION";

if (!account) {
return null;
Expand Down Expand Up @@ -108,12 +104,11 @@ const TokenOffers: React.FC<TokenOffersProps> = ({
</TableCell>
<TableCell className="flex justify-end">
<div className="flex space-x-2">
{isOwner && (
{isOwner && tokenMarketData !== null && (
<AcceptOffer
token={token}
tokenMarketData={tokenMarketData}
offer={offer}
isAuction={isAuction}
/>
)}
{areAddressesEqual(offer.offer_maker, address) && (
Expand Down

0 comments on commit 11eafcd

Please sign in to comment.