$ npm install @tetherto/wdk-utilsA collection of utilities for validating cryptocurrency addresses. This package provides a set of functions to validate various address formats from different blockchain networks.
This module is part of the WDK (Wallet Development Kit) project, which empowers developers to build secure, non-custodial wallets with unified blockchain access, stateless architecture, and complete user control.
For detailed documentation about the complete WDK ecosystem, visit docs.wallet.tether.io.
You can install the package using npm:
npm install @tetherto/wdk-utils
import {
validateBitcoinAddress,
validateEVMAddress,
validateLightningInvoice,
validateLightningAddress,
validateSparkAddress,
validateUmaAddress
} from '@tetherto/wdk-utils';
// Bitcoin Address Validation
const btcResult = validateBitcoinAddress('bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh');
console.log('Bitcoin validation result:', btcResult);
// EVM Address Validation
const evmResult = validateEVMAddress('0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe');
console.log('EVM validation result:', evmResult);
// Lightning Invoice Validation
const lnInvoiceResult = validateLightningInvoice('lnbc...');
console.log('Lightning invoice validation result:', lnInvoiceResult);
// Lightning Address Validation
const lnAddressResult = validateLightningAddress('user@domain.com');
console.log('Lightning address validation result:', lnAddressResult);
// Spark Address Validation
const sparkResult = validateSparkAddress('...');
console.log('Spark validation result:', sparkResult);
// UMA Address Validation
const umaResult = validateUmaAddress('$user@domain.com');
console.log('UMA validation result:', umaResult);
validateBitcoinAddress(address: string)Validates a Bitcoin address.
{ success: true, type: 'p2pkh' | 'p2sh' | 'bech32' } or { success: false, reason: string }validateEVMAddress(address: string)Validates an EVM address.
{ success: true, type: 'evm' } or { success: false, reason: string }validateLightningInvoice(address: string)Validates a Lightning Network invoice.
{ success: true, type: 'invoice' } or { success: false, reason: string }validateLightningAddress(address: string)Validates a Lightning Address.
{ success: true, type: 'address' } or { success: false, reason: string }validateSparkAddress(address: string)Validates a Spark address.
{ success: true, type: 'btc' | 'alphanumeric' } or { success: false, reason: string }validateUmaAddress(address: string)Validates a Universal Money Address.
{ success: true, type: 'uma' } or { success: false, reason: string }resolveUmaUsername(uma: string)Resolves a UMA username to its components.
{ localPart: string; domain: string; lightningAddress: string } | nullstripLightningPrefix(input: string)Strips the "lightning:" prefix from a string.
string# Install dependencies
npm install
# Run tests
npm test
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For support, please open an issue on the GitHub repository.