0.2.1 • Published 5 years ago

@cobo/btc v0.2.1

Weekly downloads
-
License
-
Repository
-
Last release
5 years ago

BTC Wallet with altcoins support

Example

const wallet = require('@cobo/btc')

const w = wallet
  .fromMnemonic(
    'maid series tooth gesture smile scrub awesome because letter aware wash nation',
    wallet.networks.testnet
  )
  .derivePath("m/49'/1'/0'/0/0")

const utxos = [
  {
    txId: '07e73301edaaaa713d3a671120824861314f24baf7c371232026a59a389b5ced',
    vout: 0,
    value: 1 * 1e8
  }
]

const { hex } = w.generateTransaction({
  address: 'tb1quyup6le6zt30cwmf2kdmj0y84gxze0q2f67euz',
  fee: 1e4,
  utxos,
  amount: 2e7
})

console.log(hex)

Also you can switch P2PKH / P2SH for BTC:

import wallet from 'btc-wallet'

// default to p2sh
const P2PKHWallet = wallet.fromMasterSeed(
    seed,
    wallet.networks.bitcoin
)

// legacy address
const P2SHWallet = wallet.fromMasterSeed(
    seed,
    wallet.networks.bitcoin,
    wallet.ADDRESS_TYPES.p2pkh
)
0.2.1

5 years ago

0.2.0

5 years ago

0.1.7

5 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago