TypeScript SDK companion

Useful Stellar operations, in one toolkit.

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.

01 / API map

One entry point, focused operations.

Instantiate StellarToolkit with a network and optional Horizon URL. Operations that submit transactions require secret material and return the resulting transaction hash.

01 / ACCOUNTS

Look up and fund

generateKeypair, getAccount, getBalances, accountExists, getNativeBalance, and testnet-only funding.

02 / PAYMENTS

Send and convert

sendPayment submits a payment; sendPathPayment submits a strict-receive path payment with a destination amount and maximum send amount.

03 / ASSETS

Trust and format

Add or remove trustlines, build a custom asset value, and format native or issued assets for display.

02 / Quick start

Read first. Sign only when ready.

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.

03 / Transaction safety

Secret keys are signing authority.

A leaked Stellar secret can authorize transactions from its account. Treat it like a production credential, not ordinary configuration.

  • Use testnet for development and fund test accounts only.
  • Keep secrets server-side; never commit, print, or send them to analytics.
  • Validate the destination, asset issuer, amount, and network before signing.
  • Use a dedicated, minimally funded account for experiments; rotate a key if exposed.
  • Check transaction results and error handling before relying on an operation.

Browse the complete exported types in src/types.ts and implementation in src/core.