Socket
Socket
Sign inDemoInstall

@getsafle/vault-bitcoin-controller

Package Overview
Dependencies
79
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @getsafle/vault-bitcoin-controller

[![npm version](https://badge.fury.io/js/@getsafle%2Fvault-bitcoin-controller.svg)](https://badge.fury.io/js/@getsafle%2Fvault-bitcoin-controller) [![Discussions][discussions-


Version published
Weekly downloads
3
decreased by-70%
Maintainers
4
Created
Weekly downloads
 

Changelog

Source

2.0.7 (2024-01-30)

  • Added generic network parameter in sign transaction

Readme

Source

bitcoin-controller

npm version Static Badge Discussions Static Badge

Install

npm install --save @getsafle/vault-bitcoin-controller

Initialize the Bitcoin Controller class

const { KeyringController, getBalance } = require('@getsafle/vault-bitcoin-controller');

const bitcoinController = new KeyringController({
    // 12 words mnemonic to create wallet
    mnemonic: string,
    // network - type of network [TESTNET|MAINNET]
    // default is MAINNET even if no network is passed
    network: string (TESTNET | MAINNET)
});

Methods

Generate Keyring with 1 account or add new account

const keyringState = await bitcoinController.addAccount();

Export the private key of an address present in the keyring

const privateKey = await bitcoinController.exportPrivateKey(address);

Get all accounts in the keyring

const privateKey = await bitcoinController.getAccounts();

Sign a transaction

const signedTx = await bitcoinController.signTransaction(bitcoinTx);

bitcoinTx: {from, to, amount, satPerByt}

Sign a message

const signedMsg = await bitcoinController.signMessage(msgString, address);

Get fees

const fees = await bitcoinController.getFees(rawTransaction);

Get balance

const balance = await getBalance(address, network); // if network !== TESTNET then it will fetch mainnet balance

Keywords

FAQs

Last updated on 30 Jan 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc