diff --git a/packages/nft/src/App.tsx b/packages/nft/src/App.tsx index ff5dfa1fa..61001b39a 100644 --- a/packages/nft/src/App.tsx +++ b/packages/nft/src/App.tsx @@ -36,7 +36,7 @@ export default function App() { } /> } /> } /> - } /> + } /> } /> } /> } /> diff --git a/packages/nft/src/components/Gallery.tsx b/packages/nft/src/components/Gallery.tsx index ae898d0f7..cc0aeff8d 100644 --- a/packages/nft/src/components/Gallery.tsx +++ b/packages/nft/src/components/Gallery.tsx @@ -23,27 +23,28 @@ export type UserQuery = Partial<{ function NFTCard({ nft }: { nft: NFT }) { return (
- +
-
-
- +
{nft.name}
-
-

- {nft.artist} -

-
+

+ {nft.artist} +

+
+
) } @@ -115,12 +116,7 @@ function FromRevs({ revs, computer }: { revs: string[]; computer: any }) {
{revs.map((rev) => (
- - - +
))}
@@ -206,7 +202,7 @@ export default function WithPagination(q: UserQuery) { const query = { ...q, ...params } query.offset = contractsPerPage * pageNum query.limit = contractsPerPage + 1 - query.order = 'DESC' + query.order = "DESC" const result = await computer.query(query) setIsNextAvailable(result.length > contractsPerPage) setRevs(result.slice(0, contractsPerPage)) diff --git a/packages/nft/src/components/Mint.tsx b/packages/nft/src/components/Mint.tsx index 338c7c9e0..4b3091dc9 100644 --- a/packages/nft/src/components/Mint.tsx +++ b/packages/nft/src/components/Mint.tsx @@ -5,14 +5,14 @@ import { Link } from "react-router-dom" import { Computer } from "@bitcoin-computer/lib" import { REACT_APP_NFT_MOD_SPEC } from "../constants/modSpecs" -function SuccessContent(rev: string) { +function SuccessContent(id: string) { return ( <>
Congratiolations! You minted an nft. Click{" "} { Modal.hideModal("success-modal") diff --git a/packages/nft/src/components/Nft.tsx b/packages/nft/src/components/Nft.tsx index 14e739046..a77c8ac54 100644 --- a/packages/nft/src/components/Nft.tsx +++ b/packages/nft/src/components/Nft.tsx @@ -10,7 +10,11 @@ import { import { Computer } from "@bitcoin-computer/lib" import { OfferHelper, PaymentHelper, PaymentMock, SaleHelper } from "@bitcoin-computer/swap" import { NFT } from "@bitcoin-computer/TBC721" -import { REACT_APP_OFFER_MOD_SPEC, REACT_APP_PAYMENT_MOD_SPEC, REACT_APP_SALE_MOD_SPEC } from "../constants/modSpecs" +import { + REACT_APP_OFFER_MOD_SPEC, + REACT_APP_PAYMENT_MOD_SPEC, + REACT_APP_SALE_MOD_SPEC +} from "../constants/modSpecs" const modalId = "smart-object-bought-modal" @@ -43,8 +47,8 @@ const BuyNFT = async ({ await computer.broadcast(finalTx) // const test = await computer.sync(txId) // need to have a sleep on this to get latest reve - const [updatedRev] = await computer.query({ ids: [nft._id] }) - setFunctionResult(updatedRev) + // const [updatedRev] = await computer.query({ ids: [nft._id] }) + setFunctionResult(nft._id) Modal.showModal(modalId) return nftAmount } @@ -285,14 +289,14 @@ function showBuyOffer(computer: Computer, smartObject: NFT) { return smartObject && smartObject._owners[0] !== computer.getPublicKey() && smartObject.offerTxRev } -function SuccessContent(rev: string) { +function SuccessContent(id: string) { return ( <>
You bought this NFT{" "} { Modal.hideModal(modalId) @@ -319,7 +323,7 @@ function NftView() { const location = useLocation() const params = useParams() const navigate = useNavigate() - const [rev] = useState(params.rev || "") + const [id] = useState(params.id || "") const computer = useContext(ComputerContext) const [smartObject, setSmartObject] = useState(null) const [functionResult, setFunctionResult] = useState({}) @@ -328,7 +332,8 @@ function NftView() { const fetch = async () => { try { showLoader(true) - const synced = await computer.sync(rev) + const latesRev = await computer.getLatestRev(id) + const synced = (await computer.sync(latesRev)) as any setSmartObject(synced) showLoader(false) } catch (error) { @@ -337,7 +342,7 @@ function NftView() { } } fetch() - }, [computer, rev, location, navigate]) + }, [computer, id, location, navigate]) return ( <>