cc-assetid-encoder
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -28,6 +28,6 @@ var cs = require('coinstring') | ||
module.exports = function (bitcoinTransaction) { | ||
if (!bitcoinTransaction.cc_metadata) throw new Error('Missing Colored Coin Metadata') | ||
if (bitcoinTransaction.cc_metadata[0].type !== 'issuance') throw new Error('Not An issuance transaction') | ||
if (typeof bitcoinTransaction.cc_metadata[0].lockStatus === 'undefined') throw new Error('Missing Lock Status data') | ||
var lockStatus = bitcoinTransaction.cc_metadata.lockStatus | ||
if (!bitcoinTransaction.cc_data) throw new Error('Missing Colored Coin Metadata') | ||
if (bitcoinTransaction.cc_data[0].type !== 'issuance') throw new Error('Not An issuance transaction') | ||
if (typeof bitcoinTransaction.cc_data[0].lockStatus === 'undefined') throw new Error('Missing Lock Status data') | ||
var lockStatus = bitcoinTransaction.cc_data.lockStatus | ||
var firstInput = bitcoinTransaction.vin[0] | ||
@@ -34,0 +34,0 @@ if (lockStatus) return createId(firstInput.txid + '-' + firstInput.vout, LOCKEPADDING) |
{ | ||
"name": "cc-assetid-encoder", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Creates an Asset Id for Issuance transaction", | ||
@@ -5,0 +5,0 @@ "main": "assetIdEncoder.js", |
@@ -20,3 +20,3 @@ # AssetID-Encoder | ||
{ | ||
'cc_metadata': [{ | ||
'cc_data': [{ | ||
'type': 'issuance', | ||
@@ -49,3 +49,3 @@ 'lockStatus': false, | ||
var bitcoinTransaction = { | ||
'cc_metadata': [{ | ||
'cc_data': [{ | ||
'type': 'issuance', | ||
@@ -52,0 +52,0 @@ 'lockStatus': false, |
@@ -8,3 +8,3 @@ var assetId = require(__dirname + '/../assetIdEncoder') | ||
'txid': 'bc1083ff98873050d2fa9d38823057f0125161ecad43ab2e2dcd1dd3c2668fb7', | ||
'cc_metadata': [{ | ||
'cc_data': [{ | ||
'protocol': 17219, | ||
@@ -81,3 +81,3 @@ 'version': 1, | ||
it('should return Locked asset ID', function (done) { | ||
bitcoinTransaction.cc_metadata.lockStatus = true | ||
bitcoinTransaction.cc_data.lockStatus = true | ||
assetId2 = assetId(bitcoinTransaction) | ||
@@ -91,3 +91,3 @@ assert.equal(assetId2[0], 'L', 'Should be Locked') | ||
bitcoinTransaction = { | ||
cc_metadata: | ||
cc_data: | ||
[{ | ||
@@ -112,3 +112,3 @@ type: 'issuance', | ||
bitcoinTransaction = { | ||
cc_metadata: | ||
cc_data: | ||
[{ | ||
@@ -134,3 +134,3 @@ type: 'issuance', | ||
bitcoinTransaction = { | ||
cc_metadata: | ||
cc_data: | ||
[{ | ||
@@ -154,3 +154,3 @@ type: 'issuance', | ||
bitcoinTransaction = { | ||
cc_metadata: | ||
cc_data: | ||
[{ | ||
@@ -174,3 +174,3 @@ type: 'issuance', | ||
bitcoinTransaction = { | ||
cc_metadata: | ||
cc_data: | ||
[{ | ||
@@ -177,0 +177,0 @@ type: 'issuance', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12438