How to use the @liquality/bitcoin-networks.bitcoin function in @liquality/bitcoin-networks

To help you get started, we’ve selected a few @liquality/bitcoin-networks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github liquality / chainabstractionlayer / packages / bitcoin-ledger-provider / lib / BitcoinLedgerProvider.js View on Github external
  constructor (chain = { network: networks.bitcoin, segwit: false }, numberOfBlockConfirmation = 1) {
    super(Bitcoin, `${chain.segwit ? '49' : '44'}'/${chain.network.coinType}'/0'/`, chain.network, 'BTC')
    this._derivationPath = `${chain.segwit ? '49' : '44'}'/${chain.network.coinType}'/0'/`
    this._network = chain.network
    this._bjsnetwork = chain.network.name.replace('bitcoin_', '') // for bitcoin js
    this._segwit = chain.segwit
    this._coinType = chain.network.coinType
    this._walletPublicKeyCache = {}
  }
github liquality / chainabstractionlayer / packages / bitcoin-bitcoinjs-lib-swap-provider / lib / BitcoinBitcoinJsLibSwapProvider.js View on Github external
  constructor (chain = { network: networks.bitcoin }, mode = 'p2wsh') {
    super()
    this._network = chain.network
    if (!['p2wsh', 'p2shSegwit', 'p2sh'].includes(mode)) {
      throw new Error('Mode must be one of p2wsh, p2sSegwit, p2sh')
    }
    this._mode = mode
    if (this._network.name === networks.bitcoin.name) {
      this._bitcoinJsNetwork = bitcoin.networks.mainnet
    } else if (this._network.name === networks.bitcoin_testnet.name) {
      this._bitcoinJsNetwork = bitcoin.networks.testnet
    } else if (this._network.name === networks.bitcoin_regtest.name) {
      this._bitcoinJsNetwork = bitcoin.networks.regtest
    }
  }
github liquality / chainabstractionlayer / packages / bitcoin-swap-provider / lib / BitcoinSwapProvider.js View on Github external
  constructor (chain = { network: networks.bitcoin }, mode = 'p2wsh') {
    super()
    this._network = chain.network
    if (!['p2wsh', 'p2shSegwit', 'p2sh'].includes(mode)) {
      throw new Error('Mode must be one of p2wsh, p2shSegwit, p2sh')
    }
    this._mode = mode
  }
github liquality / chainabstractionlayer / packages / bitcoin-collateral-provider / lib / BitcoinCollateralProvider.js View on Github external
  constructor (chain = { network: networks.bitcoin }) {
    super()
    this._network = chain.network
  }
github liquality / chainabstractionlayer / packages / bitcoin-node-wallet-provider / lib / BitcoinNodeWalletProvider.js View on Github external
import WalletProvider from '@liquality/wallet-provider'
import JsonRpcProvider from '@liquality/jsonrpc-provider'
import BitcoinNetworks from '@liquality/bitcoin-networks'
import { AddressTypes } from '@liquality/bitcoin-utils'
import * as bitcoin from 'bitcoinjs-lib'
import { sha256 } from '@liquality/crypto'
import { Address, addressToString } from '@liquality/utils'
import _ from 'lodash'

import { version } from '../package.json'

const BIP70_CHAIN_TO_NETWORK = {
  'main': BitcoinNetworks.bitcoin,
  'test': BitcoinNetworks.bitcoin_testnet,
  'regtest': BitcoinNetworks.bitcoin_regtest
}

export default class BitcoinNodeWalletProvider extends WalletProvider {
  constructor (network, uri, username, password, addressType = 'bech32') {
    super()
    if (!AddressTypes.includes(addressType)) {
      throw new Error(`addressType must be one of ${AddressTypes.join(',')}`)
    }
    this._addressType = addressType
    this._network = network
    this._rpc = new JsonRpcProvider(uri, username, password)
  }

  async signMessage (message, from) {
github liquality / chainabstractionlayer / packages / bitcoin-bitcoinjs-lib-swap-provider / lib / BitcoinBitcoinJsLibSwapProvider.js View on Github external
constructor (chain = { network: networks.bitcoin }, mode = 'p2wsh') {
    super()
    this._network = chain.network
    if (!['p2wsh', 'p2shSegwit', 'p2sh'].includes(mode)) {
      throw new Error('Mode must be one of p2wsh, p2sSegwit, p2sh')
    }
    this._mode = mode
    if (this._network.name === networks.bitcoin.name) {
      this._bitcoinJsNetwork = bitcoin.networks.mainnet
    } else if (this._network.name === networks.bitcoin_testnet.name) {
      this._bitcoinJsNetwork = bitcoin.networks.testnet
    } else if (this._network.name === networks.bitcoin_regtest.name) {
      this._bitcoinJsNetwork = bitcoin.networks.regtest
    }
  }

@liquality/bitcoin-networks

[![Build Status](https://travis-ci.com/liquality/chainabstractionlayer.svg?branch=master)](https://travis-ci.com/liquality/chainabstractionlayer) [![Coverage Status](https://coveralls.io/repos/github/liquality/chainabstractionlayer/badge.svg?branch=master

MIT
Latest version published 3 years ago

Package Health Score

52 / 100
Full package analysis

Similar packages