esplora-api-client
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

Blockstream Esplora Client

Built using OpenAPI.

Install

yarn install @interlay/esplora-btc-api

Build

Requires openapi-generator-cli.

yarn generate
yarn build

Examples

Get the current chain's best height

import * as esplora from '@interlay/esplora-btc-api';

async function main() {
    let result = await new esplora.BlockApi().getLastBlockHeight();
    console.log(result.data);
}

main();

Get a raw block and extract the header

import * as esplora from '@interlay/esplora-btc-api';

async function main() {
    const api = new esplora.BlockApi();
    const result = await api.getBlockRaw("$HASH", {responseType: 'arraybuffer'});
    console.log(result.data.slice(0, 80).toString('hex'));
}

main();

Package Sidebar

Install

npm i esplora-api-client

Weekly Downloads

3

Version

0.4.1

License

none

Unpacked Size

192 kB

Total Files

11

Last publish

Collaborators

  • cfly