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

@bitgo-beta/statics

Package Overview
Dependencies
Maintainers
2
Versions
1110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bitgo-beta/statics

dependency-free static configuration for the bitgo platform

  • 7.0.1-beta.66
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
183K
increased by7.22%
Maintainers
2
Weekly downloads
 
Created
Source

@bitgo/statics

Static config for the BitGo platform

Goals

  • Provide an "encyclopedia" of all relevant constants which are sprinkled throughout the BitGo stack.
  • Separate static config data from dynamic config data
  • Strong typing for static config properties, with full type information for configuration items
  • Ability to export static configuration as JSON for consumption by non-javascript projects

Examples

Get the number of decimal places in a Bitcoin

JavaScript
const { coins } = require('@bitgo/statics');

const btc = coins.get('btc');
console.log(btc.decimalPlaces);
TypeScript
import { coins } from '@bitgo/statics';

const btc = coins.get('btc');
console.log(btc.decimalPlaces);

Get the contract address for the OmiseGo ERC20 Token

JavaScript
const { coins } = require('@bitgo/statics');

const omg = coins.get('omg');
console.log(omg.contractAddress);
TypeScript
import { coins, Erc20Coin } from '@bitgo/statics';

const omg = coins.get('omg');
if (omg instanceof Erc20Coin) {
  console.log(omg.contractAddress);
}

List full names of all defined coins

JavaScript
const { coins } = require('@bitgo/statics');

coins.forEach((coin) => {
  console.log(coin.fullName);
});
TypeScript
import { coins } from '@bitgo/statics';

coins.forEach((coin) => {
  console.log(coin.fullName);
});

Repo Status

  • UTXO and account base types are defined
  • Documentation is mostly source code comments and README examples
  • This library can be depended on, but expect some changes going forward

Project Structure

  • src/base.ts: Interfaces and enums used by coin implementation classes.
  • src/coins.ts: Coin definitions.
  • src/networks.ts: Network interfaces and implementation classes.
  • src/utxo.ts: Unspent Transaction Output (UTXO) based coin classes and factory function.
  • src/account.ts: Account-based coin classes and factory methods. Includes ERC20 factory functions.
  • src/errors.ts: Custom Error classes.

Installation + Building

To install the project locally, run the following steps:

$ # clone the project locally
$ git clone git@github.com:BitGo/statics.git

$ # npm install dependencies (optionally use node >8.6.0)
$ # (optionally) nvm install 8.6.0 -- required to run the linter which is executed pre-commit
$ # (optionally) nvm use 8.6.0
$ npm install

To build the project (from TypeScript to JavaScript):

$ npm run build

This builds the JavaScript and adds it to dist/src/. You will receive compilation errors if you have invalid syntax.

Tests

To run tests:

$ npm run test

FAQs

Package last updated on 14 Nov 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