-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
1,219 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Import Push Chain SDK | ||
import { CONSTANTS, PushChain } from '@pushchain/devnet'; | ||
|
||
// Initialize the Push Chain SDK | ||
const pushChain = await PushChain.initialize(); | ||
|
||
// Fetch block by hash | ||
const blockByHash = await pushChain.block.get( | ||
'28ca25bb8a0b59b76612bcef411984d60f28d0468676fc755ed8f946433d0c64' | ||
); | ||
|
||
console.log(blockByHash); | ||
|
||
// Fetch the latest 20 blocks | ||
const latestBlocks = await pushChain.block.get('*', { | ||
limit: 20, | ||
}); | ||
|
||
console.log(latestBlocks); | ||
|
||
// Fetch blocks by dates - yesterday | ||
const blockByData = await pushChain.block.get('*', { | ||
startTime: Math.floor(Date.now() - 24 * 60 * 60 * 1000), | ||
order: 'ASC', | ||
}); | ||
|
||
console.log(blockByData); |
Oops, something went wrong.