iota-tangle
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -10,5 +10,11 @@ "use strict"; | ||
createTransactionFromBytes(bytes) { | ||
if (bytes.byteLength !== transaction_1.Transaction.BYTES_SIZE) { | ||
throw new Error('Bytes size is incorrect!'); | ||
} | ||
return transaction_1.Transaction.createFromBytes(bytes, this._serializer); | ||
} | ||
createHashFromBytes(bytes) { | ||
if (bytes.byteLength !== hash_1.Hash.BYTES_SIZE) { | ||
throw new Error('Bytes size is incorrect!'); | ||
} | ||
return hash_1.Hash.createFromBytes(bytes); | ||
@@ -15,0 +21,0 @@ } |
@@ -5,5 +5,2 @@ "use strict"; | ||
static createFromBytes(bytes) { | ||
if (bytes.byteLength !== Hash.BYTES_SIZE) { | ||
throw new Error('Bytes size is incorrect!'); | ||
} | ||
const hash = new Hash(); | ||
@@ -10,0 +7,0 @@ hash._bytes = bytes; |
@@ -5,5 +5,2 @@ "use strict"; | ||
static createFromBytes(bytes, serializer) { | ||
if (bytes.byteLength !== Transaction.BYTES_SIZE) { | ||
throw new Error('Bytes size is incorrect!'); | ||
} | ||
const transaction = new Transaction(); | ||
@@ -10,0 +7,0 @@ transaction._serializer = serializer; |
{ | ||
"name": "iota-tangle", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Basic models and services for IOTA's tangle", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -18,2 +18,6 @@ import { Transaction } from './transaction' | ||
createTransactionFromBytes(bytes: Buffer): Transaction { | ||
if (bytes.byteLength !== Transaction.BYTES_SIZE) { | ||
throw new Error('Bytes size is incorrect!') | ||
} | ||
return Transaction.createFromBytes(bytes, this._serializer) | ||
@@ -23,4 +27,8 @@ } | ||
createHashFromBytes(bytes: Buffer): Hash { | ||
if (bytes.byteLength !== Hash.BYTES_SIZE) { | ||
throw new Error('Bytes size is incorrect!') | ||
} | ||
return Hash.createFromBytes(bytes) | ||
} | ||
} |
@@ -5,6 +5,2 @@ export class Hash { | ||
static createFromBytes(bytes: Buffer): Hash { | ||
if (bytes.byteLength !== Hash.BYTES_SIZE) { | ||
throw new Error('Bytes size is incorrect!') | ||
} | ||
const hash = new Hash() | ||
@@ -11,0 +7,0 @@ |
@@ -8,6 +8,2 @@ import { Serializer } from './serializer' | ||
static createFromBytes(bytes: Buffer, serializer: Serializer): Transaction { | ||
if (bytes.byteLength !== Transaction.BYTES_SIZE) { | ||
throw new Error('Bytes size is incorrect!') | ||
} | ||
const transaction = new Transaction() | ||
@@ -14,0 +10,0 @@ |
19663