SDK Reference Overview
The Atomiq SDK provides a complete TypeScript/JavaScript interface for trustless cross-chain swaps between Bitcoin and smart chains (Solana, Starknet, EVM).
This page only contains the SDK API surface reference, for actual guides about how to integrate swaps please start with SDK Guide.
What You'll Find Here
Core SDK
The main SDK package containing:
- Swapper - The central class for managing all swap operations
- SwapperFactory - Configuration and initialization
- Swap Classes - Specific implementations and base abstractions for the different swap flows:
- ISwap / IEscrowSwap - Base and abstract swap building blocks
- ToBTCSwap / ToBTCLNSwap - Smart chain to Bitcoin and Lightning
- FromBTCSwap / FromBTCLNSwap / FromBTCLNAutoSwap / SpvFromBTCSwap - Bitcoin and Lightning to smart chain
- LnForGasSwap / OnchainForGasSwap - Trusted gas swap flows
- IAddressSwap / IBTCWalletSwap / ISwapWithGasDrop - Shared swap capability interfaces
- Bitcoin - BitcoinWallet, IBitcoinWallet, headers, RPC
- Chains - ChainInterface, SwapContract, SpvVaultContract for chain integrations and contract abstractions
- Errors - IntermediaryError, RequestError, TransactionRevertedError for SDK and on-chain failure handling
- LPs - Intermediary, IntermediaryDiscovery for working with liquidity providers
- Lightning - LightningNetworkApi, LNURLPay, LNURLWithdraw for Lightning payments and LNURL
- Messenger - Messenger, NostrMessenger for data propagation/broadcasting layer between the SDK and Watchtowers
- Pricing - ISwapPrice for swap price API & fees
- Storage - IUnifiedStorage for implementing custom storage backends
- Swap Actions - SwapExecutionAction for execution step modeling
- Tokens - Token, TokenAmount for token metadata and amount handling
- Utilities - SwapperUtils and helpers for address parsing, balance checking, token identification
Chain Integrations
Chain-specific implementations you need based on your target blockchains:
Each chain module includes:
- Chain-specific swap implementations
- Wallet integrations
- RPC configuration
- Network-specific types and utilities
Storage Adapters
The SDK uses browser-based IndexedDB by default. To use the SDK in different environments, e.g. Node.js or React Native you need to use the respective storage adapter:
- File-based SQLite storage (Node.js)
- React Native Async storage
In case you need to integrate your own storage adapter for your environment check the IUnifiedStorage interface.
If you already have a key-value storage backend you can use the Memory Indexed KV to easily turn it into the swap storage backend. This keeps the necessary indexes in-memory so is only suitable for single-user swap storage (not for backend handling a great number of swaps).
Ready to integrate? Visit the SDK Guide for detailed tutorials and examples.
Want to learn more about the Atomiq protocol? Check out the protocol overview.