Usage
Installation, quick start, and usage examples for @tetherto/wdk-wallet-spark
Known Issue: Thread Hanging in Bare runtime Environments
There is a known issue with this module causing thread hanging when used in bare runtime environments. The module is not production-ready in bare runtime at this time.
For the latest updates and workarounds, please check the GitHub Issues.
Installation
To install the @tetherto/wdk-wallet-spark package, follow these instructions:
npm install @tetherto/wdk-wallet-sparkQuick Start
Importing from @tetherto/wdk-wallet-spark
@tetherto/wdk-wallet-sparkWalletManagerSpark: Main class for managing wallets
WalletAccountSpark: Use this for full access accounts
Creating a New Spark Wallet
import WalletManagerSpark from '@tetherto/wdk-wallet-spark'
// Use a BIP-39 seed phrase (replace with your own secure phrase)
const seedPhrase = 'your twelve word seed phrase here'
// Create wallet manager with default configuration
const wallet = new WalletManagerSpark(seedPhrase)
// Or with custom network configuration
const wallet = new WalletManagerSpark(seedPhrase, {
network: 'MAINNET' // 'MAINNET', 'TESTNET', or 'REGTEST'
})
// Get a full access account
const account = await wallet.getAccount(0)
// Get the account's Spark address
const address = await account.getAddress()
console.log('Account address:', address)Note: The Spark wallet integrates with the Spark network using the @buildonspark/spark-sdk. Network configuration is limited to predefined networks, and there's no custom RPC provider option.
Managing Multiple Accounts
Important Note: Custom derivation paths via getAccountByPath() are not supported on the Spark blockchain. Only indexed accounts using the standard BIP-44 pattern are available.
Checking Balance
Transfer History
Sending Spark Transactions
Important Notes:
Spark transactions have zero fees (
fee: 0)Memo/description functionality is not supported in
sendTransactionAll amounts are specified in satoshis (1 BTC = 100,000,000 satoshis)
Addresses should be valid Spark network addresses

