flash-usdt-sender
v0.1.0
Published
Unified multi-chain USDT transfer SDK for Ethereum, BNB Chain, and TRON
Maintainers
Readme
flash-usdt-sender
Unified multi-chain USDT transfer SDK for Ethereum, BNB Chain, and TRON
flash-usdt-sender is a production-grade TypeScript SDK that unifies USDT transfers across Ethereum, BNB Smart Chain, and TRON networks. One interface, three chains, zero complexity.
🎯 Why flash-usdt-sender?
- Unified API: Same interface for ETH, BSC, and TRON
- Type-Safe: Full TypeScript support with comprehensive types
- Battle-Tested: Production-ready error handling and validation
- Gas Optimized: Automatic gas estimation and fee management
- Zero KYC: Pure crypto, wallet-level operations
- Optional Relayer: Gas sponsorship and advanced features
📦 Installation
npm install flash-usdt-senderOr with yarn:
yarn add flash-usdt-sender🚀 Quick Start
import FlashUSDT from 'flash-usdt-sender';
// Initialize SDK
const flash = new FlashUSDT();
// Send USDT on Ethereum
const result = await flash.send({
chain: 'ethereum',
fromPrivateKey: 'YOUR_PRIVATE_KEY',
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
amount: '100.5',
});
console.log(`Transaction: ${result.explorerUrl}`);📚 Usage Examples
Send USDT on Different Chains
Ethereum
const result = await flash.send({
chain: 'ethereum',
fromPrivateKey: process.env.PRIVATE_KEY,
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
amount: '50.0',
});BNB Smart Chain
const result = await flash.send({
chain: 'bsc',
fromPrivateKey: process.env.PRIVATE_KEY,
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
amount: '50.0',
});TRON
const result = await flash.send({
chain: 'tron',
fromPrivateKey: process.env.PRIVATE_KEY,
to: 'TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9',
amount: '50.0',
});Check Balance
const balance = await flash.getBalance({
chain: 'ethereum',
address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
});
console.log(`USDT Balance: ${balance.balance}`);Estimate Gas (EVM Chains)
const estimate = await flash.estimateGas(
'ethereum',
'0xYourAddress',
'0xRecipientAddress',
'100.0'
);
console.log(`Estimated gas: ${estimate.estimatedCost} ETH`);Custom RPC Endpoints
const flash = new FlashUSDT({
rpcUrls: {
ethereum: 'https://your-eth-rpc.com',
bsc: 'https://your-bsc-rpc.com',
tron: 'https://your-tron-rpc.com',
},
});With Debug Logging
const flash = new FlashUSDT({
debug: true, // Enable console logging
});With Relayer (Coming Soon)
const flash = new FlashUSDT({
apiKey: 'your-api-key',
relayerUrl: 'https://api.flashusdtsender.xyz',
});
// Gas-sponsored transfer
const result = await flash.send({
chain: 'ethereum',
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
amount: '100.0',
useRelayer: true, // No private key needed with relayer
});🔑 API Reference
Constructor
new FlashUSDT(config?: FlashUSDTConfig)Config Options:
| Option | Type | Description |
|--------|------|-------------|
| apiKey | string | Optional API key for relayer service |
| relayerUrl | string | Optional relayer endpoint URL |
| rpcUrls | object | Custom RPC endpoints for chains |
| debug | boolean | Enable debug logging |
Methods
send(request: TransferRequest): Promise<TransactionResult>
Send USDT on specified chain.
Parameters:
{
chain: 'ethereum' | 'bsc' | 'tron',
fromPrivateKey: string, // Sender's private key
to: string, // Recipient address
amount: string, // Amount in USDT (e.g., "100.5")
gasPrice?: string, // Optional gas price override (Gwei)
useRelayer?: boolean, // Use relayer for gas sponsorship
}Returns:
{
txHash: string, // Transaction hash
chain: ChainType, // Chain name
status: 'pending' | 'confirmed' | 'failed',
explorerUrl: string, // Block explorer URL
gasUsed?: string, // Gas used (if available)
blockNumber?: number, // Block number (if confirmed)
}getBalance(request: BalanceRequest): Promise<BalanceResult>
Get USDT balance on specified chain.
Parameters:
{
chain: 'ethereum' | 'bsc' | 'tron',
address: string, // Address to check
}Returns:
{
chain: ChainType,
address: string,
balance: string, // Human-readable balance
rawBalance: string, // Raw balance in smallest unit
}estimateGas(chain, fromAddress, toAddress, amount): Promise<GasEstimate>
Estimate gas for transfer (EVM chains only).
🛡️ Security Best Practices
⚠️ Private Key Safety
NEVER hardcode private keys in your source code. Always use environment variables:
// ✅ GOOD
const result = await flash.send({
chain: 'ethereum',
fromPrivateKey: process.env.PRIVATE_KEY,
to: recipientAddress,
amount: '100',
});
// ❌ BAD - Never do this!
const result = await flash.send({
chain: 'ethereum',
fromPrivateKey: '0x1234567890abcdef...', // Exposed!
to: recipientAddress,
amount: '100',
});Recommended Approaches
- Environment Variables (Development)
# .env file
PRIVATE_KEY=your_private_key_here- Secure Vaults (Production)
- AWS Secrets Manager
- HashiCorp Vault
- Azure Key Vault
- Hardware Wallets (Coming Soon)
- Ledger integration
- Trezor support
🔧 Error Handling
The SDK provides typed errors for precise error handling:
import FlashUSDT, {
InsufficientBalanceError,
NetworkError,
ValidationError,
TransactionFailedError,
} from 'flash-usdt-sender';
try {
const result = await flash.send({...});
} catch (error) {
if (error instanceof InsufficientBalanceError) {
console.error('Insufficient balance:', error.details);
} else if (error instanceof NetworkError) {
console.error('Network issue:', error.message);
} else if (error instanceof ValidationError) {
console.error('Invalid input:', error.message);
}
}🌐 Supported Chains
| Chain | USDT Contract | Decimals | Native Token |
|-------|---------------|----------|--------------|
| Ethereum | 0xdAC17F958D2ee523a2206206994597C13D831ec7 | 6 | ETH |
| BNB Chain | 0x55d398326f99059fF775485246999027B3197955 | 18 | BNB |
| TRON | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t | 6 | TRX |
📊 Chain Comparison
| Feature | Ethereum | BSC | TRON | |---------|----------|-----|------| | Avg. Confirmation | 15s | 3s | 3s | | Typical Gas Cost | ~$5-20 | ~$0.20 | ~$1-3 | | Transaction Speed | Medium | Fast | Fast | | Gas Model | Gas (Gwei) | Gas (Gwei) | Energy/Bandwidth |
🛣️ Roadmap
v0.1.0 (Current)
- ✅ Ethereum, BSC, TRON support
- ✅ Balance checking
- ✅ Gas estimation
- ✅ Full TypeScript types
- ✅ Error handling
v0.2.0 (Coming Soon)
- 🔄 Relayer integration
- 🔄 Gas sponsorship
- 🔄 Transaction webhooks
- 🔄 Batch transfers
v0.3.0 (Future)
- 📋 Hardware wallet support
- 📋 Meta-transactions
- 📋 Swap routing
- 📋 React Native support
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
MIT © Likhon Sheikh
🔗 Links
- NPM Package: https://www.npmjs.com/package/flash-usdt-sender
- Website: https://flashusdtsender.xyz
- GitHub: https://github.com/likhonsdev/flash-usdt-sender
- Documentation: https://flashusdtsender.xyz/docs
- Credits: CREDITS.md
💬 Support
- GitHub Issues: Report a bug
- Twitter: @likhonsdev
⚖️ Disclaimer
This SDK handles cryptocurrency transactions. Always test thoroughly on testnets before using in production. The authors are not responsible for any losses incurred through the use of this software.
👨💻 Built By
Developed by Likhon Sheikh 🔥
Community & Support:
- 💬 RecentCoders - Developer Community
- 🛠️ ScriptersShop - Development Services
Join our Telegram communities for updates, support, and collaboration!
