diff --git a/sdk/src/esplora.ts b/sdk/src/esplora.ts index 8488430b6..0c80030ea 100644 --- a/sdk/src/esplora.ts +++ b/sdk/src/esplora.ts @@ -423,7 +423,12 @@ export class EsploraClient { const chainBalance = response.chain_stats.funded_txo_sum - response.chain_stats.spent_txo_sum; const mempoolBalance = response.mempool_stats.funded_txo_sum - response.mempool_stats.spent_txo_sum; - // Return as an object with chain, mempool, and total fields + console.log({ + chain: chainBalance, + mempool: mempoolBalance, + total: chainBalance + mempoolBalance, + }); + return { chain: chainBalance, mempool: mempoolBalance, diff --git a/sdk/test/esplora.test.ts b/sdk/test/esplora.test.ts index 58cc813fd..ef1a59cc2 100644 --- a/sdk/test/esplora.test.ts +++ b/sdk/test/esplora.test.ts @@ -135,9 +135,13 @@ describe('Esplora Tests', () => { assert(feeRate > 0); }); - it('should get balance', async () => { + it.only('should get balance', async () => { const client = new EsploraClient('testnet'); const balance = await client.getBalance('tb1qjhekcm565spvr0epqu5nvd9mhgwaafg6d0n2yw'); - assert.equal(balance, 727499862); + assert.deepEqual(balance, { + chain: 727499862, + mempool: 0, + total: 727499862, + }); }); });