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

@getsafle/vault-bitcoin-controller

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

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-

  • 2.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by450%
Maintainers
4
Weekly downloads
 
Created
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

Package last updated on 04 Dec 2023

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