-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jellyfish-api-core): add blockchain getTxOutSetInfo RPC (#1775)
<!-- Thanks for sending a pull request! --> #### What this PR does / why we need it: /kind feature #### Which issue(s) does this PR fixes?: <!-- (Optional) Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Fixes part of #48 - Implements `gettxoutsetinfo` type for RPC.
- Loading branch information
1 parent
9e80daa
commit 1761d40
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/jellyfish-api-core/__tests__/category/blockchain/getTxOutSetInfo.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { MasterNodeRegTestContainer } from '@defichain/testcontainers' | ||
import { ContainerAdapterClient } from '../../container_adapter_client' | ||
import BigNumber from 'bignumber.js' | ||
|
||
describe('TxOutSetInfo', () => { | ||
const container = new MasterNodeRegTestContainer() | ||
const client = new ContainerAdapterClient(container) | ||
|
||
beforeAll(async () => { | ||
await container.start() | ||
await container.waitForBlockHeight(1) | ||
}) | ||
|
||
afterAll(async () => { | ||
await container.stop() | ||
}) | ||
|
||
it('should getTxOutSetInfo', async () => { | ||
const txOutSetInfo = await client.blockchain.getTxOutSetInfo() | ||
|
||
expect(txOutSetInfo).toStrictEqual({ | ||
height: 2, | ||
bestblock: expect.any(String), | ||
transactions: expect.any(Number), | ||
txouts: expect.any(Number), | ||
bogosize: expect.any(Number), | ||
hash_serialized_2: expect.any(String), | ||
disk_size: expect.any(Number), | ||
total_amount: expect.any(BigNumber) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters