New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bitcore-lib-ltc

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitcore-lib-ltc - npm Package Compare versions

Comparing version 10.0.28 to 10.0.36

77

lib/networks.js
'use strict';
var _ = require('lodash');
var BufferUtil = require('./util/buffer');

@@ -34,10 +32,7 @@ var JSUtil = require('./util/js');

if (keys) {
if (!_.isArray(keys)) {
if (!Array.isArray(keys)) {
keys = [keys];
}
var containsArg = function(key) {
return networks[index][key] === arg;
};
for (var index in networks) {
if (_.some(keys, containsArg)) {
for (const index in networks) {
if (keys.some(key => networks[index][key] === arg)) {
return networks[index];

@@ -48,3 +43,3 @@ }

}
if(networkMaps[arg] && networkMaps[arg].length >= 1) {
if (networkMaps[arg] && networkMaps[arg].length >= 1) {
return networkMaps[arg][0];

@@ -58,2 +53,13 @@ } else {

* @function
* @member Networks#is
* Returns true if the string is the network name or alias
* @param {string} str - A string to check
* @return boolean
*/
function is(str) {
return this.name == str || this.alias == str;
}
/**
* @function
* @member Networks#add

@@ -70,5 +76,7 @@ * Will add a custom Network

* @param {Number} data.xprivkey - The extended private key magic
* @param {Number} data.networkMagic - The network magic number
* @param {Number} data.port - The network port
* @param {Array} data.dnsSeeds - An array of dns seeds
* @param {Array} data.variants - An array of variants
* @param {string} data.variants.name - The name of the variant
* @param {Number} data.variants.networkMagic - The network magic number
* @param {Number} data.variants.port - The network port
* @param {Array} data.variants.dnsSeeds - An array of dns seeds
* @return Network

@@ -83,2 +91,3 @@ */

alias: data.alias,
is: data.is,
pubkeyhash: data.pubkeyhash,

@@ -118,5 +127,5 @@ privatekey: data.privatekey,

_.each(network, function(value) {
if (!_.isUndefined(value) && !_.isObject(value)) {
if(!networkMaps[value]) {
for (const value of Object.values(network)) {
if (value != null && typeof value !== 'object') {
if (!networkMaps[value]) {
networkMaps[value] = [];

@@ -126,8 +135,15 @@ }

}
});
};
networks.push(network);
for (const variant of data.variants || []) {
addNetwork({
...data,
variants: undefined,
...variant,
});
}
return network;
}

@@ -162,3 +178,4 @@

}
}}
}
}

@@ -168,2 +185,3 @@ addNetwork({

alias: 'mainnet',
is,
pubkeyhash: 0x30, // 48

@@ -196,3 +214,4 @@ privatekey: 0xb0, // 176

name: 'testnet',
alias: 'test',
alias: 'testnet',
is,
pubkeyhash: 0x6f, // 111

@@ -205,8 +224,11 @@ privatekey: 0xef, // 239

xprivkey: 0x04358394,
networkMagic: 0xfdd2c8f1,
port: 19335,
dnsSeeds: [
'testnet-seed.litecointools.com',
'seed-b.litecoin.loshan.co.uk'
]
variants: [{
name: 'testnet4',
networkMagic: 0xfdd2c8f1,
port: 19335,
dnsSeeds: [
'testnet-seed.litecointools.com',
'seed-b.litecoin.loshan.co.uk'
]
}]
});

@@ -219,2 +241,3 @@

var testnet = get('testnet');
var testnet4 = get('testnet4');

@@ -224,2 +247,3 @@ addNetwork({

alias: 'dev',
is,
pubkeyhash: 0x6f, // 111

@@ -239,3 +263,3 @@ privatekey: 0xef, // 239

* @instance
* @member Networks#testnet
* @member Networks#regtest
*/

@@ -274,2 +298,3 @@ var regtest = get('regtest');

testnet: testnet,
testnet4: testnet4,
regtest: regtest,

@@ -276,0 +301,0 @@ get: get,

{
"name": "bitcore-lib-ltc",
"version": "10.0.28",
"version": "10.0.36",
"description": "A pure and powerful JavaScript Litecoin library.",

@@ -106,3 +106,3 @@ "author": "BitPay <dev@bitpay.com>",

"license": "MIT",
"gitHead": "c47030e29c2ef353b41955d78fd0ca5c8422c590"
"gitHead": "44397d0f60079b0d52a2d94cdb2923c0e783206e"
}

@@ -210,2 +210,14 @@ 'use strict';

it('should make a new private key from random for testnet', function() {
var key = new HDPrivateKey('testnet');
should.exist(key.xprivkey);
key.network.name.should.equal('testnet');
});
it('should make a new private key from random for testnet when passing specific network "testnet4"', function() {
var key = new HDPrivateKey('testnet4');
should.exist(key.xprivkey);
key.network.name.should.equal('testnet');
});
describe('validates paths', function() {

@@ -212,0 +224,0 @@ it('validates correct paths', function() {

@@ -123,2 +123,15 @@ 'use strict';

it('should have not have network magic or port for testnet', function() {
var testnet = networks.get('testnet');
var buffUtil = require('../lib/util/buffer');
buffUtil.isBuffer(testnet.networkMagic).should.equal(false);
isNaN(testnet.port).should.equal(true);
});
it('should have network magic and port for testnet variant "testnet4"', function() {
var testnet = networks.get('testnet4');
var buffUtil = require('../lib/util/buffer');
buffUtil.isBuffer(testnet.networkMagic).should.equal(true);
isNaN(testnet.port).should.equal(false);
});
});
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