diff --git a/sdk/package.json b/sdk/package.json index 9c472299..8dc2c5b0 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@gobob/bob-sdk", - "version": "2.3.9", + "version": "3.0.0", "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { diff --git a/sdk/src/esplora.ts b/sdk/src/esplora.ts index 8488430b..0c80030e 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 58cc813f..d5eecf32 100644 --- a/sdk/test/esplora.test.ts +++ b/sdk/test/esplora.test.ts @@ -138,6 +138,10 @@ describe('Esplora Tests', () => { it('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, + }); }); });