https://github.com/pradel/stacks-get-block-info
Expose the get-block-info clarity values
https://github.com/pradel/stacks-get-block-info
Last synced: 12 months ago
JSON representation
Expose the get-block-info clarity values
- Host: GitHub
- URL: https://github.com/pradel/stacks-get-block-info
- Owner: pradel
- License: mit
- Created: 2022-02-14T14:00:36.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-15T09:37:03.000Z (over 4 years ago)
- Last Synced: 2025-02-01T22:43:56.614Z (over 1 year ago)
- Language: TypeScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stacks-get-block-info
Expose the get-block-info clarity values so they can be used outside of smart
contracts.
## Usage
To access the clarity values, you can use the `@stacks/transactions` package.
```ts
import { callReadOnlyFunction, uintCV } from "@stacks/transactions";
import { StacksMainnet } from "@stacks/network";
const vrfSeedResult = await callReadOnlyFunction({
contractAddress: "SP3VCX5NFQ8VCHFS9M6N40ZJNVTRT4HZ62WFH5C4Q",
contractName: "get-block-info",
functionName: "get-block-info-vrf-seed",
functionArgs: [uintCV(block.height)],
network: new StacksMainnet(),
senderAddress: "SP3VCX5NFQ8VCHFS9M6N40ZJNVTRT4HZ62WFH5C4Q",
});
const vrfBuffer = vrfSeedResult.value.buffer as Buffer;
```
## Deployment
- [SP3VCX5NFQ8VCHFS9M6N40ZJNVTRT4HZ62WFH5C4Q.get-block-info](https://explorer.stacks.co/txid/SP3VCX5NFQ8VCHFS9M6N40ZJNVTRT4HZ62WFH5C4Q.get-block-info?chain=mainnet)