Merge branch 'add-getUnspentTokens-function-to-base-wallet' into 'development'

Add get unspent tokens function to base wallet

See merge request GeneralProtocols/xo/stack!120
This commit is contained in:
Jim Hamill
2025-08-09 22:08:46 +00:00
+15
View File
@@ -146,6 +146,21 @@ export abstract class BaseWallet<
*/
abstract getUnspents(): Promise<BlockchainUTXOs>;
/**
* Fetch all unspents tokens from the blockchain belonging to this wallet.
*/
async getUnspentTokens(): Promise<BlockchainUTXOs> {
// Get the unspents.
const unspents = await this.getUnspents();
// Filter to get only the utxos that contain tokens
const unspentTokens = unspents.filter((utxo) => {
return Boolean(utxo.utxo.output.token);
});
return unspentTokens;
};
/**
* Fetch all unspents from the blockchain belonging to this wallet.
*