A comprehensive TypeScript/JavaScript utility library that simplifies common Stellar blockchain operations. Built for developers who want clean, tested, and production-ready helpers for Stellar development.
Documentation site: Stellar Toolkit guide
Current Version: v0.1.0
Stellar Toolkit provides high-level abstractions over the Stellar SDK, making it easier to:
- Create and manage accounts
- Send payments and handle assets
- Interact with the Stellar network
- Parse and format Stellar data
- Handle common error scenarios gracefully
- Account Management: Simplified account creation, funding, and balance checking
- Payment Operations: Easy-to-use payment and path payment functions
- Asset Utilities: Create, manage, and query custom assets
- Network Helpers: Automatic network detection and configuration
- Error Handling: Comprehensive error handling with meaningful messages
- Type-Safe: Full TypeScript support with detailed type definitions
- Well Tested: Comprehensive test suite with example tests
- CI/CD: Automated testing and linting on every commit
npm install @hyperdevtools/stellar-toolkit
# or
yarn add @hyperdevtools/stellar-toolkit
# or
pnpm add @hyperdevtools/stellar-toolkitimport { StellarToolkit } from '@hyperdevtools/stellar-toolkit';
// Initialize the toolkit
const toolkit = new StellarToolkit({
network: 'testnet', // or 'mainnet'
});
// Create a new account
const keypair = toolkit.generateKeypair();
console.log('New account:', keypair.publicKey);
// Send a payment
await toolkit.sendPayment({
from: sourceSecret,
to: destinationPublicKey,
amount: '10',
asset: 'native',
});// Create a new keypair
const keypair = toolkit.generateKeypair();
// Get account details
const account = await toolkit.getAccount(publicKey);
// Get account balances
const balances = await toolkit.getBalances(publicKey);
// Fund a testnet account
await toolkit.fundTestnetAccount(publicKey);// Simple payment
await toolkit.sendPayment({
from: sourceSecret,
to: destinationPublicKey,
amount: '100',
asset: 'native',
memo: 'Payment for services',
});
// Custom asset payment
await toolkit.sendPayment({
from: sourceSecret,
to: destinationPublicKey,
amount: '50',
asset: {
code: 'USDC',
issuer: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',
},
});
// Path payment
await toolkit.sendPathPayment({
from: sourceSecret,
to: destinationPublicKey,
sendAsset: 'native',
destAsset: { code: 'USDC', issuer: '...' },
destAmount: '100',
maxSend: '110',
});// Create a custom asset
const asset = toolkit.createAsset('MYTOKEN', issuerPublicKey);
// Establish trustline
await toolkit.addTrustline({
account: accountSecret,
asset: {
code: 'USDC',
issuer: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',
},
limit: '10000',
});// Configure a 2-of-3 multi-signature account
await toolkit.configureMultiSig({
masterSecret,
masterWeight: 1,
signers: [
{ publicKey: signer2PublicKey, weight: 1 },
{ publicKey: signer3PublicKey, weight: 1 },
],
thresholds: { low: 1, medium: 2, high: 2 },
});
// Sign a transaction with multiple signers and verify threshold
const signedTx = toolkit.signMultiSigTransaction(tx, [masterSecret, signer2Secret], 2);// Send exact source amount (100 XLM) with automatic Horizon path discovery and slippage protection
await toolkit.sendPathPaymentStrictSend({
from: sourceSecret,
to: destinationPublicKey,
sendAsset: 'native',
sendAmount: '100',
destAsset: {
code: 'USDC',
issuer: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',
},
minDestAmount: '95',
});// Bump the fee on an existing v1 transaction
const bumpedHash = await toolkit.submitFeeBumpTransaction({
feeSourceSecret: sponsorSecret,
innerTransaction: stuckTransactionXdr,
maxFeePerOp: 500,
});// Create a time-locked claimable balance
await toolkit.createClaimableBalance({
from: senderSecret,
asset: 'native',
amount: '100',
claimants: [
{
destination: recipientPublicKey,
predicate: { type: 'not_before', unixTimestamp: Math.floor(Date.now() / 1000) + 3600 },
},
],
});
// Deposit liquidity into a constant-product AMM pool
await toolkit.depositLiquidity({
accountSecret: userSecret,
assetA: 'native',
assetB: {
code: 'USDC',
issuer: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',
},
maxAmountA: '200',
maxAmountB: '50',
minPrice: '3.8',
maxPrice: '4.2',
});# Build the project
./scripts/build.sh
# Run tests
./scripts/test.sh
# Run linter
./scripts/lint.shOr using npm:
npm test # Run test suite
npm run build # Build for production
npm run lint # Check code styleThe project includes a comprehensive test suite:
npm test # Run all tests
npm test -- --watch # Run tests in watch mode
npm test -- --coverage # Run with coverage reportWe welcome contributions! Please see our CONTRIBUTING.md for details.
Good First Issues: Check out issues labeled good-first-issue
# Clone the repository
git clone https://github.com/HyperDevTools/stellar-toolkit.git
cd stellar-toolkit
# Install dependencies
npm install
# Run tests
npm test
# Build the project
npm run buildAll pull requests are automatically tested with:
- β Unit tests (Jest)
- β ESLint checks
- β TypeScript compilation
- β Code formatting (Prettier)
- β Multi-version testing (Node 18.x, 20.x)
See .github/workflows/ci.yml for details.
See CHANGELOG.md for version history.
Planned Features:
- Multi-signature account support
- Path payment strict send operations
- Claimable balance helpers
- Liquidity pool operations
- DEX trading utilities
- Fee bump transaction helpers
- Batch operation support
- Enhanced error recovery
Detailed API documentation available in docs/api/:
- Account Manager API
- Payment Manager API (coming soon)
- Trustline Manager API (coming soon)
MIT License - see LICENSE for details
Built with:
- Stellar SDK
- TypeScript
- The amazing Stellar community
- Release Notes - v0.1.0
- API Documentation - Complete API reference
- Contributing Guide - How to contribute
- Changelog - Version history
- Issue Templates - Report bugs or request features
- Stellar Developers - Official Stellar docs
- Stellar Quest - Learn Stellar development
- Issues: Report bugs or request features
- Discussions: Join community discussions on GitHub
- Contributing: See CONTRIBUTING.md
If you find this project useful, please:
- β Star the repository
- π Report bugs and suggest features
- π€ Contribute code or documentation
- π’ Share with other developers
Part of the HyperDevTools organization β’ Building developer tools for the Stellar ecosystem