-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from blockfrost/feat/mempool
chore: add methods for mempool endpoint, refactor types with @blockfrost/openapi
- Loading branch information
Showing
57 changed files
with
769 additions
and
5,720 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+102 KB
.yarn/cache/@redocly-openapi-cli-npm-1.0.0-beta.94-c4407337cb-9085a1b2b6.zip
Binary file not shown.
Binary file added
BIN
+458 KB
.yarn/cache/@redocly-openapi-core-npm-1.0.0-beta.94-ebd2a8a261-14b40f8718.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.85 KB
.yarn/cache/expected-node-version-npm-1.0.2-74ff7e5129-2d7bac9ea5.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
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
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
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
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
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
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
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
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,55 @@ | ||
import { getPaginationOptions, paginateMethod } from '../../../utils'; | ||
import { components } from '@blockfrost/openapi'; | ||
import { BlockFrostAPI } from '../../../index'; | ||
import { AllMethodOptions, PaginationOptions } from '../../../types'; | ||
import { handleError } from '../../../utils/errors'; | ||
|
||
export async function mempool( | ||
this: BlockFrostAPI, | ||
pagination?: PaginationOptions, | ||
): Promise<components['schemas']['mempool_content']> { | ||
const paginationOptions = getPaginationOptions(pagination); | ||
|
||
return new Promise((resolve, reject) => { | ||
this.instance<components['schemas']['mempool_content']>(`mempool`, { | ||
searchParams: { | ||
page: paginationOptions.page, | ||
count: paginationOptions.count, | ||
order: paginationOptions.order, | ||
}, | ||
}) | ||
.then(resp => { | ||
resolve(resp.body); | ||
}) | ||
.catch(err => { | ||
reject(handleError(err)); | ||
}); | ||
}); | ||
} | ||
|
||
export async function mempoolAll( | ||
this: BlockFrostAPI, | ||
allMethodOptions?: AllMethodOptions, | ||
): Promise<components['schemas']['mempool_content']> { | ||
return paginateMethod( | ||
pagination => this.mempool(pagination), | ||
allMethodOptions, | ||
); | ||
} | ||
|
||
export async function mempoolTx( | ||
this: BlockFrostAPI, | ||
hash: string, | ||
): Promise<components['schemas']['mempool_tx_content']> { | ||
return new Promise((resolve, reject) => { | ||
this.instance<components['schemas']['mempool_tx_content']>( | ||
`mempool/${hash}`, | ||
) | ||
.then(resp => { | ||
resolve(resp.body); | ||
}) | ||
.catch(err => { | ||
reject(handleError(err)); | ||
}); | ||
}); | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.