New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 Package Compare versions

Comparing version 1.2.0 to 1.2.1

6

CHANGELOG.md

@@ -24,1 +24,7 @@ ### 1.0.0 (2021-12-27)

- Added satPerByte to add custom gas parameter satoshi.
### 1.2.1 (2022-07-19)
##### Make custom gas parameter compulsory
- Changed satPerByte from optional to compulsory parameter.

2

package.json
{
"name": "@getsafle/vault-bitcoin-controller",
"version": "1.2.0",
"version": "1.2.1",
"description": "",

@@ -5,0 +5,0 @@ "engines": {

@@ -46,3 +46,3 @@ # bitcoin-controller

bitcoinTx: {from, to, amount, satPerByte (optional)}
bitcoinTx: {from, to, amount, satPerByt}
```

@@ -59,3 +59,3 @@

```
const fees = await bitcoinController.getFee(address, satPerByte (optional));
const fees = await bitcoinController.getFee(address, satPerByte);
```

@@ -62,0 +62,0 @@

@@ -18,4 +18,3 @@ module.exports = {

},
SATOSHI: 100000000,
DEFAULT_SATOSHI_PER_BYTE: 20
SATOSHI: 100000000
}
const axios = require('axios')
const { SATOSHI, DEFAULT_SATOSHI_PER_BYTE } = require("../config/index")
const { SATOSHI } = require("../config/index")
async function getFeeAndInput(URL, satPerByte = DEFAULT_SATOSHI_PER_BYTE) {
async function getFeeAndInput(URL, satPerByte) {

@@ -6,0 +6,0 @@ let fee = 0;

@@ -6,3 +6,3 @@ const bitcore = require("bitcore-lib")

async function signTransaction(from, to, amountToSend, URL, privateKey, satPerByte = DEFAULT_SATOSHI_PER_BYTE) {
async function signTransaction(from, to, amountToSend, URL, privateKey, satPerByte) {

@@ -9,0 +9,0 @@ const satoshiToSend = amountToSend * SATOSHI;

@@ -11,3 +11,3 @@ const ObservableStore = require('obs-store')

const { bitcoin: { HD_PATH }, bitcoin_transaction: { NATIVE_TRANSFER }, bitcoin_network: { MAINNET, TESTNET }, DEFAULT_SATOSHI_PER_BYTE } = require('./config/index')
const { bitcoin: { HD_PATH }, bitcoin_transaction: { NATIVE_TRANSFER }, bitcoin_network: { MAINNET, TESTNET } } = require('./config/index')

@@ -87,3 +87,3 @@ class KeyringController {

try {
const signedTransaction = await helpers.signTransaction(from, to, amount, URL, privkey, satPerByte ? satPerByte : DEFAULT_SATOSHI_PER_BYTE)
const signedTransaction = await helpers.signTransaction(from, to, amount, URL, privkey, satPerByte)
return { signedTransaction };

@@ -125,3 +125,3 @@ } catch (err) {

async getFee(address, satPerByte = DEFAULT_SATOSHI_PER_BYTE) {
async getFee(address, satPerByte) {
const { networkType } = this.store.getState()

@@ -128,0 +128,0 @@ try {

@@ -76,3 +76,3 @@ var assert = require('assert');

it("Get fees", async () => {
it("Get fees will return NaN", async () => {
const acc = await bitcoinWallet.getAccounts()

@@ -89,7 +89,11 @@ const { transactionFees } = await bitcoinWallet.getFee(acc[0]);

it("Sign Transaction", async () => {
const acc = await bitcoinWallet.getAccounts()
BTC_TXN_PARAM['from'] = acc[0]
const { signedTransaction } = await bitcoinWallet.signTransaction(BTC_TXN_PARAM);
console.log("signedTransaction ", signedTransaction)
it("Sign Transaction should fail and throw error", async () => {
try {
const acc = await bitcoinWallet.getAccounts()
BTC_TXN_PARAM['from'] = acc[0]
const { signedTransaction } = await bitcoinWallet.signTransaction(BTC_TXN_PARAM);
console.log("signedTransaction ", signedTransaction)
} catch (err) {
console.log("Catching error ", err)
}
})

@@ -96,0 +100,0 @@

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