Full lesson
ai-tarot-web
AI-powered tarot readings on Solana — ask a question, pay in SOL/USDC/USDT, get a three-card spread drawn from your transaction hash.
What it does
From the project README:
AI-powered tarot readings on Solana — ask the Oracle a question, pay in SOL, USDC or USDT, and receive a personalized three-card reading.
- Original
- RedDuck-Software/ai-tarot-web
- SuperStack fork
- Blockchains/ai-tarot-web @
4e2e7a6 - Stars
- 0
- Last push (original)
- 2026-08-07
- Languages
- TypeScript, CSS, JavaScript, HTML
- Detected stack
- web3.js
- Categories
- AI & AgentsPayments
- Licence
- MIT
Architecture
75 source files. By extension: .tsx ×45, .ts ×28, .js ×2.
| Top-level directory | Source files |
|---|---|
src | 71 |
(root) | 4 |
Dapp: devnet deploy pending
⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/ai-tarot-web/. Until then, the lesson and step-by-step guide below are complete, and you can 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.
src/hooks/contracts/write/use-send.ts L73–96 @ 4e2e7a6 · MIT · original const recipientTokenAddress = await getAssociatedTokenAddress(mint, recipient); const associatedTokenAccountInstruction = await generateAssociatedTokenAccountInstruction({ owner: recipient, payer: publicKey, mint, }); if (associatedTokenAccountInstruction) { rawTx.add(associatedTokenAccountInstruction); } rawTx.add( createTransferInstruction(senderTokenAddress, recipientTokenAddress, publicKey, amount * 10 ** decimals), ); const latestBlockhash = await connection.getLatestBlockhash({ commitment: 'finalized' }); rawTx.recentBlockhash = latestBlockhash.blockhash; rawTx.feePayer = publicKey; const fee = await rawTx.getEstimatedFee(connection); const solBalance = tokens?.find((t) => t.mint === wSolMint.toBase58())?.amount; if (fee && solBalance && Number(solBalance) < fee) { throw new Error('Insufficient funds'); }- Line 85
createTransferInstruction(senderTokenAddress, recipientTokenAddress, publicKey, amount * 1: An SPL token transfer through the Token Program. - Line 88
const latestBlockhash = await connection.getLatestBlockhash({ commitment: 'finalized' });: Fetches a recent blockhash. Transactions expire if it gets too old.
src/hooks/contracts/write/use-send-sol.ts L25–48 @ 4e2e7a6 · MIT · original SystemProgram.transfer({ fromPubkey: publicKey, toPubkey: OwnerAddress[network], lamports, }), ); const latestBlockhash = await connection.getLatestBlockhash({ commitment: 'finalized', }); rawTx.recentBlockhash = latestBlockhash.blockhash; rawTx.feePayer = publicKey; const fee = await rawTx.getEstimatedFee(connection); const solBalance = tokens?.find((token) => token.mint === wSolMint.toBase58())?.amount; if (fee && solBalance && Number(solBalance) < fee + lamports) { throw new Error('Insufficient funds'); } return await sendAndConfirmTransaction(publicKey, rawTx, sendTransaction); }, onError(error) {- Line 32
const latestBlockhash = await connection.getLatestBlockhash({: Fetches a recent blockhash. Transactions expire if it gets too old. - Line 46
return await sendAndConfirmTransaction(publicKey, rawTx, sendTransaction);: Submits the signed transaction to the cluster.
src/hooks/contracts/write/use-privy-send.ts L73–96 @ 4e2e7a6 · MIT · original const senderTokenAddress = await getAssociatedTokenAddress(mint, walletPubkey); const recipientTokenAddress = await getAssociatedTokenAddress(mint, recipient); const ataInstruction = await generateAssociatedTokenAccountInstruction({ owner: recipient, payer: walletPubkey, mint, }); if (ataInstruction) rawTx.add(ataInstruction); rawTx.add( createTransferInstruction( senderTokenAddress, recipientTokenAddress, walletPubkey, Math.round(amount * 10 ** decimals), ), ); const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash({ commitment: 'finalized' }); rawTx.recentBlockhash = blockhash; rawTx.feePayer = walletPubkey; const fee = await rawTx.getEstimatedFee(connection);- Line 84
createTransferInstruction(: An SPL token transfer through the Token Program. - Line 92
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash({ commitme: Fetches a recent blockhash. Transactions expire if it gets too old.
src/lib/solana-utils.ts L1–24 @ 4e2e7a6 · MIT · original/* eslint-disable @typescript-eslint/only-throw-error */import { WalletAdapterProps } from '@solana/wallet-adapter-base';import { PublicKey, Transaction } from '@solana/web3.js'; import { connection } from '../constants/solana'; export const sendAndConfirmTransaction = async ( payer: PublicKey, tx: Transaction, sendTransaction: WalletAdapterProps['sendTransaction'],): Promise<string> => { const latestBlockHash = await connection.getLatestBlockhash({ commitment: 'finalized', }); tx.feePayer = payer; tx.recentBlockhash = latestBlockHash.blockhash; const txHash = await sendTransaction(tx, connection, { skipPreflight: true }); const result = await connection.confirmTransaction( { ...latestBlockHash, signature: txHash,- Line 7
export const sendAndConfirmTransaction = async (: Submits the signed transaction to the cluster. - Line 12
const latestBlockHash = await connection.getLatestBlockhash({: Fetches a recent blockhash. Transactions expire if it gets too old.
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.
| Directory | Command | Runs |
|---|---|---|
. | npm run dev | vite |
. | npm run build | tsc -b && vite build |
. | npm run lint | eslint . |
. | npm run deploy | yarn build && wrangler deploy |
What you could build from it
- Fork the SuperStack copy and extend it within the AI & Agents gaps listed on the idea page.
- Learn the pattern first: AI agents on Solana
- Learn the pattern first: Building and sending transactions from a client
- Learn the pattern first: Blinks and Solana Actions