
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@blockfrost/blockfrost-js
Advanced tools
A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API
A JavaScript/Typescript SDK for Blockfrost.io API.
Getting started • Installation • Usage
To use this SDK, you first need to log in to blockfrost.io, create your project and retrieve the API token.
The SDK is hosted on npmjs.com, so you can directly import it using your favorite package manager.
$ npm i @blockfrost/blockfrost-js
Using the SDK is pretty straight-forward as you can see from the following examples.
import { BlockFrostAPI } from '@blockfrost/blockfrost-js';
const API = new BlockFrostAPI({
projectId: 'YOUR API KEY HERE', // see: https://blockfrost.io
});
try {
const latestBlock = await API.blocksLatest();
const networkInfo = await API.network();
const latestEpoch = await API.epochsLatest();
const health = await API.health();
const address = await API.addresses(
'addr1qxqs59lphg8g6qndelq8xwqn60ag3aeyfcp33c2kdp46a09re5df3pzwwmyq946axfcejy5n4x0y99wqpgtp2gd0k09qsgy6pz',
);
const pools = await API.pools({ page: 1, count: 10, order: 'asc' });
console.log('pools', pools);
console.log('address', address);
console.log('networkInfo', networkInfo);
console.log('latestEpoch', latestEpoch);
console.log('latestBlock', latestBlock);
console.log('health', health);
} catch (err) {
console.log('error', err);
}
import { BlockFrostIPFS } from '@blockfrost/blockfrost-js';
const IPFS = new BlockFrostIPFS({
projectId: 'YOUR IPFS KEY HERE', // see: https://blockfrost.io
});
try {
const added = await IPFS.add(`${__dirname}/img.svg`);
console.log('added', added);
const pinned = await IPFS.pin(added.ipfs_hash);
console.log('pinned', pinned);
} catch (err) {
console.log('error', err);
}
For a more detailed list of possibilities, check out the wiki.
FAQs
A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API
The npm package @blockfrost/blockfrost-js receives a total of 4,762 weekly downloads. As such, @blockfrost/blockfrost-js popularity was classified as popular.
We found that @blockfrost/blockfrost-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.