Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trezor/blockchain-link

Package Overview
Dependencies
Maintainers
6
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trezor/blockchain-link

High-level javascript interface for blockchain communication

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53K
increased by0.14%
Maintainers
6
Weekly downloads
 
Created
Source

blockchain-link is a client and unified interface for several backends (BE further on) of various blockchain networks. Currently, there are implementations for

  • blockbook: BE developed and deployed by SatoshiLabs. Provides access to Bitcoin(like) and Ethereum(like) networks.
  • ripple: third party BE that provides access to the Ripple network.
  • blockfrost: third party BE that provides access to the Cardano network.

Usage

Add blockchain-link to your dependencies.

yarn add @trezor/blockchain-link

And use it.

import BlockchainLink from '@trezor/blockchain-link';

const link = new BlockchainLink({
    name: 'Name used in logs.';
    worker: 'path/to/the/worker.js';
    server: ['url1.of.the.be', 'url2.of.the.be'];
    debug: true;
});

try {
    const resp = link.getInfo();
} catch(error) {

}

For complete API see the methods of BlockchainLink class in index.ts.

Workers

Minified workers built for various environments are available in subdirectories of @trezor/blockchain-link/build/.

  • module: Workers wrapped by primitive self-written webpack plugin into javascript module which can be used as regular module on the main thread. Useful in environments where Worker API is not available like react-native. See this webpack config for example integration.
  • web: Workers for browser based environments. See this webpack config.
  • node: Workers for node based environments. See this webpack config.

All workers can be also built from source. For example using webpack worker-loader:

import BlockbookWorker from 'worker-loader?filename=workers/blockbook-worker.[hash].js!@trezor/blockchain-link/lib/workers/blockbook/index.js';

Development

This package provides a simple testing UI for playing around with various implementations and BEs. Run it with

yarn
yarn dev

Build

yarn lint
yarn test
yarn build

Publishing

Prerequisites
  1. Make sure you have a npm account with write access to @trezor/blockchain-link package.
  2. Update CHANGELOG.md and list all changes since the last release.
  3. Bump the version in packages/blockchain-link/package.json. Use the semver convention.
Production
  1. cd packages/blockchain-link cd into the root of blockchain-link package.
  2. yarn build:lib Build the library.
  3. npm publish Publish!
Beta

If you want to publish to npm as beta (from any branch) do the following:

  1. cd packages/blockchain-link cd into the root of blockchain-link package.
  2. Change the version in packages/blockchain-link/package.json from X.X.X to X.X.(X + 1)-beta.1. The -beta.<n> suffix is important because NPM registry doesn't allow overriding already published versions. With this suffix we can publish multiple beta versions for a single patch.
  3. yarn build:lib Build the library.
  4. npm publish --tag beta Publish!

Keywords

FAQs

Package last updated on 11 Jan 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc