@medialane/ui 0.246.0 → 0.247.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/asset-comments-dialog.cjs +2 -2
- package/dist/components/asset-comments-dialog.cjs.map +1 -1
- package/dist/components/asset-comments-dialog.d.cts +3 -9
- package/dist/components/asset-comments-dialog.d.ts +3 -9
- package/dist/components/asset-comments-dialog.js +2 -2
- package/dist/components/asset-comments-dialog.js.map +1 -1
- package/dist/components/asset-page.cjs +6 -7
- package/dist/components/asset-page.cjs.map +1 -1
- package/dist/components/asset-page.d.cts +4 -13
- package/dist/components/asset-page.d.ts +4 -13
- package/dist/components/asset-page.js +6 -7
- package/dist/components/asset-page.js.map +1 -1
- package/dist/components/collection-page.cjs +3 -2
- package/dist/components/collection-page.cjs.map +1 -1
- package/dist/components/collection-page.d.cts +0 -5
- package/dist/components/collection-page.d.ts +0 -5
- package/dist/components/collection-page.js +3 -2
- package/dist/components/collection-page.js.map +1 -1
- package/dist/components/comments-section.cjs +304 -0
- package/dist/components/comments-section.cjs.map +1 -0
- package/dist/components/comments-section.d.cts +10 -0
- package/dist/components/comments-section.d.ts +10 -0
- package/dist/components/comments-section.js +270 -0
- package/dist/components/comments-section.js.map +1 -0
- package/dist/components/medialane-app.cjs.map +1 -1
- package/dist/components/medialane-app.d.cts +3 -0
- package/dist/components/medialane-app.d.ts +3 -0
- package/dist/components/medialane-app.js.map +1 -1
- package/dist/components/pop-manage-page.cjs +224 -0
- package/dist/components/pop-manage-page.cjs.map +1 -0
- package/dist/components/pop-manage-page.d.cts +7 -0
- package/dist/components/pop-manage-page.d.ts +7 -0
- package/dist/components/pop-manage-page.js +190 -0
- package/dist/components/pop-manage-page.js.map +1 -0
- package/dist/components/portfolio-sponsorships.cjs +1 -1
- package/dist/components/portfolio-sponsorships.cjs.map +1 -1
- package/dist/components/portfolio-sponsorships.js +1 -1
- package/dist/components/portfolio-sponsorships.js.map +1 -1
- package/dist/components/transfer-collection-ownership.cjs +137 -0
- package/dist/components/transfer-collection-ownership.cjs.map +1 -0
- package/dist/components/transfer-collection-ownership.d.cts +11 -0
- package/dist/components/transfer-collection-ownership.d.ts +11 -0
- package/dist/components/transfer-collection-ownership.js +113 -0
- package/dist/components/transfer-collection-ownership.js.map +1 -0
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/use-transaction.cjs +2 -0
- package/dist/utils/use-transaction.cjs.map +1 -1
- package/dist/utils/use-transaction.d.cts +1 -1
- package/dist/utils/use-transaction.d.ts +1 -1
- package/dist/utils/use-transaction.js +2 -0
- package/dist/utils/use-transaction.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/pop-manage-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport { buildPopAllowlist, popClaimLinks, popClaimLinksCsv, type PopClaimLink } from \"@medialane/sdk/starknet\";\nimport { ArrowLeft, Award, AlertCircle, CheckCircle2, Download, Loader2, Send, Users } from \"lucide-react\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { FadeIn } from \"./motion-primitives.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { Textarea } from \"./textarea.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { WalletRequired } from \"./wallet-required.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useCollection } from \"../utils/use-collections.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\nfunction parseAddresses(raw: string): string[] {\n return raw\n .split(/[\\n,\\s]+/)\n .map((a) => a.trim())\n .filter((a) => /^0x[0-9a-fA-F]+$/.test(a));\n}\n\nfunction downloadCsv(links: PopClaimLink[]) {\n const href = URL.createObjectURL(new Blob([popClaimLinksCsv(links)], { type: \"text/csv\" }));\n const anchor = Object.assign(document.createElement(\"a\"), { href, download: \"claim-links.csv\" });\n anchor.click();\n URL.revokeObjectURL(href);\n}\n\nfunction IssueSection({\n onIssue,\n isSubmitting,\n}: {\n onIssue: (address: string) => void;\n isSubmitting: boolean;\n}) {\n const [raw, setRaw] = useState(\"\");\n const address = raw.trim();\n const valid = /^0x[0-9a-fA-F]{1,64}$/.test(address);\n\n return (\n <div className=\"bento-cell p-5 space-y-3\">\n <div className=\"flex items-center gap-2\">\n <Award className=\"h-4 w-4 text-green-500\" />\n <span className=\"font-semibold text-sm\">Issue directly</span>\n </div>\n <p className=\"text-xs text-muted-foreground\">\n Send the credential straight to one wallet — for a late participant, without republishing the list or\n changing anyone's claim link.\n </p>\n <input\n type=\"text\"\n placeholder=\"0x...\"\n value={raw}\n onChange={(e) => setRaw(e.target.value)}\n className=\"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm tabular-nums placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring\"\n />\n <Button\n size=\"sm\"\n variant=\"outline\"\n className=\"w-full\"\n disabled={!valid || isSubmitting}\n onClick={() => {\n onIssue(address);\n setRaw(\"\");\n }}\n >\n <Send className=\"h-3.5 w-3.5 mr-1.5\" />\n Issue credential\n </Button>\n </div>\n );\n}\n\nfunction AllowlistSection({\n onPublish,\n isSubmitting,\n links,\n}: {\n onPublish: (addresses: string[]) => void;\n isSubmitting: boolean;\n links: PopClaimLink[] | null;\n}) {\n const [raw, setRaw] = useState(\"\");\n const parsed = parseAddresses(raw);\n\n return (\n <div className=\"bento-cell p-5 space-y-3\">\n <div className=\"flex items-center gap-2\">\n <Users className=\"h-4 w-4 text-green-500\" />\n <span className=\"font-semibold text-sm\">Participants</span>\n {parsed.length > 0 && (\n <span className=\"ml-auto text-xs text-muted-foreground\">\n {parsed.length} address{parsed.length !== 1 ? \"es\" : \"\"}\n </span>\n )}\n </div>\n <p className=\"text-xs text-muted-foreground\">\n Paste every participant's wallet address. Publishing replaces the previous list and every link\n sent before it — send the new links to everyone who hasn't claimed yet. The list stays in this\n browser: download the claim links and send each participant theirs.\n </p>\n <Textarea\n placeholder={\"Paste Starknet addresses, one per line:\\n0x04a...\\n0x06b...\"}\n rows={8}\n value={raw}\n onChange={(e) => setRaw(e.target.value)}\n className=\"tabular-nums text-xs resize-none\"\n />\n <Button\n size=\"sm\"\n className=\"w-full bg-green-600 hover:bg-green-700 text-white\"\n disabled={parsed.length === 0 || isSubmitting}\n onClick={() => onPublish(parsed)}\n >\n {isSubmitting ? (\n <>\n <Loader2 className=\"h-3.5 w-3.5 animate-spin mr-1.5\" />\n Publishing…\n </>\n ) : (\n <>\n <CheckCircle2 className=\"h-3.5 w-3.5 mr-1.5\" />\n Publish {parsed.length > 0 ? `${parsed.length} participant${parsed.length !== 1 ? \"s\" : \"\"}` : \"participants\"}\n </>\n )}\n </Button>\n {links && (\n <div className=\"space-y-2 pt-2\">\n <Button variant=\"outline\" size=\"sm\" className=\"w-full\" onClick={() => downloadCsv(links)}>\n <Download className=\"h-3.5 w-3.5 mr-1.5\" />\n Download claim links (CSV)\n </Button>\n <ul className=\"max-h-48 overflow-auto text-xs tabular-nums space-y-1 text-muted-foreground\">\n {links.map((link) => (\n <li key={link.address} className=\"truncate\">{link.address}</li>\n ))}\n </ul>\n </div>\n )}\n </div>\n );\n}\n\nexport function PopManagePage({ contract }: { contract: string }) {\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const { collection, isLoading } = useCollection(contract);\n const tx = useTransaction();\n const [done, setDone] = useState({ title: \"\", description: \"\" });\n const [links, setLinks] = useState<PopClaimLink[] | null>(null);\n const isSubmitting = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const isOwner =\n walletAddress &&\n collection?.owner &&\n normalizeAddress(\"STARKNET\", walletAddress) === normalizeAddress(\"STARKNET\", collection.owner);\n\n const issue = (recipient: string) => {\n setDone({ title: \"Credential issued\", description: \"The credential is now in their wallet.\" });\n void tx.run(async (signer) => {\n await runIntentCalls(signer, () => app.getClient().api.intents.create(\"pop-manage\", { owner: signer.address, collection: contract, action: \"issue\", recipient }));\n });\n };\n\n const publish = (addresses: string[]) => {\n const list = buildPopAllowlist(addresses);\n const count = Object.keys(list.proofs).length;\n setDone({ title: \"Participants published\", description: `Published ${count} participant${count !== 1 ? \"s\" : \"\"}.` });\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () => app.getClient().api.intents.create(\"pop-manage\", { owner: signer.address, collection: contract, action: \"set_allowlist_root\", root: list.root }));\n })\n .then((ok) => {\n if (ok) setLinks(popClaimLinks(window.location.origin, contract, list));\n });\n };\n\n return (\n <WalletRequired icon={Award} title=\"Connect your wallet\" description=\"Connect to manage your event.\">\n {isLoading ? (\n <div className=\"max-w-xl mx-auto px-4 pt-10 pb-16 space-y-4\">\n <Skeleton className=\"h-6 w-24\" />\n <Skeleton className=\"h-32 w-full rounded-2xl\" />\n <Skeleton className=\"h-64 w-full rounded-2xl\" />\n </div>\n ) : !collection ? (\n <div className=\"max-w-xl mx-auto px-4 pt-24 pb-8 text-center space-y-4\">\n <AlertCircle className=\"h-10 w-10 text-muted-foreground/20 mx-auto\" />\n <p className=\"text-muted-foreground\">Collection not found.</p>\n <Button asChild variant=\"outline\" size=\"sm\">\n <Link href=\"/launchpad/pop\">← Back</Link>\n </Button>\n </div>\n ) : !isOwner ? (\n <div className=\"max-w-xl mx-auto px-4 pt-24 pb-8 text-center space-y-4\">\n <Award className=\"h-10 w-10 text-muted-foreground/20 mx-auto\" />\n <p className=\"text-muted-foreground\">You are not the organizer of this event.</p>\n <Button asChild variant=\"outline\" size=\"sm\">\n <Link href=\"/launchpad/pop\">← Back to events</Link>\n </Button>\n </div>\n ) : (\n <div className=\"max-w-xl mx-auto px-4 pt-10 pb-16 space-y-6\">\n <TransactionDialog tx={tx} title=\"Manage event\" workingLabel=\"Updating your event…\" firstStepLabel=\"Prepare\">\n <TransactionDone tx={tx} name={collection.name ?? \"Event\"} title={done.title} description={done.description} />\n </TransactionDialog>\n\n <FadeIn>\n <Button asChild variant=\"ghost\" size=\"sm\" className=\"-ml-2\">\n <Link href=\"/launchpad/pop\">\n <ArrowLeft className=\"h-3.5 w-3.5 mr-1.5\" />\n All events\n </Link>\n </Button>\n </FadeIn>\n\n <FadeIn delay={0.04}>\n <div>\n <span className=\"pill-badge inline-flex gap-1.5 mb-2\">\n <Award className=\"h-3 w-3\" />\n Organizer\n </span>\n <h1 className=\"text-2xl font-bold mt-1\">Manage Event</h1>\n <p className=\"text-sm text-muted-foreground\">{collection.name ?? contract}</p>\n </div>\n </FadeIn>\n\n <FadeIn delay={0.08}>\n <div className=\"bento-cell p-4 flex items-center gap-3\">\n <Award className=\"h-4 w-4 text-green-500 shrink-0\" />\n <p className=\"text-xs text-muted-foreground\">\n Only participants on your <strong className=\"text-foreground\">published list</strong> can claim,\n with the link you send them.\n </p>\n </div>\n </FadeIn>\n\n <FadeIn delay={0.12}>\n <AllowlistSection onPublish={publish} isSubmitting={isSubmitting} links={links} />\n </FadeIn>\n\n <FadeIn delay={0.16}>\n <IssueSection onIssue={issue} isSubmitting={isSubmitting} />\n </FadeIn>\n </div>\n )}\n </WalletRequired>\n );\n}\n"],"mappings":";AA8CM,SA0EI,UAzEF,KADF;AA5CN,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB,eAAe,wBAA2C;AACtF,SAAS,WAAW,OAAO,aAAa,cAAc,UAAU,SAAS,MAAM,aAAa;AAC5F,SAAS,cAAc;AACvB,OAAO,UAAU;AACjB,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS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MAAK,MAAK,WAAU,SAClD,+BAAC,QAAK,MAAK,kBACT;AAAA,0BAAC,aAAU,WAAU,sBAAqB;AAAA,MAAE;AAAA,OAE9C,GACF,GACF;AAAA,IAEA,oBAAC,UAAO,OAAO,MACb,+BAAC,SACC;AAAA,2BAAC,UAAK,WAAU,uCACd;AAAA,4BAAC,SAAM,WAAU,WAAU;AAAA,QAAE;AAAA,SAE/B;AAAA,MACA,oBAAC,QAAG,WAAU,2BAA0B,0BAAY;AAAA,MACpD,oBAAC,OAAE,WAAU,iCAAiC,qBAAW,QAAQ,UAAS;AAAA,OAC5E,GACF;AAAA,IAEA,oBAAC,UAAO,OAAO,MACb,+BAAC,SAAI,WAAU,0CACb;AAAA,0BAAC,SAAM,WAAU,mCAAkC;AAAA,MACnD,qBAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,QACjB,oBAAC,YAAO,WAAU,mBAAkB,4BAAc;AAAA,QAAS;AAAA,SAEvF;AAAA,OACF,GACF;AAAA,IAEA,oBAAC,UAAO,OAAO,MACb,8BAAC,oBAAiB,WAAW,SAAS,cAA4B,OAAc,GAClF;AAAA,IAEA,oBAAC,UAAO,OAAO,MACb,8BAAC,gBAAa,SAAS,OAAO,cAA4B,GAC5D;AAAA,KACF,GAEJ;AAEJ;","names":[]}
|
|
@@ -55,7 +55,7 @@ function useRowAction(copy) {
|
|
|
55
55
|
setActiveId(id);
|
|
56
56
|
void tx.run(async (signer) => {
|
|
57
57
|
await (0, import_run_intent_calls.runIntentCalls)(signer, () => create(app.getClient().api));
|
|
58
|
-
}).then(() => then()).finally(() => setActiveId(null));
|
|
58
|
+
}).then((ok) => ok ? then() : void 0).finally(() => setActiveId(null));
|
|
59
59
|
};
|
|
60
60
|
const dialog = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_dialog.TransactionDialog, { tx, title: copy.title, workingLabel: copy.working, firstStepLabel: "Prepare", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_done.TransactionDone, { tx, name: copy.title, title: copy.done, description: copy.description }) });
|
|
61
61
|
return { run, dialog, busy, activeId };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/portfolio-sponsorships.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Handshake, Loader2, X } from \"lucide-react\";\nimport { assetHref, type ApiSponsorshipOffer } from \"@medialane/sdk\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useSponsorshipBids, useSponsorshipLicenses, useSponsorshipOffers, useSponsorshipProposals } from \"../utils/use-sponsorship.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\ntype Api = ReturnType<ReturnType<typeof useMedialaneApp>[\"getClient\"]>[\"api\"];\n\nfunction useRowAction(copy: { title: string; working: string; done: string; description: string }) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [activeId, setActiveId] = useState<string | null>(null);\n const busy = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const run = (id: string, create: (api: Api) => ReturnType<Parameters<typeof runIntentCalls>[1]>, then: () => Promise<unknown>) => {\n setActiveId(id);\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () => create(app.getClient().api));\n })\n .then(() => then())\n .finally(() => setActiveId(null));\n };\n\n const dialog = (\n <TransactionDialog tx={tx} title={copy.title} workingLabel={copy.working} firstStepLabel=\"Prepare\">\n <TransactionDone tx={tx} name={copy.title} title={copy.done} description={copy.description} />\n </TransactionDialog>\n );\n\n return { run, dialog, busy, activeId };\n}\n\nfunction Spinner({ active, idle, className }: { active: boolean; idle: React.ReactNode; className?: string }) {\n return active ? <Loader2 className={`h-3 w-3 animate-spin ${className ?? \"\"}`} /> : <>{idle}</>;\n}\n\nfunction OfferBidsRow({ offer }: { offer: ApiSponsorshipOffer }) {\n const { walletAddress } = useMedialaneApp();\n const { bids, isLoading, mutate } = useSponsorshipBids(offer.offerId);\n const action = useRowAction({ title: \"Accept bid\", working: \"Accepting the bid…\", done: \"Bid accepted!\", description: \"The license is minted to the sponsor.\" });\n\n if (isLoading || bids.length === 0) return null;\n\n return (\n <div className=\"space-y-1.5 rounded-lg bg-muted/30 p-3\">\n {action.dialog}\n <p className=\"text-xs font-semibold text-muted-foreground\">\n Bids on <Link href={assetHref(\"STARKNET\", offer.nftContract, offer.tokenId)} className=\"underline underline-offset-2\">View asset</Link>\n </p>\n {bids.map((bid) => (\n <div key={bid.id} className=\"flex items-center justify-between gap-2 text-xs\">\n <AddressDisplay address={bid.sponsor} chars={4} showCopy={false} className=\"text-muted-foreground\" />\n <Button\n size=\"sm\"\n className=\"bg-brand-rose hover:brightness-110 text-white h-7 px-2.5\"\n aria-label=\"Accept bid\"\n disabled={action.busy || !walletAddress}\n onClick={() =>\n action.run(\n bid.id,\n (api) => api.intents.create(\"sponsorship-bid-accept\", { author: walletAddress!, offerId: offer.offerId, sponsor: bid.sponsor }),\n () => mutate(),\n )\n }\n >\n <Spinner active={action.busy && action.activeId === bid.id} idle={<CheckCircle2 className=\"h-3 w-3\" />} />\n </Button>\n </div>\n ))}\n </div>\n );\n}\n\nfunction ReceivedProposals({ walletAddress }: { walletAddress: string }) {\n const { proposals, isLoading, mutate } = useSponsorshipProposals({ owner: walletAddress, open: true });\n const action = useRowAction({ title: \"Respond to proposal\", working: \"Sending your response…\", done: \"Response sent!\", description: \"Your response is now on-chain.\" });\n\n if (isLoading) return <Skeleton className=\"h-20 w-full rounded-xl\" />;\n if (proposals.length === 0) return <p className=\"text-sm text-muted-foreground\">No proposals awaiting your decision.</p>;\n\n const respond = (proposalId: string, decision: \"accept\" | \"reject\") =>\n action.run(\n proposalId,\n (api) =>\n decision === \"accept\"\n ? api.intents.create(\"sponsorship-proposal-accept\", { owner: walletAddress, proposalId })\n : api.intents.create(\"sponsorship-proposal-reject\", { owner: walletAddress, proposalId }),\n () => mutate(),\n );\n\n return (\n <div className=\"space-y-2\">\n {action.dialog}\n {proposals.map((p) => (\n <div key={p.id} className=\"bento-cell p-4 flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", p.nftContract, p.tokenId)} className=\"hover:underline\">View asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">\n <AddressDisplay address={p.proposer} chars={4} showCopy={false} /> proposed {p.amount}\n </p>\n </div>\n <div className=\"flex gap-1.5 shrink-0\">\n <Button size=\"sm\" variant=\"outline\" aria-label=\"Decline proposal\" disabled={action.busy} onClick={() => respond(p.proposalId, \"reject\")}>\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={<X className=\"h-3 w-3\" />} />\n </Button>\n <Button size=\"sm\" className=\"bg-brand-rose hover:brightness-110 text-white\" aria-label=\"Accept proposal\" disabled={action.busy} onClick={() => respond(p.proposalId, \"accept\")}>\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={<CheckCircle2 className=\"h-3 w-3\" />} />\n </Button>\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction SentProposals({ walletAddress }: { walletAddress: string }) {\n const { proposals, isLoading, mutate } = useSponsorshipProposals({ proposer: walletAddress, open: true });\n const action = useRowAction({ title: \"Withdraw proposal\", working: \"Withdrawing your proposal…\", done: \"Proposal withdrawn!\", description: \"Your proposal is no longer open.\" });\n\n if (isLoading) return <Skeleton className=\"h-20 w-full rounded-xl\" />;\n if (proposals.length === 0) return <p className=\"text-sm text-muted-foreground\">No pending proposals sent.</p>;\n\n return (\n <div className=\"space-y-2\">\n {action.dialog}\n {proposals.map((p) => (\n <div key={p.id} className=\"bento-cell p-4 flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", p.nftContract, p.tokenId)} className=\"hover:underline\">View asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">You proposed {p.amount}</p>\n </div>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={action.busy}\n onClick={() =>\n action.run(p.proposalId, (api) => api.intents.create(\"sponsorship-proposal-withdraw\", { proposer: walletAddress, proposalId: p.proposalId }), () => mutate())\n }\n >\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={null} className=\"mr-1.5\" />\n Withdraw\n </Button>\n </div>\n ))}\n </div>\n );\n}\n\nfunction LicenseList({ loading, empty, children }: { loading: boolean; empty: string; children: React.ReactNode[] }) {\n if (loading) return <Skeleton className=\"h-16 w-full rounded-xl\" />;\n if (children.length === 0) return <p className=\"text-sm text-muted-foreground\">{empty}</p>;\n return <div className=\"space-y-2\">{children}</div>;\n}\n\nexport function PortfolioSponsorships() {\n const { walletAddress } = useMedialaneApp();\n const { offers } = useSponsorshipOffers(walletAddress ? { author: walletAddress, open: true } : undefined);\n const { licenses: held, isLoading: heldLoading } = useSponsorshipLicenses(walletAddress ? { holder: walletAddress } : undefined);\n const { licenses: issued, isLoading: issuedLoading } = useSponsorshipLicenses(walletAddress ? { author: walletAddress } : undefined);\n\n if (!walletAddress) return null;\n\n return (\n <div className=\"space-y-8\">\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold flex items-center gap-2\"><Handshake className=\"h-4 w-4 text-brand-rose\" />Proposals awaiting your decision</h2>\n <ReceivedProposals walletAddress={walletAddress} />\n </section>\n\n {offers.length > 0 && (\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Bids on your offers</h2>\n <div className=\"space-y-2\">\n {offers.map((o) => <OfferBidsRow key={o.id} offer={o} />)}\n </div>\n </section>\n )}\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Proposals you've sent</h2>\n <SentProposals walletAddress={walletAddress} />\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Licenses you hold</h2>\n <LicenseList loading={heldLoading} empty=\"No sponsorship licenses yet.\">\n {held.map((l) => (\n <div key={l.id} className=\"bento-cell p-4\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", l.assetContract, l.assetTokenId)} className=\"hover:underline\">License on this asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">from <AddressDisplay address={l.author} chars={4} showCopy={false} /></p>\n </div>\n ))}\n </LicenseList>\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Licenses issued on your work</h2>\n <LicenseList loading={issuedLoading} empty=\"No licenses issued yet.\">\n {issued.map((l) => (\n <div key={l.id} className=\"bento-cell p-4\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", l.assetContract, l.assetTokenId)} className=\"hover:underline\">License on this asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">held by <AddressDisplay address={l.currentHolder ?? l.recipient} chars={4} showCopy={false} /></p>\n </div>\n ))}\n </LicenseList>\n </section>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCM;AAlCN,mBAAyB;AACzB,0BAAoD;AACpD,iBAAoD;AACpD,6BAA+B;AAC/B,oBAAuB;AACvB,kBAAiB;AACjB,2BAAgC;AAChC,sBAAyB;AACzB,gCAAkC;AAClC,8BAAgC;AAChC,8BAA+B;AAC/B,6BAA0G;AAC1G,6BAA+B;AAI/B,SAAS,aAAa,MAA6E;AACjG,QAAM,UAAM,sCAAgB;AAC5B,QAAM,SAAK,uCAAe;AAC1B,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAwB,IAAI;AAC5D,QAAM,OAAO,GAAG,UAAU,eAAe,GAAG,UAAU,gBAAgB,GAAG,UAAU;AAEnF,QAAM,MAAM,CAAC,IAAY,QAAwE,SAAiC;AAChI,gBAAY,EAAE;AACd,SAAK,GACF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,eAAe,OAAM,2BACxC,iBAAO,IAAI,CAAC,MACX,6CAAC,SAAe,WAAU,kBACxB;AAAA,oDAAC,OAAE,WAAU,yBACX,sDAAC,YAAAA,SAAA,EAAK,UAAM,sBAAU,YAAY,EAAE,eAAe,EAAE,YAAY,GAAG,WAAU,mBAAkB,mCAAqB,GACvH;AAAA,QACA,6CAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,UAAQ,4CAAC,yCAAe,SAAS,EAAE,iBAAiB,EAAE,WAAW,OAAO,GAAG,UAAU,OAAO;AAAA,WAAE;AAAA,WAJnI,EAAE,EAKZ,CACD,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":["Link"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/portfolio-sponsorships.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Handshake, Loader2, X } from \"lucide-react\";\nimport { assetHref, type ApiSponsorshipOffer } from \"@medialane/sdk\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useSponsorshipBids, useSponsorshipLicenses, useSponsorshipOffers, useSponsorshipProposals } from \"../utils/use-sponsorship.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\ntype Api = ReturnType<ReturnType<typeof useMedialaneApp>[\"getClient\"]>[\"api\"];\n\nfunction useRowAction(copy: { title: string; working: string; done: string; description: string }) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [activeId, setActiveId] = useState<string | null>(null);\n const busy = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const run = (id: string, create: (api: Api) => ReturnType<Parameters<typeof runIntentCalls>[1]>, then: () => Promise<unknown>) => {\n setActiveId(id);\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () => create(app.getClient().api));\n })\n .then((ok) => (ok ? then() : undefined))\n .finally(() => setActiveId(null));\n };\n\n const dialog = (\n <TransactionDialog tx={tx} title={copy.title} workingLabel={copy.working} firstStepLabel=\"Prepare\">\n <TransactionDone tx={tx} name={copy.title} title={copy.done} description={copy.description} />\n </TransactionDialog>\n );\n\n return { run, dialog, busy, activeId };\n}\n\nfunction Spinner({ active, idle, className }: { active: boolean; idle: React.ReactNode; className?: string }) {\n return active ? <Loader2 className={`h-3 w-3 animate-spin ${className ?? \"\"}`} /> : <>{idle}</>;\n}\n\nfunction OfferBidsRow({ offer }: { offer: ApiSponsorshipOffer }) {\n const { walletAddress } = useMedialaneApp();\n const { bids, isLoading, mutate } = useSponsorshipBids(offer.offerId);\n const action = useRowAction({ title: \"Accept bid\", working: \"Accepting the bid…\", done: \"Bid accepted!\", description: \"The license is minted to the sponsor.\" });\n\n if (isLoading || bids.length === 0) return null;\n\n return (\n <div className=\"space-y-1.5 rounded-lg bg-muted/30 p-3\">\n {action.dialog}\n <p className=\"text-xs font-semibold text-muted-foreground\">\n Bids on <Link href={assetHref(\"STARKNET\", offer.nftContract, offer.tokenId)} className=\"underline underline-offset-2\">View asset</Link>\n </p>\n {bids.map((bid) => (\n <div key={bid.id} className=\"flex items-center justify-between gap-2 text-xs\">\n <AddressDisplay address={bid.sponsor} chars={4} showCopy={false} className=\"text-muted-foreground\" />\n <Button\n size=\"sm\"\n className=\"bg-brand-rose hover:brightness-110 text-white h-7 px-2.5\"\n aria-label=\"Accept bid\"\n disabled={action.busy || !walletAddress}\n onClick={() =>\n action.run(\n bid.id,\n (api) => api.intents.create(\"sponsorship-bid-accept\", { author: walletAddress!, offerId: offer.offerId, sponsor: bid.sponsor }),\n () => mutate(),\n )\n }\n >\n <Spinner active={action.busy && action.activeId === bid.id} idle={<CheckCircle2 className=\"h-3 w-3\" />} />\n </Button>\n </div>\n ))}\n </div>\n );\n}\n\nfunction ReceivedProposals({ walletAddress }: { walletAddress: string }) {\n const { proposals, isLoading, mutate } = useSponsorshipProposals({ owner: walletAddress, open: true });\n const action = useRowAction({ title: \"Respond to proposal\", working: \"Sending your response…\", done: \"Response sent!\", description: \"Your response is now on-chain.\" });\n\n if (isLoading) return <Skeleton className=\"h-20 w-full rounded-xl\" />;\n if (proposals.length === 0) return <p className=\"text-sm text-muted-foreground\">No proposals awaiting your decision.</p>;\n\n const respond = (proposalId: string, decision: \"accept\" | \"reject\") =>\n action.run(\n proposalId,\n (api) =>\n decision === \"accept\"\n ? api.intents.create(\"sponsorship-proposal-accept\", { owner: walletAddress, proposalId })\n : api.intents.create(\"sponsorship-proposal-reject\", { owner: walletAddress, proposalId }),\n () => mutate(),\n );\n\n return (\n <div className=\"space-y-2\">\n {action.dialog}\n {proposals.map((p) => (\n <div key={p.id} className=\"bento-cell p-4 flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", p.nftContract, p.tokenId)} className=\"hover:underline\">View asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">\n <AddressDisplay address={p.proposer} chars={4} showCopy={false} /> proposed {p.amount}\n </p>\n </div>\n <div className=\"flex gap-1.5 shrink-0\">\n <Button size=\"sm\" variant=\"outline\" aria-label=\"Decline proposal\" disabled={action.busy} onClick={() => respond(p.proposalId, \"reject\")}>\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={<X className=\"h-3 w-3\" />} />\n </Button>\n <Button size=\"sm\" className=\"bg-brand-rose hover:brightness-110 text-white\" aria-label=\"Accept proposal\" disabled={action.busy} onClick={() => respond(p.proposalId, \"accept\")}>\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={<CheckCircle2 className=\"h-3 w-3\" />} />\n </Button>\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction SentProposals({ walletAddress }: { walletAddress: string }) {\n const { proposals, isLoading, mutate } = useSponsorshipProposals({ proposer: walletAddress, open: true });\n const action = useRowAction({ title: \"Withdraw proposal\", working: \"Withdrawing your proposal…\", done: \"Proposal withdrawn!\", description: \"Your proposal is no longer open.\" });\n\n if (isLoading) return <Skeleton className=\"h-20 w-full rounded-xl\" />;\n if (proposals.length === 0) return <p className=\"text-sm text-muted-foreground\">No pending proposals sent.</p>;\n\n return (\n <div className=\"space-y-2\">\n {action.dialog}\n {proposals.map((p) => (\n <div key={p.id} className=\"bento-cell p-4 flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", p.nftContract, p.tokenId)} className=\"hover:underline\">View asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">You proposed {p.amount}</p>\n </div>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={action.busy}\n onClick={() =>\n action.run(p.proposalId, (api) => api.intents.create(\"sponsorship-proposal-withdraw\", { proposer: walletAddress, proposalId: p.proposalId }), () => mutate())\n }\n >\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={null} className=\"mr-1.5\" />\n Withdraw\n </Button>\n </div>\n ))}\n </div>\n );\n}\n\nfunction LicenseList({ loading, empty, children }: { loading: boolean; empty: string; children: React.ReactNode[] }) {\n if (loading) return <Skeleton className=\"h-16 w-full rounded-xl\" />;\n if (children.length === 0) return <p className=\"text-sm text-muted-foreground\">{empty}</p>;\n return <div className=\"space-y-2\">{children}</div>;\n}\n\nexport function PortfolioSponsorships() {\n const { walletAddress } = useMedialaneApp();\n const { offers } = useSponsorshipOffers(walletAddress ? { author: walletAddress, open: true } : undefined);\n const { licenses: held, isLoading: heldLoading } = useSponsorshipLicenses(walletAddress ? { holder: walletAddress } : undefined);\n const { licenses: issued, isLoading: issuedLoading } = useSponsorshipLicenses(walletAddress ? { author: walletAddress } : undefined);\n\n if (!walletAddress) return null;\n\n return (\n <div className=\"space-y-8\">\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold flex items-center gap-2\"><Handshake className=\"h-4 w-4 text-brand-rose\" />Proposals awaiting your decision</h2>\n <ReceivedProposals walletAddress={walletAddress} />\n </section>\n\n {offers.length > 0 && (\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Bids on your offers</h2>\n <div className=\"space-y-2\">\n {offers.map((o) => <OfferBidsRow key={o.id} offer={o} />)}\n </div>\n </section>\n )}\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Proposals you've sent</h2>\n <SentProposals walletAddress={walletAddress} />\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Licenses you hold</h2>\n <LicenseList loading={heldLoading} empty=\"No sponsorship licenses yet.\">\n {held.map((l) => (\n <div key={l.id} className=\"bento-cell p-4\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", l.assetContract, l.assetTokenId)} className=\"hover:underline\">License on this asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">from <AddressDisplay address={l.author} chars={4} showCopy={false} /></p>\n </div>\n ))}\n </LicenseList>\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Licenses issued on your work</h2>\n <LicenseList loading={issuedLoading} empty=\"No licenses issued yet.\">\n {issued.map((l) => (\n <div key={l.id} className=\"bento-cell p-4\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", l.assetContract, l.assetTokenId)} className=\"hover:underline\">License on this asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">held by <AddressDisplay address={l.currentHolder ?? l.recipient} chars={4} showCopy={false} /></p>\n </div>\n ))}\n </LicenseList>\n </section>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCM;AAlCN,mBAAyB;AACzB,0BAAoD;AACpD,iBAAoD;AACpD,6BAA+B;AAC/B,oBAAuB;AACvB,kBAAiB;AACjB,2BAAgC;AAChC,sBAAyB;A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A,EAAK,UAAM,sBAAU,YAAY,EAAE,eAAe,EAAE,YAAY,GAAG,WAAU,mBAAkB,mCAAqB,GACvH;AAAA,QACA,6CAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,UAAK,4CAAC,yCAAe,SAAS,EAAE,QAAQ,OAAO,GAAG,UAAU,OAAO;AAAA,WAAE;AAAA,WAJ1G,EAAE,EAKZ,CACD,GACH;AAAA,OACF;AAAA,IAEA,6CAAC,aAAQ,WAAU,aACjB;AAAA,kDAAC,QAAG,WAAU,qBAAoB,0CAA4B;AAAA,MAC9D,4CAAC,eAAY,SAAS,eAAe,OAAM,2BACxC,iBAAO,IAAI,CAAC,MACX,6CAAC,SAAe,WAAU,kBACxB;AAAA,oDAAC,OAAE,WAAU,yBACX,sDAAC,YAAAA,SAAA,EAAK,UAAM,sBAAU,YAAY,EAAE,eAAe,EAAE,YAAY,GAAG,WAAU,mBAAkB,mCAAqB,GACvH;AAAA,QACA,6CAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,UAAQ,4CAAC,yCAAe,SAAS,EAAE,iBAAiB,EAAE,WAAW,OAAO,GAAG,UAAU,OAAO;AAAA,WAAE;AAAA,WAJnI,EAAE,EAKZ,CACD,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":["Link"]}
|
|
@@ -22,7 +22,7 @@ function useRowAction(copy) {
|
|
|
22
22
|
setActiveId(id);
|
|
23
23
|
void tx.run(async (signer) => {
|
|
24
24
|
await runIntentCalls(signer, () => create(app.getClient().api));
|
|
25
|
-
}).then(() => then()).finally(() => setActiveId(null));
|
|
25
|
+
}).then((ok) => ok ? then() : void 0).finally(() => setActiveId(null));
|
|
26
26
|
};
|
|
27
27
|
const dialog = /* @__PURE__ */ jsx(TransactionDialog, { tx, title: copy.title, workingLabel: copy.working, firstStepLabel: "Prepare", children: /* @__PURE__ */ jsx(TransactionDone, { tx, name: copy.title, title: copy.done, description: copy.description }) });
|
|
28
28
|
return { run, dialog, busy, activeId };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/portfolio-sponsorships.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Handshake, Loader2, X } from \"lucide-react\";\nimport { assetHref, type ApiSponsorshipOffer } from \"@medialane/sdk\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useSponsorshipBids, useSponsorshipLicenses, useSponsorshipOffers, useSponsorshipProposals } from \"../utils/use-sponsorship.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\ntype Api = ReturnType<ReturnType<typeof useMedialaneApp>[\"getClient\"]>[\"api\"];\n\nfunction useRowAction(copy: { title: string; working: string; done: string; description: string }) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [activeId, setActiveId] = useState<string | null>(null);\n const busy = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const run = (id: string, create: (api: Api) => ReturnType<Parameters<typeof runIntentCalls>[1]>, then: () => Promise<unknown>) => {\n setActiveId(id);\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () => create(app.getClient().api));\n })\n .then(() => then())\n .finally(() => setActiveId(null));\n };\n\n const dialog = (\n <TransactionDialog tx={tx} title={copy.title} workingLabel={copy.working} firstStepLabel=\"Prepare\">\n <TransactionDone tx={tx} name={copy.title} title={copy.done} description={copy.description} />\n </TransactionDialog>\n );\n\n return { run, dialog, busy, activeId };\n}\n\nfunction Spinner({ active, idle, className }: { active: boolean; idle: React.ReactNode; className?: string }) {\n return active ? <Loader2 className={`h-3 w-3 animate-spin ${className ?? \"\"}`} /> : <>{idle}</>;\n}\n\nfunction OfferBidsRow({ offer }: { offer: ApiSponsorshipOffer }) {\n const { walletAddress } = useMedialaneApp();\n const { bids, isLoading, mutate } = useSponsorshipBids(offer.offerId);\n const action = useRowAction({ title: \"Accept bid\", working: \"Accepting the bid…\", done: \"Bid accepted!\", description: \"The license is minted to the sponsor.\" });\n\n if (isLoading || bids.length === 0) return null;\n\n return (\n <div className=\"space-y-1.5 rounded-lg bg-muted/30 p-3\">\n {action.dialog}\n <p className=\"text-xs font-semibold text-muted-foreground\">\n Bids on <Link href={assetHref(\"STARKNET\", offer.nftContract, offer.tokenId)} className=\"underline underline-offset-2\">View asset</Link>\n </p>\n {bids.map((bid) => (\n <div key={bid.id} className=\"flex items-center justify-between gap-2 text-xs\">\n <AddressDisplay address={bid.sponsor} chars={4} showCopy={false} className=\"text-muted-foreground\" />\n <Button\n size=\"sm\"\n className=\"bg-brand-rose hover:brightness-110 text-white h-7 px-2.5\"\n aria-label=\"Accept bid\"\n disabled={action.busy || !walletAddress}\n onClick={() =>\n action.run(\n bid.id,\n (api) => api.intents.create(\"sponsorship-bid-accept\", { author: walletAddress!, offerId: offer.offerId, sponsor: bid.sponsor }),\n () => mutate(),\n )\n }\n >\n <Spinner active={action.busy && action.activeId === bid.id} idle={<CheckCircle2 className=\"h-3 w-3\" />} />\n </Button>\n </div>\n ))}\n </div>\n );\n}\n\nfunction ReceivedProposals({ walletAddress }: { walletAddress: string }) {\n const { proposals, isLoading, mutate } = useSponsorshipProposals({ owner: walletAddress, open: true });\n const action = useRowAction({ title: \"Respond to proposal\", working: \"Sending your response…\", done: \"Response sent!\", description: \"Your response is now on-chain.\" });\n\n if (isLoading) return <Skeleton className=\"h-20 w-full rounded-xl\" />;\n if (proposals.length === 0) return <p className=\"text-sm text-muted-foreground\">No proposals awaiting your decision.</p>;\n\n const respond = (proposalId: string, decision: \"accept\" | \"reject\") =>\n action.run(\n proposalId,\n (api) =>\n decision === \"accept\"\n ? api.intents.create(\"sponsorship-proposal-accept\", { owner: walletAddress, proposalId })\n : api.intents.create(\"sponsorship-proposal-reject\", { owner: walletAddress, proposalId }),\n () => mutate(),\n );\n\n return (\n <div className=\"space-y-2\">\n {action.dialog}\n {proposals.map((p) => (\n <div key={p.id} className=\"bento-cell p-4 flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", p.nftContract, p.tokenId)} className=\"hover:underline\">View asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">\n <AddressDisplay address={p.proposer} chars={4} showCopy={false} /> proposed {p.amount}\n </p>\n </div>\n <div className=\"flex gap-1.5 shrink-0\">\n <Button size=\"sm\" variant=\"outline\" aria-label=\"Decline proposal\" disabled={action.busy} onClick={() => respond(p.proposalId, \"reject\")}>\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={<X className=\"h-3 w-3\" />} />\n </Button>\n <Button size=\"sm\" className=\"bg-brand-rose hover:brightness-110 text-white\" aria-label=\"Accept proposal\" disabled={action.busy} onClick={() => respond(p.proposalId, \"accept\")}>\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={<CheckCircle2 className=\"h-3 w-3\" />} />\n </Button>\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction SentProposals({ walletAddress }: { walletAddress: string }) {\n const { proposals, isLoading, mutate } = useSponsorshipProposals({ proposer: walletAddress, open: true });\n const action = useRowAction({ title: \"Withdraw proposal\", working: \"Withdrawing your proposal…\", done: \"Proposal withdrawn!\", description: \"Your proposal is no longer open.\" });\n\n if (isLoading) return <Skeleton className=\"h-20 w-full rounded-xl\" />;\n if (proposals.length === 0) return <p className=\"text-sm text-muted-foreground\">No pending proposals sent.</p>;\n\n return (\n <div className=\"space-y-2\">\n {action.dialog}\n {proposals.map((p) => (\n <div key={p.id} className=\"bento-cell p-4 flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", p.nftContract, p.tokenId)} className=\"hover:underline\">View asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">You proposed {p.amount}</p>\n </div>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={action.busy}\n onClick={() =>\n action.run(p.proposalId, (api) => api.intents.create(\"sponsorship-proposal-withdraw\", { proposer: walletAddress, proposalId: p.proposalId }), () => mutate())\n }\n >\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={null} className=\"mr-1.5\" />\n Withdraw\n </Button>\n </div>\n ))}\n </div>\n );\n}\n\nfunction LicenseList({ loading, empty, children }: { loading: boolean; empty: string; children: React.ReactNode[] }) {\n if (loading) return <Skeleton className=\"h-16 w-full rounded-xl\" />;\n if (children.length === 0) return <p className=\"text-sm text-muted-foreground\">{empty}</p>;\n return <div className=\"space-y-2\">{children}</div>;\n}\n\nexport function PortfolioSponsorships() {\n const { walletAddress } = useMedialaneApp();\n const { offers } = useSponsorshipOffers(walletAddress ? { author: walletAddress, open: true } : undefined);\n const { licenses: held, isLoading: heldLoading } = useSponsorshipLicenses(walletAddress ? { holder: walletAddress } : undefined);\n const { licenses: issued, isLoading: issuedLoading } = useSponsorshipLicenses(walletAddress ? { author: walletAddress } : undefined);\n\n if (!walletAddress) return null;\n\n return (\n <div className=\"space-y-8\">\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold flex items-center gap-2\"><Handshake className=\"h-4 w-4 text-brand-rose\" />Proposals awaiting your decision</h2>\n <ReceivedProposals walletAddress={walletAddress} />\n </section>\n\n {offers.length > 0 && (\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Bids on your offers</h2>\n <div className=\"space-y-2\">\n {offers.map((o) => <OfferBidsRow key={o.id} offer={o} />)}\n </div>\n </section>\n )}\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Proposals you've sent</h2>\n <SentProposals walletAddress={walletAddress} />\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Licenses you hold</h2>\n <LicenseList loading={heldLoading} empty=\"No sponsorship licenses yet.\">\n {held.map((l) => (\n <div key={l.id} className=\"bento-cell p-4\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", l.assetContract, l.assetTokenId)} className=\"hover:underline\">License on this asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">from <AddressDisplay address={l.author} chars={4} showCopy={false} /></p>\n </div>\n ))}\n </LicenseList>\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Licenses issued on your work</h2>\n <LicenseList loading={issuedLoading} empty=\"No licenses issued yet.\">\n {issued.map((l) => (\n <div key={l.id} className=\"bento-cell p-4\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", l.assetContract, l.assetTokenId)} className=\"hover:underline\">License on this asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">held by <AddressDisplay address={l.currentHolder ?? l.recipient} chars={4} showCopy={false} /></p>\n </div>\n ))}\n </LicenseList>\n </section>\n </div>\n );\n}\n"],"mappings":";AAoCM,SAQgF,UARhF,KAqBA,YArBA;AAlCN,SAAS,gBAAgB;AACzB,SAAS,cAAc,WAAW,SAAS,SAAS;AACpD,SAAS,iBAA2C;AACpD,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,OAAO,UAAU;AACjB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB,wBAAwB,sBAAsB,+BAA+B;AAC1G,SAAS,sBAAsB;AAI/B,SAAS,aAAa,MAA6E;AACjG,QAAM,MAAM,gBAAgB;AAC5B,QAAM,KAAK,eAAe;AAC1B,QAAM,CAAC,UAAU,WAAW,IAAI,SAAwB,IAAI;AAC5D,QAAM,OAAO,GAAG,UAAU,eAAe,GAAG,UAAU,gBAAgB,GAAG,UAAU;AAEnF,QAAM,MAAM,CAAC,IAAY,QAAwE,SAAiC;AAChI,gBAAY,EAAE;AACd,SAAK,GACF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;AAAA,4BAAC,OAAE,WAAU,yBACX,8BAAC,QAAK,MAAM,UAAU,YAAY,EAAE,eAAe,EAAE,YAAY,GAAG,WAAU,mBAAkB,mCAAqB,GACvH;AAAA,QACA,qBAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,UAAQ,oBAAC,kBAAe,SAAS,EAAE,iBAAiB,EAAE,WAAW,OAAO,GAAG,UAAU,OAAO;AAAA,WAAE;AAAA,WAJnI,EAAE,EAKZ,CACD,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/portfolio-sponsorships.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Handshake, Loader2, X } from \"lucide-react\";\nimport { assetHref, type ApiSponsorshipOffer } from \"@medialane/sdk\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useSponsorshipBids, useSponsorshipLicenses, useSponsorshipOffers, useSponsorshipProposals } from \"../utils/use-sponsorship.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\ntype Api = ReturnType<ReturnType<typeof useMedialaneApp>[\"getClient\"]>[\"api\"];\n\nfunction useRowAction(copy: { title: string; working: string; done: string; description: string }) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [activeId, setActiveId] = useState<string | null>(null);\n const busy = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const run = (id: string, create: (api: Api) => ReturnType<Parameters<typeof runIntentCalls>[1]>, then: () => Promise<unknown>) => {\n setActiveId(id);\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () => create(app.getClient().api));\n })\n .then((ok) => (ok ? then() : undefined))\n .finally(() => setActiveId(null));\n };\n\n const dialog = (\n <TransactionDialog tx={tx} title={copy.title} workingLabel={copy.working} firstStepLabel=\"Prepare\">\n <TransactionDone tx={tx} name={copy.title} title={copy.done} description={copy.description} />\n </TransactionDialog>\n );\n\n return { run, dialog, busy, activeId };\n}\n\nfunction Spinner({ active, idle, className }: { active: boolean; idle: React.ReactNode; className?: string }) {\n return active ? <Loader2 className={`h-3 w-3 animate-spin ${className ?? \"\"}`} /> : <>{idle}</>;\n}\n\nfunction OfferBidsRow({ offer }: { offer: ApiSponsorshipOffer }) {\n const { walletAddress } = useMedialaneApp();\n const { bids, isLoading, mutate } = useSponsorshipBids(offer.offerId);\n const action = useRowAction({ title: \"Accept bid\", working: \"Accepting the bid…\", done: \"Bid accepted!\", description: \"The license is minted to the sponsor.\" });\n\n if (isLoading || bids.length === 0) return null;\n\n return (\n <div className=\"space-y-1.5 rounded-lg bg-muted/30 p-3\">\n {action.dialog}\n <p className=\"text-xs font-semibold text-muted-foreground\">\n Bids on <Link href={assetHref(\"STARKNET\", offer.nftContract, offer.tokenId)} className=\"underline underline-offset-2\">View asset</Link>\n </p>\n {bids.map((bid) => (\n <div key={bid.id} className=\"flex items-center justify-between gap-2 text-xs\">\n <AddressDisplay address={bid.sponsor} chars={4} showCopy={false} className=\"text-muted-foreground\" />\n <Button\n size=\"sm\"\n className=\"bg-brand-rose hover:brightness-110 text-white h-7 px-2.5\"\n aria-label=\"Accept bid\"\n disabled={action.busy || !walletAddress}\n onClick={() =>\n action.run(\n bid.id,\n (api) => api.intents.create(\"sponsorship-bid-accept\", { author: walletAddress!, offerId: offer.offerId, sponsor: bid.sponsor }),\n () => mutate(),\n )\n }\n >\n <Spinner active={action.busy && action.activeId === bid.id} idle={<CheckCircle2 className=\"h-3 w-3\" />} />\n </Button>\n </div>\n ))}\n </div>\n );\n}\n\nfunction ReceivedProposals({ walletAddress }: { walletAddress: string }) {\n const { proposals, isLoading, mutate } = useSponsorshipProposals({ owner: walletAddress, open: true });\n const action = useRowAction({ title: \"Respond to proposal\", working: \"Sending your response…\", done: \"Response sent!\", description: \"Your response is now on-chain.\" });\n\n if (isLoading) return <Skeleton className=\"h-20 w-full rounded-xl\" />;\n if (proposals.length === 0) return <p className=\"text-sm text-muted-foreground\">No proposals awaiting your decision.</p>;\n\n const respond = (proposalId: string, decision: \"accept\" | \"reject\") =>\n action.run(\n proposalId,\n (api) =>\n decision === \"accept\"\n ? api.intents.create(\"sponsorship-proposal-accept\", { owner: walletAddress, proposalId })\n : api.intents.create(\"sponsorship-proposal-reject\", { owner: walletAddress, proposalId }),\n () => mutate(),\n );\n\n return (\n <div className=\"space-y-2\">\n {action.dialog}\n {proposals.map((p) => (\n <div key={p.id} className=\"bento-cell p-4 flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", p.nftContract, p.tokenId)} className=\"hover:underline\">View asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">\n <AddressDisplay address={p.proposer} chars={4} showCopy={false} /> proposed {p.amount}\n </p>\n </div>\n <div className=\"flex gap-1.5 shrink-0\">\n <Button size=\"sm\" variant=\"outline\" aria-label=\"Decline proposal\" disabled={action.busy} onClick={() => respond(p.proposalId, \"reject\")}>\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={<X className=\"h-3 w-3\" />} />\n </Button>\n <Button size=\"sm\" className=\"bg-brand-rose hover:brightness-110 text-white\" aria-label=\"Accept proposal\" disabled={action.busy} onClick={() => respond(p.proposalId, \"accept\")}>\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={<CheckCircle2 className=\"h-3 w-3\" />} />\n </Button>\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction SentProposals({ walletAddress }: { walletAddress: string }) {\n const { proposals, isLoading, mutate } = useSponsorshipProposals({ proposer: walletAddress, open: true });\n const action = useRowAction({ title: \"Withdraw proposal\", working: \"Withdrawing your proposal…\", done: \"Proposal withdrawn!\", description: \"Your proposal is no longer open.\" });\n\n if (isLoading) return <Skeleton className=\"h-20 w-full rounded-xl\" />;\n if (proposals.length === 0) return <p className=\"text-sm text-muted-foreground\">No pending proposals sent.</p>;\n\n return (\n <div className=\"space-y-2\">\n {action.dialog}\n {proposals.map((p) => (\n <div key={p.id} className=\"bento-cell p-4 flex items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", p.nftContract, p.tokenId)} className=\"hover:underline\">View asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">You proposed {p.amount}</p>\n </div>\n <Button\n size=\"sm\"\n variant=\"outline\"\n disabled={action.busy}\n onClick={() =>\n action.run(p.proposalId, (api) => api.intents.create(\"sponsorship-proposal-withdraw\", { proposer: walletAddress, proposalId: p.proposalId }), () => mutate())\n }\n >\n <Spinner active={action.busy && action.activeId === p.proposalId} idle={null} className=\"mr-1.5\" />\n Withdraw\n </Button>\n </div>\n ))}\n </div>\n );\n}\n\nfunction LicenseList({ loading, empty, children }: { loading: boolean; empty: string; children: React.ReactNode[] }) {\n if (loading) return <Skeleton className=\"h-16 w-full rounded-xl\" />;\n if (children.length === 0) return <p className=\"text-sm text-muted-foreground\">{empty}</p>;\n return <div className=\"space-y-2\">{children}</div>;\n}\n\nexport function PortfolioSponsorships() {\n const { walletAddress } = useMedialaneApp();\n const { offers } = useSponsorshipOffers(walletAddress ? { author: walletAddress, open: true } : undefined);\n const { licenses: held, isLoading: heldLoading } = useSponsorshipLicenses(walletAddress ? { holder: walletAddress } : undefined);\n const { licenses: issued, isLoading: issuedLoading } = useSponsorshipLicenses(walletAddress ? { author: walletAddress } : undefined);\n\n if (!walletAddress) return null;\n\n return (\n <div className=\"space-y-8\">\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold flex items-center gap-2\"><Handshake className=\"h-4 w-4 text-brand-rose\" />Proposals awaiting your decision</h2>\n <ReceivedProposals walletAddress={walletAddress} />\n </section>\n\n {offers.length > 0 && (\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Bids on your offers</h2>\n <div className=\"space-y-2\">\n {offers.map((o) => <OfferBidsRow key={o.id} offer={o} />)}\n </div>\n </section>\n )}\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Proposals you've sent</h2>\n <SentProposals walletAddress={walletAddress} />\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Licenses you hold</h2>\n <LicenseList loading={heldLoading} empty=\"No sponsorship licenses yet.\">\n {held.map((l) => (\n <div key={l.id} className=\"bento-cell p-4\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", l.assetContract, l.assetTokenId)} className=\"hover:underline\">License on this asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">from <AddressDisplay address={l.author} chars={4} showCopy={false} /></p>\n </div>\n ))}\n </LicenseList>\n </section>\n\n <section className=\"space-y-3\">\n <h2 className=\"text-sm font-bold\">Licenses issued on your work</h2>\n <LicenseList loading={issuedLoading} empty=\"No licenses issued yet.\">\n {issued.map((l) => (\n <div key={l.id} className=\"bento-cell p-4\">\n <p className=\"text-sm font-semibold\">\n <Link href={assetHref(\"STARKNET\", l.assetContract, l.assetTokenId)} className=\"hover:underline\">License on this asset</Link>\n </p>\n <p className=\"text-xs text-muted-foreground\">held by <AddressDisplay address={l.currentHolder ?? l.recipient} chars={4} showCopy={false} /></p>\n </div>\n ))}\n </LicenseList>\n </section>\n </div>\n );\n}\n"],"mappings":";AAoCM,SAQgF,UARhF,KAqBA,YArBA;AAlCN,SAAS,gBAAgB;AACzB,SAAS,cAAc,WAAW,SAAS,SAAS;AACpD,SAAS,iBAA2C;AACpD,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,OAAO,UAAU;AACjB,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B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vH;AAAA,QACA,qBAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,UAAK,oBAAC,kBAAe,SAAS,EAAE,QAAQ,OAAO,GAAG,UAAU,OAAO;AAAA,WAAE;AAAA,WAJ1G,EAAE,EAKZ,CACD,GACH;AAAA,OACF;AAAA,IAEA,qBAAC,aAAQ,WAAU,aACjB;AAAA,0BAAC,QAAG,WAAU,qBAAoB,0CAA4B;AAAA,MAC9D,oBAAC,eAAY,SAAS,eAAe,OAAM,2BACxC,iBAAO,IAAI,CAAC,MACX,qBAAC,SAAe,WAAU,kBACxB;AAAA,4BAAC,OAAE,WAAU,yBACX,8BAAC,QAAK,MAAM,UAAU,YAAY,EAAE,eAAe,EAAE,YAAY,GAAG,WAAU,mBAAkB,mCAAqB,GACvH;AAAA,QACA,qBAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,UAAQ,oBAAC,kBAAe,SAAS,EAAE,iBAAiB,EAAE,WAAW,OAAO,GAAG,UAAU,OAAO;AAAA,WAAE;AAAA,WAJnI,EAAE,EAKZ,CACD,GACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var transfer_collection_ownership_exports = {};
|
|
21
|
+
__export(transfer_collection_ownership_exports, {
|
|
22
|
+
TransferCollectionOwnership: () => TransferCollectionOwnership
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(transfer_collection_ownership_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_lucide_react = require("lucide-react");
|
|
28
|
+
var import_sdk = require("@medialane/sdk");
|
|
29
|
+
var import_button = require("./button.js");
|
|
30
|
+
var import_dialog = require("./dialog.js");
|
|
31
|
+
var import_input = require("./input.js");
|
|
32
|
+
var import_label = require("./label.js");
|
|
33
|
+
var import_marketplace_dialog_primitives = require("./marketplace-dialog-primitives.js");
|
|
34
|
+
var import_medialane_app = require("./medialane-app.js");
|
|
35
|
+
var import_transaction_dialog = require("./transaction-dialog.js");
|
|
36
|
+
var import_transaction_done = require("./transaction-done.js");
|
|
37
|
+
var import_address = require("../utils/address.js");
|
|
38
|
+
var import_run_intent_calls = require("../utils/run-intent-calls.js");
|
|
39
|
+
var import_use_transaction = require("../utils/use-transaction.js");
|
|
40
|
+
function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }) {
|
|
41
|
+
const app = (0, import_medialane_app.useMedialaneApp)();
|
|
42
|
+
const tx = (0, import_use_transaction.useTransaction)();
|
|
43
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
44
|
+
const [confirming, setConfirming] = (0, import_react.useState)(false);
|
|
45
|
+
const [newOwner, setNewOwner] = (0, import_react.useState)("");
|
|
46
|
+
const trimmed = newOwner.trim();
|
|
47
|
+
const isValid = /^0x[0-9a-fA-F]{1,64}$/.test(trimmed);
|
|
48
|
+
const wouldNoop = isValid && (0, import_sdk.normalizeAddress)("STARKNET", trimmed) === (0, import_sdk.normalizeAddress)("STARKNET", currentOwner);
|
|
49
|
+
const close = () => {
|
|
50
|
+
setOpen(false);
|
|
51
|
+
setConfirming(false);
|
|
52
|
+
};
|
|
53
|
+
const transfer = () => {
|
|
54
|
+
close();
|
|
55
|
+
void tx.run(async (signer) => {
|
|
56
|
+
await (0, import_run_intent_calls.runIntentCalls)(
|
|
57
|
+
signer,
|
|
58
|
+
() => app.getClient().api.intents.create("transfer-collection-ownership", { owner: signer.address, collectionId: String(collectionId), newOwner: trimmed })
|
|
59
|
+
);
|
|
60
|
+
}).then((ok) => {
|
|
61
|
+
if (ok) onTransferred?.();
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_button.Button, { variant: "outline", size: "sm", className: "gap-2", onClick: () => {
|
|
66
|
+
setNewOwner("");
|
|
67
|
+
setOpen(true);
|
|
68
|
+
}, children: [
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.UserRoundCog, { className: "h-4 w-4" }),
|
|
70
|
+
"Transfer ownership"
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, { open, onOpenChange: (next) => {
|
|
73
|
+
if (!next) close();
|
|
74
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.DialogContent, { className: "max-w-[calc(100%-6px)] sm:max-w-md p-0 overflow-hidden gap-0 rounded-2xl", children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.DialogTitle, { className: "sr-only", children: [
|
|
76
|
+
"Transfer ownership of ",
|
|
77
|
+
collectionName ?? "collection"
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, { className: "sr-only", children: "Transfer the on-chain owner of this collection. Existing tokens are unaffected." }),
|
|
80
|
+
confirming ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
|
+
import_marketplace_dialog_primitives.MarketplaceConfirmStep,
|
|
82
|
+
{
|
|
83
|
+
description: `Transfer ownership to ${(0, import_address.shortenAddress)(trimmed)}?`,
|
|
84
|
+
secondaryLabel: "Back",
|
|
85
|
+
onSecondary: () => setConfirming(false),
|
|
86
|
+
primaryLabel: "Transfer ownership",
|
|
87
|
+
onPrimary: transfer,
|
|
88
|
+
primaryIcon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.UserRoundCog, { className: "h-4 w-4" })
|
|
89
|
+
}
|
|
90
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "p-6 space-y-4", children: [
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.UserRoundCog, { className: "h-5 w-5" }),
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-bold text-lg", children: "Transfer collection ownership" })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: "The new owner will control minting and future ownership transfers for this collection. Existing tokens are unaffected." }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { htmlFor: "new-owner", children: "New owner address" }),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
import_input.Input,
|
|
100
|
+
{
|
|
101
|
+
id: "new-owner",
|
|
102
|
+
placeholder: "0x\u2026",
|
|
103
|
+
value: newOwner,
|
|
104
|
+
onChange: (e) => setNewOwner(e.target.value),
|
|
105
|
+
className: "tabular-nums text-sm",
|
|
106
|
+
spellCheck: false,
|
|
107
|
+
autoComplete: "off"
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
trimmed && !isValid && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-red-500", children: "Not a valid Starknet address." }),
|
|
111
|
+
wouldNoop && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-amber-500", children: "This is already the current owner." })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2 pt-2", children: [
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "ghost", className: "flex-1", onClick: close, children: "Cancel" }),
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { className: "flex-1", onClick: () => setConfirming(true), disabled: !isValid || wouldNoop || !app.walletAddress, children: "Continue" })
|
|
116
|
+
] })
|
|
117
|
+
] })
|
|
118
|
+
] }) }),
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_dialog.TransactionDialog, { tx, title: "Transfer ownership", workingLabel: "Transferring ownership\u2026", firstStepLabel: "Prepare transfer", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
import_transaction_done.TransactionDone,
|
|
121
|
+
{
|
|
122
|
+
tx,
|
|
123
|
+
name: collectionName ?? "Collection",
|
|
124
|
+
title: "Ownership transferred",
|
|
125
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "tabular-nums", children: [
|
|
126
|
+
"New owner: ",
|
|
127
|
+
(0, import_address.shortenAddress)(trimmed)
|
|
128
|
+
] })
|
|
129
|
+
}
|
|
130
|
+
) })
|
|
131
|
+
] });
|
|
132
|
+
}
|
|
133
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
+
0 && (module.exports = {
|
|
135
|
+
TransferCollectionOwnership
|
|
136
|
+
});
|
|
137
|
+
//# sourceMappingURL=transfer-collection-ownership.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/transfer-collection-ownership.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { UserRoundCog } from \"lucide-react\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport { Button } from \"./button.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"./dialog.js\";\nimport { Input } from \"./input.js\";\nimport { Label } from \"./label.js\";\nimport { MarketplaceConfirmStep } from \"./marketplace-dialog-primitives.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransferCollectionOwnershipProps {\n collectionId: string;\n currentOwner: string;\n collectionName?: string | null;\n onTransferred?: () => void;\n}\n\nexport function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }: TransferCollectionOwnershipProps) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [open, setOpen] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [newOwner, setNewOwner] = useState(\"\");\n\n const trimmed = newOwner.trim();\n const isValid = /^0x[0-9a-fA-F]{1,64}$/.test(trimmed);\n const wouldNoop = isValid && normalizeAddress(\"STARKNET\", trimmed) === normalizeAddress(\"STARKNET\", currentOwner);\n\n const close = () => {\n setOpen(false);\n setConfirming(false);\n };\n\n const transfer = () => {\n close();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"transfer-collection-ownership\", { owner: signer.address, collectionId: String(collectionId), newOwner: trimmed }),\n );\n })\n .then((ok) => {\n if (ok) onTransferred?.();\n });\n };\n\n return (\n <>\n <Button variant=\"outline\" size=\"sm\" className=\"gap-2\" onClick={() => { setNewOwner(\"\"); setOpen(true); }}>\n <UserRoundCog className=\"h-4 w-4\" />\n Transfer ownership\n </Button>\n\n <Dialog open={open} onOpenChange={(next) => { if (!next) close(); }}>\n <DialogContent className=\"max-w-[calc(100%-6px)] sm:max-w-md p-0 overflow-hidden gap-0 rounded-2xl\">\n <DialogTitle className=\"sr-only\">Transfer ownership of {collectionName ?? \"collection\"}</DialogTitle>\n <DialogDescription className=\"sr-only\">Transfer the on-chain owner of this collection. Existing tokens are unaffected.</DialogDescription>\n\n {confirming ? (\n <MarketplaceConfirmStep\n description={`Transfer ownership to ${shortenAddress(trimmed)}?`}\n secondaryLabel=\"Back\"\n onSecondary={() => setConfirming(false)}\n primaryLabel=\"Transfer ownership\"\n onPrimary={transfer}\n primaryIcon={<UserRoundCog className=\"h-4 w-4\" />}\n />\n ) : (\n <div className=\"p-6 space-y-4\">\n <div className=\"flex items-center gap-2\">\n <UserRoundCog className=\"h-5 w-5\" />\n <p className=\"font-bold text-lg\">Transfer collection ownership</p>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n The new owner will control minting and future ownership transfers for this collection. Existing tokens are unaffected.\n </p>\n <div className=\"space-y-2\">\n <Label htmlFor=\"new-owner\">New owner address</Label>\n <Input\n id=\"new-owner\"\n placeholder=\"0x…\"\n value={newOwner}\n onChange={(e) => setNewOwner(e.target.value)}\n className=\"tabular-nums text-sm\"\n spellCheck={false}\n autoComplete=\"off\"\n />\n {trimmed && !isValid && <p className=\"text-xs text-red-500\">Not a valid Starknet address.</p>}\n {wouldNoop && <p className=\"text-xs text-amber-500\">This is already the current owner.</p>}\n </div>\n <div className=\"flex gap-2 pt-2\">\n <Button variant=\"ghost\" className=\"flex-1\" onClick={close}>\n Cancel\n </Button>\n <Button className=\"flex-1\" onClick={() => setConfirming(true)} disabled={!isValid || wouldNoop || !app.walletAddress}>\n Continue\n </Button>\n </div>\n </div>\n )}\n </DialogContent>\n </Dialog>\n\n <TransactionDialog tx={tx} title=\"Transfer ownership\" workingLabel=\"Transferring ownership…\" firstStepLabel=\"Prepare transfer\">\n <TransactionDone\n tx={tx}\n name={collectionName ?? \"Collection\"}\n title=\"Ownership transferred\"\n description={<span className=\"tabular-nums\">New owner: {shortenAddress(trimmed)}</span>}\n />\n </TransactionDialog>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDI;AApDJ,mBAAyB;AACzB,0BAA6B;AAC7B,iBAAiC;AACjC,oBAAuB;AACvB,oBAAsE;AACtE,mBAAsB;AACtB,mBAAsB;AACtB,2CAAuC;AACvC,2BAAgC;AAChC,gCAAkC;AAClC,8BAAgC;AAChC,qBAA+B;AAC/B,8BAA+B;AAC/B,6BAA+B;AASxB,SAAS,4BAA4B,EAAE,cAAc,cAAc,gBAAgB,cAAc,GAAqC;AAC3I,QAAM,UAAM,sCAAgB;AAC5B,QAAM,SAAK,uCAAe;AAC1B,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,KAAK;AACtC,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,EAAE;AAE3C,QAAM,UAAU,SAAS,KAAK;AAC9B,QAAM,UAAU,wBAAwB,KAAK,OAAO;AACpD,QAAM,YAAY,eAAW,6BAAiB,YAAY,OAAO,UAAM,6BAAiB,YAAY,YAAY;AAEhH,QAAM,QAAQ,MAAM;AAClB,YAAQ,KAAK;AACb,kBAAc,KAAK;AAAA,EACrB;AAEA,QAAM,WAAW,MAAM;AACrB,UAAM;AACN,SAAK,GACF,IAAI,OAAO,WAAW;AACrB,gBAAM;AAAA,QAAe;AAAA,QAAQ,MAC3B,IAAI,UAAU,EAAE,IAAI,QAAQ,OAAO,iCAAiC,EAAE,OAAO,OAAO,SAAS,cAAc,OAAO,YAAY,GAAG,UAAU,QAAQ,C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A,cACV,YAAY;AAAA,cACZ,cAAa;AAAA;AAAA,UACf;AAAA,UACC,WAAW,CAAC,WAAW,4CAAC,OAAE,WAAU,wBAAuB,2CAA6B;AAAA,UACxF,aAAa,4CAAC,OAAE,WAAU,0BAAyB,gDAAkC;AAAA,WACxF;AAAA,QACA,6CAAC,SAAI,WAAU,mBACb;AAAA,sDAAC,wBAAO,SAAQ,SAAQ,WAAU,UAAS,SAAS,OAAO,oBAE3D;AAAA,UACA,4CAAC,wBAAO,WAAU,UAAS,SAAS,MAAM,cAAc,IAAI,GAAG,UAAU,CAAC,WAAW,aAAa,CAAC,IAAI,eAAe,sBAEtH;AAAA,WACF;AAAA,SACF;AAAA,OAEJ,GACF;AAAA,IAEA,4CAAC,+CAAkB,IAAQ,OAAM,sBAAqB,cAAa,gCAA0B,gBAAe,oBAC1G;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,MAAM,kBAAkB;AAAA,QACxB,OAAM;AAAA,QACN,aAAa,6CAAC,UAAK,WAAU,gBAAe;AAAA;AAAA,cAAY,+BAAe,OAAO;AAAA,WAAE;AAAA;AAAA,IAClF,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface TransferCollectionOwnershipProps {
|
|
4
|
+
collectionId: string;
|
|
5
|
+
currentOwner: string;
|
|
6
|
+
collectionName?: string | null;
|
|
7
|
+
onTransferred?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }: TransferCollectionOwnershipProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { TransferCollectionOwnership, type TransferCollectionOwnershipProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface TransferCollectionOwnershipProps {
|
|
4
|
+
collectionId: string;
|
|
5
|
+
currentOwner: string;
|
|
6
|
+
collectionName?: string | null;
|
|
7
|
+
onTransferred?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }: TransferCollectionOwnershipProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { TransferCollectionOwnership, type TransferCollectionOwnershipProps };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { UserRoundCog } from "lucide-react";
|
|
5
|
+
import { normalizeAddress } from "@medialane/sdk";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./dialog.js";
|
|
8
|
+
import { Input } from "./input.js";
|
|
9
|
+
import { Label } from "./label.js";
|
|
10
|
+
import { MarketplaceConfirmStep } from "./marketplace-dialog-primitives.js";
|
|
11
|
+
import { useMedialaneApp } from "./medialane-app.js";
|
|
12
|
+
import { TransactionDialog } from "./transaction-dialog.js";
|
|
13
|
+
import { TransactionDone } from "./transaction-done.js";
|
|
14
|
+
import { shortenAddress } from "../utils/address.js";
|
|
15
|
+
import { runIntentCalls } from "../utils/run-intent-calls.js";
|
|
16
|
+
import { useTransaction } from "../utils/use-transaction.js";
|
|
17
|
+
function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }) {
|
|
18
|
+
const app = useMedialaneApp();
|
|
19
|
+
const tx = useTransaction();
|
|
20
|
+
const [open, setOpen] = useState(false);
|
|
21
|
+
const [confirming, setConfirming] = useState(false);
|
|
22
|
+
const [newOwner, setNewOwner] = useState("");
|
|
23
|
+
const trimmed = newOwner.trim();
|
|
24
|
+
const isValid = /^0x[0-9a-fA-F]{1,64}$/.test(trimmed);
|
|
25
|
+
const wouldNoop = isValid && normalizeAddress("STARKNET", trimmed) === normalizeAddress("STARKNET", currentOwner);
|
|
26
|
+
const close = () => {
|
|
27
|
+
setOpen(false);
|
|
28
|
+
setConfirming(false);
|
|
29
|
+
};
|
|
30
|
+
const transfer = () => {
|
|
31
|
+
close();
|
|
32
|
+
void tx.run(async (signer) => {
|
|
33
|
+
await runIntentCalls(
|
|
34
|
+
signer,
|
|
35
|
+
() => app.getClient().api.intents.create("transfer-collection-ownership", { owner: signer.address, collectionId: String(collectionId), newOwner: trimmed })
|
|
36
|
+
);
|
|
37
|
+
}).then((ok) => {
|
|
38
|
+
if (ok) onTransferred?.();
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
42
|
+
/* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", className: "gap-2", onClick: () => {
|
|
43
|
+
setNewOwner("");
|
|
44
|
+
setOpen(true);
|
|
45
|
+
}, children: [
|
|
46
|
+
/* @__PURE__ */ jsx(UserRoundCog, { className: "h-4 w-4" }),
|
|
47
|
+
"Transfer ownership"
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (next) => {
|
|
50
|
+
if (!next) close();
|
|
51
|
+
}, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-[calc(100%-6px)] sm:max-w-md p-0 overflow-hidden gap-0 rounded-2xl", children: [
|
|
52
|
+
/* @__PURE__ */ jsxs(DialogTitle, { className: "sr-only", children: [
|
|
53
|
+
"Transfer ownership of ",
|
|
54
|
+
collectionName ?? "collection"
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "sr-only", children: "Transfer the on-chain owner of this collection. Existing tokens are unaffected." }),
|
|
57
|
+
confirming ? /* @__PURE__ */ jsx(
|
|
58
|
+
MarketplaceConfirmStep,
|
|
59
|
+
{
|
|
60
|
+
description: `Transfer ownership to ${shortenAddress(trimmed)}?`,
|
|
61
|
+
secondaryLabel: "Back",
|
|
62
|
+
onSecondary: () => setConfirming(false),
|
|
63
|
+
primaryLabel: "Transfer ownership",
|
|
64
|
+
onPrimary: transfer,
|
|
65
|
+
primaryIcon: /* @__PURE__ */ jsx(UserRoundCog, { className: "h-4 w-4" })
|
|
66
|
+
}
|
|
67
|
+
) : /* @__PURE__ */ jsxs("div", { className: "p-6 space-y-4", children: [
|
|
68
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
69
|
+
/* @__PURE__ */ jsx(UserRoundCog, { className: "h-5 w-5" }),
|
|
70
|
+
/* @__PURE__ */ jsx("p", { className: "font-bold text-lg", children: "Transfer collection ownership" })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "The new owner will control minting and future ownership transfers for this collection. Existing tokens are unaffected." }),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
74
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "new-owner", children: "New owner address" }),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
Input,
|
|
77
|
+
{
|
|
78
|
+
id: "new-owner",
|
|
79
|
+
placeholder: "0x\u2026",
|
|
80
|
+
value: newOwner,
|
|
81
|
+
onChange: (e) => setNewOwner(e.target.value),
|
|
82
|
+
className: "tabular-nums text-sm",
|
|
83
|
+
spellCheck: false,
|
|
84
|
+
autoComplete: "off"
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
trimmed && !isValid && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: "Not a valid Starknet address." }),
|
|
88
|
+
wouldNoop && /* @__PURE__ */ jsx("p", { className: "text-xs text-amber-500", children: "This is already the current owner." })
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 pt-2", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", className: "flex-1", onClick: close, children: "Cancel" }),
|
|
92
|
+
/* @__PURE__ */ jsx(Button, { className: "flex-1", onClick: () => setConfirming(true), disabled: !isValid || wouldNoop || !app.walletAddress, children: "Continue" })
|
|
93
|
+
] })
|
|
94
|
+
] })
|
|
95
|
+
] }) }),
|
|
96
|
+
/* @__PURE__ */ jsx(TransactionDialog, { tx, title: "Transfer ownership", workingLabel: "Transferring ownership\u2026", firstStepLabel: "Prepare transfer", children: /* @__PURE__ */ jsx(
|
|
97
|
+
TransactionDone,
|
|
98
|
+
{
|
|
99
|
+
tx,
|
|
100
|
+
name: collectionName ?? "Collection",
|
|
101
|
+
title: "Ownership transferred",
|
|
102
|
+
description: /* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
|
|
103
|
+
"New owner: ",
|
|
104
|
+
shortenAddress(trimmed)
|
|
105
|
+
] })
|
|
106
|
+
}
|
|
107
|
+
) })
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
TransferCollectionOwnership
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=transfer-collection-ownership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/transfer-collection-ownership.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { UserRoundCog } from \"lucide-react\";\nimport { normalizeAddress } from \"@medialane/sdk\";\nimport { Button } from \"./button.js\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"./dialog.js\";\nimport { Input } from \"./input.js\";\nimport { Label } from \"./label.js\";\nimport { MarketplaceConfirmStep } from \"./marketplace-dialog-primitives.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionDone } from \"./transaction-done.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\n\nexport interface TransferCollectionOwnershipProps {\n collectionId: string;\n currentOwner: string;\n collectionName?: string | null;\n onTransferred?: () => void;\n}\n\nexport function TransferCollectionOwnership({ collectionId, currentOwner, collectionName, onTransferred }: TransferCollectionOwnershipProps) {\n const app = useMedialaneApp();\n const tx = useTransaction();\n const [open, setOpen] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [newOwner, setNewOwner] = useState(\"\");\n\n const trimmed = newOwner.trim();\n const isValid = /^0x[0-9a-fA-F]{1,64}$/.test(trimmed);\n const wouldNoop = isValid && normalizeAddress(\"STARKNET\", trimmed) === normalizeAddress(\"STARKNET\", currentOwner);\n\n const close = () => {\n setOpen(false);\n setConfirming(false);\n };\n\n const transfer = () => {\n close();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"transfer-collection-ownership\", { owner: signer.address, collectionId: String(collectionId), newOwner: trimmed }),\n );\n })\n .then((ok) => {\n if (ok) onTransferred?.();\n });\n };\n\n return (\n <>\n <Button variant=\"outline\" size=\"sm\" className=\"gap-2\" onClick={() => { setNewOwner(\"\"); setOpen(true); }}>\n <UserRoundCog className=\"h-4 w-4\" />\n Transfer ownership\n </Button>\n\n <Dialog open={open} onOpenChange={(next) => { if (!next) close(); }}>\n <DialogContent className=\"max-w-[calc(100%-6px)] sm:max-w-md p-0 overflow-hidden gap-0 rounded-2xl\">\n <DialogTitle className=\"sr-only\">Transfer ownership of {collectionName ?? \"collection\"}</DialogTitle>\n <DialogDescription className=\"sr-only\">Transfer the on-chain owner of this collection. Existing tokens are unaffected.</DialogDescription>\n\n {confirming ? (\n <MarketplaceConfirmStep\n description={`Transfer ownership to ${shortenAddress(trimmed)}?`}\n secondaryLabel=\"Back\"\n onSecondary={() => setConfirming(false)}\n primaryLabel=\"Transfer ownership\"\n onPrimary={transfer}\n primaryIcon={<UserRoundCog className=\"h-4 w-4\" />}\n />\n ) : (\n <div className=\"p-6 space-y-4\">\n <div className=\"flex items-center gap-2\">\n <UserRoundCog className=\"h-5 w-5\" />\n <p className=\"font-bold text-lg\">Transfer collection ownership</p>\n </div>\n <p className=\"text-sm text-muted-foreground\">\n The new owner will control minting and future ownership transfers for this collection. Existing tokens are unaffected.\n </p>\n <div className=\"space-y-2\">\n <Label htmlFor=\"new-owner\">New owner address</Label>\n <Input\n id=\"new-owner\"\n placeholder=\"0x…\"\n value={newOwner}\n onChange={(e) => setNewOwner(e.target.value)}\n className=\"tabular-nums text-sm\"\n spellCheck={false}\n autoComplete=\"off\"\n />\n {trimmed && !isValid && <p className=\"text-xs text-red-500\">Not a valid Starknet address.</p>}\n {wouldNoop && <p className=\"text-xs text-amber-500\">This is already the current owner.</p>}\n </div>\n <div className=\"flex gap-2 pt-2\">\n <Button variant=\"ghost\" className=\"flex-1\" onClick={close}>\n Cancel\n </Button>\n <Button className=\"flex-1\" onClick={() => setConfirming(true)} disabled={!isValid || wouldNoop || !app.walletAddress}>\n Continue\n </Button>\n </div>\n </div>\n )}\n </DialogContent>\n </Dialog>\n\n <TransactionDialog tx={tx} title=\"Transfer ownership\" workingLabel=\"Transferring ownership…\" firstStepLabel=\"Prepare transfer\">\n <TransactionDone\n tx={tx}\n name={collectionName ?? \"Collection\"}\n title=\"Ownership transferred\"\n description={<span className=\"tabular-nums\">New owner: {shortenAddress(trimmed)}</span>}\n />\n </TransactionDialog>\n </>\n );\n}\n"],"mappings":";AAsDI,mBAEI,KADF,YADF;AApDJ,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,QAAQ,eAAe,mBAAmB,mBAAmB;AACtE,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AASxB,SAAS,4BAA4B,EAAE,cAAc,cAAc,gBAAgB,cAAc,GAAqC;AAC3I,QAAM,MAAM,gBAAgB;AAC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