Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.spark.money/llms.txt

Use this file to discover all available pages before exploring further.

Gets all available leaves (UTXOs) owned by the wallet.

Method Signature

async getLeaves(isBalanceCheck: boolean = false): Promise<TreeNode[]>

Parameters

isBalanceCheck
boolean
If true, only queries the coordinator for faster response (default: false)

Returns

leaves
TreeNode[]
required
Array of tree nodes representing wallet leaves

Example

const leaves = await wallet.getLeaves();
console.log("Leaves:", leaves.length);
console.log("Total value:", leaves.reduce((sum, l) => sum + l.value, 0));