Skip to content

Commit

Permalink
updatea
Browse files Browse the repository at this point in the history
  • Loading branch information
christian morales authored and christian morales committed Oct 19, 2024
1 parent 9997250 commit d52415e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 47 deletions.
Binary file added src/app/icon.ico
Binary file not shown.
43 changes: 0 additions & 43 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,13 @@ import "@rainbow-me/rainbowkit/styles.css";
import { SpeedInsights } from "@vercel/speed-insights/next";
import { Analytics } from "@vercel/analytics/react";
import { Toaster } from "react-hot-toast";
import Head from "next/head";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en" suppressHydrationWarning>
<Head>
<link rel="icon" href="/favicon.ico" />
<link
rel="apple-touch-icon"
sizes="180x180"
href="/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon-16x16.png"
/>
<meta
name="description"
content="Create your own crypto currency on Solana"
/>
<title>Create My Crypto</title>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=AW-16523832540"
></script>
<script
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.NEXT_PUBLIC_ANALYTICS_ID}', {
page_path: window.location.pathname,
});
`,
}}
/>
</Head>
<body className="antialiased bg-white dark:bg-gray-900 text-gray-900 dark:text-white">
<Providers>
<ThemeWrapper>
Expand Down
18 changes: 14 additions & 4 deletions src/app/solana/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default function SolanaTokenCreator() {
formState: { errors },
watch,
setValue,
reset, // Add this
} = useForm<FormData>();
const [imagePreview, setImagePreview] = useState<string | null>(null);
const [totalFee, setTotalFee] = useState(0.5);
Expand Down Expand Up @@ -166,12 +167,13 @@ export default function SolanaTokenCreator() {

const { metadataUri } = await response.json();

// 1. Fee Transaction - Charge the user 0.1 SOL for the service
// 1. Fee Transaction - Charge the user for the service
const feeInLamports = Math.round(totalFee * LAMPORTS_PER_SOL); // Round to nearest integer
const feeTransaction = new Transaction().add(
SystemProgram.transfer({
fromPubkey: wallet.publicKey,
toPubkey: feeRecipient,
lamports: totalFee * LAMPORTS_PER_SOL,
lamports: feeInLamports,
})
);

Expand Down Expand Up @@ -244,12 +246,12 @@ export default function SolanaTokenCreator() {
mint: mintKeypair.publicKey,
mintAuthority: wallet.publicKey,
payer: wallet.publicKey,
updateAuthority: data.immutable ? null : wallet.publicKey,
updateAuthority: wallet.publicKey, // Always set this to wallet.publicKey
},
{
createMetadataAccountArgsV3: {
data: tokenMetadata,
isMutable: !data.immutable,
isMutable: !data.immutable, // This controls whether the metadata can be updated
collectionDetails: null,
},
}
Expand Down Expand Up @@ -361,6 +363,14 @@ export default function SolanaTokenCreator() {
alert(
"Your tokens have been created! Please check your wallet to view your new tokens."
);

// Clear the form and reset state
reset(); // This resets all form fields
setImagePreview(null);
setTotalFee(0.5); // Reset to initial fee

// Optionally, you can scroll to the top of the page
window.scrollTo({ top: 0, behavior: "smooth" });
} catch (sendError) {
console.error("Error sending transaction:", sendError);
setError(
Expand Down

0 comments on commit d52415e

Please sign in to comment.