Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/__tests__/mempool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ describe('Mempool tests', () => {
})

it('should fetch mempool state', async () => {
const orderBy = 'asc'
const mempoolState = bitgesellBlockchainSDK.mempool.getMempoolState(1, orderBy)
expect(mempoolState).toBeDefined()
const mempoolState = await bitgesellBlockchainSDK.mempool.getMempoolState()
expect(mempoolState).toHaveProperty('inputs')
expect(mempoolState).toHaveProperty('outputs')
expect(mempoolState).toHaveProperty('transactions')
})

it('should get invalid Transactions in the mempool', async () => {
Expand Down
12 changes: 4 additions & 8 deletions src/classes/Mempool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ export class Mempool {
}

/**
* @param limit limit per page
* @param order order results by des, asc etc
* @param fromTimestamp timestamp limit to fetch up th current timestamp
* @param page number of page results to fetch default = 1
* getMempoolState fetches mempool state
*/
public async getMempoolState(limit?: number, order?: string, fromTimestamp?: number, page = 1): Promise<MempoolState> {
const url = `${this.apiV1URL}/mempool/transactions?page=${page}&limit=${limit}&order=${order}&from_timestamp=${fromTimestamp}`
* getMempoolState fetches aggregate mempool state.
*/
public async getMempoolState(): Promise<MempoolState> {
const url = `${this.apiV1URL}/mempool/state`
const data = await this._get(url)
return data as MempoolState
}
Expand Down