Usage

Installation, quick start, and usage examples for @tetherto/wdk-wallet-spark

Installation

To install the @tetherto/wdk-wallet-spark package, follow these instructions:

npm install @tetherto/wdk-wallet-spark

Quick Start

Importing from @tetherto/wdk-wallet-spark

  1. WalletManagerSpark: Main class for managing wallets

  2. 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 sendTransaction

  • All amounts are specified in satoshis (1 BTC = 100,000,000 satoshis)

  • Addresses should be valid Spark network addresses

Message Signing and Verification

Memory Management

Lightning Network Integration

Bitcoin Layer 1 Bridge

Complete Examples

Complete Spark Wallet Setup

Lightning Network Integration

Bitcoin Layer 1 Bridge

Multi-Account Management

Transaction History Analysis

Error Handling


Need Help?