Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao committed Oct 16, 2024
1 parent ba4b03a commit cea2608
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion sdk/src/esplora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions sdk/test/esplora.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
});

0 comments on commit cea2608

Please sign in to comment.