Skip to content

Commit

Permalink
working buy modal
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBeardEth committed Dec 13, 2023
1 parent 860aa0f commit 8eeedad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion apps/nextjs/src/app/collection/ERC721MarketplaceItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const ERC721MarketplaceItem: FC<Props> = ({
quantity,
}) => {
const royaltyPercent = royaltiesBps ? royaltiesBps / 100 : royaltiesBps;
console.log(typeof price);
return (
<div>
<div className="justify-space-between flex items-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { RouterOutputs } from "@/utils/api";
import { getTokenContractAddresses } from "@/utils/utils";
import { useAccount, useContractWrite } from "@starknet-react/core";
import { uint256 } from "starknet";
import { formatUnits } from "viem";
import { formatUnits, parseUnits } from "viem";

import {
LORDS,
Expand Down Expand Up @@ -135,7 +135,7 @@ export const BuyModalRender: FC<Props> = ({
entrypoint: "approve",
calldata: [
MarketplaceContract[ChainId["SN_" + NETWORK_NAME]] as `0x${string}`, //Marketplace address
listing?.price * 10 ** 18,
parseUnits(`${listing?.price}`, 18).toString(),
0,
],
},
Expand All @@ -150,8 +150,8 @@ export const BuyModalRender: FC<Props> = ({
});

const buyToken = useCallback(async () => {
if (!tokenId || !collectionId) {
const error = new Error("Missing tokenId or collectionId");
if (!listing) {
const error = new Error("Missing Listing");
setTransactionError(error);
throw error;
}
Expand Down

0 comments on commit 8eeedad

Please sign in to comment.