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 ec54300
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
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
6 changes: 5 additions & 1 deletion sdk/test/esplora.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
});

0 comments on commit ec54300

Please sign in to comment.