Send and Transfer
Send native Spark, transfer tokens, and estimate fees.
This guide explains how to send native Spark, transfer tokens, and estimate fees.
Send Spark
- Build the recipient Spark address and amount in satoshis.
- Call
account.sendTransaction().
You can send native Spark (satoshis) using account.sendTransaction():
const result = await account.sendTransaction({
to: 'spark1...',
value: 1000000
})
console.log('Transaction hash:', result.hash)
console.log('Transaction fee:', result.fee)On-chain Spark transfers report fee as 0. Memos are not supported on sendTransaction(). Use valid Spark network addresses.
If you enable syncAndRetry, the wallet syncs its state and retries account.sendTransaction() once after a failure:
const wallet = new WalletManagerSpark(seedPhrase, {
network: 'MAINNET',
syncAndRetry: true,
})
const account = await wallet.getAccount(0)
await account.sendTransaction({
to: 'spark1...',
value: 1000000,
})Transfer Tokens
You can move tokens to another Spark address using account.transfer():
const transferResult = await account.transfer({
token: 'btkn1...',
amount: BigInt(1000000),
recipient: 'spark1...'
})
console.log('Transfer hash:', transferResult.hash)
console.log('Transfer fee:', Number(transferResult.fee))Token identifiers use Bech32m (for example btkn1...). Amounts use the token’s base units.
Estimate Fees
Spark native and token transfer quotes
You can preview the fee for a native send using account.quoteSendTransaction():
const quote = await account.quoteSendTransaction({
to: 'spark1...',
value: 1000000
})
console.log('Estimated fee:', quote.fee)You can preview the fee for a token transfer using account.quoteTransfer():
const transferQuote = await account.quoteTransfer({
token: 'btkn1...',
amount: BigInt(1000000),
recipient: 'spark1...'
})
console.log('Estimated transfer fee:', Number(transferQuote.fee))Wallet-level fee rates
You can read wallet-level fee rate placeholders using wallet.getFeeRates():
const feeRates = await wallet.getFeeRates()
console.log('Normal:', feeRates.normal)
console.log('Fast:', feeRates.fast)Spark network fees for native sends and token transfers are zero; wallet.getFeeRates() returns { normal: 0n, fast: 0n }. Lightning flows can still incur fees; see Lightning payments.
If you want to reconcile wallet state before retrying manually, call account.syncWalletBalance():
await account.syncWalletBalance()Next Steps
Learn how to create and pay Lightning invoices.