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

blockcast

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blockcast - npm Package Compare versions

Comparing version 3.5.0 to 3.6.0

2

package.json
{
"name": "blockcast",
"version": "3.5.0",
"version": "3.6.0",
"description": "A multi-transaction protocol for storing data in the Bitcoin blockchain.",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -45,8 +45,3 @@ var zlib = require('zlib')

}
var length = parseInt(((dataLength - OP_RETURN_SIZE) / OP_RETURN_SIZE) + 2, 10)
var lengthByte = new Buffer(dth(length), 'hex')
var count = OP_RETURN_SIZE - 3
var dataPayload = compressedBuffer.slice(0, count)
var payload = Buffer.concat([MAGIC_NUMBER, VERSION, lengthByte, dataPayload])
payloads.push(payload)
while (count < dataLength) {

@@ -57,2 +52,6 @@ payload = compressedBuffer.slice(count, count + OP_RETURN_SIZE)

}
var lengthByte = new Buffer(dth(payloads.length + 1), 'hex')
var dataPayload = compressedBuffer.slice(0, OP_RETURN_SIZE - 3)
var payload = Buffer.concat([MAGIC_NUMBER, VERSION, lengthByte, dataPayload])
payloads.unshift(payload)
callback(false, payloads)

@@ -59,0 +58,0 @@ })

@@ -158,2 +158,14 @@ /* global it, expect, describe */

it('should create a known data payload and then decode it', function (done) {
var data = '{"op":"t","sha1":"5eac19f495bfa2502b76e39c8b1be7aaf66225d5","value":50000,"ttl":365}'
dataPayload.create({data: data}, function (err, payloads) {
if (err) { } // TODO
dataPayload.decode(payloads, function (err, decodedData) {
if (err) { } // TODO
expect(decodedData).toBe(data)
done()
})
})
})
it('should create a data payload for some 30 byte data and then decode it', function (done) {

@@ -165,3 +177,3 @@ var data = loremIpsum.slice(0, 30)

if (err) { } // TODO
expect(data).toBe(decodedData)
expect(decodedData).toBe(data)
done()

@@ -172,3 +184,3 @@ })

it('should create a data payload for some 30 byte data and then decode it', function (done) {
it('should create a data payload for some 78 byte data and then decode it', function (done) {
var data = loremIpsum.slice(0, 78)

@@ -179,3 +191,3 @@ dataPayload.create({data: data}, function (err, payloads) {

if (err) { } // TODO
expect(data).toBe(decodedData)
expect(decodedData).toBe(data)
done()

@@ -192,3 +204,3 @@ })

if (err) { } // TODO
expect(data).toBe(decodedData)
expect(decodedData).toBe(data)
done()

@@ -195,0 +207,0 @@ })

@@ -150,3 +150,3 @@ /* global jasmine, it, expect, describe */

if (err) { } // TODO
expect(addresses[0]).toBe('msLoJikUfxbc2U5UhRSjc2svusBSqMdqxZ')
expect(addresses[0]).toBe('mwaj74EideMcpe4cjieuPFpqacmpjtKSk1')
expect(data).toBe('{"op":"t","value":50000000,"sha1":"dd09da17ec523e92e38b5f141d9625a5e77bb9fa"}')

@@ -153,0 +153,0 @@ expect(primaryTx.txid).toBe(txid)

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