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 Package Compare versions

Comparing version 1.0.0 to 1.0.1

CHANGELOG.md

8

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

@@ -33,9 +33,3 @@ "engines": {

"bitcoinjs-message": "^2.2.0",
"bitcore-explorers": "^1.0.1",
"bitcore-lib": "^8.25.10",
"browser-passworder": "^2.0.3",
"crypto-js": "^4.0.0",
"ed25519-hd-key": "^1.2.0",
"hdkey": "^2.0.1",
"loglevel": "^1.8.0",
"obs-store": "^4.0.3"

@@ -42,0 +36,0 @@ },

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

## Initialize the Polygon Controller class
## Initialize the Bitcoin Controller class

@@ -10,0 +10,0 @@ ```

@@ -0,0 +0,0 @@ module.exports = {

@@ -1,2 +0,1 @@

const axios = require('axios')
const bitcore = require("bitcore-lib")

@@ -13,3 +12,3 @@ const { SATOSHI } = require("../config/index")

const {totalAmountAvailable, inputs, fee} = await getFeeAndInput(URL)
const { totalAmountAvailable, inputs, fee } = await getFeeAndInput(URL)

@@ -16,0 +15,0 @@ if (totalAmountAvailable - satoshiToSend - fee < 0) {

const getNetwork = require('./getNetwork');
const generateAddress = require('./generateAddress');
const calcBip32ExtendedKeys = require('./calcBip32ExtendedKeys');
const getAddressFromPk = require('./getAddressFromPk');

@@ -8,3 +9,4 @@ module.exports = {

generateAddress,
calcBip32ExtendedKeys
calcBip32ExtendedKeys,
getAddressFromPk
}

@@ -1,5 +0,2 @@

const { EventEmitter } = require('events')
const log = require('loglevel')
const ObservableStore = require('obs-store')
const encryptor = require('browser-passworder')

@@ -27,2 +24,3 @@ const bitcoinjs = require('bitcoinjs-lib')

this.generateWallet()
this.importedWallets = []
}

@@ -61,2 +59,13 @@

async importWallet(_privateKey) {
try {
const { network } = this.store.getState()
const address = helpers.utils.getAddressFromPk(_privateKey, network)
this.importedWallets.push(address);
return address
} catch (e) {
return Promise.reject(e)
}
}
/**

@@ -63,0 +72,0 @@ * NATIVE_TRANSFER : {from, to, amount}

@@ -6,2 +6,11 @@ module.exports = {

EXTERNAL_ACCOUNT_PRIVATE_KEY_MAINNET: "KxF7H3kLetxkVG2545MhhW3vGi6NViLMAhhPfU9M6Qirdx8Thrnw", // works on MAINNET ONLY
EXTERNAL_ACCOUNT_ADDRESS_MAINNET: "bc1qtqectlurn5uhgzdym8ehn8ssxu0vamwsm9he0v",
EXTERNAL_ACCOUNT_PRIVATE_KEY: "cSmqQzpnXgQamBLsNqGXJXEbDx6X9Co1yuUTCpikXLtv8ChNssiY", // works on TESTNET ONLY
EXTERNAL_ACCOUNT_ADDRESS: "tb1qfl644sg3vcyv3gk6h4e8yc8jsmndpclhgusm3p",
EXTERNAL_ACCOUNT_WRONG_PRIVATE_KEY_1: "random_private_key",
EXTERNAL_ACCOUNT_WRONG_PRIVATE_KEY_2: "0xbcb7a8680126610ca94440b020280f9ef829ad26637bfb5cc",
EXTERNAL_ACCOUNT_WRONG_PRIVATE_KEY_3: "QUWL7cmUp9Cj9DF3gLFqqSipopXyzuF4QXmDNV3ZTZ28GB6Ug98Z",
EXTERNAL_ACCOUNT_WRONG_PRIVATE_KEY_4: "0xbcb7a8680126610ca94440b020280f9ef82194a4dc2760653073b5f5b150c9c3",
TESTING_MESSAGE_1: "ThisMessageOneIsForTesting",

@@ -8,0 +17,0 @@ TESTING_MESSAGE_2: "This_message_two_is_for_testing",

@@ -7,2 +7,10 @@ var assert = require('assert');

HD_WALLET_12_MNEMONIC_TEST_OTHER,
EXTERNAL_ACCOUNT_PRIVATE_KEY,
EXTERNAL_ACCOUNT_ADDRESS,
EXTERNAL_ACCOUNT_PRIVATE_KEY_MAINNET,
EXTERNAL_ACCOUNT_ADDRESS_MAINNET,
EXTERNAL_ACCOUNT_WRONG_PRIVATE_KEY_1,
EXTERNAL_ACCOUNT_WRONG_PRIVATE_KEY_2,
EXTERNAL_ACCOUNT_WRONG_PRIVATE_KEY_3,
EXTERNAL_ACCOUNT_WRONG_PRIVATE_KEY_4,
TESTING_MESSAGE_1,

@@ -85,2 +93,13 @@ TESTING_MESSAGE_2,

it("Should import correct account ", async () => {
if (opts.network === MAINNET) {
const address = await bitcoinWallet.importWallet(EXTERNAL_ACCOUNT_PRIVATE_KEY_MAINNET)
assert(address.toLowerCase() === EXTERNAL_ACCOUNT_ADDRESS_MAINNET.toLowerCase(), "Wrong address")
} else {
const address = await bitcoinWallet.importWallet(EXTERNAL_ACCOUNT_PRIVATE_KEY)
assert(address.toLowerCase() === EXTERNAL_ACCOUNT_ADDRESS.toLowerCase(), "Wrong address")
}
assert(bitcoinWallet.importedWallets.length === 1, "Should have 1 imported wallet")
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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