-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Stream blocks while executing (#87)
- Loading branch information
1 parent
3268dfa
commit 4dd1935
Showing
5 changed files
with
181 additions
and
77 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
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 |
---|---|---|
@@ -1,14 +1,19 @@ | ||
const BLOCK_FETCHER_API = | ||
"https://70jshyr5cb.execute-api.eu-central-1.amazonaws.com/block/"; | ||
|
||
const GENESIS_BLOCK_HEIGHT = 52945886; | ||
export async function fetchBlockDetails(blockHeight) { | ||
try { | ||
const response = await fetch( | ||
`${BLOCK_FETCHER_API}${String(blockHeight)}` | ||
); | ||
const block_details = await response.json(); | ||
return block_details; | ||
} catch { | ||
console.log(`Error Fetching Block Height details at ${blockHeight}`); | ||
} | ||
if (blockHeight <= GENESIS_BLOCK_HEIGHT) { | ||
throw new Error(`Block Height must be greater than genesis block height #${GENESIS_BLOCK_HEIGHT}`); | ||
} | ||
try { | ||
const response = await fetch( | ||
`${BLOCK_FETCHER_API}${String(blockHeight)}` | ||
); | ||
const block_details = await response.json(); | ||
return block_details; | ||
} catch { | ||
// console.log(`Error Fetching Block Height details at ${blockHeight}`); | ||
throw new Error(`Error Fetching Block Height details at BlockHeight #${blockHeight}`); | ||
} | ||
} |
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