Skip to content
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

collection minter wip #35

Open
wants to merge 27 commits into
base: alpha
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
Binary file modified bun.lockb
Binary file not shown.
3 changes: 1 addition & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ const nextConfig = {
reactStrictMode: true,
images: {
dangerouslyAllowSVG: true,
contentSecurityPolicy:
"default-src 'self'; script-src 'none'; sandbox;",
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
remotePatterns: [
{
protocol: "https",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"critters": "^0.0.20",
"crypto-es": "^2.1.0",
"daisyui": "^4.11.1",
"decimal.js": "^10.4.3",
"dompurify": "^3.0.9",
"framer-motion": "^11.1.7",
"isomorphic-dompurify": "^2.4.0",
Expand Down
7 changes: 7 additions & 0 deletions src/app/collection/generate/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import CraftingItemGenerator from "@/components/pages/collection/generate";

const CollectionGenerate = async () => {
return <CraftingItemGenerator />
}

export default CollectionGenerate;
2 changes: 1 addition & 1 deletion src/app/holders/[type]/[id]/details/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API_HOST, AssetType } from "@/constants";
import { NextRequest, NextResponse } from "next/server";
import { type NextRequest, NextResponse } from "next/server";

interface TickHolder {
address: string;
Expand Down
2 changes: 1 addition & 1 deletion src/app/listings/[tab]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ListingsPage from "@/components/pages/listings";
import { API_HOST, AssetType } from "@/constants";
import type { BSV20TXO, OrdUtxo } from "@/types/ordinals";
import type { BSV20TXO } from "@/types/ordinals";
import { getCapitalizedAssetType } from "@/utils/assetType";
import * as http from "@/utils/httpClient";

Expand Down
59 changes: 0 additions & 59 deletions src/app/market/[tab]/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,6 @@ import type { AssetType } from "@/constants";
import { getCapitalizedAssetType } from "@/utils/assetType";

const Market = async ({ params }: { params: { tab: AssetType } }) => {
// switch (params.tab) {
// case AssetType.Ordinals:
// // TODO: Featured ordinals
// const urlImages = `${API_HOST}/api/market?sort=recent&dir=desc&limit=20&offset=0&type=image/png`;
// const { promise } = http.customFetch<OrdUtxo[]>(urlImages);
// const imageListings = await promise;
// return (
// <MarketPage
// imageListings={imageListings}
// selectedAssetType={AssetType.Ordinals}
// />
// );
// case AssetType.BSV20:
// return (
// <MarketPage
// selectedAssetType={AssetType.BSV20}
// />
// );
// case AssetType.BSV21:
// return (
// <MarketPage
// selectedAssetType={AssetType.BSV21}
// />
// );
// case AssetType.LRC20:
// const q = {
// insc: {
// json: {
// p: "lrc-20",
// },
// },
// };

// const urlLrc20 = `${API_HOST}/api/market?sort=recent&dir=desc&limit=20&offset=0&q=${btoa(
// JSON.stringify(q)
// )}`;
// const { promise: promiseLrc20 } = http.customFetch<OrdUtxo[]>(urlLrc20);
// const lrc20Listings = await promiseLrc20;

// const lrc20TokenIds = lrc20Listings
// .filter((l) => !!l.origin?.data?.insc?.json?.id)
// .map((l) => l.origin?.data?.insc?.json?.id!);

// const urlLrc20Tokens = `${API_HOST}/api/txos/outpoints`;
// const { promise: promiseLrc20Tokens } = http.customFetch<OrdUtxo[]>(
// urlLrc20Tokens,
// {
// method: "POST",
// body: JSON.stringify(lrc20TokenIds),
// }
// );
// const lrc20Tokens = await promiseLrc20Tokens;

// return (

// );
// default:
// return null;
// }
return <NewListingPage type={params.tab} />;
};
export default Market;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Collections/featured.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const FeaturedCollections = () => {
<div key={`c-${collection.origin}`}>
<Link href={`/collection/${collection.origin}`}>
<Image
src={collection.previewUrl || `${ORDFS}/${collection.origin}`}
src={`${ORDFS}/${collection.origin|| collection.previewUrl} `}
alt={collection.name}
width={300}
height={300}
Expand Down
10 changes: 8 additions & 2 deletions src/components/Collections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useQuery } from "@tanstack/react-query";
import { Noto_Serif } from "next/font/google";
import Image from "next/image";
import Link from "next/link";
import { FaPlus } from "react-icons/fa6";
import "slick-carousel/slick/slick-theme.css";
import "slick-carousel/slick/slick.css";
import FeaturedCollections from "./featured";
Expand All @@ -30,15 +31,20 @@ const Collections = () => {
<>
<h1 className={`px-2 text-2xl mb-4 ${notoSerif.className}`}>Featured Collections</h1>
<FeaturedCollections />
<h1 className={`text-2xl px-2 mb-4 ${notoSerif.className}`}>Current Hype</h1>
<h1 className={"text-2xl px-2 mb-4 flex justify-between"}>
<div className={notoSerif.className}>
Current Hype
</div>
<Link className="btn btn-sm" href="/inscribe?tab=collection"><FaPlus className="mr-1" />New</Link>
</h1>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-2 w-full">
{data?.map((c) => (
<div key={c.outpoint} className="relative overflow-hidden mx-auto w-[300px] h-[300px]">
<Link href={`/collection/${c.outpoint}`}>
{/* <Image
width={300}
height={300}
src={c.data?.map?.previewUrl || `${ORDFS}/${c.outpoint}`}
src={`${ORDFS}/${c.outpoint}` || c.data?.map?.previewUrl}
alt=""
className="rounded-box"
/> */}
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Link from "next/link";
import { BsGpuCard } from "react-icons/bs";
import { FaBook, FaDiscord } from "react-icons/fa6";
import Vivi from "../vivi";

const Footer = () => {
const linkClass = "hover:text-yellow-500 text-yellow-400/25 transition-color duration-1000"
Expand Down
32 changes: 4 additions & 28 deletions src/components/artifact/json.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { FetchStatus, ORDFS } from "@/constants";
import type { BSV20 } from "@/types/bsv20";
import type { LRC20 } from "@/types/ordinals";
import type React from "react";
import { useEffect, useState } from "react";
import { LoaderIcon } from "react-hot-toast";
Expand All @@ -26,7 +25,6 @@ const JsonArtifact: React.FC<TextArtifactProps> = ({
}) => {
const [json, setJson] = useState<JSON | any>(j);
const [bsv20, setBsv20] = useState<Partial<BSV20> | undefined>();
const [lrc20, setLrc20] = useState<Partial<LRC20> | undefined>(undefined);
const [fetchTextStatus, setFetchTextStatus] = useState<FetchStatus>(
FetchStatus.Idle
);
Expand All @@ -45,12 +43,10 @@ const JsonArtifact: React.FC<TextArtifactProps> = ({
setFetchTextStatus(FetchStatus.Success);
setJson(resultText);

if (type === ArtifactType.LRC20 || type === ArtifactType.BSV20) {
if (type === ArtifactType.BSV20) {
const txJson = artifact.origin;
setFetchBsv20Status(FetchStatus.Success);
if (type === ArtifactType.LRC20) {
setLrc20(txJson);
} else if (type === ArtifactType.BSV20) {
if (type === ArtifactType.BSV20) {
setBsv20(txJson);
}
}
Expand Down Expand Up @@ -85,9 +81,8 @@ const JsonArtifact: React.FC<TextArtifactProps> = ({
<div className="relative w-full h-full flex">
{!mini && (
<pre
className={`overflow-hidden max-h-96 flex items-center justify-start w-full h-full transition text-xs ${
className ? className : ""
}`}
className={`overflow-hidden max-h-96 flex items-center justify-start w-full h-full transition text-xs ${className ? className : ""
}`}
>
{JSON.stringify(json, null, 2)}
</pre>
Expand All @@ -97,25 +92,6 @@ const JsonArtifact: React.FC<TextArtifactProps> = ({
<FaCode />
</div>
)}
{/* {!mini &&
type === ArtifactType.BSV20 &&
bsv20 &&
bsv20.status !== Bsv20Status.Valid && (
<div
className={`rounded bg-black bg-opacity-75 absolute bottom-0 p-2 md:p-4 ${
bsv20.status === Bsv20Status.Pending
? "text-yellow-400"
: "text-red-400"
} left-0 font-semibold w-full flex items-center justify-center text-sm`}
>
<IoMdWarning className="mr-2 w-8" />{" "}
{`${
bsv20.status === Bsv20Status.Pending
? "PENDING VALIDATION"
: "INVALID BSV20"
}`}
</div>
)} */}
</div>
) : (
<LoaderIcon className="mx-auto" />
Expand Down
11 changes: 11 additions & 0 deletions src/components/marketMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ const MarketMenu: React.FC = () => {
<div className="text-[#555]">NFT</div>
</Link>
</li>
<li>
<Link
href="/inscribe"
className="flex items-center justify-between"
>
<div>Inscribe</div>
<div className="text-[#555]">NFT / FT</div>
</Link>
</li>


<div className="divider">Token Market</div>
<li>
<Link
Expand Down
5 changes: 2 additions & 3 deletions src/components/pages/TokenMarket/fund.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ const Fund = ({ ticker }: { ticker: any }) => {
Listing Price{" "}
<div
className="tooltip"
data-tip={`This fee covers including ${
ticker.tick || ticker.sym
} on 1satordinals.com. Listing fee will be used to process pending actions.`}
data-tip={`This fee covers including ${ticker.tick || ticker.sym
} on 1sat.market. Listing fee will be used to process pending actions.`}
>
<FaQuestionCircle className="inline" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/collection/Traits.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client";

import { useEffect, useState } from "react";
import type { CollectionSubTypeData, MAP } from "js-1sat-ord";
import type { CollectionSubTypeData, CollectionTraits, CreateOrdinalsCollectionMetadata, MAP, PreMAP } from "js-1sat-ord";

interface TraitsProps {
collection: Collection;
collection: PreMAP;
}

export type Collection = MAP & {
Expand Down
Loading