Look up and fund
generateKeypair, getAccount, getBalances, accountExists, getNativeBalance, and testnet-only funding.
A compact wrapper around the Stellar SDK for account lookups, payments, trustlines, and asset utilities. Start on testnet, keep signing keys on a trusted server, and explicitly review every transaction.
Instantiate StellarToolkit with a network and optional Horizon URL. Operations that submit transactions require secret material and return the resulting transaction hash.
generateKeypair, getAccount, getBalances, accountExists, getNativeBalance, and testnet-only funding.
sendPayment submits a payment; sendPathPayment submits a strict-receive path payment with a destination amount and maximum send amount.
Add or remove trustlines, build a custom asset value, and format native or issued assets for display.
This server-side example creates a testnet keypair, funds it through the testnet friendbot, and reads its balances. Keep the secret out of logs and source control.
import { StellarToolkit } from '@hyperdevtools/stellar-toolkit';
const toolkit = new StellarToolkit({ network: 'testnet' });
const keypair = toolkit.generateKeypair();
// Public address is safe to share; store the secret securely if needed.
console.log('Public key:', keypair.publicKey);
await toolkit.fundTestnetAccount(keypair.publicKey);
const balances = await toolkit.getBalances(keypair.publicKey);
console.log('Testnet balances:', balances);For a payment, load the source secret from a server-side secret manager or protected environment variable, verify the destination and amount, and call sendPayment only after explicit user intent. Never put signing keys in browser code or a NEXT_PUBLIC_* variable.
A leaked Stellar secret can authorize transactions from its account. Treat it like a production credential, not ordinary configuration.
Browse the complete exported types in src/types.ts and implementation in src/core.