Sol.College

Full lesson

dumpfun

Original
DumpFunXYZ/dumpfun
SuperStack fork
Blockchains/dumpfun @ 4f78430
Stars
1
Last push (original)
2024-12-10
Languages
TypeScript, CSS, JavaScript
Detected stack
Next.jsweb3.js
Categories
Other
Licence
MIT

Architecture

67 source files. By extension: .tsx ×54, .ts ×10, .js ×3.

Top-level directorySource files
web67

Dapp: deploying

This fork is queued for its own live dapp on Sol.College, with a Devnet/Mainnet switch. It appears here, at /dapps/dumpfun/, once it is deployed and checked on devnet. Until then, run it locally with the commands below.

Key code, explained

Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.

DumpFunXYZ/dumpfun · web/components/context/transactionContext.tsx L121–142 @ 4f78430 · MIT · original
          let {usd,marketCap,liquidity,volume}=await fetchDexData();          //console.log(usd,marketCap,liquidity,volume)          setLoading(true); // Set loading state during transaction processing                    // Create the burn instruction to destroy tokens          const burnInstruction = createBurnInstruction(            tokenAccount, // Token account to burn from            tokenMint, // Mint of the token being burned            publicKey, // Owner of the token account            amount // Amount to burn          );                    // Create a new transaction and add the burn instruction to it          const transaction = new Transaction().add(burnInstruction);           // Send the transaction and retrieve the signature          const signature = await sendTransaction(transaction, connection);           const { context: { slot: minContextSlot }, value: { blockhash, lastValidBlockHeight } } = await connection.getLatestBlockhashAndContext();           setHash(signature)                    toast('⌛ Transaction Sent for Confirmation'); // Notify user of sent transaction
  1. Line 137 const signature = await sendTransaction(transaction, connection);: Submits the signed transaction to the cluster.
  2. Line 139 const { context: { slot: minContextSlot }, value: { blockhash, lastValidBlockHeight } } = : Fetches a recent blockhash. Transactions expire if it gets too old.
DumpFunXYZ/dumpfun · web/components/crosschain/_hooks/useCrossChain.tsx L181–204 @ 4f78430 · MIT · original
            publicKey        );          const recipientTokenAccount = await getOrCreateAssociatedTokenAccount(            connection,            wallet?.adapter,            mintPublicKey,            recipientPublicKey        );         const transaction = new Transaction().add(            createTransferInstruction(                senderTokenAccount.address,                recipientTokenAccount.address,                publicKey,                amount,                [],                TOKEN_PROGRAM_ID            )        );         try {            const signature = await sendTransaction(transaction, connection);
  1. Line 193 createTransferInstruction(: An SPL token transfer through the Token Program.
  2. Line 204 const signature = await sendTransaction(transaction, connection);: Submits the signed transaction to the cluster.

How to run, build and test

These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.

DirectoryCommandRuns
.npm run devnx serve web
.npm run buildnx build web

What you could build from it