Full lesson
DefiTalks
DeFiTalk is a Telegram-based DeFi assistant that lets users swap tokens, check balances, and other Defi Actions using simple chat commands—making decentralized finance accessible to everyone.
What it does
From the project README:
Welcome to DeFiTalk – a fully conversational, AI-native DeFi bot that brings powerful on-chain functionality directly into Telegram. Swap tokens, stake SOL, analyze portfolios, get market insights – all through natural language. No clunky UIs. No steep learning curve. Just chat and DeFi.
- Original
- shaheer-ali-dev/DefiTalks
- SuperStack fork
- Blockchains/DefiTalks @
975bda5 - Stars
- 0
- Last push (original)
- 2025-05-17
- Languages
- JavaScript
- Detected stack
- web3.js
- Categories
- DeFiConsumer & Social
- Licence
- MIT
- Homepage
- https://defi-talks.vercel.app
Architecture
26 source files. By extension: .js ×26.
| Top-level directory | Source files |
|---|---|
bot | 11 |
defi | 8 |
database | 4 |
Artificial_Intelligence | 2 |
config | 1 |
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/defitalks/. 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.
defi/solStaking.js L25–48 @ 975bda5 · MIT · original try { const keypair = Keypair.fromSecretKey(bs58.decode(privateKey)); const walletPubkey = keypair.publicKey; const lamports = amount * LAMPORTS_PER_SOL; const stakeAccount = Keypair.generate(); // STEP 1: Create stake account const createStakeAccountIx = StakeProgram.createAccount({ fromPubkey: walletPubkey, stakePubkey: stakeAccount.publicKey, authorized: new Authorized(walletPubkey, walletPubkey), lamports, lockup: new Lockup(0, 0, walletPubkey), }); const createTx = new Transaction().add(createStakeAccountIx); const creationSig = await sendAndConfirmTransaction( connection, createTx, [keypair, stakeAccount]- Line 34
// STEP 1: Create stake account: Touches staking state: the amount locked and when it was locked. - Line 45
const creationSig = await sendAndConfirmTransaction(: Submits the signed transaction to the cluster.
defi/transferToken.js L1–24 @ 975bda5 · MIT · originalconst { Connection, Keypair, PublicKey, SystemProgram, sendAndConfirmTransaction, Transaction} = require('@solana/web3.js');const bs58 = require('bs58');const { getAssociatedTokenAddress, createTransferInstruction, TOKEN_PROGRAM_ID} = require('@solana/spl-token');require('dotenv').config();const { RPC_URL } = require('../config/env');const connection = new Connection(RPC_URL); async function transferToken({ fromPrivateKeyBase58, toWalletAddress, symbol,mintAddress , decimals, amount }) { const sender = Keypair.fromSecretKey(Uint8Array.from(bs58.decode(fromPrivateKeyBase58))); const toPublicKey = new PublicKey(toWalletAddress); const isNativeSOL = symbol.toUpperCase() === 'SOL'; const tx = new Transaction();- Line 6
sendAndConfirmTransaction,: Submits the signed transaction to the cluster. - Line 12
createTransferInstruction,: An SPL token transfer through the Token Program.
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 | nodemon bot/main.js |
. | npm run start | node bot/main.js |
What you could build from it
- Fork the SuperStack copy and extend it within the DeFi gaps listed on the idea page.
- Learn the pattern first: Program Derived Addresses (PDAs)
- Learn the pattern first: Cross-Program Invocations (CPIs)
- Learn the pattern first: SPL Tokens: mints, accounts and transfers